Add windowless doors, work to add signs
This commit is contained in:
parent
35a0eaed5c
commit
be87fa3997
@ -14,6 +14,27 @@ local function door_toggle_param2(start, current)
|
||||
end
|
||||
local DOOR_META_PARAM2_NAME = "door_start_param2"
|
||||
|
||||
local function after_place_node(pos, placer)
|
||||
local node = core.get_node(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_int(DOOR_META_PARAM2_NAME, node.param2)
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, node, clicker)
|
||||
local meta = core.get_meta(pos)
|
||||
|
||||
core.swap_node(pos, {
|
||||
name = node.name,
|
||||
param2 = door_toggle_param2(meta:get_int(DOOR_META_PARAM2_NAME), node.param2)
|
||||
})
|
||||
|
||||
core.sound_play({
|
||||
name = "crate_open",
|
||||
gain = 1,
|
||||
pos = pos
|
||||
})
|
||||
end
|
||||
|
||||
PyuTest.make_door = function(name, desc, craftitem, texture, groups, extra)
|
||||
local e = extra or {}
|
||||
|
||||
@ -32,28 +53,28 @@ PyuTest.make_door = function(name, desc, craftitem, texture, groups, extra)
|
||||
selection_box = PyuTest.DOOR_NODEBOX,
|
||||
collision_box = PyuTest.DOOR_NODEBOX,
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local node = core.get_node(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_int(DOOR_META_PARAM2_NAME, node.param2)
|
||||
end,
|
||||
|
||||
on_rightclick = function (pos, node, clicker)
|
||||
local meta = core.get_meta(pos)
|
||||
|
||||
core.swap_node(pos, {
|
||||
name = name,
|
||||
param2 = door_toggle_param2(meta:get_int(DOOR_META_PARAM2_NAME), node.param2)
|
||||
})
|
||||
|
||||
core.sound_play({
|
||||
name = "crate_open",
|
||||
gain = 1,
|
||||
pos = pos
|
||||
})
|
||||
end
|
||||
after_place_node = after_place_node,
|
||||
on_rightclick = on_rightclick
|
||||
}, e))
|
||||
|
||||
local id_windowless = name .. "_windowless"
|
||||
core.register_node(id_windowless, PyuTest.util.tableconcat({
|
||||
description = Translate("Windowless " .. desc),
|
||||
groups = PyuTest.util.tableconcat(groups, {
|
||||
door = 1
|
||||
}),
|
||||
tiles = texture,
|
||||
sounds = PyuTest.make_node_sounds(),
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
node_box = PyuTest.DOOR_NODEBOX,
|
||||
selection_box = PyuTest.DOOR_NODEBOX,
|
||||
collision_box = PyuTest.DOOR_NODEBOX,
|
||||
|
||||
after_place_node = after_place_node,
|
||||
on_rightclick = on_rightclick
|
||||
}, e))
|
||||
|
||||
if craftitem ~= nil then
|
||||
core.register_craft({
|
||||
@ -64,5 +85,13 @@ PyuTest.make_door = function(name, desc, craftitem, texture, groups, extra)
|
||||
{craftitem, craftitem},
|
||||
}
|
||||
})
|
||||
|
||||
core.register_craft({
|
||||
output = id_windowless,
|
||||
recipe = {
|
||||
name, "group:axe"
|
||||
},
|
||||
type = "shapeless"
|
||||
})
|
||||
end
|
||||
end
|
||||
|
3
mods/ITEMS/pyutest_blocks/api/signs.lua
Normal file
3
mods/ITEMS/pyutest_blocks/api/signs.lua
Normal file
@ -0,0 +1,3 @@
|
||||
PyuTest.make_sign = function (name, craftitem, texture, extra)
|
||||
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user