/tg/ Wire Datum method pass 1: APC, Airlocks, Vending Machines\
@@ -167,6 +167,10 @@
|
||||
#include "code\datums\spells\trigger.dm"
|
||||
#include "code\datums\spells\turf_teleport.dm"
|
||||
#include "code\datums\spells\wizard.dm"
|
||||
#include "code\datums\wires\airlock.dm"
|
||||
#include "code\datums\wires\apc.dm"
|
||||
#include "code\datums\wires\vending.dm"
|
||||
#include "code\datums\wires\wires.dm"
|
||||
#include "code\defines\obj.dm"
|
||||
#include "code\defines\vox_sounds.dm"
|
||||
#include "code\defines\obj\hydro.dm"
|
||||
|
||||
@@ -75,6 +75,8 @@ datum/mind
|
||||
if(new_character.mind) //remove any mind currently in our new body's mind variable
|
||||
new_character.mind.current = null
|
||||
|
||||
nanomanager.user_transferred(current, new_character)
|
||||
|
||||
current = new_character //link ourself to our new body
|
||||
new_character.mind = src //and link our new body to ourself
|
||||
|
||||
|
||||
193
code/datums/wires/airlock.dm
Normal file
@@ -0,0 +1,193 @@
|
||||
// Wires for airlocks
|
||||
|
||||
/datum/wires/airlock/secure
|
||||
random = 1
|
||||
|
||||
/datum/wires/airlock
|
||||
holder_type = /obj/machinery/door/airlock
|
||||
wire_count = 12
|
||||
window_y = 570
|
||||
|
||||
var/const/AIRLOCK_WIRE_IDSCAN = 1
|
||||
var/const/AIRLOCK_WIRE_MAIN_POWER1 = 2
|
||||
var/const/AIRLOCK_WIRE_MAIN_POWER2 = 4
|
||||
var/const/AIRLOCK_WIRE_DOOR_BOLTS = 8
|
||||
var/const/AIRLOCK_WIRE_BACKUP_POWER1 = 16
|
||||
var/const/AIRLOCK_WIRE_BACKUP_POWER2 = 32
|
||||
var/const/AIRLOCK_WIRE_OPEN_DOOR = 64
|
||||
var/const/AIRLOCK_WIRE_AI_CONTROL = 128
|
||||
var/const/AIRLOCK_WIRE_ELECTRIFY = 256
|
||||
var/const/AIRLOCK_WIRE_SAFETY = 512
|
||||
var/const/AIRLOCK_WIRE_SPEED = 1024
|
||||
var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
|
||||
/datum/wires/airlock/CanUse(var/mob/living/L)
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
if(!istype(L, /mob/living/silicon))
|
||||
if(A.isElectrified())
|
||||
if(A.shock(L, 100))
|
||||
return 0
|
||||
if(A.p_open)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/airlock/GetInteractWindow()
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
. += ..()
|
||||
. += text("<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]", (A.locked ? "The door bolts have fallen!" : "The door bolts look up."),
|
||||
(A.lights ? "The door bolt lights are on." : "The door bolt lights are off!"),
|
||||
((A.arePowerSystemsOn() && !(A.stat & NOPOWER)) ? "The test light is on." : "The test light is off!"),
|
||||
(A.aiControlDisabled==0 ? "The 'AI control allowed' light is on." : "The 'AI control allowed' light is off."),
|
||||
(A.safe==0 ? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off."),
|
||||
(A.normalspeed==0 ? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off."))
|
||||
|
||||
|
||||
/datum/wires/airlock/UpdateCut(var/index, var/mended)
|
||||
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
switch(index)
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2)
|
||||
|
||||
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.
|
||||
A.loseMainPower()
|
||||
A.shock(usr, 50)
|
||||
else
|
||||
if((!IsIndexCut(AIRLOCK_WIRE_MAIN_POWER1)) && (!IsIndexCut(AIRLOCK_WIRE_MAIN_POWER2)))
|
||||
A.regainMainPower()
|
||||
A.shock(usr, 50)
|
||||
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2)
|
||||
|
||||
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.
|
||||
A.loseBackupPower()
|
||||
A.shock(usr, 50)
|
||||
else
|
||||
if((!IsIndexCut(AIRLOCK_WIRE_BACKUP_POWER1)) && (!IsIndexCut(AIRLOCK_WIRE_BACKUP_POWER2)))
|
||||
A.regainBackupPower()
|
||||
A.shock(usr, 50)
|
||||
|
||||
if(AIRLOCK_WIRE_DOOR_BOLTS)
|
||||
|
||||
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)
|
||||
if(A.locked!=1)
|
||||
A.locked = 1
|
||||
A.update_icon()
|
||||
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
|
||||
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.
|
||||
//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)
|
||||
A.aiControlDisabled = 1
|
||||
else if(A.aiControlDisabled == -1)
|
||||
A.aiControlDisabled = 2
|
||||
else
|
||||
if(A.aiControlDisabled == 1)
|
||||
A.aiControlDisabled = 0
|
||||
else if(A.aiControlDisabled == 2)
|
||||
A.aiControlDisabled = -1
|
||||
|
||||
if(AIRLOCK_WIRE_ELECTRIFY)
|
||||
|
||||
if(!mended)
|
||||
//Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted.
|
||||
if(A.secondsElectrified != -1)
|
||||
A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
|
||||
usr.attack_log += text("\[[time_stamp()]\] <font color='red'>Electrified the [A.name] at [A.x] [A.y] [A.z]</font>")
|
||||
A.secondsElectrified = -1
|
||||
else
|
||||
if(A.secondsElectrified == -1)
|
||||
A.secondsElectrified = 0
|
||||
return // Don't update the dialog.
|
||||
|
||||
if (AIRLOCK_WIRE_SAFETY)
|
||||
A.safe = mended
|
||||
|
||||
if(AIRLOCK_WIRE_SPEED)
|
||||
A.autoclose = mended
|
||||
if(mended)
|
||||
if(!A.density)
|
||||
A.close()
|
||||
|
||||
if(AIRLOCK_WIRE_LIGHT)
|
||||
A.lights = mended
|
||||
A.update_icon()
|
||||
|
||||
|
||||
/datum/wires/airlock/UpdatePulsed(var/index)
|
||||
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
switch(index)
|
||||
if(AIRLOCK_WIRE_IDSCAN)
|
||||
//Sending a pulse through this flashes the red light on the door (if the door has power).
|
||||
if((A.arePowerSystemsOn()) && (!(A.stat & NOPOWER)))
|
||||
A.door_animate("deny")
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1 || AIRLOCK_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).
|
||||
A.loseMainPower()
|
||||
if(AIRLOCK_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),
|
||||
//raises them if they are down (only if power's on)
|
||||
if(!A.locked)
|
||||
A.locked = 1
|
||||
for(var/mob/M in range(1, A))
|
||||
M << "You hear a click from the bottom of the door."
|
||||
else
|
||||
if(A.arePowerSystemsOn()) //only can raise bolts if power's on
|
||||
A.locked = 0
|
||||
for(var/mob/M in range(1, A))
|
||||
M << "You hear a click from the bottom of the door."
|
||||
A.update_icon()
|
||||
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER1 || AIRLOCK_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).
|
||||
A.loseBackupPower()
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
if(A.aiControlDisabled == 0)
|
||||
A.aiControlDisabled = 1
|
||||
else if(A.aiControlDisabled == -1)
|
||||
A.aiControlDisabled = 2
|
||||
|
||||
spawn(10)
|
||||
if(A)
|
||||
if(A.aiControlDisabled == 1)
|
||||
A.aiControlDisabled = 0
|
||||
else if(A.aiControlDisabled == 2)
|
||||
A.aiControlDisabled = -1
|
||||
|
||||
if(AIRLOCK_WIRE_ELECTRIFY)
|
||||
//one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds.
|
||||
if(A.secondsElectrified==0)
|
||||
A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
|
||||
usr.attack_log += text("\[[time_stamp()]\] <font color='red'>Electrified the [A.name] at [A.x] [A.y] [A.z]</font>")
|
||||
A.secondsElectrified = 30
|
||||
spawn(10)
|
||||
if(A)
|
||||
//TODO: Move this into process() and make pulsing reset secondsElectrified to 30
|
||||
while (A.secondsElectrified>0)
|
||||
A.secondsElectrified-=1
|
||||
if(A.secondsElectrified<0)
|
||||
A.secondsElectrified = 0
|
||||
sleep(10)
|
||||
return
|
||||
if(AIRLOCK_WIRE_OPEN_DOOR)
|
||||
//tries to open the door without ID
|
||||
//will succeed only if the ID wire is cut or the door requires no access
|
||||
if(!A.requiresID() || A.check_access(null))
|
||||
if(A.density) A.open()
|
||||
else A.close()
|
||||
if(AIRLOCK_WIRE_SAFETY)
|
||||
A.safe = !A.safe
|
||||
if(!A.density)
|
||||
A.close()
|
||||
|
||||
if(AIRLOCK_WIRE_SPEED)
|
||||
A.normalspeed = !A.normalspeed
|
||||
|
||||
if(AIRLOCK_WIRE_LIGHT)
|
||||
A.lights = !A.lights
|
||||
A.update_icon()
|
||||
94
code/datums/wires/alarm.dm
Normal file
@@ -0,0 +1,94 @@
|
||||
|
||||
/datum/wires/alarm
|
||||
holder_type = /obj/machinery/alarm
|
||||
wire_count = 5
|
||||
|
||||
var/const/AALARM_WIRE_IDSCAN = 1
|
||||
var/const/AALARM_WIRE_POWER = 2
|
||||
var/const/AALARM_WIRE_SYPHON = 4
|
||||
var/const/AALARM_WIRE_AI_CONTROL = 8
|
||||
var/const/AALARM_WIRE_AALARM = 16
|
||||
|
||||
|
||||
/datum/wires/alarm/CanUse(var/mob/living/L)
|
||||
var/obj/machinery/alarm/A = holder
|
||||
if(A.wiresexposed)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/alarm/GetInteractWindow()
|
||||
var/obj/machinery/alarm/A = holder
|
||||
. += ..()
|
||||
. += text("<br>\n[(A.locked ? "The Air Alarm is locked." : "The Air Alarm is unlocked.")]<br>\n[((A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!")]<br>\n[(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]")
|
||||
|
||||
/datum/wires/alarm/UpdateCut(var/index, var/mended)
|
||||
var/obj/machinery/alarm/A = holder
|
||||
switch(index)
|
||||
if(AALARM_WIRE_IDSCAN)
|
||||
if(!mended)
|
||||
A.locked = 1
|
||||
//world << "Idscan wire cut"
|
||||
|
||||
if(AALARM_WIRE_POWER)
|
||||
A.shock(usr, 50)
|
||||
A.shorted = !mended
|
||||
A.update_icon()
|
||||
//world << "Power wire cut"
|
||||
|
||||
if (AALARM_WIRE_AI_CONTROL)
|
||||
if (A.aidisabled == !mended)
|
||||
A.aidisabled = mended
|
||||
//world << "AI Control Wire Cut"
|
||||
|
||||
if(AALARM_WIRE_SYPHON)
|
||||
if(!mended)
|
||||
A.mode = 3 // AALARM_MODE_PANIC
|
||||
A.apply_mode()
|
||||
//world << "Syphon Wire Cut"
|
||||
|
||||
if(AALARM_WIRE_AALARM)
|
||||
if (A.alarm_area.atmosalert(2))
|
||||
A.post_alert(2)
|
||||
A.update_icon()
|
||||
|
||||
/datum/wires/alarm/UpdatePulsed(var/index)
|
||||
var/obj/machinery/alarm/A = holder
|
||||
switch(index)
|
||||
if(AALARM_WIRE_IDSCAN)
|
||||
A.locked = !A.locked
|
||||
// world << "Idscan wire pulsed"
|
||||
|
||||
if (AALARM_WIRE_POWER)
|
||||
// world << "Power wire pulsed"
|
||||
if(A.shorted == 0)
|
||||
A.shorted = 1
|
||||
A.update_icon()
|
||||
|
||||
spawn(12000)
|
||||
if(A.shorted == 1)
|
||||
A.shorted = 0
|
||||
A.update_icon()
|
||||
|
||||
|
||||
if (AALARM_WIRE_AI_CONTROL)
|
||||
// world << "AI Control wire pulsed"
|
||||
if (A.aidisabled == 0)
|
||||
A.aidisabled = 1
|
||||
A.updateDialog()
|
||||
spawn(100)
|
||||
if (A.aidisabled == 1)
|
||||
A.aidisabled = 0
|
||||
|
||||
if(AALARM_WIRE_SYPHON)
|
||||
// world << "Syphon wire pulsed"
|
||||
if(A.mode == 1) // AALARM_MODE_SCRUB
|
||||
A.mode = 3 // AALARM_MODE_PANIC
|
||||
else
|
||||
A.mode = 1 // AALARM_MODE_SCRUB
|
||||
A.apply_mode()
|
||||
|
||||
if(AALARM_WIRE_AALARM)
|
||||
// world << "Aalarm wire pulsed"
|
||||
if (A.alarm_area.atmosalert(0))
|
||||
A.post_alert(0)
|
||||
A.update_icon()
|
||||
77
code/datums/wires/apc.dm
Normal file
@@ -0,0 +1,77 @@
|
||||
/datum/wires/apc
|
||||
holder_type = /obj/machinery/power/apc
|
||||
wire_count = 4
|
||||
|
||||
var/const/APC_WIRE_IDSCAN = 1
|
||||
var/const/APC_WIRE_MAIN_POWER1 = 2
|
||||
var/const/APC_WIRE_MAIN_POWER2 = 4
|
||||
var/const/APC_WIRE_AI_CONTROL = 8
|
||||
|
||||
/datum/wires/apc/GetInteractWindow()
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
. += ..()
|
||||
. += text("<br>\n[(A.locked ? "The APC is locked." : "The APC is unlocked.")]<br>\n[(A.shorted ? "The APCs power has been shorted." : "The APC is working properly!")]<br>\n[(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]")
|
||||
|
||||
|
||||
/datum/wires/apc/CanUse(var/mob/living/L)
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
if(A.wiresexposed)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/apc/UpdatePulsed(var/index)
|
||||
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
|
||||
switch(index)
|
||||
|
||||
if(APC_WIRE_IDSCAN)
|
||||
A.locked = 0
|
||||
|
||||
spawn(300)
|
||||
A.locked = 1
|
||||
A.updateDialog()
|
||||
|
||||
if (APC_WIRE_MAIN_POWER1, APC_WIRE_MAIN_POWER2)
|
||||
if(A.shorted == 0)
|
||||
A.shorted = 1
|
||||
|
||||
spawn(1200)
|
||||
if(!IsIndexCut(APC_WIRE_MAIN_POWER1) && !IsIndexCut(APC_WIRE_MAIN_POWER2))
|
||||
A.shorted = 0
|
||||
A.updateDialog()
|
||||
|
||||
if (APC_WIRE_AI_CONTROL)
|
||||
if (A.aidisabled == 0)
|
||||
A.aidisabled = 1
|
||||
|
||||
spawn(10)
|
||||
if(!IsIndexCut(APC_WIRE_AI_CONTROL))
|
||||
A.aidisabled = 0
|
||||
A.updateDialog()
|
||||
|
||||
A.updateDialog()
|
||||
|
||||
/datum/wires/apc/UpdateCut(var/index, var/mended)
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
|
||||
switch(index)
|
||||
if(APC_WIRE_MAIN_POWER1, APC_WIRE_MAIN_POWER2)
|
||||
|
||||
if(!mended)
|
||||
A.shock(usr, 50)
|
||||
A.shorted = 1
|
||||
|
||||
else if(!IsIndexCut(APC_WIRE_MAIN_POWER1) && !IsIndexCut(APC_WIRE_MAIN_POWER2))
|
||||
A.shorted = 0
|
||||
A.shock(usr, 50)
|
||||
|
||||
if(APC_WIRE_AI_CONTROL)
|
||||
|
||||
if(!mended)
|
||||
if (A.aidisabled == 0)
|
||||
A.aidisabled = 1
|
||||
else
|
||||
if (A.aidisabled == 1)
|
||||
A.aidisabled = 0
|
||||
A.updateDialog()
|
||||
76
code/datums/wires/camera.dm
Normal file
@@ -0,0 +1,76 @@
|
||||
// Wires for cameras.
|
||||
|
||||
/datum/wires/camera
|
||||
random = 0
|
||||
holder_type = /obj/machinery/camera
|
||||
wire_count = 6
|
||||
|
||||
/datum/wires/camera/GetInteractWindow()
|
||||
|
||||
. = ..()
|
||||
var/obj/machinery/camera/C = holder
|
||||
. += "<br>\n[(C.view_range == initial(C.view_range) ? "The focus light is on." : "The focus light is off.")]"
|
||||
. += "<br>\n[(C.can_use() ? "The power link light is on." : "The power link light is off.")]"
|
||||
. += "<br>\n[(C.light_disabled ? "The camera light is off." : "The camera light is on.")]"
|
||||
. += "<br>\n[(C.alarm_on ? "The alarm light is on." : "The alarm light is off.")]"
|
||||
return .
|
||||
|
||||
/datum/wires/camera/CanUse(var/mob/living/L)
|
||||
var/obj/machinery/camera/C = holder
|
||||
if(!C.panel_open)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
var/const/CAMERA_WIRE_FOCUS = 1
|
||||
var/const/CAMERA_WIRE_POWER = 2
|
||||
var/const/CAMERA_WIRE_LIGHT = 4
|
||||
var/const/CAMERA_WIRE_ALARM = 8
|
||||
var/const/CAMERA_WIRE_NOTHING1 = 16
|
||||
var/const/CAMERA_WIRE_NOTHING2 = 32
|
||||
|
||||
/datum/wires/camera/UpdateCut(var/index, var/mended)
|
||||
var/obj/machinery/camera/C = holder
|
||||
|
||||
switch(index)
|
||||
if(CAMERA_WIRE_FOCUS)
|
||||
var/range = (mended ? initial(C.view_range) : C.short_range)
|
||||
C.setViewRange(range)
|
||||
|
||||
if(CAMERA_WIRE_POWER)
|
||||
if(C.status && !mended || !C.status && mended)
|
||||
C.deactivate(usr, 1)
|
||||
|
||||
if(CAMERA_WIRE_LIGHT)
|
||||
C.light_disabled = !mended
|
||||
|
||||
if(CAMERA_WIRE_ALARM)
|
||||
if(!mended)
|
||||
C.triggerCameraAlarm()
|
||||
else
|
||||
C.cancelCameraAlarm()
|
||||
return
|
||||
|
||||
/datum/wires/camera/UpdatePulsed(var/index)
|
||||
var/obj/machinery/camera/C = holder
|
||||
if(IsIndexCut(index))
|
||||
return
|
||||
switch(index)
|
||||
if(CAMERA_WIRE_FOCUS)
|
||||
var/new_range = (C.view_range == initial(C.view_range) ? C.short_range : initial(C.view_range))
|
||||
C.setViewRange(new_range)
|
||||
|
||||
if(CAMERA_WIRE_POWER)
|
||||
C.deactivate(null) // Deactivate the camera
|
||||
|
||||
if(CAMERA_WIRE_LIGHT)
|
||||
C.light_disabled = !C.light_disabled
|
||||
|
||||
if(CAMERA_WIRE_ALARM)
|
||||
C.visible_message("\icon[C] *beep*", "\icon[C] *beep*")
|
||||
return
|
||||
|
||||
/datum/wires/camera/proc/CanDeconstruct()
|
||||
if(IsIndexCut(CAMERA_WIRE_POWER) && IsIndexCut(CAMERA_WIRE_FOCUS) && IsIndexCut(CAMERA_WIRE_LIGHT) && IsIndexCut(CAMERA_WIRE_NOTHING1) && IsIndexCut(CAMERA_WIRE_NOTHING2))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
32
code/datums/wires/explosive.dm
Normal file
@@ -0,0 +1,32 @@
|
||||
/datum/wires/explosive
|
||||
wire_count = 1
|
||||
|
||||
var/const/WIRE_EXPLODE = 1
|
||||
|
||||
/datum/wires/explosive/proc/explode()
|
||||
return
|
||||
|
||||
/datum/wires/explosive/UpdatePulsed(var/index)
|
||||
switch(index)
|
||||
if(WIRE_EXPLODE)
|
||||
explode()
|
||||
|
||||
/datum/wires/explosive/UpdateCut(var/index, var/mended)
|
||||
switch(index)
|
||||
if(WIRE_EXPLODE)
|
||||
if(!mended)
|
||||
explode()
|
||||
|
||||
/datum/wires/explosive/plastic
|
||||
holder_type = /obj/item/weapon/plastique
|
||||
|
||||
/datum/wires/explosive/plastic/CanUse(var/mob/living/L)
|
||||
var/obj/item/weapon/plastique/P = holder
|
||||
if(P.open_panel)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/explosive/plastic/explode()
|
||||
var/obj/item/weapon/plastique/P = holder
|
||||
P.explode(get_turf(P))
|
||||
|
||||
65
code/datums/wires/mulebot.dm
Normal file
@@ -0,0 +1,65 @@
|
||||
/datum/wires/mulebot
|
||||
random = 1
|
||||
holder_type = /obj/machinery/bot/mulebot
|
||||
wire_count = 10
|
||||
|
||||
var/const/WIRE_POWER1 = 1 // power connections
|
||||
var/const/WIRE_POWER2 = 2
|
||||
var/const/WIRE_AVOIDANCE = 4 // mob avoidance
|
||||
var/const/WIRE_LOADCHECK = 8 // load checking (non-crate)
|
||||
var/const/WIRE_MOTOR1 = 16 // motor wires
|
||||
var/const/WIRE_MOTOR2 = 32 //
|
||||
var/const/WIRE_REMOTE_RX = 64 // remote recv functions
|
||||
var/const/WIRE_REMOTE_TX = 128 // remote trans status
|
||||
var/const/WIRE_BEACON_RX = 256 // beacon ping recv
|
||||
|
||||
/datum/wires/mulebot/CanUse(var/mob/living/L)
|
||||
var/obj/machinery/bot/mulebot/M = holder
|
||||
if(M.open)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
// So the wires do not open a new window, handle the interaction ourselves.
|
||||
/datum/wires/mulebot/Interact(var/mob/living/user)
|
||||
if(CanUse(user))
|
||||
var/obj/machinery/bot/mulebot/M = holder
|
||||
M.interact(user)
|
||||
|
||||
/datum/wires/mulebot/UpdatePulsed(var/index)
|
||||
switch(index)
|
||||
if(WIRE_POWER1, WIRE_POWER2)
|
||||
holder.visible_message("\blue \icon[holder] The charge light flickers.")
|
||||
if(WIRE_AVOIDANCE)
|
||||
holder.visible_message("\blue \icon[holder] The external warning lights flash briefly.")
|
||||
if(WIRE_LOADCHECK)
|
||||
holder.visible_message("\blue \icon[holder] The load platform clunks.")
|
||||
if(WIRE_MOTOR1, WIRE_MOTOR2)
|
||||
holder.visible_message("\blue \icon[holder] The drive motor whines briefly.")
|
||||
else
|
||||
holder.visible_message("\blue \icon[holder] You hear a radio crackle.")
|
||||
|
||||
// HELPER PROCS
|
||||
|
||||
/datum/wires/mulebot/proc/Motor1()
|
||||
return !(wires_status & WIRE_MOTOR1)
|
||||
|
||||
/datum/wires/mulebot/proc/Motor2()
|
||||
return !(wires_status & WIRE_MOTOR2)
|
||||
|
||||
/datum/wires/mulebot/proc/HasPower()
|
||||
return !(wires_status & WIRE_POWER1) && !(wires_status & WIRE_POWER2)
|
||||
|
||||
/datum/wires/mulebot/proc/LoadCheck()
|
||||
return !(wires_status & WIRE_LOADCHECK)
|
||||
|
||||
/datum/wires/mulebot/proc/MobAvoid()
|
||||
return !(wires_status & WIRE_AVOIDANCE)
|
||||
|
||||
/datum/wires/mulebot/proc/RemoteTX()
|
||||
return !(wires_status & WIRE_REMOTE_TX)
|
||||
|
||||
/datum/wires/mulebot/proc/RemoteRX()
|
||||
return !(wires_status & WIRE_REMOTE_RX)
|
||||
|
||||
/datum/wires/mulebot/proc/BeaconRX()
|
||||
return !(wires_status & WIRE_BEACON_RX)
|
||||
52
code/datums/wires/particle_accelerator.dm
Normal file
@@ -0,0 +1,52 @@
|
||||
/datum/wires/particle_acc/control_box
|
||||
wire_count = 5
|
||||
holder_type = /obj/machinery/particle_accelerator/control_box
|
||||
|
||||
var/const/PARTICLE_TOGGLE_WIRE = 1 // Toggles whether the PA is on or not.
|
||||
var/const/PARTICLE_STRENGTH_WIRE = 2 // Determines the strength of the PA.
|
||||
var/const/PARTICLE_INTERFACE_WIRE = 4 // Determines the interface showing up.
|
||||
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)
|
||||
var/obj/machinery/particle_accelerator/control_box/C = holder
|
||||
if(C.construction_state == 2)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/particle_acc/control_box/UpdatePulsed(var/index)
|
||||
var/obj/machinery/particle_accelerator/control_box/C = holder
|
||||
switch(index)
|
||||
|
||||
if(PARTICLE_TOGGLE_WIRE)
|
||||
C.toggle_power()
|
||||
|
||||
if(PARTICLE_STRENGTH_WIRE)
|
||||
C.add_strength()
|
||||
|
||||
if(PARTICLE_INTERFACE_WIRE)
|
||||
C.interface_control = !C.interface_control
|
||||
|
||||
if(PARTICLE_LIMIT_POWER_WIRE)
|
||||
C.visible_message("\icon[C]<b>[C]</b> makes a large whirring noise.")
|
||||
|
||||
/datum/wires/particle_acc/control_box/UpdateCut(var/index, var/mended)
|
||||
var/obj/machinery/particle_accelerator/control_box/C = holder
|
||||
switch(index)
|
||||
|
||||
if(PARTICLE_TOGGLE_WIRE)
|
||||
if(C.active == !mended)
|
||||
C.toggle_power()
|
||||
|
||||
if(PARTICLE_STRENGTH_WIRE)
|
||||
|
||||
for(var/i = 1; i < 3; i++)
|
||||
C.remove_strength()
|
||||
|
||||
if(PARTICLE_INTERFACE_WIRE)
|
||||
C.interface_control = mended
|
||||
|
||||
if(PARTICLE_LIMIT_POWER_WIRE)
|
||||
C.strength_upper_limit = (mended ? 2 : 3)
|
||||
if(C.strength_upper_limit < C.strength)
|
||||
C.remove_strength()
|
||||
31
code/datums/wires/radio.dm
Normal file
@@ -0,0 +1,31 @@
|
||||
/datum/wires/radio
|
||||
holder_type = /obj/item/device/radio
|
||||
wire_count = 3
|
||||
|
||||
var/const/WIRE_SIGNAL = 1
|
||||
var/const/WIRE_RECEIVE = 2
|
||||
var/const/WIRE_TRANSMIT = 4
|
||||
|
||||
/datum/wires/radio/CanUse(var/mob/living/L)
|
||||
var/obj/item/device/radio/R = holder
|
||||
if(R.b_stat)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/radio/Interact(var/mob/living/user)
|
||||
if(CanUse(user))
|
||||
var/obj/item/device/radio/R = holder
|
||||
R.interact(user)
|
||||
|
||||
/datum/wires/radio/UpdatePulsed(var/index)
|
||||
var/obj/item/device/radio/R = holder
|
||||
switch(index)
|
||||
if(WIRE_SIGNAL)
|
||||
R.listening = !R.listening
|
||||
R.broadcasting = R.listening
|
||||
|
||||
if(WIRE_RECEIVE)
|
||||
R.listening = !R.listening
|
||||
|
||||
if(WIRE_TRANSMIT)
|
||||
R.broadcasting = !R.broadcasting
|
||||
79
code/datums/wires/robot.dm
Normal file
@@ -0,0 +1,79 @@
|
||||
/datum/wires/robot
|
||||
random = 1
|
||||
holder_type = /mob/living/silicon/robot
|
||||
wire_count = 5
|
||||
|
||||
var/const/BORG_WIRE_LAWCHECK = 1
|
||||
var/const/BORG_WIRE_MAIN_POWER = 2 // The power wires do nothing whyyyyyyyyyyyyy
|
||||
var/const/BORG_WIRE_LOCKED_DOWN = 4
|
||||
var/const/BORG_WIRE_AI_CONTROL = 8
|
||||
var/const/BORG_WIRE_CAMERA = 16
|
||||
|
||||
/datum/wires/robot/GetInteractWindow()
|
||||
|
||||
. = ..()
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
. += text("<br>\n[(R.lawupdate ? "The LawSync light is on." : "The LawSync light is off.")]<br>\n[(R.connected_ai ? "The AI link light is on." : "The AI link light is off.")]")
|
||||
. += text("<br>\n[((!isnull(R.camera) && R.camera.status == 1) ? "The Camera light is on." : "The Camera light is off.")]<br>\n")
|
||||
. += text("<br>\n[(R.lockcharge ? "The lockdown light is on." : "The lockdown light is off.")]")
|
||||
return .
|
||||
|
||||
/datum/wires/robot/UpdateCut(var/index, var/mended)
|
||||
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
switch(index)
|
||||
if(BORG_WIRE_LAWCHECK) //Cut the law wire, and the borg will no longer receive law updates from its AI
|
||||
if(!mended)
|
||||
if (R.lawupdate == 1)
|
||||
R << "LawSync protocol engaged."
|
||||
R.show_laws()
|
||||
else
|
||||
if (R.lawupdate == 0 && !R.emagged)
|
||||
R.lawupdate = 1
|
||||
|
||||
if (BORG_WIRE_AI_CONTROL) //Cut the AI wire to reset AI control
|
||||
if(!mended)
|
||||
if (R.connected_ai)
|
||||
R.connected_ai = null
|
||||
|
||||
if (BORG_WIRE_CAMERA)
|
||||
if(!isnull(R.camera) && !R.scrambledcodes)
|
||||
R.camera.status = mended
|
||||
R.camera.deactivate(usr, 0) // Will kick anyone who is watching the Cyborg's camera.
|
||||
|
||||
if(BORG_WIRE_LAWCHECK) //Forces a law update if the borg is set to receive them. Since an update would happen when the borg checks its laws anyway, not much use, but eh
|
||||
if (R.lawupdate)
|
||||
R.lawsync()
|
||||
|
||||
if(BORG_WIRE_LOCKED_DOWN)
|
||||
R.SetLockdown(!mended)
|
||||
|
||||
|
||||
/datum/wires/robot/UpdatePulsed(var/index)
|
||||
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
switch(index)
|
||||
if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI
|
||||
if(!R.emagged)
|
||||
R.connected_ai = select_active_ai()
|
||||
|
||||
if (BORG_WIRE_CAMERA)
|
||||
if(!isnull(R.camera) && R.camera.can_use() && !R.scrambledcodes)
|
||||
R.camera.deactivate(usr, 0) // Kick anyone watching the Cyborg's camera, doesn't display you disconnecting the camera.
|
||||
R.visible_message("[R]'s camera lense focuses loudly.")
|
||||
R << "Your camera lense focuses loudly."
|
||||
|
||||
if(BORG_WIRE_LOCKED_DOWN)
|
||||
R.SetLockdown(!R.lockcharge) // Toggle
|
||||
|
||||
/datum/wires/robot/CanUse(var/mob/living/L)
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
if(R.wiresexposed)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/robot/proc/IsCameraCut()
|
||||
return wires_status & BORG_WIRE_CAMERA
|
||||
|
||||
/datum/wires/robot/proc/LockedCut()
|
||||
return wires_status & BORG_WIRE_LOCKED_DOWN
|
||||
74
code/datums/wires/syndicatebomb.dm
Normal file
@@ -0,0 +1,74 @@
|
||||
/datum/wires/syndicatebomb
|
||||
random = 1
|
||||
holder_type = /obj/machinery/syndicatebomb
|
||||
wire_count = 5
|
||||
|
||||
var/const/WIRE_BOOM = 1 // Explodes if pulsed or cut while active, defuses a bomb that isn't active on cut
|
||||
var/const/WIRE_UNBOLT = 2 // Unbolts the bomb if cut, hint on pulsed
|
||||
var/const/WIRE_DELAY = 4 // Raises the timer on pulse, does nothing on cut
|
||||
var/const/WIRE_PROCEED = 8 // Lowers the timer, explodes if cut while the bomb is active
|
||||
var/const/WIRE_ACTIVATE = 16 // Will start a bombs timer if pulsed, will hint if pulsed while already active, will stop a timer a bomb on cut
|
||||
|
||||
/datum/wires/syndicatebomb/UpdatePulsed(var/index)
|
||||
var/obj/machinery/syndicatebomb/P = holder
|
||||
switch(index)
|
||||
if(WIRE_BOOM)
|
||||
if (P.active)
|
||||
P.loc.visible_message("\red \icon[holder] An alarm sounds! It's go-")
|
||||
P.timer = 0
|
||||
if(WIRE_UNBOLT)
|
||||
P.loc.visible_message("\blue \icon[holder] The bolts spin in place for a moment.")
|
||||
if(WIRE_DELAY)
|
||||
playsound(P.loc, 'sound/machines/chime.ogg', 30, 1)
|
||||
P.loc.visible_message("\blue \icon[holder] The bomb chirps.")
|
||||
P.timer += 10
|
||||
if(WIRE_PROCEED)
|
||||
playsound(P.loc, 'sound/machines/buzz-sigh.ogg', 30, 1)
|
||||
P.loc.visible_message("\red \icon[holder] The bomb buzzes ominously!")
|
||||
if (P.timer >= 61) //Long fuse bombs can suddenly become more dangerous if you tinker with them
|
||||
P.timer = 60
|
||||
if (P.timer >= 21)
|
||||
P.timer -= 10
|
||||
else if (P.timer >= 11) //both to prevent negative timers and to have a little mercy
|
||||
P.timer = 10
|
||||
if(WIRE_ACTIVATE)
|
||||
if(!P.active && !P.defused)
|
||||
playsound(P.loc, 'sound/machines/click.ogg', 30, 1)
|
||||
P.loc.visible_message("\red \icon[holder] You hear the bomb start ticking!")
|
||||
P.active = 1
|
||||
if(!P.open_panel) //Needs to exist in case the wire is pulsed with a signaler while the panel is closed
|
||||
P.icon_state = "syndicate-bomb-active"
|
||||
else
|
||||
P.icon_state = "syndicate-bomb-active-wires"
|
||||
processing_objects.Add(P)
|
||||
else
|
||||
P.loc.visible_message("\blue \icon[holder] The bomb seems to hesitate for a moment.")
|
||||
P.timer += 5
|
||||
|
||||
/datum/wires/syndicatebomb/UpdateCut(var/index, var/mended)
|
||||
var/obj/machinery/syndicatebomb/P = holder
|
||||
switch(index)
|
||||
if(WIRE_EXPLODE)
|
||||
if(!mended)
|
||||
if(P.active)
|
||||
P.loc.visible_message("\red \icon[holder] An alarm sounds! It's go-")
|
||||
P.timer = 0
|
||||
else
|
||||
P.defused = 1
|
||||
if(mended)
|
||||
P.defused = 0 //cutting and mending all the wires of an inactive bomb will thus cure any sabotage
|
||||
if(WIRE_UNBOLT)
|
||||
if (!mended && P.anchored)
|
||||
playsound(P.loc, 'sound/effects/stealthoff.ogg', 30, 1)
|
||||
P.loc.visible_message("\blue \icon[holder] The bolts lift out of the ground!")
|
||||
P.anchored = 0
|
||||
if(WIRE_PROCEED)
|
||||
if(!mended && P.active)
|
||||
P.loc.visible_message("\red \icon[holder] An alarm sounds! It's go-")
|
||||
P.timer = 0
|
||||
if(WIRE_ACTIVATE)
|
||||
if (!mended && P.active)
|
||||
P.loc.visible_message("\blue \icon[holder] The timer stops! The bomb has been defused!")
|
||||
P.icon_state = "syndicate-bomb-inactive-wires" //no cutting possible with the panel closed
|
||||
P.active = 0
|
||||
P.defused = 1
|
||||
40
code/datums/wires/taperecorder.dm
Normal file
@@ -0,0 +1,40 @@
|
||||
/datum/wires/taperecorder
|
||||
wire_count = 2
|
||||
holder_type = /obj/item/device/taperecorder
|
||||
|
||||
var/const/WIRE_PLAY = 1
|
||||
var/const/WIRE_RECORD = 2
|
||||
|
||||
|
||||
/datum/wires/taperecorder/UpdatePulsed(var/index)
|
||||
switch(index)
|
||||
if(WIRE_PLAY)
|
||||
play()
|
||||
if(WIRE_RECORD)
|
||||
record()
|
||||
|
||||
/datum/wires/taperecorder/CanUse(var/mob/living/L)
|
||||
var/obj/item/device/taperecorder/T = holder
|
||||
if(T.open_panel)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/datum/wires/taperecorder/proc/play()
|
||||
var/obj/item/device/taperecorder/T = holder
|
||||
T.stop()
|
||||
T.play()
|
||||
|
||||
/datum/wires/taperecorder/proc/record()
|
||||
var/obj/item/device/taperecorder/T = holder
|
||||
if(T.recording)
|
||||
T.stop()
|
||||
else
|
||||
T.record()
|
||||
|
||||
//helpers
|
||||
/datum/wires/taperecorder/proc/get_play()
|
||||
return !(wires_status & WIRE_PLAY)
|
||||
|
||||
/datum/wires/taperecorder/proc/get_record()
|
||||
return !(wires_status & WIRE_RECORD)
|
||||
58
code/datums/wires/vending.dm
Normal file
@@ -0,0 +1,58 @@
|
||||
/datum/wires/vending
|
||||
holder_type = /obj/machinery/vending
|
||||
wire_count = 4
|
||||
|
||||
var/const/VENDING_WIRE_THROW = 1
|
||||
var/const/VENDING_WIRE_CONTRABAND = 2
|
||||
var/const/VENDING_WIRE_ELECTRIFY = 4
|
||||
var/const/VENDING_WIRE_IDSCAN = 8
|
||||
|
||||
/datum/wires/vending/CanUse(var/mob/living/L)
|
||||
var/obj/machinery/vending/V = holder
|
||||
if(!istype(L, /mob/living/silicon))
|
||||
if(V.seconds_electrified)
|
||||
if(V.shock(L, 100))
|
||||
return 0
|
||||
if(V.panel_open)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/vending/Interact(var/mob/living/user)
|
||||
if(CanUse(user))
|
||||
var/obj/machinery/vending/V = holder
|
||||
V.attack_hand(user)
|
||||
|
||||
/datum/wires/vending/GetInteractWindow()
|
||||
var/obj/machinery/vending/V = holder
|
||||
. += ..()
|
||||
. += "<BR>The orange light is [V.seconds_electrified ? "on" : "off"].<BR>"
|
||||
. += "The red light is [V.shoot_inventory ? "off" : "blinking"].<BR>"
|
||||
. += "The green light is [V.extended_inventory ? "on" : "off"].<BR>"
|
||||
. += "A [V.scan_id ? "purple" : "yellow"] light is on.<BR>"
|
||||
|
||||
/datum/wires/vending/UpdatePulsed(var/index)
|
||||
var/obj/machinery/vending/V = holder
|
||||
switch(index)
|
||||
if(VENDING_WIRE_THROW)
|
||||
V.shoot_inventory = !V.shoot_inventory
|
||||
if(VENDING_WIRE_CONTRABAND)
|
||||
V.extended_inventory = !V.extended_inventory
|
||||
if(VENDING_WIRE_ELECTRIFY)
|
||||
V.seconds_electrified = 30
|
||||
if(VENDING_WIRE_IDSCAN)
|
||||
V.scan_id = !V.scan_id
|
||||
|
||||
/datum/wires/vending/UpdateCut(var/index, var/mended)
|
||||
var/obj/machinery/vending/V = holder
|
||||
switch(index)
|
||||
if(VENDING_WIRE_THROW)
|
||||
V.shoot_inventory = !mended
|
||||
if(VENDING_WIRE_CONTRABAND)
|
||||
V.extended_inventory = 0
|
||||
if(VENDING_WIRE_ELECTRIFY)
|
||||
if(mended)
|
||||
V.seconds_electrified = 0
|
||||
else
|
||||
V.seconds_electrified = -1
|
||||
if(VENDING_WIRE_IDSCAN)
|
||||
V.scan_id = 1
|
||||
281
code/datums/wires/wires.dm
Normal file
@@ -0,0 +1,281 @@
|
||||
// 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()
|
||||
// 12 colours, if you're adding more than 12 wires then add more colours here
|
||||
var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown", "gold", "gray", "cyan", "navy", "purple", "pink")
|
||||
|
||||
/datum/wires
|
||||
|
||||
var/random = 0 // Will the wires be different for every single instance.
|
||||
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/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
|
||||
|
||||
/datum/wires/New(var/atom/holder)
|
||||
..()
|
||||
src.holder = holder
|
||||
if(!istype(holder, holder_type))
|
||||
CRASH("Our holder is null/the wrong type!")
|
||||
return
|
||||
|
||||
// Generate new wires
|
||||
if(random)
|
||||
GenerateWires()
|
||||
// Get the same wires
|
||||
else
|
||||
// We don't have any wires to copy yet, generate some and then copy it.
|
||||
if(!same_wires[holder_type])
|
||||
GenerateWires()
|
||||
same_wires[holder_type] = src.wires.Copy()
|
||||
else
|
||||
var/list/wires = same_wires[holder_type]
|
||||
src.wires = wires // Reference the wires list.
|
||||
|
||||
/datum/wires/proc/GenerateWires()
|
||||
var/list/colours_to_pick = wireColours.Copy() // Get a copy, not a reference.
|
||||
var/list/indexes_to_pick = list()
|
||||
//Generate our indexes
|
||||
for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i)
|
||||
indexes_to_pick += i
|
||||
colours_to_pick.len = wire_count // Downsize it to our specifications.
|
||||
|
||||
while(colours_to_pick.len && indexes_to_pick.len)
|
||||
// Pick and remove a colour
|
||||
var/colour = pick_n_take(colours_to_pick)
|
||||
|
||||
// Pick and remove an index
|
||||
var/index = pick_n_take(indexes_to_pick)
|
||||
|
||||
src.wires[colour] = index
|
||||
//wires = shuffle(wires)
|
||||
|
||||
|
||||
/datum/wires/proc/Interact(var/mob/living/user)
|
||||
|
||||
var/html = null
|
||||
if(holder && CanUse(user))
|
||||
html = GetInteractWindow()
|
||||
if(html)
|
||||
user.set_machine(holder)
|
||||
//user << browse(html, "window=wires;size=[window_x]x[window_y]")
|
||||
//onclose(user, "wires")
|
||||
var/datum/browser/popup = new(user, "wires", holder.name, window_x, window_y)
|
||||
popup.set_content(html)
|
||||
popup.set_title_image(user.browse_rsc_icon(holder.icon, holder.icon_state))
|
||||
popup.open()
|
||||
|
||||
/datum/wires/proc/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>"
|
||||
|
||||
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"])
|
||||
var/obj/item/I = L.get_active_hand()
|
||||
holder.add_hiddenprint(L)
|
||||
if(href_list["cut"]) // Toggles the cut/mend status
|
||||
if(istype(I, /obj/item/weapon/wirecutters))
|
||||
var/colour = href_list["cut"]
|
||||
CutWireColour(colour)
|
||||
else
|
||||
L << "<span class='error'>You need wirecutters!</span>"
|
||||
|
||||
else if(href_list["pulse"])
|
||||
if(istype(I, /obj/item/device/multitool))
|
||||
var/colour = href_list["pulse"]
|
||||
PulseColour(colour)
|
||||
else
|
||||
L << "<span class='error'>You need a multitool!</span>"
|
||||
|
||||
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
|
||||
if(istype(I, /obj/item/device/assembly/signaler))
|
||||
L.drop_item()
|
||||
Attach(colour, I)
|
||||
else
|
||||
L << "<span class='error'>You need a remote signaller!</span>"
|
||||
|
||||
|
||||
|
||||
|
||||
// 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
|
||||
UpdatePulsed(index)
|
||||
|
||||
/datum/wires/proc/GetIndex(var/colour)
|
||||
if(wires[colour])
|
||||
var/index = wires[colour]
|
||||
return index
|
||||
else
|
||||
CRASH("[colour] is not a key in wires.")
|
||||
|
||||
//
|
||||
// Is Index/Colour Cut procs
|
||||
//
|
||||
|
||||
/datum/wires/proc/IsColourCut(var/colour)
|
||||
var/index = GetIndex(colour)
|
||||
return IsIndexCut(index)
|
||||
|
||||
/datum/wires/proc/IsIndexCut(var/index)
|
||||
return (index & wires_status)
|
||||
|
||||
//
|
||||
// Signaller Procs
|
||||
//
|
||||
|
||||
/datum/wires/proc/IsAttached(var/colour)
|
||||
if(signallers[colour])
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/proc/GetAttached(var/colour)
|
||||
if(signallers[colour])
|
||||
return signallers[colour]
|
||||
return null
|
||||
|
||||
/datum/wires/proc/Attach(var/colour, var/obj/item/device/assembly/signaler/S)
|
||||
if(colour && S)
|
||||
if(!IsAttached(colour))
|
||||
signallers[colour] = S
|
||||
S.loc = holder
|
||||
S.connected = src
|
||||
return S
|
||||
|
||||
/datum/wires/proc/Detach(var/colour)
|
||||
if(colour)
|
||||
var/obj/item/device/assembly/signaler/S = GetAttached(colour)
|
||||
if(S)
|
||||
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/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
|
||||
@@ -185,7 +185,7 @@
|
||||
|
||||
var/list/container = list( )
|
||||
|
||||
|
||||
/*
|
||||
/obj/structure/cable
|
||||
level = 1
|
||||
anchored =1
|
||||
@@ -227,6 +227,7 @@
|
||||
/obj/structure/cable/white
|
||||
_color = "white"
|
||||
icon = 'icons/obj/power_cond_white.dmi'
|
||||
*/
|
||||
|
||||
/obj/effect/projection
|
||||
name = "Projection"
|
||||
|
||||
@@ -30,39 +30,6 @@
|
||||
shock - has a chance of electrocuting its target.
|
||||
*/
|
||||
|
||||
//This generates the randomized airlock wire assignments for the game.
|
||||
/proc/RandomAirlockWires()
|
||||
//to make this not randomize the wires, just set index to 1 and increment it in the flag for loop (after doing everything else).
|
||||
var/list/wires = list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
airlockIndexToFlag = list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
airlockIndexToWireColor = list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
airlockWireColorToIndex = list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
var/flagIndex = 1
|
||||
for (var/flag=1, flag<4096, flag+=flag)
|
||||
var/valid = 0
|
||||
var/list/colorList = list(AIRLOCK_WIRE_IDSCAN, AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2, AIRLOCK_WIRE_DOOR_BOLTS,
|
||||
AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2, AIRLOCK_WIRE_OPEN_DOOR, AIRLOCK_WIRE_AI_CONTROL, AIRLOCK_WIRE_ELECTRIFY,
|
||||
AIRLOCK_WIRE_SAFETY, AIRLOCK_WIRE_SPEED, AIRLOCK_WIRE_LIGHT)
|
||||
|
||||
while (!valid)
|
||||
var/colorIndex = pick(colorList)
|
||||
if(wires[colorIndex]==0)
|
||||
valid = 1
|
||||
wires[colorIndex] = flag
|
||||
airlockIndexToFlag[flagIndex] = flag
|
||||
airlockIndexToWireColor[flagIndex] = colorIndex
|
||||
airlockWireColorToIndex[colorIndex] = flagIndex
|
||||
colorList -= colorIndex
|
||||
flagIndex+=1
|
||||
return wires
|
||||
|
||||
/* Example:
|
||||
Airlock wires color -> flag are { 64, 128, 256, 2, 16, 4, 8, 32, 1 }.
|
||||
Airlock wires color -> index are { 7, 8, 9, 2, 5, 3, 4, 6, 1 }.
|
||||
Airlock index -> flag are { 1, 2, 4, 8, 16, 32, 64, 128, 256 }.
|
||||
Airlock index -> wire color are { 9, 4, 6, 7, 5, 8, 1, 2, 3 }.
|
||||
*/
|
||||
|
||||
/obj/machinery/door/airlock
|
||||
name = "Airlock"
|
||||
icon = 'icons/obj/doors/Doorint.dmi'
|
||||
@@ -77,7 +44,7 @@ Airlock index -> wire color are { 9, 4, 6, 7, 5, 8, 1, 2, 3 }.
|
||||
var/welded = null
|
||||
var/locked = 0
|
||||
var/lights = 1 // bolt lights show by default
|
||||
var/wires = 4095
|
||||
var/datum/wires/airlock/wires = null
|
||||
secondsElectrified = 0 //How many seconds remain until the door is no longer electrified. -1 if it is permanently electrified until someone fixes it.
|
||||
var/aiDisabledIdScanner = 0
|
||||
var/aiHacking = 0
|
||||
@@ -358,170 +325,6 @@ About the new airlock wires panel:
|
||||
..(user)
|
||||
|
||||
|
||||
/obj/machinery/door/airlock/proc/pulse(var/wireColor)
|
||||
//var/wireFlag = airlockWireColorToFlag[wireColor] //not used in this function
|
||||
var/wireIndex = airlockWireColorToIndex[wireColor]
|
||||
switch(wireIndex)
|
||||
if(AIRLOCK_WIRE_IDSCAN)
|
||||
//Sending a pulse through this flashes the red light on the door (if the door has power).
|
||||
if((src.arePowerSystemsOn()) && (!(stat & NOPOWER)))
|
||||
door_animate("deny")
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1 || AIRLOCK_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).
|
||||
src.loseMainPower()
|
||||
if(AIRLOCK_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),
|
||||
//raises them if they are down (only if power's on)
|
||||
if(!src.locked)
|
||||
src.locked = 1
|
||||
for(var/mob/M in range(1,src))
|
||||
M << "You hear a click from the bottom of the door."
|
||||
src.updateUsrDialog()
|
||||
else
|
||||
if(src.arePowerSystemsOn()) //only can raise bolts if power's on
|
||||
src.locked = 0
|
||||
for(var/mob/M in range(1,src))
|
||||
M << "You hear a click from the bottom of the door."
|
||||
src.updateUsrDialog()
|
||||
update_icon()
|
||||
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER1 || AIRLOCK_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).
|
||||
src.loseBackupPower()
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
if(src.aiControlDisabled == 0)
|
||||
src.aiControlDisabled = 1
|
||||
else if(src.aiControlDisabled == -1)
|
||||
src.aiControlDisabled = 2
|
||||
src.updateDialog()
|
||||
spawn(10)
|
||||
if(src.aiControlDisabled == 1)
|
||||
src.aiControlDisabled = 0
|
||||
else if(src.aiControlDisabled == 2)
|
||||
src.aiControlDisabled = -1
|
||||
src.updateDialog()
|
||||
if(AIRLOCK_WIRE_ELECTRIFY)
|
||||
//one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds.
|
||||
if(src.secondsElectrified==0)
|
||||
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
|
||||
usr.attack_log += text("\[[time_stamp()]\] <font color='red'>Electrified the [name] at [x] [y] [z]</font>")
|
||||
src.secondsElectrified = 30
|
||||
spawn(10)
|
||||
//TODO: Move this into process() and make pulsing reset secondsElectrified to 30
|
||||
while (src.secondsElectrified>0)
|
||||
src.secondsElectrified-=1
|
||||
if(src.secondsElectrified<0)
|
||||
src.secondsElectrified = 0
|
||||
// src.updateUsrDialog() //Commented this line out to keep the airlock from clusterfucking you with electricity. --NeoFite
|
||||
sleep(10)
|
||||
if(AIRLOCK_WIRE_OPEN_DOOR)
|
||||
//tries to open the door without ID
|
||||
//will succeed only if the ID wire is cut or the door requires no access
|
||||
if(!src.requiresID() || src.check_access(null))
|
||||
if(density) open()
|
||||
else close()
|
||||
if(AIRLOCK_WIRE_SAFETY)
|
||||
safe = !safe
|
||||
if(!src.density)
|
||||
close()
|
||||
src.updateUsrDialog()
|
||||
|
||||
if(AIRLOCK_WIRE_SPEED)
|
||||
normalspeed = !normalspeed
|
||||
src.updateUsrDialog()
|
||||
|
||||
if(AIRLOCK_WIRE_LIGHT)
|
||||
lights = !lights
|
||||
src.updateUsrDialog()
|
||||
|
||||
|
||||
/obj/machinery/door/airlock/proc/cut(var/wireColor)
|
||||
var/wireFlag = airlockWireColorToFlag[wireColor]
|
||||
var/wireIndex = airlockWireColorToIndex[wireColor]
|
||||
wires &= ~wireFlag
|
||||
switch(wireIndex)
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1 || AIRLOCK_WIRE_MAIN_POWER2)
|
||||
//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.
|
||||
src.loseMainPower()
|
||||
src.shock(usr, 50)
|
||||
src.updateUsrDialog()
|
||||
if(AIRLOCK_WIRE_DOOR_BOLTS)
|
||||
//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)
|
||||
if(src.locked!=1)
|
||||
src.locked = 1
|
||||
update_icon()
|
||||
src.updateUsrDialog()
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER1 || AIRLOCK_WIRE_BACKUP_POWER2)
|
||||
//Cutting either one disables the backup door power (allowing it to be crowbarred open, but disabling bolts-raising), but may electocute the user.
|
||||
src.loseBackupPower()
|
||||
src.shock(usr, 50)
|
||||
src.updateUsrDialog()
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
//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.
|
||||
if(src.aiControlDisabled == 0)
|
||||
src.aiControlDisabled = 1
|
||||
else if(src.aiControlDisabled == -1)
|
||||
src.aiControlDisabled = 2
|
||||
src.updateUsrDialog()
|
||||
if(AIRLOCK_WIRE_ELECTRIFY)
|
||||
//Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted.
|
||||
if(src.secondsElectrified != -1)
|
||||
shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
|
||||
usr.attack_log += text("\[[time_stamp()]\] <font color='red'>Electrified the [name] at [x] [y] [z]</font>")
|
||||
src.secondsElectrified = -1
|
||||
if (AIRLOCK_WIRE_SAFETY)
|
||||
safe = 0
|
||||
src.updateUsrDialog()
|
||||
|
||||
if(AIRLOCK_WIRE_SPEED)
|
||||
autoclose = 0
|
||||
src.updateUsrDialog()
|
||||
|
||||
if(AIRLOCK_WIRE_LIGHT)
|
||||
lights = 0
|
||||
src.updateUsrDialog()
|
||||
|
||||
/obj/machinery/door/airlock/proc/mend(var/wireColor)
|
||||
var/wireFlag = airlockWireColorToFlag[wireColor]
|
||||
var/wireIndex = airlockWireColorToIndex[wireColor] //not used in this function
|
||||
wires |= wireFlag
|
||||
switch(wireIndex)
|
||||
if(AIRLOCK_WIRE_MAIN_POWER1 || AIRLOCK_WIRE_MAIN_POWER2)
|
||||
if((!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1)) && (!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2)))
|
||||
src.regainMainPower()
|
||||
src.shock(usr, 50)
|
||||
src.updateUsrDialog()
|
||||
if(AIRLOCK_WIRE_BACKUP_POWER1 || AIRLOCK_WIRE_BACKUP_POWER2)
|
||||
if((!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1)) && (!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2)))
|
||||
src.regainBackupPower()
|
||||
src.shock(usr, 50)
|
||||
src.updateUsrDialog()
|
||||
if(AIRLOCK_WIRE_AI_CONTROL)
|
||||
//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.
|
||||
if(src.aiControlDisabled == 1)
|
||||
src.aiControlDisabled = 0
|
||||
else if(src.aiControlDisabled == 2)
|
||||
src.aiControlDisabled = -1
|
||||
src.updateUsrDialog()
|
||||
if(AIRLOCK_WIRE_ELECTRIFY)
|
||||
if(src.secondsElectrified == -1)
|
||||
src.secondsElectrified = 0
|
||||
|
||||
if (AIRLOCK_WIRE_SAFETY)
|
||||
safe = 1
|
||||
src.updateUsrDialog()
|
||||
|
||||
if(AIRLOCK_WIRE_SPEED)
|
||||
autoclose = 1
|
||||
if(!src.density)
|
||||
close()
|
||||
src.updateUsrDialog()
|
||||
|
||||
if(AIRLOCK_WIRE_LIGHT)
|
||||
lights = 1
|
||||
src.updateUsrDialog()
|
||||
|
||||
|
||||
/obj/machinery/door/airlock/proc/isElectrified()
|
||||
@@ -529,13 +332,10 @@ About the new airlock wires panel:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/door/airlock/proc/isWireColorCut(var/wireColor)
|
||||
var/wireFlag = airlockWireColorToFlag[wireColor]
|
||||
return ((src.wires & wireFlag) == 0)
|
||||
|
||||
/obj/machinery/door/airlock/proc/isWireCut(var/wireIndex)
|
||||
var/wireFlag = airlockIndexToFlag[wireIndex]
|
||||
return ((src.wires & wireFlag) == 0)
|
||||
// You can find the wires in the datum folder.
|
||||
return wires.IsIndexCut(wireIndex)
|
||||
|
||||
|
||||
/obj/machinery/door/airlock/proc/canAIControl()
|
||||
return ((src.aiControlDisabled!=1) && (!src.isAllPowerCut()));
|
||||
@@ -851,45 +651,7 @@ About the new airlock wires panel:
|
||||
**/
|
||||
|
||||
if(src.p_open)
|
||||
user.set_machine(src)
|
||||
var/t1 = text("<B>Access Panel</B><br>\n")
|
||||
|
||||
//t1 += text("[]: ", airlockFeatureNames[airlockWireColorToIndex[9]])
|
||||
var/list/wires = list(
|
||||
"Orange" = 1,
|
||||
"Dark red" = 2,
|
||||
"White" = 3,
|
||||
"Yellow" = 4,
|
||||
"Red" = 5,
|
||||
"Blue" = 6,
|
||||
"Green" = 7,
|
||||
"Grey" = 8,
|
||||
"Black" = 9,
|
||||
"Gold" = 10,
|
||||
"Aqua" = 11,
|
||||
"Pink" = 12
|
||||
)
|
||||
for(var/wiredesc in wires)
|
||||
var/is_uncut = src.wires & airlockWireColorToFlag[wires[wiredesc]]
|
||||
t1 += "[wiredesc] wire: "
|
||||
if(!is_uncut)
|
||||
t1 += "<a href='?src=\ref[src];wires=[wires[wiredesc]]'>Mend</a>"
|
||||
else
|
||||
t1 += "<a href='?src=\ref[src];wires=[wires[wiredesc]]'>Cut</a> "
|
||||
t1 += "<a href='?src=\ref[src];pulse=[wires[wiredesc]]'>Pulse</a> "
|
||||
if(src.signalers[wires[wiredesc]])
|
||||
t1 += "<a href='?src=\ref[src];remove-signaler=[wires[wiredesc]]'>Detach signaler</a>"
|
||||
else
|
||||
t1 += "<a href='?src=\ref[src];signaler=[wires[wiredesc]]'>Attach signaler</a>"
|
||||
t1 += "<br>"
|
||||
|
||||
t1 += text("<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]", (src.locked ? "The door bolts have fallen!" : "The door bolts look up."), (src.lights ? "The door bolt lights are on." : "The door bolt lights are off!"), ((src.arePowerSystemsOn() && !(stat & NOPOWER)) ? "The test light is on." : "The test light is off!"), (src.aiControlDisabled==0 ? "The 'AI control allowed' light is on." : "The 'AI control allowed' light is off."), (src.safe==0 ? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off."), (src.normalspeed==0 ? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off."))
|
||||
|
||||
t1 += text("<p><a href='?src=\ref[];close=1'>Close</a></p>\n", src)
|
||||
|
||||
user << browse(t1, "window=airlock")
|
||||
onclose(user, "airlock")
|
||||
|
||||
wires.Interact(user)
|
||||
else
|
||||
..(user)
|
||||
return
|
||||
@@ -909,51 +671,7 @@ About the new airlock wires panel:
|
||||
|
||||
if((in_range(src, usr) && istype(src.loc, /turf)) && src.p_open)
|
||||
usr.set_machine(src)
|
||||
if(href_list["wires"])
|
||||
var/t1 = text2num(href_list["wires"])
|
||||
if(!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
|
||||
usr << "You need wirecutters!"
|
||||
return
|
||||
if(src.isWireColorCut(t1))
|
||||
src.mend(t1)
|
||||
else
|
||||
src.cut(t1)
|
||||
else if(href_list["pulse"])
|
||||
var/t1 = text2num(href_list["pulse"])
|
||||
if(!istype(usr.get_active_hand(), /obj/item/device/multitool))
|
||||
usr << "You need a multitool!"
|
||||
return
|
||||
if(src.isWireColorCut(t1))
|
||||
usr << "You can't pulse a cut wire."
|
||||
return
|
||||
else
|
||||
src.pulse(t1)
|
||||
else if(href_list["signaler"])
|
||||
var/wirenum = text2num(href_list["signaler"])
|
||||
if(!istype(usr.get_active_hand(), /obj/item/device/assembly/signaler))
|
||||
usr << "You need a signaller!"
|
||||
return
|
||||
if(src.isWireColorCut(wirenum))
|
||||
usr << "You can't attach a signaller to a cut wire."
|
||||
return
|
||||
var/obj/item/device/assembly/signaler/R = usr.get_active_hand()
|
||||
if(R.secured)
|
||||
usr << "This radio can't be attached!"
|
||||
return
|
||||
var/mob/M = usr
|
||||
M.drop_item()
|
||||
R.loc = src
|
||||
R.airlock_wire = wirenum
|
||||
src.signalers[wirenum] = R
|
||||
else if(href_list["remove-signaler"])
|
||||
var/wirenum = text2num(href_list["remove-signaler"])
|
||||
if(!(src.signalers[wirenum]))
|
||||
usr << "There's no signaller attached to that wire!"
|
||||
return
|
||||
var/obj/item/device/assembly/signaler/R = src.signalers[wirenum]
|
||||
R.loc = usr.loc
|
||||
R.airlock_wire = null
|
||||
src.signalers[wirenum] = null
|
||||
|
||||
|
||||
|
||||
if(istype(usr, /mob/living/silicon) && src.canAIControl())
|
||||
@@ -1317,6 +1035,7 @@ About the new airlock wires panel:
|
||||
|
||||
/obj/machinery/door/airlock/New()
|
||||
..()
|
||||
wires = new(src)
|
||||
if(src.closeOtherId != null)
|
||||
spawn (5)
|
||||
for (var/obj/machinery/door/airlock/A in world)
|
||||
|
||||
@@ -45,12 +45,13 @@
|
||||
var/shut_up = 1 //Stop spouting those godawful pitches!
|
||||
var/extended_inventory = 0 //can we access the hidden inventory?
|
||||
var/panel_open = 0 //Hacking that vending machine. Gonna get a free candy bar.
|
||||
var/wires = 15
|
||||
var/obj/item/weapon/coin/coin
|
||||
var/const/WIRE_EXTEND = 1
|
||||
var/const/WIRE_SCANID = 2
|
||||
var/const/WIRE_SHOCK = 3
|
||||
var/const/WIRE_SHOOTINV = 4
|
||||
var/datum/wires/vending/wires = null
|
||||
var/scan_id = 1
|
||||
|
||||
var/obj/machinery/account_database/linked_db
|
||||
var/datum/money_account/linked_account
|
||||
@@ -286,35 +287,18 @@
|
||||
dat += "</TT>"
|
||||
|
||||
if(panel_open)
|
||||
var/list/vendwires = list(
|
||||
"Violet" = 1,
|
||||
"Orange" = 2,
|
||||
"Goldenrod" = 3,
|
||||
"Green" = 4,
|
||||
)
|
||||
dat += "<br><hr><br><B>Access Panel</B><br>"
|
||||
for(var/wiredesc in vendwires)
|
||||
var/is_uncut = src.wires & APCWireColorToFlag[vendwires[wiredesc]]
|
||||
dat += "[wiredesc] wire: "
|
||||
if(!is_uncut)
|
||||
dat += "<a href='?src=\ref[src];cutwire=[vendwires[wiredesc]]'>Mend</a>"
|
||||
else
|
||||
dat += "<a href='?src=\ref[src];cutwire=[vendwires[wiredesc]]'>Cut</a> "
|
||||
dat += "<a href='?src=\ref[src];pulsewire=[vendwires[wiredesc]]'>Pulse</a> "
|
||||
dat += "<br>"
|
||||
|
||||
dat += "<br>"
|
||||
dat += "The orange light is [(src.seconds_electrified == 0) ? "off" : "on"].<BR>"
|
||||
dat += "The red light is [src.shoot_inventory ? "off" : "blinking"].<BR>"
|
||||
dat += "The green light is [src.extended_inventory ? "on" : "off"].<BR>"
|
||||
dat += "The [(src.wires & WIRE_SCANID) ? "purple" : "yellow"] light is on.<BR>"
|
||||
dat += wires()
|
||||
|
||||
if (product_slogans != "")
|
||||
dat += "The speaker switch is [src.shut_up ? "off" : "on"]. <a href='?src=\ref[src];togglevoice=[1]'>Toggle</a>"
|
||||
|
||||
user << browse(dat, "window=vending")
|
||||
onclose(user, "")
|
||||
return
|
||||
|
||||
// returns the wire panel text
|
||||
/obj/machinery/vending/proc/wires()
|
||||
return "<BR>" + wires.GetInteractWindow(0, 0)
|
||||
|
||||
|
||||
/obj/machinery/vending/Topic(href, href_list)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
@@ -370,27 +354,6 @@
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
else if ((href_list["cutwire"]) && (src.panel_open))
|
||||
var/twire = text2num(href_list["cutwire"])
|
||||
if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
|
||||
usr << "You need wirecutters!"
|
||||
return
|
||||
if (src.isWireColorCut(twire))
|
||||
src.mend(twire)
|
||||
else
|
||||
src.cut(twire)
|
||||
|
||||
else if ((href_list["pulsewire"]) && (src.panel_open))
|
||||
var/twire = text2num(href_list["pulsewire"])
|
||||
if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
|
||||
usr << "You need a multitool!"
|
||||
return
|
||||
if (src.isWireColorCut(twire))
|
||||
usr << "You can't pulse a cut wire."
|
||||
return
|
||||
else
|
||||
src.pulse(twire)
|
||||
|
||||
else if ((href_list["togglevoice"]) && (src.panel_open))
|
||||
src.shut_up = !src.shut_up
|
||||
|
||||
@@ -532,49 +495,6 @@
|
||||
src.visible_message("\red <b>[src] launches [throw_item.name] at [target.name]!</b>")
|
||||
return 1
|
||||
|
||||
/obj/machinery/vending/proc/isWireColorCut(var/wireColor)
|
||||
var/wireFlag = APCWireColorToFlag[wireColor]
|
||||
return ((src.wires & wireFlag) == 0)
|
||||
|
||||
/obj/machinery/vending/proc/isWireCut(var/wireIndex)
|
||||
var/wireFlag = APCIndexToFlag[wireIndex]
|
||||
return ((src.wires & wireFlag) == 0)
|
||||
|
||||
/obj/machinery/vending/proc/cut(var/wireColor)
|
||||
var/wireFlag = APCWireColorToFlag[wireColor]
|
||||
var/wireIndex = APCWireColorToIndex[wireColor]
|
||||
src.wires &= ~wireFlag
|
||||
switch(wireIndex)
|
||||
if(WIRE_EXTEND)
|
||||
src.extended_inventory = 0
|
||||
if(WIRE_SHOCK)
|
||||
src.seconds_electrified = -1
|
||||
if (WIRE_SHOOTINV)
|
||||
if(!src.shoot_inventory)
|
||||
src.shoot_inventory = 1
|
||||
|
||||
|
||||
/obj/machinery/vending/proc/mend(var/wireColor)
|
||||
var/wireFlag = APCWireColorToFlag[wireColor]
|
||||
var/wireIndex = APCWireColorToIndex[wireColor] //not used in this function
|
||||
src.wires |= wireFlag
|
||||
switch(wireIndex)
|
||||
// if(WIRE_SCANID)
|
||||
if(WIRE_SHOCK)
|
||||
src.seconds_electrified = 0
|
||||
if (WIRE_SHOOTINV)
|
||||
src.shoot_inventory = 0
|
||||
|
||||
/obj/machinery/vending/proc/pulse(var/wireColor)
|
||||
var/wireIndex = APCWireColorToIndex[wireColor]
|
||||
switch(wireIndex)
|
||||
if(WIRE_EXTEND)
|
||||
src.extended_inventory = !src.extended_inventory
|
||||
// if (WIRE_SCANID)
|
||||
if (WIRE_SHOCK)
|
||||
src.seconds_electrified = 30
|
||||
if (WIRE_SHOOTINV)
|
||||
src.shoot_inventory = !src.shoot_inventory
|
||||
|
||||
|
||||
/obj/machinery/vending/proc/shock(mob/user, prb)
|
||||
|
||||
@@ -173,14 +173,15 @@ var/datum/nanomanager/nanomanager = new()
|
||||
//airlockWireColorToIndex takes a number representing the wire color, e.g. the orange wire is always 1, the dark red wire is always 2, etc. It returns the index for whatever that wire does.
|
||||
//airlockIndexToWireColor does the opposite thing - it takes the index for what the wire does, for example AIRLOCK_WIRE_IDSCAN is 1, AIRLOCK_WIRE_POWER1 is 2, etc. It returns the wire color number.
|
||||
//airlockWireColorToFlag takes the wire color number and returns the flag for it (1, 2, 4, 8, 16, etc)
|
||||
var/list/airlockWireColorToFlag = RandomAirlockWires()
|
||||
var/list/airlockIndexToFlag
|
||||
var/list/airlockIndexToWireColor
|
||||
var/list/airlockWireColorToIndex
|
||||
var/list/APCWireColorToFlag = RandomAPCWires()
|
||||
var/list/APCIndexToFlag
|
||||
var/list/APCIndexToWireColor
|
||||
var/list/APCWireColorToIndex
|
||||
|
||||
//var/list/airlockWireColorToFlag = RandomAirlockWires()
|
||||
//var/list/airlockIndexToFlag
|
||||
//var/list/airlockIndexToWireColor
|
||||
//var/list/airlockWireColorToIndex
|
||||
//var/list/APCWireColorToFlag = RandomAPCWires()
|
||||
//var/list/APCIndexToFlag
|
||||
//var/list/APCIndexToWireColor
|
||||
//var/list/APCWireColorToIndex
|
||||
var/list/BorgWireColorToFlag = RandomBorgWires()
|
||||
var/list/BorgIndexToFlag
|
||||
var/list/BorgIndexToWireColor
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
|
||||
return
|
||||
|
||||
/*
|
||||
pulse(var/radio = 0)
|
||||
if(istype(src.loc, /obj/machinery/door/airlock) && src.airlock_wire && src.wires)
|
||||
var/obj/machinery/door/airlock/A = src.loc
|
||||
@@ -130,7 +131,7 @@
|
||||
else
|
||||
..(radio)
|
||||
return 1
|
||||
|
||||
*/
|
||||
receive_signal(datum/signal/signal)
|
||||
if( !receiving || !signal )
|
||||
return 0
|
||||
|
||||
@@ -289,6 +289,7 @@
|
||||
'nano/css/shared.css',
|
||||
'nano/css/icons.css',
|
||||
'nano/templates/chem_dispenser.tmpl',
|
||||
'nano/templates/apc.tmpl',
|
||||
'nano/templates/cryo.tmpl',
|
||||
'nano/templates/dna_modifier.tmpl',
|
||||
'nano/templates/geoscanner.tmpl',
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
|
||||
var/obj/item/weapon/cable_coil/CC = new/obj/item/weapon/cable_coil(user.loc)
|
||||
CC.amount = 1
|
||||
CC.updateicon()
|
||||
// CC.updateicon()
|
||||
overlays = list()
|
||||
string_attached = null
|
||||
user << "\blue You detach the string from the coin."
|
||||
|
||||
@@ -45,10 +45,10 @@
|
||||
/datum/nanomanager/proc/update_uis(src_object)
|
||||
var/src_object_key = "\ref[src_object]"
|
||||
if (isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
|
||||
return 0
|
||||
return 0
|
||||
|
||||
var/update_count = 0
|
||||
for (var/ui_key in open_uis[src_object_key])
|
||||
for (var/ui_key in open_uis[src_object_key])
|
||||
for (var/datum/nanoui/ui in open_uis[src_object_key][ui_key])
|
||||
if(ui && ui.src_object && ui.user)
|
||||
ui.process(1)
|
||||
@@ -94,7 +94,7 @@
|
||||
ui.user.open_uis.Remove(ui)
|
||||
var/list/uis = open_uis[src_object_key][ui.ui_key]
|
||||
return uis.Remove(ui)
|
||||
|
||||
|
||||
/**
|
||||
* This is called on user logout
|
||||
* Closes/clears all uis attached to the user's /mob
|
||||
@@ -104,7 +104,7 @@
|
||||
* @return nothing
|
||||
*/
|
||||
|
||||
//
|
||||
//
|
||||
/datum/nanomanager/proc/user_logout(var/mob/user)
|
||||
if (isnull(user.open_uis) || !istype(user.open_uis, /list) || open_uis.len == 0)
|
||||
return 0 // has no open uis
|
||||
@@ -114,3 +114,22 @@
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This is called when a player transfers from one mob to another
|
||||
* Transfers all open UIs to the new mob
|
||||
*
|
||||
* @param oldMob /mob The user's old mob
|
||||
* @param newMob /mob The user's new mob
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
|
||||
/datum/nanomanager/proc/user_transferred(var/mob/oldMob, var/mob/newMob)
|
||||
if (isnull(oldMob.open_uis) || !istype(oldMob.open_uis, /list) || open_uis.len == 0)
|
||||
return 0 // has no open uis
|
||||
if (isnull(newMob.open_uis) || !istype(newMob.open_uis, /list))
|
||||
newMob.open_uis = list()
|
||||
for (var/datum/nanoui/ui in oldMob.open_uis)
|
||||
ui.user = newMob
|
||||
newMob.open_uis.Add(ui)
|
||||
oldMob.open_uis.Cut()
|
||||
@@ -353,6 +353,7 @@ nanoui is used to open and update nano browser uis
|
||||
fdel(f)
|
||||
f << html
|
||||
user << browse(html, "window=[window_id];[window_size][window_options]")
|
||||
winset(user, "mapwindow.map", "focus=true") // Return keyboard focus to map.
|
||||
on_close_winset()
|
||||
//onclose(user, window_id)
|
||||
nanomanager.ui_opened(src)
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
var/lastused_total = 0
|
||||
var/main_status = 0
|
||||
var/wiresexposed = 0
|
||||
var/apcwires = 15
|
||||
powernet = 0 // set so that APCs aren't found as powernet nodes //Hackish, Horrible, was like this before I changed it :(
|
||||
var/malfhack = 0 //New var for my changes to AI malf. --NeoFite
|
||||
var/mob/living/silicon/ai/malfai = null //See above --NeoFite
|
||||
@@ -57,45 +56,27 @@
|
||||
var/overload = 1 //used for the Blackout malf module
|
||||
var/beenhit = 0 // used for counting how many times it has been hit, used for Aliens at the moment
|
||||
var/mob/living/silicon/ai/occupant = null
|
||||
var/list/apcwirelist = list(
|
||||
"Orange" = 1,
|
||||
"Dark red" = 2,
|
||||
"White" = 3,
|
||||
"Yellow" = 4,
|
||||
)
|
||||
var/longtermpower = 10
|
||||
var/updating_icon = 0
|
||||
var/list/status_overlays
|
||||
var/datum/wires/apc/wires = null
|
||||
//var/debug = 0
|
||||
|
||||
/proc/RandomAPCWires()
|
||||
//to make this not randomize the wires, just set index to 1 and increment it in the flag for loop (after doing everything else).
|
||||
var/list/apcwires = list(0, 0, 0, 0)
|
||||
APCIndexToFlag = list(0, 0, 0, 0)
|
||||
APCIndexToWireColor = list(0, 0, 0, 0)
|
||||
APCWireColorToIndex = list(0, 0, 0, 0)
|
||||
var/flagIndex = 1
|
||||
for (var/flag=1, flag<16, flag+=flag)
|
||||
var/valid = 0
|
||||
while (!valid)
|
||||
var/colorIndex = rand(1, 4)
|
||||
if (apcwires[colorIndex]==0)
|
||||
valid = 1
|
||||
apcwires[colorIndex] = flag
|
||||
APCIndexToFlag[flagIndex] = flag
|
||||
APCIndexToWireColor[flagIndex] = colorIndex
|
||||
APCWireColorToIndex[colorIndex] = flagIndex
|
||||
flagIndex+=1
|
||||
return apcwires
|
||||
|
||||
/obj/machinery/power/apc/updateDialog()
|
||||
if (stat & (BROKEN|MAINT))
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/machinery/power/apc/connect_to_network()
|
||||
//Override because the APC does not directly connect to the network; it goes through a terminal.
|
||||
//The terminal is what the power computer looks for anyway.
|
||||
if(!terminal)
|
||||
make_terminal()
|
||||
if(terminal)
|
||||
terminal.connect_to_network()
|
||||
|
||||
/obj/machinery/power/apc/New(turf/loc, var/ndir, var/building=0)
|
||||
..()
|
||||
|
||||
wires = new(src)
|
||||
// offset 24 pixels in direction of dir
|
||||
// this allows the APC to be embedded in a wall, yet still inside an area
|
||||
if (building)
|
||||
@@ -177,64 +158,6 @@
|
||||
|
||||
// update the APC icon to show the three base states
|
||||
// also add overlays for indicator lights
|
||||
|
||||
/obj/machinery/power/apc/update_icon()
|
||||
if (isnull(status_overlays)) // if no status overlays list, this is first call
|
||||
status_overlays = new
|
||||
status_overlays.len = 5
|
||||
status_overlays[1] = image('icons/obj/power.dmi', "apcox-[locked]") // 0=blue 1=red
|
||||
status_overlays[2] = image('icons/obj/power.dmi', "apco3-[charging]") // 0=red, 1=yellow/black 2=green
|
||||
|
||||
status_overlays[3] = image('icons/obj/power.dmi', "apco0-[equipment]") // 0=red, 1=green, 2=blue
|
||||
status_overlays[4] = image('icons/obj/power.dmi', "apco1-[lighting]")
|
||||
status_overlays[5] = image('icons/obj/power.dmi', "apco2-[environ]")
|
||||
|
||||
if(opened)
|
||||
icon_state = "[ cell ? "apc2" : "apc1" ]" // if opened, show cell if it's inserted
|
||||
if (overlays.len) overlays.len = 0 // also delete all overlays
|
||||
return
|
||||
else if(emagged || malfhack)
|
||||
icon_state = "apcemag"
|
||||
if (overlays.len) overlays.len = 0
|
||||
return
|
||||
else if(wiresexposed)
|
||||
icon_state = "apcewires"
|
||||
if (overlays.len) overlays.len = 0
|
||||
return
|
||||
else
|
||||
icon_state = "apc0"
|
||||
|
||||
// if closed, update overlays for channel status
|
||||
|
||||
if (overlays.len) overlays.len = 0
|
||||
|
||||
var/image/buffer
|
||||
|
||||
buffer = status_overlays[1]
|
||||
buffer.icon_state = "apcox-[locked]"
|
||||
|
||||
buffer = status_overlays[2]
|
||||
buffer.icon_state = "apco3-[charging]"
|
||||
|
||||
buffer = status_overlays[3]
|
||||
buffer.icon_state = "apco0-[equipment]"
|
||||
|
||||
buffer = status_overlays[4]
|
||||
buffer.icon_state = "apco1-[lighting]"
|
||||
|
||||
buffer = status_overlays[5]
|
||||
buffer.icon_state = "apco2-[environ]"
|
||||
|
||||
overlays += status_overlays[1]
|
||||
overlays += status_overlays[2]
|
||||
|
||||
if(operating)
|
||||
overlays += status_overlays[3]
|
||||
overlays += status_overlays[4]
|
||||
overlays += status_overlays[5]
|
||||
|
||||
|
||||
/*
|
||||
/obj/machinery/power/apc/update_icon()
|
||||
|
||||
overlays.Cut()
|
||||
@@ -246,7 +169,10 @@
|
||||
else
|
||||
icon_state = basestate
|
||||
else if (opened == 2)
|
||||
icon_state = "[basestate]-nocover"
|
||||
if ((stat & BROKEN) || malfhack )
|
||||
icon_state = "[basestate]-b-nocover"
|
||||
else /* if (emagged)*/
|
||||
icon_state = "[basestate]-nocover"
|
||||
else if (stat & BROKEN)
|
||||
icon_state = "apc-b"
|
||||
else if(emagged || malfai)
|
||||
@@ -261,8 +187,6 @@
|
||||
if(operating)
|
||||
overlays.Add("apco0-[equipment]","apco1-[lighting]","apco2-[environ]") // 0=red, 1=green, 2=blue
|
||||
|
||||
*/
|
||||
|
||||
// Used in process so it doesn't update the icon too much
|
||||
/obj/machinery/power/apc/proc/queue_icon_update()
|
||||
|
||||
@@ -362,7 +286,7 @@
|
||||
else if(stat & (BROKEN|MAINT))
|
||||
user << "Nothing happens."
|
||||
else
|
||||
if(src.allowed(usr))
|
||||
if(src.allowed(usr) && !isWireCut(APC_WIRE_IDSCAN))
|
||||
locked = !locked
|
||||
user << "You [ locked ? "lock" : "unlock"] the APC interface."
|
||||
update_icon()
|
||||
@@ -396,7 +320,7 @@
|
||||
user << "You start adding cables to the APC frame..."
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
if(do_after(user, 20) && C.amount >= 10)
|
||||
var/turf/T = get_turf_loc(src)
|
||||
var/turf/T = get_turf(src)
|
||||
var/obj/structure/cable/N = T.get_cable_node()
|
||||
if (prob(50) && electrocute_mob(usr, N, N))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
@@ -500,7 +424,7 @@
|
||||
return src.attack_hand(user)
|
||||
if (!opened && wiresexposed && \
|
||||
(istype(W, /obj/item/device/multitool) || \
|
||||
istype(W, /obj/item/weapon/wirecutters)))
|
||||
istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/device/assembly/signaler)))
|
||||
return src.attack_hand(user)
|
||||
user.visible_message("\red The [src.name] has been hit with the [W.name] by [user.name]!", \
|
||||
"\red You hit the [src.name] with your [W.name]!", \
|
||||
@@ -528,7 +452,6 @@
|
||||
return
|
||||
if(stat & (BROKEN|MAINT))
|
||||
return
|
||||
|
||||
// do APC interaction
|
||||
user.set_machine(src)
|
||||
src.interact(user)
|
||||
@@ -538,19 +461,16 @@
|
||||
return
|
||||
user.visible_message("\red [user.name] slashes at the [src.name]!", "\blue You slash at the [src.name]!")
|
||||
playsound(src.loc, 'sound/weapons/slash.ogg', 100, 1)
|
||||
var/allcut = 1
|
||||
for(var/wire in apcwirelist)
|
||||
if(!isWireCut(apcwirelist[wire]))
|
||||
allcut = 0
|
||||
break
|
||||
|
||||
var/allcut = wires.IsAllCut()
|
||||
|
||||
if(beenhit >= pick(3, 4) && wiresexposed != 1)
|
||||
wiresexposed = 1
|
||||
src.update_icon()
|
||||
src.visible_message("\red The [src.name]'s cover flies open, exposing the wires!")
|
||||
|
||||
else if(wiresexposed == 1 && allcut == 0)
|
||||
for(var/wire in apcwirelist)
|
||||
cut(apcwirelist[wire])
|
||||
wires.CutAll()
|
||||
src.update_icon()
|
||||
src.visible_message("\red The [src.name]'s wires are shredded!")
|
||||
else
|
||||
@@ -558,44 +478,30 @@
|
||||
return
|
||||
|
||||
|
||||
|
||||
/obj/machinery/power/apc/interact(mob/user)
|
||||
if(!user)
|
||||
return
|
||||
|
||||
if(wiresexposed /*&& (!istype(user, /mob/living/silicon))*/) //Commented out the typecheck to allow engiborgs to repair damaged apcs.
|
||||
var/t1 = text("<html><head><title>[area.name] APC wires</title></head><body><B>Access Panel</B><br>\n")
|
||||
|
||||
for(var/wiredesc in apcwirelist)
|
||||
var/is_uncut = src.apcwires & APCWireColorToFlag[apcwirelist[wiredesc]]
|
||||
t1 += "[wiredesc] wire: "
|
||||
if(!is_uncut)
|
||||
t1 += "<a href='?src=\ref[src];apcwires=[apcwirelist[wiredesc]]'>Mend</a>"
|
||||
else
|
||||
t1 += "<a href='?src=\ref[src];apcwires=[apcwirelist[wiredesc]]'>Cut</a> "
|
||||
t1 += "<a href='?src=\ref[src];pulse=[apcwirelist[wiredesc]]'>Pulse</a> "
|
||||
t1 += "<br>"
|
||||
t1 += text("<br>\n[(src.locked ? "The APC is locked." : "The APC is unlocked.")]<br>\n[(src.shorted ? "The APCs power has been shorted." : "The APC is working properly!")]<br>\n[(src.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]")
|
||||
t1 += text("<p><a href='?src=\ref[src];close2=1'>Close</a></p></body></html>")
|
||||
user << browse(t1, "window=apcwires")
|
||||
onclose(user, "apcwires")
|
||||
wires.Interact(user)
|
||||
|
||||
user.set_machine(src)
|
||||
var/t = "<html><head><title>[area.name] APC</title></head><body><TT><B>Area Power Controller</B> ([area.name])<HR>"
|
||||
var/t = "" //"<B>Area Power Controller</B> ([area.name])"
|
||||
|
||||
//This goes after the wire stuff. They should be able to fix a physical problem when a wire is cut
|
||||
if ( (get_dist(src, user) > 1 ))
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
if (!issilicon(user))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=apc")
|
||||
return
|
||||
else if (istype(user, /mob/living/silicon) && src.aidisabled && !src.malfhack)
|
||||
else if (issilicon(user) && src.aidisabled && !src.malfhack)
|
||||
user << "AI control for this APC interface has been disabled."
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=apc")
|
||||
return
|
||||
else if (src.malfai)
|
||||
if ((src.malfai != user && src.malfai != user:parent) && !islinked(user, malfai))
|
||||
else if (src.malfai && isAI(user))
|
||||
var/mob/living/silicon/ai/AI = user
|
||||
if ((src.malfai != AI && src.malfai != AI.parent) && !islinked(AI, malfai))
|
||||
user << "AI control for this APC interface has been disabled."
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=apc")
|
||||
@@ -603,104 +509,109 @@
|
||||
|
||||
|
||||
if(locked && (!istype(user, /mob/living/silicon)))
|
||||
t += "<I>(Swipe ID card to unlock inteface.)</I><BR>"
|
||||
t += "Main breaker : <B>[operating ? "On" : "Off"]</B><BR>"
|
||||
t += "External power : <B>[ main_status ? (main_status ==2 ? "<FONT COLOR=#004000>Good</FONT>" : "<FONT COLOR=#D09000>Low</FONT>") : "<FONT COLOR=#F00000>None</FONT>"]</B><BR>"
|
||||
t += "Power cell: <B>[cell ? "[round(cell.percent())]%" : "<FONT COLOR=red>Not connected.</FONT>"]</B>"
|
||||
t += "<div class='notice icon'>Swipe ID card to unlock interface</div>"
|
||||
t += "<h3>Status</h3>"
|
||||
t += "Main Breaker: <B>[operating ? "<font class='good'>On</font>" : "<font class='bad'>Off</font>"]</B><br />"
|
||||
t += "External Power: <B>[ main_status ? (main_status ==2 ? "<font class='good'>Good</font>" : "<font class='average'>Low</font>") : "<font class='bad'>None</font>"]</B><br />"
|
||||
t += "Power Cell: <B>[cell ? "[round(cell.percent())]%" : "<font COLOR=red>Not connected.</font>"]</B>"
|
||||
if(cell)
|
||||
t += "<BR/>Charge Mode: [chargemode ? "Auto" : "Off"]"
|
||||
t += " ([charging ? ( charging == 1 ? "Charging" : "Fully charged" ) : "Not charging"])"
|
||||
t += " ([chargemode ? "Auto" : "Off"])"
|
||||
|
||||
t += "<BR><HR>Power channels<BR><PRE>"
|
||||
t += "<h3>Power Channels</h3><PRE>"
|
||||
|
||||
var/list/L = list ("Off","Off (Auto)", "On", "On (Auto)")
|
||||
|
||||
t += "Equipment: [add_lspace(lastused_equip, 6)] W : <B>[L[equipment+1]]</B><BR>"
|
||||
t += "Lighting: [add_lspace(lastused_light, 6)] W : <B>[L[lighting+1]]</B><BR>"
|
||||
t += "Environmental:[add_lspace(lastused_environ, 6)] W : <B>[L[environ+1]]</B><BR>"
|
||||
t += "Equipment: [add_lspace(lastused_equip, 6)] W : <B>[L[equipment+1]]</B><br />"
|
||||
t += "Lighting: [add_lspace(lastused_light, 6)] W : <B>[L[lighting+1]]</B><br />"
|
||||
t += "Environmental:[add_lspace(lastused_environ, 6)] W : <B>[L[environ+1]]</B><br />"
|
||||
|
||||
t += "<BR>Total load: [lastused_light + lastused_equip + lastused_environ] W</PRE>"
|
||||
t += "<HR>Cover lock: <B>[coverlocked ? "Engaged" : "Disengaged"]</B>"
|
||||
t += "<br />Total Load: [lastused_light + lastused_equip + lastused_environ] W</PRE>"
|
||||
t += "<br />Cover Lock: <B>[coverlocked ? "Engaged" : "Disengaged"]</B>"
|
||||
|
||||
else
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
t += "<I>(Swipe ID card to lock interface.)</I><BR>"
|
||||
t += "Main breaker: [operating ? "<B>On</B> <A href='?src=\ref[src];breaker=1'>Off</A>" : "<A href='?src=\ref[src];breaker=1'>On</A> <B>Off</B>" ]<BR>"
|
||||
t += "External power : <B>[ main_status ? (main_status ==2 ? "<FONT COLOR=#004000>Good</FONT>" : "<FONT COLOR=#D09000>Low</FONT>") : "<FONT COLOR=#F00000>None</FONT>"]</B><BR>"
|
||||
t += "<div class='notice icon'>Swipe ID card to lock interface</div>"
|
||||
t += "<h3>Status</h3>"
|
||||
t += "Main Breaker: [operating ? "<span class='linkOn'>On</span> <A href='?src=\ref[src];breaker=1'>Off</A>" : "<A href='?src=\ref[src];breaker=1'>On</A> <span class='linkOn'>Off</span>" ]<br />"
|
||||
t += "External power : <B>[ main_status ? (main_status ==2 ? "<font class='good'>Good</font>" : "<font class='average'>Low</font>") : "<font class='bad'>None</font>"]</B><br />"
|
||||
if(cell)
|
||||
t += "Power cell: <B>[round(cell.percent())]%</B>"
|
||||
t += "<BR/>Charge mode: [chargemode ? "<A href='?src=\ref[src];cmode=1'>Off</A> <span class='linkOn'>Auto</span>" : "<span class='linkOn'>Off</span> <A href='?src=\ref[src];cmode=1'>Auto</A>"]"
|
||||
t += " ([charging ? ( charging == 1 ? "Charging" : "Fully charged" ) : "Not charging"])"
|
||||
t += " ([chargemode ? "<A href='?src=\ref[src];cmode=1'>Off</A> <B>Auto</B>" : "<B>Off</B> <A href='?src=\ref[src];cmode=1'>Auto</A>"])"
|
||||
|
||||
else
|
||||
t += "Power cell: <B><FONT COLOR=red>Not connected.</FONT></B>"
|
||||
|
||||
t += "<BR><HR>Power channels<BR><PRE>"
|
||||
t += "Power cell: <B><font COLOR=red>Not connected.</font></B>"
|
||||
|
||||
t += "<br /><h3>Power channels</h3><PRE>"
|
||||
|
||||
t += "Equipment: [add_lspace(lastused_equip, 6)] W : "
|
||||
var/key = "eqp"
|
||||
switch(equipment)
|
||||
if(0)
|
||||
t += "<B>Off</B> <A href='?src=\ref[src];eqp=2'>On</A> <A href='?src=\ref[src];eqp=3'>Auto</A>"
|
||||
t += "<span class='linkOn'>Off</span> <A href='?src=\ref[src];[key]=2'>On</A> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(1)
|
||||
t += "<A href='?src=\ref[src];eqp=1'>Off</A> <A href='?src=\ref[src];eqp=2'>On</A> <B>Auto (Off)</B>"
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (Off)</span>"
|
||||
if(2)
|
||||
t += "<A href='?src=\ref[src];eqp=1'>Off</A> <B>On</B> <A href='?src=\ref[src];eqp=3'>Auto</A>"
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <span class='linkOn'>On</span> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(3)
|
||||
t += "<A href='?src=\ref[src];eqp=1'>Off</A> <A href='?src=\ref[src];eqp=2'>On</A> <B>Auto (On)</B>"
|
||||
t +="<BR>"
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (On)</span>"
|
||||
t +="<br />"
|
||||
|
||||
t += "Lighting: [add_lspace(lastused_light, 6)] W : "
|
||||
|
||||
key = "lgt"
|
||||
switch(lighting)
|
||||
if(0)
|
||||
t += "<B>Off</B> <A href='?src=\ref[src];lgt=2'>On</A> <A href='?src=\ref[src];lgt=3'>Auto</A>"
|
||||
t += "<span class='linkOn'>Off</span> <A href='?src=\ref[src];[key]=2'>On</A> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(1)
|
||||
t += "<A href='?src=\ref[src];lgt=1'>Off</A> <A href='?src=\ref[src];lgt=2'>On</A> <B>Auto (Off)</B>"
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (Off)</span>"
|
||||
if(2)
|
||||
t += "<A href='?src=\ref[src];lgt=1'>Off</A> <B>On</B> <A href='?src=\ref[src];lgt=3'>Auto</A>"
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <span class='linkOn'>On</span> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(3)
|
||||
t += "<A href='?src=\ref[src];lgt=1'>Off</A> <A href='?src=\ref[src];lgt=2'>On</A> <B>Auto (On)</B>"
|
||||
t +="<BR>"
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (On)</span>"
|
||||
t +="<br />"
|
||||
|
||||
|
||||
t += "Environmental:[add_lspace(lastused_environ, 6)] W : "
|
||||
key = "env"
|
||||
switch(environ)
|
||||
if(0)
|
||||
t += "<B>Off</B> <A href='?src=\ref[src];env=2'>On</A> <A href='?src=\ref[src];env=3'>Auto</A>"
|
||||
t += "<span class='linkOn'>Off</span> <A href='?src=\ref[src];[key]=2'>On</A> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(1)
|
||||
t += "<A href='?src=\ref[src];env=1'>Off</A> <A href='?src=\ref[src];env=2'>On</A> <B>Auto (Off)</B>"
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (Off)</span>"
|
||||
if(2)
|
||||
t += "<A href='?src=\ref[src];env=1'>Off</A> <B>On</B> <A href='?src=\ref[src];env=3'>Auto</A>"
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <span class='linkOn'>On</span> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(3)
|
||||
t += "<A href='?src=\ref[src];env=1'>Off</A> <A href='?src=\ref[src];env=2'>On</A> <B>Auto (On)</B>"
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (On)</span>"
|
||||
|
||||
|
||||
|
||||
t += "<BR>Total load: [lastused_light + lastused_equip + lastused_environ] W</PRE>"
|
||||
t += "<HR>Cover lock: [coverlocked ? "<B><A href='?src=\ref[src];lock=1'>Engaged</A></B>" : "<B><A href='?src=\ref[src];lock=1'>Disengaged</A></B>"]"
|
||||
t += "<br />Total Load: [lastused_light + lastused_equip + lastused_environ] W</PRE>"
|
||||
t += "<br />Cover Lock: [coverlocked ? "<B><A href='?src=\ref[src];lock=1'>Engaged</A></B>" : "<B><A href='?src=\ref[src];lock=1'>Disengaged</A></B>"]"
|
||||
|
||||
|
||||
if (istype(user, /mob/living/silicon))
|
||||
t += "<BR><HR><A href='?src=\ref[src];overload=1'><I>Overload lighting circuit</I></A><BR>"
|
||||
t += "<br /><A href='?src=\ref[src];overload=1'><I>Overload lighting circuit</I></A><br />"
|
||||
if (ticker && ticker.mode)
|
||||
// world << "there's a ticker"
|
||||
if(user.mind in ticker.mode.malf_ai)
|
||||
// world << "ticker says its malf"
|
||||
if (!src.malfai)
|
||||
t += "<BR><HR><A href='?src=\ref[src];malfhack=1'><I>Override Programming</I></A><BR>"
|
||||
t += "<br /><A href='?src=\ref[src];malfhack=1'><I>Override Programming</I></A><br />"
|
||||
else
|
||||
t += "<BR><HR><I>APC Hacked</I><BR>"
|
||||
t += "<br /><I>APC Hacked</I><br />"
|
||||
if(!src.occupant)
|
||||
t += "<A href='?src=\ref[src];occupyapc=1'><I>Shunt Core Processes</I></A><BR>"
|
||||
t += "<A href='?src=\ref[src];occupyapc=1'><I>Shunt Core Processes</I></A><br />"
|
||||
else
|
||||
t += "<I>Core Processes Uploaded</I><BR>"
|
||||
t += "<I>Core Processes Uploaded</I><br />"
|
||||
|
||||
t += "<BR><HR><A href='?src=\ref[src];close=1'>Close</A>"
|
||||
//t += "<br /><HR><A href='?src=\ref[src];close=1'>Close</A>"
|
||||
|
||||
t += "</TT></body></html>"
|
||||
user << browse(t, "window=apc")
|
||||
onclose(user, "apc")
|
||||
//user << browse(t, "window=apc")
|
||||
//onclose(user, "apc")
|
||||
var/datum/browser/popup = new(user, "apc", "[area.name] APC")
|
||||
popup.set_content(t)
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.open()
|
||||
return
|
||||
|
||||
/obj/machinery/power/apc/proc/report()
|
||||
@@ -722,87 +633,9 @@
|
||||
// world << "[area.power_equip]"
|
||||
area.power_change()
|
||||
|
||||
/obj/machinery/power/apc/proc/isWireColorCut(var/wireColor)
|
||||
var/wireFlag = APCWireColorToFlag[wireColor]
|
||||
return ((src.apcwires & wireFlag) == 0)
|
||||
|
||||
/obj/machinery/power/apc/proc/isWireCut(var/wireIndex)
|
||||
var/wireFlag = APCIndexToFlag[wireIndex]
|
||||
return ((src.apcwires & wireFlag) == 0)
|
||||
return wires.IsIndexCut(wireIndex)
|
||||
|
||||
/obj/machinery/power/apc/proc/cut(var/wireColor)
|
||||
var/wireFlag = APCWireColorToFlag[wireColor]
|
||||
var/wireIndex = APCWireColorToIndex[wireColor]
|
||||
apcwires &= ~wireFlag
|
||||
switch(wireIndex)
|
||||
if(APC_WIRE_MAIN_POWER1)
|
||||
src.shock(usr, 50)
|
||||
src.shorted = 1
|
||||
src.updateDialog()
|
||||
if(APC_WIRE_MAIN_POWER2)
|
||||
src.shock(usr, 50)
|
||||
src.shorted = 1
|
||||
src.updateDialog()
|
||||
if (APC_WIRE_AI_CONTROL)
|
||||
if (src.aidisabled == 0)
|
||||
src.aidisabled = 1
|
||||
src.updateDialog()
|
||||
// if(APC_WIRE_IDSCAN) nothing happens when you cut this wire, add in something if you want whatever
|
||||
|
||||
/obj/machinery/power/apc/proc/mend(var/wireColor)
|
||||
var/wireFlag = APCWireColorToFlag[wireColor]
|
||||
var/wireIndex = APCWireColorToIndex[wireColor] //not used in this function
|
||||
apcwires |= wireFlag
|
||||
switch(wireIndex)
|
||||
if(APC_WIRE_MAIN_POWER1)
|
||||
if ((!src.isWireCut(APC_WIRE_MAIN_POWER1)) && (!src.isWireCut(APC_WIRE_MAIN_POWER2)))
|
||||
src.shorted = 0
|
||||
src.shock(usr, 50)
|
||||
src.updateDialog()
|
||||
if(APC_WIRE_MAIN_POWER2)
|
||||
if ((!src.isWireCut(APC_WIRE_MAIN_POWER1)) && (!src.isWireCut(APC_WIRE_MAIN_POWER2)))
|
||||
src.shorted = 0
|
||||
src.shock(usr, 50)
|
||||
src.updateDialog()
|
||||
if (APC_WIRE_AI_CONTROL)
|
||||
//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.
|
||||
//aidisabledDisabled: 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 (src.aidisabled == 1)
|
||||
src.aidisabled = 0
|
||||
src.updateDialog()
|
||||
// if(APC_WIRE_IDSCAN) nothing happens when you cut this wire, add in something if you want whatever
|
||||
|
||||
/obj/machinery/power/apc/proc/pulse(var/wireColor)
|
||||
//var/wireFlag = apcWireColorToFlag[wireColor] //not used in this function
|
||||
var/wireIndex = APCWireColorToIndex[wireColor]
|
||||
switch(wireIndex)
|
||||
if(APC_WIRE_IDSCAN) //unlocks the APC for 30 seconds, if you have a better way to hack an APC I'm all ears
|
||||
src.locked = 0
|
||||
spawn(300)
|
||||
src.locked = 1
|
||||
src.updateDialog()
|
||||
if (APC_WIRE_MAIN_POWER1)
|
||||
if(shorted == 0)
|
||||
shorted = 1
|
||||
spawn(1200)
|
||||
if(shorted == 1)
|
||||
shorted = 0
|
||||
src.updateDialog()
|
||||
if (APC_WIRE_MAIN_POWER2)
|
||||
if(shorted == 0)
|
||||
shorted = 1
|
||||
spawn(1200)
|
||||
if(shorted == 1)
|
||||
shorted = 0
|
||||
src.updateDialog()
|
||||
if (APC_WIRE_AI_CONTROL)
|
||||
if (src.aidisabled == 0)
|
||||
src.aidisabled = 1
|
||||
src.updateDialog()
|
||||
spawn(10)
|
||||
if (src.aidisabled == 1)
|
||||
src.aidisabled = 0
|
||||
src.updateDialog()
|
||||
|
||||
/obj/machinery/power/apc/proc/can_use(mob/user as mob, var/loud = 0) //used by attack_hand() and Topic()
|
||||
if (user.stat)
|
||||
@@ -856,43 +689,21 @@
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/apc/Topic(href, href_list, var/usingUI = 1)
|
||||
if(!(isrobot(usr) && (href_list["apcwires"] || href_list["pulse"])))
|
||||
/obj/machinery/power/apc/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(!isrobot(usr))
|
||||
if(!can_use(usr, 1))
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
|
||||
usr.set_machine(src)
|
||||
if (href_list["apcwires"])
|
||||
var/t1 = text2num(href_list["apcwires"])
|
||||
if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
|
||||
usr << "You need wirecutters!"
|
||||
return
|
||||
if (src.isWireColorCut(t1))
|
||||
src.mend(t1)
|
||||
else
|
||||
src.cut(t1)
|
||||
else if (href_list["pulse"])
|
||||
var/t1 = text2num(href_list["pulse"])
|
||||
if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
|
||||
usr << "You need a multitool!"
|
||||
return
|
||||
if (src.isWireColorCut(t1))
|
||||
usr << "You can't pulse a cut wire."
|
||||
return
|
||||
else
|
||||
src.pulse(t1)
|
||||
else if (href_list["lock"])
|
||||
|
||||
if (href_list["lock"])
|
||||
coverlocked = !coverlocked
|
||||
|
||||
else if (href_list["breaker"])
|
||||
operating = !operating
|
||||
if(malfai)
|
||||
if (ticker.mode.config_tag == "malfunction")
|
||||
if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas))
|
||||
operating ? ticker.mode:apcs++ : ticker.mode:apcs--
|
||||
|
||||
src.update()
|
||||
update_icon()
|
||||
toggle_breaker()
|
||||
|
||||
else if (href_list["cmode"])
|
||||
chargemode = !chargemode
|
||||
@@ -903,25 +714,24 @@
|
||||
else if (href_list["eqp"])
|
||||
var/val = text2num(href_list["eqp"])
|
||||
|
||||
equipment = (val==1) ? 0 : val
|
||||
|
||||
equipment = setsubsystem(val)
|
||||
update_icon()
|
||||
update()
|
||||
|
||||
else if (href_list["lgt"])
|
||||
var/val = text2num(href_list["lgt"])
|
||||
|
||||
lighting = (val==1) ? 0 : val
|
||||
|
||||
lighting = setsubsystem(val)
|
||||
update_icon()
|
||||
update()
|
||||
|
||||
else if (href_list["env"])
|
||||
var/val = text2num(href_list["env"])
|
||||
|
||||
environ = (val==1) ? 0 :val
|
||||
|
||||
environ = setsubsystem(val)
|
||||
update_icon()
|
||||
update()
|
||||
|
||||
else if( href_list["close"] )
|
||||
usr << browse(null, "window=apc")
|
||||
usr.unset_machine()
|
||||
@@ -957,21 +767,29 @@
|
||||
else
|
||||
src.malfai = usr
|
||||
malfai << "Hack complete. The APC is now under your exclusive control."
|
||||
src.malfhack = 1
|
||||
update_icon()
|
||||
|
||||
else if (href_list["occupyapc"])
|
||||
malfoccupy(usr)
|
||||
|
||||
|
||||
else if (href_list["deoccupyapc"])
|
||||
malfvacate()
|
||||
|
||||
if(usingUI)
|
||||
src.updateDialog()
|
||||
src.updateDialog()
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/power/apc/proc/toggle_breaker()
|
||||
operating = !operating
|
||||
|
||||
if(malfai)
|
||||
if (ticker.mode.config_tag == "malfunction")
|
||||
if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas))
|
||||
operating ? ticker.mode:apcs++ : ticker.mode:apcs--
|
||||
|
||||
src.update()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/power/apc/proc/malfoccupy(var/mob/living/silicon/ai/malf)
|
||||
if(!istype(malf))
|
||||
return
|
||||
@@ -999,6 +817,10 @@
|
||||
src.occupant.verbs += /datum/game_mode/malfunction/proc/takeover
|
||||
src.occupant.cancel_camera()
|
||||
|
||||
for(var/obj/item/weapon/pinpointer/point in world)
|
||||
point.the_disk = src //the pinpointer will detect the shunted AI
|
||||
|
||||
|
||||
/obj/machinery/power/apc/proc/malfvacate(var/forced)
|
||||
if(!src.occupant)
|
||||
return
|
||||
@@ -1015,6 +837,9 @@
|
||||
src.occupant.death()
|
||||
src.occupant.gib()
|
||||
|
||||
for(var/obj/item/weapon/pinpointer/point in world)
|
||||
point.the_disk = null //the pinpointer will go back to pointing at the nuke disc.
|
||||
|
||||
|
||||
/obj/machinery/power/apc/proc/ion_act()
|
||||
//intended to be exactly the same as an AI malf attack
|
||||
@@ -1103,8 +928,8 @@
|
||||
|
||||
if(cell && !shorted)
|
||||
|
||||
// draw power from cell as before
|
||||
|
||||
// draw power from cell as before
|
||||
var/cellused = min(cell.charge, CELLRATE * lastused_total) // clamp deduction to a max, amount left in cell
|
||||
cell.use(cellused)
|
||||
|
||||
@@ -1223,8 +1048,7 @@
|
||||
// val 0=off, 1=off(auto) 2=on 3=on(auto)
|
||||
// on 0=off, 1=on, 2=autooff
|
||||
|
||||
/proc/autoset(var/val, var/on)
|
||||
|
||||
obj/machinery/power/apc/proc/autoset(var/val, var/on)
|
||||
if(on==0)
|
||||
if(val==2) // if on, return off
|
||||
return 0
|
||||
@@ -1295,8 +1119,8 @@
|
||||
ticker.mode:apcs--
|
||||
stat |= BROKEN
|
||||
operating = 0
|
||||
/*if(occupant)
|
||||
malfvacate(1)*/
|
||||
if(occupant)
|
||||
malfvacate(1)
|
||||
update_icon()
|
||||
update()
|
||||
|
||||
@@ -1323,8 +1147,8 @@
|
||||
area.power_equip = 0
|
||||
area.power_environ = 0
|
||||
area.power_change()
|
||||
/*if(occupant)
|
||||
malfvacate(1)*/
|
||||
if(occupant)
|
||||
malfvacate(1)
|
||||
..()
|
||||
|
||||
/obj/machinery/power/apc/proc/shock(mob/user, prb)
|
||||
@@ -1340,4 +1164,12 @@
|
||||
else
|
||||
return 0
|
||||
|
||||
/obj/machinery/power/apc/proc/setsubsystem(val)
|
||||
if(cell && cell.charge > 0)
|
||||
return (val==1) ? 0 : val
|
||||
else if(val == 3)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
#undef APC_UPDATE_ICON_COOLDOWN
|
||||
@@ -23,6 +23,48 @@
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/structure/cable
|
||||
level = 1
|
||||
anchored =1
|
||||
var/datum/powernet/powernet
|
||||
name = "power cable"
|
||||
desc = "A flexible superconducting cable for heavy-duty power transfer"
|
||||
icon = 'icons/obj/power_cond/power_cond_red.dmi'
|
||||
icon_state = "0-1"
|
||||
var/d1 = 0
|
||||
var/d2 = 1
|
||||
layer = 2.44 //Just below unary stuff, which is at 2.45 and above pipes, which are at 2.4
|
||||
var/cable_color = "red"
|
||||
var/obj/structure/powerswitch/power_switch
|
||||
|
||||
/obj/structure/cable/yellow
|
||||
cable_color = "yellow"
|
||||
icon = 'icons/obj/power_cond/power_cond_yellow.dmi'
|
||||
|
||||
/obj/structure/cable/green
|
||||
cable_color = "green"
|
||||
icon = 'icons/obj/power_cond/power_cond_green.dmi'
|
||||
|
||||
/obj/structure/cable/blue
|
||||
cable_color = "blue"
|
||||
icon = 'icons/obj/power_cond/power_cond_blue.dmi'
|
||||
|
||||
/obj/structure/cable/pink
|
||||
cable_color = "pink"
|
||||
icon = 'icons/obj/power_cond/power_cond_pink.dmi'
|
||||
|
||||
/obj/structure/cable/orange
|
||||
cable_color = "orange"
|
||||
icon = 'icons/obj/power_cond/power_cond_orange.dmi'
|
||||
|
||||
/obj/structure/cable/cyan
|
||||
cable_color = "cyan"
|
||||
icon = 'icons/obj/power_cond/power_cond_cyan.dmi'
|
||||
|
||||
/obj/structure/cable/white
|
||||
cable_color = "white"
|
||||
icon = 'icons/obj/power_cond/power_cond_white.dmi'
|
||||
|
||||
// the power cable object
|
||||
|
||||
/obj/structure/cable/New()
|
||||
@@ -67,7 +109,6 @@
|
||||
/obj/structure/cable/proc/get_powernet() //TODO: remove this as it is obsolete
|
||||
return powernet
|
||||
|
||||
|
||||
/obj/structure/cable/attack_tk(mob/user)
|
||||
return
|
||||
|
||||
@@ -87,16 +128,17 @@
|
||||
return
|
||||
|
||||
if(src.d1) // 0-X cables are 1 unit, X-X cables are 2 units long
|
||||
new/obj/item/weapon/cable_coil(T, 2, _color)
|
||||
new/obj/item/weapon/cable_coil(T, 2, cable_color)
|
||||
else
|
||||
new/obj/item/weapon/cable_coil(T, 1, _color)
|
||||
new/obj/item/weapon/cable_coil(T, 1, cable_color)
|
||||
|
||||
for(var/mob/O in viewers(src, null))
|
||||
O.show_message("\red [user] cuts the cable.", 1)
|
||||
|
||||
del(src)
|
||||
investigate_log("was cut by [key_name(usr, usr.client)] in [user.loc.loc]","wires")
|
||||
|
||||
return // not needed, but for clarity
|
||||
del(src)
|
||||
return
|
||||
|
||||
|
||||
else if(istype(W, /obj/item/weapon/cable_coil))
|
||||
@@ -140,12 +182,12 @@
|
||||
del(src)
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
new/obj/item/weapon/cable_coil(src.loc, src.d1 ? 2 : 1, _color)
|
||||
new/obj/item/weapon/cable_coil(src.loc, src.d1 ? 2 : 1, cable_color)
|
||||
del(src)
|
||||
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
new/obj/item/weapon/cable_coil(src.loc, src.d1 ? 2 : 1, _color)
|
||||
new/obj/item/weapon/cable_coil(src.loc, src.d1 ? 2 : 1, cable_color)
|
||||
del(src)
|
||||
return
|
||||
|
||||
@@ -156,6 +198,7 @@
|
||||
name = "cable coil"
|
||||
icon = 'icons/obj/power.dmi'
|
||||
icon_state = "coil_red"
|
||||
item_state = "coil_red"
|
||||
var/amount = MAXCOIL
|
||||
_color = "red"
|
||||
desc = "A coil of power cable."
|
||||
@@ -167,11 +210,13 @@
|
||||
g_amt = 20
|
||||
flags = TABLEPASS | FPRINT | CONDUCT
|
||||
slot_flags = SLOT_BELT
|
||||
item_state = "coil_red"
|
||||
attack_verb = list("whipped", "lashed", "disciplined", "flogged")
|
||||
|
||||
suicide_act(mob/user)
|
||||
viewers(user) << "\red <b>[user] is strangling \himself with the [src.name]! It looks like \he's trying to commit suicide.</b>"
|
||||
if(locate(/obj/structure/stool) in user.loc)
|
||||
viewers(user) << "\red <b>[user] is making a noose with the [src.name]! It looks like \he's trying to commit suicide.</b>"
|
||||
else
|
||||
viewers(user) << "\red <b>[user] is strangling \himself with the [src.name]! It looks like \he's trying to commit suicide.</b>"
|
||||
return(OXYLOSS)
|
||||
|
||||
|
||||
@@ -182,9 +227,9 @@
|
||||
_color = param_color
|
||||
pixel_x = rand(-2,2)
|
||||
pixel_y = rand(-2,2)
|
||||
updateicon()
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/cable_coil/proc/updateicon()
|
||||
/obj/item/weapon/cable_coil/update_icon()
|
||||
if (!_color)
|
||||
_color = pick("red", "yellow", "blue", "green")
|
||||
if(amount == 1)
|
||||
@@ -231,40 +276,49 @@
|
||||
src.amount--
|
||||
new/obj/item/weapon/cable_coil(user.loc, 1,_color)
|
||||
user << "You cut a piece off the cable coil."
|
||||
src.updateicon()
|
||||
src.update_icon()
|
||||
return
|
||||
|
||||
else if( istype(W, /obj/item/weapon/cable_coil) )
|
||||
var/obj/item/weapon/cable_coil/C = W
|
||||
if(C.amount == MAXCOIL)
|
||||
if(C.amount >= MAXCOIL)
|
||||
user << "The coil is too long, you cannot add any more cable to it."
|
||||
return
|
||||
|
||||
if( (C.amount + src.amount <= MAXCOIL) )
|
||||
C.amount += src.amount
|
||||
user << "You join the cable coils together."
|
||||
C.updateicon()
|
||||
del(src)
|
||||
C.give(src.amount) // give it cable
|
||||
src.use(src.amount) // make sure this one cleans up right
|
||||
return
|
||||
|
||||
else
|
||||
user << "You transfer [MAXCOIL - src.amount ] length\s of cable from one coil to the other."
|
||||
src.amount -= (MAXCOIL-C.amount)
|
||||
src.updateicon()
|
||||
C.amount = MAXCOIL
|
||||
C.updateicon()
|
||||
var/amt = MAXCOIL - C.amount
|
||||
user << "You transfer [amt] length\s of cable from one coil to the other."
|
||||
C.give(amt)
|
||||
src.use(amt)
|
||||
return
|
||||
|
||||
/obj/item/weapon/cable_coil/proc/use(var/used)
|
||||
if(src.amount < used)
|
||||
return 0
|
||||
else if (src.amount == used)
|
||||
//handle mob icon update
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.u_equip(src)
|
||||
del(src)
|
||||
else
|
||||
amount -= used
|
||||
updateicon()
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
/obj/item/weapon/cable_coil/proc/give(var/extra)
|
||||
if(amount + extra > MAXCOIL)
|
||||
amount = MAXCOIL
|
||||
else
|
||||
amount += extra
|
||||
update_icon()
|
||||
|
||||
// called when cable_coil is clicked on a turf/simulated/floor
|
||||
|
||||
/obj/item/weapon/cable_coil/proc/turf_place(turf/simulated/floor/F, mob/user)
|
||||
@@ -313,7 +367,7 @@
|
||||
use(1)
|
||||
if (C.shock(user, 50))
|
||||
if (prob(50)) //fail
|
||||
new/obj/item/weapon/cable_coil(C.loc, 1, C._color)
|
||||
new/obj/item/weapon/cable_coil(C.loc, 1, C.cable_color)
|
||||
del(C)
|
||||
//src.laying = 1
|
||||
//last = C
|
||||
@@ -373,7 +427,7 @@
|
||||
use(1)
|
||||
if (NC.shock(user, 50))
|
||||
if (prob(50)) //fail
|
||||
new/obj/item/weapon/cable_coil(NC.loc, 1, NC._color)
|
||||
new/obj/item/weapon/cable_coil(NC.loc, 1, NC.cable_color)
|
||||
del(NC)
|
||||
|
||||
return
|
||||
@@ -412,7 +466,7 @@
|
||||
use(1)
|
||||
if (C.shock(user, 50))
|
||||
if (prob(50)) //fail
|
||||
new/obj/item/weapon/cable_coil(C.loc, 2, C._color)
|
||||
new/obj/item/weapon/cable_coil(C.loc, 2, C.cable_color)
|
||||
del(C)
|
||||
|
||||
return
|
||||
@@ -488,24 +542,24 @@ obj/structure/cable/proc/cableColor(var/colorC)
|
||||
var/color_n = "red"
|
||||
if(colorC)
|
||||
color_n = colorC
|
||||
_color = color_n
|
||||
cable_color = color_n
|
||||
switch(colorC)
|
||||
if("red")
|
||||
icon = 'icons/obj/power_cond_red.dmi'
|
||||
icon = 'icons/obj/power_cond/power_cond_red.dmi'
|
||||
if("yellow")
|
||||
icon = 'icons/obj/power_cond_yellow.dmi'
|
||||
icon = 'icons/obj/power_cond/power_cond_yellow.dmi'
|
||||
if("green")
|
||||
icon = 'icons/obj/power_cond_green.dmi'
|
||||
icon = 'icons/obj/power_cond/power_cond_green.dmi'
|
||||
if("blue")
|
||||
icon = 'icons/obj/power_cond_blue.dmi'
|
||||
icon = 'icons/obj/power_cond/power_cond_blue.dmi'
|
||||
if("pink")
|
||||
icon = 'icons/obj/power_cond_pink.dmi'
|
||||
icon = 'icons/obj/power_cond/power_cond_pink.dmi'
|
||||
if("orange")
|
||||
icon = 'icons/obj/power_cond_orange.dmi'
|
||||
icon = 'icons/obj/power_cond/power_cond_orange.dmi'
|
||||
if("cyan")
|
||||
icon = 'icons/obj/power_cond_cyan.dmi'
|
||||
icon = 'icons/obj/power_cond/power_cond_cyan.dmi'
|
||||
if("white")
|
||||
icon = 'icons/obj/power_cond_white.dmi'
|
||||
icon = 'icons/obj/power_cond/power_cond_white.dmi'
|
||||
|
||||
/obj/item/weapon/cable_coil/cut
|
||||
item_state = "coil_red2"
|
||||
@@ -515,7 +569,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
|
||||
src.amount = rand(1,2)
|
||||
pixel_x = rand(-2,2)
|
||||
pixel_y = rand(-2,2)
|
||||
updateicon()
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/cable_coil/yellow
|
||||
_color = "yellow"
|
||||
@@ -524,6 +578,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
|
||||
/obj/item/weapon/cable_coil/blue
|
||||
_color = "blue"
|
||||
icon_state = "coil_blue"
|
||||
item_state = "coil_blue"
|
||||
|
||||
/obj/item/weapon/cable_coil/green
|
||||
_color = "green"
|
||||
@@ -549,23 +604,3 @@ obj/structure/cable/proc/cableColor(var/colorC)
|
||||
_color = pick("red","yellow","green","blue","pink")
|
||||
icon_state = "coil_[_color]"
|
||||
..()
|
||||
|
||||
/obj/item/weapon/cable_coil/attack(mob/M as mob, mob/user as mob)
|
||||
if(hasorgans(M))
|
||||
var/datum/organ/external/S = M:get_organ(user.zone_sel.selecting)
|
||||
if(!(S.status & ORGAN_ROBOT) || user.a_intent != "help")
|
||||
return ..()
|
||||
if(S.burn_dam > 0 && use(1))
|
||||
S.heal_damage(0,15,0,1)
|
||||
if(user != M)
|
||||
user.visible_message("\red \The [user] repairs some burn damage on their [S.display_name] with \the [src]",\
|
||||
"\red You repair some burn damage on your [S.display_name]",\
|
||||
"You hear wires being cut.")
|
||||
else
|
||||
user.visible_message("\red \The [user] repairs some burn damage on their [S.display_name] with \the [src]",\
|
||||
"\red You repair some burn damage on your [S.display_name]",\
|
||||
"You hear wires being cut.")
|
||||
else
|
||||
user << "Nothing to fix!"
|
||||
else
|
||||
return ..()
|
||||
|
||||
BIN
icons/obj/power_cond/power_cond_blue.dmi
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
icons/obj/power_cond/power_cond_cyan.dmi
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
icons/obj/power_cond/power_cond_green.dmi
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
icons/obj/power_cond/power_cond_heavy.dmi
Normal file
|
After Width: | Height: | Size: 1019 B |
BIN
icons/obj/power_cond/power_cond_orange.dmi
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
icons/obj/power_cond/power_cond_pink.dmi
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
icons/obj/power_cond/power_cond_red.dmi
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
icons/obj/power_cond/power_cond_white.dmi
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
icons/obj/power_cond/power_cond_yellow.dmi
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
icons/obj/power_cond/power_local.dmi
Normal file
|
After Width: | Height: | Size: 1.8 KiB |