mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-28 07:20:09 +01:00
Autolathe and wires panel TGUI, autolathe queueing. (#17978)
* autolathe 1 * FUCK MY LIFE * more fixes * autolathe queueing * cl * garbage collection * wire fixes * some final tweaks * on second thought this might be annoying * fix that * whoopsies * that didn't work for shit --------- Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
@@ -19,12 +19,12 @@
|
||||
src.tracked = tracked
|
||||
|
||||
/datum/component/connect_mob_behalf/RegisterWithParent()
|
||||
RegisterSignal(tracked, COMSIG_PARENT_QDELETING, PROC_REF(handle_tracked_qdel))
|
||||
RegisterSignal(tracked, COMSIG_QDELETING, PROC_REF(handle_tracked_qdel))
|
||||
update_signals()
|
||||
|
||||
/datum/component/connect_mob_behalf/UnregisterFromParent()
|
||||
unregister_signals()
|
||||
UnregisterSignal(tracked, COMSIG_PARENT_QDELETING)
|
||||
UnregisterSignal(tracked, COMSIG_QDELETING)
|
||||
|
||||
tracked = null
|
||||
tracked_mob = null
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
SEND_SIGNAL(target, COMSIG_ELEMENT_ATTACH, src)
|
||||
if(element_flags & ELEMENT_DETACH_ON_HOST_DESTROY)
|
||||
RegisterSignal(target, COMSIG_PARENT_QDELETING, PROC_REF(Detach), override = TRUE)
|
||||
RegisterSignal(target, COMSIG_QDELETING, PROC_REF(Detach), override = TRUE)
|
||||
|
||||
/// Deactivates the functionality defines by the element on the given datum
|
||||
/datum/element/proc/Detach(datum/source, force)
|
||||
SEND_SIGNAL(source, COMSIG_ELEMENT_DETACH_ON_HOST_DESTROY, src)
|
||||
SHOULD_CALL_PARENT(1)
|
||||
UnregisterSignal(source, COMSIG_PARENT_QDELETING)
|
||||
UnregisterSignal(source, COMSIG_QDELETING)
|
||||
|
||||
/datum/element/Destroy(force)
|
||||
if(!force)
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
user_client = user.client
|
||||
addProgBarImageToClient()
|
||||
|
||||
RegisterSignal(user, COMSIG_PARENT_QDELETING, PROC_REF(onUserDelete))
|
||||
RegisterSignal(user, COMSIG_QDELETING, PROC_REF(onUserDelete))
|
||||
RegisterSignal(user, COMSIG_MOB_LOGOUT, PROC_REF(cleanUserClient))
|
||||
RegisterSignal(user, COMSIG_MOB_LOGIN, PROC_REF(onUserLogin))
|
||||
|
||||
|
||||
+82
-105
@@ -1,82 +1,84 @@
|
||||
// Wires for airlocks
|
||||
|
||||
/datum/wires/airlock
|
||||
proper_name = "Airlock"
|
||||
holder_type = /obj/machinery/door/airlock
|
||||
wire_count = 12
|
||||
window_y = 570
|
||||
|
||||
/datum/wires/airlock/New(atom/holder)
|
||||
wires = list(
|
||||
WIRE_AI,
|
||||
WIRE_BACKUP1,
|
||||
WIRE_BACKUP2,
|
||||
WIRE_BOLTS,
|
||||
WIRE_IDSCAN,
|
||||
WIRE_BOLTLIGHT,
|
||||
WIRE_OPEN,
|
||||
WIRE_POWER1,
|
||||
WIRE_POWER2,
|
||||
WIRE_SAFETY,
|
||||
WIRE_SHOCK,
|
||||
WIRE_TIMING
|
||||
)
|
||||
add_duds(4)
|
||||
..()
|
||||
|
||||
/datum/wires/airlock/secure
|
||||
random = TRUE
|
||||
wire_count = 14
|
||||
|
||||
/datum/wires/airlock/blueprint
|
||||
cares_about_holder = FALSE
|
||||
|
||||
var/const/AIRLOCK_WIRE_IDSCAN = 1
|
||||
var/const/AIRLOCK_WIRE_MAIN_POWER1 = 2
|
||||
var/const/AIRLOCK_WIRE_MAIN_POWER2 = 4
|
||||
var/const/AIRLOCK_WIRE_DOOR_BOLTS = 8
|
||||
var/const/AIRLOCK_WIRE_BACKUP_POWER1 = 16
|
||||
var/const/AIRLOCK_WIRE_BACKUP_POWER2 = 32
|
||||
var/const/AIRLOCK_WIRE_OPEN_DOOR = 64
|
||||
var/const/AIRLOCK_WIRE_AI_CONTROL = 128
|
||||
var/const/AIRLOCK_WIRE_ELECTRIFY = 256
|
||||
var/const/AIRLOCK_WIRE_SAFETY = 512
|
||||
var/const/AIRLOCK_WIRE_SPEED = 1024
|
||||
var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
|
||||
/datum/wires/airlock/CanUse(var/mob/living/L)
|
||||
/datum/wires/airlock/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
if(!istype(L, /mob/living/silicon))
|
||||
if(!istype(user, /mob/living/silicon))
|
||||
if(A.isElectrified())
|
||||
if(A.shock(L, 100))
|
||||
return 0
|
||||
if(A.p_open)
|
||||
return 1
|
||||
return 0
|
||||
if(A.shock(user, 100))
|
||||
return FALSE
|
||||
if(!A.p_open)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/wires/airlock/GetInteractWindow()
|
||||
/datum/wires/airlock/get_status()
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
var/haspower = A.arePowerSystemsOn() //If there's no power, then no lights will be on.
|
||||
|
||||
. += ..()
|
||||
var/list/text = list()
|
||||
. = ..()
|
||||
|
||||
if(!haspower)
|
||||
text += "The test light and all the other indicator lights are [SPAN_BAD("off")]!"
|
||||
text += A.locked ? "The door bolts seem to be down!" : "The door bolts seem to be up."
|
||||
. += "The test light and all the other indicator lights are off!"
|
||||
. += A.locked ? "The door bolts seem to be down!" : "The door bolts seem to be up."
|
||||
else
|
||||
text += "The test light is [SPAN_GOOD("on")]."
|
||||
text += A.backup_power_lost_until ? "The backup power light is [SPAN_BAD("off")]!" : "The backup power light is [SPAN_GOOD("on")]."
|
||||
. += "The test light is on."
|
||||
. += A.backup_power_lost_until ? "The backup power light is off!" : "The backup power light is on."
|
||||
if(A.lights) // show different bolt message depending on whether we have lights
|
||||
text += "The door bolt indicator lights are [SPAN_GOOD("on")]."
|
||||
text += "They show the bolts are [A.locked ? SPAN_BAD("down") : SPAN_GOOD("up")]."
|
||||
. += "The door bolt indicator lights are on."
|
||||
. += "They show the bolts are [A.locked ? "down" : "up"]."
|
||||
else
|
||||
text += "The door bolt indicator lights are [SPAN_BAD("off")]!"
|
||||
text += A.locked ? "The door bolts seem to be down!" : "The door bolts seem to be up." // this is a closer inspection
|
||||
. += "The door bolt indicator lights are off!"
|
||||
. += A.locked ? "The door bolts seem to be down!" : "The door bolts seem to be up." // this is a closer inspection
|
||||
if(A.ai_control_disabled==0)
|
||||
if(A.emagged)
|
||||
text += "The 'AI control allowed' light is <span style='color:red'>red</span>."
|
||||
. += "The 'AI control allowed' light red."
|
||||
else if(A.ai_bolting)
|
||||
text += "The 'AI control allowed' light is <span style='color:green'>green</span>."
|
||||
. += "The 'AI control allowed' light is green."
|
||||
else
|
||||
text += "The 'AI control allowed' light is <span style='color:orange'>orange</span>."
|
||||
. += "The 'AI control allowed' light is orange."
|
||||
else
|
||||
text += "The 'AI control allowed' light is [SPAN_BAD("off")]."
|
||||
text += A.safe==0 ? "The 'Check Wiring' light is [SPAN_GOOD("on")]." : "The 'Check Wiring' light is [SPAN_BAD("off")]."
|
||||
text += A.normalspeed==0 ? "The 'Check Timing Mechanism' light is [SPAN_GOOD("on")]." : "The 'Check Timing Mechanism' light is [SPAN_BAD("off")]."
|
||||
text += A.ai_disabled_id_scanner==0 ? "The IDScan light is [SPAN_GOOD("on")]." : "The IDScan light is [SPAN_BAD("off")]."
|
||||
. += "<br>\n" + jointext(text, "<br>\n")
|
||||
. += "The 'AI control allowed' light is off."
|
||||
. += A.safe==0 ? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off."
|
||||
. += A.normalspeed==0 ? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off."
|
||||
. += A.ai_disabled_id_scanner==0 ? "The IDScan light is on." : "The IDScan light is off."
|
||||
|
||||
/datum/wires/airlock/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/airlock/on_cut(wire, mend, source)
|
||||
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
switch(index)
|
||||
if(AIRLOCK_WIRE_IDSCAN)
|
||||
A.ai_disabled_id_scanner = !mended
|
||||
switch(wire)
|
||||
if(WIRE_IDSCAN)
|
||||
A.ai_disabled_id_scanner = !mend
|
||||
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2)
|
||||
if(!mended)
|
||||
if(WIRE_POWER1, WIRE_POWER2)
|
||||
if(!mend)
|
||||
//Cutting either one disables the main door power, but unless backup power is also cut, the backup power re-powers the door in 10 seconds. While unpowered, the door may be crowbarred open, but bolts-raising will not work. Cutting these wires may electocute the user.
|
||||
A.loseMainPower()
|
||||
A.shock(usr, 50)
|
||||
@@ -84,8 +86,8 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
A.regainMainPower()
|
||||
A.shock(usr, 50)
|
||||
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2)
|
||||
if(!mended)
|
||||
if(WIRE_BACKUP1, WIRE_BACKUP2)
|
||||
if(!mend)
|
||||
//Cutting either one disables the backup door power (allowing it to be crowbarred open, but disabling bolts-raising), but may electocute the user.
|
||||
A.loseBackupPower()
|
||||
A.shock(usr, 50)
|
||||
@@ -93,14 +95,14 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
A.regainBackupPower()
|
||||
A.shock(usr, 50)
|
||||
|
||||
if(AIRLOCK_WIRE_DOOR_BOLTS)
|
||||
if(!mended)
|
||||
if(WIRE_BOLTS)
|
||||
if(!mend)
|
||||
//Cutting this wire also drops the door bolts, and mending it does not raise them. (This is what happens now, except there are a lot more wires going to door bolts at present)
|
||||
A.lock(1)
|
||||
A.update_icon()
|
||||
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
if(!mended)
|
||||
if(WIRE_AI)
|
||||
if(!mend)
|
||||
//one wire for AI control. Cutting this prevents the AI from controlling the door unless it has hacked the door through the power connection (which takes about a minute). If both main and backup power are cut, as well as this wire, then the AI cannot operate or hack the door at all.
|
||||
//ai_control_disabled: If 1, AI control is disabled until the AI hacks back in and disables the lock. If 2, the AI has bypassed the lock. If -1, the control is enabled but the AI had bypassed it earlier, so if it is disabled again the AI would have no trouble getting back in.
|
||||
if(A.ai_control_disabled == 0)
|
||||
@@ -113,42 +115,42 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
else if(A.ai_control_disabled == 2)
|
||||
A.ai_control_disabled = -1
|
||||
|
||||
if(AIRLOCK_WIRE_ELECTRIFY)
|
||||
if(!mended)
|
||||
if(WIRE_SHOCK)
|
||||
if(!mend)
|
||||
//Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted.
|
||||
A.electrify(-1)
|
||||
else
|
||||
A.electrify(0)
|
||||
return // Don't update the dialog.
|
||||
|
||||
if (AIRLOCK_WIRE_SAFETY)
|
||||
A.safe = mended
|
||||
if (WIRE_SAFETY)
|
||||
A.safe = mend
|
||||
|
||||
if(AIRLOCK_WIRE_SPEED)
|
||||
A.autoclose = mended
|
||||
if(mended)
|
||||
if(WIRE_TIMING)
|
||||
A.autoclose = mend
|
||||
if(mend)
|
||||
if(!A.density)
|
||||
A.close()
|
||||
|
||||
if(AIRLOCK_WIRE_LIGHT)
|
||||
A.lights = mended
|
||||
if(WIRE_BOLTLIGHT)
|
||||
A.lights = mend
|
||||
A.update_icon()
|
||||
|
||||
|
||||
/datum/wires/airlock/UpdatePulsed(var/index)
|
||||
/datum/wires/airlock/on_pulse(wire)
|
||||
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
switch(index)
|
||||
if(AIRLOCK_WIRE_IDSCAN)
|
||||
switch(wire)
|
||||
if(WIRE_IDSCAN)
|
||||
//Sending a pulse through flashes the red light on the door (if the door has power).
|
||||
if(A.arePowerSystemsOn() && A.density)
|
||||
A.do_animate("deny")
|
||||
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2)
|
||||
if(WIRE_POWER1, WIRE_POWER2)
|
||||
//Sending a pulse through either one causes a breaker to trip, disabling the door for 10 seconds if backup power is connected, or 1 minute if not (or until backup power comes back on, whichever is shorter).
|
||||
A.loseMainPower()
|
||||
|
||||
if(AIRLOCK_WIRE_DOOR_BOLTS)
|
||||
if(WIRE_BOLTS)
|
||||
//one wire for door bolts. Sending a pulse through this drops door bolts if they're not down (whether power's on or not),
|
||||
//raises them if they are down (only if power's on)
|
||||
if(!A.locked)
|
||||
@@ -156,21 +158,21 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
else
|
||||
A.unlock()
|
||||
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2)
|
||||
if(WIRE_BACKUP1, WIRE_BACKUP2)
|
||||
//two wires for backup power. Sending a pulse through either one causes a breaker to trip, but this does not disable it unless main power is down too (in which case it is disabled for 1 minute or however long it takes main power to come back, whichever is shorter).
|
||||
A.loseBackupPower()
|
||||
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
if(WIRE_AI)
|
||||
//Sending a pulse toggles whether AI can bolt the doors (if not emagged)
|
||||
if(A.emagged)
|
||||
return
|
||||
A.ai_bolting = !A.ai_bolting
|
||||
|
||||
if(AIRLOCK_WIRE_ELECTRIFY)
|
||||
if(WIRE_SHOCK)
|
||||
//one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds.
|
||||
A.electrify(30)
|
||||
|
||||
if(AIRLOCK_WIRE_OPEN_DOOR)
|
||||
if(WIRE_OPEN)
|
||||
//tries to open the door without ID
|
||||
//will succeed only if the ID wire is cut or the door requires no access and it's not emagged
|
||||
if(A.emagged)
|
||||
@@ -181,50 +183,25 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
else
|
||||
A.close()
|
||||
|
||||
if(AIRLOCK_WIRE_SAFETY)
|
||||
if(WIRE_SAFETY)
|
||||
A.safe = !A.safe
|
||||
if(!A.density)
|
||||
A.close()
|
||||
|
||||
if(AIRLOCK_WIRE_SPEED)
|
||||
if(WIRE_TIMING)
|
||||
A.normalspeed = !A.normalspeed
|
||||
|
||||
if(AIRLOCK_WIRE_LIGHT)
|
||||
if(WIRE_BOLTLIGHT)
|
||||
A.lights = !A.lights
|
||||
A.update_icon()
|
||||
|
||||
/datum/wires/airlock/get_wire_diagram(var/mob/user)
|
||||
var/dat = ""
|
||||
for(var/color in wires)
|
||||
dat += "<font color='[color]'>[capitalize(color)]</font>: [index_to_type(GetIndex(color))]<br>"
|
||||
for(var/color in colors)
|
||||
if(is_dud_color(color))
|
||||
continue
|
||||
dat += "<font color='[color]'>[capitalize(color)]</font>: [get_wire(color)]<br>"
|
||||
|
||||
var/datum/browser/wire_win = new(user, "airlockwires", "Airlock Wires", 450, 500)
|
||||
wire_win.set_content(dat)
|
||||
wire_win.open()
|
||||
|
||||
/datum/wires/airlock/proc/index_to_type(var/index)
|
||||
switch(index)
|
||||
if(AIRLOCK_WIRE_IDSCAN)
|
||||
return "ID Scan"
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1)
|
||||
return "Power"
|
||||
if(AIRLOCK_WIRE_MAIN_POWER2)
|
||||
return "Power"
|
||||
if(AIRLOCK_WIRE_DOOR_BOLTS)
|
||||
return "Bolts"
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER1)
|
||||
return "Backup Power"
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER2)
|
||||
return "Backup Power"
|
||||
if(AIRLOCK_WIRE_OPEN_DOOR)
|
||||
return "Actuation"
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
return "AI Control"
|
||||
if(AIRLOCK_WIRE_ELECTRIFY)
|
||||
return "Anti-tampering"
|
||||
if(AIRLOCK_WIRE_SAFETY)
|
||||
return "Safety"
|
||||
if(AIRLOCK_WIRE_SPEED)
|
||||
return "Speed"
|
||||
if(AIRLOCK_WIRE_LIGHT)
|
||||
return "Bolt Lights"
|
||||
|
||||
+37
-32
@@ -1,58 +1,63 @@
|
||||
/datum/wires/alarm
|
||||
proper_name = "Air Alarm"
|
||||
holder_type = /obj/machinery/alarm
|
||||
wire_count = 5
|
||||
|
||||
var/const/AALARM_WIRE_IDSCAN = 1
|
||||
var/const/AALARM_WIRE_POWER = 2
|
||||
var/const/AALARM_WIRE_SYPHON = 4
|
||||
var/const/AALARM_WIRE_AI_CONTROL = 8
|
||||
var/const/AALARM_WIRE_AALARM = 16
|
||||
/datum/wires/airalarm/New(atom/holder)
|
||||
wires = list(
|
||||
WIRE_POWER,
|
||||
WIRE_IDSCAN, WIRE_AI,
|
||||
WIRE_PANIC, WIRE_ALARM
|
||||
)
|
||||
add_duds(3)
|
||||
..()
|
||||
|
||||
|
||||
/datum/wires/alarm/CanUse(var/mob/living/L)
|
||||
/datum/wires/airalarm/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/alarm/A = holder
|
||||
if(A.wiresexposed && A.buildstage == 2)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
|
||||
/datum/wires/alarm/GetInteractWindow()
|
||||
/datum/wires/alarm/get_status()
|
||||
var/obj/machinery/alarm/A = holder
|
||||
. += ..()
|
||||
. += text("<br>\n[(A.locked ? "The Air Alarm is locked." : "The Air Alarm is unlocked.")]<br>\n[((A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!")]<br>\n[(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]")
|
||||
. = ..()
|
||||
. += A.locked ? "The air alarm is locked." : "The air alarm is unlocked."
|
||||
. += (A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!"
|
||||
. += A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on."
|
||||
|
||||
/datum/wires/alarm/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/alarm/on_cut(wire, mend, source)
|
||||
var/obj/machinery/alarm/A = holder
|
||||
switch(index)
|
||||
if(AALARM_WIRE_IDSCAN)
|
||||
if(!mended)
|
||||
switch(wire)
|
||||
if(WIRE_IDSCAN)
|
||||
if(!mend)
|
||||
A.locked = 1
|
||||
|
||||
if(AALARM_WIRE_POWER)
|
||||
if(WIRE_POWER)
|
||||
A.shock(usr, 50)
|
||||
A.shorted = !mended
|
||||
A.shorted = !mend
|
||||
A.update_icon()
|
||||
|
||||
if (AALARM_WIRE_AI_CONTROL)
|
||||
if (A.aidisabled == !mended)
|
||||
A.aidisabled = mended
|
||||
if (WIRE_AI)
|
||||
if (A.aidisabled == !mend)
|
||||
A.aidisabled = mend
|
||||
|
||||
if(AALARM_WIRE_SYPHON)
|
||||
if(!mended)
|
||||
if(WIRE_PANIC)
|
||||
if(!mend)
|
||||
A.mode = 3 // AALARM_MODE_PANIC
|
||||
A.apply_mode()
|
||||
|
||||
if(AALARM_WIRE_AALARM)
|
||||
if(WIRE_ALARM)
|
||||
if (A.alarm_area.atmosalert(2, A))
|
||||
A.post_alert(2)
|
||||
A.update_icon()
|
||||
|
||||
/datum/wires/alarm/UpdatePulsed(var/index)
|
||||
/datum/wires/alarm/on_pulse(wire)
|
||||
var/obj/machinery/alarm/A = holder
|
||||
switch(index)
|
||||
if(AALARM_WIRE_IDSCAN)
|
||||
switch(wire)
|
||||
if(WIRE_IDSCAN)
|
||||
A.locked = !A.locked
|
||||
|
||||
if (AALARM_WIRE_POWER)
|
||||
if (WIRE_POWER)
|
||||
if(A.shorted == 0)
|
||||
A.shorted = 1
|
||||
A.update_icon()
|
||||
@@ -63,7 +68,7 @@ var/const/AALARM_WIRE_AALARM = 16
|
||||
A.update_icon()
|
||||
|
||||
|
||||
if (AALARM_WIRE_AI_CONTROL)
|
||||
if (WIRE_AI)
|
||||
if (A.aidisabled == 0)
|
||||
A.aidisabled = 1
|
||||
A.updateDialog()
|
||||
@@ -71,14 +76,14 @@ var/const/AALARM_WIRE_AALARM = 16
|
||||
if (A.aidisabled == 1)
|
||||
A.aidisabled = 0
|
||||
|
||||
if(AALARM_WIRE_SYPHON)
|
||||
if(WIRE_PANIC)
|
||||
if(A.mode == 1) // AALARM_MODE_SCRUB
|
||||
A.mode = 3 // AALARM_MODE_PANIC
|
||||
else
|
||||
A.mode = 1 // AALARM_MODE_SCRUB
|
||||
A.apply_mode()
|
||||
|
||||
if(AALARM_WIRE_AALARM)
|
||||
if(WIRE_ALARM)
|
||||
if (A.alarm_area.atmosalert(0, A))
|
||||
A.post_alert(0)
|
||||
A.update_icon()
|
||||
|
||||
+30
-23
@@ -1,36 +1,43 @@
|
||||
/datum/wires/apc
|
||||
proper_name = "APC"
|
||||
holder_type = /obj/machinery/power/apc
|
||||
wire_count = 4
|
||||
|
||||
#define APC_WIRE_IDSCAN (1<<0)
|
||||
#define APC_WIRE_MAIN_POWER1 (1<<1)
|
||||
#define APC_WIRE_MAIN_POWER2 (1<<2)
|
||||
#define APC_WIRE_AI_CONTROL (1<<3)
|
||||
/datum/wires/apc/New(atom/holder)
|
||||
wires = list(
|
||||
WIRE_POWER1, WIRE_POWER2,
|
||||
WIRE_IDSCAN, WIRE_AI
|
||||
)
|
||||
add_duds(6)
|
||||
..()
|
||||
|
||||
/datum/wires/apc/GetInteractWindow()
|
||||
/datum/wires/apc/get_status()
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
. += ..()
|
||||
. += text("<br>\n[(A.locked ? "The APC is locked." : "The APC is unlocked.")]<br>\n[(A.shorted ? "The APCs power has been shorted." : "The APC is working properly!")]<br>\n[(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]")
|
||||
. = ..()
|
||||
. += A.locked ? "The APC is locked." : "The APC is unlocked."
|
||||
. += A.shorted ? "The APCs power has been shorted." : "The APC is working properly!"
|
||||
. += A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on."
|
||||
|
||||
/datum/wires/apc/CanUse(var/mob/living/L)
|
||||
/datum/wires/apc/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
return A?.wiresexposed
|
||||
|
||||
/datum/wires/apc/UpdatePulsed(var/index)
|
||||
/datum/wires/apc/on_pulse(wire)
|
||||
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
|
||||
switch(index)
|
||||
switch(wire)
|
||||
|
||||
if(APC_WIRE_IDSCAN)
|
||||
if(WIRE_IDSCAN)
|
||||
set_locked(A, FALSE)
|
||||
addtimer(CALLBACK(src, PROC_REF(set_locked), A, TRUE), 30 SECONDS)
|
||||
|
||||
if (APC_WIRE_MAIN_POWER1, APC_WIRE_MAIN_POWER2)
|
||||
if (WIRE_POWER1, WIRE_POWER2)
|
||||
set_short_out(A, TRUE)
|
||||
addtimer(CALLBACK(src, PROC_REF(set_short_out), A, FALSE), 120 SECONDS)
|
||||
|
||||
if (APC_WIRE_AI_CONTROL)
|
||||
if (WIRE_AI)
|
||||
set_ai_control(A, TRUE)
|
||||
addtimer(CALLBACK(src, PROC_REF(set_ai_control), A, FALSE), 1 SECONDS)
|
||||
|
||||
@@ -42,28 +49,28 @@
|
||||
/datum/wires/apc/proc/set_short_out(var/obj/machinery/power/apc/A, var/setting)
|
||||
if(setting)
|
||||
A.shorted = TRUE
|
||||
else if(A && !IsIndexCut(APC_WIRE_MAIN_POWER1) && !IsIndexCut(APC_WIRE_MAIN_POWER2))
|
||||
else if(A && !is_cut(WIRE_POWER1) && !is_cut(WIRE_POWER2))
|
||||
A.shorted = FALSE
|
||||
|
||||
/datum/wires/apc/proc/set_ai_control(var/obj/machinery/power/apc/A, var/setting)
|
||||
if(setting)
|
||||
A.aidisabled = TRUE
|
||||
else if(A && !IsIndexCut(APC_WIRE_AI_CONTROL))
|
||||
else if(A && !is_cut(WIRE_AI))
|
||||
A.aidisabled = FALSE
|
||||
|
||||
/datum/wires/apc/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/apc/on_cut(wire, mend, source)
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
|
||||
switch(index)
|
||||
if(APC_WIRE_MAIN_POWER1, APC_WIRE_MAIN_POWER2)
|
||||
switch(wire)
|
||||
if(WIRE_POWER1, WIRE_POWER2)
|
||||
|
||||
if(!mended)
|
||||
if(!mend)
|
||||
A.shock(usr, 50)
|
||||
A.shorted = TRUE
|
||||
|
||||
else if(!IsIndexCut(APC_WIRE_MAIN_POWER1) && !IsIndexCut(APC_WIRE_MAIN_POWER2))
|
||||
else if(!is_cut(WIRE_POWER1) && !is_cut(WIRE_POWER2))
|
||||
A.shorted = FALSE
|
||||
A.shock(usr, 50)
|
||||
|
||||
if(APC_WIRE_AI_CONTROL)
|
||||
A.aidisabled = !mended
|
||||
if(WIRE_AI)
|
||||
A.aidisabled = !mend
|
||||
|
||||
@@ -1,55 +1,60 @@
|
||||
/datum/wires/autolathe
|
||||
proper_name = "Autolathe"
|
||||
holder_type = /obj/machinery/autolathe
|
||||
wire_count = 6
|
||||
|
||||
var/const/AUTOLATHE_HACK_WIRE = 1
|
||||
var/const/AUTOLATHE_SHOCK_WIRE = 2
|
||||
var/const/AUTOLATHE_DISABLE_WIRE = 4
|
||||
/datum/wires/autolathe/New(atom/holder)
|
||||
wires = list(
|
||||
WIRE_HACK, WIRE_DISABLE,
|
||||
WIRE_SHOCK
|
||||
)
|
||||
add_duds(2)
|
||||
..()
|
||||
|
||||
/datum/wires/autolathe/GetInteractWindow()
|
||||
/datum/wires/autolathe/get_status()
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
. = ..()
|
||||
. += "\The [A] [A.disabled ? "is dead quiet" : "has a soft electric whirr"]."
|
||||
. += "\The [A] [A.shocked ? "is making sparking noises" : "is cycling normally"]."
|
||||
. += "\The [A] [A.hacked ? "rarely" : "occasionally"] makes a beep boop noise."
|
||||
|
||||
. += ..()
|
||||
. += "<BR>\The [A] [A.disabled ? "is dead quiet" : "has a soft electric whirr"]."
|
||||
. += "<BR>\The [A] [A.shocked ? "is making sparking noises" : "is cycling normally"]."
|
||||
. += "<BR>\The [A] [A.hacked ? "rarely" : "occasionally"] makes a beep boop noise.<BR>"
|
||||
|
||||
/datum/wires/autolathe/CanUse()
|
||||
/datum/wires/autolathe/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
if(A.panel_open)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/wires/autolathe/UpdateCut(index, mended)
|
||||
/datum/wires/autolathe/on_cut(wire, mend, source)
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
switch(index)
|
||||
if(AUTOLATHE_HACK_WIRE)
|
||||
A.hacked = !mended
|
||||
if(AUTOLATHE_SHOCK_WIRE)
|
||||
A.shocked = !mended
|
||||
if(AUTOLATHE_DISABLE_WIRE)
|
||||
A.disabled = !mended
|
||||
switch(wire)
|
||||
if(WIRE_HACK)
|
||||
A.hacked = !mend
|
||||
if(WIRE_SHOCK)
|
||||
A.shocked = !mend
|
||||
if(WIRE_DISABLE)
|
||||
A.disabled = !mend
|
||||
|
||||
/datum/wires/autolathe/UpdatePulsed(index)
|
||||
if(IsIndexCut(index))
|
||||
/datum/wires/autolathe/on_pulse(wire)
|
||||
if(is_cut(wire))
|
||||
return
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
switch(index)
|
||||
if(AUTOLATHE_HACK_WIRE)
|
||||
switch(wire)
|
||||
if(WIRE_HACK)
|
||||
A.hacked = !A.hacked
|
||||
spawn(50)
|
||||
if(A && !IsIndexCut(index))
|
||||
if(A && !is_cut(wire))
|
||||
A.hacked = 0
|
||||
Interact(usr)
|
||||
if(AUTOLATHE_SHOCK_WIRE)
|
||||
interact(usr)
|
||||
if(WIRE_SHOCK)
|
||||
A.shocked = !A.shocked
|
||||
spawn(50)
|
||||
if(A && !IsIndexCut(index))
|
||||
if(A && !is_cut(wire))
|
||||
A.shocked = 0
|
||||
Interact(usr)
|
||||
if(AUTOLATHE_DISABLE_WIRE)
|
||||
interact(usr)
|
||||
if(WIRE_DISABLE)
|
||||
A.disabled = !A.disabled
|
||||
spawn(50)
|
||||
if(A && !IsIndexCut(index))
|
||||
if(A && !is_cut(wire))
|
||||
A.disabled = 0
|
||||
Interact(usr)
|
||||
interact(usr)
|
||||
|
||||
+37
-36
@@ -1,73 +1,74 @@
|
||||
// Wires for cameras.
|
||||
|
||||
/datum/wires/camera
|
||||
proper_name = "Camera"
|
||||
holder_type = /obj/machinery/camera
|
||||
wire_count = 6
|
||||
|
||||
/datum/wires/camera/GetInteractWindow()
|
||||
/datum/wires/camera/New(atom/holder)
|
||||
wires = list(
|
||||
WIRE_POWER, WIRE_FOCUS,
|
||||
WIRE_LIGHT, WIRE_ALARM
|
||||
)
|
||||
add_duds(1)
|
||||
..()
|
||||
|
||||
. = ..()
|
||||
/datum/wires/camera/get_status()
|
||||
var/obj/machinery/camera/C = holder
|
||||
. += "<br>\n[(C.view_range == initial(C.view_range) ? "The focus light is on." : "The focus light is off.")]"
|
||||
. += "<br>\n[(C.can_use() ? "The power link light is on." : "The power link light is off.")]"
|
||||
. += "<br>\n[(C.light_disabled ? "The camera light is off." : "The camera light is on.")]"
|
||||
. += "<br>\n[(C.alarm_on ? "The alarm light is on." : "The alarm light is off.")]"
|
||||
return .
|
||||
. = ..()
|
||||
. += "[(C.view_range == initial(C.view_range) ? "The focus light is on." : "The focus light is off.")]"
|
||||
. += "[(C.can_use() ? "The power link light is on." : "The power link light is off.")]"
|
||||
. += "[(C.light_disabled ? "The camera light is off." : "The camera light is on.")]"
|
||||
. += "[(C.alarm_on ? "The alarm light is on." : "The alarm light is off.")]"
|
||||
|
||||
/datum/wires/camera/CanUse(var/mob/living/L)
|
||||
/datum/wires/camera/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/camera/C = holder
|
||||
return C.panel_open
|
||||
|
||||
var/const/CAMERA_WIRE_FOCUS = 1
|
||||
var/const/CAMERA_WIRE_POWER = 2
|
||||
var/const/CAMERA_WIRE_LIGHT = 4
|
||||
var/const/CAMERA_WIRE_ALARM = 8
|
||||
var/const/CAMERA_WIRE_NOTHING1 = 16
|
||||
var/const/CAMERA_WIRE_NOTHING2 = 32
|
||||
|
||||
/datum/wires/camera/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/camera/on_cut(wire, mend, source)
|
||||
var/obj/machinery/camera/C = holder
|
||||
|
||||
switch(index)
|
||||
if(CAMERA_WIRE_FOCUS)
|
||||
var/range = (mended ? initial(C.view_range) : C.short_range)
|
||||
switch(wire)
|
||||
if(WIRE_FOCUS)
|
||||
var/range = (mend ? initial(C.view_range) : C.short_range)
|
||||
C.setViewRange(range)
|
||||
|
||||
if(CAMERA_WIRE_POWER)
|
||||
if(C.status && !mended || !C.status && mended)
|
||||
if(WIRE_POWER)
|
||||
if(C.status && !mend || !C.status && mend)
|
||||
C.deactivate(usr, 1)
|
||||
|
||||
if(CAMERA_WIRE_LIGHT)
|
||||
C.light_disabled = !mended
|
||||
if(WIRE_LIGHT)
|
||||
C.light_disabled = !mend
|
||||
|
||||
if(CAMERA_WIRE_ALARM)
|
||||
if(!mended)
|
||||
if(WIRE_ALARM)
|
||||
if(!mend)
|
||||
C.triggerCameraAlarm()
|
||||
else
|
||||
C.cancelCameraAlarm()
|
||||
return
|
||||
|
||||
/datum/wires/camera/UpdatePulsed(var/index)
|
||||
/datum/wires/camera/on_pulse(wire)
|
||||
var/obj/machinery/camera/C = holder
|
||||
if(IsIndexCut(index))
|
||||
if(is_cut(wire))
|
||||
return
|
||||
switch(index)
|
||||
if(CAMERA_WIRE_FOCUS)
|
||||
switch(wire)
|
||||
if(WIRE_FOCUS)
|
||||
var/new_range = (C.view_range == initial(C.view_range) ? C.short_range : initial(C.view_range))
|
||||
C.setViewRange(new_range)
|
||||
|
||||
if(CAMERA_WIRE_POWER)
|
||||
if(WIRE_POWER)
|
||||
C.kick_viewers() // Kicks anyone watching the camera
|
||||
|
||||
if(CAMERA_WIRE_LIGHT)
|
||||
if(WIRE_LIGHT)
|
||||
C.light_disabled = !C.light_disabled
|
||||
|
||||
if(CAMERA_WIRE_ALARM)
|
||||
if(WIRE_ALARM)
|
||||
C.visible_message("[icon2html(C, viewers(get_turf(C)))] *beep*", "[icon2html(C, viewers(get_turf(C)))] *beep*")
|
||||
return
|
||||
|
||||
/datum/wires/camera/proc/CanDeconstruct()
|
||||
if(IsIndexCut(CAMERA_WIRE_POWER) && IsIndexCut(CAMERA_WIRE_FOCUS) && IsIndexCut(CAMERA_WIRE_LIGHT) && IsIndexCut(CAMERA_WIRE_NOTHING1) && IsIndexCut(CAMERA_WIRE_NOTHING2))
|
||||
return 1
|
||||
if(is_cut(WIRE_POWER) && is_cut(WIRE_FOCUS) && is_cut(WIRE_LIGHT))
|
||||
return TRUE
|
||||
else
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
@@ -1,36 +1,41 @@
|
||||
/datum/wires/disposal
|
||||
proper_name = "Disposals"
|
||||
random = TRUE
|
||||
holder_type = /obj/machinery/disposal
|
||||
wire_count = 3
|
||||
|
||||
var/const/DISPOSAL_WIRE_FLUSH = 1
|
||||
/datum/wires/disposal/New(atom/holder)
|
||||
wires = list(
|
||||
WIRE_FLUSH
|
||||
)
|
||||
add_duds(3)
|
||||
..()
|
||||
|
||||
/datum/wires/disposal/GetInteractWindow()
|
||||
/datum/wires/disposal/get_status()
|
||||
var/obj/machinery/disposal/D = holder
|
||||
. = ..()
|
||||
|
||||
var/obj/machinery/disposal/D = holder
|
||||
. += "<br>\nThe light indicator inserted within the flush handle is [D.can_flush ? "on" : "off"]."
|
||||
return .
|
||||
|
||||
/datum/wires/disposal/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/disposal/on_cut(wire, mend, source)
|
||||
var/obj/machinery/disposal/D = holder
|
||||
switch(index)
|
||||
if(DISPOSAL_WIRE_FLUSH)
|
||||
if(!mended)
|
||||
switch(wire)
|
||||
if(WIRE_FLUSH)
|
||||
if(!mend)
|
||||
D.can_flush = FALSE
|
||||
D.visible_message(SPAN_WARNING("\The [D] whines loudly."), range = 3)
|
||||
else
|
||||
D.can_flush = TRUE
|
||||
D.visible_message(SPAN_NOTICE("\The [D] hums soothingly."), range = 3)
|
||||
|
||||
/datum/wires/disposal/UpdatePulsed(var/index)
|
||||
/datum/wires/disposal/on_pulse(wire)
|
||||
var/obj/machinery/disposal/D = holder
|
||||
switch(index)
|
||||
if(DISPOSAL_WIRE_FLUSH)
|
||||
switch(wire)
|
||||
if(WIRE_FLUSH)
|
||||
if(D.air_contents.return_pressure() >= (700 + ONE_ATMOSPHERE) || !D.uses_air)
|
||||
D.flush()
|
||||
|
||||
/datum/wires/disposal/CanUse(var/mob/living/L)
|
||||
/datum/wires/disposal/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/disposal/D = holder
|
||||
if(D.mode <= 0)
|
||||
return TRUE
|
||||
|
||||
@@ -1,30 +1,34 @@
|
||||
/datum/wires/explosive
|
||||
wire_count = 1
|
||||
|
||||
var/const/WIRE_EXPLODE = 1
|
||||
/datum/wires/explosive/New()
|
||||
wires = list(
|
||||
WIRE_EXPLODE
|
||||
)
|
||||
add_duds(4)
|
||||
..()
|
||||
|
||||
/datum/wires/explosive/proc/explode()
|
||||
return
|
||||
|
||||
/datum/wires/explosive/UpdatePulsed(var/index)
|
||||
switch(index)
|
||||
/datum/wires/explosive/on_pulse(wire)
|
||||
switch(wire)
|
||||
if(WIRE_EXPLODE)
|
||||
explode()
|
||||
|
||||
/datum/wires/explosive/UpdateCut(var/index, var/mended)
|
||||
switch(index)
|
||||
/datum/wires/explosive/on_cut(wire, mend, source)
|
||||
switch(wire)
|
||||
if(WIRE_EXPLODE)
|
||||
if(!mended)
|
||||
if(!mend)
|
||||
explode()
|
||||
|
||||
/datum/wires/explosive/c4
|
||||
holder_type = /obj/item/plastique
|
||||
|
||||
/datum/wires/explosive/c4/CanUse(var/mob/living/L)
|
||||
/datum/wires/explosive/c4/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/item/plastique/P = holder
|
||||
if(P.open_panel)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/wires/explosive/c4/explode()
|
||||
var/obj/item/plastique/P = holder
|
||||
|
||||
@@ -1,24 +1,31 @@
|
||||
/datum/wires/iff
|
||||
proper_name = "IFF Beacon"
|
||||
holder_type = /obj/machinery/iff_beacon
|
||||
wire_count = 1
|
||||
|
||||
#define IFF_WIRE_RESET 1
|
||||
/datum/wires/iff/New()
|
||||
wires = list(
|
||||
WIRE_RESET
|
||||
)
|
||||
add_duds(2)
|
||||
..()
|
||||
|
||||
/datum/wires/iff/GetInteractWindow()
|
||||
/datum/wires/iff/get_status()
|
||||
var/obj/machinery/iff_beacon/I = holder
|
||||
. += ..()
|
||||
. += text("<br>\n[(I.use_power ? "The beacon is transmitting." : "The beacon is not transmitting.")]")
|
||||
. += "[(I.use_power ? "The beacon is transmitting." : "The beacon is not transmitting.")]"
|
||||
|
||||
/datum/wires/iff/CanUse(var/mob/living/L)
|
||||
/datum/wires/iff/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/iff_beacon/I = holder
|
||||
return I.panel_open
|
||||
|
||||
/datum/wires/iff/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/iff/on_cut(wire, mend, source)
|
||||
var/obj/machinery/iff_beacon/I = holder
|
||||
|
||||
switch(index)
|
||||
if(IFF_WIRE_RESET)
|
||||
if(!mended)
|
||||
switch(wire)
|
||||
if(WIRE_RESET)
|
||||
if(!mend)
|
||||
I.shock(usr, 50)
|
||||
I.toggle()
|
||||
I.disable()
|
||||
|
||||
@@ -1,34 +1,35 @@
|
||||
/datum/wires/tag_scanner
|
||||
proper_name = "IPC Tag Scanner"
|
||||
random = TRUE
|
||||
holder_type = /obj/item/ipc_tag_scanner
|
||||
wire_count = 4
|
||||
|
||||
var/const/TAG_WIRE_DUMMY_ONE = 1
|
||||
var/const/TAG_WIRE_POWER = 2
|
||||
var/const/TAG_WIRE_DUMMY_TWO = 4
|
||||
var/const/TAG_WIRE_HACK = 8
|
||||
|
||||
/datum/wires/tag_scanner/GetInteractWindow()
|
||||
. = ..()
|
||||
/datum/wires/tag_scanner/New()
|
||||
wires = list(
|
||||
WIRE_POWER, WIRE_HACK
|
||||
)
|
||||
add_duds(4)
|
||||
..()
|
||||
|
||||
/datum/wires/tag_scanner/get_status()
|
||||
var/obj/item/ipc_tag_scanner/S = holder
|
||||
. += text("<br>\n[(S.powered ? "The scanlight is steady." : "The scanlight is strobing.")]")
|
||||
. += text("<br>\n[(S.hacked ? "The scanlight is red." : "The scanlight is purple.")]")
|
||||
. = ..()
|
||||
. += "[(S.powered ? "The scanlight is steady." : "The scanlight is strobing.")]"
|
||||
. += "[(S.hacked ? "The scanlight is red." : "The scanlight is purple.")]"
|
||||
return .
|
||||
|
||||
/datum/wires/tag_scanner/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/tag_scanner/on_cut(wire, mend, source)
|
||||
var/obj/item/ipc_tag_scanner/S = holder
|
||||
switch(index)
|
||||
if(TAG_WIRE_POWER)
|
||||
if(!mended)
|
||||
switch(wire)
|
||||
if(WIRE_POWER)
|
||||
if(!mend)
|
||||
S.powered = FALSE
|
||||
S.visible_message(SPAN_WARNING("\The [S] whines loudly."), range = 3)
|
||||
else
|
||||
S.powered = TRUE
|
||||
S.visible_message(SPAN_NOTICE("\The [S] hums soothingly."), range = 3)
|
||||
|
||||
if(TAG_WIRE_HACK)
|
||||
if(!mended)
|
||||
if(WIRE_HACK)
|
||||
if(!mend)
|
||||
S.hacked = TRUE
|
||||
S.visible_message(SPAN_WARNING("\The [S] starts beeping incessantly."), range = 3)
|
||||
else
|
||||
@@ -36,16 +37,18 @@ var/const/TAG_WIRE_HACK = 8
|
||||
S.visible_message(SPAN_NOTICE("\The [S] hums soothingly."), range = 3)
|
||||
|
||||
|
||||
/datum/wires/tag_scanner/UpdatePulsed(var/index)
|
||||
/datum/wires/tag_scanner/on_pulse(wire)
|
||||
var/obj/item/ipc_tag_scanner/S = holder
|
||||
switch(index)
|
||||
if(TAG_WIRE_POWER)
|
||||
switch(wire)
|
||||
if(WIRE_POWER)
|
||||
S.visible_message(SPAN_WARNING("[icon2html(S, viewers(get_turf(S)))] <b>[capitalize_first_letters(S.name)]</b> beeps, \"BOOWEEEP!\""))
|
||||
|
||||
if(TAG_WIRE_HACK)
|
||||
if(WIRE_HACK)
|
||||
S.visible_message(SPAN_WARNING("[icon2html(S, viewers(get_turf(S)))] <b>[capitalize_first_letters(S.name)]</b> beeps, \"BEEYUUP!\""))
|
||||
|
||||
/datum/wires/tag_scanner/CanUse(var/mob/living/L)
|
||||
/datum/wires/tag_scanner/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/item/ipc_tag_scanner/S = holder
|
||||
if(S.wires_exposed)
|
||||
return TRUE
|
||||
|
||||
@@ -1,24 +1,30 @@
|
||||
/datum/wires/landmine
|
||||
wire_count = 1
|
||||
/datum/wires/landmine/New()
|
||||
wires = list(
|
||||
WIRE_EXPLODE
|
||||
)
|
||||
add_duds(3)
|
||||
..()
|
||||
|
||||
/datum/wires/landmine/proc/explode()
|
||||
return
|
||||
|
||||
/datum/wires/landmine/UpdatePulsed(var/index)
|
||||
switch(index)
|
||||
/datum/wires/landmine/on_pulse(wire, user)
|
||||
switch(wire)
|
||||
if(WIRE_EXPLODE)
|
||||
explode()
|
||||
|
||||
/datum/wires/landmine/UpdateCut(var/index, var/mended)
|
||||
switch(index)
|
||||
/datum/wires/landmine/on_cut(wire, mend, source)
|
||||
switch(wire)
|
||||
if(WIRE_EXPLODE)
|
||||
if(!mended)
|
||||
if(!mend)
|
||||
explode()
|
||||
|
||||
/datum/wires/landmine/claymore
|
||||
holder_type = /obj/item/landmine/claymore
|
||||
|
||||
/datum/wires/landmine/claymore/CanUse(var/mob/living/L)
|
||||
/datum/wires/landmine/claymore/interactable(mob/user)
|
||||
if(!..())
|
||||
return
|
||||
var/obj/item/landmine/claymore/claymore = holder
|
||||
if(!claymore.deactivated && claymore.deployed)
|
||||
return TRUE
|
||||
|
||||
@@ -1,38 +1,45 @@
|
||||
/datum/wires/nuclearbomb
|
||||
proper_name = "Nuclear Fission Device"
|
||||
holder_type = /obj/machinery/nuclearbomb
|
||||
random = 1
|
||||
wire_count = 7
|
||||
|
||||
var/const/NUCLEARBOMB_WIRE_LIGHT = 1
|
||||
var/const/NUCLEARBOMB_WIRE_TIMING = 2
|
||||
var/const/NUCLEARBOMB_WIRE_SAFETY = 4
|
||||
/datum/wires/nuclearbomb/New()
|
||||
wires = list(
|
||||
WIRE_LIGHT, WIRE_TIMING,
|
||||
WIRE_SAFETY
|
||||
)
|
||||
/// Listen, Derek. I know you're a surgeon, but...
|
||||
add_duds(2)
|
||||
..()
|
||||
|
||||
/datum/wires/nuclearbomb/CanUse(var/mob/living/L)
|
||||
/datum/wires/nuclearbomb/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/nuclearbomb/N = holder
|
||||
return N.panel_open
|
||||
|
||||
/datum/wires/nuclearbomb/GetInteractWindow()
|
||||
/datum/wires/nuclearbomb/get_status()
|
||||
var/obj/machinery/nuclearbomb/N = holder
|
||||
. += ..()
|
||||
. += "<BR>The device is [N.timing ? "shaking!" : "still."]<BR>"
|
||||
. += "The device is is [N.safety ? "quiet" : "whirring"].<BR>"
|
||||
. += "The lights are [N.lighthack ? "static" : "functional"].<BR>"
|
||||
. += "The device is [N.timing ? "shaking!" : "still."]"
|
||||
. += "The device is is [N.safety ? "quiet" : "whirring"]."
|
||||
. += "The lights are [N.lighthack ? "static" : "functional"]."
|
||||
|
||||
/datum/wires/nuclearbomb/UpdatePulsed(var/index)
|
||||
/datum/wires/nuclearbomb/on_pulse(wire)
|
||||
var/obj/machinery/nuclearbomb/N = holder
|
||||
switch(index)
|
||||
if(NUCLEARBOMB_WIRE_LIGHT)
|
||||
switch(wire)
|
||||
if(WIRE_LIGHT)
|
||||
N.lighthack = !N.lighthack
|
||||
N.update_icon()
|
||||
spawn(100)
|
||||
N.lighthack = !N.lighthack
|
||||
N.update_icon()
|
||||
if(NUCLEARBOMB_WIRE_TIMING)
|
||||
if(WIRE_TIMING)
|
||||
if(N.timing)
|
||||
spawn
|
||||
log_and_message_admins("pulsed a nuclear bomb's detonation wire, causing it to explode.")
|
||||
N.explode()
|
||||
if(NUCLEARBOMB_WIRE_SAFETY)
|
||||
if(WIRE_SAFETY)
|
||||
N.safety = !N.safety
|
||||
spawn(100)
|
||||
N.safety = !N.safety
|
||||
@@ -42,17 +49,17 @@ var/const/NUCLEARBOMB_WIRE_SAFETY = 4
|
||||
else
|
||||
N.visible_message("<span class='notice'>\The [N] emits a quiet whirling noise!</span>")
|
||||
|
||||
/datum/wires/nuclearbomb/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/nuclearbomb/on_cut(wire, mend, source)
|
||||
var/obj/machinery/nuclearbomb/N = holder
|
||||
switch(index)
|
||||
if(NUCLEARBOMB_WIRE_SAFETY)
|
||||
N.safety = mended
|
||||
switch(wire)
|
||||
if(WIRE_SAFETY)
|
||||
N.safety = mend
|
||||
if(N.timing)
|
||||
spawn
|
||||
log_and_message_admins("cut a nuclear bomb's timing wire, causing it to explode.")
|
||||
N.explode()
|
||||
if(NUCLEARBOMB_WIRE_TIMING)
|
||||
if(WIRE_TIMING)
|
||||
N.secure_device()
|
||||
if(NUCLEARBOMB_WIRE_LIGHT)
|
||||
N.lighthack = !mended
|
||||
if(WIRE_LIGHT)
|
||||
N.lighthack = !mend
|
||||
N.update_icon()
|
||||
|
||||
@@ -1,47 +1,52 @@
|
||||
/datum/wires/particle_acc/control_box
|
||||
wire_count = 4
|
||||
proper_name = "Particle Accelerator"
|
||||
holder_type = /obj/machinery/particle_accelerator/control_box
|
||||
|
||||
var/const/PARTICLE_TOGGLE_WIRE = 1 // Toggles whether the PA is on or not.
|
||||
var/const/PARTICLE_STRENGTH_WIRE = 2 // Determines the strength of the PA.
|
||||
var/const/PARTICLE_LIMIT_POWER_WIRE = 4 // Determines how strong the PA can be.
|
||||
/datum/wires/particle_acc/control_box/New()
|
||||
wires = list(
|
||||
WIRE_POWER,
|
||||
WIRE_STRENGTH, WIRE_POWER_LIMIT
|
||||
)
|
||||
add_duds(2)
|
||||
..()
|
||||
|
||||
/datum/wires/particle_acc/control_box/GetInteractWindow()
|
||||
/datum/wires/particle_acc/control_box/get_status()
|
||||
var/obj/machinery/particle_accelerator/control_box/C = holder
|
||||
. += ..()
|
||||
. += text("<br>\n[]<br>\n[]<br>\n[]",
|
||||
((C.active && C.assembled) ? "The firing light is on." : "The firing light is off."),
|
||||
(C.strength ? "The strength light is blinking." : "The strength light is off."),
|
||||
(C.strength_upper_limit == 2 ? "The strength limiter light is on." : "The strength limiter light is off."))
|
||||
. += (C.active && C.assembled) ? "The firing light is on." : "The firing light is off."
|
||||
. += C.strength ? "The strength light is blinking." : "The strength light is off."
|
||||
. += C.strength_upper_limit == 2 ? "The strength limiter light is on." : "The strength limiter light is off."
|
||||
|
||||
/datum/wires/particle_acc/control_box/CanUse(var/mob/living/L)
|
||||
/datum/wires/particle_acc/control_box/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/particle_accelerator/control_box/C = holder
|
||||
if(C.construction_state == 2)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/wires/particle_acc/control_box/UpdatePulsed(var/index)
|
||||
/datum/wires/particle_acc/control_box/on_pulse(wire)
|
||||
var/obj/machinery/particle_accelerator/control_box/C = holder
|
||||
switch(index)
|
||||
switch(wire)
|
||||
|
||||
if(PARTICLE_TOGGLE_WIRE)
|
||||
if(WIRE_POWER)
|
||||
C.toggle_power(usr)
|
||||
|
||||
if(PARTICLE_STRENGTH_WIRE)
|
||||
if(WIRE_STRENGTH)
|
||||
C.add_strength()
|
||||
|
||||
if(PARTICLE_LIMIT_POWER_WIRE)
|
||||
if(WIRE_POWER_LIMIT)
|
||||
C.visible_message("[icon2html(C, viewers(get_turf(C)))]<b>[C]</b> makes a large whirring noise.")
|
||||
|
||||
/datum/wires/particle_acc/control_box/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/particle_acc/control_box/on_cut(wire, mend, source)
|
||||
var/obj/machinery/particle_accelerator/control_box/C = holder
|
||||
switch(index)
|
||||
switch(wire)
|
||||
|
||||
if(PARTICLE_TOGGLE_WIRE)
|
||||
if(C.active == !mended)
|
||||
if(WIRE_POWER)
|
||||
if(C.active == !mend)
|
||||
C.toggle_power(usr)
|
||||
|
||||
if(PARTICLE_LIMIT_POWER_WIRE)
|
||||
C.strength_upper_limit = (mended ? 2 : 3)
|
||||
if(WIRE_POWER_LIMIT)
|
||||
C.strength_upper_limit = (mend ? 2 : 3)
|
||||
if(C.strength_upper_limit < C.strength)
|
||||
C.remove_strength()
|
||||
|
||||
+26
-19
@@ -1,41 +1,48 @@
|
||||
/datum/wires/radio
|
||||
proper_name = "Radio"
|
||||
holder_type = /obj/item/device/radio
|
||||
wire_count = 3
|
||||
|
||||
var/const/WIRE_SIGNAL = 1
|
||||
var/const/WIRE_RECEIVE = 2
|
||||
var/const/WIRE_TRANSMIT = 4
|
||||
/datum/wires/radio/New()
|
||||
wires = list(
|
||||
WIRE_SIGNAL,
|
||||
WIRE_RECEIVE,
|
||||
WIRE_TRANSMIT
|
||||
)
|
||||
add_duds(1)
|
||||
..()
|
||||
|
||||
/datum/wires/radio/CanUse(var/mob/living/L)
|
||||
/datum/wires/radio/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/item/device/radio/R = holder
|
||||
if(R.b_stat)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/wires/radio/UpdatePulsed(var/index)
|
||||
/datum/wires/radio/on_pulse(wire)
|
||||
var/obj/item/device/radio/R = holder
|
||||
switch(index)
|
||||
switch(wire)
|
||||
if(WIRE_SIGNAL)
|
||||
R.set_listening(!R.get_listening() && !IsIndexCut(WIRE_RECEIVE))
|
||||
R.set_broadcasting(R.get_listening() && !IsIndexCut(WIRE_TRANSMIT))
|
||||
R.set_listening(!R.get_listening() && !is_cut(WIRE_RECEIVE))
|
||||
R.set_broadcasting(R.get_listening() && !is_cut(WIRE_TRANSMIT))
|
||||
|
||||
if(WIRE_RECEIVE)
|
||||
R.set_listening(!R.get_listening() && !IsIndexCut(WIRE_SIGNAL))
|
||||
R.set_listening(!R.get_listening() && !is_cut(WIRE_SIGNAL))
|
||||
|
||||
if(WIRE_TRANSMIT)
|
||||
R.set_broadcasting(!R.get_broadcasting() && !IsIndexCut(WIRE_SIGNAL))
|
||||
R.set_broadcasting(!R.get_broadcasting() && !is_cut(WIRE_SIGNAL))
|
||||
SSnanoui.update_uis(holder)
|
||||
|
||||
/datum/wires/radio/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/radio/on_cut(wire, mend, source)
|
||||
var/obj/item/device/radio/R = holder
|
||||
switch(index)
|
||||
switch(wire)
|
||||
if(WIRE_SIGNAL)
|
||||
R.set_listening(mended && !IsIndexCut(WIRE_RECEIVE))
|
||||
R.set_broadcasting(mended && !IsIndexCut(WIRE_TRANSMIT))
|
||||
R.set_listening(mend && !is_cut(WIRE_RECEIVE))
|
||||
R.set_broadcasting(mend && !is_cut(WIRE_TRANSMIT))
|
||||
|
||||
if(WIRE_RECEIVE)
|
||||
R.set_listening(mended && !IsIndexCut(WIRE_SIGNAL))
|
||||
R.set_listening(mend && !is_cut(WIRE_SIGNAL))
|
||||
|
||||
if(WIRE_TRANSMIT)
|
||||
R.set_broadcasting(mended && !IsIndexCut(WIRE_SIGNAL))
|
||||
R.set_broadcasting(mend && !is_cut(WIRE_SIGNAL))
|
||||
SSnanoui.update_uis(holder)
|
||||
|
||||
+39
-39
@@ -1,30 +1,32 @@
|
||||
/datum/wires/robot
|
||||
random = 1
|
||||
proper_name = "Synthetic"
|
||||
random = TRUE
|
||||
holder_type = /mob/living/silicon/robot
|
||||
wire_count = 5
|
||||
|
||||
var/const/BORG_WIRE_LAWCHECK = 1
|
||||
var/const/BORG_WIRE_MAIN_POWER = 2 // The power wires do nothing whyyyyyyyyyyyyy
|
||||
var/const/BORG_WIRE_LOCKED_DOWN = 4
|
||||
var/const/BORG_WIRE_AI_CONTROL = 8
|
||||
var/const/BORG_WIRE_CAMERA = 16
|
||||
|
||||
/datum/wires/robot/GetInteractWindow()
|
||||
/datum/wires/robot/New()
|
||||
wires = list(
|
||||
WIRE_LAWSYNC,
|
||||
WIRE_AI,
|
||||
WIRE_CAMERA,
|
||||
WIRE_LOCKDOWN
|
||||
)
|
||||
add_duds(2)
|
||||
..()
|
||||
|
||||
/datum/wires/robot/get_status()
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
. = ..()
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
. += text("<br>\n[(R.law_update ? "The LawSync light is on." : "The LawSync light is off.")]")
|
||||
. += text("<br>\n[(R.connected_ai ? "The AI link light is on." : "The AI link light is off.")]")
|
||||
. += text("<br>\n[((!isnull(R.camera) && R.camera.status == 1) ? "The Camera light is on." : "The Camera light is off.")]")
|
||||
. += text("<br>\n[(R.lock_charge ? "The lockdown light is on." : "The lockdown light is off.")]")
|
||||
return .
|
||||
. += "[(R.law_update ? "The LawSync light is on." : "The LawSync light is off.")]"
|
||||
. += "[(R.connected_ai ? "The AI link light is on." : "The AI link light is off.")]"
|
||||
. += "[((!isnull(R.camera) && R.camera.status == 1) ? "The Camera light is on." : "The Camera light is off.")]"
|
||||
. += "[(R.lock_charge ? "The lockdown light is on." : "The lockdown light is off.")]"
|
||||
|
||||
/datum/wires/robot/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/robot/on_cut(wire, mend, source)
|
||||
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
switch(index)
|
||||
if(BORG_WIRE_LAWCHECK) //Cut the law wire, and the borg will no longer receive law updates from its AI
|
||||
if(!mended)
|
||||
switch(wire)
|
||||
if(WIRE_LAWSYNC) //Cut the law wire, and the borg will no longer receive law updates from its AI
|
||||
if(!mend)
|
||||
if (R.law_update == 1)
|
||||
to_chat(R, "LawSync protocol engaged.")
|
||||
R.show_laws()
|
||||
@@ -32,48 +34,46 @@ var/const/BORG_WIRE_CAMERA = 16
|
||||
if (R.law_update == 0 && !R.emagged)
|
||||
R.law_update = 1
|
||||
|
||||
if (BORG_WIRE_AI_CONTROL) //Cut the AI wire to reset AI control
|
||||
if(!mended)
|
||||
if (WIRE_AI) //Cut the AI wire to reset AI control
|
||||
if(!mend)
|
||||
R.disconnect_from_ai()
|
||||
|
||||
if (BORG_WIRE_CAMERA)
|
||||
if (WIRE_CAMERA)
|
||||
if(!isnull(R.camera) && !R.scrambled_codes)
|
||||
R.camera.status = mended
|
||||
R.camera.status = mend
|
||||
R.camera.kick_viewers() // Will kick anyone who is watching the Cyborg's camera.
|
||||
|
||||
if(BORG_WIRE_LAWCHECK) //Forces a law update if the borg is set to receive them. Since an update would happen when the borg checks its laws anyway, not much use, but eh
|
||||
if(WIRE_LAWSYNC) //Forces a law update if the borg is set to receive them. Since an update would happen when the borg checks its laws anyway, not much use, but eh
|
||||
if (R.law_update)
|
||||
R.lawsync()
|
||||
|
||||
if(BORG_WIRE_LOCKED_DOWN)
|
||||
R.SetLockdown(!mended)
|
||||
if(WIRE_LOCKDOWN)
|
||||
R.SetLockdown(!mend)
|
||||
|
||||
|
||||
/datum/wires/robot/UpdatePulsed(var/index)
|
||||
/datum/wires/robot/on_pulse(wire)
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
switch(index)
|
||||
if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI
|
||||
switch(wire)
|
||||
if (WIRE_AI) //pulse the AI wire to make the borg reselect an AI
|
||||
if(!R.emagged)
|
||||
var/mob/living/silicon/ai/new_ai = select_active_ai(R)
|
||||
R.connect_to_ai(new_ai)
|
||||
|
||||
if (BORG_WIRE_CAMERA)
|
||||
if (WIRE_CAMERA)
|
||||
if(!isnull(R.camera) && R.camera.can_use() && !R.scrambled_codes)
|
||||
R.camera.kick_viewers() // Kick anyone watching the Cyborg's camera
|
||||
R.visible_message("[R]'s camera lense focuses loudly.")
|
||||
to_chat(R, "Your camera lense focuses loudly.")
|
||||
|
||||
if(BORG_WIRE_LOCKED_DOWN)
|
||||
if(WIRE_LOCKDOWN)
|
||||
R.SetLockdown(!R.lock_charge) // Toggle
|
||||
|
||||
/datum/wires/robot/CanUse(var/mob/living/L)
|
||||
/datum/wires/robot/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
if(R.wires_exposed)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/robot/proc/IsCameraCut()
|
||||
return wires_status & BORG_WIRE_CAMERA
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/wires/robot/proc/LockedCut()
|
||||
return wires_status & BORG_WIRE_LOCKED_DOWN
|
||||
return is_cut(WIRE_LOCKDOWN)
|
||||
|
||||
@@ -1,69 +1,75 @@
|
||||
/datum/wires/smartfridge
|
||||
proper_name = "SmartFridge"
|
||||
holder_type = /obj/machinery/smartfridge
|
||||
wire_count = 5
|
||||
|
||||
/datum/wires/smartfridge/New()
|
||||
wires = list(
|
||||
WIRE_THROW,
|
||||
WIRE_SHOCK,
|
||||
WIRE_IDSCAN,
|
||||
WIRE_COOLING,
|
||||
WIRE_HEATING
|
||||
)
|
||||
add_duds(1)
|
||||
..()
|
||||
|
||||
/datum/wires/smartfridge/secure
|
||||
random = 1
|
||||
wire_count = 6
|
||||
|
||||
var/const/SMARTFRIDGE_WIRE_ELECTRIFY = 1
|
||||
var/const/SMARTFRIDGE_WIRE_THROW = 2
|
||||
var/const/SMARTFRIDGE_WIRE_IDSCAN = 4
|
||||
var/const/SMARTFRIDGE_WIRE_COOLING = 8
|
||||
var/const/SMARTFRIDGE_WIRE_HEATING = 16
|
||||
|
||||
/datum/wires/smartfridge/CanUse(var/mob/living/L)
|
||||
/datum/wires/smartfridge/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/smartfridge/S = holder
|
||||
if(!istype(L, /mob/living/silicon))
|
||||
if(!istype(user, /mob/living/silicon))
|
||||
if(S.seconds_electrified)
|
||||
if(S.shock(L, 100))
|
||||
return 0
|
||||
if(S.shock(user, 100))
|
||||
return FALSE
|
||||
if(S.panel_open)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/wires/smartfridge/GetInteractWindow()
|
||||
/datum/wires/smartfridge/get_status()
|
||||
var/obj/machinery/smartfridge/S = holder
|
||||
. += ..()
|
||||
. += "<BR>The orange light is [S.seconds_electrified ? "off" : "on"].<BR>"
|
||||
. += "The red light is [S.shoot_inventory ? "off" : "blinking"].<BR>"
|
||||
. += "A [S.scan_id ? "purple" : "yellow"] light is on.<BR>"
|
||||
. += "The cyan light is [S.cooling ? "on" : "off"].<BR>"
|
||||
. += "The blue light is [S.heating ? "on" : "off"].<BR>"
|
||||
. += "The orange light is [S.seconds_electrified ? "off" : "on"]."
|
||||
. += "The red light is [S.shoot_inventory ? "off" : "blinking"]."
|
||||
. += "A [S.scan_id ? "purple" : "yellow"] light is on."
|
||||
. += "The cyan light is [S.cooling ? "on" : "off"]."
|
||||
. += "The blue light is [S.heating ? "on" : "off"]."
|
||||
|
||||
/datum/wires/smartfridge/UpdatePulsed(var/index)
|
||||
/datum/wires/smartfridge/on_pulse(wire)
|
||||
var/obj/machinery/smartfridge/S = holder
|
||||
switch(index)
|
||||
if(SMARTFRIDGE_WIRE_THROW)
|
||||
switch(wire)
|
||||
if(WIRE_THROW)
|
||||
S.shoot_inventory = !S.shoot_inventory
|
||||
if(SMARTFRIDGE_WIRE_ELECTRIFY)
|
||||
if(WIRE_SHOCK)
|
||||
S.seconds_electrified = 30
|
||||
if(SMARTFRIDGE_WIRE_IDSCAN)
|
||||
if(WIRE_IDSCAN)
|
||||
S.scan_id = !S.scan_id
|
||||
if(SMARTFRIDGE_WIRE_COOLING)
|
||||
if(WIRE_COOLING)
|
||||
S.cooling = !S.cooling
|
||||
S.heating = FALSE
|
||||
if(SMARTFRIDGE_WIRE_HEATING)
|
||||
if(WIRE_HEATING)
|
||||
S.heating = !S.cooling
|
||||
S.cooling = FALSE
|
||||
|
||||
/datum/wires/smartfridge/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/smartfridge/on_cut(wire, mend, source)
|
||||
var/obj/machinery/smartfridge/S = holder
|
||||
switch(index)
|
||||
if(SMARTFRIDGE_WIRE_THROW)
|
||||
S.shoot_inventory = !mended
|
||||
if(SMARTFRIDGE_WIRE_ELECTRIFY)
|
||||
if(mended)
|
||||
switch(wire)
|
||||
if(WIRE_THROW)
|
||||
S.shoot_inventory = !mend
|
||||
if(WIRE_SHOCK)
|
||||
if(mend)
|
||||
S.seconds_electrified = 0
|
||||
else
|
||||
S.seconds_electrified = -1
|
||||
if(SMARTFRIDGE_WIRE_IDSCAN)
|
||||
if(WIRE_IDSCAN)
|
||||
S.scan_id = 1
|
||||
if(SMARTFRIDGE_WIRE_COOLING)
|
||||
S.cooling = mended
|
||||
if(WIRE_COOLING)
|
||||
S.cooling = mend
|
||||
S.heating = FALSE
|
||||
if(SMARTFRIDGE_WIRE_HEATING)
|
||||
S.heating = mended
|
||||
if(WIRE_HEATING)
|
||||
S.heating = mend
|
||||
S.cooling = FALSE
|
||||
|
||||
|
||||
|
||||
+39
-35
@@ -1,58 +1,62 @@
|
||||
/datum/wires/smes
|
||||
proper_name = "SMES"
|
||||
holder_type = /obj/machinery/power/smes/buildable
|
||||
wire_count = 5
|
||||
|
||||
var/const/SMES_WIRE_RCON = 1 // Remote control (AI and consoles), cut to disable
|
||||
var/const/SMES_WIRE_INPUT = 2 // Input wire, cut to disable input, pulse to disable for 60s
|
||||
var/const/SMES_WIRE_OUTPUT = 4 // Output wire, cut to disable output, pulse to disable for 60s
|
||||
var/const/SMES_WIRE_GROUNDING = 8 // Cut to quickly discharge causing sparks, pulse to only create few sparks
|
||||
var/const/SMES_WIRE_FAILSAFES = 16 // Cut to disable failsafes, mend to reenable
|
||||
/datum/wires/smes/New()
|
||||
wires = list(
|
||||
WIRE_RCON,
|
||||
WIRE_INPUT,
|
||||
WIRE_OUTPUT,
|
||||
WIRE_GROUNDING,
|
||||
WIRE_FAILSAFES
|
||||
)
|
||||
add_duds(1)
|
||||
..()
|
||||
|
||||
|
||||
/datum/wires/smes/CanUse(var/mob/living/L)
|
||||
/datum/wires/smes/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/power/smes/buildable/S = holder
|
||||
if(S.open_hatch)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
/datum/wires/smes/GetInteractWindow()
|
||||
/datum/wires/smes/get_status()
|
||||
var/obj/machinery/power/smes/buildable/S = holder
|
||||
. += ..()
|
||||
. += "The green light is [(S.input_cut || S.input_pulsed || S.output_cut || S.output_pulsed) ? "off" : "on"]<br>"
|
||||
. += "The red light is [(S.safeties_enabled || S.grounding) ? "off" : "blinking"]<br>"
|
||||
. += "The blue light is [S.RCon ? "on" : "off"]"
|
||||
. += "The green light is [(S.input_cut || S.input_pulsed || S.output_cut || S.output_pulsed) ? "off" : "on"]."
|
||||
. += "The red light is [(S.safeties_enabled || S.grounding) ? "off" : "blinking"]."
|
||||
. += "The blue light is [S.RCon ? "on" : "off"]."
|
||||
|
||||
|
||||
/datum/wires/smes/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/smes/on_cut(wire, mend, source)
|
||||
var/obj/machinery/power/smes/buildable/S = holder
|
||||
switch(index)
|
||||
if(SMES_WIRE_RCON)
|
||||
S.RCon = mended
|
||||
if(SMES_WIRE_INPUT)
|
||||
S.input_cut = !mended
|
||||
if(SMES_WIRE_OUTPUT)
|
||||
S.output_cut = !mended
|
||||
if(SMES_WIRE_GROUNDING)
|
||||
S.grounding = mended
|
||||
if(SMES_WIRE_FAILSAFES)
|
||||
S.safeties_enabled = mended
|
||||
switch(wire)
|
||||
if(WIRE_RCON)
|
||||
S.RCon = mend
|
||||
if(WIRE_INPUT)
|
||||
S.input_cut = !mend
|
||||
if(WIRE_OUTPUT)
|
||||
S.output_cut = !mend
|
||||
if(WIRE_GROUNDING)
|
||||
S.grounding = mend
|
||||
if(WIRE_FAILSAFES)
|
||||
S.safeties_enabled = mend
|
||||
|
||||
|
||||
/datum/wires/smes/UpdatePulsed(var/index)
|
||||
/datum/wires/smes/on_pulse(wire)
|
||||
var/obj/machinery/power/smes/buildable/S = holder
|
||||
switch(index)
|
||||
if(SMES_WIRE_RCON)
|
||||
switch(wire)
|
||||
if(WIRE_RCON)
|
||||
if(S.RCon)
|
||||
S.RCon = 0
|
||||
addtimer(CALLBACK(S, TYPE_PROC_REF(/obj/machinery/power/smes/buildable, reset_rcon)), 10)
|
||||
if(SMES_WIRE_INPUT)
|
||||
if(WIRE_INPUT)
|
||||
S.toggle_input()
|
||||
if(SMES_WIRE_OUTPUT)
|
||||
if(WIRE_OUTPUT)
|
||||
S.toggle_output()
|
||||
if(SMES_WIRE_GROUNDING)
|
||||
if(WIRE_GROUNDING)
|
||||
S.grounding = 0
|
||||
if(SMES_WIRE_FAILSAFES)
|
||||
if(WIRE_FAILSAFES)
|
||||
if(S.safeties_enabled)
|
||||
S.safeties_enabled = 0
|
||||
addtimer(CALLBACK(S, TYPE_PROC_REF(/obj/machinery/power/smes/buildable, reset_safeties)), 10)
|
||||
|
||||
@@ -1,47 +1,54 @@
|
||||
/datum/wires/suit_storage_unit
|
||||
proper_name = "Suit Storage Unit"
|
||||
holder_type = /obj/machinery/suit_cycler
|
||||
wire_count = 3
|
||||
|
||||
var/const/SUIT_STORAGE_WIRE_ELECTRIFY = 1
|
||||
var/const/SUIT_STORAGE_WIRE_SAFETY = 2
|
||||
var/const/SUIT_STORAGE_WIRE_LOCKED = 4
|
||||
/datum/wires/suit_storage_unit/New()
|
||||
wires = list(
|
||||
WIRE_SAFETY,
|
||||
WIRE_SHOCK,
|
||||
WIRE_LOCKDOWN
|
||||
)
|
||||
add_duds(1)
|
||||
..()
|
||||
|
||||
/datum/wires/suit_storage_unit/CanUse(var/mob/living/L)
|
||||
/datum/wires/suit_storage_unit/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/suit_cycler/S = holder
|
||||
if(!istype(L, /mob/living/silicon))
|
||||
if(!istype(user, /mob/living/silicon))
|
||||
if(S.electrified)
|
||||
if(S.shock(L, 100))
|
||||
return 0
|
||||
if(S.shock(user, 100))
|
||||
return FALSE
|
||||
if(S.panel_open)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/wires/suit_storage_unit/GetInteractWindow()
|
||||
/datum/wires/suit_storage_unit/get_status()
|
||||
var/obj/machinery/suit_cycler/S = holder
|
||||
. += ..()
|
||||
. += "<BR>The orange light is [S.electrified ? "off" : "on"].<BR>"
|
||||
. += "The red light is [S.safeties ? "off" : "blinking"].<BR>"
|
||||
. += "The yellow light is [S.locked ? "on" : "off"].<BR>"
|
||||
. += "The orange light is [S.electrified ? "off" : "on"]."
|
||||
. += "The red light is [S.safeties ? "off" : "blinking"]."
|
||||
. += "The yellow light is [S.locked ? "on" : "off"]."
|
||||
|
||||
/datum/wires/suit_storage_unit/UpdatePulsed(var/index)
|
||||
/datum/wires/suit_storage_unit/on_pulse(wire)
|
||||
var/obj/machinery/suit_cycler/S = holder
|
||||
switch(index)
|
||||
if(SUIT_STORAGE_WIRE_SAFETY)
|
||||
switch(wire)
|
||||
if(WIRE_SAFETY)
|
||||
S.safeties = !S.safeties
|
||||
if(SUIT_STORAGE_WIRE_ELECTRIFY)
|
||||
if(WIRE_SHOCK)
|
||||
S.electrified = 30
|
||||
if(SUIT_STORAGE_WIRE_LOCKED)
|
||||
if(WIRE_LOCKDOWN)
|
||||
S.locked = !S.locked
|
||||
|
||||
/datum/wires/suit_storage_unit/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/suit_storage_unit/on_cut(wire, mend, source)
|
||||
var/obj/machinery/suit_cycler/S = holder
|
||||
switch(index)
|
||||
if(SUIT_STORAGE_WIRE_SAFETY)
|
||||
S.safeties = mended
|
||||
if(SUIT_STORAGE_WIRE_LOCKED)
|
||||
S.locked = mended
|
||||
if(SUIT_STORAGE_WIRE_ELECTRIFY)
|
||||
if(mended)
|
||||
switch(wire)
|
||||
if(WIRE_SAFETY)
|
||||
S.safeties = mend
|
||||
if(WIRE_SHOCK)
|
||||
S.locked = mend
|
||||
if(WIRE_LOCKDOWN)
|
||||
if(mend)
|
||||
S.electrified = 0
|
||||
else
|
||||
S.electrified = -1
|
||||
|
||||
@@ -1,92 +1,85 @@
|
||||
/datum/wires/vending
|
||||
proper_name = "Vending Machine"
|
||||
holder_type = /obj/machinery/vending
|
||||
wire_count = 6
|
||||
|
||||
/datum/wires/vending/New()
|
||||
wires = list(
|
||||
WIRE_THROW,
|
||||
WIRE_CONTRABAND,
|
||||
WIRE_SHOCK,
|
||||
WIRE_IDSCAN,
|
||||
WIRE_COOLING,
|
||||
WIRE_HEATING
|
||||
)
|
||||
..()
|
||||
|
||||
/datum/wires/vending/blueprint
|
||||
cares_about_holder = FALSE
|
||||
|
||||
var/const/VENDING_WIRE_THROW = 1
|
||||
var/const/VENDING_WIRE_CONTRABAND = 2
|
||||
var/const/VENDING_WIRE_ELECTRIFY = 4
|
||||
var/const/VENDING_WIRE_IDSCAN = 8
|
||||
var/const/VENDING_WIRE_COOLING = 16
|
||||
var/const/VENDING_WIRE_HEATING = 32
|
||||
|
||||
/datum/wires/vending/CanUse(var/mob/living/L)
|
||||
/datum/wires/vending/interactable(mob/user)
|
||||
if(!..())
|
||||
return FALSE
|
||||
var/obj/machinery/vending/V = holder
|
||||
if(!istype(L, /mob/living/silicon))
|
||||
if(!istype(user, /mob/living/silicon))
|
||||
if(V.seconds_electrified)
|
||||
if(V.shock(L, 100))
|
||||
return 0
|
||||
if(V.shock(user, 100))
|
||||
return FALSE
|
||||
if(V.panel_open)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/wires/vending/GetInteractWindow()
|
||||
/datum/wires/vending/get_status()
|
||||
var/obj/machinery/vending/V = holder
|
||||
. += ..()
|
||||
. += "<BR>The orange light is [V.seconds_electrified ? "off" : "on"].<BR>"
|
||||
. += "The red light is [V.shoot_inventory ? "off" : "blinking"].<BR>"
|
||||
. += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"].<BR>"
|
||||
. += "The [V.scan_id ? "purple" : "yellow"] light is on.<BR>"
|
||||
. += "The cyan light is [V.temperature_setting == -1 ? "on" : "off"].<BR>"
|
||||
. += "The blue light is [V.temperature_setting == 1 ? "on" : "off"].<BR>"
|
||||
. += "The orange light is [V.seconds_electrified ? "off" : "on"]."
|
||||
. += "The red light is [V.shoot_inventory ? "off" : "blinking"]."
|
||||
. += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"]."
|
||||
. += "The [V.scan_id ? "purple" : "yellow"] light is on."
|
||||
. += "The cyan light is [V.temperature_setting == -1 ? "on" : "off"]."
|
||||
. += "The blue light is [V.temperature_setting == 1 ? "on" : "off"]."
|
||||
|
||||
/datum/wires/vending/UpdatePulsed(var/index)
|
||||
/datum/wires/vending/on_pulse(wire)
|
||||
var/obj/machinery/vending/V = holder
|
||||
switch(index)
|
||||
if(VENDING_WIRE_THROW)
|
||||
switch(wire)
|
||||
if(WIRE_THROW)
|
||||
V.shoot_inventory = !V.shoot_inventory
|
||||
if(VENDING_WIRE_CONTRABAND)
|
||||
if(WIRE_CONTRABAND)
|
||||
V.categories ^= CAT_HIDDEN
|
||||
if(VENDING_WIRE_ELECTRIFY)
|
||||
if(WIRE_SHOCK)
|
||||
V.seconds_electrified = 30
|
||||
if(VENDING_WIRE_IDSCAN)
|
||||
if(WIRE_IDSCAN)
|
||||
V.scan_id = !V.scan_id
|
||||
if(VENDING_WIRE_COOLING)
|
||||
if(WIRE_COOLING)
|
||||
V.temperature_setting = V.temperature_setting != -1 ? -1 : 0
|
||||
if(VENDING_WIRE_HEATING)
|
||||
if(WIRE_HEATING)
|
||||
V.temperature_setting = V.temperature_setting != 1 ? 1 : 0
|
||||
|
||||
/datum/wires/vending/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/vending/on_cut(wire, mend, source)
|
||||
var/obj/machinery/vending/V = holder
|
||||
switch(index)
|
||||
if(VENDING_WIRE_THROW)
|
||||
V.shoot_inventory = !mended
|
||||
if(VENDING_WIRE_CONTRABAND)
|
||||
switch(wire)
|
||||
if(WIRE_THROW)
|
||||
V.shoot_inventory = !mend
|
||||
if(WIRE_CONTRABAND)
|
||||
V.categories &= ~CAT_HIDDEN
|
||||
if(VENDING_WIRE_ELECTRIFY)
|
||||
if(mended)
|
||||
if(WIRE_SHOCK)
|
||||
if(mend)
|
||||
V.seconds_electrified = 0
|
||||
else
|
||||
V.seconds_electrified = -1
|
||||
if(VENDING_WIRE_IDSCAN)
|
||||
if(WIRE_IDSCAN)
|
||||
V.scan_id = 1
|
||||
if(VENDING_WIRE_COOLING)
|
||||
V.temperature_setting = mended && V.temperature_setting != 1 ? -1 : 0
|
||||
if(VENDING_WIRE_HEATING)
|
||||
V.temperature_setting = mended && V.temperature_setting != -1 ? 1 : 0
|
||||
if(WIRE_COOLING)
|
||||
V.temperature_setting = mend && V.temperature_setting != 1 ? -1 : 0
|
||||
if(WIRE_HEATING)
|
||||
V.temperature_setting = mend && V.temperature_setting != -1 ? 1 : 0
|
||||
|
||||
/datum/wires/vending/get_wire_diagram(var/mob/user)
|
||||
var/dat = ""
|
||||
for(var/color in wires)
|
||||
dat += "<font color='[color]'>[capitalize(color)]</font>: [index_to_type(GetIndex(color))]<br>"
|
||||
for(var/color in colors)
|
||||
if(is_dud_color(color))
|
||||
continue
|
||||
dat += "<font color='[color]'>[capitalize(color)]</font>: [get_wire(color)]<br>"
|
||||
|
||||
var/datum/browser/wire_win = new(user, "vendingwires", "Vending Wires", 450, 500)
|
||||
wire_win.set_content(dat)
|
||||
wire_win.open()
|
||||
|
||||
/datum/wires/vending/proc/index_to_type(var/index)
|
||||
switch(index)
|
||||
if(1)
|
||||
return "Ballistic Delivery Service"
|
||||
if(2)
|
||||
return "Secondary Stock"
|
||||
if(4)
|
||||
return "Anti-tampering"
|
||||
if(8)
|
||||
return "ID Scan"
|
||||
if(16)
|
||||
return "Cooling"
|
||||
if(32)
|
||||
return "Heating"
|
||||
|
||||
+310
-271
@@ -1,172 +1,208 @@
|
||||
// Wire datums. Created by Giacomand.
|
||||
// Was created to replace a horrible case of copy and pasted code with no care for maintability.
|
||||
// Goodbye Door wires, Cyborg wires, Vending Machine wires, Autolathe wires
|
||||
// Protolathe wires, APC wires and Camera wires!
|
||||
#define MAXIMUM_EMP_WIRES 3
|
||||
|
||||
#define MAX_FLAG 65535
|
||||
|
||||
var/list/same_wires = list()
|
||||
// 14 colours, if you're adding more than 14 wires then add more colours here
|
||||
var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown", "gold", "gray", "cyan", "navy", "purple", "pink", "black", "yellow")
|
||||
var/global/list/wire_color_directory = list()
|
||||
var/global/list/wire_name_directory = list()
|
||||
|
||||
/datum/wires
|
||||
|
||||
var/random = 0 // Will the wires be different for every single instance.
|
||||
var/atom/holder = null // The holder
|
||||
/// The holder (atom that contains these wires).
|
||||
var/atom/holder
|
||||
/// The holder's typepath (used for sanity checks to make sure the holder is the appropriate type for these wire sets).
|
||||
var/holder_type
|
||||
/// Whether this wire datum errors out if it has a wrong holder or not.
|
||||
var/cares_about_holder = TRUE
|
||||
var/holder_type = null // The holder type; used to make sure that the holder is the correct type.
|
||||
var/wire_count = 0 // Max is 16
|
||||
var/wires_status = 0 // BITFLAG OF WIRES
|
||||
/// Key that enables wire assignments to be common across different holders. If null, will use the holder_type as a key.
|
||||
var/dictionary_key = null
|
||||
/// The display name for the wire set. Used in the hacking interface.
|
||||
var/proper_name = "Unknown"
|
||||
|
||||
var/list/wires
|
||||
var/list/signalers
|
||||
/// List of all wires.
|
||||
var/list/wires = list()
|
||||
/// List of cut wires.
|
||||
var/list/cut_wires = list() // List of wires that have been cut.
|
||||
/// Dictionary of colours to wire.
|
||||
var/list/colors = list()
|
||||
/// List of attached assemblies.
|
||||
var/list/assemblies = list()
|
||||
/// If every instance of these wires should be random. Prevents wires from showing up in station blueprints.
|
||||
var/random = FALSE
|
||||
/// Wire manufacturer for the UI skin.
|
||||
var/manufacturer = "hephaestus"
|
||||
|
||||
var/table_options = " align='center'"
|
||||
var/row_options1 = " width='80px'"
|
||||
var/row_options2 = " width='260px'"
|
||||
var/window_x = 370
|
||||
var/window_y = 470
|
||||
/datum/wires/New(atom/holder)
|
||||
..()
|
||||
if(!istype(holder, holder_type) && cares_about_holder)
|
||||
CRASH("Wire holder is not of the expected type!")
|
||||
|
||||
/datum/wires/New(var/atom/holder)
|
||||
wires = list()
|
||||
signalers = list()
|
||||
src.holder = holder
|
||||
if(cares_about_holder && !istype(holder, holder_type))
|
||||
CRASH("Our holder is null/the wrong type!")
|
||||
if(istype(holder, /obj/machinery))
|
||||
var/obj/machinery/M = holder
|
||||
manufacturer = M.manufacturer
|
||||
|
||||
// Generate new wires
|
||||
// If there is a dictionary key set, we'll want to use that. Otherwise, use the holder type.
|
||||
var/key = dictionary_key ? dictionary_key : holder_type
|
||||
|
||||
RegisterSignal(holder, COMSIG_QDELETING, PROC_REF(on_holder_qdel))
|
||||
if(random)
|
||||
GenerateWires()
|
||||
// Get the same wires
|
||||
randomize()
|
||||
else
|
||||
// We don't have any wires to copy yet, generate some and then copy it.
|
||||
if(!same_wires[holder_type])
|
||||
GenerateWires()
|
||||
same_wires[holder_type] = src.wires.Copy()
|
||||
if(!wire_color_directory[key])
|
||||
randomize()
|
||||
wire_color_directory[key] = colors
|
||||
wire_name_directory[key] = proper_name
|
||||
else
|
||||
var/list/wires = same_wires[holder_type]
|
||||
src.wires = wires // Reference the wires list.
|
||||
colors = wire_color_directory[key]
|
||||
|
||||
/datum/wires/Destroy()
|
||||
holder = null
|
||||
//properly clear refs to avoid harddels & other problems
|
||||
for(var/color in assemblies)
|
||||
var/obj/item/device/assembly/assembly = assemblies[color]
|
||||
assembly.holder = null
|
||||
LAZYCLEARLIST(assemblies)
|
||||
return ..()
|
||||
|
||||
/datum/wires/proc/GenerateWires()
|
||||
var/list/colours_to_pick = wireColours.Copy() // Get a copy, not a reference.
|
||||
var/list/indexes_to_pick = list()
|
||||
//Generate our indexes
|
||||
for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i)
|
||||
indexes_to_pick += i
|
||||
colours_to_pick.len = wire_count // Downsize it to our specifications.
|
||||
/datum/wires/proc/add_duds(duds)
|
||||
while(duds)
|
||||
var/dud = WIRE_DUD_PREFIX + "[--duds]"
|
||||
if(dud in wires)
|
||||
continue
|
||||
wires += dud
|
||||
|
||||
while(colours_to_pick.len && indexes_to_pick.len)
|
||||
// Pick and remove a colour
|
||||
var/colour = pick_n_take(colours_to_pick)
|
||||
///Called when holder is qdeleted for us to clean ourselves as not to leave any unlawful references.
|
||||
/datum/wires/proc/on_holder_qdel(atom/source, force)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
// Pick and remove an index
|
||||
var/index = pick_n_take(indexes_to_pick)
|
||||
qdel(src)
|
||||
|
||||
src.wires[colour] = index
|
||||
//wires = shuffle(wires)
|
||||
/datum/wires/proc/randomize()
|
||||
var/static/list/possible_colors = list(
|
||||
"blue",
|
||||
"brown",
|
||||
"crimson",
|
||||
"cyan",
|
||||
"gold",
|
||||
"green",
|
||||
"grey",
|
||||
"lime",
|
||||
"magenta",
|
||||
"orange",
|
||||
"pink",
|
||||
"purple",
|
||||
"red",
|
||||
"silver",
|
||||
"violet",
|
||||
"white",
|
||||
"yellow",
|
||||
)
|
||||
|
||||
var/list/my_possible_colors = possible_colors.Copy()
|
||||
|
||||
for(var/wire in shuffle(wires))
|
||||
colors[pick_n_take(my_possible_colors)] = wire
|
||||
|
||||
/datum/wires/proc/shuffle_wires()
|
||||
colors.Cut()
|
||||
randomize()
|
||||
|
||||
/datum/wires/proc/repair()
|
||||
for(var/wire in cut_wires)
|
||||
cut(wire) // I KNOW I KNOW OK
|
||||
|
||||
|
||||
/datum/wires/proc/Interact(var/mob/living/user)
|
||||
/datum/wires/proc/get_wire(color)
|
||||
return colors[color]
|
||||
|
||||
var/html = null
|
||||
if(holder && CanUse(user))
|
||||
html = GetInteractWindow()
|
||||
if(html)
|
||||
user.set_machine(holder)
|
||||
/datum/wires/proc/get_color_of_wire(wire_type)
|
||||
for(var/color in colors)
|
||||
var/other_type = colors[color]
|
||||
if(wire_type == other_type)
|
||||
return color
|
||||
|
||||
/datum/wires/proc/get_attached(color)
|
||||
if(assemblies[color])
|
||||
return assemblies[color]
|
||||
return null
|
||||
|
||||
/datum/wires/proc/is_attached(color)
|
||||
if(assemblies[color])
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/is_cut(wire)
|
||||
return (wire in cut_wires)
|
||||
|
||||
/datum/wires/proc/is_color_cut(color)
|
||||
return is_cut(get_wire(color))
|
||||
|
||||
/datum/wires/proc/is_all_cut()
|
||||
if(cut_wires.len == wires.len)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/is_dud(wire)
|
||||
return findtext(wire, WIRE_DUD_PREFIX, 1, length(WIRE_DUD_PREFIX) + 1)
|
||||
|
||||
/datum/wires/proc/is_dud_color(color)
|
||||
return is_dud(get_wire(color))
|
||||
|
||||
/datum/wires/proc/cut(wire, source)
|
||||
if(is_cut(wire))
|
||||
cut_wires -= wire
|
||||
SEND_SIGNAL(src, COMSIG_MEND_WIRE(wire), wire)
|
||||
on_cut(wire, mend = TRUE, source = source)
|
||||
else
|
||||
user.unset_machine()
|
||||
// No content means no window.
|
||||
user << browse(null, "window=wires")
|
||||
cut_wires += wire
|
||||
SEND_SIGNAL(src, COMSIG_CUT_WIRE(wire), wire)
|
||||
on_cut(wire, mend = FALSE, source = source)
|
||||
|
||||
/datum/wires/proc/cut_color(color, source)
|
||||
cut(get_wire(color), source)
|
||||
|
||||
/datum/wires/proc/cut_random(source)
|
||||
cut(wires[rand(1, wires.len)], source)
|
||||
|
||||
/datum/wires/proc/cut_all(source)
|
||||
for(var/wire in wires)
|
||||
cut(wire, source)
|
||||
|
||||
/datum/wires/proc/pulse(wire, user, force=FALSE)
|
||||
if(!force && is_cut(wire))
|
||||
return
|
||||
on_pulse(wire, user)
|
||||
|
||||
var/datum/browser/popup = new(user, "wires", holder.name, window_x, window_y)
|
||||
popup.set_content(html)
|
||||
popup.set_title_image(user.browse_rsc_icon(holder.icon, holder.icon_state))
|
||||
popup.open()
|
||||
/datum/wires/proc/pulse_color(color, mob/living/user, force=FALSE)
|
||||
pulse(get_wire(color), user, force)
|
||||
|
||||
/datum/wires/proc/GetInteractWindow()
|
||||
var/html = "<div class='block'>"
|
||||
html += "<h3>Exposed Wires</h3>"
|
||||
html += "<table[table_options]>"
|
||||
/datum/wires/proc/pulse_assembly(obj/item/device/assembly/signaler/S)
|
||||
for(var/color in assemblies)
|
||||
if(S == assemblies[color])
|
||||
pulse_color(color, force=TRUE)
|
||||
return TRUE
|
||||
|
||||
for(var/colour in wires)
|
||||
html += "<tr>"
|
||||
html += "<td[row_options1]><font color='[colour]'>[capitalize(colour)]</font></td>"
|
||||
html += "<td[row_options2]>"
|
||||
html += "<A href='?src=\ref[src];action=1;cut=[colour]'>[IsColourCut(colour) ? "Mend" : "Cut"]</A>"
|
||||
html += " <A href='?src=\ref[src];action=1;pulse=[colour]'>Pulse</A>"
|
||||
html += " <A href='?src=\ref[src];action=1;attach=[colour]'>[IsAttached(colour) ? "Detach" : "Attach"] Signaler</A></td></tr>"
|
||||
html += "</table>"
|
||||
html += "</div>"
|
||||
/datum/wires/proc/attach_assembly(color, obj/item/device/assembly/signaler/S)
|
||||
if(S && istype(S) && !is_attached(color))
|
||||
assemblies[color] = S
|
||||
S.forceMove(holder)
|
||||
S.connected = src
|
||||
return S
|
||||
|
||||
if (random)
|
||||
html += "<i>\The [holder] appears to have tamper-resistant electronics installed.</i><br><br>" //maybe this could be more generic?
|
||||
/datum/wires/proc/detach_assembly(color)
|
||||
var/obj/item/device/assembly/signaler/S = get_attached(color)
|
||||
if(S && istype(S))
|
||||
assemblies -= color
|
||||
S.connected = null
|
||||
S.forceMove(holder.loc)
|
||||
return S
|
||||
|
||||
return html
|
||||
/// Called from [/atom/proc/emp_act]
|
||||
/datum/wires/proc/emp_pulse()
|
||||
var/list/possible_wires = shuffle(wires)
|
||||
var/remaining_pulses = MAXIMUM_EMP_WIRES
|
||||
|
||||
/datum/wires/Topic(href, href_list)
|
||||
..()
|
||||
if(in_range(holder, usr) && isliving(usr))
|
||||
|
||||
var/mob/living/L = usr
|
||||
if(CanUse(L) && href_list["action"])
|
||||
if(href_list["attach"])
|
||||
var/colour = href_list["attach"]
|
||||
// Attach
|
||||
if(!IsAttached(colour))
|
||||
var/obj/item/device/assembly/signaler/I = L.get_type_in_hands(/obj/item/device/assembly/signaler)
|
||||
if(!istype(I))
|
||||
to_chat(usr, SPAN_WARNING("You do not have a signaler to attach!"))
|
||||
return
|
||||
usr.drop_from_inventory(I)
|
||||
Attach(colour, I)
|
||||
// Detach
|
||||
else
|
||||
var/obj/item/O = Detach(colour)
|
||||
if(O)
|
||||
L.put_in_hands(O)
|
||||
|
||||
if(href_list["cut"]) // Toggles the cut/mend status
|
||||
var/obj/item/I = L.get_active_hand()
|
||||
if(!I || !I.iswirecutter())
|
||||
if(isrobot(L))
|
||||
var/mob/living/silicon/robot/R = L
|
||||
I = R.return_wirecutter()
|
||||
else
|
||||
I = L.get_inactive_hand()
|
||||
if(I?.iswirecutter())
|
||||
var/colour = href_list["cut"]
|
||||
CutWireColour(colour)
|
||||
holder.add_hiddenprint(L)
|
||||
else
|
||||
to_chat(L, SPAN_WARNING("You need wirecutters!"))
|
||||
|
||||
else if(href_list["pulse"])
|
||||
var/obj/item/I = L.get_active_hand()
|
||||
if(!I || !I.ismultitool())
|
||||
if(isrobot(L))
|
||||
var/mob/living/silicon/robot/R = L
|
||||
I = R.return_multitool()
|
||||
else
|
||||
I = L.get_inactive_hand()
|
||||
if(I?.ismultitool())
|
||||
var/colour = href_list["pulse"]
|
||||
PulseColour(colour)
|
||||
holder.add_hiddenprint(L)
|
||||
else
|
||||
to_chat(L, SPAN_WARNING("You need a multitool!"))
|
||||
|
||||
|
||||
// Update Window
|
||||
Interact(usr)
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=wires")
|
||||
usr.unset_machine(holder)
|
||||
for(var/wire in possible_wires)
|
||||
if(prob(33))
|
||||
pulse(wire)
|
||||
remaining_pulses--
|
||||
if(!remaining_pulses)
|
||||
break
|
||||
|
||||
/datum/wires/proc/get_wire_diagram(var/mob/user)
|
||||
return
|
||||
@@ -175,154 +211,157 @@ var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown"
|
||||
// Overridable Procs
|
||||
//
|
||||
|
||||
// Called when wires cut/mended.
|
||||
/datum/wires/proc/UpdateCut(var/index, var/mended)
|
||||
/datum/wires/proc/interactable(mob/user)
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
if((SEND_SIGNAL(user, COMSIG_TRY_WIRES_INTERACT, holder) & COMPONENT_CANT_INTERACT_WIRES))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/get_status()
|
||||
return list()
|
||||
|
||||
/datum/wires/proc/on_cut(wire, mend = FALSE, source = null)
|
||||
return
|
||||
|
||||
// Called when wire pulsed. Add code here.
|
||||
/datum/wires/proc/UpdatePulsed(var/index)
|
||||
/datum/wires/proc/on_pulse(wire, user)
|
||||
return
|
||||
|
||||
/datum/wires/proc/CanUse(var/mob/living/L)
|
||||
return 1
|
||||
// End Overridable Procs
|
||||
|
||||
// Example of use:
|
||||
/*
|
||||
|
||||
var/const/BOLTED= 1
|
||||
var/const/SHOCKED = 2
|
||||
var/const/SAFETY = 4
|
||||
var/const/POWER = 8
|
||||
|
||||
/datum/wires/door/UpdateCut(var/index, var/mended)
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
switch(index)
|
||||
if(BOLTED)
|
||||
if(!mended)
|
||||
A.bolt()
|
||||
if(SHOCKED)
|
||||
A.shock()
|
||||
if(SAFETY )
|
||||
A.safety()
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// Helper Procs
|
||||
//
|
||||
|
||||
/datum/wires/proc/PulseColour(var/colour)
|
||||
PulseIndex(GetIndex(colour))
|
||||
|
||||
/datum/wires/proc/PulseIndex(var/index)
|
||||
if(IsIndexCut(index))
|
||||
/datum/wires/proc/interact(mob/user)
|
||||
if(!interactable(user))
|
||||
return
|
||||
UpdatePulsed(index)
|
||||
|
||||
/datum/wires/proc/GetIndex(var/colour)
|
||||
if(wires[colour])
|
||||
var/index = wires[colour]
|
||||
return index
|
||||
else
|
||||
CRASH("[colour] is not a key in wires.")
|
||||
|
||||
//
|
||||
// Is Index/Colour Cut procs
|
||||
//
|
||||
|
||||
/datum/wires/proc/IsColourCut(var/colour)
|
||||
var/index = GetIndex(colour)
|
||||
return IsIndexCut(index)
|
||||
|
||||
/datum/wires/proc/IsIndexCut(var/index)
|
||||
return (index & wires_status)
|
||||
|
||||
//
|
||||
// signaler Procs
|
||||
//
|
||||
|
||||
/datum/wires/proc/IsAttached(var/colour)
|
||||
if(signalers[colour])
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/proc/GetAttached(var/colour)
|
||||
if(signalers[colour])
|
||||
return signalers[colour]
|
||||
return null
|
||||
|
||||
/datum/wires/proc/Attach(var/colour, var/obj/item/device/assembly/signaler/S)
|
||||
if(colour && S)
|
||||
if(!IsAttached(colour))
|
||||
signalers[colour] = S
|
||||
S.forceMove(holder)
|
||||
S.connected = src
|
||||
return S
|
||||
|
||||
/datum/wires/proc/Detach(var/colour)
|
||||
if(colour)
|
||||
var/obj/item/device/assembly/signaler/S = GetAttached(colour)
|
||||
if(S)
|
||||
signalers -= colour
|
||||
S.connected = null
|
||||
S.forceMove(holder.loc)
|
||||
return S
|
||||
ui_interact(user)
|
||||
for(var/A in assemblies)
|
||||
var/obj/item/I = assemblies[A]
|
||||
if(istype(I) && I.on_found(user))
|
||||
return
|
||||
|
||||
|
||||
/datum/wires/proc/Pulse(var/obj/item/device/assembly/signaler/S)
|
||||
/**
|
||||
* Checks whether wire assignments should be revealed.
|
||||
*
|
||||
* Returns TRUE if the wires should be revealed, FALSE otherwise.
|
||||
* Currently checks for admin ghost AI, abductor multitool and blueprints.
|
||||
* Arguments:
|
||||
* * user - The mob to check when deciding whether to reveal wires.
|
||||
*/
|
||||
/datum/wires/proc/can_reveal_wires(mob/user)
|
||||
// Admin ghost can see a purpose of each wire.
|
||||
if(isobserver(user) && check_rights(R_MOD, FALSE, user))
|
||||
return TRUE
|
||||
|
||||
for(var/colour in signalers)
|
||||
if(S == signalers[colour])
|
||||
PulseColour(colour)
|
||||
break
|
||||
// Station blueprints do that too, but only if the wires are not randomized.
|
||||
if(istype(user.get_active_hand(), /obj/item/blueprints) && !random)
|
||||
return TRUE
|
||||
|
||||
return FALSE
|
||||
|
||||
/**
|
||||
* Whether the given wire should always be revealed.
|
||||
*
|
||||
* Intended to be overridden. Allows for forcing a wire's assignmenmt to always be revealed
|
||||
* in the hacking interface.
|
||||
* Arguments:
|
||||
* * color - Color string of the wire to check.
|
||||
*/
|
||||
/datum/wires/proc/always_reveal_wire(color)
|
||||
return FALSE
|
||||
|
||||
/datum/wires/ui_host()
|
||||
return holder
|
||||
|
||||
/datum/wires/ui_status(mob/user)
|
||||
if(interactable(user))
|
||||
return ..()
|
||||
return UI_CLOSE
|
||||
|
||||
/datum/wires/ui_state(mob/user)
|
||||
return physical_state
|
||||
|
||||
|
||||
//
|
||||
// Cut Wire Colour/Index procs
|
||||
//
|
||||
/datum/wires/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if (!ui)
|
||||
ui = new(user, src, "Wires", "[capitalize(holder.name)] Wires")
|
||||
ui.open()
|
||||
|
||||
/datum/wires/proc/CutWireColour(var/colour)
|
||||
var/index = GetIndex(colour)
|
||||
CutWireIndex(index)
|
||||
/datum/wires/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/list/payload = list()
|
||||
var/reveal_wires = can_reveal_wires(user)
|
||||
|
||||
/datum/wires/proc/CutWireIndex(var/index)
|
||||
if(IsIndexCut(index))
|
||||
wires_status &= ~index
|
||||
UpdateCut(index, 1)
|
||||
else
|
||||
wires_status |= index
|
||||
UpdateCut(index, 0)
|
||||
for(var/color in colors)
|
||||
payload.Add(list(list(
|
||||
"color" = color,
|
||||
"wire" = (((reveal_wires || always_reveal_wire(color)) && !is_dud_color(color)) ? get_wire(color) : null),
|
||||
"cut" = is_color_cut(color),
|
||||
"attached" = is_attached(color)
|
||||
)))
|
||||
data["manufacturer"] = manufacturer
|
||||
data["wires"] = payload
|
||||
data["status"] = get_status()
|
||||
data["proper_name"] = (proper_name != "Unknown") ? proper_name : null
|
||||
data["tamper_resistance"] = FALSE
|
||||
if(random)
|
||||
data["tamper_resistance"] = TRUE
|
||||
return data
|
||||
|
||||
/datum/wires/proc/RandomCut()
|
||||
var/r = rand(1, wires.len)
|
||||
CutWireIndex(r)
|
||||
/datum/wires/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
. = ..()
|
||||
if(. || !interactable(usr))
|
||||
return
|
||||
|
||||
/datum/wires/proc/RandomCutAll(var/probability = 10)
|
||||
for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i)
|
||||
if(prob(probability))
|
||||
CutWireIndex(i)
|
||||
var/mob/living/L = usr
|
||||
var/target_wire = params["wire"]
|
||||
switch(action)
|
||||
if("attach")
|
||||
// Attach
|
||||
if(!is_attached(target_wire))
|
||||
var/obj/item/device/assembly/signaler/I = L.get_type_in_hands(/obj/item/device/assembly/signaler)
|
||||
if(!istype(I))
|
||||
to_chat(usr, SPAN_WARNING("You do not have a signaler to attach!"))
|
||||
return
|
||||
usr.drop_from_inventory(I)
|
||||
if(!attach_assembly(target_wire, I))
|
||||
I.forceMove(get_turf(L))
|
||||
. = TRUE
|
||||
// Detach
|
||||
else
|
||||
var/obj/item/O = detach_assembly(target_wire)
|
||||
if(O)
|
||||
L.put_in_hands(O)
|
||||
. = TRUE
|
||||
|
||||
/datum/wires/proc/CutAll()
|
||||
for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i)
|
||||
CutWireIndex(i)
|
||||
if("cut") // Toggles the cut/mend status
|
||||
var/obj/item/I = L.get_active_hand()
|
||||
if(!I || !I.iswirecutter())
|
||||
if(isrobot(L))
|
||||
var/mob/living/silicon/robot/R = L
|
||||
I = R.return_wirecutter()
|
||||
else
|
||||
I = L.get_inactive_hand()
|
||||
if(I?.iswirecutter())
|
||||
cut_color(target_wire, source = L)
|
||||
holder.add_hiddenprint(L)
|
||||
I.play_tool_sound(holder, 50)
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(L, SPAN_WARNING("You need wirecutters!"))
|
||||
|
||||
/datum/wires/proc/IsAllCut()
|
||||
if(wires_status == (1 << wire_count) - 1)
|
||||
return 1
|
||||
return 0
|
||||
if("pulse")
|
||||
var/obj/item/I = L.get_active_hand()
|
||||
if(!I || !I.ismultitool())
|
||||
if(isrobot(L))
|
||||
var/mob/living/silicon/robot/R = L
|
||||
I = R.return_multitool()
|
||||
else
|
||||
I = L.get_inactive_hand()
|
||||
if(I?.ismultitool())
|
||||
pulse_color(target_wire, L)
|
||||
holder.add_hiddenprint(L)
|
||||
. = TRUE
|
||||
else
|
||||
to_chat(L, SPAN_WARNING("You need a multitool!"))
|
||||
|
||||
/datum/wires/proc/MendAll()
|
||||
for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i)
|
||||
if(IsIndexCut(i))
|
||||
CutWireIndex(i)
|
||||
|
||||
//
|
||||
//Shuffle and Mend
|
||||
//
|
||||
|
||||
/datum/wires/proc/Shuffle()
|
||||
wires_status = 0
|
||||
GenerateWires()
|
||||
|
||||
#undef MAX_FLAG
|
||||
#undef MAXIMUM_EMP_WIRES
|
||||
|
||||
Reference in New Issue
Block a user