diff --git a/_maps/RandomRuins/SpaceRuins/forgottenship.dmm b/_maps/RandomRuins/SpaceRuins/forgottenship.dmm
index 0ac1697b8e2..3fb2848af76 100644
--- a/_maps/RandomRuins/SpaceRuins/forgottenship.dmm
+++ b/_maps/RandomRuins/SpaceRuins/forgottenship.dmm
@@ -418,7 +418,6 @@
/obj/machinery/mineral/ore_redemption{
name = "Syndicate ore redemption machine";
ore_multiplier = 4;
- ore_pickup_rate = 20;
req_access = list(150)
},
/turf/open/floor/mineral/plastitanium,
diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm
index 40e4ebca05c..4633d180150 100644
--- a/code/__DEFINES/dcs/signals.dm
+++ b/code/__DEFINES/dcs/signals.dm
@@ -47,6 +47,7 @@
#define COMSIG_ELEMENT_DETACH "element_detach"
// /atom signals
+#define COMSIG_ATOM_CREATED "atom_created" ///from base of atom/proc/Initialize(): sent any time a new atom is created
#define COMSIG_PARENT_ATTACKBY "atom_attackby" ///from base of atom/attackby(): (/obj/item, /mob/living, params)
#define COMPONENT_NO_AFTERATTACK 1 //Return this in response if you don't want afterattack to be called
#define COMSIG_ATOM_HULK_ATTACK "hulk_attack" ///from base of atom/attack_hulk(): (/mob/living/carbon/human)
diff --git a/code/__DEFINES/machines.dm b/code/__DEFINES/machines.dm
index 71ea98f9f0d..896c4812b30 100644
--- a/code/__DEFINES/machines.dm
+++ b/code/__DEFINES/machines.dm
@@ -12,6 +12,9 @@
#define IDLE_POWER_USE 1
#define ACTIVE_POWER_USE 2
+/// Bitflags for a machine's preferences on when it should start processing. For use with machinery's `processing_flags` var.
+#define START_PROCESSING_ON_INIT (1<<0) /// Indicates the machine will automatically start processing right after it's `Initialize()` is ran.
+#define START_PROCESSING_MANUALLY (1<<1) /// Machines with this flag will not start processing when it's spawned. Use this if you want to manually control when a machine starts processing.
//bitflags for door switches.
#define OPEN (1<<0)
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 931dcd249e2..bfa12cfe673 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -149,6 +149,9 @@
stack_trace("Warning: [src]([type]) initialized multiple times!")
flags_1 |= INITIALIZED_1
+ if(loc)
+ SEND_SIGNAL(loc, COMSIG_ATOM_CREATED, src) /// Sends a signal that the new atom `src`, has been created at `loc`
+
//atom color stuff
if(color)
add_atom_colour(color, FIXED_COLOUR_PRIORITY)
diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm
index 0e08ce802b9..84e623360e0 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -113,7 +113,10 @@ Class Procs:
var/critical_machine = FALSE //If this machine is critical to station operation and should have the area be excempted from power failures.
var/list/occupant_typecache //if set, turned into typecache in Initialize, other wise, defaults to mob/living typecache
var/atom/movable/occupant = null
- var/speed_process = FALSE // Process as fast as possible?
+ /// Viable flags to go here are START_PROCESSING_ON_INIT, or START_PROCESSING_MANUALLY. See code\__DEFINES\machines.dm for more information on these flags.
+ var/processing_flags = START_PROCESSING_ON_INIT
+ /// What subsystem this machine will use, which is generally SSmachines or SSfastprocess. By default all machinery use SSmachines. This fires a machine's process() roughly every 2 seconds.
+ var/subsystem_type = /datum/controller/subsystem/machines
var/obj/item/circuitboard/circuit // Circuit to be created and inserted when the machinery is created
var/interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON | INTERACT_MACHINE_SET_MACHINE
@@ -137,16 +140,24 @@ Class Procs:
circuit = new circuit
circuit.apply_default_parts(src)
- if(!speed_process)
- START_PROCESSING(SSmachines, src)
- else
- START_PROCESSING(SSfastprocess, src)
+ if(processing_flags & START_PROCESSING_ON_INIT)
+ begin_processing()
- if (occupant_typecache)
+ if(occupant_typecache)
occupant_typecache = typecacheof(occupant_typecache)
return INITIALIZE_HINT_LATELOAD
+/// Helper proc for telling a machine to start processing with the subsystem type that is located in its `subsystem_type` var.
+/obj/machinery/proc/begin_processing()
+ var/datum/controller/subsystem/processing/subsystem = locate(subsystem_type) in Master.subsystems
+ START_PROCESSING(subsystem, src)
+
+/// Helper proc for telling a machine to stop processing with the subsystem type that is located in its `subsystem_type` var.
+/obj/machinery/proc/end_processing()
+ var/datum/controller/subsystem/processing/subsystem = locate(subsystem_type) in Master.subsystems
+ STOP_PROCESSING(subsystem, src)
+
/obj/machinery/LateInitialize()
. = ..()
power_change()
@@ -154,10 +165,7 @@ Class Procs:
/obj/machinery/Destroy()
GLOB.machines.Remove(src)
- if(!speed_process)
- STOP_PROCESSING(SSmachines, src)
- else
- STOP_PROCESSING(SSfastprocess, src)
+ end_processing()
dropContents()
if(length(component_parts))
for(var/atom/A in component_parts)
diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm
index 545e2d9ab63..c7b921b6b76 100644
--- a/code/game/machinery/syndicatebomb.dm
+++ b/code/game/machinery/syndicatebomb.dm
@@ -11,7 +11,8 @@
density = FALSE
layer = BELOW_MOB_LAYER //so people can't hide it and it's REALLY OBVIOUS
resistance_flags = FIRE_PROOF | ACID_PROOF
- speed_process = TRUE
+ processing_flags = START_PROCESSING_MANUALLY
+ subsystem_type = /datum/controller/subsystem/processing/fastprocess
interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_OFFLINE
@@ -48,7 +49,7 @@
/obj/machinery/syndicatebomb/process()
if(!active)
- STOP_PROCESSING(SSfastprocess, src)
+ end_processing()
detonation_timer = null
next_beep = null
countdown.stop()
@@ -87,12 +88,12 @@
payload = new payload(src)
update_icon()
countdown = new(src)
- STOP_PROCESSING(SSfastprocess, src)
+ end_processing()
/obj/machinery/syndicatebomb/Destroy()
QDEL_NULL(wires)
QDEL_NULL(countdown)
- STOP_PROCESSING(SSfastprocess, src)
+ end_processing()
return ..()
/obj/machinery/syndicatebomb/examine(mob/user)
@@ -183,7 +184,7 @@
/obj/machinery/syndicatebomb/proc/activate()
active = TRUE
- START_PROCESSING(SSfastprocess, src)
+ begin_processing()
countdown.start()
next_beep = world.time + 10
detonation_timer = world.time + (timer_set * 10)
diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm
index 78bc44263bc..97d441b2d47 100644
--- a/code/modules/mining/machine_processing.dm
+++ b/code/modules/mining/machine_processing.dm
@@ -3,9 +3,47 @@
/**********************Mineral processing unit console**************************/
/obj/machinery/mineral
+ processing_flags = START_PROCESSING_MANUALLY
+ subsystem_type = /datum/controller/subsystem/processing/fastprocess
+ /// The current direction of `input_turf`, in relation to the machine.
var/input_dir = NORTH
+ /// The current direction, in relation to the machine, that items will be output to.
var/output_dir = SOUTH
+ /// The turf the machines listens to for items to pick up. Calls the `pickup_item()` proc.
+ var/turf/input_turf = null
+ /// Determines if this machine needs to pick up items. Used to avoid registering signals to `/mineral` machines that don't pickup items.
+ var/needs_item_input = FALSE
+/obj/machinery/mineral/Initialize(mapload)
+ . = ..()
+ if(needs_item_input)
+ register_input_turf()
+
+/// Gets the turf in the `input_dir` direction adjacent to the machine, and registers signals for ATOM_ENTERED and ATOM_CREATED. Calls the `pickup_item()` proc when it recieves these signals.
+/obj/machinery/mineral/proc/register_input_turf()
+ input_turf = get_step(src, input_dir)
+ if(input_turf) // make sure there is actually a turf
+ RegisterSignal(input_turf, list(COMSIG_ATOM_CREATED, COMSIG_ATOM_ENTERED), .proc/pickup_item)
+
+/// Unregisters signals that are registered the machine's input turf, if it has one.
+/obj/machinery/mineral/proc/unregister_input_turf()
+ if(input_turf)
+ UnregisterSignal(input_turf, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_CREATED))
+
+/**
+ Base proc for all `/mineral` subtype machines to use. Place your item pickup behavior in this proc when you override it for your specific machine.
+
+ Called when the COMSIG_ATOM_ENTERED and COMSIG_ATOM_CREATED signals are sent.
+
+ Arguments:
+ * source - the turf that is listening for the signals.
+ * target - the atom that just moved onto the `source` turf.
+ * oldLoc - the old location that `target` was at before moving onto `source`.
+*/
+/obj/machinery/mineral/proc/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
+ return
+
+/// Generic unloading proc. Takes an atom as an argument and forceMove's it to the turf adjacent to this machine in the `output_dir` direction.
/obj/machinery/mineral/proc/unload_mineral(atom/movable/S)
S.forceMove(drop_location())
var/turf/T = get_step(src,output_dir)
@@ -19,7 +57,6 @@
density = TRUE
var/obj/machinery/mineral/processing_unit/machine = null
var/machinedir = EAST
- speed_process = TRUE
/obj/machinery/mineral/processing_unit_console/Initialize()
. = ..()
@@ -58,6 +95,7 @@
if(href_list["set_on"])
machine.on = (href_list["set_on"] == "on")
+ machine.begin_processing()
updateUsrDialog()
return
@@ -75,6 +113,7 @@
icon = 'icons/obj/machines/mining_machines.dmi'
icon_state = "furnace"
density = TRUE
+ needs_item_input = TRUE
var/obj/machinery/mineral/CONSOLE = null
var/on = FALSE
var/datum/material/selected_material = null
@@ -93,10 +132,6 @@
QDEL_NULL(stored_research)
return ..()
-/obj/machinery/mineral/processing_unit/HasProximity(atom/movable/AM)
- if(istype(AM, /obj/item/stack/ore) && AM.loc == get_step(src, input_dir))
- process_ore(AM)
-
/obj/machinery/mineral/processing_unit/proc/process_ore(obj/item/stack/ore/O)
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
var/material_amount = materials.get_item_material_amount(O)
@@ -142,8 +177,12 @@
return dat
+/obj/machinery/mineral/processing_unit/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
+ if(istype(target, /obj/item/stack/ore))
+ process_ore(target)
+
/obj/machinery/mineral/processing_unit/process()
- if (on)
+ if(on)
if(selected_material)
smelt_ore()
@@ -153,6 +192,8 @@
if(CONSOLE)
CONSOLE.updateUsrDialog()
+ else
+ end_processing()
/obj/machinery/mineral/processing_unit/proc/smelt_ore()
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm
index cafc8b13379..731826bf4bc 100644
--- a/code/modules/mining/machine_redemption.dm
+++ b/code/modules/mining/machine_redemption.dm
@@ -10,19 +10,19 @@
input_dir = NORTH
output_dir = SOUTH
req_access = list(ACCESS_MINERAL_STOREROOM)
- speed_process = TRUE
layer = BELOW_OBJ_LAYER
circuit = /obj/item/circuitboard/machine/ore_redemption
ui_x = 440
ui_y = 550
+ needs_item_input = TRUE
+ processing_flags = START_PROCESSING_MANUALLY
var/points = 0
- var/ore_pickup_rate = 15
var/ore_multiplier = 1
var/point_upgrade = 1
var/list/ore_values = list(/datum/material/iron = 1, /datum/material/glass = 1, /datum/material/plasma = 15, /datum/material/silver = 16, /datum/material/gold = 18, /datum/material/titanium = 30, /datum/material/uranium = 30, /datum/material/diamond = 50, /datum/material/bluespace = 50, /datum/material/bananium = 60)
- var/message_sent = FALSE
- var/list/ore_buffer = list()
+ /// Variable that holds a timer which is used for callbacks to `send_console_message()`. Used for preventing multiple calls to this proc while the ORM is eating a stack of ores.
+ var/console_notify_timer
var/datum/techweb/stored_research
var/obj/item/disk/design_disk/inserted_disk
var/datum/component/remote_materials/materials
@@ -38,23 +38,19 @@
return ..()
/obj/machinery/mineral/ore_redemption/RefreshParts()
- var/ore_pickup_rate_temp = 15
var/point_upgrade_temp = 1
var/ore_multiplier_temp = 1
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
ore_multiplier_temp = 0.65 + (0.35 * B.rating)
- for(var/obj/item/stock_parts/manipulator/M in component_parts)
- ore_pickup_rate_temp = 15 * M.rating
for(var/obj/item/stock_parts/micro_laser/L in component_parts)
point_upgrade_temp = 0.65 + (0.35 * L.rating)
- ore_pickup_rate = ore_pickup_rate_temp
point_upgrade = point_upgrade_temp
ore_multiplier = round(ore_multiplier_temp, 0.01)
/obj/machinery/mineral/ore_redemption/examine(mob/user)
. = ..()
if(in_range(user, src) || isobserver(user))
- . += "The status display reads: Smelting [ore_multiplier] sheet(s) per piece of ore.
Reward point generation at [point_upgrade*100]%.
Ore pickup speed at [ore_pickup_rate]."
+ . += "The status display reads: Smelting [ore_multiplier] sheet(s) per piece of ore.
Reward point generation at [point_upgrade*100]%."
if(panel_open)
. += "Alt-click to rotate the input and output direction."
@@ -66,8 +62,6 @@
if(O.refined_type == null)
return
- ore_buffer -= O
-
if(O && O.refined_type)
points += O.points * point_upgrade * O.amount
@@ -113,17 +107,15 @@
return build_amount
/obj/machinery/mineral/ore_redemption/proc/process_ores(list/ores_to_process)
- var/current_amount = 0
for(var/ore in ores_to_process)
- if(current_amount >= ore_pickup_rate)
- break
smelt_ore(ore)
/obj/machinery/mineral/ore_redemption/proc/send_console_message()
var/datum/component/material_container/mat_container = materials.mat_container
if(!mat_container || !is_station_level(z))
return
- message_sent = TRUE
+
+ console_notify_timer = null
var/area/A = get_area(src)
var/msg = "Now available in [A]:
"
@@ -149,26 +141,29 @@
))
signal.send_to_receivers()
-/obj/machinery/mineral/ore_redemption/process()
+/obj/machinery/mineral/ore_redemption/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
if(!materials.mat_container || panel_open || !powered())
return
- var/atom/input = get_step(src, input_dir)
- var/obj/structure/ore_box/OB = locate() in input
- if(OB)
- input = OB
- for(var/obj/item/stack/ore/O in input)
- if(QDELETED(O))
- continue
- ore_buffer |= O
- O.forceMove(src)
- CHECK_TICK
+ if(istype(target, /obj/structure/ore_box))
+ var/obj/structure/ore_box/box = target
+ process_ores(box.contents)
+ else if(istype(target, /obj/item/stack/ore))
+ var/obj/item/stack/ore/O = target
+ smelt_ore(O)
+ else
+ return
- if(LAZYLEN(ore_buffer))
- message_sent = FALSE
- process_ores(ore_buffer)
- else if(!message_sent)
- send_console_message()
+ if(!console_notify_timer)
+ // gives 5 seconds for a load of ores to be sucked up by the ORM before it sends out request console notifications. This should be enough time for most deposits that people make
+ console_notify_timer = addtimer(CALLBACK(src, .proc/send_console_message), 5 SECONDS)
+
+/obj/machinery/mineral/ore_redemption/default_unfasten_wrench(mob/user, obj/item/I)
+ . = ..()
+ if(anchored)
+ register_input_turf() // someone just wrenched us down, re-register the turf
+ else
+ unregister_input_turf() // someone just un-wrenched us, unregister the turf
/obj/machinery/mineral/ore_redemption/attackby(obj/item/W, mob/user, params)
if(default_unfasten_wrench(user, W))
@@ -199,10 +194,12 @@
. = ..()
if(!user.canUseTopic(src, BE_CLOSE))
return
- if (panel_open)
+ if(panel_open)
input_dir = turn(input_dir, -90)
output_dir = turn(output_dir, -90)
to_chat(user, "You change [src]'s I/O settings, setting the input to [dir2text(input_dir)] and the output to [dir2text(output_dir)].")
+ unregister_input_turf() // someone just rotated the input and output directions, unregister the old turf
+ register_input_turf() // register the new one
return TRUE
/obj/machinery/mineral/ore_redemption/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
diff --git a/code/modules/mining/machine_unloading.dm b/code/modules/mining/machine_unloading.dm
index 900e49a4752..92a81871ce8 100644
--- a/code/modules/mining/machine_unloading.dm
+++ b/code/modules/mining/machine_unloading.dm
@@ -8,24 +8,14 @@
density = TRUE
input_dir = WEST
output_dir = EAST
- speed_process = TRUE
+ needs_item_input = TRUE
+ processing_flags = START_PROCESSING_MANUALLY
-/obj/machinery/mineral/unloading_machine/process()
- var/turf/T = get_step(src,input_dir)
- if(T)
- var/limit
- for(var/obj/structure/ore_box/B in T)
- for (var/obj/item/stack/ore/O in B)
- B.contents -= O
- unload_mineral(O)
- limit++
- if (limit>=10)
- return
- CHECK_TICK
- CHECK_TICK
- for(var/obj/item/I in T)
- unload_mineral(I)
- limit++
- if (limit>=10)
- return
- CHECK_TICK
+/obj/machinery/mineral/unloading_machine/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
+ if(istype(target, /obj/structure/ore_box))
+ var/obj/structure/ore_box/box = target
+ for(var/obj/item/stack/ore/O in box)
+ unload_mineral(O)
+ else if(istype(target, /obj/item/stack/ore))
+ var/obj/item/stack/ore/O = target
+ unload_mineral(O)
diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm
index c01d5f2d7c6..a396979f415 100644
--- a/code/modules/mining/mint.dm
+++ b/code/modules/mining/mint.dm
@@ -9,6 +9,7 @@
input_dir = EAST
ui_x = 300
ui_y = 250
+ needs_item_input = TRUE
var/produced_coins = 0 // how many coins the machine has made in it's last cycle
var/processing = FALSE
@@ -34,16 +35,19 @@
chosen = SSmaterials.GetMaterialRef(chosen)
-/obj/machinery/mineral/mint/process()
- var/turf/T = get_step(src, input_dir)
+/obj/machinery/mineral/mint/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
+ if(!istype(target, /obj/item/stack))
+ return
+
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
+ var/obj/item/stack/S = target
- for(var/obj/item/stack/O in T)
- var/inserted = materials.insert_item(O)
- if(inserted)
- qdel(O)
+ if(materials.insert_item(S))
+ qdel(S)
+/obj/machinery/mineral/mint/process()
if(processing)
+ var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
var/datum/material/M = chosen
if(!M)
@@ -71,6 +75,7 @@
if(!found_new)
processing = FALSE
else
+ end_processing()
icon_state = "coinpress0"
/obj/machinery/mineral/mint/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
@@ -114,8 +119,10 @@
if (!processing)
produced_coins = 0
processing = TRUE
+ begin_processing()
if ("stoppress")
processing = FALSE
+ end_processing()
if ("changematerial")
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
for(var/datum/material/mat in materials.materials)
diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm
index 8c53749b9aa..d7e70c7c953 100644
--- a/code/modules/recycling/conveyor2.dm
+++ b/code/modules/recycling/conveyor2.dm
@@ -9,6 +9,8 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
name = "conveyor belt"
desc = "A conveyor belt."
layer = BELOW_OPEN_DOOR_LAYER
+ processing_flags = START_PROCESSING_MANUALLY
+ subsystem_type = /datum/controller/subsystem/processing/fastprocess
var/operating = 0 // 1 if running forward, -1 if backwards, 0 if off
var/operable = 1 // true if can operate (no broken segments in this belt run)
var/forwards // this is the default (forward) direction, set by the map dir
@@ -18,7 +20,6 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
var/list/affecting // the list of all items that will be moved this ptick
var/id = "" // the control ID - must match controller ID
var/verted = 1 // Inverts the direction the conveyor belt moves.
- speed_process = TRUE
var/conveying = FALSE
/obj/machinery/conveyor/centcom_auto
@@ -123,25 +124,28 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
return FALSE
return TRUE
- // machine process
- // move items to the target location
+// machine process
+// move items to the target location
/obj/machinery/conveyor/process()
if(machine_stat & (BROKEN | NOPOWER))
return
+
//If the conveyor is broken or already moving items
if(!operating || conveying)
return
+
use_power(6)
+
//get the first 30 items in contents
affecting = list()
var/i = 0
- for(var/item in loc.contents)
- if(item == src)
- continue
+ var/list/items = loc.contents - src
+ for(var/item in items)
i++ // we're sure it's a real target to move at this point
if(i >= MAX_CONVEYOR_ITEMS_MOVE)
break
affecting.Add(item)
+
conveying = TRUE
addtimer(CALLBACK(src, .proc/convey, affecting), 1)
@@ -231,11 +235,10 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
desc = "A conveyor control switch."
icon = 'icons/obj/recycling.dmi'
icon_state = "switch-off"
- speed_process = TRUE
+ processing_flags = START_PROCESSING_MANUALLY
var/position = 0 // 0 off, -1 reverse, 1 forward
var/last_pos = -1 // last direction setting
- var/operated = 1 // true if just operated
var/oneway = FALSE // if the switch only operates the conveyor belts in a single direction.
var/invert_icon = FALSE // If the level points the opposite direction when it's turned on.
@@ -277,24 +280,28 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
else
icon_state = "switch-off"
-
-// timed process
-// if the switch changed, update the linked conveyors
-
-/obj/machinery/conveyor_switch/process()
- if(!operated)
- return
- operated = 0
-
+/// Updates all conveyor belts that are linked to this switch, and tells them to start processing.
+/obj/machinery/conveyor_switch/proc/update_linked_conveyors()
for(var/obj/machinery/conveyor/C in GLOB.conveyors_by_id[id])
C.operating = position
C.update_move_direction()
C.update_icon()
+ if(C.operating)
+ C.begin_processing()
+ else
+ C.end_processing()
CHECK_TICK
-// attack with hand, switch position
-/obj/machinery/conveyor_switch/interact(mob/user)
- add_fingerprint(user)
+/// Finds any switches with same `id` as this one, and set their position and icon to match us.
+/obj/machinery/conveyor_switch/proc/update_linked_switches()
+ for(var/obj/machinery/conveyor_switch/S in GLOB.conveyors_by_id[id])
+ S.invert_icon = invert_icon
+ S.position = position
+ S.update_icon()
+ CHECK_TICK
+
+/// Updates the switch's `position` and `last_pos` variable. Useful so that the switch can properly cycle between the forwards, backwards and neutral positions.
+/obj/machinery/conveyor_switch/proc/update_position()
if(position == 0)
if(oneway) //is it a oneway switch
position = oneway
@@ -309,15 +316,14 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
last_pos = position
position = 0
- operated = 1
+/// Called when a user clicks on this switch with an open hand.
+/obj/machinery/conveyor_switch/interact(mob/user)
+ add_fingerprint(user)
+ update_position()
update_icon()
+ update_linked_conveyors()
+ update_linked_switches()
- // find any switches with same id as this one, and set their positions to match us
- for(var/obj/machinery/conveyor_switch/S in GLOB.conveyors_by_id[id])
- S.invert_icon = invert_icon
- S.position = position
- S.update_icon()
- CHECK_TICK
/obj/machinery/conveyor_switch/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_CROWBAR)
diff --git a/code/modules/station_goals/shield.dm b/code/modules/station_goals/shield.dm
index 7828065aeb7..a809b1d68a7 100644
--- a/code/modules/station_goals/shield.dm
+++ b/code/modules/station_goals/shield.dm
@@ -114,9 +114,11 @@
to_chat(user, "You [active ? "deactivate": "activate"] [src].")
active = !active
if(active)
+ begin_processing()
animate(src, pixel_y = 2, time = 10, loop = -1)
anchored = TRUE
else
+ end_processing()
animate(src, pixel_y = 0, time = 10)
anchored = FALSE
update_icon()
@@ -133,7 +135,8 @@
name = "\improper Meteor Shield Satellite"
desc = "A meteor point-defense satellite."
mode = "M-SHIELD"
- speed_process = TRUE
+ processing_flags = START_PROCESSING_MANUALLY
+ subsystem_type = /datum/controller/subsystem/processing/fastprocess
var/kill_range = 14
/obj/machinery/satellite/meteor_shield/proc/space_los(meteor)