Fixes heretic target assignment, also adds a debug verb to help debug objectives and similar (#64909)

Closes #64897

This PR adds a new debug button to spawn in a bunch of human dummies, assign them to one of each station job, and add them to the manifest to simulate a "full crew" on a live server.

This PR also fixes heretic target assignment. shuffle_inplace() doesn't return the list it shuffled, so the loops never functioned, and all targets were randomly picked instead of picked with the logic.
This commit is contained in:
MrMelbert
2022-02-20 09:23:18 +00:00
committed by GitHub
parent f37044ace9
commit a6fca05560
2 changed files with 82 additions and 3 deletions
+79
View File
@@ -194,6 +194,7 @@ GLOBAL_PROTECT(admin_verbs_debug)
/client/proc/load_circuit,
/client/proc/cmd_admin_toggle_fov,
/client/proc/cmd_admin_debug_traitor_objectives,
/client/proc/spawn_debug_full_crew,
)
GLOBAL_LIST_INIT(admin_verbs_possess, list(/proc/possess, /proc/release))
GLOBAL_PROTECT(admin_verbs_possess)
@@ -823,3 +824,81 @@ GLOBAL_PROTECT(admin_verbs_hideable)
set category = "Debug"
src << link("?debug=profile&type=sendmaps&window=test")
/**
* Debug verb that spawns human crewmembers
* of each job type, gives them a mind and assigns the role,
* and injects them into the manifest, as if they were a "player".
*
* This spawns humans with minds and jobs, but does NOT make them 'players'.
* They're all clientles mobs with minds / jobs.
*/
/client/proc/spawn_debug_full_crew()
set name = "Spawn Debug Full Crew"
set desc = "Creates a full crew for the station, filling the datacore and assigning them all minds / jobs. Don't do this on live"
set category = "Debug"
if(!check_rights(R_DEBUG))
return
var/mob/admin = usr
if(SSticker.current_state != GAME_STATE_PLAYING)
to_chat(admin, "You should only be using this after a round has setup and started.")
return
// Two input checks here to make sure people are certain when they're using this.
if(tgui_alert(admin, "This command will create a bunch of dummy crewmembers with minds, job, and datacore entries, which will take a while and fill the manifest.", "Spawn Crew", list("Yes", "Cancel")) != "Yes")
return
if(tgui_alert(admin, "I sure hope you aren't doing this on live. Are you sure?", "Spawn Crew (Be certain)", list("Yes", "Cancel")) != "Yes")
return
// Find the observer spawn, so we have a place to dump the dummies.
var/obj/effect/landmark/observer_start/observer_point = locate(/obj/effect/landmark/observer_start) in GLOB.landmarks_list
var/turf/destination = get_turf(observer_point)
if(!destination)
to_chat(admin, "Failed to find the observer spawn to send the dummies.")
return
// Okay, now go through all nameable occupations.
// Pick out all jobs that have JOB_CREW_MEMBER set.
// Then, spawn a human and slap a person into it.
var/number_made = 0
for(var/rank in SSjob.name_occupations)
var/datum/job/job = SSjob.GetJob(rank)
// JOB_CREW_MEMBER is all jobs that pretty much aren't silicon
if(!(job.job_flags & JOB_CREW_MEMBER))
continue
// Create our new_player for this job and set up its mind.
var/mob/dead/new_player/new_guy = new()
new_guy.mind_initialize()
new_guy.mind.name = "[rank] Dummy"
// Assign the rank to the new player dummy.
if(!SSjob.AssignRole(new_guy, job))
qdel(new_guy)
to_chat(admin, "[rank] wasn't able to be spawned.")
continue
// It's got a job, spawn in a human and shove it in the human.
var/mob/living/carbon/human/character = new(destination)
character.name = new_guy.mind.name
new_guy.mind.transfer_to(character)
qdel(new_guy)
// Then equip up the human with job gear.
SSjob.EquipRank(character, job)
job.after_latejoin_spawn(character)
// Finally, ensure the minds are tracked and in the manifest.
SSticker.minds += character.mind
if(ishuman(character))
GLOB.data_core.manifest_inject(character)
number_made++
CHECK_TICK
to_chat(admin, "[number_made] crewmembers have been created.")