[MIRROR] Fixes Luminescence actions [MDB IGNORE] (#19698)

* Fixes Luminescence actions (#73802)

## About The Pull Request

- Add Component was supposed to use a named arg, quick fix
- While testing the fix I noticed it doesn't properly remove the
appearance when the item is lost, cuts the overlay on failures

## Why It's Good For The Game

Mothblox said this broke things (it was making a weakref of a callback
on accident)

## Changelog

🆑 Melbert
fix: Luminsecent slime actions correctly update their appearance when
integrating or ejecting slime cores
/🆑

* Fixes Luminescence actions

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-03-06 18:22:37 -08:00
committed by GitHub
co-authored by MrMelbert
parent a875a8d36d
commit e62df8f5f0
2 changed files with 11 additions and 5 deletions
@@ -15,6 +15,8 @@
if(!istype(parent, /datum/action))
return COMPONENT_INCOMPATIBLE
ASSERT(isnull(item) || istype(item))
if(!item && !item_callback)
stack_trace("[type] created without a reference item or an item callback - one or the other is required.")
return COMPONENT_INCOMPATIBLE
@@ -48,13 +50,17 @@
SIGNAL_HANDLER
// We're in the middle of being removed / deleted, remove our associated overlay
if(QDELING(src) && item_appearance)
current_button.cut_overlay(item_appearance)
item_appearance = null
if(QDELING(src))
if(item_appearance)
current_button.cut_overlay(item_appearance)
item_appearance = null
return
var/atom/movable/muse = item_callback?.Invoke() || item_ref?.resolve()
if(!istype(muse))
if(item_appearance) // New item does not exist but we have an old appearance
current_button.cut_overlay(item_appearance)
item_appearance = null
return
if(item_appearance)