Skip to content

Commit

Permalink
Refactor Fire Alarm item_interaction() (ParadiseSS13#28136)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Fordoxia and Burzah authored Feb 10, 2025
1 parent 7518262 commit 0e55808
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions code/game/machinery/firealarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

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(!wiresexposed)
return ..()

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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0e55808

Please sign in to comment.