This commit is contained in:
ShadowLarkens
2020-07-22 00:23:58 -07:00
parent ebcfd0cc35
commit 3ea0e50432
43 changed files with 1372 additions and 1069 deletions

View File

@@ -351,3 +351,84 @@ var/global/list/##LIST_NAME = list();\
#define JOB_SILICON 0x6 // 2|4, probably don't set jobs to this, but good for checking #define JOB_SILICON 0x6 // 2|4, probably don't set jobs to this, but good for checking
#define DEFAULT_OVERMAP_RANGE 0 // Makes general computers and devices be able to connect to other overmap z-levels on the same tile. #define DEFAULT_OVERMAP_RANGE 0 // Makes general computers and devices be able to connect to other overmap z-levels on the same tile.
/*
Used for wire name appearances. Replaces the color name on the left with the one on the right.
The color on the left is the one used as the actual color of the wire, but it doesn't look good when written.
So, we need to replace the name to something that looks better.
*/
#define LIST_COLOR_RENAME \
list( \
"rebeccapurple" = "dark purple",\
"darkslategrey" = "dark grey", \
"darkolivegreen"= "dark green", \
"darkslateblue" = "dark blue", \
"darkkhaki" = "khaki", \
"darkseagreen" = "light green",\
"midnightblue" = "blue", \
"lightgrey" = "light grey", \
"darkgrey" = "dark grey", \
"steelblue" = "blue", \
"goldenrod" = "gold" \
)
/// Pure Black and white colorblindness. Every species except Vulpkanins and Tajarans will have this.
#define GREYSCALE_COLOR_REPLACE \
list( \
"red" = "grey", \
"blue" = "grey", \
"green" = "grey", \
"orange" = "light grey", \
"brown" = "grey", \
"gold" = "light grey", \
"cyan" = "silver", \
"magenta" = "grey", \
"purple" = "grey", \
"pink" = "light grey" \
)
/// Red colorblindness. Vulpkanins/Wolpins have this.
#define PROTANOPIA_COLOR_REPLACE \
list( \
"red" = "darkolivegreen", \
"darkred" = "darkolivegreen", \
"green" = "yellow", \
"orange" = "goldenrod", \
"gold" = "goldenrod", \
"brown" = "darkolivegreen", \
"cyan" = "steelblue", \
"magenta" = "blue", \
"purple" = "darkslategrey", \
"pink" = "beige" \
)
/// Green colorblindness.
#define DEUTERANOPIA_COLOR_REPLACE \
list( \
"red" = "goldenrod", \
"green" = "tan", \
"yellow" = "tan", \
"orange" = "goldenrod", \
"gold" = "burlywood", \
"brown" = "saddlebrown",\
"cyan" = "lavender", \
"magenta" = "blue", \
"purple" = "slateblue", \
"pink" = "thistle" \
)
/// Yellow-Blue colorblindness. Tajarans/Farwas have this.
#define TRITANOPIA_COLOR_REPLACE \
list( \
"red" = "rebeccapurple", \
"blue" = "darkslateblue", \
"green" = "darkolivegreen", \
"orange" = "darkkhaki", \
"gold" = "darkkhaki", \
"brown" = "rebeccapurple", \
"cyan" = "darkseagreen", \
"magenta" = "darkslateblue", \
"navy" = "darkslateblue", \
"purple" = "darkslateblue", \
"pink" = "lightgrey" \
)

122
code/__defines/wires.dm Normal file
View File

@@ -0,0 +1,122 @@
// Wire defines for all machines/items.
// Miscellaneous
#define WIRE_DUD_PREFIX "__dud"
// General
#define WIRE_IDSCAN "ID Scan"
#define WIRE_MAIN_POWER1 "Primary Power"
#define WIRE_MAIN_POWER2 "Secondary Power"
#define WIRE_AI_CONTROL "AI Control"
#define WIRE_ELECTRIFY "Electrification"
#define WIRE_SAFETY "Safety"
// Vendors and smartfridges
#define WIRE_THROW_ITEM "Item Throw"
#define WIRE_CONTRABAND "Contraband"
// Airlock
#define WIRE_DOOR_BOLTS "Door Bolts"
#define WIRE_BACKUP_POWER1 "Primary Backup Power"
#define WIRE_BACKUP_POWER2 "Secondary Backup Power"
#define WIRE_OPEN_DOOR "Door State"
#define WIRE_SPEED "Door Timing"
#define WIRE_BOLT_LIGHT "Bolt Lights"
// Air alarm
#define WIRE_SYPHON "Siphon"
#define WIRE_AALARM "Atmospherics Alarm"
// Camera
#define WIRE_FOCUS "Focus"
#define WIRE_CAM_LIGHT "Camera Light"
#define WIRE_CAM_ALARM "Camera Alarm"
// Grid Check
#define WIRE_REBOOT "Reboot"
#define WIRE_LOCKOUT "Lockout"
#define WIRE_ALLOW_MANUAL1 "Manual Override 1"
#define WIRE_ALLOW_MANUAL2 "Manual Override 2"
#define WIRE_ALLOW_MANUAL3 "Manual Override 3"
// Jukebox
#define WIRE_POWER "Power"
#define WIRE_JUKEBOX_HACK "Hack"
#define WIRE_SPEEDUP "Speedup"
#define WIRE_SPEEDDOWN "Speeddown"
#define WIRE_REVERSE "Reverse"
#define WIRE_START "Start"
#define WIRE_STOP "Stop"
#define WIRE_PREV "Prev"
#define WIRE_NEXT "Next"
// Mulebot
#define WIRE_MOB_AVOIDANCE "Mob Avoidance"
#define WIRE_LOADCHECK "Load Checking"
#define WIRE_MOTOR1 "Primary Motor"
#define WIRE_MOTOR2 "Secondary Motor"
#define WIRE_REMOTE_RX "Signal Receiver"
#define WIRE_REMOTE_TX "Signal Sender"
#define WIRE_BEACON_RX "Beacon Receiver"
// Explosives, bombs
#define WIRE_EXPLODE "Explode" // Explodes if pulsed or cut while active, defuses a bomb that isn't active on cut.
#define WIRE_EXPLODE_DELAY "Explode Delay" // Explodes immediately if cut, explodes 3 seconds later if pulsed.
#define WIRE_DISARM "Disarm" // Explicit "disarming" wire.
#define WIRE_BADDISARM "Bad Disarm" // Disarming wire, except it blows up anyways.
#define WIRE_BOMB_UNBOLT "Unbolt" // Unbolts the bomb if cut, hint on pulsed.
#define WIRE_BOMB_DELAY "Delay" // Raises the timer on pulse, does nothing on cut.
#define WIRE_BOMB_PROCEED "Proceed" // Lowers the timer, explodes if cut while the bomb is active.
#define WIRE_BOMB_ACTIVATE "Activate" // Will start a bombs timer if pulsed, will hint if pulsed while already active, will stop a timer a bomb on cut.
// Nuclear bomb
#define WIRE_BOMB_LIGHT "Bomb Light"
#define WIRE_BOMB_TIMING "Bomb Timing"
#define WIRE_BOMB_SAFETY "Bomb Safety"
// Particle accelerator
#define WIRE_PARTICLE_POWER "Power Toggle" // Toggles whether the PA is on or not.
#define WIRE_PARTICLE_STRENGTH "Strength" // Determines the strength of the PA.
#define WIRE_PARTICLE_INTERFACE "Interface" // Determines the interface showing up.
#define WIRE_PARTICLE_POWER_LIMIT "Maximum Power" // Determines how strong the PA can be.
// Autolathe
#define WIRE_AUTOLATHE_HACK "Hack"
#define WIRE_AUTOLATHE_DISABLE "Disable"
// Radio
#define WIRE_RADIO_SIGNAL "Signal"
#define WIRE_RADIO_RECEIVER "Receiver"
#define WIRE_RADIO_TRANSMIT "Transmitter"
// Cyborg
#define WIRE_BORG_LOCKED "Lockdown"
#define WIRE_BORG_CAMERA "Camera"
#define WIRE_BORG_LAWCHECK "Law Check"
// Seed Storage
#define WIRE_SEED_SMART "Smart"
#define WIRE_SEED_LOCKDOWN "Lockdown"
// Shield Generator
#define WIRE_SHIELD_CONTROL "Shield Controls" // Cut to lock most shield controls. Mend to unlock them. Pulse does nothing.
// SMES
#define WIRE_SMES_RCON "RCon" // Remote control (AI and consoles), cut to disable
#define WIRE_SMES_INPUT "Input" // Input wire, cut to disable input, pulse to disable for 60s
#define WIRE_SMES_OUTPUT "Output" // Output wire, cut to disable output, pulse to disable for 60s
#define WIRE_SMES_GROUNDING "Grounding" // Cut to quickly discharge causing sparks, pulse to only create few sparks
#define WIRE_SMES_FAILSAFES "Failsafes" // Cut to disable failsafes, mend to reenable
// Suit storage unit
#define WIRE_SSU_UV "UV wire"
// Tesla coil
#define WIRE_TESLACOIL_ZAP "Zap"
// RIGsuits
#define WIRE_RIG_SECURITY "Security"
#define WIRE_RIG_AI_OVERRIDE "AI Override"
#define WIRE_RIG_SYSTEM_CONTROL "System Control"
#define WIRE_RIG_INTERFACE_LOCK "Interface Lock"
#define WIRE_RIG_INTERFACE_SHOCK "Interface Shock"

View File

@@ -1,2 +1,5 @@
GLOBAL_LIST_INIT(speech_toppings, list("|" = "i", "+" = "b", "_" = "u")) GLOBAL_LIST_INIT(speech_toppings, list("|" = "i", "+" = "b", "_" = "u"))
GLOBAL_LIST_EMPTY(meteor_list) GLOBAL_LIST_EMPTY(meteor_list)
/// List of wire colors for each object type of that round. One for airlocks, one for vendors, etc.
GLOBAL_LIST_EMPTY(wire_color_directory) // This is an associative list with the `holder_type` as the key, and a list of colors as the value.

View File

@@ -1,61 +1,53 @@
// Wires for airlocks // Wires for airlocks
/datum/wires/airlock/secure /datum/wires/airlock/secure
random = 1 randomize = 1
wire_count = 14 wire_count = 14
window_y = 680
/datum/wires/airlock /datum/wires/airlock
holder_type = /obj/machinery/door/airlock holder_type = /obj/machinery/door/airlock
wire_count = 12 wire_count = 12
window_y = 570 proper_name = "Airlock"
var/const/AIRLOCK_WIRE_IDSCAN = 1 /datum/wires/airlock/interactable(mob/user)
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)
var/obj/machinery/door/airlock/A = holder var/obj/machinery/door/airlock/A = holder
if(!istype(L, /mob/living/silicon)) if(!issilicon(user))
if(A.isElectrified()) if(A.isElectrified())
if(A.shock(L, 100)) if(A.shock(user, 100))
return 0 return FALSE
if(A.p_open) if(A.p_open)
return 1 return TRUE
return 0 return FALSE
/datum/wires/airlock/GetInteractWindow() /datum/wires/airlock/New(atom/_holder)
wires = list(
WIRE_IDSCAN, WIRE_MAIN_POWER1, WIRE_MAIN_POWER2, WIRE_DOOR_BOLTS,
WIRE_BACKUP_POWER1, WIRE_BACKUP_POWER2, WIRE_OPEN_DOOR, WIRE_AI_CONTROL,
WIRE_ELECTRIFY, WIRE_SAFETY, WIRE_SPEED, WIRE_BOLT_LIGHT
)
return ..()
/datum/wires/airlock/get_status()
. = ..()
var/obj/machinery/door/airlock/A = holder var/obj/machinery/door/airlock/A = holder
var/haspower = A.arePowerSystemsOn() //If there's no power, then no lights will be on. var/haspower = A.arePowerSystemsOn() //If there's no power, then no lights will be on.
. += ..() . += "The door bolts [A.locked ? "have fallen!" : "look up."]"
. += show_hint(0x01, A.locked, "The door bolts have fallen!", "The door bolts look up.") . += "The door bolt lights are [(A.lights && haspower) ? "on." : "off!"]"
. += show_hint(0x02, A.lights && haspower, "The door bolt lights are on.", "The door bolt lights are off!") . += "The test light is [haspower ? "on." : "off!"]"
. += show_hint(0x04, haspower, "The test light is on.", "The test light is off!") . += "The backup power light is [A.backup_power_lost_until ? "off!" : "on."]"
. += show_hint(0x08, A.backup_power_lost_until, "The backup power light is off!", "The backup power light is on.") . += "The 'AI control allowed' light is [(A.aiControlDisabled == 0 && !A.emagged && haspower) ? "on" : "off"]."
. += show_hint(0x10, A.aiControlDisabled == 0 && !A.emagged && haspower, "The 'AI control allowed' light is on.", "The 'AI control allowed' light is off.") . += "The 'Check Wiring' light is [(A.safe == 0 && haspower) ? "on" : "off"]."
. += show_hint(0x20, A.safe == 0 && haspower, "The 'Check Wiring' light is on.", "The 'Check Wiring' light is off.") . += "The 'Check Timing Mechanism' light is [(A.normalspeed == 0 && haspower) ? "on" : "off"]."
. += show_hint(0x40, A.normalspeed == 0 && haspower, "The 'Check Timing Mechanism' light is on.", "The 'Check Timing Mechanism' light is off.") . += "The IDScan light is [(A.aiDisabledIdScanner == 0 && haspower) ? "on" : "off."]"
. += show_hint(0x80, A.aiDisabledIdScanner == 0 && haspower, "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)
var/obj/machinery/door/airlock/A = holder var/obj/machinery/door/airlock/A = holder
switch(index) switch(wire)
if(AIRLOCK_WIRE_IDSCAN) if(WIRE_IDSCAN)
A.aiDisabledIdScanner = !mended A.aiDisabledIdScanner = !mend
if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2) if(WIRE_MAIN_POWER1, WIRE_MAIN_POWER2)
if(!mend)
if(!mended)
//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. //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.loseMainPower()
A.shock(usr, 50) A.shock(usr, 50)
@@ -63,9 +55,8 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
A.regainMainPower() A.regainMainPower()
A.shock(usr, 50) A.shock(usr, 50)
if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2) if(WIRE_BACKUP_POWER1, WIRE_BACKUP_POWER2)
if(!mend)
if(!mended)
//Cutting either one disables the backup door power (allowing it to be crowbarred open, but disabling bolts-raising), but may electocute the user. //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.loseBackupPower()
A.shock(usr, 50) A.shock(usr, 50)
@@ -73,16 +64,14 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
A.regainBackupPower() A.regainBackupPower()
A.shock(usr, 50) A.shock(usr, 50)
if(AIRLOCK_WIRE_DOOR_BOLTS) if(WIRE_DOOR_BOLTS)
if(!mend)
if(!mended)
//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) //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.lock(1)
A.update_icon() A.update_icon()
if(AIRLOCK_WIRE_AI_CONTROL) if(WIRE_AI_CONTROL)
if(!mend)
if(!mended)
//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. //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.
//aiControlDisabled: 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. //aiControlDisabled: 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.aiControlDisabled == 0) if(A.aiControlDisabled == 0)
@@ -95,40 +84,41 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
else if(A.aiControlDisabled == 2) else if(A.aiControlDisabled == 2)
A.aiControlDisabled = -1 A.aiControlDisabled = -1
if(AIRLOCK_WIRE_ELECTRIFY) if(WIRE_ELECTRIFY)
if(!mended) if(!mend)
//Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted. //Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted.
A.electrify(-1) A.electrify(-1)
else else
A.electrify(0) A.electrify(0)
return // Don't update the dialog. return // Don't update the dialog.
if (AIRLOCK_WIRE_SAFETY) if (WIRE_SAFETY)
A.safe = mended A.safe = mend
if(AIRLOCK_WIRE_SPEED) if(WIRE_SPEED)
A.autoclose = mended A.autoclose = mend
if(mended) if(mend)
if(!A.density) if(!A.density)
A.close() A.close()
if(AIRLOCK_WIRE_LIGHT) if(WIRE_BOLT_LIGHT)
A.lights = mended A.lights = mend
A.update_icon() A.update_icon()
/datum/wires/airlock/UpdatePulsed(var/index) /datum/wires/airlock/on_pulse(wire)
var/obj/machinery/door/airlock/A = holder var/obj/machinery/door/airlock/A = holder
switch(index) switch(wire)
if(AIRLOCK_WIRE_IDSCAN) if(WIRE_IDSCAN)
//Sending a pulse through flashes the red light on the door (if the door has power). //Sending a pulse through flashes the red light on the door (if the door has power).
if(A.arePowerSystemsOn() && A.density) if(A.arePowerSystemsOn() && A.density)
A.do_animate("deny") A.do_animate("deny")
if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2)
if(WIRE_MAIN_POWER1, WIRE_MAIN_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). //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() A.loseMainPower()
if(AIRLOCK_WIRE_DOOR_BOLTS)
if(WIRE_DOOR_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), //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) //raises them if they are down (only if power's on)
if(!A.locked) if(!A.locked)
@@ -136,10 +126,11 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
else else
A.unlock() A.unlock()
if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2) if(WIRE_BACKUP_POWER1, WIRE_BACKUP_POWER2)
//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). //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() A.loseBackupPower()
if(AIRLOCK_WIRE_AI_CONTROL)
if(WIRE_AI_CONTROL)
if(A.aiControlDisabled == 0) if(A.aiControlDisabled == 0)
A.aiControlDisabled = 1 A.aiControlDisabled = 1
else if(A.aiControlDisabled == -1) else if(A.aiControlDisabled == -1)
@@ -152,24 +143,26 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
else if(A.aiControlDisabled == 2) else if(A.aiControlDisabled == 2)
A.aiControlDisabled = -1 A.aiControlDisabled = -1
if(AIRLOCK_WIRE_ELECTRIFY) if(WIRE_ELECTRIFY)
//one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds. //one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds.
A.electrify(30) A.electrify(30)
if(AIRLOCK_WIRE_OPEN_DOOR)
if(WIRE_OPEN_DOOR)
//tries to open the door without ID //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 //will succeed only if the ID wire is cut or the door requires no access and it's not emagged
if(A.emagged) return if(A.emagged) return
if(!A.requiresID() || A.check_access(null)) if(!A.requiresID() || A.check_access(null))
if(A.density) A.open() if(A.density) A.open()
else A.close() else A.close()
if(AIRLOCK_WIRE_SAFETY)
if(WIRE_SAFETY)
A.safe = !A.safe A.safe = !A.safe
if(!A.density) if(!A.density)
A.close() A.close()
if(AIRLOCK_WIRE_SPEED) if(WIRE_SPEED)
A.normalspeed = !A.normalspeed A.normalspeed = !A.normalspeed
if(AIRLOCK_WIRE_LIGHT) if(WIRE_BOLT_LIGHT)
A.lights = !A.lights A.lights = !A.lights
A.update_icon() A.update_icon()

