Files
Bubberstation/code/datums/components/telegraph_ability.dm
SkyratBot 3bbd9a254a [MIRROR] basic ice whelps [MDB IGNORE] (#23077)
* basic ice whelps (#77493)

## About The Pull Request
i have refactored ice whelps into basic mobs. They are now the artistic
sort as theyll mark their territory by seeking out icy rocks and carve
out statues of theirselves using their claws to serve as a warning to
players/animals that this is dragon turf and theyll also go out of their
way to burn any trees in vicinity just for the hell of it. they are now
gruesome cannibals if they find a corpse of one of their kin near them
theyll go eat it for nurishment. AS for combat, they have a new ability
which allows them to release fire in all directions however theyll only
use this ability once their enraged meter is full. to make it fair ive
given them a new component which allows them to telegraph abilities and
only do them after a delay so players can react in time for it.

## Why It's Good For The Game
basic mob refactor

## Changelog
🆑
refactor: ice whelps have been refactored to basic mobs
add: ice whelps have a new dangerous ability which theyll use once their
enraged meter is full
/🆑

* basic ice whelps

* Modular paths

---------

Co-authored-by: SMOSMOSMOSMOSMO <95004236+SmoSmoSmoSmok@users.noreply.github.com>
Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com>
2023-08-14 19:17:20 -04:00

51 lines
1.8 KiB
Plaintext

/**
* Component given to creatures to telegraph their abilities!
*/
/datum/component/basic_mob_ability_telegraph
/// how long before we use our attack
var/telegraph_time
/// sound to play, if any
var/sound_path
/// are we currently telegraphing
var/currently_telegraphing = FALSE
/datum/component/basic_mob_ability_telegraph/Initialize(telegraph_time = 1 SECONDS, sound_path)
if(!isliving(parent))
return COMPONENT_INCOMPATIBLE
src.telegraph_time = telegraph_time
src.sound_path = sound_path
/datum/component/basic_mob_ability_telegraph/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOB_ABILITY_STARTED, PROC_REF(on_ability_activate))
/datum/component/basic_mob_ability_telegraph/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_MOB_ABILITY_STARTED)
///delay the ability
/datum/component/basic_mob_ability_telegraph/proc/on_ability_activate(mob/living/source, datum/action/cooldown/activated, atom/target)
SIGNAL_HANDLER
if(currently_telegraphing)
return COMPONENT_BLOCK_ABILITY_START
if(!activated.IsAvailable())
return
currently_telegraphing = TRUE
generate_tell_signs(source)
addtimer(CALLBACK(src, PROC_REF(use_ability), source, activated, target), telegraph_time)
return COMPONENT_BLOCK_ABILITY_START
///generates the telegraph signs to inform the player we're about to launch an attack
/datum/component/basic_mob_ability_telegraph/proc/generate_tell_signs(mob/living/source)
if(sound_path)
playsound(source, sound_path, 50, FALSE)
source.Shake(duration = telegraph_time)
///use the ability
/datum/component/basic_mob_ability_telegraph/proc/use_ability(mob/living/source, datum/action/cooldown/activated, atom/target)
if(!QDELETED(target) && source.stat != DEAD) //target is gone or we died
activated.Activate(target)
currently_telegraphing = FALSE