Skip to content

Commit

Permalink
[MIRROR] Tram door/panel hotfix [NO GBP] [MDB IGNORE] (#24505)
Browse files Browse the repository at this point in the history
* Tram door/panel hotfix [NO GBP] (#79093)

## About The Pull Request

- The actions to open/close and lock/unlock are supposed to match
closets, but I got it backwards. Swaps them around.
- The lock now works as expected no matter if your ID card is in hand,
in a wallet, or in your PDA.
- Moves early return for when welder has no fuel.
- There was no indication spoilers were tampered/malfunctioning. Added
an overlay, examine text, context hint, and welder action so it's more
apparent to players.
- Fixing an emagged spoiler is now multitool-weld, to match the overlay.
- Added some missing var docs.
- Improved the wording of some tram error messages about why it's broken
(ie: no power.)
- Fixed crossing signals not showing correct status/examine text when
broken/no power

![image](https://github.com/tgstation/tgstation/assets/83487515/a5539303-88a4-469b-afaf-65c8d67ce2e8)

## Changelog

:cl: LT3
fix: Fixed tram cabinet LMB/RMB actions being reversed
fix: Tram cabinet can now read IDs inside PDAs and wallets
fix: Crossing signals now correctly indicate broken/no power
fix: Trying to repair tram (weld) without welding fuel fails
fix: You can actually unbolt the tram controller from the wall
qol: Tram spoilers now have visual and examine hints about being
malfunctioning/emagged
qol: Improved some tram error messages
/:cl:

---------

Co-authored-by: Jacquerel <hnevard@ gmail.com>

* Tram door/panel hotfix [NO GBP]

* Update CODEOWNERS

---------

Co-authored-by: lessthanthree <[email protected]>
Co-authored-by: Jacquerel <hnevard@ gmail.com>
  • Loading branch information
3 people authored and FFMirrorBot committed Oct 22, 2023
1 parent 25f3841 commit 916e9ef
Show file tree
Hide file tree
Showing 12 changed files with 205 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/tools/UpdatePaths @Jolly-66

# LT3
/code/modules/industrial_lift/ @lessthnthree
/code/modules/transport/ @lessthnthree
/modular_skyrat/master_files/code/controllers/subsystem/ @lessthnthree
/modular_skyrat/modules/advanced_engineering/ @lessthnthree
/modular_skyrat/modules/airlock_override/ @lessthnthree
Expand Down
1 change: 1 addition & 0 deletions code/modules/transport/_transport_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
QDEL_LAZYLIST(methods_to_fix)
malfunctioning = FALSE
set_machine_stat(machine_stat & ~EMAGGED)
set_is_operational(TRUE)
update_appearance()
return TRUE

Expand Down
147 changes: 90 additions & 57 deletions code/modules/transport/tram/tram_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
*/
/datum/tram_mfg_info/New(specific_transport_id)
if(GLOB.round_id)
serial_number = "LT306TG[add_leading(GLOB.round_id, 6, 0)]"
serial_number = "LT306TG[add_leading(GLOB.round_id, 6, "0")]"
else
serial_number = "LT306TG[rand(000000, 999999)]"

Expand Down Expand Up @@ -724,10 +724,9 @@
context[SCREENTIP_CONTEXT_RMB] = panel_open ? "close panel" : "open panel"

if(!held_item)
context[SCREENTIP_CONTEXT_RMB] = cover_open ? "close cabinet" : "open cabinet"
context[SCREENTIP_CONTEXT_LMB] = cover_open ? "access controls" : "open cabinet"
context[SCREENTIP_CONTEXT_RMB] = cover_open ? "close cabinet" : "toggle lock"

if(istype(held_item, /obj/item/card/id/) && allowed(user) && !cover_open)
context[SCREENTIP_CONTEXT_LMB] = cover_locked ? "unlock cabinet" : "lock cabinet"

if(panel_open)
if(held_item?.tool_behaviour == TOOL_WRENCH)
Expand All @@ -748,6 +747,7 @@
. += span_notice("The door appears to be [cover_locked ? "locked. Swipe an ID card to unlock" : "unlocked. Swipe an ID card to lock"].")
if(panel_open)
. += span_notice("It is secured to the tram wall with [EXAMINE_HINT("bolts.")]")
. += span_notice("The maintenance panel can be closed with a [EXAMINE_HINT("screwdriver.")]")
else
. += span_notice("The maintenance panel can be opened with a [EXAMINE_HINT("screwdriver.")]")

Expand All @@ -756,35 +756,108 @@
. += span_notice("The [EXAMINE_HINT("red stop button")] immediately stops the tram, requiring a reset afterwards.")
. += span_notice("The cabinet can be closed with a [EXAMINE_HINT("Right-click.")]")
else
. += span_notice("The cabinet can be opened with a [EXAMINE_HINT("Right-click.")]")
. += span_notice("The cabinet can be opened with a [EXAMINE_HINT("Left-click.")]")


/obj/machinery/transport/tram_controller/attackby(obj/item/weapon, mob/living/user, params)
if(!user.combat_mode)
if(weapon && istype(weapon, /obj/item/card/id) && !cover_open)
return try_toggle_lock(user)
if(user.combat_mode || cover_open)
return ..()

var/obj/item/card/id/id_card = user.get_id_in_hand()
if(!isnull(id_card))
try_toggle_lock(user, id_card)
return

return ..()

/obj/machinery/transport/tram_controller/attack_hand(mob/living/user, params)
. = ..()
if(cover_open)
return

if(cover_locked)
var/obj/item/card/id/id_card = user.get_idcard(TRUE)
if(isnull(id_card))
balloon_alert(user, "access denied!")
return

try_toggle_lock(user, id_card)
return

toggle_door()

/obj/machinery/transport/tram_controller/attack_hand_secondary(mob/living/user, params)
. = ..()

if(!cover_open)
var/obj/item/card/id/id_card = user.get_idcard(TRUE)
if(isnull(id_card))
balloon_alert(user, "access denied!")
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

try_toggle_lock(user, id_card)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

toggle_door()
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

/obj/machinery/transport/tram_controller/proc/toggle_door()
if(!cover_open)
playsound(loc, 'sound/machines/closet_open.ogg', 35, TRUE, -3)
else
playsound(loc, 'sound/machines/closet_close.ogg', 50, TRUE, -3)
cover_open = !cover_open
update_appearance()

/obj/machinery/transport/tram_controller/proc/try_toggle_lock(mob/living/user, obj/item/card/id_card, params)
if(isnull(id_card))
id_card = user.get_idcard(TRUE)
if(obj_flags & EMAGGED)
balloon_alert(user, "access controller damaged!")
return FALSE

if(check_access(id_card))
cover_locked = !cover_locked
balloon_alert(user, "controls [cover_locked ? "locked" : "unlocked"]")
update_appearance()
return TRUE

balloon_alert(user, "access denied!")
return FALSE

/obj/machinery/transport/tram_controller/wrench_act_secondary(mob/living/user, obj/item/tool)
. = ..()
if(panel_open)
if(panel_open && cover_open)
balloon_alert(user, "unsecuring...")
tool.play_tool_sound(src)
if(tool.use_tool(src, user, 6 SECONDS))
playsound(loc, 'sound/items/deconstruct.ogg', 50, vary = TRUE)
balloon_alert(user, "unsecured")
deconstruct()
if(!tool.use_tool(src, user, 6 SECONDS))
return
playsound(loc, 'sound/items/deconstruct.ogg', 50, vary = TRUE)
balloon_alert(user, "unsecured")
deconstruct()
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

/obj/machinery/transport/tram_controller/screwdriver_act_secondary(mob/living/user, obj/item/tool)
. = ..()
if(!cover_open)
return

tool.play_tool_sound(src)
panel_open = !panel_open
balloon_alert(user, "[panel_open ? "mounting bolts exposed" : "mounting bolts hidden"]")
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

/obj/machinery/transport/tram_controller/deconstruct(disassembled = TRUE)
if(flags_1 & NODECONSTRUCT_1)
return

var/turf/drop_location = find_obstruction_free_location(1, src)

if(disassembled)
new /obj/item/wallframe/tram/controller(drop_location())
new /obj/item/wallframe/tram/controller(drop_location)
else
new /obj/item/stack/sheet/mineral/titanium(drop_location(), 2)
new /obj/item/stack/sheet/iron(drop_location(), 1)
new /obj/item/shard(drop_location())
new /obj/item/stack/sheet/mineral/titanium(drop_location, 2)
new /obj/item/stack/sheet/iron(drop_location, 1)
qdel(src)

/**
Expand Down Expand Up @@ -877,46 +950,6 @@
return
update_appearance()

/obj/machinery/transport/tram_controller/attack_hand(mob/living/user, params)
. = ..()
if(!cover_open && cover_locked)
balloon_alert(user, "it's locked! swipe ID!")
return

/obj/machinery/transport/tram_controller/attack_hand_secondary(mob/living/user, params)
. = ..()

if(!cover_open && cover_locked)
balloon_alert(user, "it's locked! swipe ID!")
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

toggle_door()
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

/obj/machinery/transport/tram_controller/proc/toggle_door()
if(!cover_open)
playsound(loc, 'sound/machines/closet_open.ogg', 35, TRUE, -3)
else
playsound(loc, 'sound/machines/closet_close.ogg', 50, TRUE, -3)
cover_open = !cover_open
update_appearance()

/obj/machinery/transport/tram_controller/proc/try_toggle_lock(mob/living/user, item, params)
var/obj/item/card/id/id_card = user.get_idcard(TRUE)
if(obj_flags & EMAGGED)
balloon_alert(user, "access controller damaged!")
return FALSE

else if(check_access(id_card))
cover_locked = !cover_locked
balloon_alert(user, "controls [cover_locked ? "locked" : "unlocked"]")
update_appearance()
return TRUE

else
balloon_alert(user, "access denied")
return FALSE

/obj/machinery/transport/tram_controller/emag_act(mob/user, obj/item/card/emag/emag_card)
if(obj_flags & EMAGGED)
balloon_alert(user, "already fried!")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/transport/tram/tram_controls.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
if(INVALID_PLATFORM)
say("Configuration error. Please contact the nearest engineer.")
if(INTERNAL_ERROR)
say("Tram controller error. Please contact the nearest engineer.")
say("Tram controller error. Please contact the nearest engineer or crew member with telecommunications access to reset the controller.")
else
return

Expand Down
6 changes: 3 additions & 3 deletions code/modules/transport/tram/tram_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@
if(BROKEN_BEYOND_REPAIR)
say("The tram has suffered a catastrophic failure. Please seek alternate modes of travel.")
if(NOT_IN_SERVICE) //tram has no power or other fault, but it's not broken forever
say("The tram is not in service. Please contact the nearest engineer.")
say("The tram is not in service due to loss of power or system problems. Please contact the nearest engineer to check power and controller.")
if(INVALID_PLATFORM) //engineer needs to fix button
say("Button configuration error. Please contact the nearest engineer.")
if(TRANSPORT_IN_USE)
say("The tram is tramversing the station, please wait.")
if(INTERNAL_ERROR)
say("Tram controller error. Please contact the nearest engineer.")
say("Tram controller error. Please contact the nearest engineer or crew member with telecommunications access to reset the controller.")
if(NO_CALL_REQUIRED) //already here
say("The tram is already here. Please board the tram and select a destination.")
else
say("Tram controller error. Please contact the nearest engineer.")
say("Tram controller error. Please contact the nearest engineer or crew member with telecommunications access to reset the controller.")

/obj/item/assembly/control/transport/call_button/activate()
if(cooldown)
Expand Down
30 changes: 19 additions & 11 deletions code/modules/transport/tram/tram_signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
. += span_notice("It can be flipped or rotated with a [EXAMINE_HINT("wrench.")]")
switch(operating_status)
if(TRANSPORT_REMOTE_WARNING)
. += span_notice("The yellow [EXAMINE_HINT("remote warning")] light is on.")
. += span_notice("The orange [EXAMINE_HINT("remote warning")] light is on.")
. += span_notice("The status display reads: Check track sensor.")
if(TRANSPORT_REMOTE_FAULT)
. += span_notice("The blue [EXAMINE_HINT("remote fault")] light is on.")
Expand Down Expand Up @@ -250,19 +250,24 @@
SIGNAL_HANDLER

if(machine_stat & BROKEN || machine_stat & NOPOWER)
operating_status = TRANSPORT_LOCAL_FAULT
update_appearance()
return

if(prob(TRANSPORT_BREAKDOWN_RATE))
operating_status = TRANSPORT_LOCAL_FAULT
local_fault()
return

operating_status = TRANSPORT_SYSTEM_NORMAL

var/datum/transport_controller/linear/tram/tram = transport_ref?.resolve()
var/obj/machinery/transport/guideway_sensor/linked_sensor = sensor_ref?.resolve()

if(isnull(tram) || tram.controller_status & COMM_ERROR)
if(malfunctioning)
operating_status = TRANSPORT_LOCAL_FAULT
else if(isnull(tram) || tram.controller_status & COMM_ERROR)
operating_status = TRANSPORT_REMOTE_FAULT
else
operating_status = TRANSPORT_SYSTEM_NORMAL

if(isnull(linked_sensor))
link_sensor()
Expand All @@ -271,14 +276,17 @@

/obj/machinery/transport/crossing_signal/on_set_machine_stat()
. = ..()
if(machine_stat & BROKEN)
operating_status = TRANSPORT_REMOTE_FAULT
if(machine_stat & BROKEN || machine_stat & NOPOWER)
operating_status = TRANSPORT_LOCAL_FAULT
else
operating_status = TRANSPORT_SYSTEM_NORMAL

/obj/machinery/transport/crossing_signal/on_set_is_operational()
. = ..()

if(!is_operational)
operating_status = TRANSPORT_LOCAL_FAULT
else
operating_status = TRANSPORT_SYSTEM_NORMAL
update_operating()

/obj/machinery/transport/crossing_signal/proc/comms_change(source, controller, new_status)
Expand Down Expand Up @@ -529,7 +537,7 @@
. += span_notice("It can be rotated with a [EXAMINE_HINT("wrench.")]")
switch(operating_status)
if(TRANSPORT_REMOTE_WARNING)
. += span_notice("The yellow [EXAMINE_HINT("remote warning")] light is on.")
. += span_notice("The orange [EXAMINE_HINT("remote warning")] light is on.")
. += span_notice("The status display reads: Check paired sensor.")
if(TRANSPORT_REMOTE_FAULT)
. += span_notice("The blue [EXAMINE_HINT("remote fault")] light is on.")
Expand Down Expand Up @@ -603,10 +611,8 @@

/obj/machinery/transport/guideway_sensor/update_overlays()
. = ..()
if(machine_stat & NOPOWER)
return

if(machine_stat & BROKEN)
if(machine_stat & BROKEN || machine_stat & NOPOWER || malfunctioning)
operating_status = TRANSPORT_LOCAL_FAULT
. += mutable_appearance(icon, "sensor-[TRANSPORT_LOCAL_FAULT]")
. += emissive_appearance(icon, "sensor-[TRANSPORT_LOCAL_FAULT]", src, alpha = src.alpha)
Expand Down Expand Up @@ -649,9 +655,11 @@
SIGNAL_HANDLER

if(machine_stat & BROKEN)
update_appearance()
return

if(prob(TRANSPORT_BREAKDOWN_RATE))
operating_status = TRANSPORT_LOCAL_FAULT
local_fault()

var/obj/machinery/transport/guideway_sensor/buddy = paired_sensor?.resolve()
Expand Down
Loading

0 comments on commit 916e9ef

Please sign in to comment.