View File

@@ -1,94 +1,86 @@
/datum/wires/alarm /datum/wires/alarm
holder_type = /obj/machinery/alarm holder_type = /obj/machinery/alarm
wire_count = 5 wire_count = 5
proper_name = "Air alarm"
var/const/AALARM_WIRE_IDSCAN = 1 /datum/wires/alarm/New(atom/_holder)
var/const/AALARM_WIRE_POWER = 2 wires = list(
var/const/AALARM_WIRE_SYPHON = 4 WIRE_IDSCAN, WIRE_MAIN_POWER1, WIRE_SYPHON,
var/const/AALARM_WIRE_AI_CONTROL = 8 WIRE_AI_CONTROL, WIRE_AALARM
var/const/AALARM_WIRE_AALARM = 16 )
return ..()
/datum/wires/alarm/CanUse(var/mob/living/L) /datum/wires/alarm/interactable(mob/user)
var/obj/machinery/alarm/A = holder var/obj/machinery/alarm/A = holder
if(A.panel_open) if(A.panel_open)
return 1 return TRUE
return 0 return FALSE
/datum/wires/alarm/GetInteractWindow() /datum/wires/alarm/get_status()
var/obj/machinery/alarm/A = holder var/obj/machinery/alarm/A = holder
. += ..() . = ..()
. += show_hint(0x1, A.locked, "The Air Alarm is locked.", "The Air Alarm is unlocked.") . += "The Air Alarm is [A.locked ? "locked." : "unlocked."]"
. += show_hint(0x2, A.shorted || (A.stat & (NOPOWER|BROKEN)), "The Air Alarm is offline.", "The Air Alarm is working properly!") . += "The Air Alarm is [(A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "offline." : "working properly!"]"
. += show_hint(0x4, A.aidisabled, "The 'AI control allowed' light is off.", "The 'AI control allowed' light is on.") . += "The 'AI control allowed' light is [A.aidisabled ? "off" : "on"]."
/datum/wires/alarm/UpdateCut(var/index, var/mended) /datum/wires/alarm/on_cut(wire, mend)
var/obj/machinery/alarm/A = holder var/obj/machinery/alarm/A = holder
switch(index) switch(wire)
if(AALARM_WIRE_IDSCAN) if(WIRE_IDSCAN)
if(!mended) if(!mend)
A.locked = 1 A.locked = TRUE
//to_world("Idscan wire cut")
if(AALARM_WIRE_POWER) if(WIRE_MAIN_POWER1)
A.shock(usr, 50) A.shock(usr, 50)
A.shorted = !mended A.shorted = !mend
A.update_icon() A.update_icon()
//to_world("Power wire cut")
if (AALARM_WIRE_AI_CONTROL) if(WIRE_AI_CONTROL)
if (A.aidisabled == !mended) A.aidisabled = !mend
A.aidisabled = mended
//to_world("AI Control Wire Cut")
if(AALARM_WIRE_SYPHON) if(WIRE_SYPHON)
if(!mended) if(!mend)
A.mode = 3 // AALARM_MODE_PANIC A.mode = 3 // MODE_PANIC
A.apply_mode() A.apply_mode()
//to_world("Syphon Wire Cut")
if(AALARM_WIRE_AALARM) if(WIRE_AALARM)
if (A.alarm_area.atmosalert(2, A)) if(A.alarm_area.atmosalert(2, A))
A.post_alert(2) A.post_alert(2)
A.update_icon() A.update_icon()
..()
/datum/wires/alarm/UpdatePulsed(var/index) /datum/wires/alarm/on_pulse(wire)
var/obj/machinery/alarm/A = holder var/obj/machinery/alarm/A = holder
switch(index) switch(wire)
if(AALARM_WIRE_IDSCAN) if(WIRE_IDSCAN)
A.locked = !A.locked A.locked = !A.locked
// to_world("Idscan wire pulsed")
if (AALARM_WIRE_POWER) if(WIRE_MAIN_POWER1)
// to_world("Power wire pulsed") if(!A.shorted)
if(A.shorted == 0) A.shorted = TRUE
A.shorted = 1
A.update_icon() A.update_icon()
spawn(12000) spawn(12000)
if(A.shorted == 1) if(A.shorted)
A.shorted = 0 A.shorted = FALSE
A.update_icon() A.update_icon()
if(WIRE_AI_CONTROL)
if (AALARM_WIRE_AI_CONTROL) if(!A.aidisabled)
// to_world("AI Control wire pulsed") A.aidisabled = TRUE
if (A.aidisabled == 0)
A.aidisabled = 1
A.updateDialog() A.updateDialog()
spawn(100) spawn(100)
if (A.aidisabled == 1) if(A.aidisabled)
A.aidisabled = 0 A.aidisabled = FALSE
if(AALARM_WIRE_SYPHON) if(WIRE_SYPHON)
// to_world("Syphon wire pulsed") if(A.mode == 1) // MODE_SCRUB
if(A.mode == 1) // AALARM_MODE_SCRUB A.mode = 3 // MODE_PANIC
A.mode = 3 // AALARM_MODE_PANIC
else else
A.mode = 1 // AALARM_MODE_SCRUB A.mode = 1 // MODE_SCRUB
A.apply_mode() A.apply_mode()
if(AALARM_WIRE_AALARM) if(WIRE_AALARM)
// to_world("Aalarm wire pulsed") if(A.alarm_area.atmosalert(0, A))
if (A.alarm_area.atmosalert(0, A))
A.post_alert(0) A.post_alert(0)
A.update_icon() A.update_icon()

View File

@@ -1,76 +1,66 @@
/datum/wires/apc /datum/wires/apc
holder_type = /obj/machinery/power/apc holder_type = /obj/machinery/power/apc
wire_count = 4 wire_count = 4
proper_name = "APC"
#define APC_WIRE_IDSCAN 1 /datum/wires/apc/New(atom/_holder)
#define APC_WIRE_MAIN_POWER1 2 wires = list(WIRE_IDSCAN, WIRE_MAIN_POWER1, WIRE_MAIN_POWER2, WIRE_AI_CONTROL)
#define APC_WIRE_MAIN_POWER2 4 return ..()
#define APC_WIRE_AI_CONTROL 8
/datum/wires/apc/GetInteractWindow() /datum/wires/apc/get_status()
. = ..()
var/obj/machinery/power/apc/A = holder var/obj/machinery/power/apc/A = holder
. += ..() . += "The APC is [A.locked ? "" : "un"]locked."
. += show_hint(0x1, A.locked, "The APC is locked.", "The APC is unlocked.") . += A.shorted ? "The APCs power has been shorted." : "The APC is working properly!"
. += show_hint(0x2, A.shorted, "The APCs power has been shorted.", "The APC is working properly!") . += "The 'AI control allowed' light is [A.aidisabled ? "off" : "on"]."
. += show_hint(0x4, A.aidisabled, "The 'AI control allowed' light is off.", "The 'AI control allowed' light is on.")
/datum/wires/apc/interactable(mob/user)
/datum/wires/apc/CanUse(var/mob/living/L)
var/obj/machinery/power/apc/A = holder var/obj/machinery/power/apc/A = holder
if(A.wiresexposed) if(A.wiresexposed)
return 1 return 1
return 0 return 0
/datum/wires/apc/UpdatePulsed(var/index) /datum/wires/apc/on_pulse(wire)
var/obj/machinery/power/apc/A = holder var/obj/machinery/power/apc/A = holder
switch(index) switch(wire)
if(WIRE_IDSCAN)
if(APC_WIRE_IDSCAN) A.locked = FALSE
A.locked = 0
spawn(300) spawn(300)
if(A) if(A)
A.locked = 1 A.locked = TRUE
if (APC_WIRE_MAIN_POWER1, APC_WIRE_MAIN_POWER2) if(WIRE_MAIN_POWER1, WIRE_MAIN_POWER2)
if(A.shorted == 0) if(!A.shorted)
A.shorted = 1 A.shorted = TRUE
spawn(1200) spawn(1200)
if(A && !IsIndexCut(APC_WIRE_MAIN_POWER1) && !IsIndexCut(APC_WIRE_MAIN_POWER2)) if(A && !is_cut(WIRE_MAIN_POWER1) && !is_cut(WIRE_MAIN_POWER2))
A.shorted = 0 A.shorted = FALSE
if (APC_WIRE_AI_CONTROL) if(WIRE_AI_CONTROL)
if (A.aidisabled == 0) if(!A.aidisabled)
A.aidisabled = 1 A.aidisabled = TRUE
spawn(10) spawn(10)
if(A && !IsIndexCut(APC_WIRE_AI_CONTROL)) if(A && !is_cut(WIRE_AI_CONTROL))
A.aidisabled = 0 A.aidisabled = FALSE
/datum/wires/apc/UpdateCut(var/index, var/mended) /datum/wires/apc/on_cut(wire, mend)
var/obj/machinery/power/apc/A = holder var/obj/machinery/power/apc/A = holder
switch(index) switch(wire)
if(APC_WIRE_MAIN_POWER1, APC_WIRE_MAIN_POWER2) if(WIRE_MAIN_POWER1, WIRE_MAIN_POWER2)
if(!mend)
if(!mended) if(isliving(usr))
if(istype(usr, /mob/living))
A.shock(usr, 50) A.shock(usr, 50)
A.shorted = 1 A.shorted = TRUE
else if(!IsIndexCut(APC_WIRE_MAIN_POWER1) && !IsIndexCut(APC_WIRE_MAIN_POWER2)) else if(!is_cut(WIRE_MAIN_POWER1) && !is_cut(WIRE_MAIN_POWER2))
A.shorted = 0 A.shorted = FALSE
if(istype(usr, /mob/living)) if(isliving(usr))
A.shock(usr, 50) A.shock(usr, 50)
if(APC_WIRE_AI_CONTROL) if(WIRE_AI_CONTROL)
A.aidisabled = !mend
if(!mended)
if (A.aidisabled == 0)
A.aidisabled = 1
else
if (A.aidisabled == 1)
A.aidisabled = 0

View File

@@ -1,61 +1,54 @@
/datum/wires/autolathe /datum/wires/autolathe
holder_type = /obj/machinery/autolathe holder_type = /obj/machinery/autolathe
wire_count = 6 wire_count = 6
proper_name = "Autolathe"
var/const/AUTOLATHE_HACK_WIRE = 1 /datum/wires/autolathe/New(atom/_holder)
var/const/AUTOLATHE_SHOCK_WIRE = 2 wires = list(WIRE_AUTOLATHE_HACK, WIRE_ELECTRIFY, WIRE_AUTOLATHE_DISABLE)
var/const/AUTOLATHE_DISABLE_WIRE = 4 return ..()
/datum/wires/autolathe/GetInteractWindow() /datum/wires/autolathe/get_status()
. = ..()
var/obj/machinery/autolathe/A = holder var/obj/machinery/autolathe/A = holder
. += ..() . += "The red light is [A.disabled ? "off" : "on"]."
. += show_hint(0x1, A.disabled, "The red light is off.", "The red light is on.") . += "The green light is [A.shocked ? "off" : "on"]."
. += show_hint(0x2, A.shocked, "The green light is off.", "The green light is on.") . += "The blue light is [A.hacked ? "off" : "on"]."
. += show_hint(0x4, A.hacked, "The blue light is off.", "The blue light is on.")
/datum/wires/autolathe/CanUse() /datum/wires/autolathe/interactable(mob/user)
var/obj/machinery/autolathe/A = holder var/obj/machinery/autolathe/A = holder
if(A.panel_open) if(A.panel_open)
return 1 return TRUE
return 0 return FALSE
/datum/wires/autolathe/proc/update_autolathe_ui(mob/living/user) /datum/wires/autolathe/on_cut(wire, mend)
if(CanUse(user))
var/obj/machinery/autolathe/A = holder
A.interact(user)
/datum/wires/autolathe/UpdateCut(index, mended)
var/obj/machinery/autolathe/A = holder var/obj/machinery/autolathe/A = holder
switch(index) switch(wire)
if(AUTOLATHE_HACK_WIRE) if(WIRE_AUTOLATHE_HACK)
A.hacked = !mended A.hacked = !mend
if(AUTOLATHE_SHOCK_WIRE) if(WIRE_ELECTRIFY)
A.shocked = !mended A.shocked = !mend
if(AUTOLATHE_DISABLE_WIRE) if(WIRE_AUTOLATHE_DISABLE)
A.disabled = !mended A.disabled = !mend
update_autolathe_ui(usr) ..()
/datum/wires/autolathe/UpdatePulsed(index) /datum/wires/autolathe/on_pulse(wire)
if(IsIndexCut(index)) if(is_cut(wire))
return return
var/obj/machinery/autolathe/A = holder var/obj/machinery/autolathe/A = holder
switch(index) switch(wire)
if(AUTOLATHE_HACK_WIRE) if(WIRE_AUTOLATHE_HACK)
A.hacked = !A.hacked A.hacked = !A.hacked
spawn(50) spawn(50)
if(A && !IsIndexCut(index)) if(A && !is_cut(wire))
A.hacked = 0 A.hacked = 0
update_autolathe_ui(usr) if(WIRE_ELECTRIFY)
if(AUTOLATHE_SHOCK_WIRE)
A.shocked = !A.shocked A.shocked = !A.shocked
spawn(50) spawn(50)
if(A && !IsIndexCut(index)) if(A && !is_cut(wire))
A.shocked = 0 A.shocked = 0
if(AUTOLATHE_DISABLE_WIRE) if(WIRE_AUTOLATHE_DISABLE)
A.disabled = !A.disabled A.disabled = !A.disabled
spawn(50) spawn(50)
if(A && !IsIndexCut(index)) if(A && !is_cut(wire))
A.disabled = 0 A.disabled = 0
update_autolathe_ui(usr) ..()
update_autolathe_ui(usr)

View File

@@ -1,70 +1,64 @@
// Wires for cameras. // Wires for cameras.
/datum/wires/camera /datum/wires/camera
random = 1 randomize = TRUE
holder_type = /obj/machinery/camera holder_type = /obj/machinery/camera
wire_count = 6 wire_count = 6
proper_name = "Camera"
/datum/wires/camera/GetInteractWindow() /datum/wires/camera/New(atom/_holder)
wires = list(WIRE_FOCUS, WIRE_MAIN_POWER1, WIRE_CAM_LIGHT, WIRE_CAM_ALARM)
return ..()
/datum/wires/camera/get_status()
. = ..() . = ..()
var/obj/machinery/camera/C = holder var/obj/machinery/camera/C = holder
. += show_hint(0x1, C.view_range == initial(C.view_range), "The focus light is on.", "The focus light is off.") . += "The focus light is [(C.view_range == initial(C.view_range)) ? "on" : "off"]."
. += show_hint(0x2, C.can_use(), "The power link light is on.", "The power link light is off.") . += "The power link light is [C.can_use() ? "on" : "off"]."
. += show_hint(0x4, C.light_disabled, "The camera light is off.", "The camera light is on.") . += "The camera light is [C.light_disabled ? "off" : "on"]."
. += show_hint(0x8, C.alarm_on, "The alarm light is on.", "The alarm light is off.") . += "The alarm light is [C.alarm_on ? "on" : "off"]."
return .
/datum/wires/camera/CanUse(var/mob/living/L) /datum/wires/camera/interactable(mob/user)
var/obj/machinery/camera/C = holder var/obj/machinery/camera/C = holder
return C.panel_open return C.panel_open
var/const/CAMERA_WIRE_FOCUS = 1 /datum/wires/camera/on_cut(wire, mend)
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)
var/obj/machinery/camera/C = holder var/obj/machinery/camera/C = holder
switch(index) switch(wire)
if(CAMERA_WIRE_FOCUS) if(WIRE_FOCUS)
var/range = (mended ? initial(C.view_range) : C.short_range) var/range = (mend ? initial(C.view_range) : C.short_range)
C.setViewRange(range) C.setViewRange(range)
if(CAMERA_WIRE_POWER) if(WIRE_MAIN_POWER1)
if(C.status && !mended || !C.status && mended) if(C.status && !mend || !C.status && mend)
C.deactivate(usr, 1) C.deactivate(usr, 1)
if(CAMERA_WIRE_LIGHT) if(WIRE_CAM_LIGHT)
C.light_disabled = !mended C.light_disabled = !mend
if(CAMERA_WIRE_ALARM) if(WIRE_CAM_ALARM)
if(!mended) if(!mend)
C.triggerCameraAlarm() C.triggerCameraAlarm()
else else
C.cancelCameraAlarm() C.cancelCameraAlarm()
return ..()
/datum/wires/camera/UpdatePulsed(var/index) /datum/wires/camera/on_pulse(wire)
var/obj/machinery/camera/C = holder var/obj/machinery/camera/C = holder
if(IsIndexCut(index)) if(is_cut(wire))
return return
switch(index) switch(wire)
if(CAMERA_WIRE_FOCUS) if(WIRE_FOCUS)
var/new_range = (C.view_range == initial(C.view_range) ? C.short_range : initial(C.view_range)) var/new_range = (C.view_range == initial(C.view_range) ? C.short_range : initial(C.view_range))
C.setViewRange(new_range) C.setViewRange(new_range)
if(CAMERA_WIRE_LIGHT) if(WIRE_CAM_LIGHT)
C.light_disabled = !C.light_disabled C.light_disabled = !C.light_disabled
if(CAMERA_WIRE_ALARM) if(WIRE_CAM_ALARM)
C.visible_message("[bicon(C)] *beep*", "[bicon(C)] *beep*") C.visible_message("[bicon(C)] *beep*", "[bicon(C)] *beep*")
return ..()
/datum/wires/camera/proc/CanDeconstruct() /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 is_all_cut()
return 1
else
return 0

