[Ready] Shuttle dock() rewrite (#2040)

This commit is contained in:
CitadelStationBot
2017-07-18 00:52:18 -05:00
committed by kevinz000
parent bbc28aa856
commit e522f715a2
22 changed files with 1034 additions and 3766 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -51,4 +51,11 @@
//Engine related
#define ENGINE_COEFF_MIN 0.5
#define ENGINE_COEFF_MAX 2
#define ENGINE_DEFAULT_MAXSPEED_ENGINES 5
#define ENGINE_DEFAULT_MAXSPEED_ENGINES 5
//Docking error flags
#define DOCKING_SUCCESS 0
#define DOCKING_COMPLETE 1
#define DOCKING_BLOCKED 2
#define DOCKING_IMMOBILIZED 4
#define DOCKING_AREA_EMPTY 8
+3 -3
View File
@@ -53,12 +53,12 @@
#define INIT_ORDER_ATOMS 11
#define INIT_ORDER_LANGUAGE 10
#define INIT_ORDER_MACHINES 9
#define INIT_ORDER_SHUTTLE 3
#define INIT_ORDER_TIMER 1
#define INIT_ORDER_DEFAULT 0
#define INIT_ORDER_AIR -1
#define INIT_ORDER_MINIMAP -2
#define INIT_ORDER_ASSETS -3
#define INIT_ORDER_SHUTTLE -2
#define INIT_ORDER_MINIMAP -3
#define INIT_ORDER_ASSETS -4
#define INIT_ORDER_ICON_SMOOTHING -5
#define INIT_ORDER_OVERLAY -6
#define INIT_ORDER_XKEYSCORE -10
+3 -3
View File
@@ -476,15 +476,15 @@ SUBSYSTEM_DEF(ticker)
if(Player.stat != DEAD && !isbrain(Player))
num_survivors++
if(station_evacuated) //If the shuttle has already left the station
var/area/shuttle_area
var/list/area/shuttle_areas
if(SSshuttle && SSshuttle.emergency)
shuttle_area = SSshuttle.emergency.areaInstance
shuttle_areas = SSshuttle.emergency.shuttle_areas
if(!Player.onCentcom() && !Player.onSyndieBase())
to_chat(Player, "<font color='blue'><b>You managed to survive, but were marooned on [station_name()]...</b></FONT>")
else
num_escapees++
to_chat(Player, "<font color='green'><b>You managed to survive the events on [station_name()] as [Player.real_name].</b></FONT>")
if(get_area(Player) == shuttle_area)
if(shuttle_areas[get_area(Player)])
num_shuttle_escapees++
else
to_chat(Player, "<font color='green'><b>You managed to survive the events on [station_name()] as [Player.real_name].</b></FONT>")
+15 -8
View File
@@ -113,20 +113,27 @@
if(T.z == ZLEVEL_TRANSIT)
for(var/A in SSshuttle.mobile)
var/obj/docking_port/mobile/M = A
if(M.launch_status == ENDGAME_TRANSIT && T in M.areaInstance)
return TRUE
if(M.launch_status == ENDGAME_TRANSIT)
for(var/place in M.shuttle_areas)
var/area/shuttle/shuttle_area = place
if(T in shuttle_area)
return TRUE
if(T.z != ZLEVEL_CENTCOM)//if not, don't bother
return FALSE
//check for centcomm shuttles
//Check for centcom itself
if(istype(T.loc, /area/centcom))
return TRUE
//Check for centcomm shuttles
for(var/A in SSshuttle.mobile)
var/obj/docking_port/mobile/M = A
if(M.launch_status == ENDGAME_LAUNCHED && T in M.areaInstance)
return TRUE
//finally check for centcom itself
return istype(T.loc,/area/centcom)
if(M.launch_status == ENDGAME_LAUNCHED)
for(var/place in M.shuttle_areas)
var/area/shuttle/shuttle_area = place
if(T in shuttle_area)
return TRUE
/atom/proc/onSyndieBase()
var/turf/T = get_turf(src)
+25 -40
View File
@@ -240,9 +240,7 @@
return 0
if(issilicon(owner.current))
return 0
var/area/A = get_area(owner.current)
if(SSshuttle.emergency.areaInstance != A)
if(SSshuttle.emergency.shuttle_areas[get_area(owner.current)])
return 0
return SSshuttle.emergency.is_hijacked()
@@ -255,40 +253,31 @@
/datum/objective/hijackclone/check_completion()
if(!owner.current)
return 0
return FALSE
if(SSshuttle.emergency.mode != SHUTTLE_ENDGAME)
return 0
var/area/A = SSshuttle.emergency.areaInstance
return FALSE
var/in_shuttle = FALSE
for(var/mob/living/player in GLOB.player_list) //Make sure nobody else is onboard
if(player.mind && player.mind != owner)
if(player.stat != DEAD)
if(issilicon(player)) //Borgs are technically dead anyways
continue
if(isanimal(player)) //animals don't count
continue
if(isbrain(player)) //also technically dead
continue
if(get_area(player) == A)
if(SSshuttle.emergency.shuttle_areas[get_area(player)])
if(player.mind && player.mind != owner)
if(player.stat != DEAD)
if(issilicon(player)) //Borgs are technically dead anyways
continue
if(isanimal(player)) //animals don't count
continue
if(isbrain(player)) //also technically dead
continue
var/location = get_turf(player.mind.current)
if(player.real_name != owner.current.real_name && !istype(location, /turf/open/floor/plasteel/shuttle/red) && !istype(location, /turf/open/floor/mineral/plastitanium/brig))
return 0
for(var/mob/living/player in GLOB.player_list) //Make sure at least one of you is onboard
if(player.mind && player.mind != owner)
if(player.stat != DEAD)
if(issilicon(player)) //Borgs are technically dead anyways
continue
if(isanimal(player)) //animals don't count
continue
if(isbrain(player)) //also technically dead
continue
if(get_area(player) == A)
var/location = get_turf(player.mind.current)
if(player.real_name == owner.current.real_name && !istype(location, /turf/open/floor/plasteel/shuttle/red) && !istype(location, /turf/open/floor/mineral/plastitanium/brig))
return 1
return 0
if(istype(location, /turf/open/floor/plasteel/shuttle/red))
continue
if(istype(location, /turf/open/floor/mineral/plastitanium/brig))
continue
if(player.real_name != owner.current.real_name)
return FALSE
else
in_shuttle = TRUE
return in_shuttle
/datum/objective/block
explanation_text = "Do not allow any organic lifeforms to escape on the shuttle alive."
@@ -301,14 +290,12 @@
if(SSshuttle.emergency.mode != SHUTTLE_ENDGAME)
return 1
var/area/A = SSshuttle.emergency.areaInstance
for(var/mob/living/player in GLOB.player_list)
if(issilicon(player))
continue
if(player.mind)
if(player.stat != DEAD)
if(get_area(player) == A)
if(get_area(player) in SSshuttle.emergency.shuttle_areas)
return 0
return 1
@@ -323,10 +310,8 @@
if(SSshuttle.emergency.mode != SHUTTLE_ENDGAME)
return 1
var/area/A = SSshuttle.emergency.areaInstance
for(var/mob/living/player in GLOB.player_list)
if(get_area(player) == A && player.mind && player.stat != DEAD && ishuman(player))
if(get_area(player) in SSshuttle.emergency.shuttle_areas && player.mind && player.stat != DEAD && ishuman(player))
var/mob/living/carbon/human/H = player
if(H.dna.species.id != "human")
return 0
@@ -701,7 +686,7 @@ GLOBAL_LIST_EMPTY(possible_items_special)
explanation_text = "Destroy [target.name], the experimental AI."
else
explanation_text = "Free Objective"
/datum/objective/destroy/internal
var/stolen = FALSE //Have we already eliminated this target?
@@ -143,11 +143,6 @@ GLOBAL_LIST_EMPTY(telecomms_list)
var/turf/position = get_turf(src)
listening_level = position.z
/obj/machinery/telecomms/onShuttleMove(turf/T1, rotation)
. = ..()
if(. && T1) // Update listening Z, just in case you have telecomm relay on a shuttle
listening_level = T1.z
/obj/machinery/telecomms/Initialize(mapload)
..()
if(mapload && autolinkers.len)
+2
View File
@@ -31,6 +31,8 @@
/turf/open/space/transit/proc/throw_atom(atom/movable/AM)
if(!AM || istype(AM, /obj/docking_port))
return
if(AM.loc != src) // Multi-tile objects are "in" multiple locs but its loc is it's true placement.
return // Don't move multi tile objects if their origin isnt in transit
var/max = world.maxx-TRANSITIONEDGE
var/min = 1+TRANSITIONEDGE
+14 -20
View File
@@ -197,11 +197,11 @@
qdel(L)
//wrapper for ChangeTurf()s that you want to prevent/affect without overriding ChangeTurf() itself
/turf/proc/TerraformTurf(path, defer_change = FALSE, ignore_air = FALSE)
return ChangeTurf(path, defer_change, ignore_air)
/turf/proc/TerraformTurf(path, defer_change = FALSE, ignore_air = FALSE, new_baseturf)
return ChangeTurf(path, defer_change, ignore_air, new_baseturf)
//Creates a new turf
/turf/proc/ChangeTurf(path, defer_change = FALSE, ignore_air = FALSE)
/turf/proc/ChangeTurf(path, defer_change = FALSE, ignore_air = FALSE, new_baseturf)
if(!path)
return
if(!GLOB.use_preloader && path == type) // Don't no-op if the map loader requires it to be reconstructed
@@ -212,7 +212,10 @@
qdel(src) //Just get the side effects and call Destroy
var/turf/W = new path(src)
W.baseturf = old_baseturf
if(new_baseturf)
W.baseturf = new_baseturf
else
W.baseturf = old_baseturf
if(!defer_change)
W.AfterChange(ignore_air)
@@ -223,10 +226,6 @@
levelupdate()
CalculateAdjacentTurfs()
if(!can_have_cabling())
for(var/obj/structure/cable/C in contents)
C.deconstruct()
//update firedoor adjacency
var/list/turfs_to_check = get_adjacent_open_turfs(src) | src
for(var/I in turfs_to_check)
@@ -408,21 +407,16 @@
if(!SSticker.HasRoundStarted())
add_blueprints(AM)
/turf/proc/empty(turf_type=/turf/open/space)
/turf/proc/empty(turf_type=/turf/open/space, baseturf_type)
// Remove all atoms except observers, landmarks, docking ports
var/turf/T0 = src
for(var/A in T0.GetAllContents())
if(istype(A, /mob/dead))
continue
if(istype(A, /obj/effect/landmark))
continue
if(istype(A, /obj/docking_port))
continue
if(A == T0)
continue
qdel(A, force=TRUE)
var/static/list/ignored_atoms = typecacheof(list(/mob/dead, /obj/effect/landmark, /obj/docking_port, /atom/movable/lighting_object))
var/list/allowed_contents = typecache_filter_list(T0.GetAllContents(),ignored_atoms)
for(var/i in 1 to allowed_contents.len)
var/thing = allowed_contents[i]
qdel(thing, force=TRUE)
T0.ChangeTurf(turf_type)
T0.ChangeTurf(turf_type, FALSE, FALSE, baseturf_type)
SSair.remove_from_active(T0)
T0.CalculateAdjacentTurfs()
@@ -287,48 +287,4 @@ Pipelines + Other Objects -> Pipe network
//Used for certain children of obj/machinery/atmospherics to not show pipe vision when mob is inside it.
/obj/machinery/atmospherics/proc/can_see_pipes()
return 1
//Properly updates pipes on shuttle movement
/obj/machinery/atmospherics/shuttleRotate(rotation)
var/list/real_node_connect = getNodeConnects()
for(DEVICE_TYPE_LOOP)
real_node_connect[I] = angle2dir(rotation+dir2angle(real_node_connect[I]))
..()
SetInitDirections()
var/list/supposed_node_connect = getNodeConnects()
var/list/nodes_copy = nodes.Copy()
for(DEVICE_TYPE_LOOP)
var/new_pos = supposed_node_connect.Find(real_node_connect[I])
nodes[new_pos] = nodes_copy[I]
/obj/machinery/atmospherics/afterShuttleMove()
..()
var/missing_nodes = FALSE
for(DEVICE_TYPE_LOOP)
if(src.nodes[I])
var/obj/machinery/atmospherics/node = src.nodes[I]
var/connected = FALSE
for(var/D in GLOB.cardinals)
if(node in get_step(src, D))
connected = TRUE
break
if(!connected)
nullifyNode(I)
if(!src.nodes[I])
missing_nodes = TRUE
if(missing_nodes)
atmosinit()
for(var/obj/machinery/atmospherics/A in pipeline_expansion())
A.atmosinit()
if(A.returnPipenet())
A.addMember(src)
build_network()
else
// atmosinit() calls update_icon(), so we don't need to call it
update_icon()
return 1
+7 -4
View File
@@ -79,10 +79,13 @@
SSshuttle.shuttle_loan = null
var/list/empty_shuttle_turfs = list()
for(var/turf/open/floor/T in SSshuttle.supply.areaInstance)
if(is_blocked_turf(T))
continue
empty_shuttle_turfs += T
var/list/area/shuttle/shuttle_areas = SSshuttle.supply.shuttle_areas
for(var/place in shuttle_areas)
var/area/shuttle/shuttle_area = place
for(var/turf/open/floor/T in shuttle_area)
if(is_blocked_turf(T))
continue
empty_shuttle_turfs += T
if(!empty_shuttle_turfs.len)
return
-4
View File
@@ -139,10 +139,6 @@ GLOBAL_LIST_EMPTY(all_lighting_objects) // Global list of lighting objects.
/atom/movable/lighting_object/blob_act()
return
// Nope nope nope!
/atom/movable/lighting_object/onShuttleMove(turf/T1, rotation)
return FALSE
// Override here to prevent things accidentally moving around overlays.
/atom/movable/lighting_object/forceMove(atom/destination, var/no_tp=FALSE, var/harderforce = FALSE)
if(harderforce)
+1 -1
View File
@@ -32,7 +32,7 @@
// Builds a lighting object for us, but only if our area is dynamic.
/turf/proc/lighting_build_overlay()
if (lighting_object)
return
qdel(lighting_object,force=TRUE) //Shitty fix for lighting objects persisting after death
var/area/A = loc
if (!IS_DYNAMIC_LIGHTING(A) && !light_sources)
-11
View File
@@ -128,12 +128,6 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
updateUsrDialog()
/obj/machinery/computer/auxillary_base/onShuttleMove(turf/T1, rotation)
..()
if(z == ZLEVEL_MINING) //Avoids double logging and landing on other Z-levels due to badminnery
SSblackbox.add_details("colonies_dropped", "[x]|[y]|[z]") //Number of times a base has been dropped!
/obj/machinery/computer/auxillary_base/proc/set_mining_mode()
if(z == ZLEVEL_MINING) //The console switches to controlling the mining shuttle once landed.
req_one_access = list()
@@ -245,11 +239,6 @@ obj/docking_port/stationary/public_mining_dock
width = 7
height = 5
obj/docking_port/stationary/public_mining_dock/onShuttleMove()
id = "mining_public" //It will not move with the base, but will become enabled as a docking point.
return 0
/obj/structure/mining_shuttle_beacon
name = "mining shuttle beacon"
desc = "A bluespace beacon calibrated to mark a landing spot for the mining shuttle when deployed near the auxillary mining base."
@@ -95,14 +95,6 @@
else
devour(L)
/mob/living/simple_animal/hostile/megafauna/onShuttleMove()
var/turf/oldloc = loc
. = ..()
if(!.)
return
var/turf/newloc = loc
message_admins("Megafauna [src] [ADMIN_FLW(src)] moved via shuttle from [ADMIN_COORDJMP(oldloc)] to [ADMIN_COORDJMP(newloc)]")
/mob/living/simple_animal/hostile/megafauna/proc/devour(mob/living/L)
if(!L)
return
+3 -39
View File
@@ -390,7 +390,7 @@ By design, d1 is the smallest direction and d2 is the highest
qdel(PN)
// cut the cable's powernet at this cable and updates the powergrid
/obj/structure/cable/proc/cut_cable_from_powernet()
/obj/structure/cable/proc/cut_cable_from_powernet(remove=TRUE)
var/turf/T1 = loc
var/list/P_list
if(!T1)
@@ -412,7 +412,8 @@ By design, d1 is the smallest direction and d2 is the highest
var/obj/O = P_list[1]
// remove the cut cable from its turf and powernet, so that it doesn't get count in propagate_network worklist
loc = null
if(remove)
loc = null
powernet.remove_cable(src) //remove the cut cable from its powernet
spawn(0) //so we don't rebuild the network X times when singulo/explosion destroys a line of X cables
@@ -426,43 +427,6 @@ By design, d1 is the smallest direction and d2 is the highest
if(!P.connect_to_network()) //can't find a node cable on a the turf to connect to
P.disconnect_from_network() //remove from current network
// Ugly procs that ensure proper separation and reconnection of wires on shuttle movement/rotation
/obj/structure/cable/beforeShuttleMove(turf/T1, rotation)
var/on_edge = FALSE
var/A = get_area(src)
for(var/D in GLOB.alldirs)
if(A != get_area(get_step(src, D)))
on_edge = TRUE
break
if(on_edge && powernet)
var/tmp_loc = loc
cut_cable_from_powernet()
loc = tmp_loc
/obj/structure/cable/afterShuttleMove()
var/on_edge = FALSE
var/A = get_area(src)
for(var/D in GLOB.alldirs)
if(A != get_area(get_step(src, D)))
on_edge = TRUE
break
if(on_edge)
var/datum/powernet/PN = new()
PN.add_cable(src)
mergeConnectedNetworks(d1) //merge the powernet with adjacents powernets
mergeConnectedNetworks(d2)
mergeConnectedNetworksOnTurf() //merge the powernet with on turf powernets
if(d1 & (d1 - 1))// if the cable is layed diagonally, check the others 2 possible directions
mergeDiagonalsNetworks(d1)
if(d2 & (d2 - 1))
mergeDiagonalsNetworks(d2)
/obj/structure/cable/shuttleRotate(rotation)
//..() is not called because wires are not supposed to have a non-default direction
//Rotate connections
+1 -1
View File
@@ -4,7 +4,7 @@
dwidth = 3
width = 7
height = 7
knockdown = FALSE
movement_force = list("KNOCKDOWN" = 0, "THROW" = 0)
/obj/docking_port/mobile/elevator/request(obj/docking_port/stationary/S) //No transit, no ignition, just a simple up/down platform
dock(S, TRUE)
+15 -14
View File
@@ -259,7 +259,7 @@
continue
if(isbrain(player)) //also technically dead
continue
if(get_area(player) == areaInstance)
if(shuttle_areas[get_area(player)])
has_people = TRUE
var/location = get_turf(player.mind.current)
if(!(player.mind.special_role == "traitor" || player.mind.special_role == "Syndicate") && !istype(location, /turf/open/floor/plasteel/shuttle/red) && !istype(location, /turf/open/floor/mineral/plastitanium/brig))
@@ -369,13 +369,20 @@
for(var/area/shuttle/escape/E in GLOB.sortedAreas)
areas += E
hyperspace_sound(HYPERSPACE_END, areas)
if(areaInstance.parallax_movedir && time_left <= PARALLAX_LOOP_TIME)
parallax_slowdown()
for(var/A in SSshuttle.mobile)
var/obj/docking_port/mobile/M = A
if(M.launch_status == ENDGAME_LAUNCHED)
if(istype(M, /obj/docking_port/mobile/pod))
M.parallax_slowdown()
if(time_left <= PARALLAX_LOOP_TIME)
var/area_parallax = FALSE
for(var/place in shuttle_areas)
var/area/shuttle/shuttle_area = place
if(shuttle_area.parallax_movedir)
area_parallax = TRUE
break
if(area_parallax)
parallax_slowdown()
for(var/A in SSshuttle.mobile)
var/obj/docking_port/mobile/M = A
if(M.launch_status == ENDGAME_LAUNCHED)
if(istype(M, /obj/docking_port/mobile/pod))
M.parallax_slowdown()
if(time_left <= 0)
//move each escape pod to its corresponding escape dock
@@ -531,12 +538,6 @@
/obj/item/weapon/storage/pod/attack_hand(mob/user)
return MouseDrop(user)
/obj/item/weapon/storage/pod/onShuttleMove()
unlocked = TRUE
// If the pod was launched, the storage will always open.
return ..()
/obj/docking_port/mobile/emergency/backup
name = "backup shuttle"
id = "backup"
+351 -50
View File
@@ -1,64 +1,133 @@
// Called before shuttle starts moving atoms.
/atom/movable/proc/beforeShuttleMove(turf/T1, rotation)
return
/*
All ShuttleMove procs go here
*/
/************************************Base procs************************************/
// Called on every turf in the shuttle region, return false if it doesn't want to move
/turf/proc/fromShuttleMove(turf/newT, turf_type, baseturf_type)
if(type == turf_type && baseturf == baseturf_type)
return FALSE
return TRUE
// Called from the new turf before anything has been moved
// Only gets called if fromShuttleMove returns true first
/turf/proc/toShuttleMove(turf/oldT, shuttle_dir)
for(var/i in 1 to contents.len)
var/atom/movable/thing = contents[i]
if(ismob(thing))
if(isliving(thing))
var/mob/living/M = thing
if(M.buckled)
M.buckled.unbuckle_mob(M, 1)
if(M.pulledby)
M.pulledby.stop_pulling()
M.stop_pulling()
M.visible_message("<span class='warning'>[src] slams into [M]!</span>")
if(M.key || M.get_ghost(TRUE))
SSblackbox.add_details("shuttle_gib", "[type]")
else
SSblackbox.add_details("shuttle_gib_unintelligent", "[type]")
M.gib()
else //non-living mobs shouldn't be affected by shuttles, which is why this is an else
if(istype(thing, /obj/singularity) && !istype(thing, /obj/singularity/narsie)) //it's a singularity but not a god, ignore it.
continue
if(!thing.anchored)
step(thing, shuttle_dir)
else
qdel(thing)
return TRUE
// Called on the old turf to move the turf data
/turf/proc/onShuttleMove(turf/newT, turf_type, baseturf_type, rotation, list/movement_force, move_dir)
if(newT == src) // In case of in place shuttle rotation shenanigans.
return
//Destination turf changes
var/destination_turf_type = newT.type
copyTurf(newT)
newT.baseturf = destination_turf_type
if(isopenturf(newT))
var/turf/open/new_open = newT
new_open.copy_air_with_tile(src)
//Source turf changes
ChangeTurf(turf_type, FALSE, TRUE, baseturf_type)
return TRUE
// Called on the new turf after everything has been moved
/turf/proc/afterShuttleMove(turf/oldT)
if(SSlighting.initialized && FALSE)
var/atom/movable/lighting_object/old_obj = lighting_object
var/atom/movable/lighting_object/new_obj = oldT.lighting_object
if(old_obj)
old_obj.update()
if(new_obj)
new_obj.update()
return TRUE
/////////////////////////////////////////////////////////////////////////////////////
// Called on every atom in shuttle turf contents before anything has been moved
// Return true if it should be moved regardless of turf being moved
/atom/movable/proc/beforeShuttleMove(turf/newT, rotation)
return FALSE
// Called on atoms to move the atom to the new location
/atom/movable/proc/onShuttleMove(turf/newT, turf/oldT, rotation, list/movement_force, move_dir)
if(newT == oldT) // In case of in place shuttle rotation shenanigans.
return
if(locs && locs.len > 1) // This is for multi tile objects
if(loc != oldT)
return
// Called when shuttle attempts to move an atom.
/atom/movable/proc/onShuttleMove(turf/T1, rotation, knockdown = TRUE)
if(rotation)
shuttleRotate(rotation)
loc = T1
if (length(client_mobs_in_contents))
loc = newT
if(length(client_mobs_in_contents))
update_parallax_contents()
return 1
return TRUE
// Called after all of the atoms on shuttle are moved.
/atom/movable/proc/afterShuttleMove()
return
// Called on atoms after everything has been moved
/atom/movable/proc/afterShuttleMove(list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir)
if(light)
update_light()
return TRUE
/////////////////////////////////////////////////////////////////////////////////////
/obj/onShuttleMove()
if(invisibility >= INVISIBILITY_ABSTRACT)
return 0
. = ..()
// Called on areas before anything has been moved
/area/proc/beforeShuttleMove()
return TRUE
/atom/movable/light/onShuttleMove()
return 0
/obj/machinery/door/airlock/onShuttleMove()
shuttledocked = 0
for(var/obj/machinery/door/airlock/A in range(1, src))
A.shuttledocked = 0
A.air_tight = TRUE
INVOKE_ASYNC(A, /obj/machinery/door/.proc/close)
. = ..()
shuttledocked = 1
for(var/obj/machinery/door/airlock/A in range(1, src))
A.shuttledocked = 1
/mob/onShuttleMove()
if(!move_on_shuttle)
return 0
. = ..()
if(!.)
// Called on areas to move their turf between areas
/area/proc/onShuttleMove(turf/oldT, turf/newT, area/underlying_old_area)
if(newT == oldT) // In case of in place shuttle rotation shenanigans.
return
if(client)
if(buckled)
shake_camera(src, 2, 1) // turn it down a bit come on
else
shake_camera(src, 7, 1)
/mob/living/carbon/onShuttleMove(turf/T1, rotation, knockdown = TRUE)
. = ..()
if(!.)
return
if(!buckled && knockdown)
Knockdown(60)
contents -= oldT
underlying_old_area.contents += oldT
oldT.change_area(src, underlying_old_area)
//The old turf has now been given back to the area that turf originaly belonged to
/obj/effect/abstract/proximity_checker/onShuttleMove()
//timer so it only happens once
addtimer(CALLBACK(monitor, /datum/proximity_monitor/proc/SetRange, monitor.current_range, TRUE), 0, TIMER_UNIQUE)
var/area/old_dest_area = newT.loc
parallax_movedir = old_dest_area.parallax_movedir
old_dest_area.contents -= newT
contents += newT
newT.change_area(old_dest_area, src)
return TRUE
// Shuttle Rotation //
// Called on areas after everything has been moved
/area/proc/afterShuttleMove()
return TRUE
/************************************Shuttle Rotation************************************/
/atom/proc/shuttleRotate(rotation)
//rotate our direction
@@ -76,4 +145,236 @@
var/oldPX = pixel_x
var/oldPY = pixel_y
pixel_x = oldPY
pixel_y = (oldPX*(-1))
pixel_y = (oldPX*(-1))
/************************************Turf move procs************************************/
/turf/open/afterShuttleMove(turf/oldT) //Recalculates SSair stuff for turfs on both sides
. = ..()
SSair.remove_from_active(src)
SSair.remove_from_active(oldT)
src.CalculateAdjacentTurfs()
oldT.CalculateAdjacentTurfs()
SSair.add_to_active(src, TRUE)
SSair.add_to_active(oldT, TRUE)
/************************************Machinery move procs************************************/
/obj/machinery/door/airlock/beforeShuttleMove()
. = ..()
shuttledocked = 0
for(var/obj/machinery/door/airlock/A in range(1, src))
A.shuttledocked = 0
A.air_tight = TRUE
INVOKE_ASYNC(A, /obj/machinery/door/.proc/close)
/obj/machinery/door/airlock/afterShuttleMove()
. = ..()
shuttledocked = 1
for(var/obj/machinery/door/airlock/A in range(1, src))
A.shuttledocked = 1
/obj/machinery/camera/beforeShuttleMove()
. = ..()
GLOB.cameranet.removeCamera(src)
GLOB.cameranet.updateChunk()
return TRUE
/obj/machinery/camera/afterShuttleMove()
. = ..()
if(can_use())
GLOB.cameranet.addCamera(src)
var/datum/camerachunk/chunk = GLOB.cameranet.getCameraChunk(x, y, z)
chunk.hasChanged(TRUE)
/obj/machinery/telecomms/onShuttleMove(turf/T1)
. = ..()
if(. && T1) // Update listening Z, just in case you have telecomm relay on a shuttle
listening_level = T1.z
/obj/machinery/mech_bay_recharge_port/afterShuttleMove()
. = ..()
recharging_turf = get_step(loc, dir)
/obj/machinery/atmospherics/afterShuttleMove()
. = ..()
if(pipe_vision_img)
pipe_vision_img.loc = loc
/obj/machinery/computer/auxillary_base/onShuttleMove(turf/T1)
. = ..()
if(z == ZLEVEL_MINING) //Avoids double logging and landing on other Z-levels due to badminnery
SSblackbox.add_details("colonies_dropped", "[x]|[y]|[z]") //Number of times a base has been dropped!
/obj/machinery/gravity_generator/main/beforeShuttleMove()
. = ..()
on = FALSE
update_list()
/obj/machinery/gravity_generator/main/afterShuttleMove()
. = ..()
if(charge_count != 0 && charging_state != POWER_UP)
on = TRUE
update_list()
/obj/machinery/thruster/beforeShuttleMove()
. = ..()
. = TRUE
//Properly updates pipes on shuttle movement
/obj/machinery/atmospherics/shuttleRotate(rotation)
var/list/real_node_connect = getNodeConnects()
for(DEVICE_TYPE_LOOP)
real_node_connect[I] = angle2dir(rotation+dir2angle(real_node_connect[I]))
. = ..()
SetInitDirections()
var/list/supposed_node_connect = getNodeConnects()
var/list/nodes_copy = nodes.Copy()
for(DEVICE_TYPE_LOOP)
var/new_pos = supposed_node_connect.Find(real_node_connect[I])
nodes[new_pos] = nodes_copy[I]
/obj/machinery/atmospherics/afterShuttleMove()
. = ..()
var/missing_nodes = FALSE
for(DEVICE_TYPE_LOOP)
if(src.nodes[I])
var/obj/machinery/atmospherics/node = src.nodes[I]
var/connected = FALSE
for(var/D in GLOB.cardinals)
if(node in get_step(src, D))
connected = TRUE
break
if(!connected)
nullifyNode(I)
if(!src.nodes[I])
missing_nodes = TRUE
if(missing_nodes)
atmosinit()
for(var/obj/machinery/atmospherics/A in pipeline_expansion())
A.atmosinit()
if(A.returnPipenet())
A.addMember(src)
build_network()
else
// atmosinit() calls update_icon(), so we don't need to call it
update_icon()
/obj/machinery/atmospherics/pipe/afterShuttleMove()
. = ..()
var/turf/T = loc
hide(T.intact)
/obj/machinery/navbeacon/beforeShuttleMove()
. = ..()
GLOB.navbeacons["[z]"] -= src
GLOB.deliverybeacons -= src
/obj/machinery/navbeacon/afterShuttleMove()
. = ..()
var/turf/T = loc
hide(T.intact)
if(codes["patrol"])
if(!GLOB.navbeacons["[z]"])
GLOB.navbeacons["[z]"] = list()
GLOB.navbeacons["[z]"] += src //Register with the patrol list!
if(codes["delivery"])
GLOB.deliverybeacons += src
GLOB.deliverybeacontags += location
/obj/machinery/power/terminal/afterShuttleMove()
. = ..()
var/turf/T = src.loc
if(level==1)
hide(T.intact)
/************************************Item move procs************************************/
/obj/item/weapon/storage/pod/onShuttleMove()
unlocked = TRUE
// If the pod was launched, the storage will always open.
return ..()
/************************************Mob move procs************************************/
/mob/onShuttleMove()
if(!move_on_shuttle)
return 0
. = ..()
if(!.)
return
if(client)
if(buckled)
shake_camera(src, 2, 1) // turn it down a bit come on
else
shake_camera(src, 7, 1)
/mob/living/afterShuttleMove(list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir)
. = ..()
if(movement_force && !buckled)
if(movement_force["THROW"])
var/throw_dir = move_dir
var/turf/target = get_edge_target_turf(src, throw_dir)
var/range = movement_force["THROW"]
var/speed = range/5
src.throw_at(target, range, speed)
if(movement_force["KNOCKDOWN"])
Knockdown(movement_force["KNOCKDOWN"])
/mob/living/simple_animal/hostile/megafauna/onShuttleMove()
var/turf/oldT = loc
. = ..()
message_admins("Megafauna [src] [ADMIN_FLW(src)] moved via shuttle from [ADMIN_COORDJMP(oldT)] to [ADMIN_COORDJMP(loc)]")
/************************************Structure move procs************************************/
/obj/structure/grille/beforeShuttleMove()
. = ..()
. = TRUE
/obj/structure/lattice/beforeShuttleMove()
. = ..()
. = TRUE
/obj/structure/disposalpipe/afterShuttleMove()
. = ..()
update()
/obj/structure/cable/afterShuttleMove()
. = ..()
var/turf/T = loc
if(level==1)
hide(T.intact)
/************************************Misc move procs************************************/
/atom/movable/lighting_object/onShuttleMove()
return FALSE
/atom/movable/light/onShuttleMove()
return FALSE
/obj/docking_port/stationary/onShuttleMove(turf/newT, turf/oldT, rotation, list/movement_force)
var/obj/docking_port/mobile/docked_port = get_docked()
if(!docked_port)
docked_port = locate(/obj/docking_port/mobile) in newT
if(docked_port && locate(/obj/docking_port/stationary) in newT)
return FALSE //There's a mobile dock that's moving to the new turf to be with another stationary dock! After all I did for them...
. = ..()
obj/docking_port/stationary/public_mining_dock/onShuttleMove()
id = "mining_public" //It will not move with the base, but will become enabled as a docking point.
return 0
/obj/effect/abstract/proximity_checker/onShuttleMove()
//timer so it only happens once
addtimer(CALLBACK(monitor, /datum/proximity_monitor/proc/SetRange, monitor.current_range, TRUE), 0, TIMER_UNIQUE)
+176 -172
View File
@@ -74,7 +74,7 @@
//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, area/A)
/obj/docking_port/proc/return_ordered_turfs(_x, _y, _z, _dir, area_type)
if(!_dir)
_dir = dir
if(!_x)
@@ -105,8 +105,8 @@
xi = _x + (dx-dwidth)*cos - (dy-dheight)*sin
yi = _y + (dy-dheight)*cos + (dx-dwidth)*sin
var/turf/T = locate(xi, yi, _z)
if(A)
if(get_area(T) == A)
if(area_type)
if(istype(get_area(T), area_type))
. += T
else
. += null
@@ -142,6 +142,7 @@
name = "dock"
var/turf_type = /turf/open/space
var/baseturf_type = /turf/open/space
var/area_type = /area/space
var/last_dock_time
@@ -173,14 +174,16 @@
SSshuttle.transit += src
/obj/docking_port/stationary/transit/proc/dezone()
for(var/i in assigned_turfs)
var/turf/T = i
for(var/i in 1 to assigned_turfs.len)
var/turf/T = assigned_turfs[i]
if(T.type == turf_type)
T.ChangeTurf(/turf/open/space)
T.ChangeTurf(/turf/open/space,new_baseturf=/turf/open/space)
T.flags |= UNUSED_TRANSIT_TURF
/obj/docking_port/stationary/transit/Destroy(force=FALSE)
if(force)
if(get_docked())
to_chat("A transit dock was destroyed while something was docked to it.")
SSshuttle.transit -= src
if(owner)
owner = null
@@ -195,7 +198,8 @@
name = "shuttle"
icon_state = "pinonclose"
var/area/shuttle/areaInstance
var/area_type = /area/shuttle
var/list/area/shuttle/shuttle_areas
var/timer //used as a timer (if you want time left to complete move, use timeLeft proc)
var/last_timer_length
@@ -217,7 +221,7 @@
var/launch_status = NOLAUNCH
var/knockdown = TRUE //Will it knock down mobs when it docks?
var/list/movement_force = list("KNOCKDOWN" = 3, "THROW" = 0)
// A timid shuttle will not register itself with the shuttle subsystem
// All shuttle templates are timid
@@ -237,7 +241,7 @@
destination = null
previous = null
assigned_transit = null
areaInstance = null
shuttle_areas = null
. = ..()
/obj/docking_port/mobile/Initialize(mapload)
@@ -245,19 +249,18 @@
if(!timid)
register()
var/area/A = get_area(src)
if(istype(A, /area/shuttle))
areaInstance = A
if(!id)
id = "[SSshuttle.mobile.len]"
if(name == "shuttle")
name = "shuttle[SSshuttle.mobile.len]"
if(!areaInstance)
areaInstance = new()
areaInstance.name = name
areaInstance.contents += return_ordered_turfs()
shuttle_areas = list()
var/list/all_turfs = return_ordered_turfs(x, y, z, dir)
for(var/i in 1 to all_turfs.len)
var/turf/curT = all_turfs[i]
var/area/cur_area = curT.loc
if(istype(cur_area, area_type))
shuttle_areas[cur_area] = TRUE
initial_engines = count_engines()
current_engines = initial_engines
@@ -378,32 +381,41 @@
/obj/docking_port/mobile/proc/jumpToNullSpace()
// Destroys the docking port and the shuttle contents.
// Not in a fancy way, it just ceases.
var/obj/docking_port/stationary/S0 = get_docked()
var/obj/docking_port/stationary/current_dock = get_docked()
var/turf_type = /turf/open/space
var/baseturf_type = /turf/open/space
var/area_type = /area/space
// If the shuttle is docked to a stationary port, restore its normal
// "empty" area and turf
if(S0)
if(S0.turf_type)
turf_type = S0.turf_type
if(S0.area_type)
area_type = S0.area_type
if(current_dock)
if(current_dock.turf_type)
turf_type = current_dock.turf_type
if(current_dock.baseturf_type)
baseturf_type = current_dock.baseturf_type
if(current_dock.area_type)
area_type = current_dock.area_type
var/list/L0 = return_ordered_turfs(x, y, z, dir, areaInstance)
var/list/shuttle_turfs = return_ordered_turfs(x, y, z, dir, area_type)
//remove area surrounding docking port
if(areaInstance.contents.len)
var/area/A0 = locate("[area_type]")
if(!A0)
A0 = new area_type(null)
for(var/turf/T0 in L0)
A0.contents += T0
for(var/i in 1 to shuttle_areas.len)
var/area/shuttle_area = shuttle_areas[i]
if(shuttle_area.contents.len)
var/area/underlying_area = locate("[area_type]")
if(!underlying_area)
underlying_area = new area_type(null)
for(var/ii in shuttle_turfs)
var/turf/T = shuttle_turfs[ii]
var/area/old_area = T.loc
underlying_area.contents += T
T.change_area(old_area, underlying_area)
for(var/i in L0)
var/turf/T0 =i
if(!T0)
for(var/i in shuttle_turfs)
var/turf/T = i
if(!T)
continue
T0.empty(turf_type)
T.empty(turf_type, baseturf_type)
qdel(src, force=TRUE)
@@ -418,7 +430,7 @@
ripples.Cut()
/obj/docking_port/mobile/proc/ripple_area(obj/docking_port/stationary/S1)
var/list/L0 = return_ordered_turfs(x, y, z, dir, areaInstance)
var/list/L0 = return_ordered_turfs(x, y, z, dir, area_type)
var/list/L1 = return_ordered_turfs(S1.x, S1.y, S1.z, S1.dir)
var/list/ripple_turfs = list()
@@ -439,117 +451,134 @@
for(var/obj/machinery/door/poddoor/shuttledock/pod in GLOB.airlocks)
pod.check()
//this is the main proc. It instantly moves our mobile port to stationary port S1
//it handles all the generic behaviour, such as sanity checks, closing doors on the shuttle, stunning mobs, etc
/obj/docking_port/mobile/proc/dock(obj/docking_port/stationary/S1, force=FALSE)
if(S1.get_docked() == src)
remove_ripples()
return
//this is the main proc. It instantly moves our mobile port to stationary port new_dock
/obj/docking_port/mobile/proc/dock(obj/docking_port/stationary/new_dock, movement_direction, force=FALSE)
// Crashing this ship with NO SURVIVORS
if(new_dock.get_docked() == src)
remove_ripples()
return DOCKING_COMPLETE
if(!force)
if(!check_dock(S1))
return -1
if(!check_dock(new_dock))
return DOCKING_BLOCKED
if(!canMove())
return -1
return DOCKING_IMMOBILIZED
var/obj/docking_port/stationary/S0 = get_docked()
var/turf_type = /turf/open/space
var/area_type = /area/space
if(S0)
if(S0.turf_type)
turf_type = S0.turf_type
if(S0.area_type)
area_type = S0.area_type
var/obj/docking_port/stationary/old_dock = get_docked()
var/turf_type = /turf/open/space //The turf that gets placed under where the shuttle moved from
var/baseturf_type = /turf/open/space //The baseturf that the gets assigned to the turf_type above
var/area_type = /area/space //The area that gets placed under where the shuttle moved from
if(old_dock) //Dock overwrites
if(old_dock.turf_type)
turf_type = old_dock.turf_type
if(old_dock.baseturf_type)
baseturf_type = old_dock.baseturf_type
if(old_dock.area_type)
area_type = old_dock.area_type
var/destination_turf_type = S1.turf_type
var/list/old_turfs = return_ordered_turfs(x, y, z, dir)
var/list/new_turfs = return_ordered_turfs(new_dock.x, new_dock.y, new_dock.z, new_dock.dir)
var/list/old_contents = list() //Lists of turfs to only move contents and area but not move the turf
var/list/new_contents = list() //For structures etc that act attached to the ship
var/list/L0 = return_ordered_turfs(x, y, z, dir, areaInstance)
var/list/L1 = return_ordered_turfs(S1.x, S1.y, S1.z, S1.dir)
var/area/underlying_old_area = locate("[area_type]")
if(!underlying_old_area)
underlying_old_area = new area_type(null)
var/rotation = dir2angle(S1.dir)-dir2angle(dir)
if ((rotation % 90) != 0)
rotation += (rotation % 90) //diagonal rotations not allowed, round up
rotation = SimplifyDegrees(rotation)
var/rotation = 0
if(new_dock.dir != dir) //Even when the dirs are the same rotation is coming out as not 0 for some reason
rotation = dir2angle(new_dock)-dir2angle(dir)
if ((rotation % 90) != 0)
rotation += (rotation % 90) //diagonal rotations not allowed, round up
rotation = SimplifyDegrees(rotation)
if(!movement_direction)
movement_direction = turn(preferred_direction, 180)
//remove area surrounding docking port
if(areaInstance.contents.len)
var/area/A0 = locate("[area_type]")
if(!A0)
A0 = new area_type(null)
for(var/turf/T0 in L0)
var/area/old = T0.loc
A0.contents += T0
T0.change_area(old, A0)
if (istype(S1, /obj/docking_port/stationary/transit))
areaInstance.parallax_movedir = preferred_direction
else
areaInstance.parallax_movedir = FALSE
remove_ripples()
//move or squish anything in the way ship at destination
roadkill(L0, L1, S1.dir)
var/list/moved_atoms = list() //Everything not a turf that gets moved in the shuttle
var/list/areas_to_move = list() //unique assoc list of areas on turfs being moved
for(var/i in 1 to L0.len)
var/turf/T0 = L0[i]
if(!T0)
/****************************************All beforeShuttleMove procs*****************************************/
var/index = 1
while(index <= old_turfs.len)
var/turf/oldT = old_turfs[index]
var/turf/newT = new_turfs[index]
var/area/old_area = oldT.loc
var/move_turf = TRUE //Should this turf be moved, if false remove from the turf list
if(!(shuttle_areas[old_area]))
move_turf = FALSE
if(move_turf)
move_turf = oldT.fromShuttleMove(newT, turf_type, baseturf_type) //turf
if(move_turf) //Only call toShuttleMove if the source turf is willing to move
move_turf = newT.toShuttleMove(oldT, dir) //turf
for(var/ii in 1 to oldT.contents.len)
var/atom/movable/moving_atom = oldT.contents[ii]
if(moving_atom.beforeShuttleMove(newT, rotation) && !move_turf) //atoms
old_contents += oldT
new_contents += newT
if(!move_turf)
old_turfs.Cut(index,index+1)
new_turfs.Cut(index,index+1)
continue
var/turf/T1 = L1[i]
if(!T1)
areas_to_move[old_area] = TRUE
index++
for(var/thing in areas_to_move)
var/area/internal_area = thing
internal_area.beforeShuttleMove() //areas
if(!old_turfs.len && !old_contents.len) //This should only happen if no shuttle area has been specified
return DOCKING_AREA_EMPTY
/*******************************************All onShuttleMove procs******************************************/
for(var/i in 1 to old_turfs.len)
var/turf/oldT = old_turfs[i]
var/turf/newT = new_turfs[i]
if(!oldT || !newT) //This really shouldn't happen
continue
if(T0.type == T0.baseturf)
for(var/thing in oldT) //Needs to be this kind of loop in case, because of shuttle rotation shenanigans, the destination turf is the same as the source turf
var/atom/movable/moving_atom = thing
moving_atom.onShuttleMove(newT, oldT, rotation, movement_force, movement_direction) //atoms
moved_atoms += moving_atom
oldT.onShuttleMove(newT, turf_type, baseturf_type, rotation, movement_force, movement_direction) //turfs
var/area/shuttle_area = oldT.loc
shuttle_area.onShuttleMove(oldT, newT, underlying_old_area) //areas
for(var/i in 1 to old_contents.len) //This is for moving atoms that need to move without their turf
var/turf/oldT = old_contents[i] //I'll figure out a way of merging these loops eventualy, probably
var/turf/newT = new_contents[i]
if(!oldT || !newT)
continue
for(var/atom/movable/AM in T0)
AM.beforeShuttleMove(T1, rotation)
for(var/thing in oldT)
var/atom/movable/moving_atom = thing
moving_atom.onShuttleMove(newT, oldT, rotation, movement_force, movement_direction) //atoms
moved_atoms += moving_atom
/******************************************All afterShuttleMove procs****************************************/
for(var/i in 1 to new_turfs.len)
var/turf/oldT = old_turfs[i]
var/turf/newT = new_turfs[i]
newT.afterShuttleMove(oldT) //turfs
var/list/moved_atoms = list()
for(var/i in 1 to moved_atoms.len)
var/atom/movable/moved_object = moved_atoms[i]
moved_object.afterShuttleMove(movement_force, dir, preferred_direction, movement_direction) //atoms
for(var/i in 1 to L0.len)
var/turf/T0 = L0[i]
if(!T0)
continue
var/turf/T1 = L1[i]
if(!T1)
continue
if(T0.type != T0.baseturf) //So if there is a hole in the shuttle we don't drag along the space/asteroid/etc to wherever we are going next
T0.copyTurf(T1)
T1.baseturf = destination_turf_type
var/area/old = T1.loc
areaInstance.contents += T1
T1.change_area(old, areaInstance)
underlying_old_area.afterShuttleMove()
//copy over air
if(isopenturf(T1))
var/turf/open/Ts1 = T1
Ts1.copy_air_with_tile(T0)
for(var/thing in areas_to_move)
var/area/internal_area = thing
internal_area.afterShuttleMove() //areas
//move mobile to new location
for(var/atom/movable/AM in T0)
if(AM.onShuttleMove(T1, rotation, knockdown))
moved_atoms += AM
new_dock.last_dock_time = world.time
setDir(new_dock.dir)
if(rotation)
T1.shuttleRotate(rotation)
SSair.remove_from_active(T1)
T1.CalculateAdjacentTurfs()
SSair.add_to_active(T1,1)
T0.ChangeTurf(turf_type)
SSair.remove_from_active(T0)
T0.CalculateAdjacentTurfs()
SSair.add_to_active(T0,1)
for(var/am in moved_atoms)
var/atom/movable/AM = am
AM.afterShuttleMove()
check_poddoors()
S1.last_dock_time = world.time
loc = S1.loc
setDir(S1.dir)
return DOCKING_SUCCESS
/obj/docking_port/mobile/proc/findRoundstartDock()
return SSshuttle.getDock(roundstart_move)
@@ -567,40 +596,6 @@
/obj/effect/landmark/shuttle_import
name = "Shuttle Import"
/obj/docking_port/mobile/proc/roadkill(list/L0, list/L1, dir)
for(var/i in 1 to L0.len)
var/turf/T0 = L0[i]
var/turf/T1 = L1[i]
if(!T0 || !T1)
continue
if(T0.type == T0.baseturf)
continue
// The corresponding tile will not be changed, so no roadkill
for(var/atom/movable/AM in T1)
if(ismob(AM))
if(isliving(AM))
var/mob/living/M = AM
if(M.buckled)
M.buckled.unbuckle_mob(M, 1)
if(M.pulledby)
M.pulledby.stop_pulling()
M.stop_pulling()
M.visible_message("<span class='warning'>[src] slams into [M]!</span>")
if(M.key || M.get_ghost(TRUE))
SSblackbox.add_details("shuttle_gib", "[type]")
else
SSblackbox.add_details("shuttle_gib_unintelligent", "[type]")
M.gib()
else //non-living mobs shouldn't be affected by shuttles, which is why this is an else
if(istype(AM, /obj/singularity) && !istype(AM, /obj/singularity/narsie)) //it's a singularity but not a god, ignore it.
continue
if(!AM.anchored)
step(AM, dir)
else
qdel(AM)
//used by shuttle subsystem to check timers
/obj/docking_port/mobile/proc/check()
check_effects()
@@ -614,7 +609,7 @@
// then try again
switch(mode)
if(SHUTTLE_CALL)
if(dock(destination))
if(dock(destination, preferred_direction))
setTimer(20)
return
if(SHUTTLE_RECALL)
@@ -643,14 +638,19 @@
create_ripples(destination, tl)
var/obj/docking_port/stationary/S0 = get_docked()
if(areaInstance.parallax_movedir && istype(S0, /obj/docking_port/stationary/transit) && timeLeft(1) <= PARALLAX_LOOP_TIME)
parallax_slowdown()
if(istype(S0, /obj/docking_port/stationary/transit) && timeLeft(1) <= PARALLAX_LOOP_TIME)
for(var/place in shuttle_areas)
var/area/shuttle/shuttle_area = place
if(shuttle_area.parallax_movedir)
parallax_slowdown()
/obj/docking_port/mobile/proc/parallax_slowdown()
areaInstance.parallax_movedir = FALSE
for(var/place in shuttle_areas)
var/area/shuttle/shuttle_area = place
shuttle_area.parallax_movedir = FALSE
if(assigned_transit && assigned_transit.assigned_area)
assigned_transit.assigned_area.parallax_movedir = FALSE
var/list/L0 = return_ordered_turfs(x, y, z, dir, areaInstance)
var/list/L0 = return_ordered_turfs(x, y, z, dir, area_type)
for (var/thing in L0)
var/turf/T = thing
for (var/thing2 in T)
@@ -740,9 +740,11 @@
// attempts to locate /obj/machinery/computer/shuttle with matching ID inside the shuttle
/obj/docking_port/mobile/proc/getControlConsole()
for(var/obj/machinery/computer/shuttle/S in areaInstance)
if(S.shuttleId == id)
return S
for(var/place in shuttle_areas)
var/area/shuttle/shuttle_area = place
for(var/obj/machinery/computer/shuttle/S in shuttle_area)
if(S.shuttleId == id)
return S
return null
/obj/docking_port/mobile/proc/hyperspace_sound(phase, list/areas)
@@ -785,9 +787,11 @@
/obj/docking_port/mobile/proc/count_engines()
. = 0
for(var/obj/structure/shuttle/engine/E in areaInstance.contents)
if(!QDELETED(E))
. += E.engine_power
for(var/thing in shuttle_areas)
var/area/shuttle/areaInstance = thing
for(var/obj/structure/shuttle/engine/E in areaInstance.contents)
if(!QDELETED(E))
. += E.engine_power
// Double initial engines to get to 0.5 minimum
// Lose all initial engines to get to 2
+21 -15
View File
@@ -41,15 +41,17 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
/obj/docking_port/mobile/supply/canMove()
if(z == ZLEVEL_STATION)
return check_blacklist(areaInstance)
return check_blacklist(shuttle_areas)
return ..()
/obj/docking_port/mobile/supply/proc/check_blacklist(areaInstance)
for(var/trf in areaInstance)
var/turf/T = trf
for(var/a in T.GetAllContents())
if(is_type_in_typecache(a, GLOB.blacklisted_cargo_types))
return FALSE
/obj/docking_port/mobile/supply/proc/check_blacklist(areaInstances)
for(var/place in areaInstances)
var/area/shuttle/shuttle_area = place
for(var/trf in shuttle_area)
var/turf/T = trf
for(var/a in T.GetAllContents())
if(is_type_in_typecache(a, GLOB.blacklisted_cargo_types))
return FALSE
return TRUE
/obj/docking_port/mobile/supply/request()
@@ -70,10 +72,12 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
return
var/list/empty_turfs = list()
for(var/turf/open/floor/T in areaInstance)
if(is_blocked_turf(T))
continue
empty_turfs += T
for(var/place in shuttle_areas)
var/area/shuttle/shuttle_area = place
for(var/turf/open/floor/T in shuttle_area)
if(is_blocked_turf(T))
continue
empty_turfs += T
var/value = 0
var/purchases = 0
@@ -107,10 +111,12 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
var/msg = ""
var/sold_atoms = ""
for(var/atom/movable/AM in areaInstance)
if(AM.anchored && !istype(AM, /obj/mecha))
continue
sold_atoms += export_item_and_contents(AM, contraband, emagged, dry_run = FALSE)
for(var/place in shuttle_areas)
var/area/shuttle/shuttle_area = place
for(var/atom/movable/AM in shuttle_area)
if(AM.anchored)
continue
sold_atoms += export_item_and_contents(AM, contraband, emagged, dry_run = FALSE)
if(sold_atoms)
sold_atoms += "."