It's a 3 step process

And now these things are ready on the fork.  Let's go make some people berrry happy.
This commit is contained in:
DoogMitt 2018-06-15 14:12:40 -08:00 committed by GitHub
parent d7219b8ae9
commit fc0c478687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ local mesewire_rules =
{x = 0, y = 0, z =-1}, {x = 0, y = 0, z =-1},
} }
-- The sweet taste of a default override
minetest.override_item("default:mese", { minetest.override_item("default:mese", {
mesecons = {conductor = { mesecons = {conductor = {
state = mesecon.state.off, state = mesecon.state.off,
@ -16,22 +17,57 @@ minetest.override_item("default:mese", {
}} }}
}) })
-- Copy node definition of powered mese from normal mese -- Now I got my own sweet Mese pixels, let's use those
-- and brighten texture tiles to indicate mese is powered minetest.register_node("mesecons_extrawires:mese_powered", {
local powered_def = mesecon.mergetable(minetest.registered_nodes["default:mese"], { description = "Meseblock On",
tiles = {"mesecons_meseblock_on.png"},
light_source = 6,
drop = "default:mese", drop = "default:mese",
light_source = 5, is_ground_content = false,
groups = {cracky = 3, level = 2},
mesecons = {conductor = { mesecons = {conductor = {
state = mesecon.state.on, state = mesecon.state.on,
offstate = "default:mese", offstate = "default:mese",
rules = mesewire_rules rules = mesewire_rules
}}, }}
groups = {cracky = 1, not_in_creative_inventory = 1},
on_blast = mesecon.on_blastnode,
}) })
for i, v in pairs(powered_def.tiles) do -- And now for some insanity
powered_def.tiles[i] = v .. "^[brighten" -- Lets add an Off state CobbleCon here
end minetest.register_node("mesecons_extrawires:mese_cobble_off", {
description = "Mese Cobble Off",
tiles = {"mesecons_cobblecon_off.png"},
is_ground_content = false,
groups = {cracky = 3, level = 2},
mesecons = {conductor = {
state = mesecon.state.off,
onstate = "mesecons_extrawires:mese_cobble_on",
rules = mesewire_rules
}}
})
minetest.register_node("mesecons_extrawires:mese_powered", powered_def) -- Finishing strange with an On state Cobblecon here
minetest.register_node("mesecons_extrawires:mese_cobble_on", {
description = "Mese Cobble On",
tiles = {"mesecons_cobblecon_on.png"},
light_source = 4,
drop = "mesecons_extrawires:mese_cobble_off",
is_ground_content = false,
groups = {cracky = 3, level = 2},
mesecons = {conductor = {
state = mesecon.state.on,
offstate = "mesecons_extrawires:mese_cobble_off",
rules = mesewire_rules
}}
})
-- Ok ok, get out of the kitchen you, here's the recipe
minetest.register_craft({
output = 'mesecons_extrawires:mese_cobble_off 5',
recipe = {
{'default:cobble', 'mesecons:wire_00000000_off', 'default:cobble'},
{'mesecons:wire_00000000_off', 'default:cobble', 'mesecons:wire_00000000_off'},
{'default:cobble', 'mesecons:wire_00000000_off', 'default:cobble'},
}
})