Files
Bubberstation/code/modules/mob/mob_lists.dm
SkyratBot 75cc524a0e [MIRROR] Midrounds With Minimum Pop Requirements Work Again & Other Fixes [MDB IGNORE] (#26052)
* Midrounds With Minimum Pop Requirements Work Again & Other Fixes (#80856)

## About The Pull Request

Fixes #80851
Fixes #73622

Thanks to iprice for bringing this to attention and Isratosh for
assistance on Sybil.

This PR removes some (hopefully) redundant
if(!SSticker.HasRoundStarted()) checks which prevented roundstart mobs
from getting added to the living players list and pre-roundstart
observers from being added to the observers list.

This affected the ability for midround antagonists with a minimum
population requirement to spawn when they should have been able to,
pre-roundstart observers could not get polled for ghost roles, and some
other silliness regarding antagonists which considered the living
station population.

Nobody is really sure why this check was here in the first place outside
of some sanity check with an unknown purpose. The only thing it would
impact at one point was regal rats, but you can't play as regal rats
pre-roundstart anymore, and even then they should be counted amongst the
living players of the round, no? Since players can spawn in before
roundstart only with admin goofiness now, hopefully removing these
checks won't break anything.

## Why It's Good For The Game

This was preventing pretty much any midround antagonist from being
picked to spawn outside of Sleeper Agents in most cases. Also,
pre-roundstart observers should have access to midround antags and other
observer-related activies.

## Changelog

🆑
fix: Dynamic midround rolls will properly consider roundstart players as
part of the living population again, allowing antagonists with a minimum
population value to spawn when they should be able to.
fix: Players who observe before roundstart can be considered for
midround ghost roles again.
fix: Some antagonists which had elements that scale with living station
population now function properly again.
/🆑

* Midrounds With Minimum Pop Requirements Work Again & Other Fixes

---------

Co-authored-by: IndieanaJones <47086570+IndieanaJones@users.noreply.github.com>
2024-01-09 16:51:05 -05:00

122 lines
4.2 KiB
Plaintext

///Adds the mob reference to the list and directory of all mobs. Called on Initialize().
/mob/proc/add_to_mob_list()
GLOB.mob_list |= src
GLOB.mob_directory[tag] = src
///Removes the mob reference from the list and directory of all mobs. Called on Destroy().
/mob/proc/remove_from_mob_list()
GLOB.mob_list -= src
GLOB.mob_directory -= tag
///Adds the mob reference to the list of all mobs alive. If mob is cliented, it adds it to the list of all living player-mobs.
/mob/proc/add_to_alive_mob_list()
if(QDELETED(src))
return
GLOB.alive_mob_list |= src
if(client)
add_to_current_living_players()
///Removes the mob reference from the list of all mobs alive. If mob is cliented, it removes it from the list of all living player-mobs.
/mob/proc/remove_from_alive_mob_list()
GLOB.alive_mob_list -= src
if(client)
remove_from_current_living_players()
///Adds a mob reference to the list of all suicided mobs
/mob/proc/add_to_mob_suicide_list()
GLOB.suicided_mob_list += src
///Removes a mob references from the list of all suicided mobs
/mob/proc/remove_from_mob_suicide_list()
GLOB.suicided_mob_list -= src
///Adds the mob reference to the list of all the dead mobs. If mob is cliented, it adds it to the list of all dead player-mobs.
/mob/proc/add_to_dead_mob_list()
if(QDELETED(src))
return
GLOB.dead_mob_list |= src
if(client)
add_to_current_dead_players()
///Remvoes the mob reference from list of all the dead mobs. If mob is cliented, it adds it to the list of all dead player-mobs.
/mob/proc/remove_from_dead_mob_list()
GLOB.dead_mob_list -= src
if(client)
remove_from_current_dead_players()
///Adds the cliented mob reference to the list of all player-mobs, besides to either the of dead or alive player-mob lists, as appropriate. Called on Login().
/mob/proc/add_to_player_list()
SHOULD_CALL_PARENT(TRUE)
GLOB.player_list |= src
if(client.holder)
GLOB.keyloop_list |= src
else if(stat != DEAD || !SSlag_switch?.measures[DISABLE_DEAD_KEYLOOP])
GLOB.keyloop_list |= src
if(stat == DEAD)
add_to_current_dead_players()
else
add_to_current_living_players()
///Removes the mob reference from the list of all player-mobs, besides from either the of dead or alive player-mob lists, as appropriate. Called on Logout().
/mob/proc/remove_from_player_list()
SHOULD_CALL_PARENT(TRUE)
GLOB.player_list -= src
GLOB.keyloop_list -= src
if(stat == DEAD)
remove_from_current_dead_players()
else
remove_from_current_living_players()
///Adds the cliented mob reference to either the list of dead player-mobs or to the list of observers, depending on how they joined the game.
/mob/proc/add_to_current_dead_players()
GLOB.dead_player_list |= src
/mob/dead/observer/add_to_current_dead_players()
if(started_as_observer)
GLOB.current_observers_list |= src
return
return ..()
/mob/dead/new_player/add_to_current_dead_players()
return
///Removes the mob reference from either the list of dead player-mobs or from the list of observers, depending on how they joined the game.
/mob/proc/remove_from_current_dead_players()
GLOB.dead_player_list -= src
/mob/dead/observer/remove_from_current_dead_players()
if(started_as_observer)
GLOB.current_observers_list -= src
return
return ..()
///Adds the cliented mob reference to the list of living player-mobs. If the mob is an antag, it adds it to the list of living antag player-mobs.
/mob/proc/add_to_current_living_players()
GLOB.alive_player_list |= src
if(mind && (mind.special_role || length(mind.antag_datums)))
add_to_current_living_antags()
///Removes the mob reference from the list of living player-mobs. If the mob is an antag, it removes it from the list of living antag player-mobs.
/mob/proc/remove_from_current_living_players()
GLOB.alive_player_list -= src
if(LAZYLEN(mind?.antag_datums))
remove_from_current_living_antags()
///Adds the cliented mob reference to the list of living antag player-mobs.
/mob/proc/add_to_current_living_antags()
if (length(mind.antag_datums) == 0)
return
for (var/datum/antagonist/antagonist in mind.antag_datums)
if (antagonist.count_against_dynamic_roll_chance)
GLOB.current_living_antags |= src
return
///Removes the mob reference from the list of living antag player-mobs.
/mob/proc/remove_from_current_living_antags()
GLOB.current_living_antags -= src