diff options
author | cheapie <no-email-for-you@example.com> | 2024-04-14 15:55:08 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2024-04-14 15:55:08 -0500 |
commit | 6152a079ab1c7583da32b71c7236cd079fe2810b (patch) | |
tree | 4986986b5f60741a646d01c3e1435a7bb510bd57 | |
parent | 8fc57f0535946351de94066e71b02b16b2c81bf9 (diff) | |
download | celevator-6152a079ab1c7583da32b71c7236cd079fe2810b.tar celevator-6152a079ab1c7583da32b71c7236cd079fe2810b.tar.gz celevator-6152a079ab1c7583da32b71c7236cd079fe2810b.tar.bz2 celevator-6152a079ab1c7583da32b71c7236cd079fe2810b.tar.xz celevator-6152a079ab1c7583da32b71c7236cd079fe2810b.zip |
Add floor passing beep
-rw-r--r-- | controller.lua | 2 | ||||
-rw-r--r-- | controllerfw.lua | 7 | ||||
-rw-r--r-- | drive_entity.lua | 16 | ||||
-rw-r--r-- | drive_null.lua | 4 | ||||
-rw-r--r-- | sounds/celevator_pi_beep.ogg | bin | 0 -> 4150 bytes |
5 files changed, 29 insertions, 0 deletions
diff --git a/controller.lua b/controller.lua index 90fd841..0912776 100644 --- a/controller.lua +++ b/controller.lua @@ -435,6 +435,8 @@ function celevator.controller.finish(pos,mem,changedinterrupts) celevator.drives[drivetype].movedoors(drivepos,"close") elseif command.command == "resetfault" then celevator.drives[drivetype].resetfault(drivepos) + elseif command.command == "pibeep" then + celevator.drives[drivetype].pibeep(drivepos) end end end diff --git a/controllerfw.lua b/controllerfw.lua index 8e5cb2d..b909a5f 100644 --- a/controllerfw.lua +++ b/controllerfw.lua @@ -852,6 +852,8 @@ else mem.showrunning = false end +local oldpifloor = mem.pifloor + mem.pifloor = mem.params.floornames[getpos(true)] local hidepi = { bfdemand = true, @@ -863,6 +865,11 @@ local hidepi = { inspconflict = true, } if hidepi[mem.carstate] then mem.pifloor = "--" end + +if mem.pifloor ~= oldpifloor and mem.carstate == "normal" then + drivecmd({command="pibeep"}) +end + local arrowenabled = { normal = true, fs1 = true, diff --git a/drive_entity.lua b/drive_entity.lua index d5b8287..35a4e71 100644 --- a/drive_entity.lua +++ b/drive_entity.lua @@ -563,6 +563,22 @@ function celevator.drives.entity.resetfault(pos) minetest.get_meta(pos):set_string("fault","") end +function celevator.drives.entity.pibeep(drivepos) + local drivemeta = minetest.get_meta(drivepos) + local origin = minetest.string_to_pos(drivemeta:get_string("origin")) + if not origin then + minetest.log("error","[celevator] [entity drive] Invalid origin for drive at "..minetest.pos_to_string(drivepos)) + drivemeta:set_string("fault","badorigin") + return + end + local apos = tonumber(drivemeta:get_string("apos")) or 0 + local beeppos = vector.add(origin,vector.new(0,apos+2,0)) + minetest.sound_play("celevator_pi_beep",{ + pos = beeppos, + gain = 1, + },true) +end + local function carsearch(pos) for i=1,500,1 do local searchpos = vector.subtract(pos,vector.new(0,i,0)) diff --git a/drive_null.lua b/drive_null.lua index db4e394..1a98970 100644 --- a/drive_null.lua +++ b/drive_null.lua @@ -234,3 +234,7 @@ end function celevator.drives.null.updatecopformspec() --No car means no COP end + +function celevator.drives.null.pibeep() + --No car means no PI, no PI means no beep +end diff --git a/sounds/celevator_pi_beep.ogg b/sounds/celevator_pi_beep.ogg Binary files differnew file mode 100644 index 0000000..17c1ce4 --- /dev/null +++ b/sounds/celevator_pi_beep.ogg |