Compare commits

...

4 Commits

Author SHA1 Message Date
teverse 36fa9e3c0b Fix map 2019-11-21 20:49:24 +00:00
teverse 7583de4509 Doout 2019-11-21 20:44:41 +00:00
teverse 88d44c83bc fixes 2019-11-21 20:38:38 +00:00
teverse c602ae466c Fixes 2019-11-21 20:30:13 +00:00
3 changed files with 57 additions and 8 deletions

View File

@ -10,10 +10,19 @@ require("tevgit:core/client/playerList.lua")
workspace.camera.position = vector3(0, 15, -10)
workspace.camera:lookAt(vector3(0, 0, 0))
-- Stealing camera from workshop
require("tevgit:workshop/controllers/environment/camera.lua")
engine.construct("block", workspace, {
position = vector3(0, 20, 0),
static = false
})
workspace:childAdded(function(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)
engine.networking:toServer("mineBlock", c.position.x/4, c.position.y/4, c.position.z/4)
end
end)

View File

@ -6,11 +6,44 @@ print("Hello Server!")
require("tevgit:core/server/debug.lua")
require("tevgit:core/server/chat.lua")
for _,v in pairs(workspace.children) do
if v.className == "block" then
v:destroy()
end
end
workspace:destroyAllChildren()
local mainLight = engine.construct("light", workspace, {
name = "mainLight",
position = vector3(3, 2, 0),
type = enums.lightType.directional,
rotation = quaternion():setEuler(math.rad(66), 0, 0),
diffuseColour = colour(10, 10, 10),
specularColour = colour(10, 10, 10)
})
engine.construct("block", workspace, {
name = "base",
position = vector3(-72, 0, 0),
size = vector3(100, 1, 100),
colour = colour:fromRGB(75, 163, 57)
})
engine.construct("block", workspace, {
name = "base",
position = vector3(72, 2, 0),
size = vector3(100, 1, 100),
colour = colour:fromRGB(75, 163, 57)
})
engine.construct("block", workspace, {
name = "base",
position = vector3(0, 2, 72),
size = vector3(100, 1, 100),
colour = colour:fromRGB(75, 163, 57)
})
engine.construct("block", workspace, {
name = "base",
position = vector3(0, 2, -72),
size = vector3(100, 1, 100),
colour = colour:fromRGB(75, 163, 57)
})
local minable = {}
@ -35,7 +68,14 @@ local function fillSpace(x, y, z)
static = true
})
setSpaceUsed(x, y, z, block)
-- If we dont set the space as used, it will not be mineable...
-- 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
setSpaceUsed(x, y, z, block)
else
-- this block is not minable, let's make it look different?
block.colour = colour:fromRGB(156, 149, 143)
end
return block
end
@ -83,7 +123,7 @@ engine.networking:bind( "mineBlock", function( client, x, y, z )
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

View File

@ -121,7 +121,7 @@ controller.registerCallback(function()
bounds.max = controller.selection[1].position
for _,v in pairs(controller.selection) do
if type(v.position) == "vector3" then
if type(v.position) == "vector3" and type(v.size) == "vector3" then
bounds:expand(v.position + (v.size/2))
bounds:expand(v.position - (v.size/2))
table.insert(boundingEvents, v:changed(boundUpdate))