This commit is contained in:
EmeraldSundisk
2020-07-04 21:33:29 -07:00
parent 99168e3ed0
commit c6b5bac0d8
871 changed files with 411113 additions and 96055 deletions
+42 -124
View File
@@ -11,31 +11,17 @@
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
anchored = TRUE
/// The identifier of the port or ship.
/// This will be used in numerous other places like the console,
/// stationary ports and whatnot to tell them your ship's mobile
/// port can be used in these places, or the docking port is compatible, etc.
//
var/id
///Common standard is for this to point -away- from the dockingport door, ie towards the ship
// this should point -away- from the dockingport door, ie towards the ship
dir = NORTH
///size of covered area, perpendicular to dir. You shouldn't modify this for mobile dockingports, set automatically.
var/width = 0
///size of covered area, parallel to dir. You shouldn't modify this for mobile dockingports, set automatically.
var/height = 0
///position relative to covered area, perpendicular to dir. You shouldn't modify this for mobile dockingports, set automatically.
var/dwidth = 0
///position relative to covered area, parallel to dir. You shouldn't modify this for mobile dockingports, set automatically.
var/dheight = 0
var/width = 0 //size of covered area, perpendicular to dir
var/height = 0 //size of covered area, parallel to dir
var/dwidth = 0 //position relative to covered area, perpendicular to dir
var/dheight = 0 //position relative to covered area, parallel to dir
var/area_type
///are we invisible to shuttle navigation computers?
var/hidden = FALSE
///Delete this port after ship fly off.
var/delete_after = FALSE
/obj/docking_port/proc/get_save_vars()
return list("pixel_x", "pixel_y", "dir", "name", "req_access", "req_access_txt", "piping_layer", "color", "icon_state", "pipe_color", "amount", "width", "height", "dwidth", "dheight")
var/hidden = FALSE //are we invisible to shuttle navigation computers?
//these objects are indestructible
/obj/docking_port/Destroy(force)
@@ -169,6 +155,8 @@
/obj/docking_port/stationary
name = "dock"
area_type = SHUTTLE_DEFAULT_UNDERLYING_AREA
var/last_dock_time
var/datum/map_template/shuttle/roundstart_template
@@ -181,9 +169,6 @@
id = "[SSshuttle.stationary.len]"
if(name == "dock")
name = "dock[SSshuttle.stationary.len]"
if(!area_type)
var/area/place = get_area(src)
area_type = place?.type || SHUTTLE_DEFAULT_UNDERLYING_AREA // We might be created in nullspace
if(mapload)
for(var/turf/T in return_turfs())
@@ -198,13 +183,6 @@
SSshuttle.stationary -= src
. = ..()
/obj/docking_port/stationary/Moved(atom/oldloc, dir, forced)
. = ..()
if(area_type) // We already have one
return
var/area/newarea = get_area(src)
area_type = newarea?.type
/obj/docking_port/stationary/proc/load_roundstart()
if(json_key)
var/sid = SSmapping.config.shuttles[json_key]
@@ -257,25 +235,16 @@
var/list/shuttle_areas
///used as a timer (if you want time left to complete move, use timeLeft proc)
var/timer
var/timer //used as a timer (if you want time left to complete move, use timeLeft proc)
var/last_timer_length
///current shuttle mode
var/mode = SHUTTLE_IDLE
///time spent in transit (deciseconds). Should not be lower then 10 seconds without editing the animation of the hyperspace ripples.
var/callTime = 100
/// time spent "starting the engines". Also rate limits how often we try to reserve transit space if its ever full of transiting shuttles.
var/ignitionTime = 55
/// time spent after arrival before being able to begin ignition
var/rechargeTime = 0
/// time spent after transit 'landing' before actually arriving
var/prearrivalTime = 0
/// The direction the shuttle prefers to travel in, ie what direction
/// the animation will cause it to appear to be traveling in
var/mode = SHUTTLE_IDLE //current shuttle mode
var/callTime = 100 //time spent in transit (deciseconds). Should not be lower then 10 seconds without editing the animation of the hyperspace ripples.
var/ignitionTime = 55 // time spent "starting the engines". Also rate limits how often we try to reserve transit space if its ever full of transiting shuttles.
// The direction the shuttle prefers to travel in
var/preferred_direction = NORTH
/// relative direction of the docking port from the front of the shuttle
/// NORTH is towards front, EAST would be starboard side, WEST port, etc.
// And the angle from the front of the shuttle to the port
var/port_direction = NORTH
var/obj/docking_port/stationary/destination
@@ -285,16 +254,13 @@
var/launch_status = NOLAUNCH
///Whether or not you want your ship to knock people down, and also whether it will throw them several tiles upon launching.
var/list/movement_force = list("KNOCKDOWN" = 3, "THROW" = 0)
var/list/movement_force = list("KNOCKDOWN" = 3, "THROW" = 2)
var/list/ripples = list()
var/engine_coeff = 1
var/current_engines = 0
var/initial_engines = 0
var/list/engine_list = list()
///if this shuttle can move docking ports other than the one it is docked at
var/can_move_docking_ports = FALSE
var/engine_coeff = 1 //current engine coeff
var/current_engines = 0 //current engine power
var/initial_engines = 0 //initial engine power
var/can_move_docking_ports = FALSE //if this shuttle can move docking ports other than the one it is docked at
var/list/hidden_turfs = list()
/obj/docking_port/mobile/proc/register()
@@ -342,12 +308,14 @@
id = "[id][idnum]"
if(name == initial(name))
name = "[name] [idnum]"
for(var/place in shuttle_areas)
var/area/area = place
area.connect_to_shuttle(src, dock, idnum, FALSE)
for(var/each in place)
var/atom/atom = each
atom.connect_to_shuttle(src, dock, idnum, FALSE)
for(var/i in shuttle_areas)
var/area/place = i
for(var/obj/machinery/computer/shuttle/comp in place)
comp.connect_to_shuttle(src, dock, idnum)
for(var/obj/machinery/computer/camera_advanced/shuttle_docker/comp in place)
comp.connect_to_shuttle(src, dock, idnum)
for(var/obj/machinery/status_display/shuttle/sd in place)
sd.connect_to_shuttle(src, dock, idnum)
//this is a hook for custom behaviour. Maybe at some point we could add checks to see if engines are intact
@@ -455,10 +423,7 @@
if(initiate_docking(S1) != DOCKING_SUCCESS)
WARNING("shuttle \"[id]\" could not enter transit space. Docked at [S0 ? S0.id : "null"]. Transit dock [S1 ? S1.id : "null"].")
else
if(S0.delete_after)
qdel(S0, TRUE)
else
previous = S0
previous = S0
else
WARNING("shuttle \"[id]\" could not enter transit space. S0=[S0 ? S0.id : "null"] S1=[S1 ? S1.id : "null"]")
@@ -507,7 +472,7 @@
if(M.mind && !istype(t, /turf/open/floor/plasteel/shuttle/red) && !istype(t, /turf/open/floor/mineral/plastitanium/red/brig))
M.mind.force_escaped = TRUE
// Ghostize them and put them in nullspace stasis (for stat & possession checks)
M.mob_transforming = TRUE
M.notransform = TRUE
M.ghostize(FALSE)
M.moveToNullspace()
@@ -571,11 +536,7 @@
// If we can't dock or we don't have a transit slot, wait for 20 ds,
// then try again
switch(mode)
if(SHUTTLE_CALL, SHUTTLE_PREARRIVAL)
if(prearrivalTime && mode != SHUTTLE_PREARRIVAL)
mode = SHUTTLE_PREARRIVAL
setTimer(prearrivalTime)
return
if(SHUTTLE_CALL)
var/error = initiate_docking(destination, preferred_direction)
if(error && error & (DOCKING_NULL_DESTINATION | DOCKING_NULL_SOURCE))
var/msg = "A mobile dock in transit exited initiate_docking() with an error. This is most likely a mapping problem: Error: [error], ([src]) ([previous][ADMIN_JMP(previous)] -> [destination][ADMIN_JMP(destination)])"
@@ -586,10 +547,6 @@
else if(error)
setTimer(20)
return
if(rechargeTime)
mode = SHUTTLE_RECHARGING
setTimer(rechargeTime)
return
if(SHUTTLE_RECALL)
if(initiate_docking(previous) != DOCKING_SUCCESS)
setTimer(20)
@@ -692,10 +649,6 @@
return "ESC"
if(SHUTTLE_STRANDED)
return "ERR"
if(SHUTTLE_RECHARGING)
return "RCH"
if(SHUTTLE_PREARRIVAL)
return "LDN"
return ""
// returns 5-letter timer string, used by status screens and mob status panel
@@ -714,7 +667,7 @@
/obj/docking_port/mobile/proc/getStatusText()
var/obj/docking_port/stationary/dockedAt = get_docked()
var/docked_at = dockedAt?.name || "unknown"
if(istype(dockedAt, /obj/docking_port/stationary/transit))
if (timeLeft() > 1 HOURS)
return "hyperspace"
@@ -725,10 +678,8 @@
else
dst = destination
. = "transit towards [dst?.name || "unknown location"] ([getTimerStr()])"
else if(mode == SHUTTLE_RECHARGING)
return "[docked_at], recharging [getTimerStr()]"
else
return docked_at
return dockedAt?.name || "unknown"
/obj/docking_port/mobile/proc/getDbgStatusText()
@@ -760,47 +711,19 @@
return null
/obj/docking_port/mobile/proc/hyperspace_sound(phase, list/areas)
var/selected_sound
var/s
switch(phase)
if(HYPERSPACE_WARMUP)
selected_sound = "hyperspace_begin"
s = 'sound/effects/hyperspace_begin.ogg'
if(HYPERSPACE_LAUNCH)
selected_sound = "hyperspace_progress"
s = 'sound/effects/hyperspace_progress.ogg'
if(HYPERSPACE_END)
selected_sound = "hyperspace_end"
s = 'sound/effects/hyperspace_end.ogg'
else
CRASH("Invalid hyperspace sound phase: [phase]")
// This previously was played from each door at max volume, and was one of the worst things I had ever seen.
// Now it's instead played from the nearest engine if close, or the first engine in the list if far since it doesn't really matter.
// Or a door if for some reason the shuttle has no engine, fuck oh hi daniel fuck it
var/range = (engine_coeff * max(width, height))
var/long_range = range * 2.5
var/atom/distant_source
if(LAZYLEN(engine_list))
distant_source = engine_list[1]
else
for(var/A in areas)
distant_source = locate(/obj/machinery/door) in A
if(distant_source)
break
if(distant_source)
for(var/mob/M in SSmobs.clients_by_zlevel[z])
var/dist_far = get_dist(M, distant_source)
if(dist_far <= long_range && dist_far > range)
M.playsound_local(distant_source, "sound/effects/[selected_sound]_distance.ogg", 100, falloff = 20)
else if(dist_far <= range)
var/source
if(engine_list.len == 0)
source = distant_source
else
var/closest_dist = 10000
for(var/obj/O in engine_list)
var/dist_near = get_dist(M, O)
if(dist_near < closest_dist)
source = O
closest_dist = dist_near
M.playsound_local(source, "sound/effects/[selected_sound].ogg", 100, falloff = range / 2)
for(var/A in areas)
for(var/obj/machinery/door/E in A) //dumb, I know, but playing it on the engines doesn't do it justice
playsound(E, s, 100, FALSE, max(width, height) - world.view)
// Losing all initial engines should get you 2
// Adding another set of engines at 0.5 time
@@ -820,12 +743,7 @@
var/area/shuttle/areaInstance = thing
for(var/obj/structure/shuttle/engine/E in areaInstance.contents)
if(!QDELETED(E))
engine_list += E
. += E.engine_power
for(var/obj/machinery/shuttle/engine/E in areaInstance.contents)
if(!QDELETED(E))
engine_list += E
. += E.thruster_active ? 1 : 0
// Double initial engines to get to 0.5 minimum
// Lose all initial engines to get to 2
@@ -850,7 +768,7 @@
/obj/docking_port/mobile/proc/in_flight()
switch(mode)
if(SHUTTLE_CALL,SHUTTLE_RECALL,SHUTTLE_PREARRIVAL)
if(SHUTTLE_CALL,SHUTTLE_RECALL)
return TRUE
if(SHUTTLE_IDLE,SHUTTLE_IGNITING)
return FALSE