View File

@@ -1,30 +1,33 @@
/datum/wires/explosive /datum/wires/explosive
wire_count = 1 wire_count = 1
proper_name = "Explosive wires"
var/const/WIRE_EXPLODE = 1 /datum/wires/explosive/New(atom/_holder)
wires = list(WIRE_EXPLODE)
return ..()
/datum/wires/explosive/proc/explode() /datum/wires/explosive/proc/explode()
return return
/datum/wires/explosive/UpdatePulsed(var/index) /datum/wires/explosive/on_pulse(wire)
switch(index) switch(wire)
if(WIRE_EXPLODE) if(WIRE_EXPLODE)
explode() explode()
/datum/wires/explosive/UpdateCut(var/index, var/mended) /datum/wires/explosive/on_cut(wire, mend)
switch(index) switch(wire)
if(WIRE_EXPLODE) if(WIRE_EXPLODE)
if(!mended) if(!mend)
explode() explode()
/datum/wires/explosive/c4 /datum/wires/explosive/c4
holder_type = /obj/item/weapon/plastique holder_type = /obj/item/weapon/plastique
/datum/wires/explosive/c4/CanUse(var/mob/living/L) /datum/wires/explosive/c4/interactable(mob/user)
var/obj/item/weapon/plastique/P = holder var/obj/item/weapon/plastique/P = holder
if(P.open_panel) if(P.open_panel)
return 1 return TRUE
return 0 return FALSE
/datum/wires/explosive/c4/explode() /datum/wires/explosive/c4/explode()
var/obj/item/weapon/plastique/P = holder var/obj/item/weapon/plastique/P = holder

View File

@@ -1,66 +1,64 @@
/datum/wires/grid_checker /datum/wires/grid_checker
holder_type = /obj/machinery/power/grid_checker holder_type = /obj/machinery/power/grid_checker
wire_count = 8 wire_count = 8
proper_name = "Grid Checker"
var/const/GRID_CHECKER_WIRE_REBOOT = 1 // This wire causes the grid-check to end, if pulsed. /datum/wires/grid_checker/New(atom/_holder)
var/const/GRID_CHECKER_WIRE_LOCKOUT = 2 // If cut or pulsed, locks the user out for half a minute. wires = list(
var/const/GRID_CHECKER_WIRE_ALLOW_MANUAL_1 = 4 // Needs to be cut for REBOOT to be possible. WIRE_REBOOT, WIRE_LOCKOUT, WIRE_ALLOW_MANUAL1,
var/const/GRID_CHECKER_WIRE_ALLOW_MANUAL_2 = 8 // Needs to be cut for REBOOT to be possible. WIRE_ALLOW_MANUAL2, WIRE_ALLOW_MANUAL3, WIRE_ELECTRIFY
var/const/GRID_CHECKER_WIRE_ALLOW_MANUAL_3 = 16 // Needs to be cut for REBOOT to be possible. )
var/const/GRID_CHECKER_WIRE_SHOCK = 32 // Shocks the user if not wearing gloves. return ..()
var/const/GRID_CHECKER_WIRE_NOTHING_1 = 64 // Does nothing, but makes it a bit harder.
var/const/GRID_CHECKER_WIRE_NOTHING_2 = 128 // Does nothing, but makes it a bit harder.
/datum/wires/grid_checker/interactable(mob/user)
/datum/wires/grid_checker/CanUse(var/mob/living/L)
var/obj/machinery/power/grid_checker/G = holder var/obj/machinery/power/grid_checker/G = holder
if(G.opened) if(G.opened)
return TRUE return TRUE
return FALSE return FALSE
/datum/wires/grid_checker/get_status()
/datum/wires/grid_checker/GetInteractWindow()
var/obj/machinery/power/grid_checker/G = holder var/obj/machinery/power/grid_checker/G = holder
. += ..() . = ..()
. += show_hint(0x1, G.power_failing, "The green light is off.", "The green light is on.") . += "The green light is [G.power_failing ? "off." : "on."]"
. += show_hint(0x2, G.wire_locked_out, "The red light is on.", "The red light is off.") . += "The red light is [G.wire_locked_out ? "on." : "off."]"
. += show_hint(0x4, G.wire_allow_manual_1 && G.wire_allow_manual_2 && G.wire_allow_manual_3, "The blue light is on.", "The blue light is off.") . += "The blue light is [(G.wire_allow_manual_1 && G.wire_allow_manual_2 && G.wire_allow_manual_3) ? "on." : "off."]"
/datum/wires/grid_checker/on_cut(wire, mend)
/datum/wires/grid_checker/UpdateCut(var/index, var/mended)
var/obj/machinery/power/grid_checker/G = holder var/obj/machinery/power/grid_checker/G = holder
switch(index) switch(wire)
if(GRID_CHECKER_WIRE_LOCKOUT) if(WIRE_LOCKOUT)
G.wire_locked_out = !mended G.wire_locked_out = !mend
if(GRID_CHECKER_WIRE_ALLOW_MANUAL_1) if(WIRE_ALLOW_MANUAL1)
G.wire_allow_manual_1 = !mended G.wire_allow_manual_1 = !mend
if(GRID_CHECKER_WIRE_ALLOW_MANUAL_2) if(WIRE_ALLOW_MANUAL2)
G.wire_allow_manual_2 = !mended G.wire_allow_manual_2 = !mend
if(GRID_CHECKER_WIRE_ALLOW_MANUAL_3) if(WIRE_ALLOW_MANUAL3)
G.wire_allow_manual_3 = !mended G.wire_allow_manual_3 = !mend
if(GRID_CHECKER_WIRE_SHOCK) if(WIRE_ELECTRIFY)
if(G.wire_locked_out) if(G.wire_locked_out)
return return
G.shock(usr, 70) G.shock(usr, 70)
..()
/datum/wires/grid_checker/on_pulse(wire)
/datum/wires/grid_checker/UpdatePulsed(var/index)
var/obj/machinery/power/grid_checker/G = holder var/obj/machinery/power/grid_checker/G = holder
switch(index) switch(wire)
if(GRID_CHECKER_WIRE_REBOOT) if(WIRE_REBOOT)
if(G.wire_locked_out) if(G.wire_locked_out)
return return
if(G.power_failing && G.wire_allow_manual_1 && G.wire_allow_manual_2 && G.wire_allow_manual_3) if(G.power_failing && G.wire_allow_manual_1 && G.wire_allow_manual_2 && G.wire_allow_manual_3)
G.end_power_failure(TRUE) G.end_power_failure(TRUE)
if(GRID_CHECKER_WIRE_LOCKOUT)
if(WIRE_LOCKOUT)
if(G.wire_locked_out) if(G.wire_locked_out)
return return
G.wire_locked_out = TRUE G.wire_locked_out = TRUE
spawn(30 SECONDS) spawn(30 SECONDS)
G.wire_locked_out = FALSE G.wire_locked_out = FALSE
if(GRID_CHECKER_WIRE_SHOCK)
if(WIRE_ELECTRIFY)
if(G.wire_locked_out) if(G.wire_locked_out)
return return
G.shock(usr, 70) G.shock(usr, 70)
..()

View File

@@ -1,42 +1,39 @@
/datum/wires/jukebox /datum/wires/jukebox
random = 1 randomize = TRUE
holder_type = /obj/machinery/media/jukebox holder_type = /obj/machinery/media/jukebox
wire_count = 11 wire_count = 11
proper_name = "Jukebox"
var/const/WIRE_POWER = 1 /datum/wires/jukebox/New(atom/_holder)
var/const/WIRE_HACK = 2 wires = list(
var/const/WIRE_SPEEDUP = 4 WIRE_MAIN_POWER1, WIRE_JUKEBOX_HACK,
var/const/WIRE_SPEEDDOWN = 8 WIRE_SPEEDUP, WIRE_SPEEDDOWN, WIRE_REVERSE,
var/const/WIRE_REVERSE = 16 WIRE_START, WIRE_STOP, WIRE_PREV, WIRE_NEXT
var/const/WIRE_NOTHING1 = 32 )
var/const/WIRE_NOTHING2 = 64 return ..()
var/const/WIRE_START = 128
var/const/WIRE_STOP = 256
var/const/WIRE_PREV = 512
var/const/WIRE_NEXT = 1024
/datum/wires/jukebox/CanUse(var/mob/living/L) /datum/wires/jukebox/interactable(mob/user)
var/obj/machinery/media/jukebox/A = holder var/obj/machinery/media/jukebox/A = holder
if(A.panel_open) if(A.panel_open)
return 1 return TRUE
return 0 return FALSE
// Show the status of lights as a hint to the current state // Show the status of lights as a hint to the current state
/datum/wires/jukebox/GetInteractWindow() /datum/wires/jukebox/get_status()
var/obj/machinery/media/jukebox/A = holder var/obj/machinery/media/jukebox/A = holder
. += ..() . = ..()
. += show_hint(0x1, A.stat & (BROKEN|NOPOWER), "The power light is off.", "The power light is on.") . += "The power light is [A.stat & (BROKEN|NOPOWER) ? "off." : "on."]"
. += show_hint(0x2, A.hacked, "The parental guidance light is off.", "The parental guidance light is on.") . += "The parental guidance light is [A.hacked ? "off." : "on."]"
. += show_hint(0x4, IsIndexCut(WIRE_REVERSE), "The data light is hauntingly dark.", "The data light is glowing softly.") . += "The data light is [is_cut(WIRE_REVERSE) ? "hauntingly dark." : "glowing softly."]"
// Give a hint as to what each wire does // Give a hint as to what each wire does
/datum/wires/jukebox/UpdatePulsed(var/index) /datum/wires/jukebox/on_pulse(wire)
var/obj/machinery/media/jukebox/A = holder var/obj/machinery/media/jukebox/A = holder
switch(index) switch(wire)
if(WIRE_POWER) if(WIRE_MAIN_POWER1)
holder.visible_message("<span class='notice'>[bicon(holder)] The power light flickers.</span>") holder.visible_message("<span class='notice'>[bicon(holder)] The power light flickers.</span>")
A.shock(usr, 90) A.shock(usr, 90)
if(WIRE_HACK) if(WIRE_JUKEBOX_HACK)
holder.visible_message("<span class='notice'>[bicon(holder)] The parental guidance light flickers.</span>") holder.visible_message("<span class='notice'>[bicon(holder)] The parental guidance light flickers.</span>")
if(WIRE_REVERSE) if(WIRE_REVERSE)
holder.visible_message("<span class='notice'>[bicon(holder)] The data light blinks ominously.</span>") holder.visible_message("<span class='notice'>[bicon(holder)] The data light blinks ominously.</span>")
@@ -55,24 +52,21 @@ var/const/WIRE_NEXT = 1024
else else
A.shock(usr, 10) // The nothing wires give a chance to shock just for fun A.shock(usr, 10) // The nothing wires give a chance to shock just for fun
/datum/wires/jukebox/UpdateCut(var/index, var/mended) /datum/wires/jukebox/on_cut(wire, mend)
var/obj/machinery/media/jukebox/A = holder var/obj/machinery/media/jukebox/A = holder
switch(index) switch(wire)
if(WIRE_POWER) if(WIRE_MAIN_POWER1)
// TODO - Actually make machine electrified or something. // TODO - Actually make machine electrified or something.
A.shock(usr, 90) A.shock(usr, 90)
if(WIRE_HACK) if(WIRE_JUKEBOX_HACK)
if(mended) A.set_hacked(!mend)
A.set_hacked(0)
else
A.set_hacked(1)
if(WIRE_SPEEDUP, WIRE_SPEEDDOWN, WIRE_REVERSE) if(WIRE_SPEEDUP, WIRE_SPEEDDOWN, WIRE_REVERSE)
var/newfreq = IsIndexCut(WIRE_REVERSE) ? -1 : 1; var/newfreq = is_cut(WIRE_REVERSE) ? -1 : 1;
if (IsIndexCut(WIRE_SPEEDUP)) if(is_cut(WIRE_SPEEDUP))
newfreq *= 2 newfreq *= 2
if (IsIndexCut(WIRE_SPEEDDOWN)) if(is_cut(WIRE_SPEEDDOWN))
newfreq *= 0.5 newfreq *= 0.5
A.freq = newfreq A.freq = newfreq

View File

@@ -1,32 +1,29 @@
/datum/wires/mines /datum/wires/mines
wire_count = 6 wire_count = 6
random = 1 randomize = TRUE
holder_type = /obj/effect/mine holder_type = /obj/effect/mine
proper_name = "Explosive Wires"
#define WIRE_DETONATE 1 /datum/wires/mines/New(atom/_holder)
#define WIRE_TIMED_DET 2 wires = list(WIRE_EXPLODE, WIRE_EXPLODE_DELAY, WIRE_DISARM, WIRE_BADDISARM)
#define WIRE_DISARM 4 return ..()
#define WIRE_DUMMY_1 8
#define WIRE_DUMMY_2 16
#define WIRE_BADDISARM 32
/datum/wires/mines/GetInteractWindow() /datum/wires/mines/get_status()
. = ..() . = ..()
. += "<br>\n["Warning: detonation may occur even with proper equipment."]" . += "\[Warning: detonation may occur even with proper equipment.]"
return .
/datum/wires/mines/proc/explode() /datum/wires/mines/proc/explode()
return return
/datum/wires/mines/UpdateCut(var/index, var/mended) /datum/wires/mines/on_cut(wire, mend)
var/obj/effect/mine/C = holder var/obj/effect/mine/C = holder
switch(index) switch(wire)
if(WIRE_DETONATE) if(WIRE_EXPLODE)
C.visible_message("[bicon(C)] *BEEE-*", "[bicon(C)] *BEEE-*") C.visible_message("[bicon(C)] *BEEE-*", "[bicon(C)] *BEEE-*")
C.explode() C.explode()
if(WIRE_TIMED_DET) if(WIRE_EXPLODE_DELAY)
C.visible_message("[bicon(C)] *BEEE-*", "[bicon(C)] *BEEE-*") C.visible_message("[bicon(C)] *BEEE-*", "[bicon(C)] *BEEE-*")
C.explode() C.explode()
@@ -35,30 +32,22 @@
new C.mineitemtype(get_turf(C)) new C.mineitemtype(get_turf(C))
spawn(0) spawn(0)
qdel(C) qdel(C)
return
if(WIRE_DUMMY_1)
return
if(WIRE_DUMMY_2)
return
if(WIRE_BADDISARM) if(WIRE_BADDISARM)
C.visible_message("[bicon(C)] *BEEPBEEPBEEP*", "[bicon(C)] *BEEPBEEPBEEP*") C.visible_message("[bicon(C)] *BEEPBEEPBEEP*", "[bicon(C)] *BEEPBEEPBEEP*")
spawn(20) spawn(20)
C.explode() C.explode()
return ..()
/datum/wires/mines/UpdatePulsed(var/index) /datum/wires/mines/on_pulse(wire)
var/obj/effect/mine/C = holder var/obj/effect/mine/C = holder
if(IsIndexCut(index)) if(is_cut(wire))
return return
switch(index) switch(wire)
if(WIRE_DETONATE) if(WIRE_EXPLODE)
C.visible_message("[bicon(C)] *beep*", "[bicon(C)] *beep*") C.visible_message("[bicon(C)] *beep*", "[bicon(C)] *beep*")
if(WIRE_TIMED_DET) if(WIRE_EXPLODE_DELAY)
C.visible_message("[bicon(C)] *BEEPBEEPBEEP*", "[bicon(C)] *BEEPBEEPBEEP*") C.visible_message("[bicon(C)] *BEEPBEEPBEEP*", "[bicon(C)] *BEEPBEEPBEEP*")
spawn(20) spawn(20)
C.explode() C.explode()
@@ -66,16 +55,10 @@
if(WIRE_DISARM) if(WIRE_DISARM)
C.visible_message("[bicon(C)] *ping*", "[bicon(C)] *ping*") C.visible_message("[bicon(C)] *ping*", "[bicon(C)] *ping*")
if(WIRE_DUMMY_1)
C.visible_message("[bicon(C)] *ping*", "[bicon(C)] *ping*")
if(WIRE_DUMMY_2)
C.visible_message("[bicon(C)] *beep*", "[bicon(C)] *beep*")
if(WIRE_BADDISARM) if(WIRE_BADDISARM)
C.visible_message("[bicon(C)] *ping*", "[bicon(C)] *ping*") C.visible_message("[bicon(C)] *ping*", "[bicon(C)] *ping*")
return ..()
/datum/wires/mines/CanUse(var/mob/living/L) /datum/wires/mines/interactable(mob/user)
var/obj/effect/mine/M = holder var/obj/effect/mine/M = holder
return M.panel_open return M.panel_open

View File

