Skip to content

Commit

Permalink
[MIRROR] Tram door fixes [MDB IGNORE] (#2951)
Browse files Browse the repository at this point in the history
* 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

:cl: 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 
/:cl:

* Tram door fixes

---------

Co-authored-by: lessthanthree <[email protected]>
Co-authored-by: NovaBot13 <[email protected]>
  • Loading branch information
3 people authored and StealsThePRs committed Jun 9, 2024
1 parent c069bc6 commit 8ce38b7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 10 deletions.
5 changes: 3 additions & 2 deletions code/game/objects/items/stacks/sheets/mineral.dm
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,9 @@ GLOBAL_LIST_INIT(bananium_recipes, list ( \
walltype = /turf/closed/wall/mineral/titanium

GLOBAL_LIST_INIT(titanium_recipes, list ( \
new/datum/stack_recipe("Titanium tile", /obj/item/stack/tile/mineral/titanium, 1, 4, 20, crafting_flags = NONE, category = CAT_TILES), \
new/datum/stack_recipe("Shuttle seat", /obj/structure/chair/comfy/shuttle, 2, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_FURNITURE), \
new /datum/stack_recipe("Titanium tile", /obj/item/stack/tile/mineral/titanium, 1, 4, 20, crafting_flags = NONE, category = CAT_TILES), \
new /datum/stack_recipe("Shuttle seat", /obj/structure/chair/comfy/shuttle, 2, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_FURNITURE), \
new /datum/stack_recipe("Material tram door assembly", /obj/structure/door_assembly/multi_tile/door_assembly_tram, 8, time = 5 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_DOORS), \
))

/obj/item/stack/sheet/mineral/titanium/get_main_recipes()
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/structures/door_assembly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
multi_tile = TRUE
glass = TRUE
nomineral = TRUE
material_amt = 8

/obj/structure/door_assembly/Initialize(mapload)
. = ..()
Expand Down
12 changes: 12 additions & 0 deletions code/game/objects/structures/door_assembly_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,18 @@
name = "large public airlock assembly"
base_name = "large public airlock"

/obj/structure/door_assembly/multi_tile/door_assembly_tram
name = "tram door assembly"
icon = 'icons/obj/doors/airlocks/tram/tram.dmi'
base_name = "tram door"
overlays_file = 'icons/obj/doors/airlocks/tram/tram-overlays.dmi'
glass_type = /obj/machinery/door/airlock/tram
airlock_type = /obj/machinery/door/airlock/tram
glass = FALSE
noglass = TRUE
mineral = "titanium"
material_type = /obj/item/stack/sheet/mineral/titanium

/obj/structure/door_assembly/door_assembly_material/atom_deconstruct(disassembled = TRUE)
var/turf/target_turf = get_turf(src)
for(var/datum/material/material_datum as anything in custom_materials)
Expand Down
29 changes: 21 additions & 8 deletions code/modules/transport/tram/tram_doors.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#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"
icon = 'icons/obj/doors/airlocks/tram/tram.dmi'
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)
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -163,7 +163,7 @@
if(airlock_state == AIRLOCK_CLOSED)
return

if(retry_counter < 3)
if(retry_counter < 2)
close()
return

Expand Down Expand Up @@ -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))
Expand All @@ -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)
Expand Down

0 comments on commit 8ce38b7

Please sign in to comment.