mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-28 15:39:57 +01:00
Repaths obj/machinery to obj/structure/machinery. **Note for reviewers:** the only meaningful changed code exists within **code/game/objects/structures.dm** and **code/game/objects/structures/_machinery.dm**, largely concerning damage procs. With the exception of moving airlock defines to their own file, ALL OTHER CHANGES ARE STRICTLY PATH CHANGES. Objects, _categorically_, are largely divided between those you can hold in your hand/inventory and those you can't. Machinery objects are already subtypes of Structures behaviorally, this PR just makes their pathing reflect that, and allows for future work (tool actions, more health/destruction functionality) to be developed without unnecessary code duplication. I have tested this PR by loading up the Horizon and dismantling various machines and structures with tools, shooting guns of various types throughout the ship, and detonating a bunch of explosions throughout the ship.
181 lines
4.4 KiB
Plaintext
181 lines
4.4 KiB
Plaintext
/obj/structure/machinery/igniter
|
|
name = "igniter"
|
|
desc = "It's useful for igniting flammable items."
|
|
icon = 'icons/obj/stationobjs.dmi'
|
|
icon_state = "igniter1"
|
|
var/id = null
|
|
var/on = 0
|
|
anchored = 1
|
|
idle_power_usage = 2
|
|
active_power_usage = 4
|
|
var/_wifi_id
|
|
var/datum/wifi/receiver/button/igniter/wifi_receiver
|
|
|
|
/obj/structure/machinery/igniter/Initialize()
|
|
. = ..()
|
|
update_icon()
|
|
if(_wifi_id)
|
|
wifi_receiver = new(_wifi_id, src)
|
|
|
|
/obj/structure/machinery/igniter/update_icon()
|
|
..()
|
|
icon_state = "igniter[on]"
|
|
|
|
/obj/structure/machinery/igniter/Destroy()
|
|
qdel(wifi_receiver)
|
|
wifi_receiver = null
|
|
return ..()
|
|
|
|
/obj/structure/machinery/igniter/attack_ai(mob/user as mob)
|
|
if(!ai_can_interact(user))
|
|
return
|
|
return src.attack_hand(user)
|
|
|
|
/obj/structure/machinery/igniter/attack_hand(mob/user as mob)
|
|
if(..())
|
|
return
|
|
add_fingerprint(user)
|
|
ignite()
|
|
return
|
|
|
|
/obj/structure/machinery/igniter/process() //ugh why is this even in process()?
|
|
if (on && powered() )
|
|
var/turf/location = src.loc
|
|
if (isturf(location))
|
|
location.hotspot_expose(1000,500,1)
|
|
return 1
|
|
|
|
/obj/structure/machinery/igniter/power_change()
|
|
..()
|
|
update_icon()
|
|
|
|
/obj/structure/machinery/igniter/proc/ignite()
|
|
use_power_oneoff(50)
|
|
on = !on
|
|
if(on)
|
|
START_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF)
|
|
else
|
|
STOP_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF)
|
|
update_icon()
|
|
|
|
|
|
// Wall mounted remote-control igniter.
|
|
|
|
/obj/structure/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
|
|
idle_power_usage = 2
|
|
active_power_usage = 4
|
|
var/_wifi_id
|
|
var/datum/wifi/receiver/button/sparker/wifi_receiver
|
|
|
|
/obj/structure/machinery/sparker/Initialize()
|
|
. = ..()
|
|
if(_wifi_id)
|
|
wifi_receiver = new(_wifi_id, src)
|
|
|
|
/obj/structure/machinery/sparker/Destroy()
|
|
qdel(wifi_receiver)
|
|
wifi_receiver = null
|
|
return ..()
|
|
|
|
/obj/structure/machinery/sparker/update_icon()
|
|
..()
|
|
if(disable)
|
|
icon_state = "migniter-d"
|
|
else if(powered())
|
|
icon_state = "migniter"
|
|
// src.sd_SetLuminosity(2)
|
|
else
|
|
icon_state = "migniter-p"
|
|
// src.sd_SetLuminosity(0)
|
|
|
|
/obj/structure/machinery/sparker/power_change()
|
|
..()
|
|
update_icon()
|
|
|
|
/obj/structure/machinery/sparker/attackby(obj/item/attacking_item, mob/user)
|
|
if (attacking_item.tool_behaviour == TOOL_SCREWDRIVER)
|
|
add_fingerprint(user)
|
|
disable = !disable
|
|
if(disable)
|
|
user.visible_message(SPAN_WARNING("[user] has disabled the [src]!"), SPAN_WARNING("You disable the connection to the [src]."))
|
|
else if(!disable)
|
|
user.visible_message(SPAN_WARNING("[user] has reconnected the [src]!"), SPAN_WARNING("You fix the connection to the [src]."))
|
|
update_icon()
|
|
return TRUE
|
|
|
|
/obj/structure/machinery/sparker/attack_ai(mob/user)
|
|
if(!ai_can_interact(user))
|
|
return
|
|
if (anchored)
|
|
return ignite()
|
|
|
|
/obj/structure/machinery/sparker/proc/ignite()
|
|
if (!powered())
|
|
return
|
|
|
|
if (disable || (last_spark && world.time < last_spark + 50))
|
|
return
|
|
|
|
|
|
flick("migniter-spark", src)
|
|
spark(src, 2, GLOB.alldirs)
|
|
src.last_spark = world.time
|
|
use_power_oneoff(1000)
|
|
var/turf/location = src.loc
|
|
if (isturf(location))
|
|
location.hotspot_expose(1000,500,1)
|
|
return 1
|
|
|
|
/obj/structure/machinery/sparker/emp_act(severity)
|
|
. = ..()
|
|
|
|
if(stat & (BROKEN|NOPOWER))
|
|
return
|
|
|
|
ignite()
|
|
|
|
/obj/structure/machinery/button/ignition
|
|
name = "ignition switch"
|
|
desc = "A remote control switch for a mounted igniter."
|
|
active_time = 5 SECONDS
|
|
var/list/datum/weakref/linked_sparkers
|
|
var/list/datum/weakref/linked_igniters
|
|
|
|
/obj/structure/machinery/button/ignition/Initialize()
|
|
..()
|
|
return INITIALIZE_HINT_LATELOAD
|
|
|
|
/obj/structure/machinery/button/ignition/LateInitialize()
|
|
. = ..()
|
|
for (var/obj/structure/machinery/M in SSmachinery.machinery)
|
|
var/obj/structure/machinery/sparker/S = M
|
|
if (istype(S) && S.id == id)
|
|
LAZYADD(linked_sparkers, WEAKREF(S))
|
|
else
|
|
var/obj/structure/machinery/igniter/I = M
|
|
if (istype(I) && I.id == id)
|
|
LAZYADD(linked_igniters, WEAKREF(I))
|
|
|
|
/obj/structure/machinery/button/ignition/activate(mob/living/user)
|
|
if(..())
|
|
return
|
|
|
|
for (var/datum/weakref/W in linked_sparkers)
|
|
var/obj/structure/machinery/sparker/S = W.resolve()
|
|
if(!isnull(S))
|
|
INVOKE_ASYNC(S, TYPE_PROC_REF(/obj/structure/machinery/sparker, ignite))
|
|
|
|
for (var/datum/weakref/W in linked_igniters)
|
|
var/obj/structure/machinery/igniter/I = W.resolve()
|
|
if(!isnull(I))
|
|
I.ignite()
|