@@ -1,52 +1,48 @@
/datum/wires/particle_acc/control_box /datum/wires/particle_acc/control_box
wire_count = 5 wire_count = 5
holder_type = /obj/machinery/particle_accelerator/control_box holder_type = /obj/machinery/particle_accelerator/control_box
proper_name = "Particle accelerator control"
var/const/PARTICLE_TOGGLE_WIRE = 1 // Toggles whether the PA is on or not. /datum/wires/particle_acc/control_box/New(atom/_holder)
var/const/PARTICLE_STRENGTH_WIRE = 2 // Determines the strength of the PA. wires = list(WIRE_PARTICLE_POWER, WIRE_PARTICLE_STRENGTH, WIRE_PARTICLE_INTERFACE, WIRE_PARTICLE_POWER_LIMIT)
var/const/PARTICLE_INTERFACE_WIRE = 4 // Determines the interface showing up. return ..()
var/const/PARTICLE_LIMIT_POWER_WIRE = 8 // Determines how strong the PA can be.
//var/const/PARTICLE_NOTHING_WIRE = 16 // Blank wire
/datum/wires/particle_acc/control_box/CanUse(var/mob/living/L) /datum/wires/particle_acc/control_box/interactable(mob/user)
var/obj/machinery/particle_accelerator/control_box/C = holder var/obj/machinery/particle_accelerator/control_box/C = holder
if(C.construction_state == 2) if(C.construction_state == 2)
return 1 return TRUE
return 0 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 var/obj/machinery/particle_accelerator/control_box/C = holder
switch(index) switch(wire)
if(WIRE_PARTICLE_POWER)
if(PARTICLE_TOGGLE_WIRE)
C.toggle_power() C.toggle_power()
if(PARTICLE_STRENGTH_WIRE) if(WIRE_PARTICLE_STRENGTH)
C.add_strength() C.add_strength()
if(PARTICLE_INTERFACE_WIRE) if(WIRE_PARTICLE_INTERFACE)
C.interface_control = !C.interface_control C.interface_control = !C.interface_control
if(PARTICLE_LIMIT_POWER_WIRE) if(WIRE_PARTICLE_POWER_LIMIT)
C.visible_message("[bicon(C)]<b>[C]</b> makes a large whirring noise.") C.visible_message("[bicon(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)
var/obj/machinery/particle_accelerator/control_box/C = holder var/obj/machinery/particle_accelerator/control_box/C = holder
switch(index) switch(wire)
if(WIRE_PARTICLE_POWER)
if(PARTICLE_TOGGLE_WIRE) if(C.active == !mend)
if(C.active == !mended)
C.toggle_power() C.toggle_power()
if(PARTICLE_STRENGTH_WIRE) if(WIRE_PARTICLE_STRENGTH)
for(var/i = 1; i < 3; i++) for(var/i = 1; i < 3; i++)
C.remove_strength() C.remove_strength()
if(PARTICLE_INTERFACE_WIRE) if(WIRE_PARTICLE_INTERFACE)
C.interface_control = mended C.interface_control = mend
if(PARTICLE_LIMIT_POWER_WIRE) if(WIRE_PARTICLE_POWER_LIMIT)
C.strength_upper_limit = (mended ? 2 : 3) C.strength_upper_limit = (mend ? 2 : 3)
if(C.strength_upper_limit < C.strength) if(C.strength_upper_limit < C.strength)
C.remove_strength() C.remove_strength()

View File

@@ -1,41 +1,42 @@
/datum/wires/radio /datum/wires/radio
holder_type = /obj/item/device/radio holder_type = /obj/item/device/radio
wire_count = 3 wire_count = 3
proper_name = "Radio"
var/const/WIRE_SIGNAL = 1 /datum/wires/radio/New(atom/_holder)
var/const/WIRE_RECEIVE = 2 wires = list(WIRE_RADIO_SIGNAL, WIRE_RADIO_RECEIVER, WIRE_RADIO_TRANSMIT)
var/const/WIRE_TRANSMIT = 4 return ..()
/datum/wires/radio/CanUse(var/mob/living/L) /datum/wires/radio/interactable(mob/user)
var/obj/item/device/radio/R = holder var/obj/item/device/radio/R = holder
if(R.b_stat) if(R.b_stat)
return 1 return TRUE
return 0 return FALSE
/datum/wires/radio/UpdatePulsed(var/index) /datum/wires/radio/on_pulse(wire)
var/obj/item/device/radio/R = holder var/obj/item/device/radio/R = holder
switch(index) switch(wire)
if(WIRE_SIGNAL) if(WIRE_RADIO_SIGNAL)
R.listening = !R.listening && !IsIndexCut(WIRE_RECEIVE) R.listening = !R.listening && !is_cut(WIRE_RADIO_RECEIVER)
R.broadcasting = R.listening && !IsIndexCut(WIRE_TRANSMIT) R.broadcasting = R.listening && !is_cut(WIRE_RADIO_TRANSMIT)
if(WIRE_RECEIVE) if(WIRE_RADIO_RECEIVER)
R.listening = !R.listening && !IsIndexCut(WIRE_SIGNAL) R.listening = !R.listening && !is_cut(WIRE_RADIO_SIGNAL)
if(WIRE_TRANSMIT) if(WIRE_RADIO_TRANSMIT)
R.broadcasting = !R.broadcasting && !IsIndexCut(WIRE_SIGNAL) R.broadcasting = !R.broadcasting && !is_cut(WIRE_RADIO_SIGNAL)
SSnanoui.update_uis(holder) ..()
/datum/wires/radio/UpdateCut(var/index, var/mended) /datum/wires/radio/on_cut(wire, mend)
var/obj/item/device/radio/R = holder var/obj/item/device/radio/R = holder
switch(index) switch(wire)
if(WIRE_SIGNAL) if(WIRE_RADIO_SIGNAL)
R.listening = mended && !IsIndexCut(WIRE_RECEIVE) R.listening = mend && !is_cut(WIRE_RADIO_RECEIVER)
R.broadcasting = mended && !IsIndexCut(WIRE_TRANSMIT) R.broadcasting = mend && !is_cut(WIRE_RADIO_TRANSMIT)
if(WIRE_RECEIVE) if(WIRE_RADIO_RECEIVER)
R.listening = mended && !IsIndexCut(WIRE_SIGNAL) R.listening = mend && !is_cut(WIRE_RADIO_SIGNAL)
if(WIRE_TRANSMIT) if(WIRE_RADIO_TRANSMIT)
R.broadcasting = mended && !IsIndexCut(WIRE_SIGNAL) R.broadcasting = mend && !is_cut(WIRE_RADIO_SIGNAL)
SSnanoui.update_uis(holder) ..()

View File

@@ -1,76 +1,63 @@
/datum/wires/robot /datum/wires/robot
random = 1 randomize = TRUE
holder_type = /mob/living/silicon/robot holder_type = /mob/living/silicon/robot
wire_count = 5 wire_count = 5
proper_name = "Cyborg"
var/const/BORG_WIRE_LAWCHECK = 1 /datum/wires/robot/New(atom/_holder)
var/const/BORG_WIRE_MAIN_POWER = 2 // The power wires do nothing whyyyyyyyyyyyyy wires = list(WIRE_AI_CONTROL, WIRE_BORG_CAMERA, WIRE_BORG_LAWCHECK, WIRE_BORG_LOCKED)
var/const/BORG_WIRE_LOCKED_DOWN = 4 return ..()
var/const/BORG_WIRE_AI_CONTROL = 8
var/const/BORG_WIRE_CAMERA = 16
/datum/wires/robot/GetInteractWindow() /datum/wires/robot/get_status()
. = ..() . = ..()
var/mob/living/silicon/robot/R = holder var/mob/living/silicon/robot/R = holder
. += show_hint(0x1, R.lawupdate, "The LawSync light is on.", "The LawSync light is off.") . += "The LawSync light is [R.lawupdate ? "on" : "off"]."
. += show_hint(0x2, R.connected_ai, "The AI link light is on.", "The AI link light is off.") . += "The AI link light is [R.connected_ai ? "on" : "off"]."
. += show_hint(0x4, (!isnull(R.camera) && R.camera.status == 1), "The camera light is on.", "The camera light is off.") . += "The Camera light is [(R.camera && R.camera.status == 1) ? "on" : "off"]."
. += show_hint(0x8, R.lockdown, "The lockdown light is on.", "The lockdown light is off.") . += "The lockdown light is [R.lockcharge ? "on" : "off"]."
return .
/datum/wires/robot/UpdateCut(var/index, var/mended)
/datum/wires/robot/on_cut(wire, mend)
var/mob/living/silicon/robot/R = holder var/mob/living/silicon/robot/R = holder
switch(index) switch(wire)
if(BORG_WIRE_LAWCHECK) //Cut the law wire, and the borg will no longer receive law updates from its AI if(WIRE_BORG_LAWCHECK) //Cut the law wire, and the borg will no longer receive law updates from its AI
if(!mended) if(!mend)
if (R.lawupdate == 1) if(R.lawupdate)
to_chat(R, "LawSync protocol engaged.") to_chat(R, "LawSync protocol engaged.")
R.lawsync()
R.show_laws() R.show_laws()
else else
if (R.lawupdate == 0 && !R.emagged) if(!R.lawupdate && !R.emagged)
R.lawupdate = 1 R.lawupdate = TRUE
if (BORG_WIRE_AI_CONTROL) //Cut the AI wire to reset AI control if(WIRE_AI_CONTROL) //Cut the AI wire to reset AI control
if(!mended) if(!mend)
R.disconnect_from_ai() R.disconnect_from_ai()
if (BORG_WIRE_CAMERA) if(WIRE_BORG_CAMERA)
if(!isnull(R.camera) && !R.scrambledcodes) if(!isnull(R.camera) && !R.scrambledcodes)
R.camera.status = mended R.camera.status = mend
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_BORG_LOCKED)
if (R.lawupdate) R.SetLockdown(!mend)
R.lawsync() ..()
if(BORG_WIRE_LOCKED_DOWN) /datum/wires/robot/on_pulse(wire)
R.SetLockdown(!mended)
/datum/wires/robot/UpdatePulsed(var/index)
var/mob/living/silicon/robot/R = holder var/mob/living/silicon/robot/R = holder
switch(index) switch(wire)
if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI if(WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI
if(!R.emagged) if(!R.emagged)
var/mob/living/silicon/ai/new_ai = select_active_ai(R) R.connect_to_ai(select_active_ai(R))
R.connect_to_ai(new_ai)
if (BORG_WIRE_CAMERA) if(WIRE_BORG_CAMERA)
if(!isnull(R.camera) && R.camera.can_use() && !R.scrambledcodes) if(!isnull(R.camera) && R.camera.can_use() && !R.scrambledcodes)
R.visible_message("[R]'s camera lense focuses loudly.") R.visible_message("[R]'s camera lense focuses loudly.")
to_chat(R, "Your camera lense focuses loudly.") to_chat(R, "Your camera lense focuses loudly.")
if(BORG_WIRE_LOCKED_DOWN) if(WIRE_BORG_LOCKED)
R.SetLockdown(!R.lockdown) // Toggle R.SetLockdown(!R.lockdown) // Toggle
/datum/wires/robot/CanUse(var/mob/living/L) /datum/wires/robot/interactable(mob/user)
var/mob/living/silicon/robot/R = holder var/mob/living/silicon/robot/R = holder
if(R.wiresexposed) if(R.wiresexposed)
return 1 return TRUE
return 0 return FALSE
/datum/wires/robot/proc/IsCameraCut()
return wires_status & BORG_WIRE_CAMERA
/datum/wires/robot/proc/LockedCut()
return wires_status & BORG_WIRE_LOCKED_DOWN

View File

@@ -1,56 +1,58 @@
#define SEED_WIRE_SMART 1
#define SEED_WIRE_CONTRABAND 2
#define SEED_WIRE_ELECTRIFY 4
#define SEED_WIRE_LOCKDOWN 8
/datum/wires/seedstorage /datum/wires/seedstorage
holder_type = /obj/machinery/seed_storage holder_type = /obj/machinery/seed_storage
wire_count = 4 wire_count = 4
random = 1 randomize = TRUE
proper_name = "Seed Storage"
/datum/wires/seedstorage/CanUse(var/mob/living/L) /datum/wires/seedstorage/New(atom/_holder)
wires = list(WIRE_SEED_SMART, WIRE_CONTRABAND, WIRE_ELECTRIFY, WIRE_SEED_LOCKDOWN)
return ..()
/datum/wires/seedstorage/interactable(mob/user)
var/obj/machinery/seed_storage/V = holder var/obj/machinery/seed_storage/V = holder
if(V.panel_open) if(V.panel_open)
return 1 return TRUE
return 0 return FALSE
/datum/wires/seedstorage/GetInteractWindow() /datum/wires/seedstorage/get_status()
var/obj/machinery/seed_storage/V = holder var/obj/machinery/seed_storage/V = holder
. += ..() . = ..()
. += show_hint(0x1, V.seconds_electrified, "The orange light is off.", "The orange light is on.") . += "The orange light is [V.seconds_electrified ? "off." : "on."]"
. += show_hint(0x2, V.smart, "The red light is off.", "The red light is blinking.") . += "The red light is [V.smart ? "off." : "blinking."]"
. += show_hint(0x4, V.hacked || V.emagged, "The green light is on.", "The green light is off.") . += "The green light is [(V.hacked || V.emagged) ? "on." : "off."]"
. += show_hint(0x8, V.lockdown, "The keypad lock is deployed.", "The keypad lock is retracted.") . += "The keypad lock light is [V.lockdown ? "deployed." : "retracted."]"
/datum/wires/seedstorage/UpdatePulsed(var/index) /datum/wires/seedstorage/on_pulse(wire)
var/obj/machinery/seed_storage/V = holder var/obj/machinery/seed_storage/V = holder
switch(index) switch(wire)
if(SEED_WIRE_SMART) if(WIRE_SEED_SMART)
V.smart = !V.smart V.smart = !V.smart
if(SEED_WIRE_CONTRABAND) if(WIRE_CONTRABAND)
V.hacked = !V.hacked V.hacked = !V.hacked
if(SEED_WIRE_ELECTRIFY) if(WIRE_ELECTRIFY)
V.seconds_electrified = 30 V.seconds_electrified = 30
if(SEED_WIRE_LOCKDOWN) if(WIRE_SEED_LOCKDOWN)
V.lockdown = !V.lockdown V.lockdown = !V.lockdown
..()
/datum/wires/seedstorage/UpdateCut(var/index, var/mended) /datum/wires/seedstorage/on_cut(wire, mend)
var/obj/machinery/seed_storage/V = holder var/obj/machinery/seed_storage/V = holder
switch(index) switch(wire)
if(SEED_WIRE_SMART) if(WIRE_SEED_SMART)
V.smart = 0 V.smart = FALSE
if(SEED_WIRE_CONTRABAND) if(WIRE_CONTRABAND)
V.hacked = !mended V.hacked = !mend
if(SEED_WIRE_ELECTRIFY) if(WIRE_ELECTRIFY)
if(mended) if(mend)
V.seconds_electrified = 0 V.seconds_electrified = 0
else else
V.seconds_electrified = -1 V.seconds_electrified = -1
if(SEED_WIRE_LOCKDOWN) if(WIRE_SEED_LOCKDOWN)
if(mended) if(mend)
V.lockdown = 1 V.lockdown = TRUE
V.req_access = list() V.req_access = list()
V.req_one_access = list() V.req_one_access = list()
else else
V.req_access = initial(V.req_access) V.req_access = initial(V.req_access)
V.req_one_access = initial(V.req_one_access) V.req_one_access = initial(V.req_one_access)
..()

View File

@@ -1,46 +1,47 @@
/datum/wires/shield_generator /datum/wires/shield_generator
holder_type = /obj/machinery/power/shield_generator holder_type = /obj/machinery/power/shield_generator
wire_count = 5 wire_count = 5
proper_name = "Shield Generator"
var/const/SHIELDGEN_WIRE_POWER = 1 // Cut to disable power input into the generator. Pulse does nothing. Mend to restore. /datum/wires/shield_generator/New(atom/_holder)
var/const/SHIELDGEN_WIRE_HACK = 2 // Pulse to hack the generator, enabling hacked modes. Cut to unhack. Mend does nothing. wires = list(WIRE_MAIN_POWER1, WIRE_CONTRABAND, WIRE_AI_CONTROL, WIRE_SHIELD_CONTROL)
var/const/SHIELDGEN_WIRE_CONTROL = 4 // Cut to lock most shield controls. Mend to unlock them. Pulse does nothing. return ..()
var/const/SHIELDGEN_WIRE_AICONTROL = 8 // Cut to disable AI control. Mend to restore.
var/const/SHIELDGEN_WIRE_NOTHING = 16 // A blank wire that doesn't have any specific function
/datum/wires/shield_generator/CanUse(var/mob/living/L) /datum/wires/shield_generator/interactable(mob/user)
var/obj/machinery/power/shield_generator/S = holder var/obj/machinery/power/shield_generator/S = holder
if(S.panel_open) if(S.panel_open)
return 1 return TRUE
return 0 return FALSE
/datum/wires/shield_generator/GetInteractWindow() /datum/wires/shield_generator/get_status()
var/obj/machinery/power/shield_generator/S = holder var/obj/machinery/power/shield_generator/S = holder
. += ..() . = ..()
. += show_hint(0x1, S.mode_changes_locked, "The orange light is on.", "The orange light is off.") . += "The orange light is [S.mode_changes_locked ? "on." : "off."]"
. += show_hint(0x2, S.ai_control_disabled, "The blue light is off.", "The blue light is blinking.") . += "The blue light is [S.ai_control_disabled ? "off." : "blinking."]"
. += show_hint(0x4, S.hacked, "The violet light is pulsing.", "The violet light is steady.") . += "The violet light is [S.hacked ? "pulsing." : "steady."]"
. += show_hint(0x8, S.input_cut, "The red light is off.", "The red light is on.") . += "The red light is [S.input_cut ? "off." : "on."]"
/datum/wires/shield_generator/UpdateCut(index, mended) /datum/wires/shield_generator/on_cut(wire, mend)
var/obj/machinery/power/shield_generator/S = holder var/obj/machinery/power/shield_generator/S = holder
switch(index) switch(wire)
if(SHIELDGEN_WIRE_POWER) if(WIRE_MAIN_POWER1)
S.input_cut = !mended S.input_cut = !mend
if(SHIELDGEN_WIRE_HACK) if(WIRE_CONTRABAND)
if(!mended) if(!mend)
S.hacked = 0 S.hacked = FALSE
if(S.check_flag(MODEFLAG_BYPASS)) if(S.check_flag(MODEFLAG_BYPASS))
S.toggle_flag(MODEFLAG_BYPASS) S.toggle_flag(MODEFLAG_BYPASS)
if(S.check_flag(MODEFLAG_OVERCHARGE)) if(S.check_flag(MODEFLAG_OVERCHARGE))
S.toggle_flag(MODEFLAG_OVERCHARGE) S.toggle_flag(MODEFLAG_OVERCHARGE)
if(SHIELDGEN_WIRE_CONTROL) if(WIRE_SHIELD_CONTROL)
S.mode_changes_locked = !mended S.mode_changes_locked = !mend
if(SHIELDGEN_WIRE_AICONTROL) if(WIRE_AI_CONTROL)
S.ai_control_disabled = !mended S.ai_control_disabled = !mend
..()
/datum/wires/shield_generator/UpdatePulsed(var/index) /datum/wires/shield_generator/on_pulse(wire)
var/obj/machinery/power/shield_generator/S = holder var/obj/machinery/power/shield_generator/S = holder
switch(index) switch(wire)
if(SHIELDGEN_WIRE_HACK) if(WIRE_CONTRABAND)
S.hacked = 1 S.hacked = TRUE
..()

View File

@@ -1,47 +1,52 @@
/datum/wires/smartfridge /datum/wires/smartfridge
holder_type = /obj/machinery/smartfridge holder_type = /obj/machinery/smartfridge
wire_count = 3 wire_count = 3
proper_name = "Smartfridge"
/datum/wires/smartfridge/New(atom/_holder)
wires = list(WIRE_ELECTRIFY, WIRE_IDSCAN, WIRE_THROW_ITEM)
return ..()
/datum/wires/smartfridge/secure /datum/wires/smartfridge/secure
random = 1 randomize = TRUE
wire_count = 4 wire_count = 4 // 3 actual, 1 dud.
var/const/SMARTFRIDGE_WIRE_ELECTRIFY = 1 /datum/wires/smartfridge/interactable(mob/user)
var/const/SMARTFRIDGE_WIRE_THROW = 2
var/const/SMARTFRIDGE_WIRE_IDSCAN = 4
/datum/wires/smartfridge/CanUse(var/mob/living/L)
var/obj/machinery/smartfridge/S = holder var/obj/machinery/smartfridge/S = holder
if(iscarbon(user) && S.Adjacent(user) && S.seconds_electrified && S.shock(user, 100))
return FALSE
if(S.panel_open) if(S.panel_open)
return 1 return TRUE
return 0 return FALSE
/datum/wires/smartfridge/GetInteractWindow() /datum/wires/smartfridge/get_status()
. = ..()
var/obj/machinery/smartfridge/S = holder var/obj/machinery/smartfridge/S = holder
. += ..() . += "The orange light is [S.seconds_electrified ? "off" : "on"]."
. += show_hint(0x1, S.seconds_electrified, "The orange light is off.", "The orange light is on.") . += "The red light is [S.shoot_inventory ? "off" : "blinking"]."
. += show_hint(0x2, S.shoot_inventory, "The red light is off.", "The red light is blinking.") . += "A [S.scan_id ? "purple" : "yellow"] light is on."
. += show_hint(0x4, S.scan_id, "A purple light is on.", "A yellow light is on.")
/datum/wires/smartfridge/UpdatePulsed(var/index) /datum/wires/smartfridge/on_pulse(wire)
var/obj/machinery/smartfridge/S = holder var/obj/machinery/smartfridge/S = holder
switch(index) switch(wire)
if(SMARTFRIDGE_WIRE_THROW) if(WIRE_THROW_ITEM)
S.shoot_inventory = !S.shoot_inventory S.shoot_inventory = !S.shoot_inventory
if(SMARTFRIDGE_WIRE_ELECTRIFY) if(WIRE_ELECTRIFY)
S.seconds_electrified = 30 S.seconds_electrified = 30
if(SMARTFRIDGE_WIRE_IDSCAN) if(WIRE_IDSCAN)
S.scan_id = !S.scan_id S.scan_id = !S.scan_id
..()
/datum/wires/smartfridge/UpdateCut(var/index, var/mended) /datum/wires/smartfridge/on_cut(wire, mend)
var/obj/machinery/smartfridge/S = holder var/obj/machinery/smartfridge/S = holder
switch(index) switch(wire)
if(SMARTFRIDGE_WIRE_THROW) if(WIRE_THROW_ITEM)
S.shoot_inventory = !mended S.shoot_inventory = !mend
if(SMARTFRIDGE_WIRE_ELECTRIFY) if(WIRE_ELECTRIFY)
if(mended) if(mend)
S.seconds_electrified = 0 S.seconds_electrified = 0
else else
S.seconds_electrified = -1 S.seconds_electrified = -1
if(SMARTFRIDGE_WIRE_IDSCAN) if(WIRE_IDSCAN)
S.scan_id = 1 S.scan_id = TRUE
..()

View File

@@ -1,59 +1,57 @@
/datum/wires/smes /datum/wires/smes
holder_type = /obj/machinery/power/smes/buildable holder_type = /obj/machinery/power/smes/buildable
wire_count = 5 wire_count = 5
proper_name = "SMES"
var/const/SMES_WIRE_RCON = 1 // Remote control (AI and consoles), cut to disable /datum/wires/smes/New(atom/_holder)
var/const/SMES_WIRE_INPUT = 2 // Input wire, cut to disable input, pulse to disable for 60s wires = list(WIRE_SMES_RCON, WIRE_SMES_INPUT, WIRE_SMES_OUTPUT, WIRE_SMES_GROUNDING, WIRE_SMES_FAILSAFES)
var/const/SMES_WIRE_OUTPUT = 4 // Output wire, cut to disable output, pulse to disable for 60s return ..()
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/interactable(mob/user)
/datum/wires/smes/CanUse(var/mob/living/L)
var/obj/machinery/power/smes/buildable/S = holder var/obj/machinery/power/smes/buildable/S = holder
if(S.panel_open) if(S.panel_open)
return 1 return TRUE
return 0 return FALSE
/datum/wires/smes/get_status()
/datum/wires/smes/GetInteractWindow()
var/obj/machinery/power/smes/buildable/S = holder var/obj/machinery/power/smes/buildable/S = holder
. += ..() . = ..()
. += show_hint(0x1, S.input_cut || S.input_pulsed || S.output_cut || S.output_pulsed, "The green light is off.", "The green light is on.") . += "The green light is [(S.input_cut || S.input_pulsed || S.output_cut || S.output_pulsed) ? "off" : "on"]."
. += show_hint(0x2, S.safeties_enabled || S.grounding, "The red light is off.", "The red light is blinking.") . += "The red light is [(S.safeties_enabled || S.grounding) ? "off" : "blinking"]."
. += show_hint(0x4, S.RCon, "The blue light is on.", "The blue light is off.") . += "The blue light is [S.RCon ? "on" : "off"]."
/datum/wires/smes/UpdateCut(var/index, var/mended) /datum/wires/smes/on_cut(wire, mend)
var/obj/machinery/power/smes/buildable/S = holder var/obj/machinery/power/smes/buildable/S = holder
switch(index) switch(wire)
if(SMES_WIRE_RCON) if(WIRE_SMES_RCON)
S.RCon = mended S.RCon = mend
if(SMES_WIRE_INPUT) if(WIRE_SMES_INPUT)
S.input_cut = !mended S.input_cut = !mend
if(SMES_WIRE_OUTPUT) if(WIRE_SMES_OUTPUT)
S.output_cut = !mended S.output_cut = !mend
if(SMES_WIRE_GROUNDING) if(WIRE_SMES_GROUNDING)
S.grounding = mended S.grounding = mend
if(SMES_WIRE_FAILSAFES) if(WIRE_SMES_FAILSAFES)
S.safeties_enabled = mended S.safeties_enabled = mend
..()
/datum/wires/smes/on_pulse(wire)
/datum/wires/smes/UpdatePulsed(var/index)
var/obj/machinery/power/smes/buildable/S = holder var/obj/machinery/power/smes/buildable/S = holder
switch(index) switch(wire)
if(SMES_WIRE_RCON) if(WIRE_SMES_RCON)
if(S.RCon) if(S.RCon)
S.RCon = 0 S.RCon = 0
spawn(10) spawn(10)
S.RCon = 1 S.RCon = 1
if(SMES_WIRE_INPUT) if(WIRE_SMES_INPUT)
S.toggle_input() S.toggle_input()
if(SMES_WIRE_OUTPUT) if(WIRE_SMES_OUTPUT)
S.toggle_output() S.toggle_output()
if(SMES_WIRE_GROUNDING) if(WIRE_SMES_GROUNDING)
S.grounding = 0 S.grounding = 0
if(SMES_WIRE_FAILSAFES) if(WIRE_SMES_FAILSAFES)
if(S.safeties_enabled) if(S.safeties_enabled)
S.safeties_enabled = 0 S.safeties_enabled = 0
spawn(10) spawn(10)
S.safeties_enabled = 1 S.safeties_enabled = 1
..()

View File

@@ -1,47 +1,46 @@
/datum/wires/suit_storage_unit /datum/wires/suit_storage_unit
holder_type = /obj/machinery/suit_cycler holder_type = /obj/machinery/suit_cycler
wire_count = 3 wire_count = 3
proper_name = "Suit storage unit"
var/const/SUIT_STORAGE_WIRE_ELECTRIFY = 1 /datum/wires/suit_storage_unit/New(atom/_holder)
var/const/SUIT_STORAGE_WIRE_SAFETY = 2 wires = list(WIRE_IDSCAN, WIRE_ELECTRIFY, WIRE_SAFETY)
var/const/SUIT_STORAGE_WIRE_LOCKED = 4 return ..()
/datum/wires/suit_storage_unit/CanUse(var/mob/living/L) /datum/wires/suit_storage_unit/interactable(mob/user)
var/obj/machinery/suit_cycler/S = holder var/obj/machinery/suit_cycler/S = holder
if(!istype(L, /mob/living/silicon)) if(iscarbon(user) && S.Adjacent(user) && S.electrified)
if(S.electrified) return !S.shock(user, 100)
if(S.shock(L, 100))
return 0
if(S.panel_open) if(S.panel_open)
return 1 return TRUE
return 0 return FALSE
/datum/wires/suit_storage_unit/GetInteractWindow() /datum/wires/suit_storage_unit/get_status()
var/obj/machinery/suit_cycler/S = holder . = ..()
. += ..() var/obj/machinery/suit_cycler/A = holder
. += show_hint(0x1, S.electrified, "The orange light is off.", "The orange light is on.") . += "The orange light is [A.electrified ? "off" : "on"]."
. += show_hint(0x2, S.safeties, "The red light is off.", "The red light is blinking.") . += "The red light is [A.safeties ? "off" : "blinking"]."
. += show_hint(0x4, S.locked, "The yellow light is on.", "The yellow light is off.") . += "The yellow light is [A.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 var/obj/machinery/suit_cycler/S = holder
switch(index) switch(wire)
if(SUIT_STORAGE_WIRE_SAFETY) if(WIRE_SAFETY)
S.safeties = !S.safeties S.safeties = !S.safeties
if(SUIT_STORAGE_WIRE_ELECTRIFY) if(WIRE_ELECTRIFY)
S.electrified = 30 S.electrified = 30
if(SUIT_STORAGE_WIRE_LOCKED) if(WIRE_IDSCAN)
S.locked = !S.locked S.locked = !S.locked
/datum/wires/suit_storage_unit/UpdateCut(var/index, var/mended) /datum/wires/suit_storage_unit/on_cut(wire, mend)
var/obj/machinery/suit_cycler/S = holder var/obj/machinery/suit_cycler/S = holder
switch(index) switch(wire)
if(SUIT_STORAGE_WIRE_SAFETY) if(WIRE_SAFETY)
S.safeties = mended S.safeties = mend
if(SUIT_STORAGE_WIRE_LOCKED) if(WIRE_IDSCAN)
S.locked = mended S.locked = mend
if(SUIT_STORAGE_WIRE_ELECTRIFY) if(WIRE_ELECTRIFY)
if(mended) if(mend)
S.electrified = 0 S.electrified = 0
else else
S.electrified = -1 S.electrified = -1

View File

@@ -1,18 +1,21 @@
/datum/wires/tesla_coil /datum/wires/tesla_coil
wire_count = 1 wire_count = 1
holder_type = /obj/machinery/power/tesla_coil holder_type = /obj/machinery/power/tesla_coil
proper_name = "Tesla coil"
var/const/WIRE_ZAP = 1 /datum/wires/tesla_coil/New(atom/_holder)
wires = list(WIRE_TESLACOIL_ZAP)
return ..()
/datum/wires/tesla_coil/CanUse(mob/living/L) /datum/wires/tesla_coil/interactable(mob/user)
var/obj/machinery/power/tesla_coil/T = holder var/obj/machinery/power/tesla_coil/T = holder
if(T && T.panel_open) if(T && T.panel_open)
return 1 return TRUE
return 0 return FALSE
/datum/wires/tesla_coil/UpdatePulsed(index) /datum/wires/tesla_coil/on_pulse(wire)
var/obj/machinery/power/tesla_coil/T = holder var/obj/machinery/power/tesla_coil/T = holder
switch(index) switch(wire)
if(WIRE_ZAP) if(WIRE_TESLACOIL_ZAP)
T.zap() T.zap()
..() ..()

View File

@@ -1,49 +1,53 @@
/datum/wires/vending /datum/wires/vending
holder_type = /obj/machinery/vending holder_type = /obj/machinery/vending
wire_count = 4 wire_count = 4
proper_name = "Vending machine"
var/const/VENDING_WIRE_THROW = 1 /datum/wires/vending/New(atom/_holder)
var/const/VENDING_WIRE_CONTRABAND = 2 wires = list(WIRE_THROW_ITEM, WIRE_IDSCAN, WIRE_ELECTRIFY, WIRE_CONTRABAND)
var/const/VENDING_WIRE_ELECTRIFY = 4 return ..()
var/const/VENDING_WIRE_IDSCAN = 8
/datum/wires/vending/CanUse(var/mob/living/L) /datum/wires/vending/interactable(mob/user)
var/obj/machinery/vending/V = holder var/obj/machinery/vending/V = holder
if(iscarbon(user) && V.seconds_electrified && V.shock(user, 100))
return FALSE
if(V.panel_open) if(V.panel_open)
return 1 return TRUE
return 0 return FALSE
/datum/wires/vending/GetInteractWindow() /datum/wires/vending/get_status()
var/obj/machinery/vending/V = holder var/obj/machinery/vending/V = holder
. += ..() . = ..()
. += show_hint(0x1, V.seconds_electrified, "The orange light is off.", "The orange light is on.") . += "The orange light is [V.seconds_electrified ? "on" : "off"]."
. += show_hint(0x2, V.shoot_inventory, "The red light is off.", "The red light is blinking.") . += "The red light is [V.shoot_inventory ? "off" : "blinking"]."
. += show_hint(0x4, V.categories & CAT_HIDDEN, "A green light is on.", "A green light is off.") . += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"]."
. += show_hint(0x8, V.scan_id, "A purple light is on.", "A yellow light is on.") . += "A [V.scan_id ? "purple" : "yellow"] light is on."
/datum/wires/vending/UpdatePulsed(var/index) /datum/wires/vending/on_pulse(wire)
var/obj/machinery/vending/V = holder var/obj/machinery/vending/V = holder
switch(index) switch(wire)
if(VENDING_WIRE_THROW) if(WIRE_THROW_ITEM)
V.shoot_inventory = !V.shoot_inventory V.shoot_inventory = !V.shoot_inventory
if(VENDING_WIRE_CONTRABAND) if(WIRE_CONTRABAND)
V.categories ^= CAT_HIDDEN V.categories ^= CAT_HIDDEN
if(VENDING_WIRE_ELECTRIFY) if(WIRE_ELECTRIFY)
V.seconds_electrified = 30 V.seconds_electrified = 30
if(VENDING_WIRE_IDSCAN) if(WIRE_IDSCAN)
V.scan_id = !V.scan_id V.scan_id = !V.scan_id
..()
/datum/wires/vending/UpdateCut(var/index, var/mended) /datum/wires/vending/on_cut(wire, mend)
var/obj/machinery/vending/V = holder var/obj/machinery/vending/V = holder
switch(index) switch(wire)
if(VENDING_WIRE_THROW) if(WIRE_THROW_ITEM)
V.shoot_inventory = !mended V.shoot_inventory = !mend
if(VENDING_WIRE_CONTRABAND) if(WIRE_CONTRABAND)
V.categories &= ~CAT_HIDDEN V.categories &= ~CAT_HIDDEN
if(VENDING_WIRE_ELECTRIFY) if(WIRE_ELECTRIFY)
if(mended) if(mend)
V.seconds_electrified = 0 V.seconds_electrified = 0
else else
V.seconds_electrified = -1 V.seconds_electrified = -1
if(VENDING_WIRE_IDSCAN) if(WIRE_IDSCAN)
V.scan_id = 1 V.scan_id = 1
..()

View File

@@ -1,340 +1,460 @@
// 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 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")
/datum/wires /datum/wires
/// TRUE if the wires will be different every time a new wire datum is created.
var/randomize = FALSE
/// The atom the wires belong too. For example: an airlock.
var/atom/holder
/// The holder type; used to make sure that the holder is the correct type.
var/holder_type
/// The display name for the TGUI window. For example, given the var is "APC"...
/// When the TGUI window is opened, "wires" will be appended to it's title, and it would become "APC wires".
var/proper_name = "Unknown"
/// The total number of wires that our holder atom has.
var/wire_count = NONE
/// A list of all wires. For a list of valid wires defines that can go here, see `code/__DEFINES/wires.dm`
var/list/wires
/// A list of all cut wires. The same values that can go into `wires` will get added and removed from this list.
var/list/cut_wires
/// An associative list with the wire color as the key, and the wire define as the value.
var/list/colors
/// An associative list of signalers attached to the wires. The wire color is the key, and the signaler object reference is the value.
var/list/assemblies
var/random = 0 // Will the wires be different for every single instance. /datum/wires/New(atom/_holder)
var/atom/holder = null // The holder
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
var/hint_states = 0 // BITFLAG OF HINT STATES (For tracking if they changed for bolding in UI)
var/hint_states_initialized = FALSE // False until first time window is rendered.
var/list/wires = list()
var/list/signallers = list()
var/table_options = " align='center'"
var/row_options1 = " width='80px'"
var/row_options2 = " width='260px'"
var/window_x = 370
var/window_y = 470
// Note: Its assumed states are boolean. If you ever have a multi-state hint, you must implement that yourself.
/datum/wires/proc/show_hint(flag, current_state, true_text, false_text)
var/state_changed = FALSE
if(hint_states_initialized)
if(!(hint_states & flag) != !current_state) // NOT-ing to convert to boolean
state_changed = TRUE
if(current_state)
hint_states |= flag
return state_changed ? "<br><b>[true_text]</b>" : "<br>[true_text]"
else
hint_states &= ~flag
return state_changed ? "<br><b>[false_text]</b>" : "<br>[false_text]"
/datum/wires/New(var/atom/holder)
..() ..()
src.holder = holder if(!istype(_holder, holder_type))
if(!istype(holder, holder_type))
CRASH("Our holder is null/the wrong type!") CRASH("Our holder is null/the wrong type!")
holder = _holder
cut_wires = list()
colors = list()
assemblies = list()
// Add in the appropriate amount of dud wires.
var/wire_len = length(wires)
if(wire_len < wire_count) // If the amount of "real" wires is less than the total we're suppose to have...
add_duds(wire_count - wire_len) // Add in the appropriate amount of duds to reach `wire_count`.
// If the randomize is true, we need to generate a new set of wires and ignore any wire color directories.
if(randomize)
randomize()
return return
// Generate new wires if(!GLOB.wire_color_directory[holder_type])
if(random) randomize()
GenerateWires() GLOB.wire_color_directory[holder_type] = colors
// Get the same wires
else else
// We don't have any wires to copy yet, generate some and then copy it. colors = GLOB.wire_color_directory[holder_type]
if(!same_wires[holder_type])
GenerateWires()
same_wires[holder_type] = src.wires.Copy()
else
var/list/wires = same_wires[holder_type]
src.wires = wires // Reference the wires list.
/datum/wires/Destroy() /datum/wires/Destroy()
holder = null holder = null
signallers.Cut() for(var/color in colors)
detach_assembly(color)
return ..() return ..()
/datum/wires/proc/GenerateWires() /**
var/list/colours_to_pick = wireColours.Copy() // Get a copy, not a reference. * Randomly generates a new set of wires. and corresponding colors from the given pool. Assigns the information as an associative list, to `colors`.
var/list/indexes_to_pick = list() *
//Generate our indexes * In the `colors` list, the name of the color is the key, and the wire is the value.
for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i) * For example: `colors["red"] = WIRE_ELECTRIFY`. This will look like `list("red" = WIRE_ELECTRIFY)` internally.
indexes_to_pick += i */
colours_to_pick.len = wire_count // Downsize it to our specifications. /datum/wires/proc/randomize()
var/static/list/possible_colors = list("red", "blue", "green", "darkred", "orange", "brown", "gold", "grey", "cyan", "navy", "purple", "pink", "darkslategrey", "yellow")
var/list/my_possible_colors = possible_colors.Copy()
while(colours_to_pick.len && indexes_to_pick.len) for(var/wire in shuffle(wires))
// Pick and remove a colour colors[pick_n_take(my_possible_colors)] = wire
var/colour = pick_n_take(colours_to_pick)
// Pick and remove an index /**
var/index = pick_n_take(indexes_to_pick) * Proc called when the user attempts to interact with wires UI.
*
* Checks if the user exists, is a mob, the wires are attached to something (`holder`) and makes sure `interactable(user)` returns TRUE.
* If all the checks succeed, open the TGUI interface for the user.
*
* Arugments:
* * user - the mob trying to interact with the wires.
*/
/datum/wires/proc/Interact(mob/user)
if(user && istype(user) && holder && interactable(user))
tgui_interact(user)
src.wires[colour] = index /**
//wires = shuffle(wires) * Base proc, intended to be overriden. Wire datum specific checks you want to run before the TGUI is shown to the user should go here.
*/
/datum/wires/proc/interactable(mob/user)
return TRUE
/// Users will be interacting with our holder object and not the wire datum directly, therefore we need to return the holder.
/datum/wires/tgui_host()
return holder
/datum/wires/proc/Interact(var/mob/living/user) /datum/wires/tgui_interact(mob/user, datum/tgui/ui = null)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Wires", "[proper_name] wires")
ui.open()
var/html = null /datum/wires/tgui_state(mob/user)
if(holder && CanUse(user)) return GLOB.tgui_physical_state
html = GetInteractWindow()
hint_states_initialized = TRUE /datum/wires/tgui_data(mob/user)
if(html) var/list/data = list()
user.set_machine(holder) var/list/replace_colors
else
user.unset_machine() if(isliving(user))
// No content means no window. var/mob/living/L = user
user << browse(null, "window=wires") for(var/datum/modifier/M in L.modifiers)
if(!isnull(M.wire_colors_replace))
replace_colors = M.wire_colors_replace
break
var/list/wires_list = list()
for(var/color in colors)
var/replaced_color = color
var/color_name = color
if(color in replace_colors) // If this color is one that needs to be replaced using the colorblindness list.
replaced_color = replace_colors[color]
if(replaced_color in LIST_COLOR_RENAME) // If its an ugly written color name like "darkolivegreen", rename it to something like "dark green".
color_name = LIST_COLOR_RENAME[replaced_color]
else
color_name = replaced_color // Else just keep the normal color name
wires_list += list(list(
"seen_color" = replaced_color, // The color of the wire that the mob will see. This will be the same as `color` if the user is NOT colorblind.
"color_name" = color_name, // The wire's name. This will be the same as `color` if the user is NOT colorblind.
"color" = color, // The "real" color of the wire. No replacements.
"wire" = can_see_wire_info(user) && !is_dud_color(color) ? get_wire(color) : null, // Wire define information like "Contraband" or "Door Bolts".
"cut" = is_color_cut(color), // Whether the wire is cut or not. Used to display "cut" or "mend".
"attached" = is_attached(color) // Whether or not a signaler is attached to this wire.
))
data["wires"] = wires_list
// Get the information shown at the bottom of wire TGUI window, such as "The red light is blinking", etc.
// If the user is colorblind, we need to replace these colors as well.
var/list/status = get_status()
if(replace_colors)
var/i
for(i in 1 to length(status))
for(var/color in replace_colors)
var/new_color = replace_colors[color]
if(new_color in LIST_COLOR_RENAME)
new_color = LIST_COLOR_RENAME[new_color]
if(findtext(status[i], color))
status[i] = replacetext(status[i], color, new_color)
break
data["status"] = status
return data
/datum/wires/tgui_act(action, list/params)
if(..())
return return
var/datum/browser/popup = new(user, "wires", holder.name, window_x, window_y) var/mob/user = usr
popup.set_content(html) if(!interactable(user))
popup.set_title_image(user.browse_rsc_icon(holder.icon, holder.icon_state))
popup.open()
/datum/wires/proc/GetInteractWindow()
var/html = "<div class='block'>"
html += "<h3>Exposed Wires</h3>"
html += "<table[table_options]>"
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"] Signaller</A></td></tr>"
html += "</table>"
html += "</div>"
if (random)
html += "<i>\The [holder] appears to have tamper-resistant electronics installed.</i><br><br>" //maybe this could be more generic?
return html
/datum/wires/Topic(href, href_list)
..()
if(in_range(holder, usr) && isliving(usr))
var/mob/living/L = usr
if(CanUse(L) && href_list["action"])
holder.add_hiddenprint(L)
var/list/items = L.get_all_held_items()
var/success = FALSE
if(href_list["cut"]) // Toggles the cut/mend status
for(var/obj/item/I in items) // Paranoid about someone somehow grabbing a non-/obj/item, lets play it safe.
if(I.is_wirecutter())
var/colour = href_list["cut"]
CutWireColour(colour)
playsound(holder, I.usesound, 20, 1)
success = TRUE
break
if(!success)
to_chat(L, span("warning", "You need wirecutters!"))
else if(href_list["pulse"])
for(var/obj/item/I in items)
if(I.is_multitool())
var/colour = href_list["pulse"]
PulseColour(colour)
playsound(holder, 'sound/weapons/empty.ogg', 20, 1)
success = TRUE
break
if(!success)
to_chat(L, span("warning", "You need a multitool!"))
else if(href_list["attach"])
var/colour = href_list["attach"]
// Detach
if(IsAttached(colour))
var/obj/item/O = Detach(colour)
if(O)
L.put_in_hands(O)
// Attach
else
var/obj/item/device/assembly/signaler/S = L.is_holding_item_of_type(/obj/item/device/assembly/signaler)
if(istype(S))
L.drop_from_inventory(S)
Attach(colour, S)
else
to_chat(L, span("warning", "You need a remote signaller!"))
// Update Window
Interact(usr)
if(href_list["close"])
usr << browse(null, "window=wires")
usr.unset_machine(holder)
//
// Overridable Procs
//
// Called when wires cut/mended.
/datum/wires/proc/UpdateCut(var/index, var/mended)
return
// Called when wire pulsed. Add code here.
/datum/wires/proc/UpdatePulsed(var/index)
return
/datum/wires/proc/CanUse(var/mob/living/L)
return 1
// 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))
return return
UpdatePulsed(index)
/datum/wires/proc/GetIndex(var/colour) var/obj/item/I = user.get_active_hand()
if(wires[colour]) var/color = lowertext(params["wire"])
var/index = wires[colour] holder.add_hiddenprint(user)
return index
switch(action)
// Toggles the cut/mend status.
if("cut")
// if(!I.is_wirecutter() && !user.can_admin_interact())
if(!istype(I) || !I.is_wirecutter())
to_chat(user, "<span class='error'>You need wirecutters!</span>")
return
playsound(holder, I.usesound, 20, 1)
cut_color(color)
return TRUE
// Pulse a wire.
if("pulse")
// if(!I.is_multitool() && !user.can_admin_interact())
if(!istype(I) || !I.is_multitool())
to_chat(user, "<span class='error'>You need a multitool!</span>")
return
playsound(holder, 'sound/weapons/empty.ogg', 20, 1)
pulse_color(color)
// If they pulse the electrify wire, call interactable() and try to shock them.
if(get_wire(color) == WIRE_ELECTRIFY)
interactable(user)
return TRUE
// Attach a signaler to a wire.
if("attach")
if(is_attached(color))
var/obj/item/O = detach_assembly(color)
if(O)
user.put_in_hands(O)
return TRUE
if(!istype(I, /obj/item/device/assembly/signaler))
to_chat(user, "<span class='error'>You need a remote signaller!</span>")
return
if(user.unEquip(I))
attach_assembly(color, I)
return TRUE
else
to_chat(user, "<span class='warning'>[I] is stuck to your hand!</span>")
/**
* Proc called to determine if the user can see wire define information, such as "Contraband", "Door Bolts", etc.
*
* If the user is an admin, or has a multitool which reveals wire information in their active hand, the proc returns TRUE.
*
* TODO: Reimplement this if we ever get Advanced Admin Interaction or want alien multitools to do more neat things.
* For now, it always returns false.
* Arguments:
* * user - the mob who is interacting with the wires.
*/
/datum/wires/proc/can_see_wire_info(mob/user)
// if(user.can_admin_interact())
// return TRUE
// var/obj/item/I = user.get_active_hand()
// if(istype(I) && I.is_multitool())
// var/obj/item/multitool/M = user.get_active_hand()
// if(M.shows_wire_information)
// return TRUE
return FALSE
/**
* Base proc, intended to be overwritten. Put wire information you'll see at the botton of the TGUI window here, such as "The red light is blinking".
*/
/datum/wires/proc/get_status()
return list()
/**
* Clears the `colors` list, and randomizes it to a new set of color-to-wire relations.
*/
/datum/wires/proc/shuffle_wires()
colors.Cut()
randomize()
/**
* Repairs all cut wires.
*/
/datum/wires/proc/repair()
cut_wires.Cut()
/**
* Adds in dud wires, which do nothing when cut/pulsed.
*
* Arguments:
* * duds - the amount of dud wires to generate.
*/
/datum/wires/proc/add_duds(duds)
while(duds)
var/dud = WIRE_DUD_PREFIX + "[--duds]"
if(dud in wires)
continue
wires += dud
/**
* Determines if the passed in wire is a dud or not. Returns TRUE if the wire is a dud, FALSE otherwise.
*
* Arugments:
* * wire - a wire define, NOT a color. For example `WIRE_ELECTRIFY`.
*/
/datum/wires/proc/is_dud(wire)
return findtext(wire, WIRE_DUD_PREFIX, 1, length(WIRE_DUD_PREFIX) + 1)
/**
* Returns TRUE if the wire that corresponds to the passed in color is a dud. FALSE otherwise.
*
* Arugments:
* * color - a wire color.
*/
/datum/wires/proc/is_dud_color(color)
return is_dud(get_wire(color))
/**
* Gets the wire associated with the color passed in.
*
* Arugments:
* * color - a wire color.
*/
/datum/wires/proc/get_wire(color)
return colors[color]
/**
* Determines if the passed in wire is cut or not. Returns TRUE if it's cut, FALSE otherwise.
*
* Arugments:
* * wire - a wire define, NOT a color. For example `WIRE_ELECTRIFY`.
*/
/datum/wires/proc/is_cut(wire)
return (wire in cut_wires)
/**
* Determines if the wire associated with the passed in color, is cut or not. Returns TRUE if it's cut, FALSE otherwise.
*
* Arugments:
* * wire - a wire color.
*/
/datum/wires/proc/is_color_cut(color)
return is_cut(get_wire(color))
/**
* Determines if all of the wires are cut. Returns TRUE they're all cut, FALSE otherwise.
*/
/datum/wires/proc/is_all_cut()
return (length(cut_wires) == length(wires))
/**
* Cut or mend a wire. Calls `on_cut()`.
*
* Arugments:
* * wire - a wire define, NOT a color. For example `WIRE_ELECTRIFY`.
*/
/datum/wires/proc/cut(wire)
if(is_cut(wire))
cut_wires -= wire
on_cut(wire, mend = TRUE)
else else
CRASH("[colour] is not a key in wires.") cut_wires += wire
on_cut(wire, mend = FALSE)
// /**
// Is Index/Colour Cut procs * Cut the wire which corresponds with the passed in color.
// *
* Arugments:
* * color - a wire color.
*/
/datum/wires/proc/cut_color(color)
cut(get_wire(color))
/datum/wires/proc/IsColourCut(var/colour) /**
var/index = GetIndex(colour) * Cuts a random wire.
return IsIndexCut(index) */
/datum/wires/proc/cut_random()
cut(wires[rand(1, length(wires))])
/datum/wires/proc/IsIndexCut(var/index) /**
return (index & wires_status) * Cuts all wires.
*/
/datum/wires/proc/cut_all()
for(var/wire in wires)
cut(wire)
// /**
// Signaller Procs * Proc called when any wire is cut.
// *
* Base proc, intended to be overriden.
* Place an behavior you want to happen when certain wires are cut, into this proc.
*
* Arugments:
* * wire - a wire define, NOT color. For example 'WIRE_ELECTRIFY'.
* * mend - TRUE if we're mending the wire. FALSE if we're cutting.
*/
/datum/wires/proc/on_cut(wire, mend = FALSE)
return
/datum/wires/proc/IsAttached(var/colour) /**
if(signallers[colour]) * Pulses the given wire. Calls `on_pulse()`.
return 1 *
return 0 * Arugments:
* * wire - a wire define, NOT a color. For example `WIRE_ELECTRIFY`.
*/
/datum/wires/proc/pulse(wire)
if(is_cut(wire))
return
on_pulse(wire)
/datum/wires/proc/GetAttached(var/colour) /**
if(signallers[colour]) * Pulses the wire associated with the given color.
return signallers[colour] *
* Arugments:
* * wire - a wire color.
*/
/datum/wires/proc/pulse_color(color)
pulse(get_wire(color))
/**
* Proc called when any wire is pulsed.
*
* Base proc, intended to be overriden.
* Place behavior you want to happen when certain wires are pulsed, into this proc.
*
* Arugments:
* * wire - a wire define, NOT color. For example 'WIRE_ELECTRIFY'.
*/
/datum/wires/proc/on_pulse(wire)
return
/**
* Proc called when an attached signaler receives a signal.
*
* Searches through the `assemblies` list for the wire that the signaler is attached to. Pulses the wire when it's found.
*
* Arugments:
* * S - the attached signaler receiving the signal.
*/
/datum/wires/proc/pulse_assembly(obj/item/device/assembly/signaler/S)
for(var/color in assemblies)
if(S == assemblies[color])
pulse_color(color)
return TRUE
/**
* Proc called when a mob tries to attach a signaler to a wire.
*
* Makes sure that `S` is actually a signaler and that something is not already attached to the wire.
* Adds the signaler to the `assemblies` list as a value, with the `color` as a the key.
*
* Arguments:
* * color - the wire color.
* * S - the signaler that a mob is trying to attach.
*/
/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
/**
* Proc called when a mob tries to detach a signaler from a wire.
*
* First checks if there is a signaler on the wire. If so, removes the signaler, and clears it from `assemblies` list.
*
* Arguments:
* * color - the wire color.
*/
/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.drop_location())
return S
/**
* Gets the signaler attached to the given wire color, if there is one.
*
* Arguments:
* * color - the wire color.
*/
/datum/wires/proc/get_attached(color)
if(assemblies[color])
return assemblies[color]
return null return null
/datum/wires/proc/Attach(var/colour, var/obj/item/device/assembly/signaler/S) /**
if(colour && S) * Checks if the given wire has a signaler on it.
if(!IsAttached(colour)) *
signallers[colour] = S * Arguments:
S.loc = holder * * color - the wire color.
S.connected = src */
return S /datum/wires/proc/is_attached(color)
if(assemblies[color])
/datum/wires/proc/Detach(var/colour) return TRUE
if(colour)
var/obj/item/device/assembly/signaler/S = GetAttached(colour)
if(S)
signallers -= colour
S.connected = null
S.loc = holder.loc
return S
/datum/wires/proc/Pulse(var/obj/item/device/assembly/signaler/S)
for(var/colour in signallers)
if(S == signallers[colour])
PulseColour(colour)
break
//
// Cut Wire Colour/Index procs
//
/datum/wires/proc/CutWireColour(var/colour)
var/index = GetIndex(colour)
CutWireIndex(index)
/datum/wires/proc/CutWireIndex(var/index)
if(IsIndexCut(index))
wires_status &= ~index
UpdateCut(index, 1)
else
wires_status |= index
UpdateCut(index, 0)
/datum/wires/proc/RandomCut()
var/r = rand(1, wires.len)
CutWireIndex(r)
/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)
/datum/wires/proc/CutAll()
for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i)
CutWireIndex(i)
/datum/wires/proc/IsAllCut()
if(wires_status == (1 << wire_count) - 1)
return 1
return 0
/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()

