mirror of
https://github.com/minetest-mods/MoreMesecons.git
synced 2025-01-09 17:30:24 +01: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.
|
||||
* `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.
|
||||
* `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).
|
||||
* `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,10 +41,13 @@ local teleport_nearest = function(pos)
|
||||
end
|
||||
end
|
||||
if newpos.x then
|
||||
if vector.distance(newpos, nearest:getpos()) > MAX_DISTANCE then return end
|
||||
nearest:moveto(newpos)
|
||||
minetest.log("action", "Player "..nearest:get_player_name().." was teleport with a MoreMesecons Teleporter.")
|
||||
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)
|
||||
minetest.log("action", "Player "..nearest:get_player_name().." was teleport with a MoreMesecons Teleporter.")
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
|
Loading…
Reference in New Issue
Block a user