Files
Bubberstation/code/datums/elements/simple_flying.dm
MrMelbert 34f3f479ae Small hulk cleanup / nukes TRAIT_IGNOREDAMAGESLOWDOWN (#85003)
## About The Pull Request

I was investigating a bug with hulk in which using it while damaged
doesn't put you back on full speed

I noticed `TRAIT_IGNOREDAMAGESLOWDOWN` on its own was subtly broken, in
that it did nothing if the user did not call `updatehealth` afterwards

And guess what, most (if not all) uses of the trait did not do this, so
it never applied correctly

So I nuked the trait entirely, made all uses of it use the same thing
morphine uses (`/datum/movespeed_modifier/damage_slowdown`)

And since I was auditing this I saw the ball module was broke, it
removed the immunity but never added it. Quick fix

I also cleaned up some Hulk stuff while I was in the area because I was
in the area. I removed all instances of `check_mutation` and replaced it
with trait checking because it made more sense.

I also also fixed a bug with the simple flying element never removing on
detach because I touched something that uses it for the above change.

## Changelog

🆑 Melbert
fix: Using hulk (and a myriad of similar effects) now properly updates
your movespeed to ignore the damage movespeed penalty
fix: Some things which temporarily make you fly don't make you fly
forever
fix: MODsuit ball module now properly makes you immune to damage
movespeed penalty when in ball form
fix: Adding Hulk via VV dropdown doesn't default to adding the strongest
hulk available (that which is used by the medieval pirates)
/🆑
2024-07-17 01:14:08 +02:00

30 lines
1.1 KiB
Plaintext

/**
* # simple flying element!
*
* Non bespoke element (1 in existence) that makes animals fly while living and... not while dead!
* Note: works for carbons and above, but please do something better. humans have wings got dangit!
*/
/datum/element/simple_flying
/datum/element/simple_flying/Attach(datum/target)
. = ..()
if(!isliving(target))
return ELEMENT_INCOMPATIBLE
var/mob/living/valid_target = target
on_stat_change(valid_target, new_stat = valid_target.stat) //immediately try adding flight if they're conscious
RegisterSignal(target, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_change))
/datum/element/simple_flying/Detach(datum/target)
. = ..()
UnregisterSignal(target, COMSIG_MOB_STATCHANGE)
REMOVE_TRAIT(target, TRAIT_MOVE_FLYING, ELEMENT_TRAIT(type))
///signal called by the stat of the target changing
/datum/element/simple_flying/proc/on_stat_change(mob/living/target, new_stat)
SIGNAL_HANDLER
if(new_stat == CONSCIOUS)
ADD_TRAIT(target, TRAIT_MOVE_FLYING, ELEMENT_TRAIT(type))
else
REMOVE_TRAIT(target, TRAIT_MOVE_FLYING, ELEMENT_TRAIT(type))