1
0
Fork 0

Add on state for observers

This commit is contained in:
Wuzzy 2018-01-10 18:27:47 +01:00
parent 3627b03b2e
commit 916627c6b6
2 changed files with 30 additions and 24 deletions

View File

@ -9,43 +9,48 @@ local get_rules_flat = function(node)
return rules return rules
end end
minetest.register_node("mcl_observers:observer", { mesecon.register_node("mcl_observers:observer",
description = "Observer", {
is_ground_content = false, is_ground_content = false,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
paramtype2 = "facedir", paramtype2 = "facedir",
-- TODO: Add to craft guide and creative inventory when it's useful -- 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 }, 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 = { tiles = {
"mcl_observers_observer_top.png", "default_furnace_bottom.png", "mcl_observers_observer_top.png", "default_furnace_bottom.png",
"mcl_observers_observer_side.png", "mcl_observers_observer_side.png", "mcl_observers_observer_side.png", "mcl_observers_observer_side.png",
"mcl_observers_observer_front.png", "mcl_observers_observer_back.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 -- TODO: Mesecons handling
mesecons = {effector = { mesecons = { receptor = {
state = mesecon.state.off,
rules = get_rules_flat, 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({ minetest.register_craft({
output = "mcl_observers:observer", output = "mcl_observers:observer_off",
recipe = { recipe = {
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" }, { "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
{ "mcl_nether:quartz", "mesecons:redstone", "mesecons:redstone" }, { "mcl_nether:quartz", "mesecons:redstone", "mesecons:redstone" },
@ -53,7 +58,7 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "mcl_observers:observer", output = "mcl_observers:observer_off",
recipe = { recipe = {
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" }, { "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
{ "mesecons:redstone", "mesecons:redstone", "mcl_nether:quartz" }, { "mesecons:redstone", "mesecons:redstone", "mcl_nether:quartz" },

View File

@ -8,7 +8,8 @@ local wip_items = {
"mcl_fishing:fishing_rod", "mcl_fishing:fishing_rod",
"mcl_maps:empty_map", "mcl_maps:empty_map",
"gemalde:node_1", "gemalde:node_1",
"mcl_observers:observer", "mcl_observers:observer_off",
"mcl_observers:observer_on",
"mcl_chests:trapped_chest", "mcl_chests:trapped_chest",
"mobs_mc:totem", "mobs_mc:totem",
"mcl_paintings:painting", "mcl_paintings:painting",