[MIRROR] cleans up the light replacer's redundant Emag() proc [MDB IGNORE] (#20484)

* cleans up the light replacer's redundant Emag() proc (#74628)

🆑 ShizCalev
code: Vareditting a light replacer's emagged status will now properly
update the item's name / appearance.
/🆑

No behavior change aside from varedits updating the item's appearance
properly.

* cleans up the light replacer's redundant Emag() proc

---------

Co-authored-by: ShizCalev <ShizCalev@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-04-11 14:01:17 +02:00
committed by GitHub
parent 8293ad4e67
commit bd086d8a9d
@@ -138,7 +138,23 @@
/obj/item/lightreplacer/emag_act()
if(obj_flags & EMAGGED)
return
Emag()
obj_flags |= EMAGGED
playsound(loc, SFX_SPARKS, 100, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
update_appearance()
/obj/item/lightreplacer/update_name(updates)
. = ..()
name = (obj_flags & EMAGGED) ? "shortcircuited [initial(name)]" : initial(name)
/obj/item/lightreplacer/update_icon_state()
icon_state = "[initial(icon_state)][(obj_flags & EMAGGED ? "-emagged" : "")]"
return ..()
/obj/item/lightreplacer/vv_edit_var(vname, vval)
if(vname == NAMEOF(src, obj_flags))
update_appearance()
return ..()
/obj/item/lightreplacer/attack_self(mob/user)
for(var/obj/machinery/light/target in user.loc)
@@ -182,10 +198,6 @@
user.Beam(target, icon_state = "rped_upgrade", time = 1 SECONDS)
playsound(src, 'sound/items/pshoom.ogg', 40, 1)
/obj/item/lightreplacer/update_icon_state()
icon_state = "[initial(icon_state)][(obj_flags & EMAGGED ? "-emagged" : "")]"
return ..()
/obj/item/lightreplacer/proc/status_string()
return "It has [uses] light\s remaining (plus [bulb_shards] fragment\s)."
@@ -247,15 +259,6 @@
to_chat(user, span_notice("You replace \the [target.fitting] with \the [src]."))
return TRUE
/obj/item/lightreplacer/proc/Emag()
obj_flags ^= EMAGGED
playsound(src.loc, SFX_SPARKS, 100, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
if(obj_flags & EMAGGED)
name = "shortcircuited [initial(name)]"
else
name = initial(name)
update_appearance()
/obj/item/lightreplacer/proc/can_use(mob/living/user)
src.add_fingerprint(user)
return uses > 0