Compare commits

..

No commits in common. "cdb0134b4115fcdfd40e8f389f70c564f1f6fc0a" and "e51f49eb6ad6fe61082f0c8809439ed0460501f2" have entirely different histories.

2 changed files with 36 additions and 46 deletions

View File

@ -15,7 +15,7 @@ local function registerBlock(c)
if c.className == "block" then
c:once("mouseLeftPressed", function ()
if c.size == vector3(4, 4, 4) then
--print("mining", c.position.x/4, c.position.y/4, c.position.z/4)
print("mining", c.position.x/4, c.position.y/4, c.position.z/4)
engine.networking:toServer("mineBlock", c.position.x/4, c.position.y/4, c.position.z/4)
end
end)

View File

@ -13,43 +13,35 @@ local mainLight = engine.construct("light", workspace, {
position = vector3(3, 2, 0),
type = enums.lightType.directional,
rotation = quaternion():setEuler(math.rad(66), 0, 0),
diffuseColour = colour(1, 1, 1),
specularColour = colour(1, 1, 1)
})
local pointLight = engine.construct("light", workspace, {
name = "pointLight",
position = vector3(0, 1, 0),
type = enums.lightType.point,
diffuseColour = colour(10, 10, 10),
radius = 20
specularColour = colour(10, 10, 10)
})
engine.construct("block", workspace, {
name = "base",
position = vector3(-72, 2.25, 0),
size = vector3(100, 0.5, 44),
position = vector3(-72, 2, 0),
size = vector3(100, 0.5, 100),
colour = colour:fromRGB(75, 163, 57)
})
engine.construct("block", workspace, {
name = "base",
position = vector3(72, 2.25, 0),
size = vector3(100, 0.5, 44),
position = vector3(72, 2, 0),
size = vector3(100, 0.5, 100),
colour = colour:fromRGB(75, 163, 57)
})
engine.construct("block", workspace, {
name = "base",
position = vector3(0, 2.25, 72),
size = vector3(200, 0.5, 100),
position = vector3(0, 2, 72),
size = vector3(100, 0.5, 100),
colour = colour:fromRGB(75, 163, 57)
})
engine.construct("block", workspace, {
name = "base",
position = vector3(0, 2.25, -72),
size = vector3(200, 0.5, 100),
position = vector3(0, 2, -72),
size = vector3(100, 0.5, 100),
colour = colour:fromRGB(75, 163, 57)
})
@ -79,7 +71,7 @@ local function fillSpace(x, y, z)
-- If we dont set the space as used, it will not be mineable...
-- Use this to our advantage to set a boundary
if x < 40 and x > -40 and y > -50 and z > -40 and z < 40 then
if x < 20 and x > -20 and y > -20 and z > -20 and z < 20 then
setSpaceUsed(x, y, z, block)
else
-- this block is not minable, let's make it look different?
@ -110,35 +102,33 @@ engine.networking:bind( "mineBlock", function( client, x, y, z )
if type(x) == "number" and type(y) == "number" and type(z) == "number" and isSpaceUsed(x, y, z) then
local block = minable[x][y][z]
if block then
setSpaceUsed(x, y, z, true)
setSpaceUsed(x, y, z, true)
if not isSpaceUsed(x, y - 1, z) then
fillSpace(x, y - 1, z)
end
if not isSpaceUsed(x, y + 1, z) then
fillSpace(x, y + 1, z)
end
if not isSpaceUsed(x - 1, y, z) then
fillSpace(x - 1, y, z)
end
if not isSpaceUsed(x + 1, y, z) then
fillSpace(x + 1, y, z)
end
if not isSpaceUsed(x, y, z - 1) then
fillSpace(x, y, z - 1)
end
if not isSpaceUsed(x, y, z + 1) then
fillSpace(x, y, z + 1)
end
block:destroy()
if not isSpaceUsed(x, y - 1, z) then
fillSpace(x, y - 1, z)
end
if not isSpaceUsed(x, y + 1, z) then
fillSpace(x, y + 1, z)
end
if not isSpaceUsed(x - 1, y, z) then
fillSpace(x - 1, y, z)
end
if not isSpaceUsed(x + 1, y, z) then
fillSpace(x + 1, y, z)
end
if not isSpaceUsed(x, y, z - 1) then
fillSpace(x, y, z - 1)
end
if not isSpaceUsed(x, y, z + 1) then
fillSpace(x, y, z + 1)
end
block:destroy()
end
end)