mirror of
https://github.com/minetest-mods/MoreMesecons.git
synced 2025-01-09 01:10:22 +01:00
Change the signal changer
This commit is contained in:
parent
acf86e8c69
commit
d86da768aa
@ -19,7 +19,7 @@ MoreMesecons is a mod for minetest wich adds some mesecons items.
|
||||
* `Injector Controller` : This node is usefull to activate/deactivate a pipeworks filter injector : it sends a blinky signal.
|
||||
* `Player Killer` : This block kills the nearest player (with a maximal distance of 8 blocks by default) (if this player isn't its owner) when it receives a mesecons signal.
|
||||
* `Sayer` : This node sends a message to every players inside a radius of 8 nodes.
|
||||
* `Signal Changer` : If it receives a signal on its pin "F", it turns on. If it receives a signal on its pin "O", it turns off.
|
||||
* `Signal Changer` : If it receives a signal on its pin "F", it turns on. If it receives a signal on its pin "O", it turns off. Note : an inverted signal is sended at the other end of the arrow.
|
||||
* `Switch Torch` : It connects just like Mesecons Torch. If it receives a signal, it turns on, and if it receives a second signal, it turns off.
|
||||
* `Teleporter` : If you place one teleporter, if it receives a mesecons, it teleports the nearest player on itself. If you place two teleporters on the same axis, if one receives a mesecons signal, it teleports the nearest player on the second (with a maximal distance of 50 nodes by default). The player teleporter must be inside a radius of 25 nodes.
|
||||
* `Temporary Gate` : If it receives a mesecons signal, whatever its duration, a mesecons signal is send with a fixed duration. You can change it by right-click (in seconds) (you can write for example 0.2 to send a pulse, or 20 to send long signals).
|
||||
|
@ -4,7 +4,8 @@ local nodebox = {
|
||||
}
|
||||
|
||||
local function signalchanger_get_output_rules(node)
|
||||
local rules = {{x=1, y=0, z=0}}
|
||||
local rules = {{x=1, y=0, z=0},
|
||||
{x=-1, y=0, z=0}}
|
||||
for i = 0, node.param2 do
|
||||
rules = mesecon.rotate_rules_left(rules)
|
||||
end
|
||||
@ -25,10 +26,12 @@ local update = function(pos, node, link, newstate)
|
||||
local input_on = meta:get_int("input_on") == 1
|
||||
local input_off = meta:get_int("input_off") == 1
|
||||
if input_on then
|
||||
mesecon.receptor_on(pos, signalchanger_get_output_rules(node))
|
||||
mesecon.receptor_on(pos, {signalchanger_get_output_rules(node)[1]})
|
||||
mesecon.receptor_off(pos, {signalchanger_get_output_rules(node)[2]})
|
||||
minetest.swap_node(pos, {name = "moremesecons_signalchanger:signalchanger_on", param2 = node.param2})
|
||||
elseif input_off then
|
||||
mesecon.receptor_off(pos, signalchanger_get_output_rules(node))
|
||||
mesecon.receptor_off(pos, {signalchanger_get_output_rules(node)[1]})
|
||||
mesecon.receptor_on(pos, {signalchanger_get_output_rules(node)[2]})
|
||||
minetest.swap_node(pos, {name = "moremesecons_signalchanger:signalchanger_off", param2 = node.param2})
|
||||
end
|
||||
end
|
||||
@ -46,7 +49,6 @@ mesecon.register_node("moremesecons_signalchanger:signalchanger", {
|
||||
groups = {dig_immediate = 2},
|
||||
mesecons = {
|
||||
receptor = {
|
||||
state = mesecon.state.off,
|
||||
rules = signalchanger_get_output_rules
|
||||
},
|
||||
effector = {
|
||||
@ -55,11 +57,14 @@ mesecon.register_node("moremesecons_signalchanger:signalchanger", {
|
||||
},
|
||||
},
|
||||
tiles = {"moremesecons_signalchanger_off.png"},
|
||||
on_construct = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
mesecon.receptor_on(pos, {signalchanger_get_output_rules(node)[2]})
|
||||
end
|
||||
},{
|
||||
groups = {dig_immediate = 2, not_in_creative_inventory = 1},
|
||||
mesecons = {
|
||||
receptor = {
|
||||
state = mesecon.state.on,
|
||||
rules = signalchanger_get_output_rules,
|
||||
},
|
||||
effector = {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 112 B After Width: | Height: | Size: 149 B |
Binary file not shown.
Before Width: | Height: | Size: 115 B After Width: | Height: | Size: 149 B |
Loading…
Reference in New Issue
Block a user