Files
Bubberstation/code/datums/elements/update_icon_updates_onmob.dm
MrPerson e22560a346 update_icon() improvements (#48669)
* update_icon() improvements

Fixes some update_icon() calls to properly call parent and use update_overlays() and update_icon_state().

The rest of obj/item fuck it

* Suggested fixes, also passes the linter

* I always forget . = ..() is faster than return ..() FOR SOME FUCKING REASON

* Actually this is better

* Signilzes datum/action to update its icon when its connected item does.
2020-01-11 23:46:43 -05:00

17 lines
582 B
Plaintext

//update_icon() may change the onmob icons
//Very good name, I know
/datum/element/update_icon_updates_onmob/Attach(datum/target)
. = ..()
if(!istype(target, /obj/item))
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, COMSIG_ATOM_UPDATED_ICON, .proc/update_onmob)
/datum/element/update_icon_updates_onmob/proc/update_onmob(obj/item/target)
if(ismob(target.loc))
var/mob/M = target.loc
if(M.is_holding(target))
M.update_inv_hands()
else
M.regenerate_icons() //yeah this is shit, but we don't know which update_foo() proc to call instead so we'll call them all