Merge branch 'master' of https://github.com/kaadmy/pixture
This commit is contained in:
commit
4f8a32144d
|
@ -22,17 +22,17 @@ minetest.register_node(
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -0.5, -0.5, 0.5, 2/16, 0.5},
|
{-0.5, -0.5, -0.5, 0.5, 2/16, 0.5}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -0.5, -0.5, 0.5, 2/16, 1.5},
|
{-0.5, -0.5, -0.5, 0.5, 2/16, 1.5}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
after_place_node = function(pos, placer, itemstack)
|
after_place_node = function(pos, placer, itemstack)
|
||||||
local node = minetest.env:get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local p = {x = pos.x, y = pos.y, z = pos.z}
|
local p = {x = pos.x, y = pos.y, z = pos.z}
|
||||||
local param2 = node.param2
|
local param2 = node.param2
|
||||||
node.name = "bed:bed_head"
|
node.name = "bed:bed_head"
|
||||||
|
@ -45,16 +45,16 @@ minetest.register_node(
|
||||||
elseif param2 == 3 then
|
elseif param2 == 3 then
|
||||||
pos.x = pos.x - 1
|
pos.x = pos.x - 1
|
||||||
end
|
end
|
||||||
if minetest.registered_nodes[minetest.env:get_node(pos).name].buildable_to then
|
if minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then
|
||||||
minetest.env:set_node(pos, node)
|
minetest.set_node(pos, node)
|
||||||
else
|
else
|
||||||
minetest.env:remove_node(p)
|
minetest.remove_node(p)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
local node = minetest.env:get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local param2 = node.param2
|
local param2 = node.param2
|
||||||
if param2 == 0 then
|
if param2 == 0 then
|
||||||
pos.z = pos.z+1
|
pos.z = pos.z+1
|
||||||
|
@ -65,10 +65,11 @@ minetest.register_node(
|
||||||
elseif param2 == 3 then
|
elseif param2 == 3 then
|
||||||
pos.x = pos.x-1
|
pos.x = pos.x-1
|
||||||
end
|
end
|
||||||
if (minetest.env:get_node({x = pos.x, y = pos.y, z = pos.z}).name == "bed:bed_head") then
|
|
||||||
if (minetest.env:get_node({x = pos.x, y = pos.y, z = pos.z}).param2 == param2) then
|
local head_node = minetest.get_node(pos)
|
||||||
minetest.env:remove_node(pos)
|
if head_node.name == "bed:bed_head"
|
||||||
end
|
and head_node.param2 == param2 then
|
||||||
|
minetest.remove_node(pos)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ minetest.register_node(
|
||||||
or not minetest.is_singleplayer()
|
or not minetest.is_singleplayer()
|
||||||
and not minetest.setting_getbool("bed_enabled") then return end
|
and not minetest.setting_getbool("bed_enabled") then return end
|
||||||
|
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local param2 = node.param2
|
local param2 = node.param2
|
||||||
if param2 == 0 then
|
if param2 == 0 then
|
||||||
pos.z = pos.z + 0.5
|
pos.z = pos.z + 0.5
|
||||||
|
@ -194,11 +195,11 @@ minetest.register_globalstep(
|
||||||
|
|
||||||
local players = #minetest.get_connected_players()
|
local players = #minetest.get_connected_players()
|
||||||
if players ~= 0 and players * 0.5 < sleeping_players then
|
if players ~= 0 and players * 0.5 < sleeping_players then
|
||||||
if minetest.env:get_timeofday() < 0.2 or minetest.env:get_timeofday() > 0.8 then
|
if minetest.get_timeofday() < 0.2 or minetest.get_timeofday() > 0.8 then
|
||||||
if not wait then
|
if not wait then
|
||||||
minetest.chat_send_all("[zzz] " .. sleeping_players .. " of " .. players .. " players slept, skipping to day.")
|
minetest.chat_send_all("[zzz] " .. sleeping_players .. " of " .. players .. " players slept, skipping to day.")
|
||||||
minetest.after(2, function()
|
minetest.after(2, function()
|
||||||
minetest.env:set_timeofday(0.23)
|
minetest.set_timeofday(0.23)
|
||||||
wait = false
|
wait = false
|
||||||
end)
|
end)
|
||||||
wait = true
|
wait = true
|
||||||
|
@ -229,4 +230,4 @@ minetest.register_on_leaveplayer(
|
||||||
players_in_bed[player:get_player_name()] = nil
|
players_in_bed[player:get_player_name()] = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
default.log("mod:bed", "loaded")
|
default.log("mod:bed", "loaded")
|
||||||
|
|
Loading…
Reference in New Issue