Refactor Fire Alarm item_interaction() (#28136)

* Update firealarm.dm

* revert

* Update code/game/machinery/firealarm.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com>

---------

Signed-off-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
CRUNCH
2025-02-10 04:01:29 +00:00
committed by GitHub
co-authored by Burzah
parent 7518262c6e
commit 0e558089ac
+20 -15
View File
@@ -127,24 +127,28 @@ FIRE ALARM
/obj/machinery/firealarm/item_interaction(mob/living/user, obj/item/used, list/modifiers)
add_fingerprint(user)
if(wiresexposed)
if(buildstage == FIRE_ALARM_UNWIRED && istype(used, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = used
if(!coil.use(5))
to_chat(user, "<span class='warning'>You need a total of five cables to wire [src]!</span>")
return ITEM_INTERACT_COMPLETE
if(!wiresexposed)
return ..()
buildstage = FIRE_ALARM_READY
playsound(get_turf(src), used.usesound, 50, 1)
to_chat(user, "<span class='notice'>You wire [src]!</span>")
update_icon()
else if(buildstage == FIRE_ALARM_FRAME && istype(used, /obj/item/firealarm_electronics))
to_chat(user, "<span class='notice'>You insert the circuit!</span>")
qdel(used)
buildstage = FIRE_ALARM_UNWIRED
update_icon()
if(buildstage == FIRE_ALARM_UNWIRED && istype(used, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = used
if(!coil.use(5))
to_chat(user, "<span class='warning'>You need a total of five cables to wire [src]!</span>")
return ITEM_INTERACT_COMPLETE
buildstage = FIRE_ALARM_READY
playsound(get_turf(src), used.usesound, 50, TRUE)
to_chat(user, "<span class='notice'>You wire [src]!</span>")
update_icon()
return ITEM_INTERACT_COMPLETE
if(buildstage == FIRE_ALARM_FRAME && istype(used, /obj/item/firealarm_electronics))
to_chat(user, "<span class='notice'>You insert the circuit!</span>")
qdel(used)
buildstage = FIRE_ALARM_UNWIRED
update_icon()
return ITEM_INTERACT_COMPLETE
return ..()
/obj/machinery/firealarm/crowbar_act(mob/user, obj/item/I)
@@ -198,6 +202,7 @@ FIRE ALARM
return
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
update_icon()
WIRECUTTER_SNIP_MESSAGE
var/obj/item/stack/cable_coil/new_coil = new /obj/item/stack/cable_coil(drop_location())
new_coil.amount = 5