From 9df8c6be6460e250a39e5773eefd963001d62a7b Mon Sep 17 00:00:00 2001 From: palige Date: Mon, 31 Aug 2015 11:25:29 +0200 Subject: [PATCH] Change README.md and fix a bug for teleporter and wireless --- README.md | 10 +++++----- moremesecons_teleporter/init.lua | 10 ++++++++-- moremesecons_wireless/init.lua | 8 +++++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e5076db..74a72c1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # MoreMesecons -Based on Mesecons by Jeija -By @paly2 -With the participation of @LeMagnesium (bugfix), @Ataron (textures), and @JAPP (texture) +Based on Mesecons by Jeija +By @paly2 +With the participation of @LeMagnesium (bugfix), @Ataron (textures), and @JAPP (texture). MoreMesecons is a mod for minetest wich add some mesecons items. @@ -14,6 +14,6 @@ MoreMesecons is a mod for minetest wich add some mesecons items. * `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. * `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` : Both parties teleporters must be on the same axis. +* `Teleporter` : 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` : Put 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. diff --git a/moremesecons_teleporter/init.lua b/moremesecons_teleporter/init.lua index 2dbfea9..001dafc 100644 --- a/moremesecons_teleporter/init.lua +++ b/moremesecons_teleporter/init.lua @@ -1,4 +1,4 @@ -teleporters = {} +local teleporters = {} local register = function(pos) local meta = minetest.env:get_meta(pos) @@ -63,7 +63,13 @@ minetest.register_node("moremesecons_teleporter:teleporter", { sounds = default.node_sound_stone_defaults(), on_construct = function(pos) register(pos) - end + end, + on_destruct = function(pos) + local RID = minetest.get_meta(pos):get_int("RID") + if RID then + table.remove(teleporters, RID) + end + end, }) diff --git a/moremesecons_wireless/init.lua b/moremesecons_wireless/init.lua index f36cc7e..d3a1acc 100644 --- a/moremesecons_wireless/init.lua +++ b/moremesecons_wireless/init.lua @@ -1,4 +1,4 @@ -wireless = {} +local wireless = {} local register = function(pos) local meta = minetest.env:get_meta(pos) @@ -56,6 +56,12 @@ minetest.register_node("moremesecons_wireless:wireless", { meta:set_string("formspec", "field[channel;channel;${channel}]") register(pos) end, + on_destruct = function(pos) + local RID = minetest.get_meta(pos):get_int("RID") + if RID then + table.remove(wireless, RID) + end + end, on_receive_fields = function(pos, formname, fields, sender) local meta = minetest.get_meta(pos) meta:set_string("channel", fields.channel)