shuttle pog
This commit is contained in:
@@ -156,13 +156,13 @@
|
||||
return
|
||||
if(SSshuttle.supply.getDockedId() == "supply_home")
|
||||
SSshuttle.supply.export_categories = get_export_categories()
|
||||
SSshuttle.moveShuttle("supply", "supply_away", TRUE)
|
||||
SSshuttle.moveShuttle(SSshuttle.supply.id, "supply_away", TRUE)
|
||||
say("The supply shuttle is departing.")
|
||||
investigate_log("[key_name(usr)] sent the supply shuttle away.", INVESTIGATE_CARGO)
|
||||
else
|
||||
investigate_log("[key_name(usr)] called the supply shuttle.", INVESTIGATE_CARGO)
|
||||
say("The supply shuttle has been called and will arrive in [SSshuttle.supply.timeLeft(600)] minutes.")
|
||||
SSshuttle.moveShuttle("supply", "supply_home", TRUE)
|
||||
SSshuttle.moveShuttle(SSshuttle.supply.id, "supply_home", TRUE)
|
||||
. = TRUE
|
||||
if("loan")
|
||||
if(!SSshuttle.shuttle_loan)
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
/// 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
|
||||
/// Possible destinations
|
||||
var/port_destinations
|
||||
///Common standard is for this to 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.
|
||||
@@ -34,8 +36,26 @@
|
||||
///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")
|
||||
///are we registered in SSshuttles?
|
||||
var/registered = FALSE
|
||||
|
||||
///register to SSshuttles
|
||||
/obj/docking_port/proc/register()
|
||||
if(registered)
|
||||
WARNING("docking_port registered multiple times")
|
||||
unregister()
|
||||
registered = TRUE
|
||||
return
|
||||
|
||||
///unregister from SSshuttles
|
||||
/obj/docking_port/proc/unregister()
|
||||
if(!registered)
|
||||
WARNING("docking_port unregistered multiple times")
|
||||
registered = FALSE
|
||||
return
|
||||
|
||||
/obj/docking_port/proc/Check_id()
|
||||
return
|
||||
|
||||
//these objects are indestructible
|
||||
/obj/docking_port/Destroy(force)
|
||||
@@ -43,7 +63,7 @@
|
||||
// may result.
|
||||
if(force)
|
||||
..()
|
||||
. = QDEL_HINT_QUEUE
|
||||
return QDEL_HINT_QUEUE
|
||||
else
|
||||
return QDEL_HINT_LETMELIVE
|
||||
|
||||
@@ -60,7 +80,7 @@
|
||||
/obj/docking_port/shuttleRotate()
|
||||
return //we don't rotate with shuttles via this code.
|
||||
|
||||
//returns a list(x0,y0, x1,y1) where points 0 and 1 are bounding corners of the projected rectangle
|
||||
///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 == null)
|
||||
_dir = dir
|
||||
@@ -90,15 +110,14 @@
|
||||
_y + (-dwidth+width-1)*sin + (-dheight+height-1)*cos
|
||||
)
|
||||
|
||||
//returns turfs within our projected rectangle in no particular order
|
||||
///returns turfs within our projected rectangle in no particular order
|
||||
/obj/docking_port/proc/return_turfs()
|
||||
var/list/L = return_coords()
|
||||
var/turf/T0 = locate(L[1],L[2],z)
|
||||
var/turf/T1 = locate(L[3],L[4],z)
|
||||
return block(T0,T1)
|
||||
|
||||
//returns turfs within our projected rectangle in a specific order.
|
||||
//this ensures that turfs are copied over in the same order, regardless of any rotation
|
||||
///returns turfs within our projected rectangle in a specific order.this ensures that turfs are copied over in the same order, regardless of any rotation
|
||||
/obj/docking_port/proc/return_ordered_turfs(_x, _y, _z, _dir)
|
||||
var/cos = 1
|
||||
var/sin = 0
|
||||
@@ -127,7 +146,9 @@
|
||||
|
||||
#ifdef DOCKING_PORT_HIGHLIGHT
|
||||
//Debug proc used to highlight bounding area
|
||||
/obj/docking_port/proc/highlight(_color)
|
||||
/obj/docking_port/proc/highlight(_color = "#f00")
|
||||
invisibility = 0
|
||||
layer = GHOST_LAYER
|
||||
var/list/L = return_coords()
|
||||
var/turf/T0 = locate(L[1],L[2],z)
|
||||
var/turf/T1 = locate(L[3],L[4],z)
|
||||
@@ -146,11 +167,13 @@
|
||||
/obj/docking_port/proc/get_docked()
|
||||
return locate(/obj/docking_port/stationary) in loc
|
||||
|
||||
// Return id of the docked docking_port
|
||||
/obj/docking_port/proc/getDockedId()
|
||||
var/obj/docking_port/P = get_docked()
|
||||
if(P)
|
||||
return P.id
|
||||
|
||||
// Say that A in the absolute (rectangular) bounds of this shuttle or no.
|
||||
/obj/docking_port/proc/is_in_shuttle_bounds(atom/A)
|
||||
var/turf/T = get_turf(A)
|
||||
if(T.z != z)
|
||||
@@ -174,13 +197,36 @@
|
||||
var/datum/map_template/shuttle/roundstart_template
|
||||
var/json_key
|
||||
|
||||
/obj/docking_port/stationary/register(replace = FALSE)
|
||||
. = ..()
|
||||
if(!id)
|
||||
id = "dock"
|
||||
else
|
||||
port_destinations = id
|
||||
|
||||
if(!name)
|
||||
name = "dock"
|
||||
// how?
|
||||
// It registers the initial shuttle (no changes)
|
||||
// and if another one comes in with the same name (id) it adds the count on it
|
||||
var/counter = SSshuttle.assoc_stationary[id]
|
||||
if(!replace || !counter)
|
||||
if(counter)
|
||||
counter++
|
||||
SSshuttle.assoc_stationary[id] = counter
|
||||
id = "[id]_[counter]"
|
||||
name = "[name] [counter]"
|
||||
else
|
||||
SSshuttle.assoc_stationary[id] = 1
|
||||
|
||||
if(!port_destinations)
|
||||
port_destinations = id
|
||||
|
||||
SSshuttle.stationary += src
|
||||
|
||||
/obj/docking_port/stationary/Initialize(mapload)
|
||||
. = ..()
|
||||
SSshuttle.stationary += src
|
||||
if(!id)
|
||||
id = "[SSshuttle.stationary.len]"
|
||||
if(name == "dock")
|
||||
name = "dock[SSshuttle.stationary.len]"
|
||||
register()
|
||||
if(!area_type)
|
||||
var/area/place = get_area(src)
|
||||
area_type = place?.type || SHUTTLE_DEFAULT_UNDERLYING_AREA // We might be created in nullspace
|
||||
@@ -193,9 +239,13 @@
|
||||
highlight("#f00")
|
||||
#endif
|
||||
|
||||
/obj/docking_port/stationary/unregister()
|
||||
. = ..()
|
||||
SSshuttle.stationary -= src
|
||||
|
||||
/obj/docking_port/stationary/Destroy(force)
|
||||
if(force)
|
||||
SSshuttle.stationary -= src
|
||||
unregister()
|
||||
. = ..()
|
||||
|
||||
/obj/docking_port/stationary/Moved(atom/oldloc, dir, forced)
|
||||
@@ -249,6 +299,28 @@
|
||||
reserved_area = null
|
||||
return ..()
|
||||
|
||||
/obj/docking_port/stationary/picked
|
||||
///Holds a list of map name strings for the port to pick from
|
||||
var/list/shuttlekeys
|
||||
|
||||
/obj/docking_port/stationary/picked/Initialize(mapload)
|
||||
. = ..()
|
||||
if(!LAZYLEN(shuttlekeys))
|
||||
WARNING("Random docking port [id] loaded with no shuttle keys")
|
||||
return
|
||||
var/selectedid = pick(shuttlekeys)
|
||||
roundstart_template = SSmapping.shuttle_templates[selectedid]
|
||||
|
||||
/obj/docking_port/stationary/picked/whiteship
|
||||
name = "Deep Space"
|
||||
id = "whiteship_away"
|
||||
dheight = 0
|
||||
dir = 2
|
||||
dwidth = 11
|
||||
height = 22
|
||||
width = 35
|
||||
shuttlekeys = list("whiteship_meta", "whiteship_pubby", "whiteship_box", "whiteship_cere", "whiteship_kilo", "whiteship_donut", "whiteship_delta")
|
||||
|
||||
/obj/docking_port/mobile
|
||||
name = "shuttle"
|
||||
icon_state = "pinonclose"
|
||||
@@ -271,11 +343,9 @@
|
||||
/// 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
|
||||
/// 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.
|
||||
/// 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
|
||||
@@ -297,15 +367,38 @@
|
||||
var/can_move_docking_ports = FALSE
|
||||
var/list/hidden_turfs = list()
|
||||
|
||||
/obj/docking_port/mobile/proc/register()
|
||||
/obj/docking_port/mobile/register(replace = FALSE)
|
||||
. = ..()
|
||||
if(!id)
|
||||
id = "shuttle"
|
||||
|
||||
if(!name)
|
||||
name = "shuttle"
|
||||
|
||||
var/counter = SSshuttle.assoc_mobile[id]
|
||||
if(!replace || !counter)
|
||||
if(counter)
|
||||
counter++
|
||||
SSshuttle.assoc_mobile[id] = counter
|
||||
id = "[id]_[counter]"
|
||||
name = "[name] [counter]"
|
||||
//Re link machinery to new shuttle id
|
||||
linkup()
|
||||
else
|
||||
SSshuttle.assoc_mobile[id] = 1
|
||||
|
||||
SSshuttle.mobile += src
|
||||
|
||||
/obj/docking_port/mobile/unregister()
|
||||
. = ..()
|
||||
SSshuttle.mobile -= src
|
||||
|
||||
/obj/docking_port/mobile/Destroy(force)
|
||||
if(force)
|
||||
SSshuttle.mobile -= src
|
||||
unregister()
|
||||
destination = null
|
||||
previous = null
|
||||
QDEL_NULL(assigned_transit) //don't need it where we're goin'!
|
||||
QDEL_NULL(assigned_transit) //don't need it where we're goin'!
|
||||
shuttle_areas = null
|
||||
remove_ripples()
|
||||
. = ..()
|
||||
@@ -314,9 +407,16 @@
|
||||
. = ..()
|
||||
|
||||
if(!id)
|
||||
id = "[SSshuttle.mobile.len]"
|
||||
if(name == "shuttle")
|
||||
name = "shuttle[SSshuttle.mobile.len]"
|
||||
id = "shuttle"
|
||||
if(!name)
|
||||
name = "shuttle"
|
||||
var/counter = 1
|
||||
var/tmp_id = id
|
||||
var/tmp_name = name
|
||||
while(Check_id(id))
|
||||
counter++
|
||||
id = "[tmp_id]_[counter]"
|
||||
name = "[tmp_name] [counter]"
|
||||
|
||||
shuttle_areas = list()
|
||||
var/list/all_turfs = return_ordered_turfs(x, y, z, dir)
|
||||
@@ -334,20 +434,13 @@
|
||||
#endif
|
||||
|
||||
// Called after the shuttle is loaded from template
|
||||
/obj/docking_port/mobile/proc/linkup(datum/map_template/shuttle/template, obj/docking_port/stationary/dock)
|
||||
var/list/static/shuttle_id = list()
|
||||
var/idnum = ++shuttle_id[template]
|
||||
if(idnum > 1)
|
||||
if(id == initial(id))
|
||||
id = "[id][idnum]"
|
||||
if(name == initial(name))
|
||||
name = "[name] [idnum]"
|
||||
/obj/docking_port/mobile/proc/linkup(obj/docking_port/stationary/dock)
|
||||
for(var/place in shuttle_areas)
|
||||
var/area/area = place
|
||||
area.connect_to_shuttle(src, dock, idnum, FALSE)
|
||||
area.connect_to_shuttle(src, dock)
|
||||
for(var/each in place)
|
||||
var/atom/atom = each
|
||||
atom.connect_to_shuttle(src, dock, idnum, FALSE)
|
||||
atom.connect_to_shuttle(src, dock)
|
||||
|
||||
|
||||
//this is a hook for custom behaviour. Maybe at some point we could add checks to see if engines are intact
|
||||
@@ -442,7 +535,7 @@
|
||||
mode = SHUTTLE_RECALL
|
||||
|
||||
/obj/docking_port/mobile/proc/enterTransit()
|
||||
if((SSshuttle.lockdown && is_station_level(z)) || !canMove()) //emp went off, no escape
|
||||
if((SSshuttle.lockdown && is_station_level(z)) || !canMove()) //emp went off, no escape
|
||||
mode = SHUTTLE_IDLE
|
||||
return
|
||||
previous = null
|
||||
@@ -454,7 +547,7 @@
|
||||
if(S1)
|
||||
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
|
||||
else if(S0)
|
||||
if(S0.delete_after)
|
||||
qdel(S0, TRUE)
|
||||
else
|
||||
@@ -471,7 +564,7 @@
|
||||
var/underlying_area_type = SHUTTLE_DEFAULT_UNDERLYING_AREA
|
||||
// If the shuttle is docked to a stationary port, restore its normal
|
||||
// "empty" area and turf
|
||||
if(current_dock && current_dock.area_type)
|
||||
if(current_dock?.area_type)
|
||||
underlying_area_type = current_dock.area_type
|
||||
|
||||
var/list/old_turfs = return_ordered_turfs(x, y, z, dir)
|
||||
@@ -489,7 +582,7 @@
|
||||
oldT.change_area(old_area, underlying_area)
|
||||
oldT.empty(FALSE)
|
||||
|
||||
// Here we locate the bottomost shuttle boundary and remove all turfs above it
|
||||
// Here we locate the bottommost shuttle boundary and remove all turfs above it
|
||||
var/list/baseturf_cache = oldT.baseturfs
|
||||
for(var/k in 1 to length(baseturf_cache))
|
||||
if(ispath(baseturf_cache[k], /turf/baseturf_skipover/shuttle))
|
||||
@@ -626,7 +719,7 @@
|
||||
for(var/place in shuttle_areas)
|
||||
var/area/shuttle/shuttle_area = place
|
||||
shuttle_area.parallax_movedir = FALSE
|
||||
if(assigned_transit && assigned_transit.assigned_area)
|
||||
if(assigned_transit?.assigned_area)
|
||||
assigned_transit.assigned_area.parallax_movedir = FALSE
|
||||
var/list/L0 = return_ordered_turfs(x, y, z, dir)
|
||||
for (var/thing in L0)
|
||||
@@ -696,11 +789,13 @@
|
||||
return "RCH"
|
||||
if(SHUTTLE_PREARRIVAL)
|
||||
return "LDN"
|
||||
// if(SHUTTLE_DISABLED)
|
||||
// return "DIS"
|
||||
return ""
|
||||
|
||||
// returns 5-letter timer string, used by status screens and mob status panel
|
||||
/obj/docking_port/mobile/proc/getTimerStr()
|
||||
if(mode == SHUTTLE_STRANDED)
|
||||
if(mode == SHUTTLE_STRANDED)// || mode == SHUTTLE_DISABLED)
|
||||
return "--:--"
|
||||
|
||||
var/timeleft = timeLeft()
|
||||
@@ -712,8 +807,8 @@
|
||||
return "00:00"
|
||||
|
||||
/**
|
||||
* Gets shuttle location status in a form of string for tgui interfaces
|
||||
*/
|
||||
* Gets shuttle location status in a form of string for tgui interfaces
|
||||
*/
|
||||
/obj/docking_port/mobile/proc/get_status_text_tgui()
|
||||
var/obj/docking_port/stationary/dockedAt = get_docked()
|
||||
var/docked_at = dockedAt?.name || "Unknown"
|
||||
@@ -727,7 +822,8 @@
|
||||
else
|
||||
dst = destination
|
||||
return "In transit to [dst?.name || "unknown location"]"
|
||||
else if(mode == SHUTTLE_RECHARGING)
|
||||
// custom shuttle
|
||||
if(mode == SHUTTLE_RECHARGING)
|
||||
return "[docked_at], recharging [getTimerStr()]"
|
||||
else
|
||||
return docked_at
|
||||
@@ -752,7 +848,7 @@
|
||||
|
||||
/obj/docking_port/mobile/proc/getDbgStatusText()
|
||||
var/obj/docking_port/stationary/dockedAt = get_docked()
|
||||
. = (dockedAt && dockedAt.name) ? dockedAt.name : "unknown"
|
||||
. = (dockedAt?.name) ? dockedAt.name : "unknown"
|
||||
if(istype(dockedAt, /obj/docking_port/stationary/transit))
|
||||
var/obj/docking_port/stationary/dst
|
||||
if(mode == SHUTTLE_RECALL)
|
||||
@@ -795,7 +891,7 @@
|
||||
var/range = (engine_coeff * max(width, height))
|
||||
var/long_range = range * 2.5
|
||||
var/atom/distant_source
|
||||
if(LAZYLEN(engine_list))
|
||||
if(engine_list[1])
|
||||
distant_source = engine_list[1]
|
||||
else
|
||||
for(var/A in areas)
|
||||
@@ -841,10 +937,6 @@
|
||||
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
|
||||
|
||||
@@ -228,7 +228,8 @@ GLOBAL_LIST_EMPTY(custom_shuttle_machines) //Machines that require updating (He
|
||||
curT.baseturfs.Insert(3, /turf/baseturf_skipover/shuttle)
|
||||
port.shuttle_areas[cur_area] = TRUE
|
||||
|
||||
port.linkup(new_shuttle, stationary_port)
|
||||
port.register() // register does the same thing on the old linkup
|
||||
port.linkup(stationary_port)
|
||||
|
||||
port.movement_force = list("KNOCKDOWN" = 0, "THROW" = 0)
|
||||
port.initiate_docking(stationary_port)
|
||||
@@ -236,8 +237,6 @@ GLOBAL_LIST_EMPTY(custom_shuttle_machines) //Machines that require updating (He
|
||||
port.mode = SHUTTLE_IDLE
|
||||
port.timer = 0
|
||||
|
||||
port.register()
|
||||
|
||||
icon_state = "rsd_empty"
|
||||
|
||||
//Clear highlights
|
||||
|
||||
Reference in New Issue
Block a user