From 25ff49a67cdb37bc78e3318e36c79e40d188014c Mon Sep 17 00:00:00 2001 From: cheapie Date: Wed, 8 Jul 2026 15:45:27 -0500 Subject: Add alarm and phone --- car.lua | 5 +++++ controllerfw.lua | 19 ++++++++++++++++++- docs/file_sources | 8 ++++++++ sounds/celevator_alarm.ogg | Bin 0 -> 62361 bytes sounds/celevator_phone.ogg | Bin 0 -> 29051 bytes textures/celevator_copbutton_alarm.png | Bin 0 -> 229 bytes textures/celevator_copbutton_phone.png | Bin 0 -> 213 bytes 7 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 sounds/celevator_alarm.ogg create mode 100644 sounds/celevator_phone.ogg create mode 100644 textures/celevator_copbutton_alarm.png create mode 100644 textures/celevator_copbutton_phone.png diff --git a/car.lua b/car.lua index 94eac20..2c10fd9 100644 --- a/car.lua +++ b/car.lua @@ -125,6 +125,11 @@ function celevator.car.register(name,defs,size) player = playername, protected = protected, } + if fields.alarm then + core.sound_play({name="celevator_alarm"},{pos=pos,max_hear_distance=32,ephemeral=true}) + elseif fields.phone then + core.sound_play({name="celevator_phone"},{pos=pos,gain=0.3,max_hear_distance=8,ephemeral=true}) + end celevator.controller.run(carinfo.controllerpos,event) end elseif def._keyswitches then diff --git a/controllerfw.lua b/controllerfw.lua index 42e4bb0..419936d 100644 --- a/controllerfw.lua +++ b/controllerfw.lua @@ -738,6 +738,9 @@ elseif event.type == "cop" then open() elseif fields.callcancel and (mem.carstate == "indep" or mem.carstate == "fs2") then mem.carcalls = {} + elseif fields.phone then + mem.phoneactive = true + interrupt(15,"phonedone") end end elseif event.type == "copswitches" then @@ -958,6 +961,8 @@ elseif event.type == "mrsmoke" then end if not mem.recallto then mem.recallto = getpos() end end +elseif event.iid == "phonedone" then + mem.phoneactive = false end local oldstate = mem.carstate @@ -1718,7 +1723,7 @@ local copcols = math.floor((floorcount-1)/10)+1 local coprows = math.floor((floorcount-1)/copcols)+1 local litimg = "celevator_copbutton_lit.png" local unlitimg = "celevator_copbutton_unlit.png" -mem.copformspec = mem.copformspec..string.format("size[%f,%f]",copcols*1.25+2.5,coprows*1.25+5) +mem.copformspec = mem.copformspec..string.format("size[%f,%f]",copcols*1.25+2.5,coprows*1.25+6) mem.copformspec = mem.copformspec.."no_prepend[]" mem.copformspec = mem.copformspec.."background9[0,0;16,12;celevator_fs_bg.png;true;3]" for i=1,floorcount,1 do @@ -1746,6 +1751,18 @@ end local closelabel = core.formspec_escape(">|<") mem.copformspec = mem.copformspec..string.format("image_button[%f,%f;1.2,1.2;%s;close;%s;false;false;%s]",dcxp,coprows*1.25+2.5,unlitimg,closelabel,litimg) +local alarmunlitimg = unlitimg.."^celevator_copbutton_alarm.png" +local alarmlitimg = litimg.."^celevator_copbutton_alarm.png" +mem.copformspec = mem.copformspec..string.format("image_button[%f,%f;1.2,1.2;%s;alarm;;false;false;%s]",doxp,coprows*1.25+4,alarmunlitimg,alarmlitimg) + +local phoneunlitimg = unlitimg.."^celevator_copbutton_phone.png" +local phonelitimg = litimg.."^celevator_copbutton_phone.png" +if mem.phoneactive then + mem.copformspec = mem.copformspec..string.format("image[%f,%f;1.2,1.2;%s]",dcxp,coprows*1.25+4,phonelitimg) +else + mem.copformspec = mem.copformspec..string.format("image_button[%f,%f;1.2,1.2;%s;phone;;false;false;%s]",dcxp,coprows*1.25+4,phoneunlitimg,phonelitimg) +end + local callcancellabel = S("Call\nCancel") mem.copformspec = mem.copformspec..string.format("image_button[0.4,0.5;1.4,1.4;%s;callcancel;"..callcancellabel..";false;false;%s]",unlitimg,litimg) diff --git a/docs/file_sources b/docs/file_sources index ef9bcdb..3e2b464 100644 --- a/docs/file_sources +++ b/docs/file_sources @@ -54,3 +54,11 @@ Edited by cheapie. Originally from "Fujitec Traction Elevator Machine Room" by ElevDSM on YouTube, explicit permission has been obtained from the author to use these sounds here and distribute them under mod's license. https://www.youtube.com/watch?v=0rPZrkEreAo Edited by cheapie. + +* celevator_alarm.ogg +Originally from "School bell.wav" by deleted_user_7020630 on Freesound, originally licensed under CC0. +https://freesound.org/people/deleted_user_7020630/sounds/378394/ +Edited by cheapie. + +* celevator_phone.ogg +Synthesized in Audacity by cheapie. diff --git a/sounds/celevator_alarm.ogg b/sounds/celevator_alarm.ogg new file mode 100644 index 0000000..561ac4e Binary files /dev/null and b/sounds/celevator_alarm.ogg differ diff --git a/sounds/celevator_phone.ogg b/sounds/celevator_phone.ogg new file mode 100644 index 0000000..ae12398 Binary files /dev/null and b/sounds/celevator_phone.ogg differ diff --git a/textures/celevator_copbutton_alarm.png b/textures/celevator_copbutton_alarm.png new file mode 100644 index 0000000..3ad852e Binary files /dev/null and b/textures/celevator_copbutton_alarm.png differ diff --git a/textures/celevator_copbutton_phone.png b/textures/celevator_copbutton_phone.png new file mode 100644 index 0000000..dc8b9a6 Binary files /dev/null and b/textures/celevator_copbutton_phone.png differ -- cgit v1.2.3