Skip to content

Commit

Permalink
fixes sparkers (#9956)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsar-Salat authored Oct 5, 2023
1 parent a733b5f commit f32caa7
Showing 1 changed file with 27 additions and 29 deletions.
56 changes: 27 additions & 29 deletions code/game/machinery/igniter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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.

Expand All @@ -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
Expand All @@ -91,50 +91,48 @@
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]!", "<span class='notice'>You disable the connection to \the [src].</span>")
if (!src.disable)
user.visible_message("[user] has reconnected \the [src]!", "<span class='notice'>You fix the connection to \the [src].</span>")
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]!", "<span class='notice'>You disable the connection to \the [src].</span>")
if (!disable)
user.visible_message("[user] has reconnected \the [src]!", "<span class='notice'>You fix the connection to \the [src].</span>")
update_appearance()
return TRUE

/obj/machinery/sparker/attack_ai()
if (anchored)
return src.ignite()
return ignite()
else
return

/obj/machinery/sparker/proc/ignite()
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


flick("[initial(icon_state)]-spark", src)
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
Expand Down

0 comments on commit f32caa7

Please sign in to comment.