make SSevents frequeny_lower and frequency_upper configurable, fix runtimes when no events were drafted to trigger (#82978)

## About The Pull Request

Make events frequency configurable.
Fix runtime when no events were drafted to be picked from.

## Why It's Good For The Game

No runtimes good. 
No need to change frequency in code.

🆑
fix: fix runtime when no events were drafted to be picked from
config: make events frequency configurable
/🆑

---------

Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
Gaxeer
2024-05-02 03:14:35 +02:00
committed by GitHub
co-authored by san7890
parent d6b7f5c019
commit 9d2c02e691
4 changed files with 37 additions and 9 deletions
+8 -3
View File
@@ -23,6 +23,10 @@ SUBSYSTEM_DEF(events)
if(!event.typepath || !event.valid_for_map())
continue //don't want this one! leave it for the garbage collector
control += event //add it to the list of all events (controls)
frequency_lower = CONFIG_GET(number/events_frequency_lower)
frequency_upper = CONFIG_GET(number/events_frequency_upper)
reschedule()
// Instantiate our holidays list if it hasn't been already
if(isnull(GLOB.holidays))
@@ -85,7 +89,8 @@ SUBSYSTEM_DEF(events)
event_roster[event_to_check] = event_to_check.weight
var/datum/round_event_control/event_to_run = pick_weight(event_roster)
TriggerEvent(event_to_run)
if(event_to_run)
TriggerEvent(event_to_run)
///Does the last pre-flight checks for the passed event, and runs it if the event is ready.
/datum/controller/subsystem/events/proc/TriggerEvent(datum/round_event_control/event_to_trigger)
@@ -103,8 +108,8 @@ SUBSYSTEM_DEF(events)
///Sets the event frequency bounds back to their initial value.
/datum/controller/subsystem/events/proc/resetFrequency()
frequency_lower = initial(frequency_lower)
frequency_upper = initial(frequency_upper)
frequency_lower = CONFIG_GET(number/events_frequency_lower)
frequency_upper = CONFIG_GET(number/events_frequency_upper)
/**
* HOLIDAYS