|
9 | 9 | new /datum/wire_description(SMES_WIRE_FAILSAFES, "This wire appears to connect to a failsafe mechanism.") |
10 | 10 | ) |
11 | 11 |
|
12 | | -var/global/const/SMES_WIRE_RCON = 1 // Remote control (AI and consoles), cut to disable |
13 | | -var/global/const/SMES_WIRE_INPUT = 2 // Input wire, cut to disable input, pulse to disable for 60s |
14 | | -var/global/const/SMES_WIRE_OUTPUT = 4 // Output wire, cut to disable output, pulse to disable for 60s |
15 | | -var/global/const/SMES_WIRE_GROUNDING = 8 // Cut to quickly discharge causing sparks, pulse to only create few sparks |
16 | | -var/global/const/SMES_WIRE_FAILSAFES = 16 // Cut to disable failsafes, mend to reenable |
17 | | - |
18 | | - |
19 | | -/datum/wires/smes/CanUse(var/mob/living/L) |
20 | | - var/obj/machinery/power/smes/buildable/S = holder |
21 | | - if(!S.grounding && S.powernet && S.powernet.avail) |
22 | | - electrocute_mob(L, S.powernet, S, S.safeties_enabled? 0.1 : 1) |
23 | | - if(S.panel_open) |
24 | | - return 1 |
25 | | - return 0 |
| 12 | +/// Remote control (AI and consoles), cut to disable |
| 13 | +var/global/const/SMES_WIRE_RCON = BITFLAG(0) |
| 14 | +/// Input wire, cut to disable input, pulse to disable for 60s |
| 15 | +var/global/const/SMES_WIRE_INPUT = BITFLAG(1) |
| 16 | +/// Output wire, cut to disable output, pulse to disable for 60s |
| 17 | +var/global/const/SMES_WIRE_OUTPUT = BITFLAG(2) |
| 18 | +/// Cut to quickly discharge causing sparks, pulse to only create few sparks |
| 19 | +var/global/const/SMES_WIRE_GROUNDING = BITFLAG(3) |
| 20 | +/// Cut to disable failsafes, mend to reenable |
| 21 | +var/global/const/SMES_WIRE_FAILSAFES = BITFLAG(4) |
26 | 22 |
|
| 23 | +/datum/wires/smes/CanUse(var/mob/living/user) |
| 24 | + var/obj/machinery/power/smes/buildable/storage = holder |
| 25 | + if(!storage.grounding && storage.powernet && storage.powernet.avail) |
| 26 | + electrocute_mob(user, storage.powernet, storage, (storage.safeties_enabled? 0.1 : 1)) |
| 27 | + return storage.panel_open |
27 | 28 |
|
28 | 29 | /datum/wires/smes/GetInteractWindow(mob/user) |
29 | | - var/obj/machinery/power/smes/buildable/S = holder |
| 30 | + var/obj/machinery/power/smes/buildable/storage = holder |
30 | 31 | . += ..() |
31 | | - . += "The green light is [(S.input_cut || S.input_pulsed || S.output_cut || S.output_pulsed) ? "off" : "on"]<br>" |
32 | | - . += "The red light is [(S.safeties_enabled || S.grounding) ? "off" : "blinking"]<br>" |
33 | | - . += "The blue light is [S.RCon ? "on" : "off"]" |
34 | | - |
| 32 | + . += "The green light is [(storage.input_cut || storage.input_pulsed || storage.output_cut || storage.output_pulsed) ? "off" : "on"]<br>" |
| 33 | + . += "The red light is [(storage.safeties_enabled || storage.grounding) ? "off" : "blinking"]<br>" |
| 34 | + . += "The blue light is [storage.RCon ? "on" : "off"]" |
35 | 35 |
|
36 | 36 | /datum/wires/smes/UpdateCut(var/index, var/mended) |
37 | | - var/obj/machinery/power/smes/buildable/S = holder |
| 37 | + var/obj/machinery/power/smes/buildable/storage = holder |
38 | 38 | switch(index) |
39 | 39 | if(SMES_WIRE_RCON) |
40 | | - S.RCon = mended |
| 40 | + storage.RCon = mended |
41 | 41 | if(SMES_WIRE_INPUT) |
42 | | - S.input_cut = !mended |
| 42 | + storage.input_cut = !mended |
43 | 43 | if(SMES_WIRE_OUTPUT) |
44 | | - S.output_cut = !mended |
| 44 | + storage.output_cut = !mended |
45 | 45 | if(SMES_WIRE_GROUNDING) |
46 | | - S.grounding = mended |
| 46 | + storage.grounding = mended |
47 | 47 | if(SMES_WIRE_FAILSAFES) |
48 | | - S.safeties_enabled = mended |
| 48 | + storage.safeties_enabled = mended |
49 | 49 |
|
50 | 50 | /datum/wires/smes/proc/reset_rcon() |
51 | | - var/obj/machinery/power/smes/buildable/S = holder |
52 | | - if(S) |
53 | | - S.RCon = TRUE |
| 51 | + var/obj/machinery/power/smes/buildable/storage = holder |
| 52 | + if(storage) |
| 53 | + storage.RCon = TRUE |
54 | 54 |
|
55 | 55 | /datum/wires/smes/proc/reset_safeties() |
56 | | - var/obj/machinery/power/smes/buildable/S = holder |
57 | | - if(S) |
58 | | - S.safeties_enabled = TRUE |
| 56 | + var/obj/machinery/power/smes/buildable/storage = holder |
| 57 | + if(storage) |
| 58 | + storage.safeties_enabled = TRUE |
59 | 59 |
|
60 | 60 | /datum/wires/smes/UpdatePulsed(var/index) |
61 | | - var/obj/machinery/power/smes/buildable/S = holder |
| 61 | + var/obj/machinery/power/smes/buildable/storage = holder |
62 | 62 | switch(index) |
63 | 63 | if(SMES_WIRE_RCON) |
64 | | - if(S.RCon) |
65 | | - S.RCon = 0 |
| 64 | + if(storage.RCon) |
| 65 | + storage.RCon = 0 |
66 | 66 | addtimer(CALLBACK(src, PROC_REF(reset_rcon)), 1 SECOND) |
67 | 67 | if(SMES_WIRE_INPUT) |
68 | | - S.toggle_input() |
| 68 | + storage.toggle_input() |
69 | 69 | if(SMES_WIRE_OUTPUT) |
70 | | - S.toggle_output() |
| 70 | + storage.toggle_output() |
71 | 71 | if(SMES_WIRE_GROUNDING) |
72 | | - S.grounding = 0 |
| 72 | + storage.grounding = 0 |
73 | 73 | if(SMES_WIRE_FAILSAFES) |
74 | | - if(S.safeties_enabled) |
75 | | - S.safeties_enabled = 0 |
| 74 | + if(storage.safeties_enabled) |
| 75 | + storage.safeties_enabled = 0 |
76 | 76 | addtimer(CALLBACK(src, PROC_REF(reset_safeties)), 1 SECOND) |
0 commit comments