Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vehicle bay elevator stuff #5851

Merged
merged 5 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions code/game/objects/effects/elevator.dm
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
/obj/effect/elevator/supply
name = "\improper empty space"
desc = "There seems to be an awful lot of machinery down below"
/obj/effect/elevator
name = "\proper empty space"
desc = "There seems to be an awful lot of machinery down below..."
icon = 'icons/effects/160x160.dmi'
icon_state = "supply_elevator_lowered"
unacidable = TRUE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
layer = ABOVE_TURF_LAYER
appearance_flags = KEEP_TOGETHER

/obj/effect/elevator/supply/ex_act(severity)
/obj/effect/elevator/ex_act(severity)
return

/obj/effect/elevator/supply/Destroy(force)
/obj/effect/elevator/Destroy(force)
if(!force)
return QDEL_HINT_LETMELIVE
return ..()

/obj/effect/elevator/supply/visible_message() //Prevents message spam with empty elevator shaft - "The empty space falls into the depths!"
// Don't move with the elevator.
/obj/effect/elevator/onShuttleMove(turf/newT, turf/oldT, list/movement_force, move_dir, obj/docking_port/stationary/old_dock, obj/docking_port/mobile/moving_dock)
return
/obj/effect/elevator/afterShuttleMove(turf/oldT, list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir, rotation)
return
/obj/effect/elevator/lateShuttleMove(turf/oldT, list/movement_force, move_dir)
return

/obj/effect/elevator/animation_overlay
blend_mode = BLEND_INSET_OVERLAY
appearance_flags = KEEP_TOGETHER

/obj/effect/elevator/vehicle
icon_state = "vehicle_elevator_lowered"
60 changes: 40 additions & 20 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"
desc = "There seems to be an awful lot of machinery down below"
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/effect/elevator) && !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
100 changes: 86 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 All @@ -55,6 +87,46 @@
id = "almayer vehicle"
roundstart_template = /datum/map_template/shuttle/vehicle

//elevator effects (four so the entire elevator doesn't vanish when there's one opaque obstacle between you and the actual elevator loc).
var/obj/effect/elevator/vehicle/SW
var/obj/effect/elevator/vehicle/SE
var/obj/effect/elevator/vehicle/NW
var/obj/effect/elevator/vehicle/NE

/obj/docking_port/stationary/vehicle_elevator/almayer/Initialize(mapload)
. = ..()
// Create and offset some effects for the elevator shaft sprite.
SW = new(locate(src.x - 2, src.y - 2, src.z))

SE = new(locate(src.x + 2, src.y - 2, src.z))
SE.pixel_x = -128

NW = new(locate(src.x - 2, src.y + 2, src.z))
NW.pixel_y = -128

NE = new(locate(src.x + 2, src.y + 2, src.z))
NE.pixel_x = -128
NE.pixel_y = -128

SW.invisibility = INVISIBILITY_ABSTRACT
SE.invisibility = INVISIBILITY_ABSTRACT
NW.invisibility = INVISIBILITY_ABSTRACT
NE.invisibility = INVISIBILITY_ABSTRACT

// Make the elevator shaft visible when the elevator leaves.
/obj/docking_port/stationary/vehicle_elevator/almayer/on_departure(obj/docking_port/mobile/departing_shuttle)
SW.invisibility = 0
SE.invisibility = 0
NW.invisibility = 0
NE.invisibility = 0

// And make it invisible again when the elevator returns.
/obj/docking_port/stationary/vehicle_elevator/almayer/on_arrival(obj/docking_port/mobile/arriving_shuttle)
SW.invisibility = INVISIBILITY_ABSTRACT
SE.invisibility = INVISIBILITY_ABSTRACT
NW.invisibility = INVISIBILITY_ABSTRACT
NE.invisibility = INVISIBILITY_ABSTRACT

/obj/docking_port/stationary/vehicle_elevator/adminlevel
name = "Adminlevel Vehicle Elevator Dock"
id = "adminlevel vehicle"
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
28 changes: 8 additions & 20 deletions code/modules/shuttles/shuttle_supply.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
var/max_late_time = 300
var/railing_id = "supply_elevator_railing"
var/gear_id = "supply_elevator_gear"
var/obj/effect/elevator/supply/SW //elevator effects (four so the entire elevator doesn't vanish when
var/obj/effect/elevator/supply/SE //there's one opaque obstacle between you and the actual elevator loc).
var/obj/effect/elevator/supply/NW
var/obj/effect/elevator/supply/NE
var/obj/effect/elevator/SW //elevator effects (four so the entire elevator doesn't vanish when
var/obj/effect/elevator/SE //there's one opaque obstacle between you and the actual elevator loc).
var/obj/effect/elevator/NW
var/obj/effect/elevator/NE
var/Elevator_x
var/Elevator_y
var/Elevator_z
Expand All @@ -34,15 +34,15 @@
Elevator_x = pick_loc().x
Elevator_y = pick_loc().y
Elevator_z = pick_loc().z
SW = new /obj/effect/elevator/supply(locate(Elevator_x-2,Elevator_y-2,Elevator_z))
SW = new /obj/effect/elevator(locate(Elevator_x-2,Elevator_y-2,Elevator_z))
SW.vis_contents += elevator_animation
SE = new /obj/effect/elevator/supply(locate(Elevator_x+2,Elevator_y-2,Elevator_z))
SE = new /obj/effect/elevator(locate(Elevator_x+2,Elevator_y-2,Elevator_z))
SE.pixel_x = -128
SE.vis_contents += elevator_animation
NW = new /obj/effect/elevator/supply(locate(Elevator_x-2,Elevator_y+2,Elevator_z))
NW = new /obj/effect/elevator(locate(Elevator_x-2,Elevator_y+2,Elevator_z))
NW.pixel_y = -128
NW.vis_contents += elevator_animation
NE = new /obj/effect/elevator/supply(locate(Elevator_x+2,Elevator_y+2,Elevator_z))
NE = new /obj/effect/elevator(locate(Elevator_x+2,Elevator_y+2,Elevator_z))
NE.pixel_x = -128
NE.pixel_y = -128
NE.vis_contents += elevator_animation
Expand Down 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
SabreML marked this conversation as resolved.
Show resolved Hide resolved
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
Loading