summaryrefslogtreecommitdiff
path: root/controller.lua
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2023-08-04 15:01:39 -0500
committercheapie <no-email-for-you@example.com>2023-08-04 15:01:39 -0500
commit6e3377a70d9bfc8311cfbec69f498b8140068eb8 (patch)
treecfcc003c1c947639fafc4d3067fc82c8bb6824ff /controller.lua
parent2348665474695d2af74e3a44e9c06f492fb08ba8 (diff)
downloadcelevator-6e3377a70d9bfc8311cfbec69f498b8140068eb8.tar
celevator-6e3377a70d9bfc8311cfbec69f498b8140068eb8.tar.gz
celevator-6e3377a70d9bfc8311cfbec69f498b8140068eb8.tar.bz2
celevator-6e3377a70d9bfc8311cfbec69f498b8140068eb8.tar.xz
celevator-6e3377a70d9bfc8311cfbec69f498b8140068eb8.zip
Add position indicator
Diffstat (limited to 'controller.lua')
-rw-r--r--controller.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/controller.lua b/controller.lua
index a607666..8bfa1af 100644
--- a/controller.lua
+++ b/controller.lua
@@ -433,6 +433,33 @@ function celevator.controller.finish(pos,mem)
celevator.callbutton.setlight(minetest.get_position_from_hash(hash),"down",newdownbuttonlights[landing])
end
end
+ local oldpitext = oldmem.pifloor or "--"
+ local newpitext = mem.pifloor or "--"
+ if oldpitext ~= newpitext then
+ local pis = minetest.deserialize(meta:get_string("pis")) or {}
+ for hash in pairs(pis) do
+ local pipos = minetest.get_position_from_hash(hash)
+ celevator.pi.settext(pipos,newpitext)
+ end
+ end
+ local oldpiuparrow = oldmem.piuparrow
+ local newpiuparrow = mem.piuparrow
+ local oldpidownarrow = oldmem.pidownarrow
+ local newpidownarrow = mem.pidownarrow
+ if oldpiuparrow ~= newpiuparrow then
+ local pis = minetest.deserialize(meta:get_string("pis")) or {}
+ for hash in pairs(pis) do
+ local pipos = minetest.get_position_from_hash(hash)
+ celevator.pi.setarrow(pipos,"up",newpiuparrow)
+ end
+ end
+ if oldpidownarrow ~= newpidownarrow then
+ local pis = minetest.deserialize(meta:get_string("pis")) or {}
+ for hash in pairs(pis) do
+ local pipos = minetest.get_position_from_hash(hash)
+ celevator.pi.setarrow(pipos,"down",newpidownarrow)
+ end
+ end
meta:set_string("mem",minetest.serialize(mem))
if node.name == "celevator:controller_open" then meta:set_string("formspec",mem.formspec or "") end
meta:set_string("formspec_hidden",mem.formspec or "")