Tram door fixes (#83672)

## About The Pull Request

- Fixes the emergency open spamming infinitely on bump open
- Tram doors have an associated assembly, can be repaired, rebuilt, and
constructed
- Adjusted door timings to better match the animation, no longer getting
briefly stuck on an invisible, open door

## Why It's Good For The Game

Fixing little issues that have surfaced

## Changelog

🆑 LT3
fix: Tram doors can now be constructed and assemblies built
fix: Emergency opening tram doors no longer spam balloon alerts
fix: Tram doors open faster on arrival
fix: Tram doors correctly force close on attempt 3 
/🆑
This commit is contained in:
lessthanthree
2024-06-09 18:52:04 +01:00
committed by GitHub
parent dfa2cabfce
commit 30b9245adc
4 changed files with 37 additions and 10 deletions
+21 -8
View File
@@ -1,7 +1,7 @@
#define TRAM_DOOR_WARNING_TIME (1.4 SECONDS)
#define TRAM_DOOR_CYCLE_TIME (0.4 SECONDS)
#define TRAM_DOOR_WARNING_TIME (0.9 SECONDS)
#define TRAM_DOOR_CYCLE_TIME (0.6 SECONDS)
#define TRAM_DOOR_CRUSH_TIME (0.7 SECONDS)
#define TRAM_DOOR_RECYCLE_TIME (3 SECONDS)
#define TRAM_DOOR_RECYCLE_TIME (2.7 SECONDS)
/obj/machinery/door/airlock/tram
name = "tram door"
@@ -9,7 +9,7 @@
overlays_file = 'icons/obj/doors/airlocks/tram/tram-overlays.dmi'
multi_tile = TRUE
opacity = FALSE
assemblytype = null
assemblytype = /obj/structure/door_assembly/multi_tile/door_assembly_tram
airlock_material = "glass"
air_tight = TRUE
req_access = list(ACCESS_TCOMMS)
@@ -55,7 +55,7 @@
update_freelook_sight()
flags_1 &= ~PREVENT_CLICK_UNDER_1
air_update_turf(TRUE, FALSE)
sleep(TRAM_DOOR_CYCLE_TIME)
sleep(TRAM_DOOR_WARNING_TIME)
layer = OPEN_DOOR_LAYER
update_icon(ALL, AIRLOCK_OPEN, TRUE)
operating = FALSE
@@ -64,7 +64,7 @@
/obj/machinery/door/airlock/tram/close(forced = DEFAULT_DOOR_CHECKS, force_crush = FALSE)
retry_counter++
if(retry_counter >= 4 || force_crush || forced == BYPASS_DOOR_CHECKS)
if(retry_counter >= 3 || force_crush || forced == BYPASS_DOOR_CHECKS)
try_to_close(forced = BYPASS_DOOR_CHECKS)
return
@@ -116,7 +116,7 @@
air_update_turf(TRUE, TRUE)
crush()
crushing_in_progress = FALSE
sleep(TRAM_DOOR_CYCLE_TIME)
sleep(TRAM_DOOR_WARNING_TIME)
update_icon(ALL, AIRLOCK_CLOSED, 1)
operating = FALSE
retry_counter = 0
@@ -163,7 +163,7 @@
if(airlock_state == AIRLOCK_CLOSED)
return
if(retry_counter < 3)
if(retry_counter < 2)
close()
return
@@ -205,6 +205,9 @@
* Tram doors can be opened with hands when unpowered
*/
/obj/machinery/door/airlock/tram/try_safety_unlock(mob/user)
if(DOING_INTERACTION_WITH_TARGET(user, src))
return
if(!hasPower() && density)
balloon_alert(user, "pulling emergency exit...")
if(do_after(user, 4 SECONDS, target = src))
@@ -215,10 +218,20 @@
* If you pry (bump) the doors open midtravel, open quickly so you can jump out and make a daring escape.
*/
/obj/machinery/door/airlock/tram/bumpopen(mob/user, forced = BYPASS_DOOR_CHECKS)
if(DOING_INTERACTION_WITH_TARGET(user, src))
return
if(operating || !density)
return
if(!hasPower())
try_safety_unlock(user)
return
var/datum/transport_controller/linear/tram/tram_part = transport_ref?.resolve()
add_fingerprint(user)
if(!tram_part.controller_active)
return
if((tram_part.travel_remaining < DEFAULT_TRAM_LENGTH || tram_part.travel_remaining > tram_part.travel_trip_length - DEFAULT_TRAM_LENGTH) && tram_part.controller_active)
return // we're already animating, don't reset that
open(forced = BYPASS_DOOR_CHECKS)