Files
Bubberstation/code/datums/actions/mobs/sneak.dm
John Willard 8d14688256 Fixes some issues with paper planes (#81453)
## About The Pull Request

1. paper's examine was defined twice, which made spacemandmm throw a
minor notice about
2. paper's altclick had a second arg for some item, which would never be
the case because that's not a real arg
3. there was a check for src's type, now just removed to the type's
altclick
4. some papercode was sitting in paper plane code file, now moved

the rest is misc changes such as replacing camelCase and using SECONDS.

## Why It's Good For The Game

None of this is player-facing but it's updating some rather old code to
more modern code standards.

## Changelog

Nothing player-facing.

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2024-02-17 17:41:10 +01:00

37 lines
1.3 KiB
Plaintext

/datum/action/cooldown/mob_cooldown/sneak
name = "Sneak"
desc = "Blend into the environment."
button_icon = 'icons/mob/actions/actions_animal.dmi'
button_icon_state = "sniper_zoom"
background_icon_state = "bg_alien"
overlay_icon_state = "bg_alien_border"
cooldown_time = 0.5 SECONDS
melee_cooldown_time = 0 SECONDS
click_to_activate = FALSE
/// The alpha we go to when sneaking.
var/sneak_alpha = 75
/// How long it takes to become transparent
var/animation_time = 0.5 SECONDS
/datum/action/cooldown/mob_cooldown/sneak/Remove(mob/living/remove_from)
if(HAS_TRAIT(remove_from, TRAIT_SNEAK))
remove_from.alpha = initial(remove_from.alpha)
REMOVE_TRAIT(remove_from, TRAIT_SNEAK, ACTION_TRAIT)
return ..()
/datum/action/cooldown/mob_cooldown/sneak/Activate(atom/target)
if(HAS_TRAIT(owner, TRAIT_SNEAK))
// It's safest to go to the initial alpha of the mob.
// Otherwise we get permanent invisbility exploits.
animate(owner, alpha = initial(owner.alpha), time = animation_time)
owner.balloon_alert(owner, "you reveal yourself")
REMOVE_TRAIT(owner, TRAIT_SNEAK, ACTION_TRAIT)
else
animate(owner, alpha = sneak_alpha, time = animation_time)
owner.balloon_alert(owner, "you blend into the environment")
ADD_TRAIT(owner, TRAIT_SNEAK, ACTION_TRAIT)
return TRUE