Files
Bubberstation/code/modules/pai/candidate.dm
Jeremiah 86e801987e Reworks pAIs (#68241)
A pretty heavy refactor for pAIs that just spilled into a rework.

Attempts to fully document and organize backend code.
Fixes a large number of bugs left untouched for a decade.
Breaks down the frontend into subcomponents.
Rebalances their software modules.
(should) fix pAI faces get removed if you activate them during alert #68242
2022-07-24 16:18:59 +01:00

36 lines
918 B
Plaintext

/**
* #pAI Candidate
*
* Created when a user opens the pAI submit interface.
* Stores the candidate in an associative list of ckey: candidate objects.
*/
/datum/pai_candidate
/// User inputted OOC comments
var/comments
/// User inputted behavior description
var/description
/// User's ckey
var/ckey
/// User's pAI name. If blank, ninja name.
var/name
/// If the user has hit "submit"
var/ready = FALSE
/datum/pai_candidate/New(ckey)
src.ckey = ckey
/**
* Checks if a candidate is ready so that they may be displayed or
* downloaded. Removes any invalid entries.
*
* @returns {boolean} - TRUE if the candidate is ready, FALSE if not
*/
/datum/pai_candidate/proc/check_ready()
var/mob/candidate_mob = get_mob_by_key(ckey)
if(!candidate_mob?.client || !isobserver(candidate_mob) || is_banned_from(ckey, ROLE_PAI))
SSpai.candidates -= ckey
return FALSE
if(!ready)
return FALSE
return TRUE