mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
Tram Maintenance: Fixes/signal cleanup (#94938)
## About The Pull Request - Removes some unused tram signals that have been replaced with COMSIG_TRANSPORT_ACTIVE. - Renames COMSIG_TRANSPORT_ACTIVE to COMSIG_TRANSPORT_UPDATED to better reflect what it now does, and commonality with other x_UPDATED named signals - Tram door fixes - Fixes admins varediting tram speed not working. Introduces a new var "tram_max_speed" with 100 being the fastest. Easier to understand at a glance and not having to worry about movement delay vars, etc. Admins can just set a value 1-100 and it will change the appropriate internal vars. ## Why It's Good For The Game Fixes, remove unused code ## Changelog 🆑 LT3 fix: Admins can now actually adjust the speed of the tram fix: Fixed tram doors repeating multiple varied copies of their audio fix: Fixed tram doors emergency release sound/animation code: Cleaned up some tram signal code /🆑
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
/// Sent from /obj/structure/transport/linear/tram when it begins to travel. (obj/effect/landmark/tram/idle_platform, obj/effect/landmark/tram/to_where)
|
||||
#define COMSIG_TRAM_TRAVEL "tram_travel"
|
||||
|
||||
/// Sent from /obj/structure/transport/linear/tram when it hits someone: ()
|
||||
#define COMSIG_TRAM_COLLISION "tram_collided"
|
||||
|
||||
@@ -8,13 +5,9 @@
|
||||
#define COMSIG_LIVING_HIT_BY_TRAM "tram_hit_me"
|
||||
|
||||
// Sent to and from SStransport for control between various components
|
||||
/// Requesting transport move to a destination
|
||||
/// Request messages to the transport controller from auxiliary devices (crossing signals, buttons, etc.)
|
||||
#define COMSIG_TRANSPORT_REQUEST "!REQ"
|
||||
/// Response to a COMSIG_TRANSPORT_REQUEST request signal
|
||||
/// Response messages from the transport controller to a COMSIG_TRANSPORT_REQUEST request signal
|
||||
#define COMSIG_TRANSPORT_RESPONSE "!RESP"
|
||||
/// Transport controller 'active' (busy) status
|
||||
#define COMSIG_TRANSPORT_ACTIVE "!ACTV"
|
||||
/// Transport controller destination change signal
|
||||
#define COMSIG_TRANSPORT_DESTINATION "!DEST"
|
||||
/// Transport controller communication status (tram malfunction event)
|
||||
#define COMSIG_COMMS_STATUS "!COMM"
|
||||
/// Transport controller general status update. Includes: processing status, status alert bitflags, location info, and destination info
|
||||
#define COMSIG_TRANSPORT_UPDATED "!ACTV"
|
||||
|
||||
@@ -35,10 +35,13 @@
|
||||
var/current_load = 0
|
||||
|
||||
///decisecond delay between horizontal movement. cannot make the tram move faster than 1 movement per world.tick_lag.
|
||||
var/speed_limiter = 0.5
|
||||
var/internal_movement_delay
|
||||
|
||||
///version of speed_limiter that gets set in init and is considered our base speed if our lift gets slowed down
|
||||
var/base_speed_limiter = 0.5
|
||||
///version of internal_movement_delay that gets set in init and is considered our base delay if our tram gets slowed down
|
||||
var/base_internal_movement_delay
|
||||
|
||||
///speed of the death machine on rails (in percent)
|
||||
var/tram_max_speed = 100
|
||||
|
||||
///the world.time we should next move at. in case our speed is set to less than 1 movement per tick
|
||||
var/scheduled_move = INFINITY
|
||||
@@ -118,8 +121,8 @@
|
||||
*/
|
||||
/datum/transport_controller/linear/tram/New(obj/structure/transport/linear/tram/transport_module)
|
||||
. = ..()
|
||||
speed_limiter = transport_module.speed_limiter
|
||||
base_speed_limiter = transport_module.speed_limiter
|
||||
set_tram_speed(tram_max_speed)
|
||||
base_internal_movement_delay = internal_movement_delay
|
||||
tram_history = SSpersistence.load_tram_history(specific_transport_id)
|
||||
var/datum/tram_mfg_info/previous_tram = peek(tram_history)
|
||||
if(!isnull(previous_tram) && previous_tram.active)
|
||||
@@ -130,17 +133,26 @@
|
||||
check_starting_landmark()
|
||||
|
||||
/**
|
||||
* If someone VVs the base speed limiter of the tram, copy it to the current active speed limiter.
|
||||
* We expect people to VV tram_max_speed, and set the appropriate internal_movement_delay/base_internal_movement_delay.
|
||||
* But if they set one of the internals, we should also update tram_max_speed to reflect it.
|
||||
*
|
||||
* You cannot make the tram move faster than 1 movement per world.tick_lag, so our lower limit is 0.5 (tram_max_speed 100)
|
||||
*/
|
||||
/datum/transport_controller/linear/tram/vv_edit_var(var_name, var_value)
|
||||
. = ..()
|
||||
if(var_name == "base_speed_limiter")
|
||||
speed_limiter = max(speed_limiter, base_speed_limiter)
|
||||
if(var_name == "tram_max_speed")
|
||||
set_tram_speed(tram_max_speed)
|
||||
if(var_name == "internal_movement_delay")
|
||||
internal_movement_delay = round(max(internal_movement_delay, 0.5), 0.1)
|
||||
tram_max_speed = round(50 / internal_movement_delay, 1)
|
||||
if(var_name == "base_internal_movement_delay")
|
||||
base_internal_movement_delay = round(max(base_internal_movement_delay, 0.5), 0.1)
|
||||
internal_movement_delay = max(internal_movement_delay, base_internal_movement_delay)
|
||||
tram_max_speed = round(50 / internal_movement_delay, 1)
|
||||
|
||||
/datum/transport_controller/linear/tram/Destroy()
|
||||
paired_cabinet = null
|
||||
set_status_code(SYSTEM_FAULT, TRUE)
|
||||
SEND_SIGNAL(SStransport, COMSIG_TRANSPORT_ACTIVE, src, FALSE, controller_status, travel_direction, destination_platform)
|
||||
tram_registration.active = FALSE
|
||||
SSblackbox.record_feedback("amount", "tram_destroyed", 1)
|
||||
SSpersistence.save_tram_history(specific_transport_id)
|
||||
@@ -216,7 +228,7 @@
|
||||
explosion(transport_module, devastation_range = 1, heavy_impact_range = 2, light_impact_range = 3)
|
||||
qdel(transport_module)
|
||||
|
||||
send_transport_active_signal()
|
||||
send_transport_status_update()
|
||||
|
||||
/**
|
||||
* Calculate the journey details to the requested platform
|
||||
@@ -259,8 +271,6 @@
|
||||
playsound(paired_cabinet, 'sound/machines/synth/synth_yes.ogg', 40, vary = FALSE, extrarange = SHORT_RANGE_SOUND_EXTRARANGE)
|
||||
paired_cabinet.say("Controller reset.")
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_TRAM_TRAVEL, idle_platform, destination_platform)
|
||||
|
||||
for(var/obj/structure/transport/linear/tram/transport_module as anything in transport_modules) //only thing everyone needs to know is the new location.
|
||||
if(transport_module.travelling) //wee woo wee woo there was a double action queued. damn multi tile structs
|
||||
return //we don't care to undo cover_locked controls, though, as that will resolve itself
|
||||
@@ -270,10 +280,11 @@
|
||||
malf_active = TRANSPORT_LOCAL_FAULT
|
||||
addtimer(CALLBACK(src, PROC_REF(announce_malf_event)), 1 SECONDS)
|
||||
transport_module.verify_transport_contents()
|
||||
transport_module.glide_size_override = DELAY_TO_GLIDE_SIZE(speed_limiter)
|
||||
transport_module.internal_movement_delay = internal_movement_delay
|
||||
transport_module.glide_size_override = DELAY_TO_GLIDE_SIZE(internal_movement_delay)
|
||||
transport_module.set_travelling(TRUE)
|
||||
|
||||
scheduled_move = world.time + speed_limiter
|
||||
scheduled_move = world.time + internal_movement_delay
|
||||
|
||||
START_PROCESSING(SStransport, src)
|
||||
|
||||
@@ -321,7 +332,7 @@
|
||||
recovery_clear_count = 0
|
||||
|
||||
if(recovery_clear_count >= SStransport.max_cheap_moves)
|
||||
speed_limiter = base_speed_limiter
|
||||
set_tram_speed(tram_max_speed)
|
||||
recovery_mode = FALSE
|
||||
recovery_clear_count = 0
|
||||
log_transport("TC: [specific_transport_id] removing speed limiter, performance issue resolved. Last tick was [duration]ms.")
|
||||
@@ -331,13 +342,17 @@
|
||||
if(recovery_activate_count >= SStransport.max_exceeding_moves)
|
||||
message_admins("The tram at [ADMIN_JMP(transport_modules[1])] is taking [duration] ms which is more than [SStransport.max_time] ms per movement for [recovery_activate_count] ticks. Reducing its movement speed until it recovers. If this continues to be a problem you can reset the tram contents to its original state, and clear added objects on the Debug tab.")
|
||||
log_transport("TC: [specific_transport_id] activating speed limiter due to poor performance. Last tick was [duration]ms.")
|
||||
speed_limiter = base_speed_limiter * 2 //halves its speed
|
||||
base_internal_movement_delay = internal_movement_delay // update base in case it's been edited
|
||||
internal_movement_delay = base_internal_movement_delay * 2 //halves its speed
|
||||
recovery_mode = TRUE
|
||||
recovery_activate_count = 0
|
||||
else
|
||||
recovery_activate_count = max(recovery_activate_count - 1, 0)
|
||||
|
||||
scheduled_move = world.time + speed_limiter
|
||||
scheduled_move = world.time + internal_movement_delay
|
||||
|
||||
/datum/transport_controller/linear/tram/proc/set_tram_speed(new_speed)
|
||||
internal_movement_delay = round(clamp(50 / new_speed, 0.5, 5), 0.1)
|
||||
|
||||
/**
|
||||
* Tram stops normally, performs post-trip actions and updates the tram registration.
|
||||
@@ -351,13 +366,12 @@
|
||||
playsound(paired_cabinet, 'sound/machines/synth/synth_yes.ogg', 40, vary = FALSE, extrarange = SHORT_RANGE_SOUND_EXTRARANGE)
|
||||
paired_cabinet.say("Controller reset.")
|
||||
log_transport("TC: [specific_transport_id] position data successfully reset.")
|
||||
speed_limiter = initial(speed_limiter)
|
||||
idle_platform = destination_platform
|
||||
tram_registration.distance_travelled += (travel_trip_length - travel_remaining)
|
||||
travel_trip_length = 0
|
||||
current_speed = 0
|
||||
current_load = 0
|
||||
speed_limiter = initial(speed_limiter)
|
||||
set_tram_speed(tram_max_speed)
|
||||
|
||||
/**
|
||||
* Tram comes to an in-station degraded stop, throwing the players. Caused by power loss or tram malfunction event.
|
||||
@@ -371,7 +385,6 @@
|
||||
playsound(paired_cabinet, 'sound/machines/synth/synth_yes.ogg', 40, vary = FALSE, extrarange = SHORT_RANGE_SOUND_EXTRARANGE)
|
||||
paired_cabinet.say("Controller reset.")
|
||||
log_transport("TC: [specific_transport_id] position data successfully reset. ")
|
||||
speed_limiter = initial(speed_limiter)
|
||||
if(malf_active == TRANSPORT_LOCAL_FAULT)
|
||||
set_status_code(SYSTEM_FAULT, TRUE)
|
||||
addtimer(CALLBACK(src, PROC_REF(cycle_doors), CYCLE_OPEN), 2 SECONDS)
|
||||
@@ -384,7 +397,7 @@
|
||||
travel_trip_length = 0
|
||||
current_speed = 0
|
||||
current_load = 0
|
||||
speed_limiter = initial(speed_limiter)
|
||||
set_tram_speed(tram_max_speed)
|
||||
var/throw_direction = travel_direction
|
||||
for(var/obj/structure/transport/linear/tram/module in transport_modules)
|
||||
module.estop_throw(throw_direction)
|
||||
@@ -449,7 +462,7 @@
|
||||
travel_remaining = get_dist(nav_beacon, reset_beacon)
|
||||
travel_trip_length = travel_remaining
|
||||
destination_platform = reset_beacon
|
||||
speed_limiter = 1.5
|
||||
internal_movement_delay = 1.5
|
||||
playsound(paired_cabinet, 'sound/machines/ping.ogg', 40, vary = FALSE, extrarange = SHORT_RANGE_SOUND_EXTRARANGE)
|
||||
paired_cabinet.say("Peforming controller reset... Navigating to reset point.")
|
||||
log_transport("TC: [specific_transport_id] trip calculation: src: [nav_beacon.x], [nav_beacon.y], [nav_beacon.z] dst: [destination_platform] [destination_platform.x], [destination_platform.y], [destination_platform.z] = Dir [travel_direction] Dist [travel_remaining].")
|
||||
@@ -502,7 +515,7 @@
|
||||
return
|
||||
|
||||
controller_active = new_status
|
||||
send_transport_active_signal()
|
||||
send_transport_status_update()
|
||||
log_transport("TC: [specific_transport_id] controller state [controller_active ? "READY > PROCESSING" : "PROCESSING > READY"].")
|
||||
|
||||
/**
|
||||
@@ -524,10 +537,10 @@
|
||||
controller_status |= code
|
||||
else
|
||||
controller_status &= ~code
|
||||
send_transport_active_signal()
|
||||
send_transport_status_update()
|
||||
|
||||
/datum/transport_controller/linear/tram/proc/send_transport_active_signal()
|
||||
SEND_SIGNAL(SStransport, COMSIG_TRANSPORT_ACTIVE, src, controller_active, controller_status, travel_direction, destination_platform)
|
||||
/datum/transport_controller/linear/tram/proc/send_transport_status_update()
|
||||
SEND_SIGNAL(SStransport, COMSIG_TRANSPORT_UPDATED, src, controller_active, controller_status, travel_direction, destination_platform)
|
||||
|
||||
/**
|
||||
* Part of the pre-departure list, checks the status of the doors on the tram
|
||||
@@ -630,18 +643,18 @@
|
||||
/datum/transport_controller/linear/tram/proc/power_lost()
|
||||
set_operational(FALSE)
|
||||
log_transport("TC: [specific_transport_id] power lost.")
|
||||
send_transport_active_signal()
|
||||
|
||||
/datum/transport_controller/linear/tram/proc/power_restored()
|
||||
set_operational(TRUE)
|
||||
log_transport("TC: [specific_transport_id] power restored.")
|
||||
cycle_doors(CYCLE_OPEN)
|
||||
send_transport_active_signal()
|
||||
|
||||
/datum/transport_controller/linear/tram/proc/set_operational(new_value)
|
||||
if(controller_operational != new_value)
|
||||
controller_operational = new_value
|
||||
|
||||
send_transport_status_update()
|
||||
|
||||
/**
|
||||
* Returns the closest tram nav beacon to an atom
|
||||
*
|
||||
@@ -740,9 +753,8 @@
|
||||
return push_destination
|
||||
|
||||
|
||||
/datum/transport_controller/linear/tram/slow //for some reason speed is set to initial() in the code but if i touched it it would probably break so
|
||||
speed_limiter = 3
|
||||
base_speed_limiter = 3
|
||||
/datum/transport_controller/linear/tram/slow
|
||||
tram_max_speed = 16.5
|
||||
|
||||
/**
|
||||
* The physical cabinet on the tram. Acts as the interface between players and the controller datum.
|
||||
@@ -1013,7 +1025,7 @@
|
||||
return
|
||||
|
||||
controller_datum.notify_controller(src)
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_ACTIVE, PROC_REF(sync_controller))
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_UPDATED, PROC_REF(sync_controller))
|
||||
|
||||
/obj/machinery/transport/tram_controller/hilbert/find_controller()
|
||||
for(var/datum/transport_controller/linear/tram/tram as anything in SStransport.transports_by_type[TRANSPORT_TYPE_TRAM])
|
||||
@@ -1025,7 +1037,7 @@
|
||||
return
|
||||
|
||||
controller_datum.notify_controller(src)
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_ACTIVE, PROC_REF(sync_controller))
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_UPDATED, PROC_REF(sync_controller))
|
||||
|
||||
/**
|
||||
* Since the machinery obj is a dumb terminal for the controller datum, sync the display with the status bitfield of the tram
|
||||
@@ -1184,7 +1196,7 @@
|
||||
if(!controller_datum)
|
||||
return
|
||||
controller_datum.set_home_controller(src)
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_ACTIVE, PROC_REF(sync_controller))
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_UPDATED, PROC_REF(sync_controller))
|
||||
|
||||
/obj/item/wallframe/tram
|
||||
name = "tram controller cabinet"
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
var/datum/transport_controller/linear/tram/tram = transport_ref?.resolve()
|
||||
if(tram)
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_ACTIVE, PROC_REF(update_display))
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_UPDATED, PROC_REF(update_display))
|
||||
|
||||
/obj/machinery/computer/tram_controls/update_current_power_usage()
|
||||
return // We get power from area rectifiers
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
/obj/machinery/transport/destination_sign/Initialize(mapload)
|
||||
. = ..()
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_ACTIVE, PROC_REF(update_sign))
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_UPDATED, PROC_REF(update_sign))
|
||||
SStransport.displays += src
|
||||
available_faces = list(
|
||||
TRAMSTATION_LINE_1,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#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 (2.7 SECONDS)
|
||||
/// Amount of travel distance to force open tram doors while moving
|
||||
#define TRAM_DOOR_RELEASE_THRESHOLD 17
|
||||
|
||||
/obj/machinery/door/airlock/tram
|
||||
name = "tram door"
|
||||
@@ -23,6 +21,7 @@
|
||||
var/retry_counter
|
||||
var/crushing_in_progress = FALSE
|
||||
bound_width = 64
|
||||
COOLDOWN_DECLARE(release_cooldown)
|
||||
|
||||
/obj/machinery/door/airlock/tram/Initialize(mapload)
|
||||
. = ..()
|
||||
@@ -40,15 +39,12 @@
|
||||
return FALSE
|
||||
|
||||
SEND_SIGNAL(src, COMSIG_AIRLOCK_OPEN, FALSE)
|
||||
set_airlock_state(AIRLOCK_OPENING, animated = TRUE)
|
||||
var/animate_open = forced == BYPASS_DOOR_CHECKS ? FALSE : TRUE
|
||||
set_airlock_state(AIRLOCK_OPENING, animate_open, force_type = forced)
|
||||
|
||||
var/passable_delay
|
||||
var/passable_delay = animation_segment_delay(AIRLOCK_OPENING_PASSABLE)
|
||||
if(forced >= BYPASS_DOOR_CHECKS)
|
||||
playsound(src, 'sound/machines/airlock/airlockforced.ogg', vol = 40, vary = FALSE)
|
||||
passable_delay = 0
|
||||
else
|
||||
playsound(src, doorOpen, vol = 40, vary = FALSE)
|
||||
passable_delay = animation_segment_delay(AIRLOCK_OPENING_PASSABLE)
|
||||
|
||||
sleep(passable_delay)
|
||||
set_density(FALSE)
|
||||
@@ -56,7 +52,7 @@
|
||||
filler.set_density(FALSE)
|
||||
flags_1 &= ~PREVENT_CLICK_UNDER_1
|
||||
air_update_turf(TRUE, FALSE)
|
||||
var/open_delay = animation_segment_delay(AIRLOCK_OPENING_FINISHED) - passable_delay
|
||||
var/open_delay = forced == BYPASS_DOOR_CHECKS ? (0.2 SECONDS) : (animation_segment_delay(AIRLOCK_OPENING_FINISHED) - passable_delay)
|
||||
sleep(open_delay)
|
||||
layer = OPEN_DOOR_LAYER
|
||||
set_airlock_state(AIRLOCK_OPEN, animated = FALSE)
|
||||
@@ -72,7 +68,7 @@
|
||||
if(retry_counter == 1)
|
||||
playsound(src, 'sound/machines/chime.ogg', 40, vary = FALSE, extrarange = SHORT_RANGE_SOUND_EXTRARANGE)
|
||||
|
||||
addtimer(CALLBACK(src, PROC_REF(verify_status)), TRAM_DOOR_RECYCLE_TIME)
|
||||
addtimer(CALLBACK(src, PROC_REF(verify_status)), (2.7 SECONDS))
|
||||
try_to_close()
|
||||
|
||||
/**
|
||||
@@ -92,9 +88,8 @@
|
||||
do_sparks(3, TRUE, src)
|
||||
playsound(src, SFX_SPARKS, vol = 75, vary = FALSE, extrarange = SHORT_RANGE_SOUND_EXTRARANGE)
|
||||
use_energy(50 JOULES)
|
||||
playsound(src, doorClose, vol = 40, vary = FALSE)
|
||||
layer = CLOSED_DOOR_LAYER
|
||||
set_airlock_state(AIRLOCK_CLOSING, animated = TRUE)
|
||||
set_airlock_state(AIRLOCK_CLOSING, animated = TRUE, force_type = forced)
|
||||
var/unpassable_delay = animation_segment_delay(AIRLOCK_CLOSING_UNPASSABLE)
|
||||
sleep(unpassable_delay)
|
||||
if(!hungry_door)
|
||||
@@ -104,7 +99,7 @@
|
||||
say("Please stand clear of the doors!")
|
||||
playsound(src, 'sound/machines/buzz/buzz-sigh.ogg', 60, vary = FALSE, extrarange = SHORT_RANGE_SOUND_EXTRARANGE)
|
||||
layer = OPEN_DOOR_LAYER
|
||||
set_airlock_state(AIRLOCK_OPEN, animated = FALSE)
|
||||
set_airlock_state(AIRLOCK_OPEN, animated = FALSE, force_type = forced)
|
||||
return FALSE
|
||||
SEND_SIGNAL(src, COMSIG_AIRLOCK_CLOSE)
|
||||
var/opaque_delay = animation_segment_delay(AIRLOCK_CLOSING_OPAQUE) - unpassable_delay
|
||||
@@ -118,7 +113,7 @@
|
||||
crushing_in_progress = FALSE
|
||||
var/close_delay = animation_segment_delay(AIRLOCK_CLOSING_FINISHED) - unpassable_delay - opaque_delay
|
||||
sleep(close_delay)
|
||||
set_airlock_state(AIRLOCK_CLOSED, animated = FALSE)
|
||||
set_airlock_state(AIRLOCK_CLOSED, animated = FALSE, force_type = forced)
|
||||
retry_counter = 0
|
||||
return TRUE
|
||||
|
||||
@@ -222,22 +217,20 @@
|
||||
* 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))
|
||||
if(!COOLDOWN_FINISHED(src, release_cooldown))
|
||||
return
|
||||
|
||||
if(!hasPower() && density)
|
||||
balloon_alert(user, "pulling emergency exit...")
|
||||
if(do_after(user, 4 SECONDS, target = src))
|
||||
try_to_crowbar(null, user, TRUE)
|
||||
return TRUE
|
||||
COOLDOWN_START(src, release_cooldown, 1.2 SECONDS)
|
||||
playsound(src, soundin = 'sound/machines/airlock/airlockforced.ogg', vol = 40, vary = FALSE)
|
||||
balloon_alert_to_viewers("pulling emergency exit!", vision_distance = COMBAT_MESSAGE_RANGE)
|
||||
if(do_after(user, 1.2 SECONDS, target = src))
|
||||
open(forced = BYPASS_DOOR_CHECKS)
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
@@ -245,17 +238,33 @@
|
||||
try_safety_unlock(user)
|
||||
return
|
||||
|
||||
if(!COOLDOWN_FINISHED(src, release_cooldown))
|
||||
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)
|
||||
if((tram_part.travel_remaining < TRAM_DOOR_RELEASE_THRESHOLD || tram_part.travel_remaining > tram_part.travel_trip_length - TRAM_DOOR_RELEASE_THRESHOLD) && tram_part.controller_active)
|
||||
return // we're already animating, don't reset that
|
||||
set_airlock_state(AIRLOCK_OPENING, animated = TRUE)
|
||||
COOLDOWN_START(src, release_cooldown, 1.2 SECONDS)
|
||||
playsound(src, soundin = 'sound/machines/airlock/airlockforced.ogg', vol = 40, vary = FALSE)
|
||||
balloon_alert_to_viewers("pulling emergency exit!", vision_distance = COMBAT_MESSAGE_RANGE)
|
||||
if(do_after(user, delay = 0.6 SECONDS, timed_action_flags = IGNORE_USER_LOC_CHANGE | IGNORE_SLOWDOWNS))
|
||||
open(forced = BYPASS_DOOR_CHECKS)
|
||||
|
||||
#undef TRAM_DOOR_WARNING_TIME
|
||||
#undef TRAM_DOOR_CYCLE_TIME
|
||||
#undef TRAM_DOOR_CRUSH_TIME
|
||||
#undef TRAM_DOOR_RECYCLE_TIME
|
||||
/obj/machinery/door/airlock/tram/animation_effects(animation, force_type = DEFAULT_DOOR_CHECKS)
|
||||
if(force_type == BYPASS_DOOR_CHECKS)
|
||||
return
|
||||
|
||||
switch(animation)
|
||||
if(DOOR_OPENING_ANIMATION)
|
||||
use_energy(50 JOULES)
|
||||
playsound(src, soundin = doorOpen, vol = 40, vary = FALSE)
|
||||
if(DOOR_CLOSING_ANIMATION)
|
||||
use_energy(50 JOULES)
|
||||
playsound(src, soundin = doorClose, vol = 40, vary = FALSE)
|
||||
if(DOOR_DENY_ANIMATION)
|
||||
addtimer(CALLBACK(src, PROC_REF(handle_deny_end)), 0.6 SECONDS)
|
||||
|
||||
#undef TRAM_DOOR_RELEASE_THRESHOLD
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
/obj/machinery/transport/power_rectifier/post_machine_initialize()
|
||||
. = ..()
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_ACTIVE, PROC_REF(power_tram))
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_UPDATED, PROC_REF(power_tram))
|
||||
find_platform()
|
||||
|
||||
/**
|
||||
|
||||
@@ -103,8 +103,7 @@
|
||||
|
||||
/obj/machinery/transport/crossing_signal/Initialize(mapload)
|
||||
. = ..()
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_ACTIVE, PROC_REF(wake_up))
|
||||
RegisterSignal(SStransport, COMSIG_COMMS_STATUS, PROC_REF(comms_change))
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_UPDATED, PROC_REF(wake_up))
|
||||
SStransport.crossing_signals += src
|
||||
register_context()
|
||||
|
||||
@@ -353,7 +352,7 @@
|
||||
return PROCESS_KILL
|
||||
|
||||
// Finally the interesting part where it's ACTUALLY approaching
|
||||
if(approach_distance <= red_distance_threshold)
|
||||
if(approach_distance <= red_distance_threshold && operating_status == TRANSPORT_SYSTEM_NORMAL)
|
||||
set_signal_state(XING_STATE_RED)
|
||||
return
|
||||
if(approach_distance <= amber_distance_threshold && operating_status == TRANSPORT_SYSTEM_NORMAL)
|
||||
@@ -488,7 +487,7 @@
|
||||
/obj/machinery/transport/guideway_sensor/post_machine_initialize()
|
||||
. = ..()
|
||||
pair_sensor()
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_ACTIVE, PROC_REF(wake_up))
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_UPDATED, PROC_REF(wake_up))
|
||||
|
||||
/obj/machinery/transport/guideway_sensor/add_context(atom/source, list/context, obj/item/held_item, mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -467,7 +467,7 @@
|
||||
return INITIALIZE_HINT_LATELOAD
|
||||
|
||||
/obj/structure/tram/spoiler/LateInitialize()
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_ACTIVE, PROC_REF(set_spoiler))
|
||||
RegisterSignal(SStransport, COMSIG_TRANSPORT_UPDATED, PROC_REF(set_spoiler))
|
||||
|
||||
/obj/structure/tram/spoiler/add_context(atom/source, list/context, obj/item/held_item, mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
var/list/atom/movable/changed_gliders = list()
|
||||
|
||||
///decisecond delay between horizontal movements. cannot make the tram move faster than 1 movement per world.tick_lag. only used to give to the transport_controller
|
||||
var/speed_limiter = 0.5
|
||||
var/internal_movement_delay = 0.5
|
||||
|
||||
///master datum that controls our movement. in general /transport/linear subtypes control moving themselves, and
|
||||
/// /datum/transport_controller instances control moving the entire tram and any behavior associated with that.
|
||||
@@ -415,7 +415,7 @@
|
||||
for(var/mob/living/victim_living in dest_turf.contents)
|
||||
var/damage_multiplier = victim_living.maxHealth * 0.01
|
||||
var/extra_ouch = FALSE // if emagged you're gonna have a really bad time
|
||||
if(speed_limiter == 0.5) // slow trams don't cause extra damage
|
||||
if(internal_movement_delay <= 1) // slow trams don't cause extra damage
|
||||
for(var/obj/structure/tram/spoiler/my_spoiler in transport_contents)
|
||||
if(istype(victim_living.buckled, /obj/structure/fluff/tram_rail))
|
||||
extra_ouch = TRUE
|
||||
@@ -912,7 +912,6 @@
|
||||
UnregisterSignal(glider, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE)
|
||||
|
||||
src.travelling = travelling
|
||||
SEND_SIGNAL(src, COMSIG_TRANSPORT_ACTIVE, travelling)
|
||||
|
||||
/obj/structure/transport/linear/tram/set_currently_z_moving()
|
||||
return FALSE //trams can never z fall and shouldnt waste any processing time trying to do so
|
||||
@@ -972,4 +971,3 @@
|
||||
|
||||
/obj/structure/transport/linear/tram/slow
|
||||
transport_controller_type = /datum/transport_controller/linear/tram/slow
|
||||
speed_limiter = /datum/transport_controller/linear/tram/slow::speed_limiter
|
||||
|
||||
Reference in New Issue
Block a user