Admins can reroll random events into something else (#83424)

## About The Pull Request

Random events can now be rerolled by admins, much like how they can
reroll dynamic rulesets. During the ten-second warning window, you can
choose "Something Else" to have a (randomly selected) different event
run in its stead. You still get the 10-second delay when this new one is
picked, meaning you can keep rerolling until you get something
interesting.

The option to just cancel a random event remains.
## Why It's Good For The Game

Cancelling a random event sets back the random event clock, meaning you
have to wait a few minutes for another one to roll. Now you can just
reroll dangerous events into something calmer (or y'know, calm events
into something more dangerous).
## Changelog
🆑 Rhials
admin: Admins can now reroll random events into something else.
/🆑
This commit is contained in:
Rhials
2024-05-25 15:55:03 -07:00
committed by GitHub
parent 6b1c389a99
commit 39b84e7e2c
2 changed files with 21 additions and 4 deletions
+9 -2
View File
@@ -65,8 +65,13 @@ SUBSYSTEM_DEF(events)
/datum/controller/subsystem/events/proc/reschedule()
scheduled = world.time + rand(frequency_lower, max(frequency_lower,frequency_upper))
//selects a random event based on whether it can occur and it's 'weight'(probability)
/datum/controller/subsystem/events/proc/spawnEvent()
/**
* Selects a random event based on whether it can occur and it's 'weight'(probability)
*
* Arguments:
* * excluded_event - The event path we will be foregoing, if present.
*/
/datum/controller/subsystem/events/proc/spawnEvent(datum/round_event_control/excluded_event)
set waitfor = FALSE //for the admin prompt
if(!CONFIG_GET(flag/allow_random_events))
return
@@ -77,6 +82,8 @@ SUBSYSTEM_DEF(events)
var/list/event_roster = list()
for(var/datum/round_event_control/event_to_check in control)
if(excluded_event && event_to_check.typepath == excluded_event.typepath) //If an event has been rerolled we won't just roll the same one again.
continue
if(!event_to_check.can_spawn_event(players_amt))
continue
if(event_to_check.weight < 0) //for round-start events etc.