summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--car.lua5
-rw-r--r--controllerfw.lua19
-rw-r--r--docs/file_sources8
-rw-r--r--sounds/celevator_alarm.oggbin0 -> 62361 bytes
-rw-r--r--sounds/celevator_phone.oggbin0 -> 29051 bytes
-rw-r--r--textures/celevator_copbutton_alarm.pngbin0 -> 229 bytes
-rw-r--r--textures/celevator_copbutton_phone.pngbin0 -> 213 bytes
7 files changed, 31 insertions, 1 deletions
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
--- /dev/null
+++ b/sounds/celevator_alarm.ogg
Binary files differ
diff --git a/sounds/celevator_phone.ogg b/sounds/celevator_phone.ogg
new file mode 100644
index 0000000..ae12398
--- /dev/null
+++ b/sounds/celevator_phone.ogg
Binary files differ
diff --git a/textures/celevator_copbutton_alarm.png b/textures/celevator_copbutton_alarm.png
new file mode 100644
index 0000000..3ad852e
--- /dev/null
+++ b/textures/celevator_copbutton_alarm.png
Binary files differ
diff --git a/textures/celevator_copbutton_phone.png b/textures/celevator_copbutton_phone.png
new file mode 100644
index 0000000..dc8b9a6
--- /dev/null
+++ b/textures/celevator_copbutton_phone.png
Binary files differ