Force teleport to update formspec by punching
parent
c0c4d5f627
commit
0519791f0a
10
README.txt
10
README.txt
|
@ -1,7 +1,7 @@
|
||||||
teleports
|
teleports
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Mod "teleports" for Minetest 0.4.17 or later.
|
Mod "teleports" for Minetest 0.4.17 or later. Updated version of lag01's Teleports mod!
|
||||||
|
|
||||||
Allows players to create teleports with crafting (8 diamonds + 1 obsidian).
|
Allows players to create teleports with crafting (8 diamonds + 1 obsidian).
|
||||||
|
|
||||||
|
@ -17,6 +17,14 @@ the destination exactly, but one block 'besides' it.
|
||||||
|
|
||||||
Beware: If you dig a teleport, you only get 1 diamond back, so think before placing!
|
Beware: If you dig a teleport, you only get 1 diamond back, so think before placing!
|
||||||
|
|
||||||
|
For server operators
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
This mod is compatible with lag01's original teleports mod. The formspecs have changed tho
|
||||||
|
because the original mod's formspec were buggy.
|
||||||
|
|
||||||
|
To force a teleport to update its formspec, just punch it!
|
||||||
|
|
||||||
Credits:
|
Credits:
|
||||||
========
|
========
|
||||||
This mod code is licensed under the GNU LGPLv2
|
This mod code is licensed under the GNU LGPLv2
|
||||||
|
|
6
init.lua
6
init.lua
|
@ -258,6 +258,11 @@ minetest.register_node("teleports:teleport", {
|
||||||
teleports:save()
|
teleports:save()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
on_punch = function(pos, node, puncher, pointed_thing)
|
||||||
|
-- Force formspec update on punch
|
||||||
|
teleports.set_formspec(pos)
|
||||||
|
minetest.log("info", "[teleports] Teleport formspec force-updated: "..minetest.pos_to_string(pos))
|
||||||
|
end,
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
-- Update list of teleports on destruction
|
-- Update list of teleports on destruction
|
||||||
local near_teleports = teleports:find_nearby(pos, TELEPORT_SHOW_MAX)
|
local near_teleports = teleports:find_nearby(pos, TELEPORT_SHOW_MAX)
|
||||||
|
@ -326,4 +331,3 @@ minetest.register_craft({
|
||||||
{"default:diamond","default:diamond","default:diamond"},
|
{"default:diamond","default:diamond","default:diamond"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue