Files
Paradise/code/game/machinery/igniter.dm
FalseIncarnate 1caf39230a Logic Gates WIP 3
Allows mass driver buttons to send logic signals
- They send LOGIC_FLICKER, since they are only on when pressed, then
turn off when released
- Can send logic signals to a different ID tag than their associated
driver/door ID tag, configurable from the multitool menu

Allows light switches to send logic signals
- Will send LOGIC_ON or LOGIC_OFF signals to match their current state
- Send both when toggled and on the process() cycle
- Light control can be toggled via the multitool menu, so you can use
them as purely light switches, purely logic switches, or as dual
switches

Allows light switches to be made from metal sheets, just like mass
driver buttons (1 sheet per button)
- Fixes a resource duplication bug where driver buttons can be
disassembled for more metal than it takes to build them

Begins to move some code for various button types into the buttons.dm
file, rather than being scattered across multiple files
- Driver buttons code moved from door_control.dm
- Ignition switch code moved from igniter.dm

Renames driver_button.dm to buttons_switches.dm
- This is the file that contained the mountable frames for driver
buttons, and now also contains the frame for light switches.
2016-03-29 03:11:42 -04:00

117 lines
2.8 KiB
Plaintext
Executable File

/obj/machinery/igniter
name = "igniter"
desc = "It's useful for igniting plasma."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "igniter1"
var/id = null
var/on = 1.0
anchored = 1.0
use_power = 1
idle_power_usage = 2
active_power_usage = 4
/obj/machinery/igniter/attack_ai(mob/user as mob)
return src.attack_hand(user)
/obj/machinery/igniter/attack_hand(mob/user as mob)
if(..())
return
add_fingerprint(user)
use_power(50)
src.on = !( src.on )
src.icon_state = text("igniter[]", src.on)
return
/obj/machinery/igniter/process() //ugh why is this even in process()?
if (src.on && !(stat & NOPOWER) )
var/turf/location = src.loc
if (isturf(location))
location.hotspot_expose(1000,500,1)
return 1
/obj/machinery/igniter/New()
..()
icon_state = "igniter[on]"
/obj/machinery/igniter/power_change()
if(!( stat & NOPOWER) )
icon_state = "igniter[src.on]"
else
icon_state = "igniter0"
// Wall mounted remote-control igniter.
/obj/machinery/sparker
name = "Mounted igniter"
desc = "A wall-mounted ignition device."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "migniter"
var/id = null
var/disable = 0
var/last_spark = 0
var/base_state = "migniter"
anchored = 1
/obj/machinery/sparker/New()
..()
/obj/machinery/sparker/power_change()
if ( powered() && disable == 0 )
stat &= ~NOPOWER
icon_state = "[base_state]"
// src.sd_set_light(2)
else
stat |= ~NOPOWER
icon_state = "[base_state]-p"
// src.sd_set_light(0)
/obj/machinery/sparker/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/device/detective_scanner))
return
if (istype(W, /obj/item/weapon/screwdriver))
add_fingerprint(user)
src.disable = !src.disable
if (src.disable)
user.visible_message("\red [user] has disabled the [src]!", "\red You disable the connection to the [src].")
icon_state = "[base_state]-d"
if (!src.disable)
user.visible_message("\red [user] has reconnected the [src]!", "\red You fix the connection to the [src].")
if(src.powered())
icon_state = "[base_state]"
else
icon_state = "[base_state]-p"
/obj/machinery/sparker/attack_ai()
if (src.anchored)
return src.spark()
else
return
/obj/machinery/sparker/proc/spark()
if (!(powered()))
return
if ((src.disable) || (src.last_spark && world.time < src.last_spark + 50))
return
flick("[base_state]-spark", src)
var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread
s.set_up(2, 1, src)
s.start()
src.last_spark = world.time
use_power(1000)
var/turf/location = src.loc
if (isturf(location))
location.hotspot_expose(1000,500,1)
return 1
/obj/machinery/sparker/emp_act(severity)
if(stat & (BROKEN|NOPOWER))
..(severity)
return
spark()
..(severity)