mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 06:57:42 +01:00
Improved antag fishing busting (#19542)
This commit is contained in:
@@ -276,12 +276,12 @@ SUBSYSTEM_DEF(jobs)
|
||||
|
||||
//Get the players who are ready
|
||||
for(var/mob/new_player/player in GLOB.player_list)
|
||||
if(player.ready && player.has_valid_preferences() && player.mind && !player.mind.assigned_role)
|
||||
if(player.ready && player.mind && !player.mind.assigned_role)
|
||||
unassigned += player
|
||||
|
||||
Debug("DO, Len: [unassigned.len]")
|
||||
if(unassigned.len == 0)
|
||||
return 0
|
||||
if(!length(unassigned))
|
||||
return FALSE
|
||||
|
||||
//Shuffle players and jobs
|
||||
unassigned = shuffle(unassigned)
|
||||
@@ -392,7 +392,7 @@ SUBSYSTEM_DEF(jobs)
|
||||
unassigned -= player
|
||||
|
||||
log_debug("Dividing Occupations took [stop_watch(watch)]s")
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/datum/controller/subsystem/jobs/proc/AssignRank(mob/living/carbon/human/H, rank, joined_late = FALSE, log_to_db = TRUE)
|
||||
if(!H)
|
||||
|
||||
@@ -65,6 +65,8 @@ SUBSYSTEM_DEF(ticker)
|
||||
var/real_reboot_time = 0
|
||||
/// Datum used to generate the end of round scoreboard.
|
||||
var/datum/scoreboard/score = null
|
||||
/// List of ckeys who had antag rolling issues flagged
|
||||
var/list/flagged_antag_rollers = list()
|
||||
|
||||
/datum/controller/subsystem/ticker/Initialize()
|
||||
login_music = pick(\
|
||||
@@ -197,13 +199,35 @@ SUBSYSTEM_DEF(ticker)
|
||||
if(player.client.prefs.toggles2 & PREFTOGGLE_2_RANDOMSLOT)
|
||||
player.client.prefs.load_random_character_slot(player.client)
|
||||
|
||||
// Lets check if people who ready should or shouldnt be
|
||||
for(var/mob/new_player/P in GLOB.player_list)
|
||||
// Not logged in
|
||||
if(!P.client)
|
||||
continue
|
||||
// Not ready
|
||||
if(!P.ready)
|
||||
continue
|
||||
// Not set to return if nothing available
|
||||
if(P.client.prefs.active_character.alternate_option != RETURN_TO_LOBBY)
|
||||
continue
|
||||
|
||||
var/has_antags = (length(P.client.prefs.be_special) > 0)
|
||||
if(!P.client.prefs.active_character.check_any_job())
|
||||
to_chat(P, "<span class='danger'>You have no jobs enabled, along with return to lobby if job is unavailable. This makes you ineligible for any round start role, please update your job preferences.</span>")
|
||||
if(has_antags)
|
||||
// We add these to a list so we can deal with them as a batch later
|
||||
// A lot of DB tracking stuff needs doing, so we may as well async it
|
||||
flagged_antag_rollers |= P.ckey
|
||||
|
||||
P.ready = FALSE
|
||||
|
||||
//Configure mode and assign player to special mode stuff
|
||||
mode.pre_pre_setup()
|
||||
var/can_continue
|
||||
can_continue = mode.pre_setup() //Setup special modes
|
||||
var/can_continue = FALSE
|
||||
can_continue = mode.pre_setup() //Setup special modes. This also does the antag fishing checks.
|
||||
SSjobs.DivideOccupations() //Distribute jobs
|
||||
if(!can_continue)
|
||||
qdel(mode)
|
||||
QDEL_NULL(mode)
|
||||
to_chat(world, "<B>Error setting up [GLOB.master_mode].</B> Reverting to pre-game lobby.")
|
||||
current_state = GAME_STATE_PREGAME
|
||||
force_start = FALSE
|
||||
@@ -307,6 +331,9 @@ SUBSYSTEM_DEF(ticker)
|
||||
#ifdef UNIT_TESTS
|
||||
RunUnitTests()
|
||||
#endif
|
||||
|
||||
// Do this 10 second after roundstart because of roundstart lag, and make it more visible
|
||||
addtimer(CALLBACK(src, .proc/handle_antagfishing_reporting), 10 SECONDS)
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -653,3 +680,53 @@ SUBSYSTEM_DEF(ticker)
|
||||
sleep(sound_length)
|
||||
|
||||
world.Reboot()
|
||||
|
||||
// Timers invoke this async
|
||||
/datum/controller/subsystem/ticker/proc/handle_antagfishing_reporting()
|
||||
// This needs the DB
|
||||
if(!SSdbcore.IsConnected())
|
||||
return
|
||||
// Dont need to do anything
|
||||
if(!length(flagged_antag_rollers))
|
||||
return
|
||||
|
||||
// Records themselves
|
||||
var/list/datum/antag_record/records = list()
|
||||
// Queries to load data (executed as async batch)
|
||||
var/list/datum/db_query/load_queries = list()
|
||||
// Queries to save data (executed as async batch)
|
||||
var/list/datum/db_query/save_queries = list()
|
||||
|
||||
|
||||
for(var/ckey in flagged_antag_rollers)
|
||||
var/datum/antag_record/AR = new /datum/antag_record(ckey)
|
||||
records[ckey] = AR
|
||||
load_queries[ckey] = AR.get_load_query()
|
||||
|
||||
// Explanation for parameters:
|
||||
// TRUE: We want warnings if these fail
|
||||
// FALSE: Do NOT qdel() queries here, otherwise they wont be read. At all.
|
||||
// TRUE: This is an assoc list, so it needs to prepare for that
|
||||
SSdbcore.MassExecute(load_queries, TRUE, FALSE, TRUE)
|
||||
|
||||
// Report on things
|
||||
var/list/log_text = list("The following players attempted to roll antag with no jobs (total infractions listed)")
|
||||
|
||||
for(var/ckey in flagged_antag_rollers)
|
||||
var/datum/antag_record/AR = records[ckey]
|
||||
AR.handle_data(load_queries[ckey])
|
||||
save_queries[ckey] = AR.get_save_query()
|
||||
|
||||
log_text += "<small>- <a href='?priv_msg=[ckey]'>[ckey]</a>: [AR.infraction_count]</small>"
|
||||
|
||||
log_text += "Investigation advised if there are a high number of infractions"
|
||||
|
||||
message_admins(log_text.Join("<br>"))
|
||||
|
||||
// Now do a ton of saves
|
||||
SSdbcore.MassExecute(save_queries, TRUE, TRUE, TRUE)
|
||||
|
||||
// And cleanup
|
||||
QDEL_LIST_ASSOC_VAL(load_queries)
|
||||
records.Cut()
|
||||
flagged_antag_rollers.Cut()
|
||||
|
||||
Reference in New Issue
Block a user