Conflicts!!!

This commit is contained in:
Artur
2020-06-22 17:39:24 +03:00
395 changed files with 84463 additions and 336540 deletions
+124 -42
View File
@@ -11,17 +11,31 @@
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
// this should point -away- from the dockingport door, ie towards the ship
///Common standard is for this to point -away- from the dockingport door, ie towards the ship
dir = NORTH
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
///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/area_type
var/hidden = FALSE //are we invisible to shuttle navigation computers?
///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")
//these objects are indestructible
/obj/docking_port/Destroy(force)
@@ -155,8 +169,6 @@
/obj/docking_port/stationary
name = "dock"
area_type = SHUTTLE_DEFAULT_UNDERLYING_AREA
var/last_dock_time
var/datum/map_template/shuttle/roundstart_template
@@ -169,6 +181,9 @@
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())
@@ -183,6 +198,13 @@
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]
@@ -235,16 +257,25 @@
var/list/shuttle_areas
var/timer //used as a timer (if you want time left to complete move, use timeLeft proc)
///used as a timer (if you want time left to complete move, use timeLeft proc)
var/timer
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
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
/// The direction the shuttle prefers to travel in, ie what direction
/// the animation will cause it to appear to be traveling in
var/preferred_direction = NORTH
// And the angle from the front of the shuttle to the port
/// relative direction of the docking port from the front of the shuttle
/// NORTH is towards front, EAST would be starboard side, WEST port, etc.
var/port_direction = NORTH
var/obj/docking_port/stationary/destination
@@ -254,13 +285,16 @@
var/launch_status = NOLAUNCH
var/list/movement_force = list("KNOCKDOWN" = 3, "THROW" = 2)
///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/ripples = list()
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/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/list/hidden_turfs = list()
/obj/docking_port/mobile/proc/register()
@@ -308,14 +342,12 @@
id = "[id][idnum]"
if(name == initial(name))
name = "[name] [idnum]"
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)
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)
//this is a hook for custom behaviour. Maybe at some point we could add checks to see if engines are intact
@@ -423,7 +455,10 @@
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
previous = S0
if(S0.delete_after)
qdel(S0, TRUE)
else
previous = S0
else
WARNING("shuttle \"[id]\" could not enter transit space. S0=[S0 ? S0.id : "null"] S1=[S1 ? S1.id : "null"]")
@@ -472,7 +507,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.notransform = TRUE
M.mob_transforming = TRUE
M.ghostize(FALSE)
M.moveToNullspace()
@@ -536,7 +571,11 @@
// 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)
if(SHUTTLE_CALL, SHUTTLE_PREARRIVAL)
if(prearrivalTime && mode != SHUTTLE_PREARRIVAL)
mode = SHUTTLE_PREARRIVAL
setTimer(prearrivalTime)
return
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)])"
@@ -547,6 +586,10 @@
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)
@@ -649,6 +692,10 @@
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
@@ -667,7 +714,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"
@@ -678,8 +725,10 @@
else
dst = destination
. = "transit towards [dst?.name || "unknown location"] ([getTimerStr()])"
else if(mode == SHUTTLE_RECHARGING)
return "[docked_at], recharging [getTimerStr()]"
else
return dockedAt?.name || "unknown"
return docked_at
/obj/docking_port/mobile/proc/getDbgStatusText()
@@ -711,19 +760,47 @@
return null
/obj/docking_port/mobile/proc/hyperspace_sound(phase, list/areas)
var/s
var/selected_sound
switch(phase)
if(HYPERSPACE_WARMUP)
s = 'sound/effects/hyperspace_begin.ogg'
selected_sound = "hyperspace_begin"
if(HYPERSPACE_LAUNCH)
s = 'sound/effects/hyperspace_progress.ogg'
selected_sound = "hyperspace_progress"
if(HYPERSPACE_END)
s = 'sound/effects/hyperspace_end.ogg'
selected_sound = "hyperspace_end"
else
CRASH("Invalid hyperspace sound phase: [phase]")
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)
// 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)
// Losing all initial engines should get you 2
// Adding another set of engines at 0.5 time
@@ -743,7 +820,12 @@
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
@@ -768,7 +850,7 @@
/obj/docking_port/mobile/proc/in_flight()
switch(mode)
if(SHUTTLE_CALL,SHUTTLE_RECALL)
if(SHUTTLE_CALL,SHUTTLE_RECALL,SHUTTLE_PREARRIVAL)
return TRUE
if(SHUTTLE_IDLE,SHUTTLE_IGNITING)
return FALSE