mirror of https://github.com/teverse/teverse
Compare commits
10 Commits
e51f49eb6a
...
cdb0134b41
Author | SHA1 | Date |
---|---|---|
![]() |
cdb0134b41 | |
![]() |
aceca964c8 | |
![]() |
e38836dad8 | |
![]() |
03e2e981c0 | |
![]() |
2e74f88798 | |
![]() |
24c710baf7 | |
![]() |
e8ca464058 | |
![]() |
bb8bf31c16 | |
![]() |
959f05c0fc | |
![]() |
3858d06826 |
|
@ -15,7 +15,7 @@ local function registerBlock(c)
|
||||||
if c.className == "block" then
|
if c.className == "block" then
|
||||||
c:once("mouseLeftPressed", function ()
|
c:once("mouseLeftPressed", function ()
|
||||||
if c.size == vector3(4, 4, 4) then
|
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)
|
engine.networking:toServer("mineBlock", c.position.x/4, c.position.y/4, c.position.z/4)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -13,35 +13,43 @@ local mainLight = engine.construct("light", workspace, {
|
||||||
position = vector3(3, 2, 0),
|
position = vector3(3, 2, 0),
|
||||||
type = enums.lightType.directional,
|
type = enums.lightType.directional,
|
||||||
rotation = quaternion():setEuler(math.rad(66), 0, 0),
|
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),
|
diffuseColour = colour(10, 10, 10),
|
||||||
specularColour = colour(10, 10, 10)
|
radius = 20
|
||||||
})
|
})
|
||||||
|
|
||||||
engine.construct("block", workspace, {
|
engine.construct("block", workspace, {
|
||||||
name = "base",
|
name = "base",
|
||||||
position = vector3(-72, 2, 0),
|
position = vector3(-72, 2.25, 0),
|
||||||
size = vector3(100, 0.5, 100),
|
size = vector3(100, 0.5, 44),
|
||||||
colour = colour:fromRGB(75, 163, 57)
|
colour = colour:fromRGB(75, 163, 57)
|
||||||
})
|
})
|
||||||
|
|
||||||
engine.construct("block", workspace, {
|
engine.construct("block", workspace, {
|
||||||
name = "base",
|
name = "base",
|
||||||
position = vector3(72, 2, 0),
|
position = vector3(72, 2.25, 0),
|
||||||
size = vector3(100, 0.5, 100),
|
size = vector3(100, 0.5, 44),
|
||||||
colour = colour:fromRGB(75, 163, 57)
|
colour = colour:fromRGB(75, 163, 57)
|
||||||
})
|
})
|
||||||
|
|
||||||
engine.construct("block", workspace, {
|
engine.construct("block", workspace, {
|
||||||
name = "base",
|
name = "base",
|
||||||
position = vector3(0, 2, 72),
|
position = vector3(0, 2.25, 72),
|
||||||
size = vector3(100, 0.5, 100),
|
size = vector3(200, 0.5, 100),
|
||||||
colour = colour:fromRGB(75, 163, 57)
|
colour = colour:fromRGB(75, 163, 57)
|
||||||
})
|
})
|
||||||
|
|
||||||
engine.construct("block", workspace, {
|
engine.construct("block", workspace, {
|
||||||
name = "base",
|
name = "base",
|
||||||
position = vector3(0, 2, -72),
|
position = vector3(0, 2.25, -72),
|
||||||
size = vector3(100, 0.5, 100),
|
size = vector3(200, 0.5, 100),
|
||||||
colour = colour:fromRGB(75, 163, 57)
|
colour = colour:fromRGB(75, 163, 57)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -71,7 +79,7 @@ local function fillSpace(x, y, z)
|
||||||
|
|
||||||
-- If we dont set the space as used, it will not be mineable...
|
-- If we dont set the space as used, it will not be mineable...
|
||||||
-- Use this to our advantage to set a boundary
|
-- Use this to our advantage to set a boundary
|
||||||
if x < 20 and x > -20 and y > -20 and z > -20 and z < 20 then
|
if x < 40 and x > -40 and y > -50 and z > -40 and z < 40 then
|
||||||
setSpaceUsed(x, y, z, block)
|
setSpaceUsed(x, y, z, block)
|
||||||
else
|
else
|
||||||
-- this block is not minable, let's make it look different?
|
-- this block is not minable, let's make it look different?
|
||||||
|
@ -102,33 +110,35 @@ 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
|
if type(x) == "number" and type(y) == "number" and type(z) == "number" and isSpaceUsed(x, y, z) then
|
||||||
local block = minable[x][y][z]
|
local block = minable[x][y][z]
|
||||||
|
|
||||||
setSpaceUsed(x, y, z, true)
|
if block then
|
||||||
|
setSpaceUsed(x, y, z, true)
|
||||||
|
|
||||||
if not isSpaceUsed(x, y - 1, z) then
|
if not isSpaceUsed(x, y - 1, z) then
|
||||||
fillSpace(x, y - 1, z)
|
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
|
||||||
|
|
||||||
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
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue