Skip to content

Commit

Permalink
Vehicle elevator timing, sfx, railings, and pit teleportation
Browse files Browse the repository at this point in the history
Too late to try to make this atomic
  • Loading branch information
SabreML committed Feb 29, 2024
1 parent 2778c29 commit bc896c3
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 50 deletions.
58 changes: 39 additions & 19 deletions code/game/turfs/floor_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,13 @@
plating_type = /turf/open/floor/tdome
hull_floor = TRUE

//Cargo elevator
/// Base type of the requisitions and vehicle bay elevator pits.
/turf/open/floor/almayer/empty
name = "empty space"
name = "\proper empty space"
desc = "There seems to be an awful lot of machinery down below"
icon = 'icons/turf/floors/floors.dmi'
icon_state = "black"

/turf/open/floor/almayer/empty/Initialize(mapload, ...)
. = ..()
GLOB.asrs_empty_space_tiles_list += src

/turf/open/floor/almayer/empty/Destroy(force) // may as well
. = ..()
GLOB.asrs_empty_space_tiles_list -= src

/turf/open/floor/almayer/empty/is_weedable()
return NOT_WEEDABLE

Expand All @@ -239,9 +231,14 @@

/turf/open/floor/almayer/empty/Entered(atom/movable/AM)
..()
if(!isobserver(AM))
if(!isobserver(AM) && !istype(AM, /obj/docking_port))
addtimer(CALLBACK(src, PROC_REF(enter_depths), AM), 0.2 SECONDS)

/// Returns a list of turfs to be used as a destination for anyone unfortunate enough to fall into the pit.
/turf/open/floor/almayer/empty/proc/get_depths_turfs()
// Empty proc to be overridden.
return

/turf/open/floor/almayer/empty/proc/enter_depths(atom/movable/AM)
if(AM.throwing == 0 && istype(get_turf(AM), /turf/open/floor/almayer/empty))
AM.visible_message(SPAN_WARNING("[AM] falls into the depths!"), SPAN_WARNING("You fall into the depths!"))
Expand All @@ -252,14 +249,12 @@
for(var/atom/computer as anything in GLOB.supply_controller.bound_supply_computer_list)
computer.balloon_alert_to_viewers("you hear horrifying noises coming from the elevator!")

var/area/area_shuttle = GLOB.supply_controller.shuttle?.get_location_area()
if(!area_shuttle)
return
var/list/turflist = list()
for(var/turf/turf in area_shuttle)
turflist |= turf
var/list/depths_turfs = get_depths_turfs()
if(!length(depths_turfs))
// If this ever happens, something went wrong.
CRASH("get_depths_turfs() didn't return anything!")

thrown_human.forceMove(pick(turflist))
thrown_human.forceMove(pick(depths_turfs))

var/timer = 0.5 SECONDS
for(var/index in 1 to 10)
Expand All @@ -268,9 +263,34 @@
return

else
for(var/obj/effect/decal/cleanable/C in contents) //for the off chance of someone bleeding mid=flight
for(var/obj/effect/decal/cleanable/C in contents) //for the off chance of someone bleeding mid-flight
qdel(C)

/// Requisitions pit.
/turf/open/floor/almayer/empty/requisitions

/turf/open/floor/almayer/empty/requisitions/Initialize(mapload, ...)
. = ..()
GLOB.asrs_empty_space_tiles_list += src

/turf/open/floor/almayer/empty/requisitions/Destroy(force)
GLOB.asrs_empty_space_tiles_list -= src
return ..()

/turf/open/floor/almayer/empty/requisitions/get_depths_turfs()
var/area/elevator_area = GLOB.supply_controller.shuttle?.get_location_area()

var/turf_list = list()
for(var/turf/turf in elevator_area)
turf_list |= turf
return turf_list

/// Vehicle bay pit.
/turf/open/floor/almayer/empty/vehicle_bay

/turf/open/floor/almayer/empty/vehicle_bay/get_depths_turfs()
return SSshuttle.vehicle_elevator.return_turfs()

//Others
/turf/open/floor/almayer/uscm
icon_state = "logo_c"
Expand Down
60 changes: 46 additions & 14 deletions code/modules/shuttle/vehicle_elevator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

id = MOBILE_SHUTTLE_VEHICLE_ELEVATOR

callTime = 5 SECONDS
ignitionTime = 1 SECONDS
// Call and ""ignition"" times are set to line up with the sound effects.
callTime = 4 SECONDS
ignitionTime = 5 SECONDS

ignition_sound = 'sound/machines/asrs_raising.ogg'
ignition_sound = 'sound/machines/asrs_lowering.ogg'
ambience_idle = null
ambience_flight = null

Expand All @@ -28,19 +29,50 @@
railings += R

/obj/docking_port/mobile/vehicle_elevator/on_ignition()
for(var/i in gears)
var/obj/structure/machinery/gear/G = i
G.start_moving()

/obj/docking_port/mobile/vehicle_elevator/afterShuttleMove()
. = ..()
// If the elevator isn't in the vehicle bay, start the gears immediately.
if(!is_mainship_level(z))
start_gears()

// Play the 'raising' sound effect at the destination docking port manually.
// `landing_sound` can't be used since that only plays on the elevator itself,
// and this sound file is too long for that either way.
playsound(destination, 'sound/machines/asrs_raising.ogg', 60)
return
for(var/i in gears)
var/obj/structure/machinery/gear/G = i
G.stop_moving()
for(var/i in railings)
var/obj/structure/machinery/door/poddoor/railing/R = i
INVOKE_ASYNC(R, TYPE_PROC_REF(/obj/structure/machinery/door, open))

// If the elevator *is* in the vehicle bay, close the railings and start the gears when it leaves.
close_railings()
addtimer(CALLBACK(src, PROC_REF(start_gears)), ignitionTime)

/obj/docking_port/mobile/vehicle_elevator/afterShuttleMove()
. = ..()
// Check `get_docked()` in order to skip this if it just moved to the 'transit' port.
if(get_docked() == destination)
stop_gears()

// If the elevator moved to the vehicle bay, open the railings.
if(is_mainship_level(z))
open_railings()

/obj/docking_port/mobile/vehicle_elevator/proc/start_gears()
for(var/obj/structure/machinery/gear/gear as anything in gears)
gear.start_moving()

/obj/docking_port/mobile/vehicle_elevator/proc/stop_gears()
for(var/obj/structure/machinery/gear/gear as anything in gears)
gear.stop_moving()

/obj/docking_port/mobile/vehicle_elevator/proc/open_railings()
for(var/obj/structure/machinery/door/poddoor/railing/railing as anything in railings)
// If the railing isn't already open.
if(railing.density)
railing.open()

/obj/docking_port/mobile/vehicle_elevator/proc/close_railings()
for(var/obj/structure/machinery/door/poddoor/railing/railing as anything in railings)
// If the railing isn't already closed.
if(!railing.density)
railing.close()

/obj/docking_port/stationary/vehicle_elevator
name = "Root Vehicle Elevator Dock"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/shuttles/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
if(iselevator)
if(istype(T,/turf/open/space))
if(is_mainship_level(T.z))
T.ChangeTurf(/turf/open/floor/almayer/empty)
T.ChangeTurf(/turf/open/floor/almayer/empty/requisitions)
else
T.ChangeTurf(/turf/open/gm/empty)
else if(istype(T,/turf/open/space))
Expand Down
12 changes: 0 additions & 12 deletions code/modules/shuttles/shuttle_supply.dm
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,3 @@
if(M.id == gear_id)
spawn()
M.icon_state = "gear"

/obj/effect/landmark/vehicleelevator/Initialize(mapload, ...)
. = ..()
GLOB.vehicle_elevator = get_turf(src)
return INITIALIZE_HINT_QDEL

/datum/shuttle/ferry/supply/vehicle
railing_id = "vehicle_elevator_railing"
gear_id = "vehicle_elevator_gears"

/datum/shuttle/ferry/supply/vehicle/pick_loc()
return GLOB.vehicle_elevator
8 changes: 4 additions & 4 deletions maps/map_files/USS_Almayer/USS_Almayer.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -12215,7 +12215,7 @@
/turf/open/floor/almayer,
/area/almayer/squads/req)
"bpR" = (
/turf/open/floor/almayer/empty,
/turf/open/floor/almayer/empty/requisitions,
/area/supply/station)
"bpS" = (
/obj/structure/machinery/door/poddoor/railing{
Expand Down Expand Up @@ -12587,7 +12587,7 @@
/area/almayer/squads/req)
"bsK" = (
/obj/effect/landmark/supply_elevator,
/turf/open/floor/almayer/empty,
/turf/open/floor/almayer/empty/requisitions,
/area/supply/station)
"bsL" = (
/obj/structure/machinery/door/poddoor/railing{
Expand Down Expand Up @@ -53225,7 +53225,7 @@
/area/almayer/squads/bravo)
"oiX" = (
/obj/docking_port/stationary/vehicle_elevator/almayer,
/turf/open/floor/almayer/empty,
/turf/open/floor/almayer/empty/vehicle_bay,
/area/almayer/hallways/lower/vehiclehangar)
"oiY" = (
/obj/effect/decal/warning_stripes{
Expand Down Expand Up @@ -65062,7 +65062,7 @@
},
/area/almayer/medical/lower_medical_medbay)
"sje" = (
/turf/open/floor/almayer/empty,
/turf/open/floor/almayer/empty/vehicle_bay,
/area/almayer/hallways/lower/vehiclehangar)
"sjj" = (
/obj/structure/machinery/keycard_auth{
Expand Down

0 comments on commit bc896c3

Please sign in to comment.