View File

@@ -773,7 +773,7 @@
to_chat(user, "It does nothing.") to_chat(user, "It does nothing.")
return return
else else
if(allowed(usr) && !wires.IsIndexCut(AALARM_WIRE_IDSCAN)) if(allowed(usr) && !wires.is_cut(WIRE_IDSCAN))
locked = !locked locked = !locked
to_chat(user, "<span class='notice'>You [locked ? "lock" : "unlock"] the Air Alarm interface.</span>") to_chat(user, "<span class='notice'>You [locked ? "lock" : "unlock"] the Air Alarm interface.</span>")
else else

View File

@@ -42,24 +42,6 @@
var/list/camera_computers_using_this = list() var/list/camera_computers_using_this = list()
/obj/machinery/camera/apply_visual(mob/living/carbon/human/M)
if(!M.client)
return
M.overlay_fullscreen("fishbed",/obj/screen/fullscreen/fishbed)
M.overlay_fullscreen("scanlines",/obj/screen/fullscreen/scanline)
M.overlay_fullscreen("whitenoise",/obj/screen/fullscreen/noise)
M.machine_visual = src
return 1
/obj/machinery/camera/remove_visual(mob/living/carbon/human/M)
if(!M.client)
return
M.clear_fullscreen("fishbed",0)
M.clear_fullscreen("scanlines")
M.clear_fullscreen("whitenoise")
M.machine_visual = null
return 1
/obj/machinery/camera/New() /obj/machinery/camera/New()
wires = new(src) wires = new(src)
assembly = new(src) assembly = new(src)
@@ -292,7 +274,7 @@
//Used when someone breaks a camera //Used when someone breaks a camera
/obj/machinery/camera/proc/destroy() /obj/machinery/camera/proc/destroy()
stat |= BROKEN stat |= BROKEN
wires.RandomCutAll() wires.cut_all()
triggerCameraAlarm() triggerCameraAlarm()
update_icon() update_icon()
@@ -327,7 +309,7 @@
camera_alarm.triggerAlarm(loc, src, duration) camera_alarm.triggerAlarm(loc, src, duration)
/obj/machinery/camera/proc/cancelCameraAlarm() /obj/machinery/camera/proc/cancelCameraAlarm()
if(wires.IsIndexCut(CAMERA_WIRE_ALARM)) if(wires.is_cut(WIRE_CAM_ALARM))
return return
alarm_on = 0 alarm_on = 0
@@ -494,7 +476,6 @@
return return
if (stat & BROKEN) // Fix the camera if (stat & BROKEN) // Fix the camera
stat &= ~BROKEN stat &= ~BROKEN
wires.CutAll() wires.repair()
wires.MendAll()
update_icon() update_icon()
update_coverage() update_coverage()

