mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-23 20:17:15 +01:00
Various fixes upport from chomp (#15794)
* up-port * more upstream commonality
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
var/global/list/datum/pipe_network/pipe_networks = list() // TODO - Move into SSmachines
|
||||
|
||||
/datum/pipe_network
|
||||
var/list/datum/gas_mixture/gases = list() //All of the gas_mixtures continuously connected in this network
|
||||
var/volume = 0 //caches the total volume for atmos machines to use in gas calculations
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
node1 = null
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
node1 = null
|
||||
node2 = null
|
||||
|
||||
. = ..()
|
||||
|
||||
|
||||
@@ -154,17 +154,17 @@ if (!(DATUM.datum_flags & DF_ISPROCESSING)) {\
|
||||
#define STOP_PROCESSING_IN_LIST(DATUM, LIST) LIST.Remove(DATUM);DATUM.datum_flags &= ~DF_ISPROCESSING
|
||||
|
||||
// Note - I would prefer these be defined machines.dm, but some are used prior in file order. ~Leshana
|
||||
#define START_MACHINE_PROCESSING(Datum) START_PROCESSING_IN_LIST(Datum, global.processing_machines)
|
||||
#define STOP_MACHINE_PROCESSING(Datum) STOP_PROCESSING_IN_LIST(Datum, global.processing_machines)
|
||||
#define START_MACHINE_PROCESSING(Datum) START_PROCESSING_IN_LIST(Datum, SSmachines.processing_machines)
|
||||
#define STOP_MACHINE_PROCESSING(Datum) STOP_PROCESSING_IN_LIST(Datum, SSmachines.processing_machines)
|
||||
|
||||
#define START_PROCESSING_PIPENET(Datum) START_PROCESSING_IN_LIST(Datum, global.pipe_networks)
|
||||
#define STOP_PROCESSING_PIPENET(Datum) STOP_PROCESSING_IN_LIST(Datum, global.pipe_networks)
|
||||
#define START_PROCESSING_PIPENET(Datum) START_PROCESSING_IN_LIST(Datum, SSmachines.networks)
|
||||
#define STOP_PROCESSING_PIPENET(Datum) STOP_PROCESSING_IN_LIST(Datum, SSmachines.networks)
|
||||
|
||||
#define START_PROCESSING_POWERNET(Datum) START_PROCESSING_IN_LIST(Datum, global.powernets)
|
||||
#define STOP_PROCESSING_POWERNET(Datum) STOP_PROCESSING_IN_LIST(Datum, global.powernets)
|
||||
#define START_PROCESSING_POWERNET(Datum) START_PROCESSING_IN_LIST(Datum, SSmachines.powernets)
|
||||
#define STOP_PROCESSING_POWERNET(Datum) STOP_PROCESSING_IN_LIST(Datum, SSmachines.powernets)
|
||||
|
||||
#define START_PROCESSING_POWER_OBJECT(Datum) START_PROCESSING_IN_LIST(Datum, global.processing_power_items)
|
||||
#define STOP_PROCESSING_POWER_OBJECT(Datum) STOP_PROCESSING_IN_LIST(Datum, global.processing_power_items)
|
||||
#define START_PROCESSING_POWER_OBJECT(Datum) START_PROCESSING_IN_LIST(Datum, SSmachines.powerobjs)
|
||||
#define STOP_PROCESSING_POWER_OBJECT(Datum) STOP_PROCESSING_IN_LIST(Datum, SSmachines.powerobjs)
|
||||
|
||||
// Computer login types
|
||||
#define LOGIN_TYPE_NORMAL 1
|
||||
|
||||
@@ -102,7 +102,8 @@ start the index of the first element in the range that is not already known to b
|
||||
if(start <= lo)
|
||||
start = lo + 1
|
||||
|
||||
for(,start < hi, ++start)
|
||||
var/list/L = src.L
|
||||
for(start in start to hi - 1)
|
||||
var/pivot = fetchElement(L,start)
|
||||
|
||||
//set left and right to the index where pivot belongs
|
||||
@@ -626,20 +627,17 @@ reverse a descending sequence without violating stability.
|
||||
var/val2 = fetchElement(L,cursor2)
|
||||
|
||||
while(1)
|
||||
if(call(cmp)(val1,val2) < 0)
|
||||
if(call(cmp)(val1,val2) <= 0)
|
||||
if(++cursor1 >= end1)
|
||||
break
|
||||
val1 = fetchElement(L,cursor1)
|
||||
else
|
||||
moveElement(L,cursor2,cursor1)
|
||||
|
||||
++cursor2
|
||||
if(++cursor2 >= end2)
|
||||
break
|
||||
++end1
|
||||
++cursor1
|
||||
//if(++cursor1 >= end1)
|
||||
// break
|
||||
|
||||
val2 = fetchElement(L,cursor2)
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ SUBSYSTEM_DEF(garbage)
|
||||
var/list/queues
|
||||
#ifdef REFERENCE_TRACKING
|
||||
var/list/reference_find_on_fail = list()
|
||||
var/find_reference_on_fail_global_toggle = FALSE
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -23,10 +23,18 @@ SUBSYSTEM_DEF(machines)
|
||||
|
||||
var/list/current_run = list()
|
||||
|
||||
var/list/all_machines = list()
|
||||
|
||||
var/list/networks = list()
|
||||
var/list/processing_machines = list()
|
||||
var/list/powernets = list()
|
||||
var/list/powerobjs = list()
|
||||
|
||||
/datum/controller/subsystem/machines/Initialize(timeofday)
|
||||
makepowernets()
|
||||
admin_notice("<span class='danger'>Initializing atmos machinery.</span>", R_DEBUG)
|
||||
setup_atmos_machinery(global.machines)
|
||||
machines = all_machines //stupid god damn globals
|
||||
setup_atmos_machinery(all_machines)
|
||||
fire()
|
||||
..()
|
||||
|
||||
@@ -83,24 +91,24 @@ SUBSYSTEM_DEF(machines)
|
||||
msg += "PN:[round(cost_powernets,1)]|"
|
||||
msg += "PO:[round(cost_power_objects,1)]"
|
||||
msg += "} "
|
||||
msg += "PI:[global.pipe_networks.len]|"
|
||||
msg += "MC:[global.processing_machines.len]|"
|
||||
msg += "PN:[global.powernets.len]|"
|
||||
msg += "PO:[global.processing_power_items.len]|"
|
||||
msg += "MC/MS:[round((cost ? global.processing_machines.len/cost_machinery : 0),0.1)]"
|
||||
msg += "PI:[SSmachines.networks.len]|"
|
||||
msg += "MC:[SSmachines.processing_machines.len]|"
|
||||
msg += "PN:[SSmachines.powernets.len]|"
|
||||
msg += "PO:[SSmachines.powerobjs.len]|"
|
||||
msg += "MC/MS:[round((cost ? SSmachines.processing_machines.len/cost_machinery : 0),0.1)]"
|
||||
..(jointext(msg, null))
|
||||
|
||||
/datum/controller/subsystem/machines/proc/process_pipenets(resumed = 0)
|
||||
if (!resumed)
|
||||
src.current_run = global.pipe_networks.Copy()
|
||||
src.current_run = networks.Copy()
|
||||
//cache for sanic speed (lists are references anyways)
|
||||
var/wait = src.wait
|
||||
var/list/current_run = src.current_run
|
||||
while(current_run.len)
|
||||
var/datum/pipe_network/PN = current_run[current_run.len]
|
||||
current_run.len--
|
||||
if(QDELETED(PN))
|
||||
global.pipe_networks.Remove(PN)
|
||||
if(!PN)
|
||||
networks.Remove(PN)
|
||||
DISABLE_BITFIELD(PN?.datum_flags, DF_ISPROCESSING)
|
||||
else
|
||||
PN.process(wait)
|
||||
@@ -109,30 +117,30 @@ SUBSYSTEM_DEF(machines)
|
||||
|
||||
/datum/controller/subsystem/machines/proc/process_machinery(resumed = 0)
|
||||
if (!resumed)
|
||||
src.current_run = global.processing_machines.Copy()
|
||||
src.current_run = processing_machines.Copy()
|
||||
|
||||
var/wait = src.wait
|
||||
var/list/current_run = src.current_run
|
||||
while(current_run.len)
|
||||
var/obj/machinery/M = current_run[current_run.len]
|
||||
current_run.len--
|
||||
if(QDELETED(M) || (M.process(wait) == PROCESS_KILL))
|
||||
global.processing_machines.Remove(M)
|
||||
if(!M || (M.process(wait) == PROCESS_KILL))
|
||||
processing_machines.Remove(M)
|
||||
DISABLE_BITFIELD(M?.datum_flags, DF_ISPROCESSING)
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/machines/proc/process_powernets(resumed = 0)
|
||||
if (!resumed)
|
||||
src.current_run = global.powernets.Copy()
|
||||
src.current_run = powernets.Copy()
|
||||
|
||||
var/wait = src.wait
|
||||
var/list/current_run = src.current_run
|
||||
while(current_run.len)
|
||||
var/datum/powernet/PN = current_run[current_run.len]
|
||||
current_run.len--
|
||||
if(QDELETED(PN))
|
||||
global.powernets.Remove(PN)
|
||||
if(!PN)
|
||||
powernets.Remove(PN)
|
||||
DISABLE_BITFIELD(PN?.datum_flags, DF_ISPROCESSING)
|
||||
else
|
||||
PN.reset(wait)
|
||||
@@ -143,36 +151,42 @@ SUBSYSTEM_DEF(machines)
|
||||
// Currently only used by powersinks. These items get priority processed before machinery
|
||||
/datum/controller/subsystem/machines/proc/process_power_objects(resumed = 0)
|
||||
if (!resumed)
|
||||
src.current_run = global.processing_power_items.Copy()
|
||||
src.current_run = powerobjs.Copy()
|
||||
|
||||
var/wait = src.wait
|
||||
var/list/current_run = src.current_run
|
||||
while(current_run.len)
|
||||
var/obj/item/I = current_run[current_run.len]
|
||||
current_run.len--
|
||||
if(QDELETED(I) || (I.pwr_drain(wait) == PROCESS_KILL))
|
||||
global.processing_power_items.Remove(I)
|
||||
if(!I || (I.pwr_drain(wait) == PROCESS_KILL))
|
||||
powerobjs.Remove(I)
|
||||
DISABLE_BITFIELD(I?.datum_flags, DF_ISPROCESSING)
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/machines/Recover()
|
||||
for(var/datum/D as anything in global.pipe_networks)
|
||||
for(var/datum/D as anything in SSmachines.networks)
|
||||
if(!istype(D, /datum/pipe_network))
|
||||
error("Found wrong type during SSmachinery recovery: list=global.pipe_networks, item=[D], type=[D?.type]")
|
||||
global.pipe_networks -= D
|
||||
for(var/datum/D as anything in global.processing_machines)
|
||||
error("Found wrong type during SSmachinery recovery: list=SSmachines.networks, item=[D], type=[D?.type]")
|
||||
SSmachines.networks -= D
|
||||
for(var/datum/D as anything in SSmachines.processing_machines)
|
||||
if(!istype(D, /obj/machinery))
|
||||
error("Found wrong type during SSmachinery recovery: list=global.processing_machines, item=[D], type=[D?.type]")
|
||||
global.processing_machines -= D
|
||||
for(var/datum/D as anything in global.powernets)
|
||||
error("Found wrong type during SSmachinery recovery: list=SSmachines.machines, item=[D], type=[D?.type]")
|
||||
SSmachines.processing_machines -= D
|
||||
for(var/datum/D as anything in SSmachines.powernets)
|
||||
if(!istype(D, /datum/powernet))
|
||||
error("Found wrong type during SSmachinery recovery: list=global.powernets, item=[D], type=[D?.type]")
|
||||
global.powernets -= D
|
||||
for(var/datum/D as anything in global.processing_power_items)
|
||||
error("Found wrong type during SSmachinery recovery: list=SSmachines.powernets, item=[D], type=[D?.type]")
|
||||
SSmachines.powernets -= D
|
||||
for(var/datum/D as anything in SSmachines.powerobjs)
|
||||
if(!istype(D, /obj/item))
|
||||
error("Found wrong type during SSmachinery recovery: list=global.processing_power_items, item=[D], type=[D?.type]")
|
||||
global.processing_power_items -= D
|
||||
error("Found wrong type during SSmachinery recovery: list=SSmachines.powerobjs, item=[D], type=[D?.type]")
|
||||
SSmachines.powerobjs -= D
|
||||
|
||||
all_machines = SSmachines.all_machines
|
||||
networks = SSmachines.networks
|
||||
processing_machines = SSmachines.processing_machines
|
||||
powernets = SSmachines.powernets
|
||||
powerobjs = SSmachines.powerobjs
|
||||
|
||||
#undef SSMACHINES_PIPENETS
|
||||
#undef SSMACHINES_MACHINERY
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#ifdef REFERENCE_TRACKING
|
||||
var/tmp/running_find_references
|
||||
var/tmp/last_find_references = 0
|
||||
var/tmp/find_references_on_destroy = FALSE //set this to true on an item to have it find refs after
|
||||
#ifdef REFERENCE_TRACKING_DEBUG
|
||||
///Stores info about where refs are found, used for sanity checks and testing
|
||||
var/list/found_refs
|
||||
@@ -113,6 +114,14 @@
|
||||
|
||||
tag = null
|
||||
SStgui.close_uis(src)
|
||||
|
||||
#ifdef REFERENCE_TRACKING
|
||||
if(find_references_on_destroy)
|
||||
return QDEL_HINT_FINDREFERENCE
|
||||
if(SSgarbage.find_reference_on_fail_global_toggle)
|
||||
return QDEL_HINT_IFFAIL_FINDREFERENCE
|
||||
#endif
|
||||
|
||||
return QDEL_HINT_QUEUE
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifdef REFERENCE_TRACKING
|
||||
|
||||
/datum/proc/find_references(skip_alert)
|
||||
/datum/proc/find_references(skip_alert = TRUE)
|
||||
running_find_references = type
|
||||
if(usr?.client)
|
||||
if(usr.client.running_find_references)
|
||||
@@ -28,7 +28,11 @@
|
||||
|
||||
//Time to search the whole game for our ref
|
||||
DoSearchVar(GLOB, "GLOB") //globals
|
||||
log_reftracker("Finished searching globals")
|
||||
log_reftracker("Finished searching GLOB")
|
||||
|
||||
for(var/thing in global.vars)
|
||||
DoSearchVar(thing, "Global variable -> [nameof(thing)]", search_time = starting_time)
|
||||
log_reftracker("Finished searching global.vars")
|
||||
|
||||
for(var/datum/thing in world) //atoms (don't beleive its lies)
|
||||
DoSearchVar(thing, "World -> [thing.type]", search_time = starting_time)
|
||||
|
||||
@@ -130,7 +130,7 @@ Class Procs:
|
||||
|
||||
/obj/machinery/Initialize(var/mapload)
|
||||
. = ..()
|
||||
global.machines += src
|
||||
SSmachines.all_machines += src
|
||||
if(ispath(circuit))
|
||||
circuit = new circuit(src)
|
||||
if(!speed_process)
|
||||
@@ -145,7 +145,7 @@ Class Procs:
|
||||
STOP_MACHINE_PROCESSING(src)
|
||||
else
|
||||
STOP_PROCESSING(SSfastprocess, src)
|
||||
global.machines -= src
|
||||
SSmachines.all_machines -= src
|
||||
if(component_parts)
|
||||
for(var/atom/A in component_parts)
|
||||
if(A.loc == src) // If the components are inside the machine, delete them.
|
||||
|
||||
+1
-4
@@ -1,8 +1,7 @@
|
||||
// Items that ask to be called every cycle.
|
||||
var/global/datum/datacore/data_core = null
|
||||
var/global/list/machines = list() // ALL Machines, wether processing or not.
|
||||
var/global/list/processing_machines = list() // TODO - Move into SSmachines
|
||||
var/global/list/processing_power_items = list() // TODO - Move into SSmachines
|
||||
|
||||
var/global/list/active_diseases = list()
|
||||
var/global/list/hud_icon_reference = list()
|
||||
|
||||
@@ -91,8 +90,6 @@ var/list/IClog = list()
|
||||
var/list/OOClog = list()
|
||||
var/list/adminlog = list()
|
||||
|
||||
var/list/powernets = list() // TODO - Move into SSmachines
|
||||
|
||||
var/Debug2 = 0
|
||||
var/datum/debug/debugobj
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
feedback_add_details("admin_verb","CPOW") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
for (var/datum/powernet/PN in powernets)
|
||||
for (var/datum/powernet/PN in SSmachines.powernets)
|
||||
if (!PN.nodes || !PN.nodes.len)
|
||||
if(PN.cables && (PN.cables.len > 1))
|
||||
var/obj/structure/cable/C = PN.cables[1]
|
||||
@@ -57,4 +57,4 @@
|
||||
if (!PN.cables || (PN.cables.len < 10))
|
||||
if(PN.cables && (PN.cables.len > 1))
|
||||
var/obj/structure/cable/C = PN.cables[1]
|
||||
to_chat(usr, "<span class='filter_adminlog'>Powernet with fewer than 10 cables! (number [PN.number]) - example cable at [C.x], [C.y], [C.z] in area [get_area(C.loc)]</span>")
|
||||
to_chat(usr, "<span class='filter_adminlog'>Powernet with fewer than 10 cables! (number [PN.number]) - example cable at [C.x], [C.y], [C.z] in area [get_area(C.loc)]</span>")
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
to_chat(usr, "\[1/5\] - Supermatter depowered")
|
||||
|
||||
// Remove all gases from all pipenets
|
||||
for(var/datum/pipe_network/PN in pipe_networks)
|
||||
for(var/datum/pipe_network/PN in SSmachines.networks)
|
||||
for(var/datum/gas_mixture/G in PN.gases)
|
||||
G.gas = list()
|
||||
G.update_values()
|
||||
@@ -48,4 +48,4 @@
|
||||
SSair.RebootZAS()
|
||||
|
||||
to_chat(usr, "\[5/5\] - ZAS Rebooted")
|
||||
to_world("<span class = 'danger'>Atmosphere restart completed in <b>[(world.timeofday - current_time)/10]</b> seconds.</span>")
|
||||
to_world("<span class = 'danger'>Atmosphere restart completed in <b>[(world.timeofday - current_time)/10]</b> seconds.</span>")
|
||||
|
||||
Reference in New Issue
Block a user