[MIRROR] PURE Code Improvements to the Shuttle Subsystem [MDB IGNORE] (#10609)

* PURE Code Improvements to the Shuttle Subsystem

* modular updates

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-01-12 02:47:57 +00:00
committed by GitHub
co-authored by GoldenAlpharex Gandalf
parent 66f6442476
commit 61ca3472ea
24 changed files with 301 additions and 253 deletions
+1 -1
View File
@@ -58,7 +58,7 @@
data["status"] = "Recharging"
else
data["status"] = "In Transit"
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.port_destinations))
continue
if(!M.check_dock(S, silent = TRUE))
+17 -17
View File
@@ -327,7 +327,7 @@
set_coefficient = 1
else
set_coefficient = 0.5
var/call_time = SSshuttle.emergencyCallTime * set_coefficient * engine_coeff
var/call_time = SSshuttle.emergency_call_time * set_coefficient * engine_coeff
switch(mode)
// The shuttle can not normally be called while "recalling", so
// if this proc is called, it's via admin fiat
@@ -340,30 +340,30 @@
SSshuttle.emergencyCallAmount++
if(prob(70))
SSshuttle.emergencyLastCallLoc = signalOrigin
SSshuttle.emergency_last_call_loc = signalOrigin
else
SSshuttle.emergencyLastCallLoc = null
SSshuttle.emergency_last_call_loc = null
//priority_announce("The emergency shuttle has been called. [redAlert ? "Red Alert state confirmed: Dispatching priority shuttle. " : "" ]It will arrive in [timeLeft(600)] minutes.[reason][SSshuttle.emergencyLastCallLoc ? "\n\nCall signal traced. Results can be viewed on any communications console." : "" ][SSshuttle.adminEmergencyNoRecall ? "\n\nWarning: Shuttle recall subroutines disabled; Recall not possible." : ""]", null, 'sound/ai/shuttlecalled.ogg', "Priority") //ORIGINAL
//SKYRAT EDIT CHANGE BEGIN - AUTOTRANSFER
if(!silent)
priority_announce("The emergency shuttle has been called. [redAlert ? "Red Alert state confirmed: Dispatching priority shuttle. " : "" ]It will arrive in [timeLeft(600)] minutes.[reason][SSshuttle.emergencyLastCallLoc ? "\n\nCall signal traced. Results can be viewed on any communications console." : "" ][SSshuttle.adminEmergencyNoRecall ? "\n\nWarning: Shuttle recall subroutines disabled; Recall not possible." : ""]", null, ANNOUNCER_SHUTTLECALLED, "Priority")
priority_announce("The emergency shuttle has been called. [redAlert ? "Red Alert state confirmed: Dispatching priority shuttle. " : "" ]It will arrive in [timeLeft(600)] minutes.[reason][SSshuttle.emergency_last_call_loc ? "\n\nCall signal traced. Results can be viewed on any communications console." : "" ][SSshuttle.admin_emergency_no_recall ? "\n\nWarning: Shuttle recall subroutines disabled; Recall not possible." : ""]", null, ANNOUNCER_SHUTTLECALLED, "Priority")
//SKYRAT EDIT CHANGE END - AUTOTRANSFER
/obj/docking_port/mobile/emergency/cancel(area/signalOrigin)
if(mode != SHUTTLE_CALL)
return
if(SSshuttle.emergencyNoRecall)
if(SSshuttle.emergency_no_recall)
return
invertTimer()
mode = SHUTTLE_RECALL
if(prob(70))
SSshuttle.emergencyLastCallLoc = signalOrigin
SSshuttle.emergency_last_call_loc = signalOrigin
else
SSshuttle.emergencyLastCallLoc = null
priority_announce("The emergency shuttle has been recalled.[SSshuttle.emergencyLastCallLoc ? " Recall signal traced. Results can be viewed on any communications console." : "" ]", null, ANNOUNCER_SHUTTLERECALLED, "Priority")
SSshuttle.emergency_last_call_loc = null
priority_announce("The emergency shuttle has been recalled.[SSshuttle.emergency_last_call_loc ? " Recall signal traced. Results can be viewed on any communications console." : "" ]", null, ANNOUNCER_SHUTTLERECALLED, "Priority")
SSticker.emergency_reason = null
@@ -450,7 +450,7 @@
setTimer(20)
return
mode = SHUTTLE_DOCKED
setTimer(SSshuttle.emergencyDockTime)
setTimer(SSshuttle.emergency_dock_time)
send2adminchat("Server", "The Emergency Shuttle has docked with the station.")
priority_announce("[SSshuttle.emergency] has docked with the station. You have [timeLeft(600)] minutes to board the Emergency Shuttle.", null, ANNOUNCER_SHUTTLEDOCK, "Priority")
ShuttleDBStuff()
@@ -462,7 +462,7 @@
SSshuttle.checkHostileEnvironment()
if(mode == SHUTTLE_STRANDED)
return
for(var/A in SSshuttle.mobile)
for(var/A in SSshuttle.mobile_docking_ports)
var/obj/docking_port/mobile/M = A
if(M.launch_status == UNLAUNCHED) //Pods will not launch from the mine/planet, and other ships won't launch unless we tell them to.
M.check_transit_zone()
@@ -475,7 +475,7 @@
return
success &= (check_transit_zone() == TRANSIT_READY)
for(var/A in SSshuttle.mobile)
for(var/A in SSshuttle.mobile_docking_ports)
var/obj/docking_port/mobile/M = A
if(M.launch_status == UNLAUNCHED)
success &= (M.check_transit_zone() == TRANSIT_READY)
@@ -489,9 +489,9 @@
areas += E
hyperspace_sound(HYPERSPACE_WARMUP, areas)
if(time_left <= 0 && !SSshuttle.emergencyNoEscape)
if(time_left <= 0 && !SSshuttle.emergency_no_escape)
//move each escape pod (or applicable spaceship) to its corresponding transit dock
for(var/A in SSshuttle.mobile)
for(var/A in SSshuttle.mobile_docking_ports)
var/obj/docking_port/mobile/M = A
M.on_emergency_launch()
@@ -503,7 +503,7 @@
enterTransit()
mode = SHUTTLE_ESCAPE
launch_status = ENDGAME_LAUNCHED
setTimer(SSshuttle.emergencyEscapeTime * engine_coeff)
setTimer(SSshuttle.emergency_escape_time * engine_coeff)
priority_announce("The Emergency Shuttle has left the station. Estimate [timeLeft(600)] minutes until the shuttle docks at Central Command.", null, ANNOUNCER_SHUTTLELEFT, "Priority") //SKYRAT EDIT CHANGE - ANNOUNCER_SHUTTLELEFT
INVOKE_ASYNC(SSticker, /datum/controller/subsystem/ticker.proc/poll_hearts)
bolt_all_doors() //SKYRAT EDIT ADDITION
@@ -528,7 +528,7 @@
break
if(area_parallax)
parallax_slowdown()
for(var/A in SSshuttle.mobile)
for(var/A in SSshuttle.mobile_docking_ports)
var/obj/docking_port/mobile/M = A
if(M.launch_status == ENDGAME_LAUNCHED)
if(istype(M, /obj/docking_port/mobile/pod))
@@ -536,7 +536,7 @@
if(time_left <= 0)
//move each escape pod to its corresponding escape dock
for(var/A in SSshuttle.mobile)
for(var/A in SSshuttle.mobile_docking_ports)
var/obj/docking_port/mobile/M = A
M.on_emergency_dock()
@@ -561,7 +561,7 @@
mode = SHUTTLE_ESCAPE
launch_status = ENDGAME_LAUNCHED
setTimer(SSshuttle.emergencyEscapeTime)
setTimer(SSshuttle.emergency_escape_time)
priority_announce("The Emergency Shuttle is preparing for direct jump. Estimate [timeLeft(600)] minutes until the shuttle docks at Central Command.", null, null, "Priority")
+6 -6
View File
@@ -33,11 +33,11 @@
if(!mapload)
connect_to_shuttle(SSshuttle.get_containing_shuttle(src))
for(var/obj/docking_port/stationary/S as anything in SSshuttle.stationary)
for(var/obj/docking_port/stationary/S as anything in SSshuttle.stationary_docking_ports)
if(S.id == shuttleId)
jumpto_ports[S.id] = TRUE
for(var/V in SSshuttle.stationary)
for(var/V in SSshuttle.stationary_docking_ports)
if(!V)
continue
var/obj/docking_port/stationary/S = V
@@ -355,9 +355,9 @@
playsound(console, 'sound/machines/terminal_prompt_deny.ogg', 25, FALSE)
var/list/L = list()
for(var/V in SSshuttle.stationary)
for(var/V in SSshuttle.stationary_docking_ports)
if(!V)
stack_trace("SSshuttle.stationary have null entry!")
stack_trace("SSshuttle.stationary_docking_ports have null entry!")
continue
var/obj/docking_port/stationary/S = V
if(console.z_lock.len && !(S.z in console.z_lock))
@@ -365,9 +365,9 @@
if(console.jumpto_ports[S.id])
L["([L.len])[S.name]"] = S
for(var/V in SSshuttle.beacons)
for(var/V in SSshuttle.beacon_list)
if(!V)
stack_trace("SSshuttle.beacons have null entry!")
stack_trace("SSshuttle.beacon_list have null entry!")
continue
var/obj/machinery/spaceship_navigation_beacon/nav_beacon = V
if(!nav_beacon.z || SSmapping.level_has_any_trait(nav_beacon.z, console.locked_traits))
+6 -6
View File
@@ -220,7 +220,7 @@
if(!port_destinations)
port_destinations = id
SSshuttle.stationary += src
SSshuttle.stationary_docking_ports += src
/obj/docking_port/stationary/Initialize(mapload)
. = ..()
@@ -239,7 +239,7 @@
/obj/docking_port/stationary/unregister()
. = ..()
SSshuttle.stationary -= src
SSshuttle.stationary_docking_ports -= src
/obj/docking_port/stationary/Destroy(force)
if(force)
@@ -281,13 +281,13 @@
/obj/docking_port/stationary/transit/Initialize(mapload)
. = ..()
SSshuttle.transit += src
SSshuttle.transit_docking_ports += src
/obj/docking_port/stationary/transit/Destroy(force=FALSE)
if(force)
if(get_docked())
log_world("A transit dock was destroyed while something was docked to it.")
SSshuttle.transit -= src
SSshuttle.transit_docking_ports -= src
if(owner)
if(owner.assigned_transit == src)
owner.assigned_transit = null
@@ -390,11 +390,11 @@
else
SSshuttle.assoc_mobile[id] = 1
SSshuttle.mobile += src
SSshuttle.mobile_docking_ports += src
/obj/docking_port/mobile/unregister()
. = ..()
SSshuttle.mobile -= src
SSshuttle.mobile_docking_ports -= src
/obj/docking_port/mobile/Destroy(force)
if(force)
@@ -20,13 +20,13 @@
/obj/machinery/spaceship_navigation_beacon/Initialize(mapload)
. = ..()
SSshuttle.beacons |= src
SSshuttle.beacon_list |= src
/obj/machinery/spaceship_navigation_beacon/emp_act()
locked = TRUE
/obj/machinery/spaceship_navigation_beacon/Destroy()
SSshuttle.beacons -= src
SSshuttle.beacon_list -= src
return ..()
// update the icon_state
+4 -4
View File
@@ -116,14 +116,14 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
new item.item_instance.type(grocery_crate)
SSshuttle.chef_groceries.Cut() //This lets the console know it can order another round.
if(!SSshuttle.shoppinglist.len)
if(!SSshuttle.shopping_list.len)
return
var/value = 0
var/purchases = 0
var/list/goodies_by_buyer = list() // if someone orders more than GOODY_FREE_SHIPPING_MAX goodies, we upcharge to a normal crate so they can't carry around 20 combat shotties
for(var/datum/supply_order/spawning_order in SSshuttle.shoppinglist)
for(var/datum/supply_order/spawning_order in SSshuttle.shopping_list)
if(!empty_turfs.len)
break
var/price = spawning_order.pack.get_cost()
@@ -159,8 +159,8 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
var/datum/bank_account/department/cargo = SSeconomy.get_dep_account(ACCOUNT_CAR)
cargo.adjust_money(price - spawning_order.pack.get_cost()) //Cargo gets the handling fee
value += spawning_order.pack.get_cost()
SSshuttle.shoppinglist -= spawning_order
SSshuttle.orderhistory += spawning_order
SSshuttle.shopping_list -= spawning_order
SSshuttle.order_history += spawning_order
QDEL_NULL(spawning_order.applied_coupon)
if(!spawning_order.pack.goody) //we handle goody crates below