View File

@@ -543,10 +543,6 @@ About the new airlock wires panel:
return 1 return 1
return 0 return 0
/obj/machinery/door/airlock/proc/isWireCut(var/wireIndex)
// You can find the wires in the datum folder.
return wires.IsIndexCut(wireIndex)
/obj/machinery/door/airlock/proc/canAIControl() /obj/machinery/door/airlock/proc/canAIControl()
return ((src.aiControlDisabled!=1) && (!src.isAllPowerLoss())); return ((src.aiControlDisabled!=1) && (!src.isAllPowerLoss()));
@@ -559,7 +555,7 @@ About the new airlock wires panel:
return (src.main_power_lost_until==0 || src.backup_power_lost_until==0) return (src.main_power_lost_until==0 || src.backup_power_lost_until==0)
/obj/machinery/door/airlock/requiresID() /obj/machinery/door/airlock/requiresID()
return !(src.isWireCut(AIRLOCK_WIRE_IDSCAN) || aiDisabledIdScanner) return !(wires.is_cut(WIRE_IDSCAN) || aiDisabledIdScanner)
/obj/machinery/door/airlock/proc/isAllPowerLoss() /obj/machinery/door/airlock/proc/isAllPowerLoss()
if(stat & (NOPOWER|BROKEN)) if(stat & (NOPOWER|BROKEN))
@@ -569,10 +565,10 @@ About the new airlock wires panel:
return 0 return 0
/obj/machinery/door/airlock/proc/mainPowerCablesCut() /obj/machinery/door/airlock/proc/mainPowerCablesCut()
return src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1) || src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2) return wires.is_cut(WIRE_MAIN_POWER1) || wires.is_cut(WIRE_MAIN_POWER2)
/obj/machinery/door/airlock/proc/backupPowerCablesCut() /obj/machinery/door/airlock/proc/backupPowerCablesCut()
return src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1) || src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2) return wires.is_cut(WIRE_BACKUP_POWER1) || wires.is_cut(WIRE_BACKUP_POWER2)
/obj/machinery/door/airlock/proc/loseMainPower() /obj/machinery/door/airlock/proc/loseMainPower()
main_power_lost_until = mainPowerCablesCut() ? -1 : world.time + SecondsToTicks(60) main_power_lost_until = mainPowerCablesCut() ? -1 : world.time + SecondsToTicks(60)
@@ -620,7 +616,7 @@ About the new airlock wires panel:
/obj/machinery/door/airlock/proc/electrify(var/duration, var/feedback = 0) /obj/machinery/door/airlock/proc/electrify(var/duration, var/feedback = 0)
var/message = "" var/message = ""
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY) && arePowerSystemsOn()) if(wires.is_cut(WIRE_ELECTRIFY) && arePowerSystemsOn())
message = text("The electrification wire is cut - Door permanently electrified.") message = text("The electrification wire is cut - Door permanently electrified.")
src.electrified_until = -1 src.electrified_until = -1
else if(duration && !arePowerSystemsOn()) else if(duration && !arePowerSystemsOn())
@@ -646,7 +642,7 @@ About the new airlock wires panel:
/obj/machinery/door/airlock/proc/set_idscan(var/activate, var/feedback = 0) /obj/machinery/door/airlock/proc/set_idscan(var/activate, var/feedback = 0)
var/message = "" var/message = ""
if(src.isWireCut(AIRLOCK_WIRE_IDSCAN)) if(wires.is_cut(WIRE_IDSCAN))
message = "The IdScan wire is cut - IdScan feature permanently disabled." message = "The IdScan wire is cut - IdScan feature permanently disabled."
else if(activate && src.aiDisabledIdScanner) else if(activate && src.aiDisabledIdScanner)
src.aiDisabledIdScanner = 0 src.aiDisabledIdScanner = 0
@@ -661,7 +657,7 @@ About the new airlock wires panel:
/obj/machinery/door/airlock/proc/set_safeties(var/activate, var/feedback = 0) /obj/machinery/door/airlock/proc/set_safeties(var/activate, var/feedback = 0)
var/message = "" var/message = ""
// Safeties! We don't need no stinking safeties! // Safeties! We don't need no stinking safeties!
if (src.isWireCut(AIRLOCK_WIRE_SAFETY)) if (wires.is_cut(WIRE_SAFETY))
message = text("The safety wire is cut - Cannot enable safeties.") message = text("The safety wire is cut - Cannot enable safeties.")
else if (!activate && src.safe) else if (!activate && src.safe)
safe = 0 safe = 0
@@ -879,7 +875,7 @@ About the new airlock wires panel:
if(!backup_power_lost_until) if(!backup_power_lost_until)
src.loseBackupPower() src.loseBackupPower()
if("bolts") if("bolts")
if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) if(wires.is_cut(WIRE_DOOR_BOLTS))
to_chat(usr, "The door bolt control wire is cut - Door bolts permanently dropped.") to_chat(usr, "The door bolt control wire is cut - Door bolts permanently dropped.")
else if(activate && src.lock()) else if(activate && src.lock())
to_chat(usr, "The door bolts have been dropped.") to_chat(usr, "The door bolts have been dropped.")
@@ -902,7 +898,7 @@ About the new airlock wires panel:
set_safeties(!activate, 1) set_safeties(!activate, 1)
if("timing") if("timing")
// Door speed control // Door speed control
if(src.isWireCut(AIRLOCK_WIRE_SPEED)) if(wires.is_cut(WIRE_SPEED))
to_chat(usr, "The timing wire is cut - Cannot alter timing.") to_chat(usr, "The timing wire is cut - Cannot alter timing.")
else if (activate && src.normalspeed) else if (activate && src.normalspeed)
normalspeed = 0 normalspeed = 0
@@ -910,7 +906,7 @@ About the new airlock wires panel:
normalspeed = 1 normalspeed = 1
if("lights") if("lights")
// Bolt lights // Bolt lights
if(src.isWireCut(AIRLOCK_WIRE_LIGHT)) if(wires.is_cut(WIRE_BOLT_LIGHT))
to_chat(usr, "The bolt lights wire is cut - The door bolt lights are permanently disabled.") to_chat(usr, "The bolt lights wire is cut - The door bolt lights are permanently disabled.")
else if (!activate && src.lights) else if (!activate && src.lights)
lights = 0 lights = 0
@@ -1076,7 +1072,7 @@ About the new airlock wires panel:
/obj/machinery/door/airlock/can_open(var/forced=0) /obj/machinery/door/airlock/can_open(var/forced=0)
if(!forced) if(!forced)
if(!arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_OPEN_DOOR)) if(!arePowerSystemsOn() || wires.is_cut(WIRE_OPEN_DOOR))
return 0 return 0
if(locked || welded) if(locked || welded)
@@ -1089,7 +1085,7 @@ About the new airlock wires panel:
if(!forced) if(!forced)
//despite the name, this wire is for general door control. //despite the name, this wire is for general door control.
if(!arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_OPEN_DOOR)) if(!arePowerSystemsOn() || wires.is_cut(WIRE_OPEN_DOOR))
return 0 return 0
return ..() return ..()
@@ -1190,7 +1186,7 @@ About the new airlock wires panel:
return return
if (!forced) if (!forced)
if(operating || !src.arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) return if(operating || !src.arePowerSystemsOn() || wires.is_cut(WIRE_DOOR_BOLTS)) return
src.locked = 0 src.locked = 0
playsound(src, bolt_up_sound, 30, 0, 3) playsound(src, bolt_up_sound, 30, 0, 3)

