Skip to content

Commit

Permalink
stop the pills (tgstation#18703)
Browse files Browse the repository at this point in the history
* RedPills Processing

Now you have to use START_PROCESSING(SSname, thing) (and STOP_PROCESSING)

* Fixes a minor bug.
  • Loading branch information
MrStonedOne authored and AnturK committed Jun 20, 2016
1 parent c480ad7 commit 0d6bbbb
Show file tree
Hide file tree
Showing 90 changed files with 424 additions and 416 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/MC.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#define MC_AVERAGE_SLOW(average, current) (0.9 * (average) + 0.1 * (current))
#define NEW_SS_GLOBAL(varname) if(varname != src){if(istype(varname)){Recover();qdel(varname);}varname = src;}

#define START_PROCESSING(Processor, Datum) if (!Datum.isprocessing) Datum.isprocessing = 1;Processor.processing += Datum
#define STOP_PROCESSING(Processor, Datum) if (Datum.isprocessing) Datum.isprocessing = 0;Processor.processing -= Datum

//SubSystem flags (Please design any new flags so that the default is off, to make adding flags to subsystems easier)

//subsystem should fire during pre-game lobby.
Expand Down
4 changes: 3 additions & 1 deletion code/controllers/subsystem/machines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ var/datum/subsystem/machines/SSmachine
if(thing:use_power)
thing:auto_use_power() //add back the power state
else
processing.Remove(thing)
processing -= thing
if (thing)
thing.isprocessing = 0
if (MC_TICK_CHECK)
return

Expand Down
5 changes: 3 additions & 2 deletions code/controllers/subsystem/objects.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
var/datum/subsystem/objects/SSobj

/datum/var/isprocessing = 0
/datum/proc/process()
set waitfor = 0
SSobj.processing.Remove(src)
STOP_PROCESSING(SSobj, src)
return 0

/datum/subsystem/objects
Expand Down Expand Up @@ -50,7 +51,7 @@ var/datum/subsystem/objects/SSobj
if(thing)
thing.process(wait)
else
SSobj.processing.Remove(thing)
SSobj.processing -= thing
if (MC_TICK_CHECK)
return

Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/blob/blobs/core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/obj/effect/blob/core/New(loc, client/new_overmind = null, new_rate = 2, placed = 0)
blob_cores += src
SSobj.processing |= src
START_PROCESSING(SSobj, src)
poi_list |= src
update_icon() //so it atleast appears
if(!placed && !overmind)
Expand Down Expand Up @@ -45,7 +45,7 @@
if(overmind)
overmind.blob_core = null
overmind = null
SSobj.processing.Remove(src)
STOP_PROCESSING(SSobj, src)
poi_list -= src
return ..()

Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/blob/blobs/node.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/obj/effect/blob/node/New(loc, var/h = 100)
blob_nodes += src
SSobj.processing |= src
START_PROCESSING(SSobj, src)
..(loc, h)

/obj/effect/blob/node/scannerreport()
Expand All @@ -33,7 +33,7 @@

/obj/effect/blob/node/Destroy()
blob_nodes -= src
SSobj.processing.Remove(src)
STOP_PROCESSING(SSobj, src)
return ..()

/obj/effect/blob/node/Life()
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/changeling/powers/fleshmend.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

/obj/effect/proc_holder/changeling/fleshmend/New()
..()
SSobj.processing.Add(src)
START_PROCESSING(SSobj, src)

/obj/effect/proc_holder/changeling/fleshmend/Destroy()
SSobj.processing.Remove(src)
STOP_PROCESSING(SSobj, src)
..()

/obj/effect/proc_holder/changeling/fleshmend/process()
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/changeling/powers/mutations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
..()
if(ismob(loc))
loc.visible_message("<span class='warning'>[loc.name]\'s flesh rapidly inflates, forming a bloated mass around their body!</span>", "<span class='warning'>We inflate our flesh, creating a spaceproof suit!</span>", "<span class='italics'>You hear organic matter ripping and tearing!</span>")
SSobj.processing += src
START_PROCESSING(SSobj, src)

/obj/item/clothing/suit/space/changeling/process()
if(ishuman(loc))
Expand Down
14 changes: 7 additions & 7 deletions code/game/gamemodes/clock_cult/clock_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@

/obj/item/clockwork/slab/New()
..()
SSobj.processing += src
START_PROCESSING(SSobj, src)
production_time = world.time + SLAB_PRODUCTION_TIME

/obj/item/clockwork/slab/Destroy()
SSobj.processing -= src
STOP_PROCESSING(SSobj, src)
return ..()

/obj/item/clockwork/slab/process()
if(!produces_components)
SSobj.processing -= src
STOP_PROCESSING(SSobj, src)
return
if(production_time > world.time)
return
Expand Down Expand Up @@ -396,10 +396,10 @@

/obj/item/clothing/glasses/wraith_spectacles/New()
..()
SSobj.processing += src
START_PROCESSING(SSobj, src)

/obj/item/clothing/glasses/wraith_spectacles/Destroy()
SSobj.processing -= src
STOP_PROCESSING(SSobj, src)
return ..()

/obj/item/clothing/glasses/wraith_spectacles/process()
Expand Down Expand Up @@ -770,11 +770,11 @@

/obj/item/clockwork/tinkerers_daemon/New()
..()
SSobj.processing += src
START_PROCESSING(SSobj, src)
clockwork_daemons++

/obj/item/clockwork/tinkerers_daemon/Destroy()
SSobj.processing -= src
STOP_PROCESSING(SSobj, src)
clockwork_daemons--
return ..()

Expand Down
10 changes: 6 additions & 4 deletions code/game/gamemodes/clock_cult/clock_machines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@
if(active)
icon_state = active_icon
if(fast_process)
SSfastprocess.processing |= src
START_PROCESSING(SSfastprocess, src)
else
SSobj.processing |= src
START_PROCESSING(SSobj, src)
else
icon_state = inactive_icon
SSfastprocess.processing -= src
SSobj.processing -= src
if(fast_process)
STOP_PROCESSING(SSfastprocess, src)
else
STOP_PROCESSING(SSobj, src)


/obj/structure/clockwork/powered/proc/total_accessable_power() //how much power we have and can use
Expand Down
8 changes: 4 additions & 4 deletions code/game/gamemodes/clock_cult/clock_ratvar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
countdown = new(src)
countdown.start()
SSshuttle.emergencyNoEscape = TRUE
SSobj.processing += src
START_PROCESSING(SSobj, src)
var/area/gate_area = get_area(src)
for(var/M in mob_list)
if(is_servant_of_ratvar(M) || isobserver(M))
Expand All @@ -50,7 +50,7 @@
SSshuttle.emergency.timer = world.time
if(!purpose_fulfilled)
priority_announce("Hostile enviroment resolved. You have 3 minutes to board the Emergency Shuttle.", null, 'sound/AI/shuttledock.ogg', "Priority")
SSobj.processing -= src
STOP_PROCESSING(SSobj, src)
if(!purpose_fulfilled)
var/area/gate_area = get_area(src)
for(var/M in mob_list)
Expand Down Expand Up @@ -190,7 +190,7 @@
ratvar_awakens = TRUE
for(var/obj/item/clockwork/ratvarian_spear/R in all_clockwork_objects)
R.update_force()
SSobj.processing += src
START_PROCESSING(SSobj, src)
world << "<span class='heavy_brass'><font size=6>\"BAPR NTNVA ZL YVTUG FUNYY FUVAR NPEBFF GUVF CNGURGVP ERNYZ!!\"</font></span>"
world << 'sound/effects/ratvar_reveal.ogg'
var/image/alert_overlay = image('icons/effects/clockwork_effects.dmi', "ratvar_alert")
Expand All @@ -204,7 +204,7 @@
ratvar_awakens = FALSE
for(var/obj/item/clockwork/ratvarian_spear/R in all_clockwork_objects)
R.update_force()
SSobj.processing -= src
STOP_PROCESSING(SSobj, src)
world << "<span class='heavy_brass'><font size=6>\"NO! I will not... be...</font> <font size=5>banished...</font> <font size=4>again...\"</font></span>"
return ..()

Expand Down
8 changes: 4 additions & 4 deletions code/game/gamemodes/clock_cult/clock_structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@

/obj/structure/clockwork/cache/New()
..()
SSobj.processing += src
START_PROCESSING(SSobj, src)
clockwork_caches++

/obj/structure/clockwork/cache/Destroy()
clockwork_caches--
SSobj.processing -= src
STOP_PROCESSING(SSobj, src)
return ..()

/obj/structure/clockwork/cache/destroyed()
Expand Down Expand Up @@ -324,10 +324,10 @@

/obj/structure/clockwork/ocular_warden/New()
..()
SSfastprocess.processing += src
START_PROCESSING(SSfastprocess, src)

/obj/structure/clockwork/ocular_warden/Destroy()
SSfastprocess.processing -= src
STOP_PROCESSING(SSfastprocess, src)
return ..()

/obj/structure/clockwork/ocular_warden/examine(mob/user)
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/cult/cult_structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ var/list/blacklisted_pylon_turfs = typecacheof(list(
var/last_corrupt = 0

/obj/structure/cult/pylon/New()
SSfastprocess.processing |= src
START_PROCESSING(SSfastprocess, src)
..()

/obj/structure/cult/pylon/Destroy()
SSfastprocess.processing.Remove(src)
STOP_PROCESSING(SSfastprocess, src)
return ..()

/obj/structure/cult/pylon/process()
Expand Down
8 changes: 4 additions & 4 deletions code/game/gamemodes/gang/dominator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
if(G != gang)
G.message_gangtools("WARNING: [gang.name] Gang takeover imminent. Their dominator at [domloc.map_name] must be destroyed!",1,1)
else
SSmachine.processing -= src
STOP_PROCESSING(SSmachine, src)

/obj/machinery/dominator/take_damage(damage, damage_type = BRUTE, sound_effect = 1)
switch(damage_type)
Expand Down Expand Up @@ -115,7 +115,7 @@
cut_overlays()
operating = 0
stat |= BROKEN
SSmachine.processing -= src
STOP_PROCESSING(SSmachine, src)

/obj/machinery/dominator/Destroy()
if(!(stat & BROKEN))
Expand All @@ -125,7 +125,7 @@
qdel(spark_system)
qdel(countdown)
countdown = null
SSmachine.processing -= src
STOP_PROCESSING(SSmachine, src)
return ..()

/obj/machinery/dominator/emp_act(severity)
Expand Down Expand Up @@ -199,7 +199,7 @@
countdown.start()

SetLuminosity(3)
SSmachine.processing += src
START_PROCESSING(SSmachine, src)

gang.message_gangtools("Hostile takeover in progress: Estimated [time] minutes until victory.[gang.dom_attempts ? "" : " This is your final attempt."]")
for(var/datum/gang/G in ticker.mode.gangs)
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/gang/gang.dm
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ var/list/gang_colors_pool = list("red","orange","yellow","green","blue","purple"

/datum/gang_points/New()
next_point_time = world.time + next_point_interval
SSobj.processing += src
START_PROCESSING(SSobj, src)

/datum/gang_points/process(seconds)
var/list/winners = list() //stores the winners if there are any
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/handofgod/structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@


/obj/structure/divine/nexus/New()
SSobj.processing |= src
START_PROCESSING(SSobj, src)


/obj/structure/divine/nexus/process()
Expand All @@ -287,7 +287,7 @@


/obj/structure/divine/nexus/Destroy()
SSobj.processing -= src
STOP_PROCESSING(SSobj, src)
return ..()


Expand Down
8 changes: 4 additions & 4 deletions code/game/gamemodes/miniantags/abduction/abduction_gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@
M.SetStunned(0)
M.SetWeakened(0)
combat_cooldown = 0
SSobj.processing |= src
START_PROCESSING(SSobj, src)

/obj/item/clothing/suit/armor/abductor/vest/process()
combat_cooldown++
if(combat_cooldown==initial(combat_cooldown))
SSobj.processing.Remove(src)
STOP_PROCESSING(SSobj, src)

/obj/item/device/abductor/proc/AbductorCheck(user)
if(isabductor(user))
Expand Down Expand Up @@ -262,7 +262,7 @@
if(cooldown == initial(cooldown))
home.Retrieve(imp_in,1)
cooldown = 0
SSobj.processing |= src
START_PROCESSING(SSobj, src)
else
imp_in << "<span class='warning'>You must wait [30 - cooldown] seconds to use [src] again!</span>"
return
Expand All @@ -271,7 +271,7 @@
if(cooldown < initial(cooldown))
cooldown++
if(cooldown == initial(cooldown))
SSobj.processing.Remove(src)
STOP_PROCESSING(SSobj, src)

/obj/item/weapon/implant/abductor/implant(var/mob/source, var/mob/user)
if(..())
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/miniantags/abduction/gland.dm
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@

/obj/effect/cocoon/abductor/proc/Start()
hatch_time = world.time + 600
SSobj.processing |= src
START_PROCESSING(SSobj, src)

/obj/effect/cocoon/abductor/process()
if(world.time > hatch_time)
SSobj.processing.Remove(src)
STOP_PROCESSING(SSobj, src)
for(var/mob/M in contents)
src.visible_message("<span class='warning'>[src] hatches!</span>")
M.loc = src.loc
Expand Down
8 changes: 4 additions & 4 deletions code/game/gamemodes/nuclear/nuclearbomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var/bomb_set
countdown = new(src)
nuke_list += src
core = new /obj/item/nuke_core(src)
SSobj.processing -= core
STOP_PROCESSING(SSobj, core)
update_icon()
poi_list |= src
previous_level = get_security_level()
Expand Down Expand Up @@ -118,7 +118,7 @@ var/bomb_set
user << "<span class='notice'>You pry off [src]'s inner plate. You can see the core's green glow!</span>"
deconstruction_state = NUKESTATE_CORE_EXPOSED
update_icon()
SSobj.processing += core
START_PROCESSING(SSobj, core)
return
if(NUKESTATE_CORE_EXPOSED)
if(istype(I, /obj/item/nuke_core_container))
Expand All @@ -141,7 +141,7 @@ var/bomb_set
if(M.use(20))
user << "<span class='notice'>You repair [src]'s inner metal plate. The radiation is contained.</span>"
deconstruction_state = NUKESTATE_PANEL_REMOVED
SSobj.processing -= core
STOP_PROCESSING(SSobj, core)
update_icon()
else
user << "<span class='warning'>You need more metal to do that!</span>"
Expand Down Expand Up @@ -434,7 +434,7 @@ This is here to make the tiles around the station mininuke change when it's arme
/obj/item/weapon/disk/nuclear/New()
..()
poi_list |= src
SSobj.processing |= src
START_PROCESSING(SSobj, src)

/obj/item/weapon/disk/nuclear/process()
var/turf/disk_loc = get_turf(src)
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/wizard/artefact.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
src.spawn_amt_left = spawn_amt
src.desc = desc
src.spawn_fast = spawn_fast
SSobj.processing |= src
START_PROCESSING(SSobj, src)
return

/obj/effect/rend/process()
Expand Down
Loading

0 comments on commit 0d6bbbb

Please sign in to comment.