mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
Makes shuttles lazy load (#28315)
* update documentation + names * shuttle 1 * shuttle 2 * thank god * undef * ci fix * fix ci again * Fallbacks and stuff * fixes the lance
This commit is contained in:
@@ -126,14 +126,7 @@
|
||||
turf_type = /turf/simulated/floor/plating/asteroid/basalt/lava_land_surface;
|
||||
width = 16
|
||||
},
|
||||
/obj/docking_port/mobile{
|
||||
dir = 8;
|
||||
dwidth = 8;
|
||||
height = 20;
|
||||
id = "freegolem";
|
||||
name = "Free Golem Ship";
|
||||
width = 16
|
||||
},
|
||||
/obj/docking_port/mobile/free_golem,
|
||||
/turf/simulated/floor/mineral/titanium/purple,
|
||||
/area/shuttle/freegolem)
|
||||
"C" = (
|
||||
|
||||
@@ -234,14 +234,7 @@
|
||||
id = "whiteship_away";
|
||||
name = "Deep Space"
|
||||
},
|
||||
/obj/docking_port/mobile{
|
||||
dir = 8;
|
||||
id = "whiteship";
|
||||
name = "NEV Cherub";
|
||||
dwidth = 6;
|
||||
height = 19;
|
||||
width = 12
|
||||
},
|
||||
/obj/docking_port/mobile/whiteship,
|
||||
/turf/simulated/floor/plating,
|
||||
/area/shuttle/abandoned)
|
||||
"yF" = (
|
||||
|
||||
+12694
-12960
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@
|
||||
id_tag = "s_docking_airlock";
|
||||
name = "Shuttle Hatch"
|
||||
},
|
||||
/obj/docking_port/mobile{
|
||||
/obj/docking_port/mobile/admin{
|
||||
dir = 2;
|
||||
dwidth = 8;
|
||||
height = 15;
|
||||
|
||||
@@ -588,7 +588,7 @@
|
||||
"Gx" = (
|
||||
/obj/structure/fans/tiny,
|
||||
/obj/machinery/door/airlock/external,
|
||||
/obj/docking_port/mobile{
|
||||
/obj/docking_port/mobile/admin{
|
||||
dir = 2;
|
||||
dwidth = 9;
|
||||
height = 18;
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
"aj" = (
|
||||
/obj/structure/fans/tiny,
|
||||
/obj/machinery/door/airlock/external,
|
||||
/obj/docking_port/mobile{
|
||||
/obj/docking_port/mobile/admin{
|
||||
dir = 2;
|
||||
dwidth = 9;
|
||||
height = 18;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/turf/simulated/floor/plating/nitrogen,
|
||||
/area/shuttle/administration)
|
||||
"aj" = (
|
||||
/obj/docking_port/mobile{
|
||||
/obj/docking_port/mobile/admin{
|
||||
dir = 2;
|
||||
dwidth = 9;
|
||||
height = 18;
|
||||
|
||||
@@ -604,7 +604,8 @@
|
||||
timid = 1;
|
||||
dir = 2;
|
||||
lance_docking = 1;
|
||||
shuttle_speed_factor = 1.5
|
||||
shuttle_speed_factor = 1.5;
|
||||
port_direction = 1
|
||||
},
|
||||
/obj/machinery/door/airlock/external{
|
||||
id_tag = "s_docking_airlock"
|
||||
|
||||
@@ -52,15 +52,8 @@
|
||||
/obj/machinery/door/airlock/titanium{
|
||||
id_tag = "s_docking_airlock"
|
||||
},
|
||||
/obj/docking_port/mobile{
|
||||
dir = 8;
|
||||
dwidth = 2;
|
||||
height = 12;
|
||||
id = "ferry";
|
||||
name = "ferry shuttle";
|
||||
roundstart_move = "ferry_away";
|
||||
timid = 1;
|
||||
width = 5
|
||||
/obj/docking_port/mobile/ferry{
|
||||
timid = 1
|
||||
},
|
||||
/turf/simulated/floor/plating,
|
||||
/area/shuttle/transport)
|
||||
|
||||
@@ -103,15 +103,8 @@
|
||||
/obj/machinery/door/airlock/titanium{
|
||||
id_tag = "s_docking_airlock"
|
||||
},
|
||||
/obj/docking_port/mobile{
|
||||
dir = 8;
|
||||
dwidth = 2;
|
||||
height = 12;
|
||||
id = "ferry";
|
||||
name = "ferry shuttle";
|
||||
roundstart_move = "ferry_away";
|
||||
timid = 1;
|
||||
width = 5
|
||||
/obj/docking_port/mobile/ferry{
|
||||
timid = 1
|
||||
},
|
||||
/turf/simulated/floor/plating,
|
||||
/area/shuttle/transport)
|
||||
|
||||
@@ -15,4 +15,4 @@
|
||||
#define SHUTTLE_DOCKER_BLOCKED_BY_HIDDEN_PORT 2
|
||||
#define SHUTTLE_DOCKER_BLOCKED 3
|
||||
|
||||
#define SHUTTLE_TRANSIT_BORDER 16
|
||||
#define SHUTTLE_TRANSIT_BORDER 9
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
#define CALL_SHUTTLE_REASON_LENGTH 12
|
||||
|
||||
#define MAX_TRANSIT_REQUEST_RETRIES 10
|
||||
/// How many turfs to allow before we start blocking transit requests
|
||||
#define MAX_TRANSIT_TILE_COUNT (150 ** 2)
|
||||
/// How many turfs to allow before we start freeing up existing "soft reserved" transit docks
|
||||
/// If we're under load we want to allow for cycling, but if not we want to preserve already generated docks for use
|
||||
#define SOFT_TRANSIT_RESERVATION_THRESHOLD (100 ** 2)
|
||||
|
||||
SUBSYSTEM_DEF(shuttle)
|
||||
name = "Shuttle"
|
||||
wait = 10
|
||||
@@ -7,9 +15,12 @@ SUBSYSTEM_DEF(shuttle)
|
||||
runlevels = RUNLEVEL_SETUP | RUNLEVEL_GAME
|
||||
offline_implications = "Shuttles will no longer function. Immediate server restart recommended."
|
||||
cpu_display = SS_CPUDISPLAY_LOW
|
||||
var/list/mobile = list()
|
||||
var/list/stationary = list()
|
||||
var/list/transit = list()
|
||||
/// A list of all the mobile docking ports.
|
||||
var/list/mobile_docking_ports = list()
|
||||
/// A list of all the stationary docking ports.
|
||||
var/list/stationary_docking_ports = list()
|
||||
/// A list of all the transit docking ports.
|
||||
var/list/transit_docking_ports = list()
|
||||
|
||||
//emergency shuttle stuff
|
||||
var/obj/docking_port/mobile/emergency/emergency
|
||||
@@ -41,6 +52,13 @@ SUBSYSTEM_DEF(shuttle)
|
||||
/// Have we locked in the emergency shuttle, to prevent people from breaking things / wasting player money?
|
||||
var/emergency_locked_in = FALSE
|
||||
|
||||
/// A list of all the mobile docking ports currently requesting a spot in hyperspace.
|
||||
var/list/transit_requesters = list()
|
||||
/// An associative list of the mobile docking ports that have failed a transit request, with the amount of times they've actually failed that transit request, up to MAX_TRANSIT_REQUEST_RETRIES
|
||||
var/list/transit_request_failures = list()
|
||||
/// How many turfs our shuttles are currently utilizing in reservation space
|
||||
var/transit_utilized = 0
|
||||
|
||||
/datum/controller/subsystem/shuttle/Initialize()
|
||||
if(!emergency)
|
||||
WARNING("No /obj/docking_port/mobile/emergency placed on the map!")
|
||||
@@ -53,7 +71,7 @@ SUBSYSTEM_DEF(shuttle)
|
||||
initial_move()
|
||||
|
||||
/datum/controller/subsystem/shuttle/get_stat_details()
|
||||
return "M:[length(mobile)] S:[length(stationary)] T:[length(transit)]"
|
||||
return "M:[length(mobile_docking_ports)] S:[length(stationary_docking_ports)] T:[length(transit_docking_ports)]"
|
||||
|
||||
/datum/controller/subsystem/shuttle/proc/initial_load()
|
||||
for(var/obj/docking_port/D in world)
|
||||
@@ -61,22 +79,58 @@ SUBSYSTEM_DEF(shuttle)
|
||||
CHECK_TICK
|
||||
|
||||
/datum/controller/subsystem/shuttle/fire(resumed = FALSE)
|
||||
for(var/thing in mobile)
|
||||
if(thing)
|
||||
var/obj/docking_port/mobile/P = thing
|
||||
P.check()
|
||||
for(var/thing in mobile_docking_ports)
|
||||
if(!thing)
|
||||
mobile_docking_ports.Remove(thing)
|
||||
continue
|
||||
CHECK_TICK
|
||||
mobile.Remove(thing)
|
||||
var/obj/docking_port/mobile/port = thing
|
||||
port.check()
|
||||
for(var/obj/docking_port/stationary/transit/T as anything in transit_docking_ports)
|
||||
if(!T.owner)
|
||||
qdel(T, force=TRUE)
|
||||
// This next one removes transit docks/zones that aren't
|
||||
// immediately being used. This will mean that the zone creation
|
||||
// code will be running a lot.
|
||||
|
||||
// If we're below the soft reservation threshold, don't clear the old space
|
||||
// We're better off holding onto it for now
|
||||
if(transit_utilized < SOFT_TRANSIT_RESERVATION_THRESHOLD)
|
||||
continue
|
||||
var/obj/docking_port/mobile/owner = T.owner
|
||||
if(owner)
|
||||
var/idle = owner.mode == SHUTTLE_IDLE
|
||||
// var/not_centcom_evac = owner.launch_status == NOLAUNCH
|
||||
var/not_in_use = (!T.get_docked())
|
||||
if(idle && not_in_use)
|
||||
qdel(T, force=TRUE)
|
||||
|
||||
if(!SSmapping.clearing_reserved_turfs)
|
||||
while(transit_requesters.len)
|
||||
var/requester = popleft(transit_requesters)
|
||||
var/success = FALSE
|
||||
// Do not try and generate any transit if we're using more then our max already
|
||||
if(transit_utilized < MAX_TRANSIT_TILE_COUNT)
|
||||
success = generate_transit_dock(requester)
|
||||
else
|
||||
log_debug("Transit request for '[requester]' failed, too many turfs in use.")
|
||||
if(!success) // BACK OF THE QUEUE
|
||||
transit_request_failures[requester]++
|
||||
if(transit_request_failures[requester] < MAX_TRANSIT_REQUEST_RETRIES)
|
||||
transit_requesters += requester
|
||||
else
|
||||
var/obj/docking_port/mobile/M = requester
|
||||
M.transit_failure()
|
||||
if(MC_TICK_CHECK)
|
||||
break
|
||||
|
||||
/datum/controller/subsystem/shuttle/proc/getShuttle(id)
|
||||
for(var/obj/docking_port/mobile/M in mobile)
|
||||
for(var/obj/docking_port/mobile/M in mobile_docking_ports)
|
||||
if(M.id == id)
|
||||
return M
|
||||
WARNING("couldn't find shuttle with id: [id]")
|
||||
|
||||
/datum/controller/subsystem/shuttle/proc/getDock(id)
|
||||
for(var/obj/docking_port/stationary/S in stationary)
|
||||
for(var/obj/docking_port/stationary/S in stationary_docking_ports)
|
||||
if(S.id == id)
|
||||
return S
|
||||
WARNING("couldn't find dock with id: [id]")
|
||||
@@ -244,14 +298,14 @@ SUBSYSTEM_DEF(shuttle)
|
||||
return 0 //dock successful
|
||||
|
||||
/datum/controller/subsystem/shuttle/proc/initial_move()
|
||||
for(var/obj/docking_port/mobile/M in mobile)
|
||||
for(var/obj/docking_port/mobile/M in mobile_docking_ports)
|
||||
if(!M.roundstart_move)
|
||||
continue
|
||||
M.dockRoundstart()
|
||||
|
||||
/datum/controller/subsystem/shuttle/proc/get_dock_overlap(x0, y0, x1, y1, z)
|
||||
. = list()
|
||||
var/list/stationary_cache = stationary
|
||||
var/list/stationary_cache = stationary_docking_ports
|
||||
for(var/i in 1 to length(stationary_cache))
|
||||
var/obj/docking_port/port = stationary_cache[i]
|
||||
if(!port || port.z != z)
|
||||
@@ -425,4 +479,102 @@ SUBSYSTEM_DEF(shuttle)
|
||||
custom_escape_shuttle_loading = FALSE
|
||||
return loaded_shuttle
|
||||
|
||||
/datum/controller/subsystem/shuttle/proc/request_transit_dock(obj/docking_port/mobile/M)
|
||||
if(!istype(M))
|
||||
CRASH("[M] is not a mobile docking port")
|
||||
|
||||
if(M.assigned_transit)
|
||||
return
|
||||
transit_requesters |= M
|
||||
|
||||
/datum/controller/subsystem/shuttle/proc/generate_transit_dock(obj/docking_port/mobile/M)
|
||||
// First, determine the size of the needed zone
|
||||
// Because of shuttle rotation, the "width" of the shuttle is not
|
||||
// always x.
|
||||
var/travel_dir = M.preferred_direction
|
||||
// Remember, the direction is the direction we appear to be
|
||||
// coming from
|
||||
var/dock_angle = dir2angle(M.preferred_direction) + dir2angle(M.port_direction) + 180
|
||||
var/dock_dir = angle2dir(dock_angle)
|
||||
|
||||
var/transit_width = SHUTTLE_TRANSIT_BORDER * 2
|
||||
var/transit_height = SHUTTLE_TRANSIT_BORDER * 2
|
||||
|
||||
// Shuttles travelling on their side have their dimensions swapped
|
||||
// from our perspective
|
||||
switch(dock_dir)
|
||||
if(NORTH, SOUTH)
|
||||
transit_width += M.width
|
||||
transit_height += M.height
|
||||
if(EAST, WEST)
|
||||
transit_width += M.height
|
||||
transit_height += M.width
|
||||
|
||||
var/transit_path = /turf/space/transit
|
||||
switch(travel_dir)
|
||||
if(NORTH)
|
||||
transit_path = /turf/space/transit/north
|
||||
if(SOUTH)
|
||||
transit_path = /turf/space/transit/south
|
||||
if(EAST)
|
||||
transit_path = /turf/space/transit/east
|
||||
if(WEST)
|
||||
transit_path = /turf/space/transit/west
|
||||
|
||||
var/datum/turf_reservation/proposal = SSmapping.request_turf_block_reservation(
|
||||
transit_width,
|
||||
transit_height,
|
||||
reservation_type = /datum/turf_reservation/transit,
|
||||
turf_type_override = transit_path,
|
||||
)
|
||||
|
||||
if(!istype(proposal))
|
||||
return FALSE
|
||||
|
||||
var/turf/bottomleft = proposal.bottom_left_turf
|
||||
var/list/coords = M.return_coords(0, 0, dock_dir)
|
||||
|
||||
// Then we want the point closest to -infinity,-infinity
|
||||
var/min_x = min(coords[1], coords[3]) // x0, x1
|
||||
var/min_y = min(coords[2], coords[4]) // y0, y1
|
||||
|
||||
// Then find where to place the dock
|
||||
var/transit_x = bottomleft.x + SHUTTLE_TRANSIT_BORDER + abs(min_x)
|
||||
var/transit_y = bottomleft.y + SHUTTLE_TRANSIT_BORDER + abs(min_y)
|
||||
|
||||
var/turf/midpoint = locate(transit_x, transit_y, bottomleft.z)
|
||||
if(!midpoint)
|
||||
qdel(proposal)
|
||||
return FALSE
|
||||
|
||||
// our shuttle system currently doesnt support changing areas of shuttles
|
||||
// var/area/shuttle/transit/new_area = new()
|
||||
// new_area.parallax_move_direction = travel_dir
|
||||
// new_area.contents = proposal.reserved_turfs
|
||||
|
||||
var/obj/docking_port/stationary/transit/new_transit_dock = new(midpoint)
|
||||
new_transit_dock.reserved_area = proposal
|
||||
new_transit_dock.owner = M
|
||||
// new_transit_dock.assigned_area = new_area
|
||||
new_transit_dock.id = "[M.id]_transit"
|
||||
new_transit_dock.turf_type = transit_path
|
||||
|
||||
// Add 180, because ports point inwards, rather than outwards
|
||||
new_transit_dock.setDir(angle2dir(dock_angle))
|
||||
|
||||
// Proposals use 2 extra hidden tiles of space, from the cordons that surround them
|
||||
transit_utilized += (proposal.width + 2) * (proposal.height + 2)
|
||||
M.assigned_transit = new_transit_dock
|
||||
RegisterSignal(proposal, COMSIG_PARENT_QDELETING, PROC_REF(transit_space_clearing))
|
||||
return new_transit_dock
|
||||
|
||||
/// Gotta manage our space brother
|
||||
/datum/controller/subsystem/shuttle/proc/transit_space_clearing(datum/turf_reservation/source)
|
||||
SIGNAL_HANDLER
|
||||
transit_utilized -= (source.width + 2) * (source.height + 2)
|
||||
|
||||
#undef CALL_SHUTTLE_REASON_LENGTH
|
||||
#undef MAX_TRANSIT_REQUEST_RETRIES
|
||||
#undef MAX_TRANSIT_TILE_COUNT
|
||||
#undef SOFT_TRANSIT_RESERVATION_THRESHOLD
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ SUBSYSTEM_DEF(mapping)
|
||||
// Makes a blank space level for the sake of randomness
|
||||
GLOB.space_manager.add_new_zlevel("Empty Area", linkage = CROSSLINKED, traits = empty_z_traits)
|
||||
// Add a reserved z-level
|
||||
// add_reservation_zlevel() // CURRENTLY DISABLED, AS NOTHING USES IT. IF YOU WANT TO ADD LAZYLOADING TO ANYTHING, MAKE SURE TO REIMPLEMENT THIS
|
||||
add_reservation_zlevel()
|
||||
|
||||
// Setup the Z-level linkage
|
||||
GLOB.space_manager.do_transition_setup()
|
||||
@@ -369,10 +369,12 @@ SUBSYSTEM_DEF(mapping)
|
||||
return used_turfs[T]
|
||||
|
||||
/// Requests a /datum/turf_reservation based on the given width, height.
|
||||
/datum/controller/subsystem/mapping/proc/request_turf_block_reservation(width, height)
|
||||
/datum/controller/subsystem/mapping/proc/request_turf_block_reservation(width, height, reservation_type = /datum/turf_reservation, turf_type_override)
|
||||
UNTIL(!clearing_reserved_turfs)
|
||||
log_debug("Reserving [width]x[height] turf reservation")
|
||||
var/datum/turf_reservation/reserve = new /datum/turf_reservation
|
||||
var/datum/turf_reservation/reserve = new reservation_type
|
||||
if(!isnull(turf_type_override))
|
||||
reserve.turf_type = turf_type_override
|
||||
for(var/i in levels_by_trait(Z_FLAG_RESERVED))
|
||||
if(reserve.reserve(width, height, i))
|
||||
return reserve
|
||||
@@ -418,6 +420,7 @@ SUBSYSTEM_DEF(mapping)
|
||||
unused_turfs["[z]"] = block
|
||||
clearing_reserved_turfs = FALSE
|
||||
|
||||
// TODO: Firing in a non-fire folder... Someone needs to move this file someday.
|
||||
/datum/controller/subsystem/mapping/fire(resumed)
|
||||
// Cache for sonic speed
|
||||
var/list/list/turf/unused_turfs = src.unused_turfs
|
||||
@@ -448,8 +451,7 @@ SUBSYSTEM_DEF(mapping)
|
||||
lists_to_reserve.Cut(1, index)
|
||||
|
||||
/**
|
||||
* Lazy loads a template on a lazy-loaded z-level
|
||||
* If you want to use this as non-debug, make sure to uncomment add_reservation_zlevel in /datum/controller/subsystem/mapping/Initialize()
|
||||
* Lazy loads a template on a lazy-loaded z-level.
|
||||
*/
|
||||
/datum/controller/subsystem/mapping/proc/lazy_load_template(datum/map_template/template)
|
||||
RETURN_TYPE(/datum/turf_reservation)
|
||||
|
||||
@@ -146,14 +146,6 @@
|
||||
CCport.dheight = 0
|
||||
CCport.width = 19
|
||||
CCport.dwidth = 9
|
||||
var/obj/docking_port/stationary/CCtransit
|
||||
CCtransit = SSshuttle.getDock("emergency_transit")
|
||||
CCtransit.setDir(2)
|
||||
CCtransit.forceMove(locate(113, 68, 1))
|
||||
CCtransit.height = 50
|
||||
CCtransit.dheight = 0
|
||||
CCtransit.width = 19
|
||||
CCtransit.dwidth = 9
|
||||
var/obj/docking_port/stationary/syndicate
|
||||
syndicate = SSshuttle.getDock("emergency_syndicate")
|
||||
syndicate.setDir(8)
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
/area/shuttle/abandoned
|
||||
name = "Abandoned Ship"
|
||||
icon_state = "shuttle"
|
||||
parallax_move_direction = WEST
|
||||
|
||||
/area/shuttle/syndicate
|
||||
name = "Syndicate Nuclear Team Shuttle"
|
||||
@@ -129,3 +130,11 @@
|
||||
name = "Free Golem Ship"
|
||||
icon_state = "purple"
|
||||
xenobiology_compatible = TRUE
|
||||
parallax_move_direction = WEST
|
||||
|
||||
/// Currently disabled as our shuttle system does not support TG-shuttle areas yet
|
||||
// /area/shuttle/transit
|
||||
// name = "Hyperspace"
|
||||
// desc = "Weeeeee"
|
||||
// dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
|
||||
// there_can_be_many = TRUE
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/turf/space/transit
|
||||
var/pushdirection // push things that get caught in the transit tile this direction
|
||||
plane = PLANE_SPACE
|
||||
icon_state = "black"
|
||||
dir = SOUTH
|
||||
@@ -11,105 +10,23 @@
|
||||
|
||||
/// moving to the north
|
||||
/turf/space/transit/north
|
||||
dir = SOUTH // south because the space tile is scrolling south
|
||||
|
||||
pushdirection = SOUTH // south because the space tile is scrolling south
|
||||
|
||||
//IF ANYONE KNOWS A MORE EFFICIENT WAY OF MANAGING THESE SPRITES, BE MY GUEST.
|
||||
/turf/space/transit/north/shuttlespace_ns1
|
||||
icon_state = "speedspace_ns_1"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns2
|
||||
icon_state = "speedspace_ns_2"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns3
|
||||
icon_state = "speedspace_ns_3"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns4
|
||||
icon_state = "speedspace_ns_4"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns5
|
||||
icon_state = "speedspace_ns_5"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns6
|
||||
icon_state = "speedspace_ns_6"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns7
|
||||
icon_state = "speedspace_ns_7"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns8
|
||||
icon_state = "speedspace_ns_8"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns9
|
||||
icon_state = "speedspace_ns_9"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns10
|
||||
icon_state = "speedspace_ns_10"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns11
|
||||
icon_state = "speedspace_ns_11"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns12
|
||||
icon_state = "speedspace_ns_12"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns13
|
||||
icon_state = "speedspace_ns_13"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns14
|
||||
icon_state = "speedspace_ns_14"
|
||||
|
||||
/turf/space/transit/north/shuttlespace_ns15
|
||||
icon_state = "speedspace_ns_15"
|
||||
/// moving to the south
|
||||
/turf/space/transit/south
|
||||
dir = NORTH
|
||||
|
||||
/// moving to the east
|
||||
/turf/space/transit/east
|
||||
pushdirection = WEST
|
||||
dir = WEST
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew1
|
||||
icon_state = "speedspace_ew_1"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew2
|
||||
icon_state = "speedspace_ew_2"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew3
|
||||
icon_state = "speedspace_ew_3"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew4
|
||||
icon_state = "speedspace_ew_4"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew5
|
||||
icon_state = "speedspace_ew_5"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew6
|
||||
icon_state = "speedspace_ew_6"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew7
|
||||
icon_state = "speedspace_ew_7"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew8
|
||||
icon_state = "speedspace_ew_8"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew9
|
||||
icon_state = "speedspace_ew_9"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew10
|
||||
icon_state = "speedspace_ew_10"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew11
|
||||
icon_state = "speedspace_ew_11"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew12
|
||||
icon_state = "speedspace_ew_12"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew13
|
||||
icon_state = "speedspace_ew_13"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew14
|
||||
icon_state = "speedspace_ew_14"
|
||||
|
||||
/turf/space/transit/east/shuttlespace_ew15
|
||||
icon_state = "speedspace_ew_15"
|
||||
//-tg- stuff
|
||||
/// moving to the west
|
||||
/turf/space/transit/west
|
||||
dir = EAST
|
||||
|
||||
/**
|
||||
* @DEPRECATED TYPE
|
||||
*/
|
||||
/turf/space/transit/horizontal
|
||||
dir = WEST
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
dwidth = 3
|
||||
width = 7
|
||||
height = 7
|
||||
preferred_direction = EAST
|
||||
port_direction = EAST
|
||||
|
||||
/obj/docking_port/mobile/assault_pod/request()
|
||||
if(z == initial(src.z)) //No launching pods that have already launched
|
||||
|
||||
@@ -277,7 +277,7 @@
|
||||
width = 22
|
||||
height = 11
|
||||
dir = 4
|
||||
travelDir = 0
|
||||
port_direction = WEST
|
||||
var/sound_played = 0 //If the launch sound has been sent to all players on the shuttle itself
|
||||
|
||||
|
||||
@@ -478,6 +478,15 @@
|
||||
)
|
||||
sound_played = 0
|
||||
mode = SHUTTLE_STRANDED
|
||||
return
|
||||
|
||||
if(time_left <= 10 SECONDS)
|
||||
var/failure = !check_transit_zone()
|
||||
for(var/obj/docking_port/mobile/pod/M in SSshuttle.mobile_docking_ports)
|
||||
if(is_station_level(M.z)) //Will not launch from the mine/planet
|
||||
failure |= !M.check_transit_zone()
|
||||
if(failure)
|
||||
setTimer(10 SECONDS)
|
||||
|
||||
if(time_left <= 50 && !sound_played) //4 seconds left - should sync up with the launch
|
||||
sound_played = 1
|
||||
@@ -487,7 +496,7 @@
|
||||
|
||||
if(time_left <= 0 && !length(SSshuttle.hostile_environments))
|
||||
//move each escape pod to its corresponding transit dock
|
||||
for(var/obj/docking_port/mobile/pod/M in SSshuttle.mobile)
|
||||
for(var/obj/docking_port/mobile/pod/M in SSshuttle.mobile_docking_ports)
|
||||
if(is_station_level(M.z)) //Will not launch from the mine/planet
|
||||
M.enterTransit()
|
||||
//now move the actual emergency shuttle to its transit dock
|
||||
@@ -505,7 +514,7 @@
|
||||
if(SHUTTLE_ESCAPE)
|
||||
if(time_left <= 0)
|
||||
//move each escape pod to its corresponding escape dock
|
||||
for(var/obj/docking_port/mobile/pod/M in SSshuttle.mobile)
|
||||
for(var/obj/docking_port/mobile/pod/M in SSshuttle.mobile_docking_ports)
|
||||
M.dock(SSshuttle.getDock("[M.id]_away"))
|
||||
|
||||
var/hyperspace_end_sound = sound('sound/effects/hyperspace_end.ogg')
|
||||
@@ -576,6 +585,18 @@
|
||||
for(var/turf/T in L2)
|
||||
ripples += new /obj/effect/temp_visual/ripple/lance_crush(T)
|
||||
|
||||
/obj/docking_port/mobile/emergency/transit_failure()
|
||||
..()
|
||||
message_admins("Moving emergency shuttle directly to centcom dock to prevent deadlock.")
|
||||
|
||||
mode = SHUTTLE_ESCAPE
|
||||
// launch_status = ENDGAME_LAUNCHED
|
||||
setTimer(60 SECONDS)
|
||||
GLOB.major_announcement.Announce(
|
||||
"The emergency shuttle is preparing for direct jump. Estimate [timeLeft(1 MINUTES)] minutes until the shuttle docks at Central Command.",
|
||||
"Emergency Shuttle Transit Failure",
|
||||
)
|
||||
|
||||
// This basically opens a big-ass row of blast doors when the shuttle arrives at centcom
|
||||
/obj/docking_port/mobile/pod
|
||||
name = "escape pod"
|
||||
@@ -584,11 +605,13 @@
|
||||
dwidth = 1
|
||||
width = 3
|
||||
height = 4
|
||||
port_direction = SOUTH
|
||||
|
||||
/obj/docking_port/mobile/pod/Initialize(mapload)
|
||||
. = ..()
|
||||
if(id == "pod")
|
||||
WARNING("[type] id has not been changed from the default. Use the id convention \"pod1\" \"pod2\" etc.")
|
||||
preferred_direction = dir
|
||||
|
||||
/obj/docking_port/mobile/pod/cancel()
|
||||
return
|
||||
|
||||
@@ -294,7 +294,7 @@
|
||||
playsound(console, 'sound/machines/terminal_prompt_deny.ogg', 25, 0)
|
||||
|
||||
var/list/L = list()
|
||||
for(var/V in SSshuttle.stationary)
|
||||
for(var/V in SSshuttle.stationary_docking_ports)
|
||||
if(!V)
|
||||
continue
|
||||
var/obj/docking_port/stationary/S = V
|
||||
|
||||
+133
-17
@@ -49,11 +49,11 @@
|
||||
|
||||
//returns a list(x0,y0, x1,y1) where points 0 and 1 are bounding corners of the projected rectangle
|
||||
/obj/docking_port/proc/return_coords(_x, _y, _dir)
|
||||
if(!_dir)
|
||||
if(_dir == null)
|
||||
_dir = dir
|
||||
if(!_x)
|
||||
if(_x == null)
|
||||
_x = x
|
||||
if(!_y)
|
||||
if(_y == null)
|
||||
_y = y
|
||||
|
||||
//byond's sin and cos functions are inaccurate. This is faster and perfectly accurate
|
||||
@@ -75,7 +75,7 @@
|
||||
_y + (-dwidth*sin) + (-dheight*cos),
|
||||
_x + (-dwidth+width-1)*cos - (-dheight+height-1)*sin,
|
||||
_y + (-dwidth+width-1)*sin + (-dheight+height-1)*cos
|
||||
)
|
||||
)
|
||||
|
||||
//returns turfs within our projected rectangle in no particular order
|
||||
/obj/docking_port/proc/return_turfs()
|
||||
@@ -171,11 +171,11 @@
|
||||
stack_trace("Docking port [src] could not initialize. SSshuttle doesnt exist!")
|
||||
return FALSE
|
||||
|
||||
SSshuttle.stationary += src
|
||||
SSshuttle.stationary_docking_ports += src
|
||||
if(!id)
|
||||
id = "[length(SSshuttle.stationary)]"
|
||||
id = "[length(SSshuttle.stationary_docking_ports)]"
|
||||
if(name == "dock")
|
||||
name = "dock[length(SSshuttle.stationary)]"
|
||||
name = "dock[length(SSshuttle.stationary_docking_ports)]"
|
||||
|
||||
#ifdef DOCKING_PORT_HIGHLIGHT
|
||||
highlight("#f00")
|
||||
@@ -190,6 +190,12 @@
|
||||
name = "In transit"
|
||||
turf_type = /turf/space/transit
|
||||
lock_shuttle_doors = TRUE
|
||||
/// The turf reservation returned by the transit area request
|
||||
var/datum/turf_reservation/reserved_area
|
||||
/// The area created during the transit area reservation
|
||||
var/area/shuttle/transit/assigned_area
|
||||
/// The mobile port that owns this transit port
|
||||
var/obj/docking_port/mobile/owner
|
||||
|
||||
/obj/docking_port/stationary/transit/register()
|
||||
if(!..())
|
||||
@@ -197,7 +203,7 @@
|
||||
|
||||
name = "In transit" //This looks weird, but- it means that the on-map instances can be named something actually usable to search for, but still appear correctly in terminals.
|
||||
|
||||
SSshuttle.transit += src
|
||||
SSshuttle.transit_docking_ports += src
|
||||
return 1
|
||||
|
||||
/obj/docking_port/mobile
|
||||
@@ -213,7 +219,6 @@
|
||||
var/callTime = 50 //time spent in transit (deciseconds)
|
||||
var/ignitionTime = 30 // time spent "starting the engines". Also rate limits how often we try to reserve transit space if its ever full of transiting shuttles.
|
||||
var/roundstart_move //id of port to send shuttle to at roundstart
|
||||
var/travelDir = 0 //direction the shuttle would travel in
|
||||
var/rebuildable = 0 //can build new shuttle consoles for this one
|
||||
|
||||
/// The speed factor for this shuttle. Higher means faster.
|
||||
@@ -223,6 +228,7 @@
|
||||
|
||||
var/obj/docking_port/stationary/destination
|
||||
var/obj/docking_port/stationary/previous
|
||||
var/obj/docking_port/stationary/transit/assigned_transit
|
||||
/// Does this shuttle use the lockdown system?
|
||||
var/uses_lockdown = FALSE
|
||||
/// If this variable is true, shuttle is on lockdown, and other requests can not be processed
|
||||
@@ -230,6 +236,11 @@
|
||||
/// Is this a shuttle that completely destroys whatever dares to get in it's way?
|
||||
var/lance_docking = FALSE
|
||||
|
||||
/// 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
|
||||
/// 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
|
||||
|
||||
/obj/docking_port/mobile/Initialize(mapload)
|
||||
. = ..()
|
||||
var/area/A = get_area(src)
|
||||
@@ -259,18 +270,18 @@
|
||||
if(!SSshuttle)
|
||||
CRASH("Docking port [src] could not initialize. SSshuttle doesnt exist!")
|
||||
|
||||
SSshuttle.mobile += src
|
||||
SSshuttle.mobile_docking_ports += src
|
||||
|
||||
if(!id)
|
||||
id = "[length(SSshuttle.mobile)]"
|
||||
id = "[length(SSshuttle.mobile_docking_ports)]"
|
||||
if(name == "shuttle")
|
||||
name = "shuttle[length(SSshuttle.mobile)]"
|
||||
name = "shuttle[length(SSshuttle.mobile_docking_ports)]"
|
||||
|
||||
return 1
|
||||
|
||||
/obj/docking_port/mobile/Destroy(force)
|
||||
if(force)
|
||||
SSshuttle.mobile -= src
|
||||
SSshuttle.mobile_docking_ports -= src
|
||||
areaInstance = null
|
||||
destination = null
|
||||
previous = null
|
||||
@@ -575,11 +586,13 @@
|
||||
|
||||
|
||||
/obj/docking_port/mobile/proc/findTransitDock()
|
||||
if(assigned_transit && check_dock(assigned_transit))
|
||||
return assigned_transit
|
||||
stack_trace("[name] ([id])'s findTransitDock() was called, but there was no assigned transit dock, reverting to emergency fallback.")
|
||||
var/obj/docking_port/stationary/transit/T = SSshuttle.getDock("[id]_transit")
|
||||
if(T && check_dock(T))
|
||||
return T
|
||||
|
||||
|
||||
/obj/docking_port/mobile/proc/findRoundstartDock()
|
||||
var/obj/docking_port/stationary/D
|
||||
D = SSshuttle.getDock(roundstart_move)
|
||||
@@ -698,6 +711,9 @@
|
||||
/obj/docking_port/mobile/proc/check()
|
||||
check_effects()
|
||||
|
||||
if(mode == SHUTTLE_IGNITING)
|
||||
check_transit_zone()
|
||||
|
||||
var/timeLeft = timeLeft(1)
|
||||
|
||||
if(timeLeft <= 0)
|
||||
@@ -711,6 +727,9 @@
|
||||
setTimer(20) //can't dock for some reason, try again in 2 seconds
|
||||
return
|
||||
if(SHUTTLE_IGNITING)
|
||||
if(!check_transit_zone())
|
||||
setTimer(20)
|
||||
return
|
||||
mode = SHUTTLE_CALL
|
||||
setTimer(callTime)
|
||||
enterTransit()
|
||||
@@ -792,6 +811,16 @@
|
||||
dst = destination
|
||||
. += " towards [dst ? dst.name : "unknown location"] ([timeLeft(600)]mins)"
|
||||
|
||||
/obj/docking_port/mobile/proc/transit_failure()
|
||||
message_admins("Shuttle [src] repeatedly failed to create transit zone.")
|
||||
|
||||
/obj/docking_port/mobile/proc/check_transit_zone()
|
||||
if(assigned_transit)
|
||||
return TRUE
|
||||
SSshuttle.request_transit_dock(src)
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/docking_port/mobile/labour
|
||||
dir = 8
|
||||
dwidth = 2
|
||||
@@ -801,6 +830,7 @@
|
||||
rebuildable = TRUE
|
||||
width = 9
|
||||
uses_lockdown = TRUE
|
||||
port_direction = EAST
|
||||
|
||||
/obj/docking_port/mobile/mining
|
||||
dir = 8
|
||||
@@ -811,6 +841,92 @@
|
||||
rebuildable = TRUE
|
||||
width = 7
|
||||
uses_lockdown = TRUE
|
||||
port_direction = EAST
|
||||
|
||||
/obj/docking_port/mobile/specops
|
||||
dir = 8
|
||||
dwidth = 2
|
||||
height = 11
|
||||
id = "specops"
|
||||
name = "ert shuttle"
|
||||
width = 5
|
||||
preferred_direction = EAST
|
||||
|
||||
/obj/docking_port/mobile/sit
|
||||
dir = 8
|
||||
dwidth = 3
|
||||
height = 5
|
||||
id = "sit"
|
||||
name = "SIT shuttle"
|
||||
width = 11
|
||||
preferred_direction = SOUTH
|
||||
port_direction = WEST
|
||||
|
||||
/obj/docking_port/mobile/sst
|
||||
dir = 4
|
||||
dwidth = 7
|
||||
height = 5
|
||||
id = "sst"
|
||||
name = "SST shuttle"
|
||||
width = 11
|
||||
preferred_direction = SOUTH
|
||||
port_direction = EAST
|
||||
|
||||
/obj/docking_port/mobile/admin
|
||||
dir = 2
|
||||
dwidth = 8
|
||||
height = 15
|
||||
id = "admin"
|
||||
name = "administration shuttle"
|
||||
timid = TRUE
|
||||
width = 18
|
||||
|
||||
/obj/docking_port/mobile/ferry
|
||||
dir = 8
|
||||
dwidth = 2
|
||||
height = 12
|
||||
id = "ferry"
|
||||
name = "ferry shuttle"
|
||||
width = 5
|
||||
preferred_direction = EAST
|
||||
|
||||
/obj/docking_port/mobile/trade_sol
|
||||
dir = 8
|
||||
dwidth = 4
|
||||
height = 11
|
||||
id = "trade_sol"
|
||||
name = "sol trade shuttle"
|
||||
width = 9
|
||||
preferred_direction = EAST
|
||||
|
||||
/obj/docking_port/mobile/nuke_ops
|
||||
dheight = 9
|
||||
dir = 2
|
||||
dwidth = 5
|
||||
height = 22
|
||||
id = "syndicate"
|
||||
name = "syndicate infiltrator"
|
||||
width = 18
|
||||
|
||||
/obj/docking_port/mobile/free_golem
|
||||
dir = 8
|
||||
dwidth = 8
|
||||
height = 20
|
||||
id = "freegolem"
|
||||
name = "Free Golem Ship"
|
||||
width = 16
|
||||
preferred_direction = WEST
|
||||
port_direction = SOUTH
|
||||
|
||||
/obj/docking_port/mobile/whiteship
|
||||
dir = 8
|
||||
id = "whiteship"
|
||||
name = "NEV Cherub"
|
||||
dwidth = 6
|
||||
height = 19
|
||||
width = 12
|
||||
preferred_direction = WEST
|
||||
port_direction = SOUTH
|
||||
|
||||
/obj/machinery/computer/shuttle
|
||||
name = "Shuttle Console"
|
||||
@@ -848,7 +964,7 @@
|
||||
// find close shuttle that is ok to mess with
|
||||
if(!SSshuttle) //intentionally mapping shuttle consoles without actual shuttles IS POSSIBLE OH MY GOD WHO KNEW *glare*
|
||||
return
|
||||
for(var/obj/docking_port/mobile/D in SSshuttle.mobile)
|
||||
for(var/obj/docking_port/mobile/D in SSshuttle.mobile_docking_ports)
|
||||
if(get_dist(src, D) <= max_connect_range && D.rebuildable)
|
||||
M = D
|
||||
shuttleId = M.id
|
||||
@@ -859,7 +975,7 @@
|
||||
if(M && !possible_destinations)
|
||||
// find perfect fits
|
||||
possible_destinations = ""
|
||||
for(var/obj/docking_port/stationary/S in SSshuttle.stationary)
|
||||
for(var/obj/docking_port/stationary/S in SSshuttle.stationary_docking_ports)
|
||||
if(!istype(S, /obj/docking_port/stationary/transit) && S.width == M.width && S.height == M.height && S.dwidth == M.dwidth && S.dheight == M.dheight && findtext(S.id, M.id))
|
||||
possible_destinations += "[possible_destinations ? ";" : ""][S.id]"
|
||||
|
||||
@@ -890,7 +1006,7 @@
|
||||
var/list/docking_ports = list()
|
||||
data["docking_ports"] = docking_ports
|
||||
var/list/options = params2list(possible_destinations)
|
||||
for(var/obj/docking_port/stationary/S in SSshuttle.stationary)
|
||||
for(var/obj/docking_port/stationary/S in SSshuttle.stationary_docking_ports)
|
||||
if(!options.Find(S.id))
|
||||
continue
|
||||
if(!M.check_dock(S))
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
|
||||
// Status panel
|
||||
data["shuttles"] = list()
|
||||
for(var/i in SSshuttle.mobile)
|
||||
for(var/i in SSshuttle.mobile_docking_ports)
|
||||
var/obj/docking_port/mobile/M = i
|
||||
if(!M)
|
||||
continue
|
||||
@@ -159,14 +159,14 @@
|
||||
|
||||
if("jump_to")
|
||||
if(params["type"] == "mobile")
|
||||
for(var/i in SSshuttle.mobile)
|
||||
for(var/i in SSshuttle.mobile_docking_ports)
|
||||
var/obj/docking_port/mobile/M = i
|
||||
if(M.id == params["id"])
|
||||
usr.forceMove(get_turf(M))
|
||||
break
|
||||
|
||||
if("fast_travel")
|
||||
for(var/i in SSshuttle.mobile)
|
||||
for(var/i in SSshuttle.mobile_docking_ports)
|
||||
var/obj/docking_port/mobile/M = i
|
||||
if(M.id == params["id"] && M.timer && M.timeLeft() >= 50)
|
||||
M.setTimer(50)
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
id = "supply"
|
||||
callTime = 2 MINUTES
|
||||
dir = 8
|
||||
travelDir = 90
|
||||
width = 12
|
||||
dwidth = 5
|
||||
height = 7
|
||||
port_direction = EAST
|
||||
|
||||
// The list of things that can't be sent to CC.
|
||||
var/list/blacklist = list(
|
||||
|
||||
@@ -151,3 +151,5 @@
|
||||
generate_cordon()
|
||||
return TRUE
|
||||
|
||||
/datum/turf_reservation/transit
|
||||
turf_type = /turf/space/transit
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/obj/docking_port/mobile{id="specops"} : /obj/docking_port/mobile/specops
|
||||
/obj/docking_port/mobile{id="sit"} : /obj/docking_port/mobile/sit
|
||||
/obj/docking_port/mobile{id="sst"} : /obj/docking_port/mobile/sst
|
||||
/obj/docking_port/mobile{id="admin"} : /obj/docking_port/mobile/admin{@OLD}
|
||||
/obj/docking_port/mobile{id="ferry"} : /obj/docking_port/mobile/ferry
|
||||
/obj/docking_port/mobile{id="trade_sol"} : /obj/docking_port/mobile/trade_sol
|
||||
/obj/docking_port/mobile{id="syndicate"} : /obj/docking_port/mobile/nuke_ops
|
||||
/obj/docking_port/mobile{id="freegolem"} : /obj/docking_port/mobile/free_golem
|
||||
/obj/docking_port/mobile{id="whiteship"} : /obj/docking_port/mobile/whiteship
|
||||
@@ -0,0 +1,4 @@
|
||||
help:
|
||||
Create a subtype to use instead.
|
||||
=/obj/docking_port/mobile:
|
||||
banned: true
|
||||
@@ -0,0 +1,4 @@
|
||||
help:
|
||||
Transit ports are not allowed to be manually mapped in.
|
||||
/obj/docking_port/stationary/transit:
|
||||
banned: true
|
||||
Reference in New Issue
Block a user