Fixes the false armblade removal timer. Refactors addtimer (#21714)

* Clever girl...

* Make the addtimer unique param safe

* Refactor addtimer calls

* Moved the location of the define so the other SSs can use it
This commit is contained in:
Cyberboss
2016-11-25 22:05:58 +13:00
committed by oranges
parent 2466ce4e7b
commit e37f807941
44 changed files with 86 additions and 75 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ var/datum/subsystem/augury/SSaugury
if(O.orbiting)
continue
else if(biggest_doom)
addtimer(O, "orbit", 0, FALSE, biggest_doom)
addtimer(O, "orbit", 0, TIMER_NORMAL, biggest_doom)
/datum/action/innate/augury
name = "Auto Follow Debris"
+10 -4
View File
@@ -62,7 +62,7 @@ var/datum/subsystem/timer/SStimer
SStimer.hashes -= hash
return QDEL_HINT_IWILLGC
/proc/addtimer(thingToCall, procToCall, wait, unique = FALSE, ...)
/proc/addtimer(thingToCall, procToCall, wait, unique = TIMER_NORMAL, ...)
if (!thingToCall || !procToCall)
return
if (!SStimer.can_fire)
@@ -76,11 +76,17 @@ var/datum/subsystem/timer/SStimer
hashlist[1] = "[thingToCall](\ref[thingToCall])"
event.hash = jointext(args, null)
if(args.len > 4)
event.argList = args.Copy(5)
var/bad_args = unique != TIMER_NORMAL && unique != TIMER_UNIQUE
if(args.len > 4 || bad_args)
if(bad_args)
stack_trace("Invalid arguments in call to addtimer!")
event.argList = args.Copy(4)
else
event.argList = args.Copy(5)
// Check for dupes if unique = 1.
if(unique)
if(!bad_args && unique != TIMER_NORMAL) //faster than checking if(unique == TIMER_UNIQUE)
var/datum/timedevent/hash_event = SStimer.hashes[event.hash]
if(hash_event)
return hash_event.id
+1 -1
View File
@@ -29,7 +29,7 @@ var/datum/subsystem/weather/SSweather
var/datum/weather/W = pickweight(possible_weather_for_this_z)
run_weather(W.name, Z)
eligible_zlevels -= Z
addtimer(src, "make_z_eligible", rand(3000, 6000) + W.weather_duration_upper, TRUE, Z) //Around 5-10 minutes between weathers
addtimer(src, "make_z_eligible", rand(3000, 6000) + W.weather_duration_upper, TIMER_UNIQUE, Z) //Around 5-10 minutes between weathers
/datum/subsystem/weather/Initialize(start_timeofday)
..()