mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 03:32:00 +00:00
## About The Pull Request It turns out monkeys being catatonic got broken 2 years ago in a PR that was meant to fix something else; also, it turns out monkeys are supposed to have primal eyes when turned into humans, and that got broken too. I fixed both of those things, and while I was at it I did a refactor to make it easier to give noticable organs (or anything else that you'd want correct pronoun and verb tenses) easier to implement. 1) AI controlled mobs now properly display their noticable organs when appropriate 2) Added some macros and a helper proc for replacing appropriate pronouns and verb tenses in text 3) The noticable organ HTML is no longer broken, so you can pass text with spans into it, if you want the text to be pretty or big or whatever 4) Monkeys are no longer catatonic if they have an active AI controller; this goes for any carbon actually but I think monkeys are the only one with AI controllers at the moment ## Why It's Good For The Game Fixes the logic for displaying organs on AI controller mobs (currently monkeys) Makes it easier to add these kind of organs for carbons, AI controlled or not, in the future Look! An actual use-case for split editor:  ## Changelog Humanized monkeys now have their primal eyes again; monkeys with active AI are no longer catatonic. 🆑 Bisar fix: AI controlled monkeys are no longer catatonic, and they have primal eyes again when turned into humans. spellcheck: Noticable organs now have more modular grammar, and their current grammar is fixed. refactor: Refactored the code for displaying the messages for noticable organs. config: Added a documented define of all our pronouns /🆑 --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
53 lines
2.5 KiB
Plaintext
53 lines
2.5 KiB
Plaintext
/**
|
|
* ai control examine; which gives the pawn of the parent the noticable organs depending on AI status!
|
|
*
|
|
* Used for monkeys to have PRIMAL eyes
|
|
*/
|
|
/datum/element/ai_control_examine
|
|
element_flags = ELEMENT_BESPOKE
|
|
argument_hash_start_idx = 2
|
|
/// These organ slots on the parent's pawn, if filled, will get a special ai-specific examine
|
|
/// Apply the element to ORGAN_SLOT_BRAIN if you don't want it to be hideable behind clothing.
|
|
var/list/noticable_organ_examines
|
|
|
|
/datum/element/ai_control_examine/Attach(datum/target, noticable_organ_examines = list(ORGAN_SLOT_BRAIN = span_deadsay("doesn't appear to be themself.")))
|
|
. = ..()
|
|
|
|
if(!istype(target, /datum/ai_controller))
|
|
return ELEMENT_INCOMPATIBLE
|
|
var/datum/ai_controller/target_controller = target
|
|
src.noticable_organ_examines = noticable_organ_examines
|
|
RegisterSignal(target_controller, COMSIG_AI_CONTROLLER_POSSESSED_PAWN, PROC_REF(on_ai_controller_possessed_pawn))
|
|
|
|
/datum/element/ai_control_examine/Detach(datum/ai_controller/target_controller)
|
|
. = ..()
|
|
UnregisterSignal(target_controller, COMSIG_AI_CONTROLLER_POSSESSED_PAWN)
|
|
if(target_controller.pawn && ishuman(target_controller.pawn))
|
|
UnregisterSignal(target_controller.pawn, COMSIG_ORGAN_IMPLANTED)
|
|
|
|
/// Signal when the ai controller possesses a pawn
|
|
/datum/element/ai_control_examine/proc/on_ai_controller_possessed_pawn(datum/ai_controller/source_controller)
|
|
SIGNAL_HANDLER
|
|
|
|
if(!ishuman(source_controller.pawn))
|
|
return //not supported
|
|
var/mob/living/carbon/human/human_pawn = source_controller.pawn
|
|
//make current organs noticable
|
|
for(var/organ_slot_key in noticable_organ_examines)
|
|
var/obj/item/organ/found = human_pawn.get_organ_slot(organ_slot_key)
|
|
if(!found)
|
|
continue
|
|
make_organ_noticable(organ_slot_key, found, human_pawn)
|
|
//listen for future insertions (the element removes itself on removal, so we can ignore organ removal)
|
|
RegisterSignal(human_pawn, COMSIG_ORGAN_IMPLANTED, PROC_REF(on_organ_implanted))
|
|
|
|
/datum/element/ai_control_examine/proc/on_organ_implanted(obj/item/organ/possibly_noticable, mob/living/carbon/receiver)
|
|
SIGNAL_HANDLER
|
|
if(noticable_organ_examines[possibly_noticable.slot])
|
|
make_organ_noticable(possibly_noticable.slot, possibly_noticable)
|
|
|
|
/datum/element/ai_control_examine/proc/make_organ_noticable(organ_slot, obj/item/organ/noticable_organ, mob/living/carbon/human/human_pawn)
|
|
var/examine_text = noticable_organ_examines[organ_slot]
|
|
var/body_zone = organ_slot != ORGAN_SLOT_BRAIN ? noticable_organ.zone : null
|
|
noticable_organ.AddElement(/datum/element/noticable_organ/ai_control, examine_text, body_zone)
|