Skip to content

Commit

Permalink
Foam and Conveyor Belts now process as fast as possible, Adds the Fas…
Browse files Browse the repository at this point in the history
…t Process subsystem
  • Loading branch information
AndrewJacksonThe2nd committed Mar 25, 2016
1 parent f56eedb commit f54132e
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 13 deletions.
36 changes: 36 additions & 0 deletions code/controllers/subsystem/fastprocess.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
var/datum/subsystem/fastprocess/SSfastprocess

/datum/subsystem/fastprocess
name = "Fast Process"
priority = -1
wait = 1
dynamic_wait = 1
dwait_upper = 300
dwait_lower = 1
dwait_delta = 7

var/list/processing = list()
var/list/currentrun = list()

/datum/subsystem/fastprocess/New()
NEW_SS_GLOBAL(SSfastprocess)

/datum/subsystem/fastprocess/stat_entry()
..("FP:[processing.len]")


/datum/subsystem/fastprocess/fire(resumed = 0)
if (!resumed)
src.currentrun = processing.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun

while(currentrun.len)
var/datum/thing = currentrun[1]
currentrun.Cut(1, 2)
if(thing)
thing.process(wait)
else
SSobj.processing.Remove(thing)
if (MC_TICK_CHECK)
return
11 changes: 9 additions & 2 deletions code/game/machinery/machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,23 @@ Class Procs:
var/unsecuring_tool = /obj/item/weapon/wrench
var/interact_open = 0 // Can the machine be interacted with when in maint/when the panel is open.
var/interact_offline = 0 // Can the machine be interacted with while de-powered.
var/speed_process = 0 // Process as fast as possible?

/obj/machinery/New()
..()
machines += src
SSmachine.processing += src
if(!speed_process)
SSmachine.processing += src
else
SSfastprocess.processing += src
power_change()

/obj/machinery/Destroy()
machines.Remove(src)
SSmachine.processing -= src
if(!speed_process)
SSmachine.processing -= src
else
SSfastprocess.processing -= src
dropContents()
return ..()

Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/effects/effect_system/effects_foam.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
/obj/effect/particle_effect/foam/New(loc)
..(loc)
create_reagents(1000) //limited by the size of the reagent holder anyway.
SSobj.processing |= src
SSfastprocess.processing |= src
playsound(src, 'sound/effects/bubbles2.ogg', 80, 1, -3)

/obj/effect/particle_effect/foam/Destroy()
SSobj.processing.Remove(src)
SSfastprocess.processing.Remove(src)
return ..()


/obj/effect/particle_effect/foam/proc/kill_foam()
SSobj.processing.Remove(src)
SSfastprocess.processing.Remove(src)
if(metal)
var/obj/structure/foamedmetal/M = new(src.loc)
M.metal = metal
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/items/weapons/grenades/clusterbuster.dm
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,7 @@
/obj/item/weapon/grenade/clusterbuster/soap
name = "Slipocalypse"
payload = /obj/item/weapon/grenade/spawnergrenade/syndiesoap

/obj/item/weapon/grenade/clusterbuster/clf3
name = "WELCOME TO HELL"
payload = /obj/item/weapon/grenade/chem_grenade/clf3
1 change: 1 addition & 0 deletions code/modules/mining/equipment_locker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
var/sheet_per_ore = 1
var/point_upgrade = 1
var/list/ore_values = list(("sand" = 1), ("iron" = 1), ("plasma" = 15), ("silver" = 16), ("gold" = 18), ("uranium" = 30), ("diamond" = 50), ("bananium" = 60))
speed_process = 1

/obj/machinery/mineral/ore_redemption/New()
..()
Expand Down
1 change: 1 addition & 0 deletions code/modules/mining/machine_processing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
anchored = 1
var/obj/machinery/mineral/processing_unit/machine = null
var/machinedir = EAST
speed_process = 1

/obj/machinery/mineral/processing_unit_console/New()
..()
Expand Down
1 change: 1 addition & 0 deletions code/modules/mining/machine_stacking.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
anchored = 1
var/obj/machinery/mineral/stacking_machine/machine = null
var/machinedir = SOUTHEAST
speed_process = 1

/obj/machinery/mineral/stacking_unit_console/New()
..()
Expand Down
6 changes: 5 additions & 1 deletion code/modules/mining/machine_unloading.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
anchored = 1
input_dir = WEST
output_dir = EAST
speed_process = 1

/obj/machinery/mineral/unloading_machine/process()
var/turf/T = get_step(src,input_dir)
Expand All @@ -21,8 +22,11 @@
limit++
if (limit>=10)
return
CHECK_TICK
CHECK_TICK
for(var/obj/item/I in T)
unload_mineral(I)
limit++
if (limit>=10)
return
return
CHECK_TICK
1 change: 1 addition & 0 deletions code/modules/mining/mint.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
var/processing = 0
var/chosen = "metal" //which material will be used to make coins
var/coinsToProduce = 10
speed_process = 1

/obj/machinery/mineral/mint/process()
var/turf/T = get_step(src,input_dir)
Expand Down
13 changes: 7 additions & 6 deletions code/modules/recycling/conveyor2.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
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 // set to -1 to have the conveyour belt be inverted, so you can use the other corner icons
speed_process = 1

/obj/machinery/conveyor/centcom_auto
id = "round_end_belt"
Expand Down Expand Up @@ -105,15 +106,12 @@
use_power(100)

affecting = loc.contents - src // moved items will be all in loc
sleep(1) // slight delay to prevent infinite propagation due to map order
var/items_moved = 0
sleep(1)
for(var/atom/movable/A in affecting)
if(!A.anchored)
if(A.loc == src.loc) // prevents the object from being affected if it's not currently here.
step(A,movedir)
items_moved++
if(items_moved >= 10)
break
CHECK_TICK

// attack with item, place item on conveyor
/obj/machinery/conveyor/attackby(obj/item/I, mob/user, params)
Expand All @@ -125,7 +123,7 @@
user << "<span class='notice'>You remove the conveyor belt.</span>"
qdel(src)
return
if(istype(I, /obj/item/weapon/wrench))
if(istype(I, /obj/item/weapon/wrench))
if(!(stat & BROKEN))
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
dir = turn(dir,-45)
Expand Down Expand Up @@ -203,6 +201,7 @@

var/list/conveyors // the list of converyors that are controlled by this switch
anchored = 1
speed_process = 1



Expand Down Expand Up @@ -240,6 +239,7 @@
for(var/obj/machinery/conveyor/C in conveyors)
C.operating = position
C.update_move_direction()
CHECK_TICK

// attack with hand, switch position
/obj/machinery/conveyor_switch/attack_hand(mob/user)
Expand All @@ -266,6 +266,7 @@
if(S.id == src.id)
S.position = position
S.update()
CHECK_TICK

/obj/machinery/conveyor_switch/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weapon/crowbar))
Expand Down
1 change: 0 additions & 1 deletion code/modules/recycling/sortingmachinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
var/giftwrapped = 0
var/sortTag = 0


/obj/structure/bigDelivery/attack_hand(mob/user)
playsound(src.loc, 'sound/items/poster_ripped.ogg', 50, 1)
qdel(src)
Expand Down
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
#include "code\controllers\subsystem\assets.dm"
#include "code\controllers\subsystem\diseases.dm"
#include "code\controllers\subsystem\events.dm"
#include "code\controllers\subsystem\fastprocess.dm"
#include "code\controllers\subsystem\garbage.dm"
#include "code\controllers\subsystem\icon_smooth.dm"
#include "code\controllers\subsystem\jobs.dm"
Expand Down

0 comments on commit f54132e

Please sign in to comment.