Files
Bubberstation/code/datums/elements/earhealing.dm
SkyratBot 0a1f06a2d1 [MIRROR] This tail refactor turned into an organ refactor. Funny how that works. [MDB IGNORE] (#14017)
* This tail refactor turned into an organ refactor. Funny how that works.

* Firstly, fixing all the conflicts.

* Fixes all our maps (hopefully)

* Actually, this should fix pod people hair :)

* Almost everything is working, just two major things to fix

* Fixed a certain kind of external organ

* Cleaning up some more stuff

* Turned tail_cat into tail because why the fuck are they separate?

* Moved all the tails into tails.dmi because that was just dumb to have like 3 in a different file

* Adds relevant_layers to organs to help with rendering

* Makes stored_feature_id also check mutant_bodyparts

* Fixes the icon_state names of ALL the tails (pain)

* Fixes wagging, gotta refactor most mutant bodyparts later on

* I Love Added Failures

* Fixed some organs that slipped through my searches

* This could possibly fix the CI for this?

* It doesn't look like it did fix it

* This will make it pass, even if it's ugly as sin.

* Fixed Felinids having a weird ghost tail

* Fixes instances of snouts and tails not being properly colored

Co-authored-by: Kapu1178 <75460809+Kapu1178@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
2022-06-11 23:20:16 -04:00

37 lines
1.2 KiB
Plaintext

/datum/element/earhealing
element_flags = ELEMENT_DETACH
var/list/user_by_item = list()
/datum/element/earhealing/New()
START_PROCESSING(SSdcs, src)
/datum/element/earhealing/Attach(datum/target)
. = ..()
if(!isitem(target))
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED), .proc/equippedChanged)
/datum/element/earhealing/Detach(datum/target)
. = ..()
UnregisterSignal(target, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED))
user_by_item -= target
/datum/element/earhealing/proc/equippedChanged(datum/source, mob/living/carbon/user, slot)
SIGNAL_HANDLER
if(slot == ITEM_SLOT_EARS && istype(user))
user_by_item[source] = user
else
user_by_item -= source
/datum/element/earhealing/process(delta_time)
for(var/i in user_by_item)
var/mob/living/carbon/user = user_by_item[i]
var/obj/item/organ/internal/ears/ears = user.getorganslot(ORGAN_SLOT_EARS)
if(!ears || HAS_TRAIT_NOT_FROM(user, TRAIT_DEAF, EAR_DAMAGE))
continue
ears.deaf = max(ears.deaf - 0.25 * delta_time, (ears.damage < ears.maxHealth ? 0 : 1)) // Do not clear deafness if our ears are too damaged
ears.applyOrganDamage(-0.025 * delta_time, 0)
CHECK_TICK