diff options
author | cheapie <no-email-for-you@example.com> | 2024-05-11 16:27:42 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2024-05-11 16:27:42 -0500 |
commit | 18b8f47dceec87d2ceb1126264928554978754fc (patch) | |
tree | 5e55fa0b655cc4b9fbe0f7e666d52f41d3e8cf0e | |
parent | a659a519ebfc0ed34fea9f8acf5ffcd744b01db0 (diff) | |
download | celevator-18b8f47dceec87d2ceb1126264928554978754fc.tar celevator-18b8f47dceec87d2ceb1126264928554978754fc.tar.gz celevator-18b8f47dceec87d2ceb1126264928554978754fc.tar.bz2 celevator-18b8f47dceec87d2ceb1126264928554978754fc.tar.xz celevator-18b8f47dceec87d2ceb1126264928554978754fc.zip |
Add flashing fire hat and recall to next available floor for machine room smoke detectors
-rw-r--r-- | controllerfw.lua | 33 | ||||
-rw-r--r-- | mesecons.lua | 10 | ||||
-rw-r--r-- | textures/celevator_fire_hat_flashing.png | bin | 0 -> 4453 bytes |
3 files changed, 41 insertions, 2 deletions
diff --git a/controllerfw.lua b/controllerfw.lua index 8c3663e..cd54dff 100644 --- a/controllerfw.lua +++ b/controllerfw.lua @@ -647,6 +647,7 @@ elseif event.type == "fs1switch" then end mem.fs1switch = event.state mem.fs1led = event.state + if not event.state then mem.flashfirehat = false end elseif event.type == "cartopbox" then if event.control == "inspectswitch" then mem.cartopinspectsw = not mem.cartopinspectsw @@ -729,6 +730,7 @@ elseif event.type == "dispatchermsg" then elseif event.channel == "fs1switch" then mem.fs1switch = event.msg mem.fs1led = event.msg + if not event.msg then mem.flashfirehat = false end end elseif event.type == "remotemsg" then if event.channel == "groupupcall" and mem.carstate == "normal" then @@ -765,6 +767,29 @@ elseif event.iid == "nudge" and mem.carstate == "normal" then elseif mem.doorstate == "opening" then interrupt(1,"nudge") end +elseif event.type == "mrsmoke" then + mem.flashfirehat = true + if not mem.fs1led then + mem.fs1switch = true + mem.fs1led = true + mem.recallto = nil + if mem.drive.status.vel > 0 then + for i=getpos(),#mem.params.floornames,1 do + if mem.drive.status.neareststop < gettarget(i) then + mem.recallto = i + break + end + end + elseif mem.drive.status.vel < 0 then + for i=#mem.params.floornames,1,-1 do + if mem.drive.status.neareststop < gettarget(i) then + mem.recallto = i + break + end + end + end + if not mem.recallto then mem.recallto = getpos() end + end end local oldstate = mem.carstate @@ -1462,8 +1487,12 @@ mem.copformspec = mem.copformspec..string.format("image_button[%f,%f;1.2,1.2;%s; mem.copformspec = mem.copformspec..string.format("image_button[0.4,0.5;1.4,1.4;%s;callcancel;Call\nCancel;false;false;%s]",unlitimg,litimg) -local firehat = mem.flash_fs and "celevator_fire_hat_lit.png" or "celevator_fire_hat_unlit.png" -mem.copformspec = mem.copformspec..string.format("image[2.2,0.5;1.4,1.4;%s]",firehat) +if mem.flashfirehat then + mem.copformspec = mem.copformspec.."animated_image[2.2,0.5;1.4,1.4;firehat;celevator_fire_hat_flashing.png;2;750]" +else + local firehat = mem.flash_fs and "celevator_fire_hat_lit.png" or "celevator_fire_hat_unlit.png" + mem.copformspec = mem.copformspec..string.format("image[2.2,0.5;1.4,1.4;%s]",firehat) +end mem.switchformspec = "formspec_version[7]size[8,10]" local fs2ontex = (mem.fs2sw == "on") and "celevator_button_rect_active.png" or "celevator_button_rect.png" diff --git a/mesecons.lua b/mesecons.lua index f5fd06b..bc00185 100644 --- a/mesecons.lua +++ b/mesecons.lua @@ -338,6 +338,16 @@ local inputoptions = { end, needsfloor = false, }, + { + id = "mrsmoke", + desc = "Machine Room or Hoistway Smoke Detector", + func_on = function(controllerpos) + celevator.controller.run(controllerpos,{ + type = "mrsmoke", + }) + end, + needsfloor = false, + }, } local dinputoptions = { diff --git a/textures/celevator_fire_hat_flashing.png b/textures/celevator_fire_hat_flashing.png Binary files differnew file mode 100644 index 0000000..97c8e5c --- /dev/null +++ b/textures/celevator_fire_hat_flashing.png |