From f32caa759b6c0690ae60be6f6425b6738548b935 Mon Sep 17 00:00:00 2001 From: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Date: Wed, 4 Oct 2023 20:34:50 -0400 Subject: [PATCH] fixes sparkers (#9956) --- code/game/machinery/igniter.dm | 56 ++++++++++++++++------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index 734d2dfa5e28e..0a36e83f6e813 100644 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -3,6 +3,7 @@ desc = "It's useful for igniting plasma." icon = 'icons/obj/stationobjs.dmi' icon_state = "igniter0" + base_icon_state = "igniter" plane = FLOOR_PLANE use_power = IDLE_POWER_USE idle_power_usage = 2 @@ -35,11 +36,11 @@ use_power(50) on = !( on ) - update_icon() + update_appearance() /obj/machinery/igniter/process() //ugh why is this even in process()? - if (src.on && !(machine_stat & NOPOWER) ) - var/turf/location = src.loc + if (on && !(machine_stat & NOPOWER) ) + var/turf/location = loc if (isturf(location)) location.hotspot_expose(1000,500,1) return 1 @@ -58,11 +59,9 @@ return ..() -/obj/machinery/igniter/update_icon() - if(machine_stat & NOPOWER) - icon_state = "igniter0" - else - icon_state = "igniter[on]" +/obj/machinery/igniter/update_icon_state() + icon_state = "[base_icon_state][(machine_stat & NOPOWER) ? 0 : on]" + return ..() // Wall mounted remote-control igniter. @@ -71,6 +70,7 @@ desc = "A wall-mounted ignition device." icon = 'icons/obj/stationobjs.dmi' icon_state = "migniter" + base_icon_state = "migniter" resistance_flags = FIRE_PROOF layer = ABOVE_WINDOW_LAYER var/id = null @@ -91,34 +91,32 @@ QDEL_NULL(spark_system) return ..() -/obj/machinery/sparker/update_icon() +/obj/machinery/sparker/update_icon_state() if(disable) - icon_state = "[initial(icon_state)]-d" - else if(powered()) - icon_state = "[initial(icon_state)]" - else - icon_state = "[initial(icon_state)]-p" + icon_state = "[base_icon_state]-d" + return ..() + icon_state = "[base_icon_state][powered() ? null : "-p"]" + return ..() /obj/machinery/sparker/powered() - if(!disable) + if(disable) return FALSE return ..() -/obj/machinery/sparker/attackby(obj/item/W, mob/user, params) - if (W.tool_behaviour == TOOL_SCREWDRIVER) - add_fingerprint(user) - src.disable = !src.disable - if (src.disable) - user.visible_message("[user] has disabled \the [src]!", "You disable the connection to \the [src].") - if (!src.disable) - user.visible_message("[user] has reconnected \the [src]!", "You fix the connection to \the [src].") - update_icon() - else - return ..() +/obj/machinery/sparker/screwdriver_act(mob/living/user, obj/item/tool) + add_fingerprint(user) + tool.play_tool_sound(src, 50) + disable = !disable + if (disable) + user.visible_message("[user] has disabled \the [src]!", "You disable the connection to \the [src].") + if (!disable) + user.visible_message("[user] has reconnected \the [src]!", "You fix the connection to \the [src].") + update_appearance() + return TRUE /obj/machinery/sparker/attack_ai() if (anchored) - return src.ignite() + return ignite() else return @@ -126,7 +124,7 @@ if (!(powered())) return - if ((src.disable) || (src.last_spark && world.time < src.last_spark + 50)) + if ((disable) || (last_spark && world.time < last_spark + 50)) return @@ -134,7 +132,7 @@ spark_system.start() last_spark = world.time use_power(1000) - var/turf/location = src.loc + var/turf/location = loc if (isturf(location)) location.hotspot_expose(1000,2500,1) return 1