mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
Merge pull request #16471 from Core0verload/events
Adds minimal players requirements for random events
This commit is contained in:
@@ -70,19 +70,14 @@ var/datum/subsystem/events/SSevent
|
||||
// if(E) E.runEvent()
|
||||
return
|
||||
|
||||
var/gamemode = ticker.mode.config_tag
|
||||
var/players_amt = get_active_player_count(alive_check = 1, afk_check = 1, human_check = 1)
|
||||
// Only alive, non-AFK human players count towards this.
|
||||
|
||||
var/sum_of_weights = 0
|
||||
for(var/datum/round_event_control/E in control)
|
||||
if(E.occurrences >= E.max_occurrences)
|
||||
if(!E.canSpawnEvent(players_amt, gamemode))
|
||||
continue
|
||||
if(E.earliest_start >= world.time)
|
||||
continue
|
||||
if(E.gamemode_blacklist.len && (ticker.mode.config_tag in E.gamemode_blacklist))
|
||||
continue
|
||||
if(E.gamemode_whitelist.len && !(ticker.mode.config_tag in E.gamemode_whitelist))
|
||||
continue
|
||||
if(E.holidayID)
|
||||
if(!holidays || !holidays[E.holidayID])
|
||||
continue
|
||||
if(E.weight < 0) //for round-start events etc.
|
||||
if(E.runEvent() == PROCESS_KILL)
|
||||
E.max_occurrences = 0
|
||||
@@ -96,17 +91,8 @@ var/datum/subsystem/events/SSevent
|
||||
sum_of_weights = rand(0,sum_of_weights) //reusing this variable. It now represents the 'weight' we want to select
|
||||
|
||||
for(var/datum/round_event_control/E in control)
|
||||
if(E.occurrences >= E.max_occurrences)
|
||||
if(!E.canSpawnEvent(players_amt, gamemode))
|
||||
continue
|
||||
if(E.earliest_start >= world.time)
|
||||
continue
|
||||
if(E.gamemode_blacklist.len && (ticker.mode.config_tag in E.gamemode_blacklist))
|
||||
continue
|
||||
if(E.gamemode_whitelist.len && !(ticker.mode.config_tag in E.gamemode_whitelist))
|
||||
continue
|
||||
if(E.holidayID)
|
||||
if(!holidays || !holidays[E.holidayID])
|
||||
continue
|
||||
sum_of_weights -= E.weight
|
||||
|
||||
if(sum_of_weights <= 0) //we've hit our goal
|
||||
|
||||
Reference in New Issue
Block a user