mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge pull request #6620 from Heroman3003/eventpause
Pauses event processing while doing event actions
This commit is contained in:
@@ -21,6 +21,7 @@ SUBSYSTEM_DEF(events)
|
||||
|
||||
/datum/controller/subsystem/events/fire(resumed)
|
||||
for(var/datum/event/E in active_events)
|
||||
if(E.processing_active)
|
||||
E.process()
|
||||
|
||||
for(var/i = EVENT_LEVEL_MUNDANE to EVENT_LEVEL_MAJOR)
|
||||
|
||||
@@ -46,9 +46,10 @@
|
||||
|
||||
var/severity = 0 //Severity. Lower means less severe, higher means more severe. Does not have to be supported. Is set on New().
|
||||
var/activeFor = 0 //How long the event has existed. You don't need to change this.
|
||||
var/isRunning = 1 //If this event is currently running. You should not change this.
|
||||
var/isRunning = TRUE //If this event is currently running. You should not change this.
|
||||
var/startedAt = 0 //When this event started.
|
||||
var/endedAt = 0 //When this event ended.
|
||||
var/processing_active = TRUE
|
||||
var/datum/event_meta/event_meta = null
|
||||
|
||||
/datum/event/nothing
|
||||
@@ -96,18 +97,26 @@
|
||||
//This proc will handle the calls to the appropiate procs.
|
||||
/datum/event/process()
|
||||
if(activeFor > startWhen && activeFor < endWhen)
|
||||
processing_active = FALSE
|
||||
tick()
|
||||
processing_active = TRUE
|
||||
|
||||
if(activeFor == startWhen)
|
||||
isRunning = 1
|
||||
isRunning = TRUE
|
||||
processing_active = FALSE
|
||||
start()
|
||||
processing_active = TRUE
|
||||
|
||||
if(activeFor == announceWhen)
|
||||
processing_active = FALSE
|
||||
announce()
|
||||
processing_active = TRUE
|
||||
|
||||
if(activeFor == endWhen)
|
||||
isRunning = 0
|
||||
isRunning = FALSE
|
||||
processing_active = FALSE
|
||||
end()
|
||||
processing_active = TRUE
|
||||
|
||||
// Everything is done, let's clean up.
|
||||
if(activeFor >= lastProcessAt())
|
||||
|
||||
Reference in New Issue
Block a user