forked from MineClone5/MineClone5
Add on state for observers
This commit is contained in:
parent
3627b03b2e
commit
916627c6b6
|
@ -9,43 +9,48 @@ local get_rules_flat = function(node)
|
|||
return rules
|
||||
end
|
||||
|
||||
minetest.register_node("mcl_observers:observer", {
|
||||
description = "Observer",
|
||||
mesecon.register_node("mcl_observers:observer",
|
||||
{
|
||||
is_ground_content = false,
|
||||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||
paramtype2 = "facedir",
|
||||
-- TODO: Add to craft guide and creative inventory when it's useful
|
||||
groups = {pickaxey=1, not_in_craft_guide=1, not_in_creative_inventory=1 },
|
||||
on_rotate = false,
|
||||
_mcl_blast_resistance = 17.5,
|
||||
_mcl_hardness = 3.5,
|
||||
},
|
||||
{
|
||||
description = "Observer",
|
||||
tiles = {
|
||||
"mcl_observers_observer_top.png", "default_furnace_bottom.png",
|
||||
"mcl_observers_observer_side.png", "mcl_observers_observer_side.png",
|
||||
"mcl_observers_observer_front.png", "mcl_observers_observer_back.png",
|
||||
},
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta2 = meta
|
||||
meta:from_table(oldmetadata)
|
||||
local inv = meta:get_inventory()
|
||||
for i=1, inv:get_size("main") do
|
||||
local stack = inv:get_stack("main", i)
|
||||
if not stack:is_empty() then
|
||||
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
|
||||
minetest.add_item(p, stack)
|
||||
end
|
||||
end
|
||||
meta:from_table(meta2:to_table())
|
||||
end,
|
||||
_mcl_blast_resistance = 17.5,
|
||||
_mcl_hardness = 3.5,
|
||||
-- TODO: Mesecons handling
|
||||
mesecons = {effector = {
|
||||
mesecons = { receptor = {
|
||||
state = mesecon.state.off,
|
||||
rules = get_rules_flat,
|
||||
}},
|
||||
on_rotate = false,
|
||||
})
|
||||
},
|
||||
{
|
||||
_doc_items_create_entry = false,
|
||||
tiles = {
|
||||
"mcl_observers_observer_top.png", "default_furnace_bottom.png",
|
||||
"mcl_observers_observer_side.png", "mcl_observers_observer_side.png",
|
||||
"mcl_observers_observer_front.png", "mcl_observers_observer_back_lit.png",
|
||||
},
|
||||
-- TODO: Mesecons handling
|
||||
mesecons = { receptor = {
|
||||
state = mesecon.state.on,
|
||||
rules = get_rules_flat,
|
||||
}},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_observers:observer",
|
||||
output = "mcl_observers:observer_off",
|
||||
recipe = {
|
||||
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
|
||||
{ "mcl_nether:quartz", "mesecons:redstone", "mesecons:redstone" },
|
||||
|
@ -53,7 +58,7 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "mcl_observers:observer",
|
||||
output = "mcl_observers:observer_off",
|
||||
recipe = {
|
||||
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
|
||||
{ "mesecons:redstone", "mesecons:redstone", "mcl_nether:quartz" },
|
||||
|
|
|
@ -8,7 +8,8 @@ local wip_items = {
|
|||
"mcl_fishing:fishing_rod",
|
||||
"mcl_maps:empty_map",
|
||||
"gemalde:node_1",
|
||||
"mcl_observers:observer",
|
||||
"mcl_observers:observer_off",
|
||||
"mcl_observers:observer_on",
|
||||
"mcl_chests:trapped_chest",
|
||||
"mobs_mc:totem",
|
||||
"mcl_paintings:painting",
|
||||
|
|
Loading…
Reference in New Issue