diff options
author | cheapie <no-email-for-you@example.com> | 2023-08-04 16:46:03 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2023-08-04 16:46:03 -0500 |
commit | 12d9182bd5c50013dd76885cf8395b9a1a4f84a6 (patch) | |
tree | 7e988aeaf7fec82f490efafab699156a8ac35854 /controller.lua | |
parent | 6e3377a70d9bfc8311cfbec69f498b8140068eb8 (diff) | |
download | celevator-12d9182bd5c50013dd76885cf8395b9a1a4f84a6.tar celevator-12d9182bd5c50013dd76885cf8395b9a1a4f84a6.tar.gz celevator-12d9182bd5c50013dd76885cf8395b9a1a4f84a6.tar.bz2 celevator-12d9182bd5c50013dd76885cf8395b9a1a4f84a6.tar.xz celevator-12d9182bd5c50013dd76885cf8395b9a1a4f84a6.zip |
Add lanterns
Diffstat (limited to 'controller.lua')
-rw-r--r-- | controller.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/controller.lua b/controller.lua index 8bfa1af..5322e22 100644 --- a/controller.lua +++ b/controller.lua @@ -460,6 +460,15 @@ function celevator.controller.finish(pos,mem) celevator.pi.setarrow(pipos,"down",newpidownarrow) end end + local oldlanterns = oldmem.lanterns or {} + local newlanterns = mem.lanterns or {} + local lanterns = minetest.deserialize(meta:get_string("lanterns")) or {} + for hash,landing in pairs(lanterns) do + if oldlanterns[landing] ~= newlanterns[landing] then + celevator.lantern.setlight(minetest.get_position_from_hash(hash),"up",newlanterns[landing] == "up") + celevator.lantern.setlight(minetest.get_position_from_hash(hash),"down",newlanterns[landing] == "down") + 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 "") |