mirror of
https://github.com/minetest-mods/MoreMesecons.git
synced 2024-08-20 13:14:04 +02:00
Add a new functionnality to the teleporter
This commit is contained in:
parent
77efe403ff
commit
e1385f76ff
@ -16,6 +16,6 @@ MoreMesecons is a mod for minetest wich add some mesecons items.
|
|||||||
* `Sayer` : This node sends a message to every players inside a radius of 8 nodes.
|
* `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 ti 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 ti receives a signal on its pin "O", it turns off.
|
||||||
* `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.
|
* `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` : Place two teleporters on the same axis. If one receives a mesecons signal, it teleports the nearest player on the second.
|
* `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.
|
||||||
* `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).
|
* `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).
|
||||||
* `Wireless` : Place 2 (or more) wireless somewhere. Change their channel by right-click. If you send a signal to a wireless, every wireless wich have the same channel will send the signal.
|
* `Wireless` : Place 2 (or more) wireless somewhere. Change their channel by right-click. If you send a signal to a wireless, every wireless wich have the same channel will send the signal.
|
||||||
|
@ -41,11 +41,14 @@ local teleport_nearest = function(pos)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if newpos.x then
|
if newpos.x then
|
||||||
if vector.distance(newpos, nearest:getpos()) > MAX_DISTANCE then return end
|
if vector.distance(newpos, nearest:getpos()) > MAX_DISTANCE then newpos = {} end -- If the is another teleporter BUT too far, delete newpos.
|
||||||
|
end
|
||||||
|
if not newpos.x then
|
||||||
|
newpos = {x=pos.x, y=pos.y+1, z=pos.z} -- If newpos doesn't exist, teleport on the actual teleporter.
|
||||||
|
end
|
||||||
nearest:moveto(newpos)
|
nearest:moveto(newpos)
|
||||||
minetest.log("action", "Player "..nearest:get_player_name().." was teleport with a MoreMesecons Teleporter.")
|
minetest.log("action", "Player "..nearest:get_player_name().." was teleport with a MoreMesecons Teleporter.")
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "moremesecons_teleporter:teleporter 2",
|
output = "moremesecons_teleporter:teleporter 2",
|
||||||
|
Loading…
Reference in New Issue
Block a user