forked from MineClone5/MineClone5
Rework core rules of most redstone components
This commit is contained in:
parent
7626102bdb
commit
f612d1b584
|
@ -53,7 +53,9 @@ register_rail("mcl_minecarts:golden_rail",
|
|||
mesecons = {
|
||||
conductor = {
|
||||
state = mesecon.state.off,
|
||||
offstate = "mcl_minecarts:golden_rail",
|
||||
onstate = "mcl_minecarts:golden_rail_on",
|
||||
rules = mesecon.rules.alldirs,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -69,6 +71,8 @@ register_rail("mcl_minecarts:golden_rail_on",
|
|||
conductor = {
|
||||
state = mesecon.state.on,
|
||||
offstate = "mcl_minecarts:golden_rail",
|
||||
onstate = "mcl_minecarts:golden_rail_on",
|
||||
rules = mesecon.rules.alldirs,
|
||||
},
|
||||
},
|
||||
drop = "mcl_minecarts:golden_rail",
|
||||
|
@ -87,7 +91,9 @@ register_rail("mcl_minecarts:activator_rail",
|
|||
mesecons = {
|
||||
conductor = {
|
||||
state = mesecon.state.off,
|
||||
offstate = "mcl_minecarts:activator_rail",
|
||||
onstate = "mcl_minecarts:activator_rail_on",
|
||||
rules = mesecon.rules.alldirs,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -102,6 +108,8 @@ register_rail("mcl_minecarts:activator_rail_on",
|
|||
conductor = {
|
||||
state = mesecon.state.on,
|
||||
offstate = "mcl_minecarts:activator_rail",
|
||||
onstate = "mcl_minecarts:activator_rail_on",
|
||||
rules = mesecon.rules.alldirs,
|
||||
},
|
||||
},
|
||||
drop = "mcl_minecarts:activator_rail",
|
||||
|
@ -119,6 +127,7 @@ register_rail("mcl_minecarts:detector_rail",
|
|||
mesecons = {
|
||||
receptor = {
|
||||
state = mesecon.state.off,
|
||||
rules = mesecon.rules.pplate,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -132,6 +141,7 @@ register_rail("mcl_minecarts:detector_rail_on",
|
|||
mesecons = {
|
||||
receptor = {
|
||||
state = mesecon.state.on,
|
||||
rules = mesecon.rules.pplate,
|
||||
},
|
||||
},
|
||||
drop = "mcl_minecarts:detector_rail",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-- Functions that get the input/output rules of the comparator
|
||||
|
||||
local comparator_get_output_rules = function(node)
|
||||
local rules = {{x = -1, y = 0, z = 0}}
|
||||
local rules = {{x = -1, y = 0, z = 0, spread=true}}
|
||||
for i = 0, node.param2 do
|
||||
rules = mesecon.rotate_rules_left(rules)
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
local rules_flat = {
|
||||
{ x = 0, y = 0, z = -1 },
|
||||
{ x = 0, y = 0, z = -1, spread = true },
|
||||
}
|
||||
local get_rules_flat = function(node)
|
||||
local rules = rules_flat
|
||||
|
@ -9,8 +9,8 @@ local get_rules_flat = function(node)
|
|||
return rules
|
||||
end
|
||||
|
||||
local rules_down = {{ x = 0, y = 1, z = 0 }}
|
||||
local rules_up = {{ x = 0, y = -1, z = 0 }}
|
||||
local rules_down = {{ x = 0, y = 1, z = 0, spread = true }}
|
||||
local rules_up = {{ x = 0, y = -1, z = 0, spread = true }}
|
||||
|
||||
-- Scan the node in front of the observer
|
||||
-- and update the observer state if needed.
|
||||
|
@ -36,13 +36,13 @@ local observer_scan = function(pos, initialize)
|
|||
-- Node state changed! Activate observer
|
||||
if node.name == "mcl_observers:observer_off" then
|
||||
minetest.set_node(pos, {name = "mcl_observers:observer_on", param2 = node.param2})
|
||||
mesecon.receptor_on(pos)
|
||||
mesecon.receptor_on(pos, get_rules_flat(node))
|
||||
elseif node.name == "mcl_observers:observer_down_off" then
|
||||
minetest.set_node(pos, {name = "mcl_observers:observer_down_on"})
|
||||
mesecon.receptor_on(pos)
|
||||
mesecon.receptor_on(pos, rules_down)
|
||||
elseif node.name == "mcl_observers:observer_up_off" then
|
||||
minetest.set_node(pos, {name = "mcl_observers:observer_up_on"})
|
||||
mesecon.receptor_on(pos)
|
||||
mesecon.receptor_on(pos, rules_up)
|
||||
end
|
||||
meta_needs_updating = true
|
||||
end
|
||||
|
@ -58,12 +58,6 @@ end
|
|||
|
||||
-- Vertical orientation (CURRENTLY DISABLED)
|
||||
local observer_orientate = function(pos, placer)
|
||||
-- Currently, do nothing.
|
||||
-- The vertical observers detect the node correctly, but they have problems with
|
||||
-- transmitting the redstone signal vertically.
|
||||
-- TODO: Re-enable orientation when vertical observers are done.
|
||||
do return end
|
||||
|
||||
-- Not placed by player
|
||||
if not placer then return end
|
||||
|
||||
|
@ -130,7 +124,7 @@ mesecon.register_node("mcl_observers:observer",
|
|||
on_timer = function(pos, elapsed)
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.set_node(pos, {name = "mcl_observers:observer_off", param2 = node.param2})
|
||||
mesecon.receptor_off(pos)
|
||||
mesecon.receptor_off(pos, get_rules_flat(node))
|
||||
end,
|
||||
}
|
||||
)
|
||||
|
@ -179,7 +173,7 @@ mesecon.register_node("mcl_observers:observer_down",
|
|||
on_timer = function(pos, elapsed)
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.set_node(pos, {name = "mcl_observers:observer_down_off", param2 = node.param2})
|
||||
mesecon.receptor_off(pos)
|
||||
mesecon.receptor_off(pos, rules_down)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -226,7 +220,7 @@ mesecon.register_node("mcl_observers:observer_up",
|
|||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
minetest.set_node(pos, {name = "mcl_observers:observer_up_off"})
|
||||
mesecon.receptor_off(pos)
|
||||
mesecon.receptor_off(pos, rules_up)
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ mesecon.rules.default =
|
|||
{x=0, y=-1, z=-1}}
|
||||
|
||||
mesecon.rules.alldirs =
|
||||
{{x= 1, y= 0, z= 0, spread = true},
|
||||
{x=-1, y= 0, z= 0, spread = true},
|
||||
{x= 0, y= 1, z= 0, spread = true},
|
||||
{x= 0, y=-1, z= 0, spread = true},
|
||||
{x= 0, y= 0, z= 1, spread = true},
|
||||
{x= 0, y= 0, z=-1, spread = true}}
|
||||
{{x= 1, y= 0, z= 0},
|
||||
{x=-1, y= 0, z= 0},
|
||||
{x= 0, y= 1, z= 0},
|
||||
{x= 0, y=-1, z= 0},
|
||||
{x= 0, y= 0, z= 1},
|
||||
{x= 0, y= 0, z=-1}}
|
||||
|
||||
mesecon.rules.pplate =
|
||||
{{x = 1, y = 0, z = 0},
|
||||
|
@ -49,13 +49,13 @@ mesecon.rules.flat =
|
|||
{x = 0, y = 0, z =-1}}
|
||||
|
||||
-- NOT IN ORIGNAL MESECONS
|
||||
mesecon.rules.mcl_alldirs_short =
|
||||
{{x= 1, y= 0, z= 0},
|
||||
{x=-1, y= 0, z= 0},
|
||||
{x= 0, y= 1, z= 0},
|
||||
{x= 0, y=-1, z= 0},
|
||||
{x= 0, y= 0, z= 1},
|
||||
{x= 0, y= 0, z=-1}}
|
||||
mesecon.rules.mcl_alldirs_spread =
|
||||
{{x= 1, y= 0, z= 0, spread = true},
|
||||
{x=-1, y= 0, z= 0, spread = true},
|
||||
{x= 0, y= 1, z= 0, spread = true},
|
||||
{x= 0, y=-1, z= 0, spread = true},
|
||||
{x= 0, y= 0, z= 1, spread = true},
|
||||
{x= 0, y= 0, z=-1, spread = true}}
|
||||
|
||||
-- END OF UNOFFICIAL RULES
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Function that get the input/output rules of the delayer
|
||||
local delayer_get_output_rules = function(node)
|
||||
local rules = {{x = -1, y = 0, z = 0}}
|
||||
local rules = {{x = -1, y = 0, z = 0, spread=true}}
|
||||
for i = 0, node.param2 do
|
||||
rules = mesecon.rotate_rules_left(rules)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
local boxes = { -8/16, -8/16, -8/16, 8/16, -2/16, 8/16 } -- Solar Pannel
|
||||
local boxes = { -8/16, -8/16, -8/16, 8/16, -2/16, 8/16 }
|
||||
|
||||
-- Solar Panel
|
||||
-- Daylight Sensor
|
||||
minetest.register_node("mesecons_solarpanel:solar_panel_on", {
|
||||
drawtype = "nodebox",
|
||||
tiles = { "jeija_solar_panel.png","jeija_solar_panel.png","jeija_solar_panel_side.png",
|
||||
|
@ -25,17 +25,16 @@ minetest.register_node("mesecons_solarpanel:solar_panel_on", {
|
|||
sounds = mcl_sounds.node_sound_glass_defaults(),
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.on,
|
||||
rules = mesecon.rules.alldirs,
|
||||
rules = mesecon.rules.pplate,
|
||||
}},
|
||||
on_rightclick = function(pos, node, clicker, pointed_thing)
|
||||
minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_inverted_off"})
|
||||
mesecon.receptor_off(pos)
|
||||
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
||||
end,
|
||||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 0.2,
|
||||
})
|
||||
|
||||
-- Solar Panel
|
||||
minetest.register_node("mesecons_solarpanel:solar_panel_off", {
|
||||
drawtype = "nodebox",
|
||||
tiles = { "jeija_solar_panel.png","jeija_solar_panel.png","jeija_solar_panel_side.png",
|
||||
|
@ -60,11 +59,11 @@ minetest.register_node("mesecons_solarpanel:solar_panel_off", {
|
|||
sounds = mcl_sounds.node_sound_glass_defaults(),
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.off,
|
||||
rules = mesecon.rules.alldirs,
|
||||
rules = mesecon.rules.pplate,
|
||||
}},
|
||||
on_rightclick = function(pos, node, clicker, pointed_thing)
|
||||
minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_inverted_on"})
|
||||
mesecon.receptor_on(pos)
|
||||
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
||||
end,
|
||||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 0.2,
|
||||
|
@ -89,7 +88,7 @@ minetest.register_abm({
|
|||
|
||||
if light >= 12 and minetest.get_timeofday() > 0.2 and minetest.get_timeofday() < 0.8 then
|
||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_on", param2=node.param2})
|
||||
mesecon.receptor_on(pos)
|
||||
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
@ -104,14 +103,13 @@ minetest.register_abm({
|
|||
|
||||
if light < 12 then
|
||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_off", param2=node.param2})
|
||||
mesecon.receptor_off(pos)
|
||||
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
--- Solar panel inversed
|
||||
--- Inverted Daylight Sensor
|
||||
|
||||
-- Solar Panel
|
||||
minetest.register_node("mesecons_solarpanel:solar_panel_inverted_on", {
|
||||
drawtype = "nodebox",
|
||||
tiles = { "jeija_solar_panel_inverted.png","jeija_solar_panel_inverted.png","jeija_solar_panel_side.png",
|
||||
|
@ -135,17 +133,17 @@ minetest.register_node("mesecons_solarpanel:solar_panel_inverted_on", {
|
|||
_doc_items_create_entry = false,
|
||||
sounds = mcl_sounds.node_sound_glass_defaults(),
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.on
|
||||
state = mesecon.state.on,
|
||||
rules = mesecon.rules.pplate,
|
||||
}},
|
||||
on_rightclick = function(pos, node, clicker, pointed_thing)
|
||||
minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_off"})
|
||||
mesecon.receptor_off(pos)
|
||||
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
||||
end,
|
||||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 0.2,
|
||||
})
|
||||
|
||||
-- Solar Panel
|
||||
minetest.register_node("mesecons_solarpanel:solar_panel_inverted_off", {
|
||||
drawtype = "nodebox",
|
||||
tiles = { "jeija_solar_panel_inverted.png","jeija_solar_panel_inverted.png","jeija_solar_panel_side.png",
|
||||
|
@ -170,11 +168,12 @@ minetest.register_node("mesecons_solarpanel:solar_panel_inverted_off", {
|
|||
_doc_items_usagehelp = "Rightclick the daylight sensor to turn it into a daylight sensor.",
|
||||
sounds = mcl_sounds.node_sound_glass_defaults(),
|
||||
mesecons = {receptor = {
|
||||
state = mesecon.state.off
|
||||
state = mesecon.state.off,
|
||||
rules = mesecon.rules.pplate,
|
||||
}},
|
||||
on_rightclick = function(pos, node, clicker, pointed_thing)
|
||||
minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_on"})
|
||||
mesecon.receptor_on(pos)
|
||||
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
||||
end,
|
||||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 0.2,
|
||||
|
@ -190,7 +189,7 @@ minetest.register_abm({
|
|||
|
||||
if light < 12 then
|
||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_inverted_on", param2=node.param2})
|
||||
mesecon.receptor_on(pos)
|
||||
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
@ -205,7 +204,7 @@ minetest.register_abm({
|
|||
|
||||
if light >= 12 and minetest.get_timeofday() > 0.8 and minetest.get_timeofday() < 0.2 then
|
||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_inverted_off", param2=node.param2})
|
||||
mesecon.receptor_off(pos)
|
||||
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -164,20 +164,20 @@ local function register_wires()
|
|||
end
|
||||
|
||||
local rules = {}
|
||||
if (nid[0] == 1) then table.insert(rules, vector.new( 1, 0, 0)) end
|
||||
if (nid[1] == 1) then table.insert(rules, vector.new( 0, 0, 1)) end
|
||||
if (nid[2] == 1) then table.insert(rules, vector.new(-1, 0, 0)) end
|
||||
if (nid[3] == 1) then table.insert(rules, vector.new( 0, 0, -1)) end
|
||||
if (nid[0] == 1) then table.insert(rules, {x=1, y= 0,z= 0, spread=true}) end
|
||||
if (nid[1] == 1) then table.insert(rules, {x=0, y= 0,z= 1, spread=true}) end
|
||||
if (nid[2] == 1) then table.insert(rules, {x=-1,y= 0,z= 0, spread=true}) end
|
||||
if (nid[3] == 1) then table.insert(rules, {x= 0,y= 0,z=-1, spread=true}) end
|
||||
|
||||
if (nid[0] == 1) then table.insert(rules, vector.new( 1, -1, 0)) end
|
||||
if (nid[1] == 1) then table.insert(rules, vector.new( 0, -1, 1)) end
|
||||
if (nid[2] == 1) then table.insert(rules, vector.new(-1, -1, 0)) end
|
||||
if (nid[3] == 1) then table.insert(rules, vector.new( 0, -1, -1)) end
|
||||
if (nid[0] == 1) then table.insert(rules, {x= 1,y=-1,z= 0}) end
|
||||
if (nid[1] == 1) then table.insert(rules, {x= 0,y=-1,z= 1}) end
|
||||
if (nid[2] == 1) then table.insert(rules, {x=-1,y=-1,z= 0}) end
|
||||
if (nid[3] == 1) then table.insert(rules, {x= 0,y=-1,z= -1}) end
|
||||
|
||||
if (nid[4] == 1) then table.insert(rules, vector.new( 1, 1, 0)) end
|
||||
if (nid[5] == 1) then table.insert(rules, vector.new( 0, 1, 1)) end
|
||||
if (nid[6] == 1) then table.insert(rules, vector.new(-1, 1, 0)) end
|
||||
if (nid[7] == 1) then table.insert(rules, vector.new( 0, 1, -1)) end
|
||||
if (nid[4] == 1) then table.insert(rules, {x= 1,y= 1,z= 0}) end
|
||||
if (nid[5] == 1) then table.insert(rules, {x= 0,y= 1,z= 1}) end
|
||||
if (nid[6] == 1) then table.insert(rules, {x=-1,y= 1,z= 0}) end
|
||||
if (nid[7] == 1) then table.insert(rules, {x= 0,y= 1,z= -1}) end
|
||||
|
||||
local meseconspec_off = { conductor = {
|
||||
rules = rules,
|
||||
|
|
|
@ -370,13 +370,7 @@ register_chest("chest",
|
|||
false
|
||||
)
|
||||
|
||||
local trapped_chest_mesecons_rules = {
|
||||
{x = 1, y = 0, z = 0},
|
||||
{x = -1, y = 0, z = 0},
|
||||
{x = 0, y = 0, z = 1},
|
||||
{x = 0, y = 0, z =-1},
|
||||
{x = 0, y =-1, z = 0}
|
||||
}
|
||||
local trapped_chest_mesecons_rules = mesecon.rules.pplate
|
||||
|
||||
register_chest("trapped_chest",
|
||||
"Trapped Chest",
|
||||
|
|
Loading…
Reference in New Issue