View File

@@ -155,8 +155,8 @@ var/global/list/default_medbay_channels = list(
data["freq"] = format_frequency(frequency) data["freq"] = format_frequency(frequency)
data["rawfreq"] = num2text(frequency) data["rawfreq"] = num2text(frequency)
data["mic_cut"] = (wires.IsIndexCut(WIRE_TRANSMIT) || wires.IsIndexCut(WIRE_SIGNAL)) data["mic_cut"] = (wires.is_cut(WIRE_RADIO_TRANSMIT) || wires.is_cut(WIRE_RADIO_SIGNAL))
data["spk_cut"] = (wires.IsIndexCut(WIRE_RECEIVE) || wires.IsIndexCut(WIRE_SIGNAL)) data["spk_cut"] = (wires.is_cut(WIRE_RADIO_RECEIVER) || wires.is_cut(WIRE_RADIO_SIGNAL))
var/list/chanlist = list_channels(user) var/list/chanlist = list_channels(user)
if(islist(chanlist) && chanlist.len) if(islist(chanlist) && chanlist.len)
@@ -215,12 +215,6 @@ var/global/list/default_medbay_channels = list(
/mob/observer/dead/has_internal_radio_channel_access(var/list/req_one_accesses) /mob/observer/dead/has_internal_radio_channel_access(var/list/req_one_accesses)
return can_admin_interact() return can_admin_interact()
/obj/item/device/radio/proc/text_wires()
if (b_stat)
return wires.GetInteractWindow()
return
/obj/item/device/radio/proc/text_sec_channel(var/chan_name, var/chan_stat) /obj/item/device/radio/proc/text_sec_channel(var/chan_name, var/chan_stat)
var/list = !!(chan_stat&FREQ_LISTENING)!=0 var/list = !!(chan_stat&FREQ_LISTENING)!=0
return {" return {"
@@ -229,10 +223,10 @@ var/global/list/default_medbay_channels = list(
"} "}
/obj/item/device/radio/proc/ToggleBroadcast() /obj/item/device/radio/proc/ToggleBroadcast()
broadcasting = !broadcasting && !(wires.IsIndexCut(WIRE_TRANSMIT) || wires.IsIndexCut(WIRE_SIGNAL)) broadcasting = !broadcasting && !(wires.is_cut(WIRE_RADIO_TRANSMIT) || wires.is_cut(WIRE_RADIO_SIGNAL))
/obj/item/device/radio/proc/ToggleReception() /obj/item/device/radio/proc/ToggleReception()
listening = !listening && !(wires.IsIndexCut(WIRE_RECEIVE) || wires.IsIndexCut(WIRE_SIGNAL)) listening = !listening && !(wires.is_cut(WIRE_RADIO_RECEIVER) || wires.is_cut(WIRE_RADIO_SIGNAL))
/obj/item/device/radio/CanUseTopic() /obj/item/device/radio/CanUseTopic()
if(!on) if(!on)
@@ -337,7 +331,7 @@ GLOBAL_DATUM(autospeaker, /mob/living/silicon/ai/announcer)
// Uncommenting this. To the above comment: // Uncommenting this. To the above comment:
// The permacell radios aren't suppose to be able to transmit, this isn't a bug and this "fix" is just making radio wires useless. -Giacom // The permacell radios aren't suppose to be able to transmit, this isn't a bug and this "fix" is just making radio wires useless. -Giacom
if(wires.IsIndexCut(WIRE_TRANSMIT)) // The device has to have all its wires and shit intact if(wires.is_cut(WIRE_RADIO_TRANSMIT)) // The device has to have all its wires and shit intact
return FALSE return FALSE
if(!radio_connection) if(!radio_connection)
@@ -541,7 +535,7 @@ GLOBAL_DATUM(autospeaker, /mob/living/silicon/ai/announcer)
// check if this radio can receive on the given frequency, and if so, // check if this radio can receive on the given frequency, and if so,
// what the range is in which mobs will hear the radio // what the range is in which mobs will hear the radio
// returns: -1 if can't receive, range otherwise // returns: -1 if can't receive, range otherwise
if(wires.IsIndexCut(WIRE_RECEIVE)) if(wires.is_cut(WIRE_RADIO_RECEIVER))
return -1 return -1
if(!listening) if(!listening)
return -1 return -1

View File

@@ -128,7 +128,7 @@
//Only care about megabroadcasts or things that are targeted at us //Only care about megabroadcasts or things that are targeted at us
if(!(0 in level)) if(!(0 in level))
return -1 return -1
if(wires.IsIndexCut(WIRE_RECEIVE)) if(wires.is_cut(WIRE_RADIO_RECEIVER))
return -1 return -1
if(!listening) if(!listening)
return -1 return -1

View File

@@ -109,8 +109,8 @@ Code:
/obj/item/device/assembly/signaler/pulse(var/radio = 0) /obj/item/device/assembly/signaler/pulse(var/radio = 0)
if(is_jammed(src)) if(is_jammed(src))
return FALSE return FALSE
if(src.connected && src.wires) if(connected && wires)
connected.Pulse(src) connected.pulse_assembly(src)
else if(holder) else if(holder)
holder.process_activation(src, 1, 0) holder.process_activation(src, 1, 0)
else else

View File

@@ -1,13 +1,11 @@
/datum/wires/rig /datum/wires/rig
random = 1 randomize = TRUE
holder_type = /obj/item/weapon/rig holder_type = /obj/item/weapon/rig
wire_count = 5 wire_count = 5
#define RIG_SECURITY 1 /datum/wires/rig/New(atom/_holder)
#define RIG_AI_OVERRIDE 2 wires = list(WIRE_RIG_SECURITY, WIRE_RIG_AI_OVERRIDE, WIRE_RIG_SYSTEM_CONTROL, WIRE_RIG_INTERFACE_LOCK, WIRE_RIG_INTERFACE_SHOCK)
#define RIG_SYSTEM_CONTROL 4 return ..()
#define RIG_INTERFACE_LOCK 8
#define RIG_INTERFACE_SHOCK 16
/* /*
* Rig security can be snipped to disable ID access checks on rig. * Rig security can be snipped to disable ID access checks on rig.
* Rig AI override can be pulsed to toggle whether or not the AI can take control of the suit. * Rig AI override can be pulsed to toggle whether or not the AI can take control of the suit.
@@ -15,43 +13,41 @@
* Interface lock can be pulsed to toggle whether or not the interface can be accessed. * Interface lock can be pulsed to toggle whether or not the interface can be accessed.
*/ */
/datum/wires/rig/UpdateCut(var/index, var/mended) /datum/wires/rig/on_cut(wire, mend)
var/obj/item/weapon/rig/rig = holder var/obj/item/weapon/rig/rig = holder
switch(index) switch(wire)
if(RIG_SECURITY) if(WIRE_RIG_SECURITY)
if(mended) if(mend)
rig.req_access = initial(rig.req_access) rig.req_access = initial(rig.req_access)
rig.req_one_access = initial(rig.req_one_access) rig.req_one_access = initial(rig.req_one_access)
if(RIG_INTERFACE_SHOCK) if(WIRE_RIG_INTERFACE_SHOCK)
rig.electrified = mended ? 0 : -1 rig.electrified = mend ? 0 : -1
rig.shock(usr,100) rig.shock(usr,100)
/datum/wires/rig/UpdatePulsed(var/index) /datum/wires/rig/on_pulse(wire)
var/obj/item/weapon/rig/rig = holder var/obj/item/weapon/rig/rig = holder
switch(index) switch(wire)
if(RIG_SECURITY) if(WIRE_RIG_SECURITY)
rig.security_check_enabled = !rig.security_check_enabled rig.security_check_enabled = !rig.security_check_enabled
rig.visible_message("\The [rig] twitches as several suit locks [rig.security_check_enabled?"close":"open"].") rig.visible_message("\The [rig] twitches as several suit locks [rig.security_check_enabled?"close":"open"].")
if(RIG_AI_OVERRIDE) if(WIRE_RIG_AI_OVERRIDE)
rig.ai_override_enabled = !rig.ai_override_enabled rig.ai_override_enabled = !rig.ai_override_enabled
rig.visible_message("A small red light on [rig] [rig.ai_override_enabled?"goes dead":"flickers on"].") rig.visible_message("A small red light on [rig] [rig.ai_override_enabled?"goes dead":"flickers on"].")
if(RIG_SYSTEM_CONTROL) if(WIRE_RIG_SYSTEM_CONTROL)
rig.malfunctioning += 10 rig.malfunctioning += 10
if(rig.malfunction_delay <= 0) if(rig.malfunction_delay <= 0)
rig.malfunction_delay = 20 rig.malfunction_delay = 20
rig.shock(usr,100) rig.shock(usr,100)
if(RIG_INTERFACE_LOCK) if(WIRE_RIG_INTERFACE_LOCK)
rig.interface_locked = !rig.interface_locked rig.interface_locked = !rig.interface_locked
rig.visible_message("\The [rig] clicks audibly as the software interface [rig.interface_locked?"darkens":"brightens"].") rig.visible_message("\The [rig] clicks audibly as the software interface [rig.interface_locked?"darkens":"brightens"].")
if(RIG_INTERFACE_SHOCK) if(WIRE_RIG_INTERFACE_SHOCK)
if(rig.electrified != -1) if(rig.electrified != -1)
rig.electrified = 30 rig.electrified = 30
rig.shock(usr,100) rig.shock(usr,100)
/datum/wires/rig/CanUse(var/mob/living/L) /datum/wires/rig/interactable(mob/user)
var/obj/item/weapon/rig/rig = holder var/obj/item/weapon/rig/rig = holder
if(rig.open) if(rig.open)
return 1 return TRUE
return 0 return FALSE

View File

@@ -17,9 +17,9 @@
if(prob(2*severity)) if(prob(2*severity))
cam.destroy() cam.destroy()
else else
cam.wires.UpdateCut(CAMERA_WIRE_POWER, 0) cam.wires.cut(WIRE_MAIN_POWER1)
if(prob(5*severity)) if(prob(5*severity))
cam.wires.UpdateCut(CAMERA_WIRE_ALARM, 0) cam.wires.cut(WIRE_CAM_ALARM)
/datum/event/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5) /datum/event/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5)
if(!cameranet.cameras.len) if(!cameranet.cameras.len)

View File

@@ -19,9 +19,9 @@
for(var/obj/machinery/camera/cam in range(camera_range, C)) for(var/obj/machinery/camera/cam in range(camera_range, C))
if(is_valid_camera(cam)) if(is_valid_camera(cam))
cam.wires.UpdateCut(CAMERA_WIRE_POWER, 0) cam.wires.cut(WIRE_MAIN_POWER1)
if(prob(25)) if(prob(25))
cam.wires.UpdateCut(CAMERA_WIRE_ALARM, 0) cam.wires.cut(WIRE_CAM_ALARM)
/datum/event2/event/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5) /datum/event2/event/camera_damage/proc/acquire_random_camera(var/remaining_attempts = 5)
if(!cameranet.cameras.len) if(!cameranet.cameras.len)

