mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-13 11:01:40 +00:00
* Adjusts spawn times * Incursion Adjustment Part 1 * Skelecurity * Skeleton Officer and Mobster * Skeleton mob drops * Rattle em * New mobs, AI, removed volatile * Nerfs spider * Trait * Config fix * Nerfs juggernauts * Rune effect while reanimating * Linters * Fleshspider Retaliate * Update skeleton_mob.dm * Projectile changes * Event tracker for giant spiders and better tracking for skeletons * Oops * Linter * Apply suggestions from code review Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com> Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> * Lints * Small fix, tries to revive the original player first before selecting dchat * Linters * Fixes mobs not gibbing often enough * Improves incursion rally, undeerifies it * Oops * Update incursion_ai.dm * Removes incursion skeletons from xenobio mobs * No gold core flesh spiders --------- Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com>
74 lines
2.3 KiB
Plaintext
74 lines
2.3 KiB
Plaintext
/// A component for ai-controlled atoms which plays a sound if they switch to a living target which they can attack
|
|
/datum/component/aggro_emote
|
|
/// Blackboard key in which target data is stored
|
|
var/target_key
|
|
/// If we want to limit emotes to only play at mobs
|
|
var/living_only
|
|
/// List of emotes to play
|
|
var/list/emote_list
|
|
/// Chance to play an emote
|
|
var/emote_chance
|
|
/// Chance to subtract every time we play an emote (permanently)
|
|
var/subtract_chance
|
|
/// Minimum chance to play an emote
|
|
var/minimum_chance
|
|
/// Aggro sound
|
|
var/aggro_sound
|
|
/// Volume for the sound
|
|
var/aggro_volume
|
|
/// List of possible things to say
|
|
var/list/say_list
|
|
|
|
/datum/component/aggro_emote/Initialize(
|
|
target_key = BB_BASIC_MOB_CURRENT_TARGET,
|
|
living_only = FALSE,
|
|
list/emote_list,
|
|
aggro_sound = null,
|
|
aggro_volume = 70,
|
|
emote_chance = 30,
|
|
minimum_chance = 2,
|
|
subtract_chance = 7,
|
|
list/say_list,
|
|
)
|
|
. = ..()
|
|
if(!isatom(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
var/atom/atom_parent = parent
|
|
if(!atom_parent.ai_controller)
|
|
return COMPONENT_INCOMPATIBLE
|
|
src.aggro_sound = aggro_sound
|
|
src.aggro_volume = aggro_volume
|
|
src.target_key = target_key
|
|
src.emote_list = emote_list
|
|
src.emote_chance = emote_chance
|
|
src.minimum_chance = minimum_chance
|
|
src.subtract_chance = subtract_chance
|
|
src.say_list = say_list
|
|
|
|
/datum/component/aggro_emote/RegisterWithParent()
|
|
. = ..()
|
|
RegisterSignal(parent, COMSIG_AI_BLACKBOARD_KEY_SET(target_key), PROC_REF(on_target_changed))
|
|
|
|
/datum/component/aggro_emote/UnregisterFromParent()
|
|
UnregisterSignal(parent, COMSIG_AI_BLACKBOARD_KEY_SET(target_key))
|
|
return ..()
|
|
|
|
/// When we get a new target, see if we want to bark at it
|
|
/datum/component/aggro_emote/proc/on_target_changed(atom/source)
|
|
SIGNAL_HANDLER
|
|
var/atom/new_target = source.ai_controller.blackboard[target_key]
|
|
if(isnull(new_target) || !prob(emote_chance))
|
|
return
|
|
if(living_only && !isliving(new_target))
|
|
return // If we don't want to bark at food items or chairs or windows
|
|
emote_chance = max(emote_chance - subtract_chance, minimum_chance)
|
|
var/mob/living/mob_parent = source
|
|
if(!istype(mob_parent))
|
|
return
|
|
if(emote_list)
|
|
mob_parent.emote("me", EMOTE_VISIBLE, "[pick(emote_list)] at [new_target].")
|
|
if(aggro_sound)
|
|
playsound(mob_parent.loc, aggro_sound, aggro_volume, TRUE)
|
|
if(say_list)
|
|
mob_parent.say(pick(say_list))
|