Transformed the machinery processor into an StonedMC subsystem

* This is PHASE 1 of a multi-phase conversion.  In this first phase we implement the subsystem, but leave it processing the existing global list variables.  In the next phase we will switch to use datum variables in the subsystem.  The main reason for splitting into two phases is ease of code review; change the meaningful code without the hundreds of machines -> SSmachines.machinery substitutions.
* We did declare macros for adding/removing things to the processing lists, and convert everywhere to use the macros.
* Added var/is_processing to /datum to keep track of whether an instance is already in a processing list (prevents it being in the list twice!) and also debugging, making sure its not in two lists etc.
* NOTE: The global machines list is **no longer sorted** for performance reasons.  As far as I know, the only module that actually ever cared was cameras.   Our camera system already handles its own sorting in the cameranets anyway, so it should no longer be needed.
This commit is contained in:
Leshana
2017-12-29 15:31:59 -05:00
parent 66e9d9cfdf
commit a97a574278
16 changed files with 237 additions and 35 deletions
+4 -4
View File
@@ -26,7 +26,7 @@
/obj/item/device/powersink/Destroy()
processing_objects.Remove(src)
processing_power_items.Remove(src)
STOP_PROCESSING_POWER_OBJECT(src)
..()
/obj/item/device/powersink/attackby(var/obj/item/I, var/mob/user)
@@ -50,7 +50,7 @@
else
if (mode == 2)
processing_objects.Remove(src) // Now the power sink actually stops draining the station's power if you unhook it. --NeoFite
processing_power_items.Remove(src)
STOP_PROCESSING_POWER_OBJECT(src)
anchored = 0
mode = 0
src.visible_message("<span class='notice'>[user] detaches [src] from the cable!</span>")
@@ -74,14 +74,14 @@
mode = 2
icon_state = "powersink1"
processing_objects.Add(src)
processing_power_items.Add(src)
START_PROCESSING_POWER_OBJECT(src)
if(2) //This switch option wasn't originally included. It exists now. --NeoFite
src.visible_message("<span class='notice'>[user] deactivates [src]!</span>")
mode = 1
set_light(0)
icon_state = "powersink0"
processing_objects.Remove(src)
processing_power_items.Remove(src)
STOP_PROCESSING_POWER_OBJECT(src)
/obj/item/device/powersink/pwr_drain()
if(!attached)