View File

@@ -20,6 +20,7 @@
var/light_intensity = null // Ditto. Not implemented yet. var/light_intensity = null // Ditto. Not implemented yet.
var/mob_overlay_state = null // Icon_state for an overlay to apply to a (human) mob while this exists. This is actually implemented. var/mob_overlay_state = null // Icon_state for an overlay to apply to a (human) mob while this exists. This is actually implemented.
var/client_color = null // If set, the client will have the world be shown in this color, from their perspective. var/client_color = null // If set, the client will have the world be shown in this color, from their perspective.
var/wire_colors_replace = null // If set, the client will have wires replaced by the given replacement list. For colorblindness.
// Now for all the different effects. // Now for all the different effects.
// Percentage modifiers are expressed as a multipler. (e.g. +25% damage should be written as 1.25) // Percentage modifiers are expressed as a multipler. (e.g. +25% damage should be written as 1.25)

View File

@@ -127,33 +127,39 @@
desc = "You have a form of red-green colorblindness. You cannot see reds, and have trouble distinguishing them from yellows and greens." desc = "You have a form of red-green colorblindness. You cannot see reds, and have trouble distinguishing them from yellows and greens."
client_color = MATRIX_Protanopia client_color = MATRIX_Protanopia
wire_colors_replace = PROTANOPIA_COLOR_REPLACE
/datum/modifier/trait/colorblind_deuteranopia /datum/modifier/trait/colorblind_deuteranopia
name = "Deuteranopia" name = "Deuteranopia"
desc = "You have a form of red-green colorblindness. You cannot see greens, and have trouble distinguishing them from yellows and reds." desc = "You have a form of red-green colorblindness. You cannot see greens, and have trouble distinguishing them from yellows and reds."
client_color = MATRIX_Deuteranopia client_color = MATRIX_Deuteranopia
wire_colors_replace = DEUTERANOPIA_COLOR_REPLACE
/datum/modifier/trait/colorblind_tritanopia /datum/modifier/trait/colorblind_tritanopia
name = "Tritanopia" name = "Tritanopia"
desc = "You have a form of blue-yellow colorblindness. You have trouble distinguishing between blues, greens, and yellows, and see blues and violets as dim." desc = "You have a form of blue-yellow colorblindness. You have trouble distinguishing between blues, greens, and yellows, and see blues and violets as dim."
client_color = MATRIX_Tritanopia client_color = MATRIX_Tritanopia
wire_colors_replace = TRITANOPIA_COLOR_REPLACE
/datum/modifier/trait/colorblind_taj /datum/modifier/trait/colorblind_taj
name = "Colorblind - Blue-red" name = "Colorblind - Blue-red"
desc = "You are colorblind. You have a minor issue with blue colors and have difficulty recognizing them from red colors." desc = "You are colorblind. You have a minor issue with blue colors and have difficulty recognizing them from red colors."
client_color = MATRIX_Taj_Colorblind client_color = MATRIX_Taj_Colorblind
wire_colors_replace = TRITANOPIA_COLOR_REPLACE
/datum/modifier/trait/colorblind_vulp /datum/modifier/trait/colorblind_vulp
name = "Colorblind - Red-green" name = "Colorblind - Red-green"
desc = "You are colorblind. You have a severe issue with green colors and have difficulty recognizing them from red colors." desc = "You are colorblind. You have a severe issue with green colors and have difficulty recognizing them from red colors."
client_color = MATRIX_Vulp_Colorblind client_color = MATRIX_Vulp_Colorblind
wire_colors_replace = PROTANOPIA_COLOR_REPLACE
/datum/modifier/trait/colorblind_monochrome /datum/modifier/trait/colorblind_monochrome
name = "Monochromacy" name = "Monochromacy"
desc = "You are fully colorblind. Your condition is rare, but you can see no colors at all." desc = "You are fully colorblind. Your condition is rare, but you can see no colors at all."
client_color = MATRIX_Monochromia client_color = MATRIX_Monochromia
wire_colors_replace = GREYSCALE_COLOR_REPLACE

View File

@@ -192,9 +192,9 @@ var/list/slot_equipment_priority = list( \
//This differs from remove_from_mob() in that it checks if the item can be unequipped first. //This differs from remove_from_mob() in that it checks if the item can be unequipped first.
/mob/proc/unEquip(obj/item/I, force = 0, var/atom/target) //Force overrides NODROP for things like wizarditis and admin undress. /mob/proc/unEquip(obj/item/I, force = 0, var/atom/target) //Force overrides NODROP for things like wizarditis and admin undress.
if(!(force || canUnEquip(I))) if(!(force || canUnEquip(I)))
return return FALSE
drop_from_inventory(I, target) drop_from_inventory(I, target)
return 1 return TRUE
//Attemps to remove an object on a mob. //Attemps to remove an object on a mob.

View File

@@ -69,7 +69,7 @@
/mob/living/silicon/robot/handle_regular_status_updates() /mob/living/silicon/robot/handle_regular_status_updates()
if(src.camera && !scrambledcodes) if(src.camera && !scrambledcodes)
if(src.stat == 2 || wires.IsIndexCut(BORG_WIRE_CAMERA)) if(src.stat == 2 || wires.is_cut(WIRE_BORG_CAMERA))
src.camera.set_status(0) src.camera.set_status(0)
else else
src.camera.set_status(1) src.camera.set_status(1)

View File

@@ -124,7 +124,7 @@
camera = new /obj/machinery/camera(src) camera = new /obj/machinery/camera(src)
camera.c_tag = real_name camera.c_tag = real_name
camera.replace_networks(list(NETWORK_DEFAULT,NETWORK_ROBOTS)) camera.replace_networks(list(NETWORK_DEFAULT,NETWORK_ROBOTS))
if(wires.IsIndexCut(BORG_WIRE_CAMERA)) if(wires.is_cut(WIRE_BORG_CAMERA))
camera.status = 0 camera.status = 0
init() init()
@@ -536,7 +536,7 @@
to_chat(user, "You close the cover.") to_chat(user, "You close the cover.")
opened = 0 opened = 0
updateicon() updateicon()
else if(wiresexposed && wires.IsAllCut()) else if(wiresexposed && wires.is_all_cut())
//Cell is out, wires are exposed, remove MMI, produce damaged chassis, baleet original mob. //Cell is out, wires are exposed, remove MMI, produce damaged chassis, baleet original mob.
if(!mmi) if(!mmi)
to_chat(user, "\The [src] has no brain to remove.") to_chat(user, "\The [src] has no brain to remove.")
@@ -932,7 +932,7 @@
/mob/living/silicon/robot/proc/SetLockdown(var/state = 1) /mob/living/silicon/robot/proc/SetLockdown(var/state = 1)
// They stay locked down if their wire is cut. // They stay locked down if their wire is cut.
if(wires.LockedCut()) if(wires.is_cut(WIRE_BORG_LOCKED))
state = 1 state = 1
if(state) if(state)
throw_alert("locked", /obj/screen/alert/locked) throw_alert("locked", /obj/screen/alert/locked)

View File

@@ -227,11 +227,9 @@
/datum/wires/vending/no_contraband /datum/wires/vending/no_contraband
/datum/wires/vending/no_contraband/UpdatePulsed(index) //Can't hack for contraband, need emag. /datum/wires/vending/no_contraband/on_pulse(index) //Can't hack for contraband, need emag.
if(index != VENDING_WIRE_CONTRABAND) if(index != WIRE_CONTRABAND)
..(index) ..(index)
else
return
/obj/machinery/vending/nifsoft_shop/emag_act(remaining_charges, mob/user) //Yeees, YEEES! Give me that black market tech. /obj/machinery/vending/nifsoft_shop/emag_act(remaining_charges, mob/user) //Yeees, YEEES! Give me that black market tech.
if(!emagged || !(categories & CAT_HIDDEN)) if(!emagged || !(categories & CAT_HIDDEN))

View File

@@ -698,7 +698,7 @@ GLOBAL_LIST_EMPTY(apcs)
else if(hacker) else if(hacker)
to_chat(user, "<span class='warning'>Access denied.</span>") to_chat(user, "<span class='warning'>Access denied.</span>")
else else
if(src.allowed(usr) && !isWireCut(APC_WIRE_IDSCAN)) if(src.allowed(usr) && !wires.is_cut(WIRE_IDSCAN))
locked = !locked locked = !locked
to_chat(user, "You [ locked ? "lock" : "unlock"] the APC interface.") to_chat(user, "You [ locked ? "lock" : "unlock"] the APC interface.")
update_icon() update_icon()
@@ -727,9 +727,9 @@ GLOBAL_LIST_EMPTY(apcs)
return 1 return 1
/obj/machinery/power/apc/blob_act() /obj/machinery/power/apc/blob_act()
if(!wires.IsAllCut()) if(!wires.is_all_cut())
wiresexposed = TRUE wiresexposed = TRUE
wires.CutAll() wires.cut_all()
update_icon() update_icon()
/obj/machinery/power/apc/attack_hand(mob/user) /obj/machinery/power/apc/attack_hand(mob/user)
@@ -748,7 +748,7 @@ GLOBAL_LIST_EMPTY(apcs)
user.visible_message("<span call='warning'>[user.name] slashes at the [src.name]!</span>", "<span class='notice'>You slash at the [src.name]!</span>") user.visible_message("<span call='warning'>[user.name] slashes at the [src.name]!</span>", "<span class='notice'>You slash at the [src.name]!</span>")
playsound(src, 'sound/weapons/slash.ogg', 100, 1) playsound(src, 'sound/weapons/slash.ogg', 100, 1)
var/allcut = wires.IsAllCut() var/allcut = wires.is_all_cut()
if(beenhit >= pick(3, 4) && wiresexposed != 1) if(beenhit >= pick(3, 4) && wiresexposed != 1)
wiresexposed = 1 wiresexposed = 1
@@ -756,7 +756,7 @@ GLOBAL_LIST_EMPTY(apcs)
src.visible_message("<span call='warning'>The [src.name]'s cover flies open, exposing the wires!</span>") src.visible_message("<span call='warning'>The [src.name]'s cover flies open, exposing the wires!</span>")
else if(wiresexposed == 1 && allcut == 0) else if(wiresexposed == 1 && allcut == 0)
wires.CutAll() wires.cut_all()
src.update_icon() src.update_icon()
src.visible_message("<span call='warning'>The [src.name]'s wires are shredded!</span>") src.visible_message("<span call='warning'>The [src.name]'s wires are shredded!</span>")
else else
@@ -879,10 +879,6 @@ GLOBAL_LIST_EMPTY(apcs)
// to_world("[area.power_equip]") // to_world("[area.power_equip]")
area.power_change() area.power_change()
/obj/machinery/power/apc/proc/isWireCut(var/wireIndex)
return wires.IsIndexCut(wireIndex)
/obj/machinery/power/apc/proc/can_use(mob/user as mob, var/loud = 0) //used by attack_hand() and Topic() /obj/machinery/power/apc/proc/can_use(mob/user as mob, var/loud = 0) //used by attack_hand() and Topic()
if(!user.client) if(!user.client)
return 0 return 0

View File

@@ -91,17 +91,17 @@
return return
if(href_list["togglep"]) if(href_list["togglep"])
if(!wires.IsIndexCut(PARTICLE_TOGGLE_WIRE)) if(!wires.is_cut(WIRE_PARTICLE_POWER))
toggle_power() toggle_power()
else if(href_list["scan"]) else if(href_list["scan"])
part_scan() part_scan()
else if(href_list["strengthup"]) else if(href_list["strengthup"])
if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE)) if(!wires.is_cut(WIRE_PARTICLE_STRENGTH))
add_strength() add_strength()
else if(href_list["strengthdown"]) else if(href_list["strengthdown"])
if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE)) if(!wires.is_cut(WIRE_PARTICLE_STRENGTH))
remove_strength() remove_strength()
updateDialog() updateDialog()

View File

@@ -0,0 +1,72 @@
import { Fragment } from 'inferno';
import { useBackend } from '../backend';
import { Box, Button, LabeledList, Section } from '../components';
import { Window } from '../layouts';
export const Wires = (props, context) => {
const { act, data } = useBackend(context);
const wires = data.wires || [];
const statuses = data.status || [];
return (
<Window
width={350}
height={150 + wires.length * 30}
resizable>
<Window.Content>
<Section>
<LabeledList>
{wires.map(wire => (
<LabeledList.Item
key={wire.seen_color}
className="candystripe"
label={wire.color_name}
labelColor={wire.seen_color}
color={wire.seen_color}
buttons={(
<Fragment>
<Button
content={wire.cut ? 'Mend' : 'Cut'}
onClick={() => act('cut', {
wire: wire.color,
})} />
<Button
content="Pulse"
onClick={() => act('pulse', {
wire: wire.color,
})} />
<Button
content={wire.attached ? 'Detach' : 'Attach'}
onClick={() => act('attach', {
wire: wire.color,
})} />
</Fragment>
)}>
{!!wire.wire && (
<i>
({wire.wire})
</i>
)}
</LabeledList.Item>
))}
</LabeledList>
</Section>
{!!statuses.length && (
<Section>
{statuses.map(status => (
<Box
key={status}
color="lightgray"
mt={0.1}>
{status}
</Box>
))}
</Section>
)}
</Window.Content>
</Window>
);
};

File diff suppressed because one or more lines are too long

View File

@@ -88,6 +88,7 @@
#include "code\__defines\unit_tests.dm" #include "code\__defines\unit_tests.dm"
#include "code\__defines\vote.dm" #include "code\__defines\vote.dm"
#include "code\__defines\vv.dm" #include "code\__defines\vv.dm"
#include "code\__defines\wires.dm"
#include "code\__defines\xenoarcheaology.dm" #include "code\__defines\xenoarcheaology.dm"
#include "code\__defines\ZAS.dm" #include "code\__defines\ZAS.dm"
#include "code\_compatibility\509\_JSON.dm" #include "code\_compatibility\509\_JSON.dm"