mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
Refactor wire datums
Finish wire port and refactor wire datums to use string keys; widen color range to support more wires and more colors.
This commit is contained in:
+125
-155
@@ -1,195 +1,165 @@
|
||||
// Wires for airlocks
|
||||
/datum/wires/airlock
|
||||
var/const/W_POWER1 = "power1"
|
||||
var/const/W_POWER2 = "power2"
|
||||
var/const/W_BACKUP1 = "backup1"
|
||||
var/const/W_BACKUP2 = "backup2"
|
||||
var/const/W_OPEN = "open"
|
||||
var/const/W_BOLTS = "bolts"
|
||||
var/const/W_IDSCAN = "idscan"
|
||||
var/const/W_AI = "ai"
|
||||
var/const/W_SHOCK = "shock"
|
||||
var/const/W_SAFETY = "safety"
|
||||
var/const/W_TIMING = "timing"
|
||||
var/const/W_LIGHT = "light"
|
||||
var/const/W_ZAP1 = "zap1"
|
||||
var/const/W_ZAP2 = "zap2"
|
||||
|
||||
holder_type = /obj/machinery/door/airlock
|
||||
|
||||
/datum/wires/airlock/secure
|
||||
random = 1
|
||||
randomize = TRUE
|
||||
|
||||
/datum/wires/airlock
|
||||
holder_type = /obj/machinery/door/airlock
|
||||
wire_count = 12
|
||||
window_y = 570
|
||||
/datum/wires/airlock/New(atom/holder)
|
||||
wires = list(
|
||||
W_POWER1, W_POWER2,
|
||||
W_BACKUP1, W_BACKUP2,
|
||||
W_OPEN, W_BOLTS, W_IDSCAN, W_AI,
|
||||
W_SHOCK, W_SAFETY, W_TIMING, W_LIGHT,
|
||||
W_ZAP1, W_ZAP2
|
||||
)
|
||||
add_duds(2)
|
||||
..()
|
||||
|
||||
var/const/AIRLOCK_WIRE_IDSCAN = 1
|
||||
var/const/AIRLOCK_WIRE_MAIN_POWER1 = 2
|
||||
var/const/AIRLOCK_WIRE_MAIN_POWER2 = 4
|
||||
var/const/AIRLOCK_WIRE_DOOR_BOLTS = 8
|
||||
var/const/AIRLOCK_WIRE_BACKUP_POWER1 = 16
|
||||
var/const/AIRLOCK_WIRE_BACKUP_POWER2 = 32
|
||||
var/const/AIRLOCK_WIRE_OPEN_DOOR = 64
|
||||
var/const/AIRLOCK_WIRE_AI_CONTROL = 128
|
||||
var/const/AIRLOCK_WIRE_ELECTRIFY = 256
|
||||
var/const/AIRLOCK_WIRE_SAFETY = 512
|
||||
var/const/AIRLOCK_WIRE_SPEED = 1024
|
||||
var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
|
||||
/datum/wires/airlock/CanUse(var/mob/living/L)
|
||||
/datum/wires/airlock/interactable(mob/user)
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
if(!istype(L, /mob/living/silicon))
|
||||
if(A.isElectrified())
|
||||
if(A.shock(L, 100))
|
||||
return 0
|
||||
if(!istype(user, /mob/living/silicon) && A.isElectrified() && A.shock(user, 100))
|
||||
return FALSE
|
||||
if(A.p_open)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
|
||||
/datum/wires/airlock/getStatus()
|
||||
/datum/wires/airlock/get_status()
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
var/list/status = list()
|
||||
status.Add(A.locked ? "The door bolts have fallen!" : "The door bolts look up.")
|
||||
status.Add(A.hasPower() ? "The test light is on." : "The test light is off!")
|
||||
status.Add((A.aiControlDisabled==0 && !A.emagged) ? "The 'AI control allowed' light is on." : "The 'AI control allowed' light is off.")
|
||||
status.Add(A.safe==0 ? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off.")
|
||||
status.Add(A.normalspeed==0 ? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off.")
|
||||
status.Add(A.emergency==0 ? "The emergency lights are off." : "The emergency lights are on.")
|
||||
status.Add("The door bolts [A.locked ? "have fallen!" : "look up."]")
|
||||
status.Add("The test light is [A.hasPower() ? "on" : "off"].")
|
||||
status.Add("The AI connection light is [!A.aiControlDisabled && !A.emagged ? "on" : "off"].")
|
||||
status.Add("The wire warning light is [!A.safe ? "on" : "off"].")
|
||||
status.Add("The timer is powered [A.autoclose ? "on" : "off"].")
|
||||
status.Add("The speed light is [A.normalspeed ? "on" : "off"].")
|
||||
status.Add("The emergency light is [A.emergency ? "on" : "off"].")
|
||||
return status
|
||||
|
||||
/datum/wires/airlock/UpdateCut(var/index, var/mended)
|
||||
|
||||
/datum/wires/airlock/on_pulse(wire)
|
||||
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])")
|
||||
add_logs(usr, A, "electrified", addition="at [A.x],[A.y],[A.z]")
|
||||
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)
|
||||
switch(wire)
|
||||
if(W_POWER1, W_POWER2) // Pulse to loose power.
|
||||
A.loseMainPower()
|
||||
if(W_BACKUP1, W_BACKUP2) // Pulse to loose backup power.
|
||||
A.loseBackupPower()
|
||||
if(W_OPEN) // Pulse to open door (only works not emagged and ID wire is cut or no access is required).
|
||||
if(A.emagged)
|
||||
return
|
||||
if(!A.requiresID() || A.check_access(null))
|
||||
if(A.density)
|
||||
A.open()
|
||||
else
|
||||
A.close()
|
||||
|
||||
if(AIRLOCK_WIRE_LIGHT)
|
||||
A.lights = mended
|
||||
if(W_BOLTS) // Pulse to toggle bolts (but only raise if power is on).
|
||||
if(!A.locked)
|
||||
A.bolt()
|
||||
A.audible_message("<span class='italics'>You hear a click from the bottom of the door.</span>", null, 1)
|
||||
else
|
||||
if(A.hasPower())
|
||||
A.unbolt()
|
||||
A.audible_message("<span class='italics'>You hear a click from the bottom of the door.</span>", null, 1)
|
||||
A.update_icon()
|
||||
|
||||
|
||||
/datum/wires/airlock/UpdatePulsed(index)
|
||||
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
switch(index)
|
||||
if(AIRLOCK_WIRE_IDSCAN)
|
||||
//Sending a pulse through this disables emergency access and flashes the red light on the door (if the door has power).
|
||||
if(W_IDSCAN) // Pulse to disable emergency access and flash red lights.
|
||||
if(A.hasPower() && A.density)
|
||||
A.do_animate("deny")
|
||||
if(A.emergency)
|
||||
A.emergency = 0
|
||||
A.emergency = FALSE
|
||||
A.update_icon()
|
||||
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
|
||||
A.audible_message("<span class='italics'>You hear a click from the bottom of the door.</span>", null, 1)
|
||||
else
|
||||
if(A.hasPower()) //only can raise bolts if power's on
|
||||
A.locked = 0
|
||||
A.audible_message("<span class='italics'>You hear a click from the bottom of the door.</span>", null, 1)
|
||||
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(W_AI) // Pulse to disable W_AI control for 10 ticks (follows same rules as cutting).
|
||||
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)
|
||||
if(W_SHOCK) // Pulse to shock the door for 10 ticks.
|
||||
if(!A.secondsElectrified)
|
||||
A.secondsElectrified = 30
|
||||
A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
|
||||
add_logs(usr, A, "electrified", addition="at [A.x],[A.y],[A.z]")
|
||||
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)
|
||||
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 and it's not emagged
|
||||
if(A.emagged) return
|
||||
if(!A.requiresID() || A.check_access(null))
|
||||
if(A.density) A.open()
|
||||
else A.close()
|
||||
if(AIRLOCK_WIRE_SAFETY)
|
||||
if(W_SAFETY)
|
||||
A.safe = !A.safe
|
||||
if(!A.density)
|
||||
A.close()
|
||||
|
||||
if(AIRLOCK_WIRE_SPEED)
|
||||
if(W_TIMING)
|
||||
A.normalspeed = !A.normalspeed
|
||||
|
||||
if(AIRLOCK_WIRE_LIGHT)
|
||||
if(W_LIGHT)
|
||||
A.lights = !A.lights
|
||||
A.update_icon()
|
||||
|
||||
/datum/wires/airlock/on_cut(wire, mend)
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
switch(wire)
|
||||
if(W_POWER1, W_POWER2) // Cut to loose power, repair all to gain power.
|
||||
if(mend && !is_cut(W_POWER1) && !is_cut(W_POWER2))
|
||||
A.regainMainPower()
|
||||
A.shock(usr, 50)
|
||||
else
|
||||
A.loseMainPower()
|
||||
A.shock(usr, 50)
|
||||
if(W_BACKUP1, W_BACKUP2) // Cut to loose backup power, repair all to gain backup power.
|
||||
if(mend && !is_cut(W_BACKUP1) && !is_cut(W_BACKUP2))
|
||||
A.regainBackupPower()
|
||||
A.shock(usr, 50)
|
||||
else
|
||||
A.loseBackupPower()
|
||||
A.shock(usr, 50)
|
||||
if(W_BOLTS) // Cut to drop bolts, mend does nothing.
|
||||
if(!mend)
|
||||
A.bolt()
|
||||
if(W_AI) // Cut to disable W_AI control, mend to re-enable.
|
||||
if(mend)
|
||||
if(A.aiControlDisabled == 1) // 0 = normal, 1 = locked out, 2 = overridden by W_AI, -1 = previously overridden by W_AI
|
||||
A.aiControlDisabled = 0
|
||||
else if(A.aiControlDisabled == 2)
|
||||
A.aiControlDisabled = -1
|
||||
else
|
||||
if(A.aiControlDisabled == 0)
|
||||
A.aiControlDisabled = 1
|
||||
else if(A.aiControlDisabled == -1)
|
||||
A.aiControlDisabled = 2
|
||||
if(W_SHOCK) // Cut to shock the door, mend to unshock.
|
||||
if(mend)
|
||||
if(A.secondsElectrified)
|
||||
A.secondsElectrified = 0
|
||||
else
|
||||
if(A.secondsElectrified != -1)
|
||||
A.secondsElectrified = -1
|
||||
A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
|
||||
add_logs(usr, A, "electrified", addition="at [A.x],[A.y],[A.z]")
|
||||
if(W_SAFETY) // Cut to disable safeties, mend to re-enable.
|
||||
A.safe = mend
|
||||
if(W_TIMING) // Cut to disable auto-close, mend to re-enable.
|
||||
A.autoclose = mend
|
||||
if(A.autoclose && !A.density)
|
||||
A.close()
|
||||
if(W_LIGHT) // Cut to disable lights, mend to re-enable.
|
||||
A.lights = mend
|
||||
A.update_icon()
|
||||
if(W_ZAP1, W_ZAP2) // Ouch.
|
||||
A.shock(usr, 50)
|
||||
|
||||
+57
-72
@@ -1,96 +1,81 @@
|
||||
/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
|
||||
var/const/W_POWER = "power"
|
||||
var/const/W_IDSCAN = "idscan"
|
||||
var/const/W_AI = "ai"
|
||||
var/const/W_PANIC = "panic"
|
||||
var/const/W_ALARM = "alarm"
|
||||
|
||||
/datum/wires/alarm/New(atom/holder)
|
||||
wires = list(
|
||||
W_POWER,
|
||||
W_IDSCAN, W_AI,
|
||||
W_PANIC, W_ALARM
|
||||
)
|
||||
add_duds(3)
|
||||
..()
|
||||
|
||||
/datum/wires/alarm/CanUse(mob/living/L)
|
||||
/datum/wires/alarm/interactable(mob/user)
|
||||
var/obj/machinery/alarm/A = holder
|
||||
if(A.panel_open && A.buildstage == 2)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
|
||||
/datum/wires/alarm/getStatus()
|
||||
/datum/wires/alarm/get_status()
|
||||
var/obj/machinery/alarm/A = holder
|
||||
var/list/status = list()
|
||||
status.Add(A.locked ? "The Air Alarm is locked." : "The Air Alarm is unlocked.")
|
||||
status.Add((A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!")
|
||||
status.Add(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")
|
||||
status.Add("The interface light is [A.locked ? "red" : "green"].")
|
||||
status.Add("The short indicator is [A.shorted ? "lit" : "off"].")
|
||||
status.Add("The AI connection light is [!A.aidisabled ? "on" : "off"].")
|
||||
return status
|
||||
|
||||
/datum/wires/alarm/UpdateCut(index, mended)
|
||||
/datum/wires/alarm/on_pulse(wire)
|
||||
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,holder))
|
||||
A.post_alert(2)
|
||||
A.update_icon()
|
||||
|
||||
/datum/wires/alarm/UpdatePulsed(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
|
||||
switch(wire)
|
||||
if(W_POWER) // Short out for a long time.
|
||||
if(!A.shorted)
|
||||
A.shorted = TRUE
|
||||
A.update_icon()
|
||||
|
||||
spawn(12000)
|
||||
if(A.shorted == 1)
|
||||
A.shorted = 0
|
||||
if(A.shorted)
|
||||
A.shorted = FALSE
|
||||
A.update_icon()
|
||||
|
||||
|
||||
if (AALARM_WIRE_AI_CONTROL)
|
||||
// world << "AI Control wire pulsed"
|
||||
if (A.aidisabled == 0)
|
||||
A.aidisabled = 1
|
||||
A.updateDialog()
|
||||
if(W_IDSCAN) // Toggle lock.
|
||||
A.locked = !A.locked
|
||||
if(W_AI) // Disable AI control for a while.
|
||||
if(!A.aidisabled)
|
||||
A.aidisabled = TRUE
|
||||
spawn(100)
|
||||
if (A.aidisabled == 1)
|
||||
A.aidisabled = 0
|
||||
|
||||
if(AALARM_WIRE_SYPHON)
|
||||
// world << "Syphon wire pulsed"
|
||||
if(A.aidisabled)
|
||||
A.aidisabled = FALSE
|
||||
if(W_PANIC) // Toggle panic siphon.
|
||||
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,holder))
|
||||
if(W_ALARM) // Clear alarms.
|
||||
if(A.alarm_area.atmosalert(0, holder))
|
||||
A.post_alert(0)
|
||||
A.update_icon()
|
||||
|
||||
/datum/wires/alarm/on_cut(wire, mend)
|
||||
var/obj/machinery/alarm/A = holder
|
||||
switch(wire)
|
||||
if(W_POWER) // Short out forever.
|
||||
A.shock(usr, 50)
|
||||
A.shorted = !mend
|
||||
A.update_icon()
|
||||
if(W_IDSCAN)
|
||||
if(!mend)
|
||||
A.locked = TRUE
|
||||
if(W_AI)
|
||||
A.aidisabled = mend // Enable/disable AI control.
|
||||
if(W_PANIC) // Force panic syphon on.
|
||||
if(!mend)
|
||||
A.mode = 3 // AALARM_MODE_PANIC
|
||||
A.apply_mode()
|
||||
if(W_ALARM) // Post alarm.
|
||||
if(A.alarm_area.atmosalert(2, holder))
|
||||
A.post_alert(2)
|
||||
A.update_icon()
|
||||
+44
-50
@@ -1,65 +1,59 @@
|
||||
/datum/wires/apc
|
||||
var/const/W_POWER1 = "power1"
|
||||
var/const/W_POWER2 = "power2"
|
||||
var/const/W_IDSCAN = "idscan"
|
||||
var/const/W_AI = "ai"
|
||||
|
||||
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/New(atom/holder)
|
||||
wires = list(
|
||||
W_POWER1, W_POWER2,
|
||||
W_IDSCAN, W_AI
|
||||
)
|
||||
add_duds(6)
|
||||
..()
|
||||
|
||||
|
||||
/datum/wires/apc/getStatus()
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
var/list/status = list()
|
||||
status.Add(A.locked ? "The Air Alarm is locked." : "The Air Alarm is unlocked.")
|
||||
status.Add(A.shorted ? "The APCs power has been shorted." : "The APC is working properly!")
|
||||
status.Add(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")
|
||||
return status
|
||||
|
||||
/datum/wires/apc/CanUse(mob/living/L)
|
||||
/datum/wires/apc/interactable(mob/user)
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
if(A.wiresexposed)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
|
||||
/datum/wires/apc/UpdatePulsed(index)
|
||||
/datum/wires/apc/get_status()
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
switch(index)
|
||||
if(APC_WIRE_IDSCAN)
|
||||
A.locked = 0
|
||||
addtimer(A, "reset", 300, FALSE, APC_WIRE_IDSCAN)
|
||||
var/list/status = list()
|
||||
status.Add("The interface light is [A.locked ? "red" : "green"].")
|
||||
status.Add("The short indicator is [A.shorted ? "lit" : "off"].")
|
||||
status.Add("The AI connection light is [!A.aidisabled ? "on" : "off"].")
|
||||
return status
|
||||
|
||||
if (APC_WIRE_MAIN_POWER1, APC_WIRE_MAIN_POWER2)
|
||||
if(A.shorted == 0)
|
||||
A.shorted = 1
|
||||
/datum/wires/apc/on_pulse(wire)
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
switch(wire)
|
||||
if(W_POWER1, W_POWER2) // Short for a long while.
|
||||
if(!A.shorted)
|
||||
A.shorted = TRUE
|
||||
addtimer(A, "reset", 1200, FALSE, index)
|
||||
if(W_IDSCAN) // Unlock for a little while.
|
||||
A.locked = FALSE
|
||||
addtimer(A, "reset", 300, FALSE, index)
|
||||
if (W_AI) // Disable AI control for a very short time.
|
||||
if (!A.aidisabled)
|
||||
A.aidisabled = TRUE
|
||||
addtimer(A, "reset", 10, FALSE, index)
|
||||
|
||||
if (APC_WIRE_AI_CONTROL)
|
||||
if (A.aidisabled == 0)
|
||||
A.aidisabled = 1
|
||||
addtimer(A, "reset", 10, FALSE, APC_WIRE_AI_CONTROL)
|
||||
A.updateDialog()
|
||||
|
||||
/datum/wires/apc/UpdateCut(index, mended)
|
||||
/datum/wires/apc/on_cut(index, mend)
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
|
||||
switch(index)
|
||||
if(APC_WIRE_MAIN_POWER1, APC_WIRE_MAIN_POWER2)
|
||||
|
||||
if(!mended)
|
||||
if(W_POWER1, W_POWER2) // Short out.
|
||||
if(mend && !is_cut(W_POWER1) && !is_cut(W_POWER2))
|
||||
A.shorted = FALSE
|
||||
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()
|
||||
A.shorted = TRUE
|
||||
A.shock(usr, 50)
|
||||
if(W_AI) // Disable AI control.
|
||||
if(mend)
|
||||
A.aidisabled = FALSE
|
||||
else
|
||||
A.aidisabled = TRUE
|
||||
@@ -1,57 +1,58 @@
|
||||
/datum/wires/autolathe
|
||||
var/const/W_HACK = "hack"
|
||||
var/const/W_DISABLE = "disable"
|
||||
var/const/W_SHOCK = "shock"
|
||||
var/const/W_ZAP = "zap"
|
||||
|
||||
holder_type = /obj/machinery/autolathe
|
||||
wire_count = 10
|
||||
|
||||
var/const/AUTOLATHE_HACK_WIRE = 1
|
||||
var/const/AUTOLATHE_SHOCK_WIRE = 2
|
||||
var/const/AUTOLATHE_DISABLE_WIRE = 4
|
||||
/datum/wires/autolathe/New(atom/holder)
|
||||
wires = list(
|
||||
W_HACK, W_DISABLE,
|
||||
W_SHOCK, W_ZAP
|
||||
)
|
||||
add_duds(6)
|
||||
..()
|
||||
|
||||
/datum/wires/autolathe/interactable(mob/user)
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
if(A.panel_open)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/autolathe/getStatus()
|
||||
/datum/wires/autolathe/get_status()
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
var/list/status = list()
|
||||
status.Add("The red light is [A.disabled ? "off" : "on"].")
|
||||
status.Add("The blue light is [A.hacked ? "off" : "on"].")
|
||||
return status
|
||||
|
||||
/datum/wires/autolathe/CanUse()
|
||||
/datum/wires/autolathe/on_pulse(wire)
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
if(A.panel_open)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/wires/autolathe/UpdateCut(index, mended)
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
switch(index)
|
||||
if(AUTOLATHE_HACK_WIRE)
|
||||
if(!A.hacked)
|
||||
A.adjust_hacked(1)
|
||||
if(AUTOLATHE_SHOCK_WIRE)
|
||||
A.shocked = !mended
|
||||
if(AUTOLATHE_DISABLE_WIRE)
|
||||
A.disabled = !mended
|
||||
|
||||
/datum/wires/autolathe/UpdatePulsed(index)
|
||||
if(IsIndexCut(index))
|
||||
return
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
switch(index)
|
||||
if(AUTOLATHE_HACK_WIRE)
|
||||
switch(wire)
|
||||
if(W_HACK)
|
||||
A.adjust_hacked(!A.hacked)
|
||||
spawn(50)
|
||||
if(A && !IsIndexCut(index))
|
||||
A.adjust_hacked(0)
|
||||
Interact(usr)
|
||||
if(AUTOLATHE_SHOCK_WIRE)
|
||||
if(A && !is_cut(wire))
|
||||
A.adjust_hacked(FALSE)
|
||||
if(W_SHOCK)
|
||||
A.shocked = !A.shocked
|
||||
spawn(50)
|
||||
if(A && !IsIndexCut(index))
|
||||
A.shocked = 0
|
||||
Interact(usr)
|
||||
if(AUTOLATHE_DISABLE_WIRE)
|
||||
if(A && !is_cut(wire))
|
||||
A.shocked = FALSE
|
||||
if(W_DISABLE)
|
||||
A.disabled = !A.disabled
|
||||
spawn(50)
|
||||
if(A && !IsIndexCut(index))
|
||||
A.disabled = 0
|
||||
Interact(usr)
|
||||
if(A && !is_cut(wire))
|
||||
A.disabled = FALSE
|
||||
|
||||
/datum/wires/autolathe/on_cut(wire, mend)
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
switch(wire)
|
||||
if(W_HACK)
|
||||
A.adjust_hacked(mend)
|
||||
if(W_HACK)
|
||||
A.shocked = !mend
|
||||
if(W_DISABLE)
|
||||
A.disabled = !mend
|
||||
if(W_ZAP)
|
||||
A.shock(usr, 50)
|
||||
@@ -1,46 +1,44 @@
|
||||
/datum/wires/explosive
|
||||
wire_count = 1
|
||||
var/const/W_BOOM = "boom"
|
||||
|
||||
/datum/wires/explosive/New(atom/holder)
|
||||
wires = list(
|
||||
W_BOOM
|
||||
)
|
||||
..()
|
||||
|
||||
var/const/WIRE_EXPLODE = 1
|
||||
|
||||
/datum/wires/explosive/proc/explode()
|
||||
return
|
||||
|
||||
/datum/wires/explosive/UpdatePulsed(index)
|
||||
/datum/wires/explosive/on_pulse(index)
|
||||
switch(index)
|
||||
if(WIRE_EXPLODE)
|
||||
if(W_BOOM)
|
||||
explode()
|
||||
|
||||
/datum/wires/explosive/UpdateCut(index, mended)
|
||||
/datum/wires/explosive/on_cut(index, mend)
|
||||
switch(index)
|
||||
if(WIRE_EXPLODE)
|
||||
if(!mended)
|
||||
if(W_BOOM)
|
||||
if(!mend)
|
||||
explode()
|
||||
|
||||
|
||||
/datum/wires/explosive/c4
|
||||
holder_type = /obj/item/weapon/c4
|
||||
|
||||
/datum/wires/explosive/c4/CanUse(mob/living/L)
|
||||
/datum/wires/explosive/c4/interactable(mob/user)
|
||||
var/obj/item/weapon/c4/P = holder
|
||||
if(P.open_panel)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
|
||||
/datum/wires/explosive/c4/explode()
|
||||
var/obj/item/weapon/c4/P = holder
|
||||
P.explode()
|
||||
|
||||
|
||||
|
||||
/datum/wires/explosive/gibtonite
|
||||
holder_type = /obj/item/weapon/twohanded/required/gibtonite
|
||||
|
||||
/datum/wires/explosive/gibtonite/CanUse(mob/living/L)
|
||||
return 1
|
||||
|
||||
/datum/wires/explosive/gibtonite/UpdateCut(index, mended)
|
||||
return
|
||||
|
||||
/datum/wires/explosive/gibtonite/explode()
|
||||
var/obj/item/weapon/twohanded/required/gibtonite/P = holder
|
||||
P.GibtoniteReaction(null, 2)
|
||||
@@ -1,53 +1,40 @@
|
||||
/datum/wires/mulebot
|
||||
random = 1
|
||||
var/const/W_POWER1 = "power1"
|
||||
var/const/W_POWER2 = "power2"
|
||||
var/const/W_AVOIDANCE = "avoidance"
|
||||
var/const/W_LOADCHECK = "loadcheck"
|
||||
var/const/W_MOTOR1 = "motor1"
|
||||
var/const/W_MOTOR2 = "motor2"
|
||||
var/const/W_REMOTE_RX = "rx"
|
||||
var/const/W_REMOTE_TX = "tx"
|
||||
var/const/W_BEACON_RX = "beacon"
|
||||
|
||||
holder_type = /mob/living/simple_animal/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/New(atom/holder)
|
||||
wires = list(
|
||||
W_POWER1, W_POWER2,
|
||||
W_AVOIDANCE, W_LOADCHECK,
|
||||
W_MOTOR1, W_MOTOR2,
|
||||
W_REMOTE_RX, W_REMOTE_TX, W_BEACON_RX
|
||||
)
|
||||
..()
|
||||
|
||||
/datum/wires/mulebot/UpdatePulsed(index)
|
||||
switch(index)
|
||||
if(WIRE_POWER1, WIRE_POWER2)
|
||||
holder.visible_message("<span class='notice'>\icon[holder] The charge light flickers.</span>")
|
||||
if(WIRE_AVOIDANCE)
|
||||
holder.visible_message("<span class='notice'>\icon[holder] The external warning lights flash briefly.</span>")
|
||||
if(WIRE_LOADCHECK)
|
||||
holder.visible_message("<span class='notice'>\icon[holder] The load platform clunks.</span>")
|
||||
if(WIRE_MOTOR1, WIRE_MOTOR2)
|
||||
holder.visible_message("<span class='notice'>\icon[holder] The drive motor whines briefly.</span>")
|
||||
/datum/wires/mulebot/interactable(mob/user)
|
||||
var/mob/living/simple_animal/bot/mulebot/M = holder
|
||||
if(M.open)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/mulebot/on_pulse(wire)
|
||||
var/mob/living/simple_animal/bot/mulebot/M = holder
|
||||
switch(wire)
|
||||
if(W_POWER1, W_POWER2)
|
||||
holder.visible_message("<span class='notice'>\icon[M] The charge light flickers.</span>")
|
||||
if(W_AVOIDANCE)
|
||||
holder.visible_message("<span class='notice'>\icon[M] The external warning lights flash briefly.</span>")
|
||||
if(W_LOADCHECK)
|
||||
holder.visible_message("<span class='notice'>\icon[M] The load platform clunks.</span>")
|
||||
if(W_MOTOR1, W_MOTOR2)
|
||||
holder.visible_message("<span class='notice'>\icon[M] The drive motor whines briefly.</span>")
|
||||
else
|
||||
holder.visible_message("<span class='notice'>\icon[holder] You hear a radio crackle.</span>")
|
||||
|
||||
// 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)
|
||||
holder.visible_message("<span class='notice'>\icon[M] You hear a radio crackle.</span>")
|
||||
@@ -1,52 +1,49 @@
|
||||
/datum/wires/particle_acc/control_box
|
||||
wire_count = 5
|
||||
/datum/wires/particle_accelerator/control_box
|
||||
var/const/W_POWER = "power" // Toggles whether the PA is on or not.
|
||||
var/const/W_STRENGTH = "strength" // Determines the strength of the PA.
|
||||
var/const/W_LIMIT = "limit" // Determines how strong the PA can be.
|
||||
var/const/W_INTERFACE = "interface" // Determines the interface showing up.
|
||||
|
||||
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_accelerator/control_box/New(atom/holder)
|
||||
wires = list(
|
||||
W_POWER, W_STRENGTH, W_LIMIT,
|
||||
W_INTERFACE
|
||||
)
|
||||
add_duds(2)
|
||||
..()
|
||||
|
||||
/datum/wires/particle_acc/control_box/CanUse(mob/living/L)
|
||||
/datum/wires/particle_accelerator/control_box/interactable(mob/user)
|
||||
var/obj/machinery/particle_accelerator/control_box/C = holder
|
||||
if(C.construction_state == 2)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
|
||||
/datum/wires/particle_acc/control_box/UpdatePulsed(index)
|
||||
/datum/wires/particle_accelerator/control_box/on_pulse(wire)
|
||||
var/obj/machinery/particle_accelerator/control_box/C = holder
|
||||
switch(index)
|
||||
|
||||
if(PARTICLE_TOGGLE_WIRE)
|
||||
switch(wire)
|
||||
if(W_POWER)
|
||||
C.toggle_power()
|
||||
|
||||
if(PARTICLE_STRENGTH_WIRE)
|
||||
if(W_STRENGTH)
|
||||
C.add_strength()
|
||||
|
||||
if(PARTICLE_INTERFACE_WIRE)
|
||||
if(W_INTERFACE)
|
||||
C.interface_control = !C.interface_control
|
||||
|
||||
if(PARTICLE_LIMIT_POWER_WIRE)
|
||||
if(W_LIMIT)
|
||||
C.visible_message("\icon[C]<b>[C]</b> makes a large whirring noise.")
|
||||
|
||||
/datum/wires/particle_acc/control_box/UpdateCut(index, mended)
|
||||
/datum/wires/particle_accelerator/control_box/on_cut(wire, mend)
|
||||
var/obj/machinery/particle_accelerator/control_box/C = holder
|
||||
switch(index)
|
||||
|
||||
if(PARTICLE_TOGGLE_WIRE)
|
||||
if(C.active == !mended)
|
||||
switch(wire)
|
||||
if(W_POWER)
|
||||
if(C.active == !mend)
|
||||
C.toggle_power()
|
||||
|
||||
if(PARTICLE_STRENGTH_WIRE)
|
||||
|
||||
if(W_STRENGTH)
|
||||
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(W_INTERFACE)
|
||||
if(!mend)
|
||||
C.interface_control = FALSE
|
||||
if(W_LIMIT)
|
||||
C.strength_upper_limit = (mend ? 2 : 3)
|
||||
if(C.strength_upper_limit < C.strength)
|
||||
C.remove_strength()
|
||||
@@ -1,46 +1,48 @@
|
||||
|
||||
/datum/wires/pizza_bomb
|
||||
random = 1
|
||||
var/const/W_BOOM1 = "boomb1" // Boom.
|
||||
var/const/W_BOOM2 = "boomb2" // Boom!
|
||||
var/const/W_BOOM3 = "boomb3" // BOOM!
|
||||
var/const/W_DISARM = "disarm" // No boom!
|
||||
|
||||
holder_type = /obj/item/device/pizza_bomb
|
||||
wire_count = 4
|
||||
randomize = 1
|
||||
|
||||
var/const/PIZZA_WIRE_DISARM = 1 // No boom
|
||||
/datum/wires/pizza_bomb/New(atom/holder)
|
||||
wires = list(
|
||||
W_BOOM1, W_BOOM2, W_BOOM3,
|
||||
W_DISARM
|
||||
)
|
||||
..()
|
||||
|
||||
|
||||
/datum/wires/pizza_bomb/UpdatePulsed(index)
|
||||
var/obj/item/device/pizza_bomb/P = holder
|
||||
switch(index)
|
||||
if(PIZZA_WIRE_DISARM)
|
||||
var/was_primed = P.primed
|
||||
P.disarm()
|
||||
if(was_primed)
|
||||
spawn(100) //Rearm after a short time
|
||||
if(P)
|
||||
P.arm()
|
||||
else
|
||||
if(!P.disarmed)
|
||||
message_admins("a pizza bomb at <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[P.loc.x];Y=[P.loc.y];Z=[P.loc.z]'>(JMP)</a> armed by [key_name_admin(P.armer)] has exploded via wire pulsing.")
|
||||
log_game("a pizza bomb ([P.loc.x],[P.loc.y],[P.loc.z]) armed by [key_name(P.armer)] has exploded via wire pulsing.")
|
||||
P.go_boom()
|
||||
|
||||
|
||||
/datum/wires/pizza_bomb/UpdateCut(index,mended)
|
||||
var/obj/item/device/pizza_bomb/P = holder
|
||||
switch(index)
|
||||
if(PIZZA_WIRE_DISARM)
|
||||
if(mended)
|
||||
P.disarmed = 0
|
||||
else
|
||||
P.disarm()
|
||||
else
|
||||
if(!mended && !P.disarmed)
|
||||
message_admins("a pizza bomb at <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[P.loc.x];Y=[P.loc.y];Z=[P.loc.z]'>(JMP)</a> armed by [key_name_admin(P.armer)] has exploded via wire pulsing.")
|
||||
log_game("a pizza bomb ([P.loc.x],[P.loc.y],[P.loc.z]) armed by [key_name(P.armer)] has exploded via wire pulsing.")
|
||||
P.go_boom()
|
||||
|
||||
/datum/wires/pizza_bomb/getStatus()
|
||||
/datum/wires/pizza_bomb/get_status()
|
||||
var/obj/item/device/pizza_bomb/P = holder
|
||||
var/list/status = list()
|
||||
status.Add("The red light is [P.primed ? "on" : "off"].")
|
||||
status.Add("The green light is [P.disarmed ? "on": "off"].")
|
||||
return status
|
||||
|
||||
/datum/wires/pizza_bomb/on_pulse(wire)
|
||||
var/obj/item/device/pizza_bomb/P = holder
|
||||
switch(wire)
|
||||
if(W_DISARM) // Rearm after a short time
|
||||
var/was_primed = P.primed
|
||||
P.disarm()
|
||||
if(was_primed)
|
||||
spawn(100)
|
||||
if(P)
|
||||
P.arm()
|
||||
else
|
||||
if(!P.disarmed)
|
||||
P.go_boom()
|
||||
|
||||
/datum/wires/pizza_bomb/on_cut(wire, mend)
|
||||
var/obj/item/device/pizza_bomb/P = holder
|
||||
switch(wire)
|
||||
if(W_DISARM)
|
||||
if(mend)
|
||||
P.disarmed = FALSE
|
||||
else
|
||||
P.disarm()
|
||||
else
|
||||
if(!mend && !P.disarmed)
|
||||
P.go_boom()
|
||||
|
||||
+37
-37
@@ -1,47 +1,25 @@
|
||||
|
||||
/datum/wires/r_n_d
|
||||
random = 1
|
||||
var/const/W_HACK = "hack" // Hacks the machine.
|
||||
var/const/W_DISABLE = "disable" // Disables the machine.
|
||||
var/const/W_SHOCK = "shock" // Shocks the user, 50% chance
|
||||
|
||||
holder_type = /obj/machinery/r_n_d
|
||||
wire_count = 6
|
||||
randomize = 1
|
||||
|
||||
var/const/RD_WIRE_HACK = 1 // Hacks the r_n_d machine
|
||||
var/const/RD_WIRE_SHOCK = 2 // Shocks the user, 50% chance
|
||||
var/const/RD_WIRE_DISABLE = 4 // Disables the machine
|
||||
/datum/wires/r_n_d/New(atom/holder)
|
||||
wires = list(
|
||||
W_HACK, W_DISABLE,
|
||||
W_SHOCK
|
||||
)
|
||||
add_duds(5)
|
||||
..()
|
||||
|
||||
|
||||
/datum/wires/r_n_d/CanUse(mob/living/L)
|
||||
/datum/wires/r_n_d/interactable(mob/user)
|
||||
var/obj/machinery/r_n_d/R = holder
|
||||
if(R.panel_open)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
|
||||
|
||||
/datum/wires/r_n_d/UpdatePulsed(index)
|
||||
var/obj/machinery/r_n_d/R = holder
|
||||
switch(index)
|
||||
if(RD_WIRE_HACK)
|
||||
R.hacked = !R.hacked
|
||||
if(RD_WIRE_DISABLE)
|
||||
R.disabled = !R.disabled
|
||||
if(RD_WIRE_SHOCK)
|
||||
var/Rshock = R.shocked
|
||||
R.shocked = !R.shocked
|
||||
spawn(100)
|
||||
if(R)
|
||||
R.shocked = Rshock
|
||||
|
||||
|
||||
/datum/wires/r_n_d/UpdateCut(index,mended)
|
||||
var/obj/machinery/r_n_d/R = holder
|
||||
switch(index)
|
||||
if(RD_WIRE_HACK)
|
||||
R.hacked = !mended
|
||||
if(RD_WIRE_DISABLE)
|
||||
R.disabled = !mended
|
||||
if(RD_WIRE_SHOCK)
|
||||
R.shocked = !mended
|
||||
|
||||
/datum/wires/r_n_d/getStatus()
|
||||
/datum/wires/r_n_d/get_status()
|
||||
var/obj/machinery/r_n_d/R = holder
|
||||
var/list/status = list()
|
||||
status.Add("The red light is [R.disabled ? "off" : "on"].")
|
||||
@@ -49,3 +27,25 @@ var/const/RD_WIRE_DISABLE = 4 // Disables the machine
|
||||
status.Add("The blue light is [R.hacked ? "off" : "on"].")
|
||||
return status
|
||||
|
||||
/datum/wires/r_n_d/on_pulse(wire)
|
||||
var/obj/machinery/r_n_d/R = holder
|
||||
switch(wire)
|
||||
if(W_HACK)
|
||||
R.hacked = !R.hacked
|
||||
if(W_DISABLE)
|
||||
R.disabled = !R.disabled
|
||||
if(W_SHOCK)
|
||||
R.shocked = TRUE
|
||||
spawn(100)
|
||||
if(R)
|
||||
R.shocked = FALSE
|
||||
|
||||
/datum/wires/r_n_d/on_cut(wire, mend)
|
||||
var/obj/machinery/r_n_d/R = holder
|
||||
switch(wire)
|
||||
if(W_HACK)
|
||||
R.hacked = !mend
|
||||
if(W_DISABLE)
|
||||
R.disabled = !mend
|
||||
if(W_SHOCK)
|
||||
R.shocked = !mend
|
||||
|
||||
+17
-19
@@ -1,31 +1,29 @@
|
||||
/datum/wires/radio
|
||||
var/const/W_SIGNAL = "signal"
|
||||
var/const/W_RX = "recieve"
|
||||
var/const/W_TX = "transmit"
|
||||
|
||||
holder_type = /obj/item/device/radio
|
||||
wire_count = 3
|
||||
|
||||
var/const/WIRE_SIGNAL = 1
|
||||
var/const/WIRE_RECEIVE = 2
|
||||
var/const/WIRE_TRANSMIT = 4
|
||||
/datum/wires/radio/New(atom/holder)
|
||||
wires = list(
|
||||
W_SIGNAL,
|
||||
W_RX, W_TX
|
||||
)
|
||||
..()
|
||||
|
||||
/datum/wires/radio/CanUse(mob/living/L)
|
||||
/datum/wires/radio/interactable(mob/user)
|
||||
var/obj/item/device/radio/R = holder
|
||||
if(R.b_stat)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
|
||||
/datum/wires/radio/Interact(mob/living/user)
|
||||
if(CanUse(user))
|
||||
var/obj/item/device/radio/R = holder
|
||||
R.interact(user)
|
||||
|
||||
/datum/wires/radio/UpdatePulsed(index)
|
||||
/datum/wires/radio/on_pulse(index)
|
||||
var/obj/item/device/radio/R = holder
|
||||
switch(index)
|
||||
if(WIRE_SIGNAL)
|
||||
if(W_SIGNAL)
|
||||
R.listening = !R.listening
|
||||
R.broadcasting = R.listening
|
||||
|
||||
if(WIRE_RECEIVE)
|
||||
if(W_RX)
|
||||
R.listening = !R.listening
|
||||
|
||||
if(WIRE_TRANSMIT)
|
||||
R.broadcasting = !R.broadcasting
|
||||
if(W_TX)
|
||||
R.broadcasting = !R.broadcasting
|
||||
|
||||
+54
-86
@@ -1,103 +1,71 @@
|
||||
/datum/wires/robot
|
||||
random = 1
|
||||
var/const/W_AI = "ai"
|
||||
var/const/W_LAWSYNC = "lawsync"
|
||||
var/const/W_LOCKDOWN = "lockdown"
|
||||
var/const/W_CAMERA = "camera"
|
||||
|
||||
holder_type = /mob/living/silicon/robot
|
||||
wire_count = 5
|
||||
randomize = 1
|
||||
|
||||
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/r_n_d/New(atom/holder)
|
||||
wires = list(
|
||||
W_HACK, W_DISABLE,
|
||||
W_SHOCK
|
||||
)
|
||||
add_duds(2)
|
||||
..()
|
||||
|
||||
/datum/wires/robot/interactable(mob/user)
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
if(R.wiresexposed)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/robot/getStatus()
|
||||
/datum/wires/robot/get_status()
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
var/list/status = list()
|
||||
status.Add(R.lawupdate ? "The LawSync light is on." : "The LawSync light is off.")
|
||||
status.Add(R.connected_ai ? "The AI link light is on." : "The AI link light is off.")
|
||||
status.Add((!isnull(R.camera) && R.camera.status == 1) ? "The Camera light is on." : "The Camera light is off.")
|
||||
status.Add(R.lockcharge ? "The lockdown light is on." : "The lockdown light is off.")
|
||||
status.Add("The law sync module is [R.lawupdate ? "on" : "off"].")
|
||||
status.Add("The intelligence link display shows [R.connected_ai ? R.connected_ai.name : "NULL"].")
|
||||
status.Add("The camera light is [!isnull(R.camera) && R.camera.status ? "on" : "off"].")
|
||||
status.Add("The lockdown indicator is [R.lockcharge ? "on" : "off"].")
|
||||
return status
|
||||
|
||||
/datum/wires/robot/UpdateCut(index, mended)
|
||||
|
||||
/datum/wires/robot/on_pulse(wire)
|
||||
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(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
|
||||
switch(wire)
|
||||
if(W_AI) // Pulse to pick a new AI.
|
||||
if(!R.emagged)
|
||||
var/new_ai = select_active_ai(R)
|
||||
if(new_ai && (new_ai != R.connected_ai))
|
||||
R.connected_ai = new_ai
|
||||
R.notify_ai(1)
|
||||
var/numberer = 1 // Send images the Cyborg has taken to the AI's album upon sync.
|
||||
for(var/datum/picture/z in R.aicamera.aipictures)
|
||||
if(R.connected_ai.aicamera.aipictures.len == 0)
|
||||
var/datum/picture/p = new/datum/picture()
|
||||
p = z
|
||||
p.fields["name"] = "Uploaded Image [numberer] (synced from [R.name])"
|
||||
R.connected_ai.aicamera.aipictures += p
|
||||
numberer++
|
||||
continue
|
||||
for(var/datum/picture/t in R.connected_ai.aicamera.aipictures) //Hopefully to prevent someone spamming images to silicons, by spamming this wire
|
||||
if((z.fields["pixel_y"] != t.fields["pixel_y"]) && (z.fields["pixel_x"] != t.fields["pixel_x"])) //~2.26 out of 1000 chance this will stop something it shouldn't
|
||||
var/datum/picture/p = new/datum/picture()
|
||||
p = z
|
||||
p.fields["name"] = "Uploaded Image [numberer] (synced from [R.name])"
|
||||
R.connected_ai.aicamera.aipictures += p
|
||||
else
|
||||
continue
|
||||
numberer++
|
||||
if(R.aicamera.aipictures.len > 0)
|
||||
R << "<span class='notice'>Locally saved images synced with AI. Images were retained in local database in case of loss of connection with the AI.</span>"
|
||||
|
||||
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.notify_ai(TRUE)
|
||||
if(W_CAMERA) // Pulse to disable the camera.
|
||||
if(!isnull(R.camera) && !R.scrambledcodes)
|
||||
R.camera.deactivate(usr, 0)
|
||||
R.visible_message("[R]'s camera lense focuses loudly.", "Your camera lense focuses loudly.")
|
||||
if(W_LAWSYNC) // Forces a law update if possible.
|
||||
if(R.lawupdate)
|
||||
R.visible_message("[R] gently chimes.", "LawSync protocol engaged.")
|
||||
R.lawsync()
|
||||
R.show_laws()
|
||||
if(W_LOCKDOWN)
|
||||
R.SetLockdown(!R.lockcharge) // Toggle
|
||||
|
||||
/datum/wires/robot/CanUse(mob/living/L)
|
||||
/datum/wires/robot/on_cut(wire, mend)
|
||||
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
|
||||
switch(wire)
|
||||
if(W_AI) // Cut the AI wire to reset AI control.
|
||||
if(!mend)
|
||||
R.connected_ai = null
|
||||
if(W_LAWSYNC) // Cut the law wire, and the borg will no longer receive law updates from its AI. Repair and it will re-sync.
|
||||
if(mend)
|
||||
if(!R.emagged)
|
||||
R.lawupdate = TRUE
|
||||
else
|
||||
R.lawupdate = FALSE
|
||||
if (W_CAMERA) // Disable the camera.
|
||||
if(!isnull(R.camera) && !R.scrambledcodes)
|
||||
R.camera.status = mend
|
||||
R.camera.deactivate(usr, 0)
|
||||
R.visible_message("[R]'s camera lense focuses loudly.", "Your camera lense focuses loudly.")
|
||||
if(W_LOCKDOWN) // Simple lockdown.
|
||||
R.SetLockdown(!mend)
|
||||
|
||||
@@ -1,77 +1,81 @@
|
||||
/datum/wires/syndicatebomb
|
||||
random = 1
|
||||
var/const/W_BOOM = "boom" // Explodes if pulsed or cut while active, defuses a bomb that isn't active on cut.
|
||||
var/const/W_UNBOLT = "unbolt" // Unbolts the bomb if cut, hint on pulsed.
|
||||
var/const/W_DELAY = "delay" // Raises the timer on pulse, does nothing on cut.
|
||||
var/const/W_PROCEED = "proceed" // Lowers the timer, explodes if cut while the bomb is active.
|
||||
var/const/W_ACTIVATE = "activate" // Will start a bombs timer if pulsed, will hint if pulsed while already active, will stop a timer a bomb on cut.
|
||||
|
||||
holder_type = /obj/machinery/syndicatebomb
|
||||
wire_count = 5
|
||||
randomize = TRUE
|
||||
|
||||
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/New(atom/holder)
|
||||
wires = list(
|
||||
W_BOOM, W_UNBOLT,
|
||||
W_ACTIVATE, W_DELAY, W_PROCEED
|
||||
)
|
||||
..()
|
||||
|
||||
|
||||
/datum/wires/syndicatebomb/CanUse(mob/living/L)
|
||||
/datum/wires/syndicatebomb/interactable(mob/user)
|
||||
var/obj/machinery/syndicatebomb/P = holder
|
||||
if(P.open_panel)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
|
||||
/datum/wires/syndicatebomb/UpdatePulsed(index)
|
||||
var/obj/machinery/syndicatebomb/P = holder
|
||||
switch(index)
|
||||
if(WIRE_BOOM)
|
||||
if (P.active)
|
||||
P.loc.visible_message("<span class='danger'>\icon[holder] An alarm sounds! It's go-</span>")
|
||||
P.timer = 0
|
||||
if(WIRE_UNBOLT)
|
||||
P.loc.visible_message("<span class='notice'>\icon[holder] The bolts spin in place for a moment.</span>")
|
||||
if(WIRE_DELAY)
|
||||
playsound(P.loc, 'sound/machines/chime.ogg', 30, 1)
|
||||
P.loc.visible_message("<span class='notice'>\icon[holder] The bomb chirps.</span>")
|
||||
P.timer += 10
|
||||
if(WIRE_PROCEED)
|
||||
playsound(P.loc, 'sound/machines/buzz-sigh.ogg', 30, 1)
|
||||
P.loc.visible_message("<span class='danger'>\icon[holder] The bomb buzzes ominously!</span>")
|
||||
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("<span class='danger'>\icon[holder] You hear the bomb start ticking!</span>")
|
||||
P.active = 1
|
||||
P.icon_state = "[initial(P.icon_state)]-active[P.open_panel ? "-wires" : ""]"
|
||||
/datum/wires/syndicatebomb/on_pulse(wire)
|
||||
var/obj/machinery/syndicatebomb/B = holder
|
||||
switch(wire)
|
||||
if(W_BOOM)
|
||||
if(B.active)
|
||||
B.loc.visible_message("<span class='danger'>\icon[B] An alarm sounds! It's go-</span>")
|
||||
B.timer = 0
|
||||
if(W_UNBOLT)
|
||||
B.loc.visible_message("<span class='notice'>\icon[B] The bolts spin in place for a moment.</span>")
|
||||
if(W_DELAY)
|
||||
B.loc.visible_message("<span class='notice'>\icon[B] The bomb chirps.</span>")
|
||||
playsound(B.loc, 'sound/machines/chime.ogg', 30, 1)
|
||||
B.timer += 10
|
||||
if(W_PROCEED)
|
||||
B.loc.visible_message("<span class='danger'>\icon[B] The bomb buzzes ominously!</span>")
|
||||
playsound(B.loc, 'sound/machines/buzz-sigh.ogg', 30, 1)
|
||||
if(B.timer >= 61) // Long fuse bombs can suddenly become more dangerous if you tinker with them.
|
||||
B.timer = 60
|
||||
else if(B.timer >= 21)
|
||||
B.timer -= 10
|
||||
else if(B.timer >= 11) // Both to prevent negative timers and to have a little mercy.
|
||||
B.timer = 10
|
||||
if(W_ACTIVATE)
|
||||
if(!B.active && !B.defused)
|
||||
B.loc.visible_message("<span class='danger'>\icon[B] You hear the bomb start ticking!</span>")
|
||||
playsound(B.loc, 'sound/machines/click.ogg', 30, 1)
|
||||
B.active = 1
|
||||
B.update_icon()
|
||||
else
|
||||
P.loc.visible_message("<span class='notice'>\icon[holder] The bomb seems to hesitate for a moment.</span>")
|
||||
P.timer += 5
|
||||
B.loc.visible_message("<span class='notice'>\icon[B] The bomb seems to hesitate for a moment.</span>")
|
||||
B.timer += 5
|
||||
|
||||
/datum/wires/syndicatebomb/UpdateCut(index, mended)
|
||||
var/obj/machinery/syndicatebomb/P = holder
|
||||
switch(index)
|
||||
if(WIRE_EXPLODE)
|
||||
if(!mended)
|
||||
if(P.active)
|
||||
P.loc.visible_message("<span class='danger'>\icon[holder] An alarm sounds! It's go-</span>")
|
||||
P.timer = 0
|
||||
/datum/wires/syndicatebomb/on_cut(wire, mend)
|
||||
var/obj/machinery/syndicatebomb/B = holder
|
||||
switch(wire)
|
||||
if(W_BOOM)
|
||||
if(mend)
|
||||
B.defused = 0 // Cutting and mending all the wires of an inactive bomb will thus cure any sabotage.
|
||||
else
|
||||
if(B.active)
|
||||
B.loc.visible_message("<span class='danger'>\icon[B] An alarm sounds! It's go-</span>")
|
||||
B.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("<span class='notice'>\icon[holder] The bolts lift out of the ground!</span>")
|
||||
P.anchored = 0
|
||||
if(WIRE_PROCEED)
|
||||
if(!mended && P.active)
|
||||
P.loc.visible_message("<span class='danger'>\icon[holder] An alarm sounds! It's go-</span>")
|
||||
P.timer = 0
|
||||
if(WIRE_ACTIVATE)
|
||||
if (!mended && P.active)
|
||||
P.loc.visible_message("<span class='notice'>\icon[holder] The timer stops! The bomb has been defused!</span>")
|
||||
P.icon_state = "[initial(P.icon_state)]-inactive[P.open_panel ? "-wires" : ""]"
|
||||
P.active = 0
|
||||
P.defused = 1
|
||||
B.defused = 1
|
||||
if(W_UNBOLT)
|
||||
if(!mend && B.anchored)
|
||||
B.loc.visible_message("<span class='notice'>\icon[B] The bolts lift out of the ground!</span>")
|
||||
playsound(B.loc, 'sound/effects/stealthoff.ogg', 30, 1)
|
||||
B.anchored = 0
|
||||
if(W_PROCEED)
|
||||
if(!mend && B.active)
|
||||
B.loc.visible_message("<span class='danger'>\icon[B] An alarm sounds! It's go-</span>")
|
||||
B.timer = 0
|
||||
if(W_ACTIVATE)
|
||||
if (!mend && B.active)
|
||||
B.loc.visible_message("<span class='notice'>\icon[B] The timer stops! The bomb has been defused!</span>")
|
||||
B.active = 0
|
||||
B.defused = 1
|
||||
B.update_icon()
|
||||
@@ -1,24 +1,20 @@
|
||||
/datum/wires/vending
|
||||
var/const/W_THROW = "throw"
|
||||
var/const/W_CONTRABAND = "contraband"
|
||||
var/const/W_ELECTRIFY = "electrify"
|
||||
var/const/W_IDSCAN = "idscan"
|
||||
var/const/W_SPEAKER = "speaker"
|
||||
|
||||
holder_type = /obj/machinery/vending
|
||||
wire_count = 5
|
||||
|
||||
var/const/VENDING_WIRE_THROW = 1
|
||||
var/const/VENDING_WIRE_CONTRABAND = 2
|
||||
var/const/VENDING_WIRE_ELECTRIFY = 4
|
||||
var/const/VENDING_WIRE_IDSCAN = 8
|
||||
var/const/VENDING_WIRE_SPEAKER = 16
|
||||
|
||||
/datum/wires/vending/CanUse(mob/living/L)
|
||||
/datum/wires/vending/interactable(mob/user)
|
||||
var/obj/machinery/vending/V = holder
|
||||
if(!istype(L, /mob/living/silicon))
|
||||
if(V.seconds_electrified)
|
||||
if(V.shock(L, 100))
|
||||
return 0
|
||||
if(!istype(user, /mob/living/silicon) && V.seconds_electrified && V.shock(user, 100))
|
||||
return FALSE
|
||||
if(V.panel_open)
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
|
||||
/datum/wires/vending/getStatus()
|
||||
/datum/wires/vending/get_status()
|
||||
var/obj/machinery/vending/V = holder
|
||||
var/list/status = list()
|
||||
status.Add("The orange light is [V.seconds_electrified ? "on" : "off"].")
|
||||
@@ -28,33 +24,33 @@ var/const/VENDING_WIRE_SPEAKER = 16
|
||||
status.Add("The speaker light is [V.shut_up ? "off" : "on"].")
|
||||
return status
|
||||
|
||||
/datum/wires/vending/UpdatePulsed(index)
|
||||
/datum/wires/vending/on_pulse(wire)
|
||||
var/obj/machinery/vending/V = holder
|
||||
switch(index)
|
||||
if(VENDING_WIRE_THROW)
|
||||
switch(wire)
|
||||
if(W_THROW)
|
||||
V.shoot_inventory = !V.shoot_inventory
|
||||
if(VENDING_WIRE_CONTRABAND)
|
||||
if(W_CONTRABAND)
|
||||
V.extended_inventory = !V.extended_inventory
|
||||
if(VENDING_WIRE_ELECTRIFY)
|
||||
if(W_ELECTRIFY)
|
||||
V.seconds_electrified = 30
|
||||
if(VENDING_WIRE_IDSCAN)
|
||||
if(W_IDSCAN)
|
||||
V.scan_id = !V.scan_id
|
||||
if(VENDING_WIRE_SPEAKER)
|
||||
if(W_SPEAKER)
|
||||
V.shut_up = !V.shut_up
|
||||
|
||||
/datum/wires/vending/UpdateCut(index, mended)
|
||||
/datum/wires/vending/on_cut(wire, mend)
|
||||
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
|
||||
switch(wire)
|
||||
if(W_THROW)
|
||||
V.shoot_inventory = !mend
|
||||
if(W_CONTRABAND)
|
||||
V.extended_inventory = FALSE
|
||||
if(W_ELECTRIFY)
|
||||
if(mend)
|
||||
V.seconds_electrified = FALSE
|
||||
else
|
||||
V.seconds_electrified = -1
|
||||
if(VENDING_WIRE_IDSCAN)
|
||||
V.scan_id = 1
|
||||
if(VENDING_WIRE_SPEAKER)
|
||||
V.shut_up = mended
|
||||
if(W_IDSCAN)
|
||||
V.scan_id = mend
|
||||
if(W_SPEAKER)
|
||||
V.shut_up = mend
|
||||
+176
-236
@@ -1,299 +1,239 @@
|
||||
// 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")
|
||||
var/list/wire_colors = list( // http://www.crockford.com/wrrrld/color.html
|
||||
"gold",
|
||||
"silver",
|
||||
"gray",
|
||||
"white",
|
||||
"peru",
|
||||
"brown",
|
||||
"bisque",
|
||||
"tan",
|
||||
"beige",
|
||||
"firebrick",
|
||||
"crimson",
|
||||
"red",
|
||||
"tomato",
|
||||
"redorange",
|
||||
"orange",
|
||||
"yellow",
|
||||
"khaki",
|
||||
"greenyellow",
|
||||
"lawngreen",
|
||||
"lime",
|
||||
"green",
|
||||
"teal",
|
||||
"seagreen",
|
||||
"aqua",
|
||||
"cyan",
|
||||
"blue",
|
||||
"purple",
|
||||
"plum",
|
||||
"pink",
|
||||
"hotpink",
|
||||
"magenta",
|
||||
"black",
|
||||
)
|
||||
var/list/wire_color_directory = list()
|
||||
|
||||
/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/Destroy()
|
||||
holder = null
|
||||
signallers = list()
|
||||
return ..()
|
||||
|
||||
/datum/wires/proc/GenerateWires()
|
||||
var/list/colours_to_pick = wireColours.Copy() // Get a copy, not a reference.
|
||||
var/list/indexes_to_pick = list()
|
||||
//Generate our indexes
|
||||
for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i)
|
||||
indexes_to_pick += i
|
||||
colours_to_pick.len = wire_count // Downsize it to our specifications.
|
||||
|
||||
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/IsInteractionTool(obj/item/I)
|
||||
/proc/is_wire_tool(obj/item/I)
|
||||
if(istype(I, /obj/item/device/multitool))
|
||||
return 1
|
||||
|
||||
return TRUE
|
||||
if(istype(I, /obj/item/weapon/wirecutters))
|
||||
return 1
|
||||
|
||||
return TRUE
|
||||
if(istype(I, /obj/item/device/assembly))
|
||||
var/obj/item/device/assembly/A = I
|
||||
if(A.attachable)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
/datum/wires/ui_interact(mob/user, ui_key = "wires", datum/tgui/ui = null, force_open = 0, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = wire_state)
|
||||
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "wires", holder.name, 200 + wire_count*50, 470, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/datum/wires/proc/Interact(mob/living/user)
|
||||
if(holder && CanUse(user)) //remove this
|
||||
ui_interact(user)
|
||||
//Active prox sensors and similar on wires
|
||||
for(var/A in signallers)
|
||||
if(istype(signallers[A], /obj/item))
|
||||
var/obj/item/I = signallers[A]
|
||||
if(I.on_found(user))
|
||||
return
|
||||
|
||||
/datum/wires/proc/getStatus()
|
||||
return TRUE
|
||||
return
|
||||
|
||||
//
|
||||
// Overridable Procs
|
||||
//
|
||||
/datum/wires
|
||||
var/atom/holder = null // The holder (atom that contains these wires).
|
||||
var/holder_type = null // The holder's typepath (used to make wire colors common to all holders).
|
||||
|
||||
// Called when wires cut/mended.
|
||||
/datum/wires/proc/UpdateCut(index, mended)
|
||||
return
|
||||
var/list/wires = list() // List of wires.
|
||||
var/list/cut_wires = list() // List of wires that have been cut.
|
||||
var/list/colors = list() // Dictionary of colors to wire.
|
||||
var/list/assemblies = list() // List of attached assemblies.
|
||||
var/randomize = 0 // If every instance of these wires should be random.
|
||||
|
||||
// Called when wire pulsed. Add code here.
|
||||
/datum/wires/proc/UpdatePulsed(index)
|
||||
return
|
||||
|
||||
/datum/wires/proc/CanUse(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(colour)
|
||||
PulseIndex(GetIndex(colour))
|
||||
|
||||
/datum/wires/proc/PulseIndex(index)
|
||||
if(IsIndexCut(index))
|
||||
/datum/wires/New(atom/holder)
|
||||
..()
|
||||
if(!istype(holder, holder_type))
|
||||
CRASH("Wire holder is not of the expected type!")
|
||||
return
|
||||
UpdatePulsed(index)
|
||||
|
||||
/datum/wires/proc/GetIndex(colour)
|
||||
if(wires[colour])
|
||||
var/index = wires[colour]
|
||||
return index
|
||||
src.holder = holder
|
||||
if(randomize)
|
||||
randomize()
|
||||
else
|
||||
CRASH("[colour] is not a key in wires.")
|
||||
if(!wire_color_directory[holder_type])
|
||||
randomize()
|
||||
wire_color_directory[holder_type] = colors
|
||||
else
|
||||
colors = wire_color_directory[holder_type]
|
||||
|
||||
/datum/wires/proc/GetColour(index)
|
||||
for(var/colour in wires)
|
||||
if(wires[colour] == index)
|
||||
return colour
|
||||
/datum/wires/Destroy()
|
||||
holder = null
|
||||
assemblies = list()
|
||||
return ..()
|
||||
|
||||
//
|
||||
// Is Index/Colour Cut procs
|
||||
//
|
||||
/datum/wires/proc/add_duds(duds)
|
||||
while(duds)
|
||||
wires += "dud[duds--]"
|
||||
|
||||
/datum/wires/proc/IsColourCut(colour)
|
||||
var/index = GetIndex(colour)
|
||||
return IsIndexCut(index)
|
||||
/datum/wires/proc/randomize()
|
||||
var/list/possible_colors = shuffle(wire_colors.Copy())
|
||||
|
||||
/datum/wires/proc/IsIndexCut(index)
|
||||
return (index & wires_status)
|
||||
for(var/wire in shuffle(wires))
|
||||
colors[pick_n_take(possible_colors)] = wire
|
||||
|
||||
//
|
||||
// Signaller Procs
|
||||
//
|
||||
/datum/wires/proc/repair()
|
||||
cut_wires = list()
|
||||
|
||||
/datum/wires/proc/IsAttached(colour)
|
||||
if(signallers[colour])
|
||||
return 1
|
||||
return 0
|
||||
/datum/wires/proc/get_wire(color)
|
||||
return colors[color]
|
||||
|
||||
/datum/wires/proc/GetAttached(colour)
|
||||
if(signallers[colour])
|
||||
return signallers[colour]
|
||||
/datum/wires/proc/get_attached(color)
|
||||
if(assemblies[color])
|
||||
return assemblies[color]
|
||||
return null
|
||||
|
||||
/datum/wires/proc/Attach(colour, obj/item/device/assembly/S)
|
||||
if(colour && S && S.attachable)
|
||||
if(!IsAttached(colour))
|
||||
signallers[colour] = S
|
||||
S.loc = holder
|
||||
S.connected = src
|
||||
return S
|
||||
/datum/wires/proc/is_attached(color)
|
||||
if(assemblies[color])
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/Detach(colour)
|
||||
if(colour)
|
||||
var/obj/item/device/assembly/S = GetAttached(colour)
|
||||
if(S)
|
||||
signallers -= colour
|
||||
S.connected = null
|
||||
S.loc = holder.loc
|
||||
return S
|
||||
/datum/wires/proc/is_cut(wire)
|
||||
return (wire in cut_wires)
|
||||
|
||||
/datum/wires/proc/is_color_cut(color)
|
||||
return is_cut(get_wire(color))
|
||||
|
||||
/datum/wires/proc/Pulse(obj/item/device/assembly/S)
|
||||
for(var/colour in signallers)
|
||||
if(S == signallers[colour])
|
||||
PulseColour(colour)
|
||||
break
|
||||
/datum/wires/proc/is_all_cut()
|
||||
if(cut_wires.len == wires.len)
|
||||
return TRUE
|
||||
|
||||
|
||||
//
|
||||
// Cut Wire Colour/Index procs
|
||||
//
|
||||
|
||||
/datum/wires/proc/CutWireColour(colour)
|
||||
var/index = GetIndex(colour)
|
||||
CutWireIndex(index)
|
||||
|
||||
/datum/wires/proc/CutWireIndex(index)
|
||||
if(IsIndexCut(index))
|
||||
wires_status &= ~index
|
||||
UpdateCut(index, 1)
|
||||
/datum/wires/proc/cut(wire)
|
||||
if(is_cut(wire))
|
||||
cut_wires -= wire
|
||||
on_cut(wire, mend = TRUE)
|
||||
else
|
||||
wires_status |= index
|
||||
UpdateCut(index, 0)
|
||||
cut_wires += wire
|
||||
on_cut(wire, mend = FALSE)
|
||||
|
||||
/datum/wires/proc/RandomCut()
|
||||
var/r = rand(1, wires.len)
|
||||
CutWireIndex(r)
|
||||
/datum/wires/proc/cut_color(color)
|
||||
cut(get_wire(color))
|
||||
|
||||
/datum/wires/proc/CutAll()
|
||||
for(var/i = 1; i < MAX_FLAG && i < (1 << wire_count); i += i)
|
||||
CutWireIndex(i)
|
||||
/datum/wires/proc/cut_random()
|
||||
cut(wires[rand(1, wires.len)])
|
||||
|
||||
/datum/wires/proc/IsAllCut()
|
||||
if(wires_status == (1 << wire_count) - 1)
|
||||
return 1
|
||||
return 0
|
||||
/datum/wires/proc/cut_all()
|
||||
for(var/wire in wires)
|
||||
cut(wire)
|
||||
|
||||
//
|
||||
//Shuffle and Mend
|
||||
//
|
||||
/datum/wires/proc/pulse(wire)
|
||||
if(is_cut(wire))
|
||||
return
|
||||
on_pulse(wire)
|
||||
|
||||
/datum/wires/proc/Shuffle()
|
||||
wires_status = 0
|
||||
GenerateWires()
|
||||
/datum/wires/proc/pulse_color(color)
|
||||
pulse(get_wire(color))
|
||||
|
||||
/datum/wires/get_ui_data()
|
||||
/datum/wires/proc/pulse_assembly(obj/item/device/assembly/S)
|
||||
for(var/color in assemblies)
|
||||
if(S == assemblies[color])
|
||||
pulse_color(color)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/attach_assembly(color, obj/item/device/assembly/S)
|
||||
if(S && istype(S) && S.attachable && !is_attached(color))
|
||||
assemblies[color] = S
|
||||
S.loc = holder
|
||||
S.connected = src
|
||||
return S
|
||||
|
||||
/datum/wires/proc/detach_assembly(color)
|
||||
var/obj/item/device/assembly/S = get_attached(color)
|
||||
if(S && istype(S))
|
||||
assemblies -= color
|
||||
S.connected = null
|
||||
S.loc = holder.loc
|
||||
return S
|
||||
|
||||
// Overridable Procs
|
||||
/datum/wires/proc/interactable(mob/user)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/proc/get_status()
|
||||
return list()
|
||||
|
||||
/datum/wires/proc/on_cut(wire, mended)
|
||||
return
|
||||
|
||||
/datum/wires/proc/on_pulse(wire)
|
||||
return
|
||||
// End Overridable Procs
|
||||
|
||||
/datum/wires/proc/interact(mob/user)
|
||||
if(!interactable(user))
|
||||
return
|
||||
ui_interact(user)
|
||||
for(var/A in assemblies)
|
||||
var/obj/item/I = assemblies[A]
|
||||
if(istype(I) && I.on_found(user))
|
||||
return
|
||||
|
||||
/datum/wires/ui_interact(mob/user, ui_key = "wires", datum/tgui/ui = null, force_open = 0, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = wire_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "wires", "[holder.name] wires", 350, 150 + wires.len * 30, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/datum/wires/get_ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/list/payload = list()
|
||||
for(var/colour in wires)
|
||||
payload.Add(list(list("colour"=colour,"isCut"=IsColourCut(colour),"hasAttachment"=IsAttached(colour))))
|
||||
for(var/color in colors)
|
||||
payload.Add(list(list(
|
||||
"color" = color,
|
||||
"wire" = (IsAdminGhost(user) ? get_wire(color) : null),
|
||||
"cut" = is_color_cut(color),
|
||||
"attached" = is_attached(color)
|
||||
)))
|
||||
data["wires"] = payload
|
||||
data["holderInfo"] = getStatus()
|
||||
data["status"] = get_status()
|
||||
return data
|
||||
|
||||
/datum/wires/ui_act(action, params)
|
||||
if(..())
|
||||
if(!interactable(usr))
|
||||
return
|
||||
|
||||
var/target_wire = params["wire"]
|
||||
var/mob/living/L = usr
|
||||
if(!istype(L) || !CanUse(L)) //only physical beings can touch these. Sorry admins, maybe later
|
||||
return
|
||||
var/obj/item/I = L.get_active_hand()
|
||||
switch(action)
|
||||
if("cut")
|
||||
if(istype(I, /obj/item/weapon/wirecutters))
|
||||
CutWireColour(target_wire)
|
||||
if(istype(I, /obj/item/weapon/wirecutters) || IsAdminGhost(usr))
|
||||
cut_color(target_wire)
|
||||
else
|
||||
L << "<span class='warning'>You need wirecutters!</span>"
|
||||
if("pulse")
|
||||
if(istype(I, /obj/item/device/multitool))
|
||||
PulseColour(target_wire)
|
||||
if(istype(I, /obj/item/device/multitool) || IsAdminGhost(usr))
|
||||
pulse_color(target_wire)
|
||||
else
|
||||
L << "<span class='warning'>You need a multitool!</span>"
|
||||
if("attach")
|
||||
//Detach
|
||||
if(IsAttached(target_wire))
|
||||
var/obj/item/O = Detach(target_wire)
|
||||
if(is_attached(target_wire))
|
||||
var/obj/item/O = detach_assembly(target_wire)
|
||||
if(O)
|
||||
L.put_in_hands(O)
|
||||
// Attach
|
||||
else
|
||||
if(istype(I, /obj/item/device/assembly))
|
||||
var/obj/item/device/assembly/A = I;
|
||||
var/obj/item/device/assembly/A = I
|
||||
if(A.attachable)
|
||||
if(!L.drop_item())
|
||||
return
|
||||
Attach(target_wire, A)
|
||||
attach_assembly(target_wire, A)
|
||||
else
|
||||
L << "<span class='warning'>You need an attachable assembly!</span>"
|
||||
return 1
|
||||
return 1
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
return
|
||||
|
||||
if(panel_open && !istype(user, /mob/living/silicon/ai))
|
||||
wires.Interact(user)
|
||||
wires.interact(user)
|
||||
else if (!shorted)
|
||||
ui_interact(user)
|
||||
|
||||
@@ -339,7 +339,7 @@
|
||||
var/device_id = params["id_tag"]
|
||||
switch(action)
|
||||
if("lock")
|
||||
if(usr.has_unlimited_silicon_privilege && !wires.IsIndexCut(AALARM_WIRE_IDSCAN))
|
||||
if(usr.has_unlimited_silicon_privilege && !wires.is_cut(wires.W_IDSCAN))
|
||||
locked = !locked
|
||||
if(
|
||||
"power",
|
||||
@@ -647,10 +647,10 @@
|
||||
/obj/machinery/alarm/attackby(obj/item/W, mob/user, params)
|
||||
switch(buildstage)
|
||||
if(2)
|
||||
if(istype(W, /obj/item/weapon/wirecutters) && panel_open && (wires.wires_status == 27 || wires.wires_status == 31)) //this checks for all wires to be cut, except the syphon wire which is optional.
|
||||
if(istype(W, /obj/item/weapon/wirecutters) && panel_open && wires.is_all_cut())
|
||||
playsound(src.loc, 'sound/items/Wirecutter.ogg', 50, 1)
|
||||
user << "<span class='notice'>You cut the final wires.</span>"
|
||||
var/obj/item/stack/cable_coil/cable = new /obj/item/stack/cable_coil( src.loc )
|
||||
var/obj/item/stack/cable_coil/cable = new /obj/item/stack/cable_coil(loc)
|
||||
cable.amount = 5
|
||||
buildstage = 1
|
||||
update_icon()
|
||||
@@ -669,7 +669,7 @@
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
user << "<span class='warning'>It does nothing!</span>"
|
||||
else
|
||||
if(src.allowed(usr) && !wires.IsIndexCut(AALARM_WIRE_IDSCAN))
|
||||
if(src.allowed(usr) && !wires.is_cut(wires.W_IDSCAN))
|
||||
locked = !locked
|
||||
user << "<span class='notice'>You [ locked ? "lock" : "unlock"] the air alarm interface.</span>"
|
||||
src.updateUsrDialog()
|
||||
@@ -701,7 +701,7 @@
|
||||
if (cable.get_amount() >= 5 && buildstage == 1)
|
||||
cable.use(5)
|
||||
user << "<span class='notice'>You wire the air alarm.</span>"
|
||||
wires.wires_status = 0
|
||||
wires.repair()
|
||||
aidisabled = 0
|
||||
locked = 1
|
||||
mode = 1
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
|
||||
/obj/machinery/autolathe/attack_hand(mob/user)
|
||||
if(panel_open && !isAI(user))
|
||||
return wires.Interact(user)
|
||||
return wires.interact(user)
|
||||
if(..(user, 0))
|
||||
return
|
||||
interact(user)
|
||||
|
||||
@@ -81,21 +81,6 @@ var/list/airlock_overlays = list()
|
||||
airlock_material = "glass"
|
||||
update_icon()
|
||||
|
||||
/*
|
||||
About the new airlock wires panel:
|
||||
* An airlock wire dialog can be accessed by the normal way or by using wirecutters or a multitool on the door while the wire-panel is open. This would show the following wires, which you can either wirecut/mend or send a multitool pulse through. There are 9 wires.
|
||||
* one wire from the ID scanner. Sending a pulse through this flashes the red light on the door (if the door has power). If you cut this wire, the door will stop recognizing valid IDs. (If the door has 0000 access, it still opens and closes, though)
|
||||
* two wires for power. 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). 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 \red open, but bolts-raising will not work. Cutting these wires may electrocute the user.
|
||||
* one wire for door bolts. Sending a pulse through this drops door bolts (whether the door is powered or not) or raises them (if it is). Cutting this wire also drops the door bolts, and mending it does not raise them. If the wire is cut, trying to raise the door bolts will not work.
|
||||
* 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). Cutting either one disables the backup door power (allowing it to be crowbarred open, but disabling bolts-raising), but may electocute the user.
|
||||
* one wire for opening the door. Sending a pulse through this while the door has power makes it open the door if no access is required.
|
||||
* one wire for AI control. Sending a pulse through this blocks AI control for a second or so (which is enough to see the AI control light on the panel dialog go off and back on again). Cutting this prevents the AI from controlling the door unless it has hacked the door through the power connection (which takes about a minute). If both main and backup power are cut, as well as this wire, then the AI cannot operate or hack the door at all.
|
||||
* one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds. Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted. (Currently it is also STAYING electrified until someone mends the wire)
|
||||
* one wire for controling door safetys. When active, door does not close on someone. When cut, door will ruin someone's shit. When pulsed, door will immedately ruin someone's shit.
|
||||
* one wire for controlling door speed. When active, dor closes at normal rate. When cut, door does not close manually. When pulsed, door attempts to close every tick.
|
||||
*/
|
||||
// You can find code for the airlock wires in the wire datum folder.
|
||||
|
||||
/obj/machinery/door/airlock/proc/bolt()
|
||||
if(locked)
|
||||
return
|
||||
@@ -142,28 +127,21 @@ About the new airlock wires panel:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/door/airlock/proc/isWireCut(wireIndex)
|
||||
// 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()));
|
||||
return ((aiControlDisabled != 1) && (!isAllPowerCut()));
|
||||
|
||||
/obj/machinery/door/airlock/proc/canAIHack()
|
||||
return ((src.aiControlDisabled==1) && (!hackProof) && (!src.isAllPowerCut()));
|
||||
return ((aiControlDisabled==1) && (!hackProof) && (!isAllPowerCut()));
|
||||
|
||||
/obj/machinery/door/airlock/hasPower()
|
||||
return ((src.secondsMainPowerLost==0 || src.secondsBackupPowerLost==0) && !(stat & NOPOWER))
|
||||
return ((secondsMainPowerLost == 0 || secondsBackupPowerLost == 0) && !(stat & NOPOWER))
|
||||
|
||||
/obj/machinery/door/airlock/requiresID()
|
||||
return !(src.isWireCut(AIRLOCK_WIRE_IDSCAN) || aiDisabledIdScanner)
|
||||
return !(wires.is_cut(wires.W_IDSCAN) || aiDisabledIdScanner)
|
||||
|
||||
/obj/machinery/door/airlock/proc/isAllPowerCut()
|
||||
var/retval=0
|
||||
if(src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1) || src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2))
|
||||
if(src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1) || src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2))
|
||||
retval=1
|
||||
return retval
|
||||
if((wires.is_cut(wires.W_POWER1) || wires.is_cut(wires.W_POWER2)) && (wires.is_cut(wires.W_BACKUP1) || wires.is_cut(wires.W_BACKUP2)))
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/door/airlock/proc/regainMainPower()
|
||||
if(src.secondsMainPowerLost > 0)
|
||||
@@ -183,19 +161,19 @@ About the new airlock wires panel:
|
||||
if(qdeleted(src))
|
||||
return
|
||||
cont = 0
|
||||
if(src.secondsMainPowerLost>0)
|
||||
if((!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1)) && (!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2)))
|
||||
src.secondsMainPowerLost -= 1
|
||||
src.updateDialog()
|
||||
if(secondsMainPowerLost>0)
|
||||
if(!wires.is_cut(wires.W_POWER1) && !wires.is_cut(wires.W_POWER2))
|
||||
secondsMainPowerLost -= 1
|
||||
updateDialog()
|
||||
cont = 1
|
||||
|
||||
if(src.secondsBackupPowerLost>0)
|
||||
if((!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1)) && (!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2)))
|
||||
src.secondsBackupPowerLost -= 1
|
||||
src.updateDialog()
|
||||
if(secondsBackupPowerLost>0)
|
||||
if(!wires.is_cut(wires.W_BACKUP1) && !wires.is_cut(wires.W_BACKUP2))
|
||||
secondsBackupPowerLost -= 1
|
||||
updateDialog()
|
||||
cont = 1
|
||||
src.spawnPowerRestoreRunning = 0
|
||||
src.updateDialog()
|
||||
spawnPowerRestoreRunning = 0
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/door/airlock/proc/loseBackupPower()
|
||||
if(src.secondsBackupPowerLost < 60)
|
||||
@@ -394,7 +372,7 @@ About the new airlock wires panel:
|
||||
user.set_machine(src)
|
||||
var/t1 = text("<B>Airlock Control</B><br>\n")
|
||||
if(src.secondsMainPowerLost > 0)
|
||||
if((!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1)) && (!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2)))
|
||||
if(!wires.is_cut(wires.W_POWER1) && !wires.is_cut(wires.W_POWER2))
|
||||
t1 += text("Main power is offline for [] seconds.<br>\n", src.secondsMainPowerLost)
|
||||
else
|
||||
t1 += text("Main power is offline indefinitely.<br>\n")
|
||||
@@ -402,7 +380,7 @@ About the new airlock wires panel:
|
||||
t1 += text("Main power is online.")
|
||||
|
||||
if(src.secondsBackupPowerLost > 0)
|
||||
if((!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1)) && (!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2)))
|
||||
if(!wires.is_cut(wires.W_BACKUP1) && !wires.is_cut(wires.W_BACKUP2))
|
||||
t1 += text("Backup power is offline for [] seconds.<br>\n", src.secondsBackupPowerLost)
|
||||
else
|
||||
t1 += text("Backup power is offline indefinitely.<br>\n")
|
||||
@@ -412,7 +390,7 @@ About the new airlock wires panel:
|
||||
t1 += text("Backup power is offline, but will turn on if main power fails.")
|
||||
t1 += "<br>\n"
|
||||
|
||||
if(src.isWireCut(AIRLOCK_WIRE_IDSCAN))
|
||||
if(wires.is_cut(wires.W_IDSCAN))
|
||||
t1 += text("IdScan wire is cut.<br>\n")
|
||||
else if(src.aiDisabledIdScanner)
|
||||
t1 += text("IdScan disabled. <A href='?src=\ref[];aiEnable=1'>Enable?</a><br>\n", src)
|
||||
@@ -424,21 +402,21 @@ About the new airlock wires panel:
|
||||
else
|
||||
t1 += text("Emergency Access Override is disabled. <A href='?src=\ref[];aiEnable=11'>Enable?</a><br>\n", src)
|
||||
|
||||
if(src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1))
|
||||
if(wires.is_cut(wires.W_POWER1))
|
||||
t1 += text("Main Power Input wire is cut.<br>\n")
|
||||
if(src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2))
|
||||
if(wires.is_cut(wires.W_POWER2))
|
||||
t1 += text("Main Power Output wire is cut.<br>\n")
|
||||
if(src.secondsMainPowerLost == 0)
|
||||
t1 += text("<A href='?src=\ref[];aiDisable=2'>Temporarily disrupt main power?</a>.<br>\n", src)
|
||||
if(src.secondsBackupPowerLost == 0)
|
||||
t1 += text("<A href='?src=\ref[];aiDisable=3'>Temporarily disrupt backup power?</a>.<br>\n", src)
|
||||
|
||||
if(src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1))
|
||||
if(wires.is_cut(wires.W_BACKUP1))
|
||||
t1 += text("Backup Power Input wire is cut.<br>\n")
|
||||
if(src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2))
|
||||
if(wires.is_cut(wires.W_BACKUP2))
|
||||
t1 += text("Backup Power Output wire is cut.<br>\n")
|
||||
|
||||
if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS))
|
||||
if(wires.is_cut(wires.W_BOLTS))
|
||||
t1 += text("Door bolt drop wire is cut.<br>\n")
|
||||
else if(!src.locked)
|
||||
t1 += text("Door bolts are up. <A href='?src=\ref[];aiDisable=4'>Drop them?</a><br>\n", src)
|
||||
@@ -449,14 +427,14 @@ About the new airlock wires panel:
|
||||
else
|
||||
t1 += text(" Cannot raise door bolts due to power failure.<br>\n")
|
||||
|
||||
if(src.isWireCut(AIRLOCK_WIRE_LIGHT))
|
||||
if(wires.is_cut(wires.W_LIGHT))
|
||||
t1 += text("Door bolt lights wire is cut.<br>\n")
|
||||
else if(!src.lights)
|
||||
t1 += text("Door bolt lights are off. <A href='?src=\ref[];aiEnable=10'>Enable?</a><br>\n", src)
|
||||
else
|
||||
t1 += text("Door bolt lights are on. <A href='?src=\ref[];aiDisable=10'>Disable?</a><br>\n", src)
|
||||
|
||||
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
|
||||
if(wires.is_cut(wires.W_SHOCK))
|
||||
t1 += text("Electrification wire is cut.<br>\n")
|
||||
if(src.secondsElectrified==-1)
|
||||
t1 += text("Door is electrified indefinitely. <A href='?src=\ref[];aiDisable=5'>Un-electrify it?</a><br>\n", src)
|
||||
@@ -465,23 +443,20 @@ About the new airlock wires panel:
|
||||
else
|
||||
t1 += text("Door is not electrified. <A href='?src=\ref[];aiEnable=5'>Electrify it for 30 seconds?</a> Or, <A href='?src=\ref[];aiEnable=6'>Electrify it indefinitely until someone cancels the electrification?</a><br>\n", src, src)
|
||||
|
||||
if(src.isWireCut(AIRLOCK_WIRE_SAFETY))
|
||||
if(wires.is_cut(wires.W_SAFETY))
|
||||
t1 += text("Door force sensors not responding.</a><br>\n")
|
||||
else if(src.safe)
|
||||
t1 += text("Door safeties operating normally. <A href='?src=\ref[];aiDisable=8'>Override?</a><br>\n",src)
|
||||
else
|
||||
t1 += text("Danger. Door safeties disabled. <A href='?src=\ref[];aiEnable=8'>Restore?</a><br>\n",src)
|
||||
|
||||
if(src.isWireCut(AIRLOCK_WIRE_SPEED))
|
||||
if(wires.is_cut(wires.W_TIMING))
|
||||
t1 += text("Door timing circuitry not responding.</a><br>\n")
|
||||
else if(src.normalspeed)
|
||||
t1 += text("Door timing circuitry operating normally. <A href='?src=\ref[];aiDisable=9'>Override?</a><br>\n",src)
|
||||
else
|
||||
t1 += text("Warning. Door timing circuitry operating abnormally. <A href='?src=\ref[];aiEnable=9'>Restore?</a><br>\n",src)
|
||||
|
||||
|
||||
|
||||
|
||||
if(src.welded)
|
||||
t1 += text("Door appears to have been welded shut.<br>\n")
|
||||
else if(!src.locked)
|
||||
@@ -542,7 +517,7 @@ About the new airlock wires panel:
|
||||
sleep(10)
|
||||
//bring up airlock dialog
|
||||
src.aiHacking = 0
|
||||
if (user)
|
||||
if(user)
|
||||
src.attack_ai(user)
|
||||
|
||||
/obj/machinery/door/airlock/attack_paw(mob/user)
|
||||
@@ -571,7 +546,7 @@ About the new airlock wires panel:
|
||||
return
|
||||
|
||||
if(src.p_open)
|
||||
wires.Interact(user)
|
||||
wires.interact(user)
|
||||
else
|
||||
..()
|
||||
return
|
||||
@@ -605,7 +580,7 @@ About the new airlock wires panel:
|
||||
switch (code)
|
||||
if(1)
|
||||
//disable idscan
|
||||
if(src.isWireCut(AIRLOCK_WIRE_IDSCAN))
|
||||
if(wires.is_cut(wires.W_IDSCAN))
|
||||
usr << "The IdScan wire has been cut - So, you can't disable it, but it is already disabled anyways."
|
||||
else if(src.aiDisabledIdScanner)
|
||||
usr << "You've already disabled the IdScan feature."
|
||||
@@ -627,13 +602,13 @@ About the new airlock wires panel:
|
||||
usr << "Backup power is already offline."
|
||||
if(4)
|
||||
//drop door bolts
|
||||
if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS))
|
||||
if(wires.is_cut(wires.W_BOLTS))
|
||||
usr << "You can't drop the door bolts - The door bolt dropping wire has been cut."
|
||||
else
|
||||
bolt()
|
||||
if(5)
|
||||
//un-electrify door
|
||||
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
|
||||
if(wires.is_cut(wires.W_SHOCK))
|
||||
usr << text("Can't un-electrify the airlock - The electrification wire is cut.")
|
||||
else if(src.secondsElectrified==-1)
|
||||
src.secondsElectrified = 0
|
||||
@@ -642,24 +617,21 @@ About the new airlock wires panel:
|
||||
|
||||
if(8)
|
||||
// Safeties! We don't need no stinking safeties!
|
||||
if (src.isWireCut(AIRLOCK_WIRE_SAFETY))
|
||||
if(wires.is_cut(wires.W_SAFETY))
|
||||
usr << text("Control to door sensors is disabled.")
|
||||
else if (src.safe)
|
||||
safe = 0
|
||||
else
|
||||
usr << text("Firmware reports safeties already overriden.")
|
||||
|
||||
|
||||
|
||||
if(9)
|
||||
// Door speed control
|
||||
if(src.isWireCut(AIRLOCK_WIRE_SPEED))
|
||||
if(wires.is_cut(wires.W_TIMING))
|
||||
usr << text("Control to door timing circuitry has been severed.")
|
||||
else if (src.normalspeed)
|
||||
normalspeed = 0
|
||||
else
|
||||
usr << text("Door timing circuitry already accelerated.")
|
||||
|
||||
if(7)
|
||||
//close door
|
||||
if(src.welded)
|
||||
@@ -673,7 +645,7 @@ About the new airlock wires panel:
|
||||
|
||||
if(10)
|
||||
// Bolt lights
|
||||
if(src.isWireCut(AIRLOCK_WIRE_LIGHT))
|
||||
if(wires.is_cut(wires.W_LIGHT))
|
||||
usr << text("Control to door bolt lights has been severed.</a>")
|
||||
else if (src.lights)
|
||||
lights = 0
|
||||
@@ -695,7 +667,7 @@ About the new airlock wires panel:
|
||||
switch (code)
|
||||
if(1)
|
||||
//enable idscan
|
||||
if(src.isWireCut(AIRLOCK_WIRE_IDSCAN))
|
||||
if(wires.is_cut(wires.W_IDSCAN))
|
||||
usr << "You can't enable IdScan - The IdScan wire has been cut."
|
||||
else if(src.aiDisabledIdScanner)
|
||||
src.aiDisabledIdScanner = 0
|
||||
@@ -703,7 +675,7 @@ About the new airlock wires panel:
|
||||
usr << "The IdScan feature is not disabled."
|
||||
if(4)
|
||||
//raise door bolts
|
||||
if(src.isWireCut(AIRLOCK_WIRE_DOOR_BOLTS))
|
||||
if(wires.is_cut(wires.W_BOLTS))
|
||||
usr << text("The door bolt drop wire is cut - you can't raise the door bolts.<br>\n")
|
||||
else if(!src.locked)
|
||||
usr << text("The door bolts are already up.<br>\n")
|
||||
@@ -715,7 +687,7 @@ About the new airlock wires panel:
|
||||
|
||||
if(5)
|
||||
//electrify door for 30 seconds
|
||||
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
|
||||
if(wires.is_cut(wires.W_SHOCK))
|
||||
usr << text("The electrification wire has been cut.<br>\n")
|
||||
else if(src.secondsElectrified==-1)
|
||||
usr << text("The door is already indefinitely electrified. You'd have to un-electrify it before you can re-electrify it with a non-forever duration.<br>\n")
|
||||
@@ -734,7 +706,7 @@ About the new airlock wires panel:
|
||||
sleep(10)
|
||||
if(6)
|
||||
//electrify door indefinitely
|
||||
if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY))
|
||||
if(wires.is_cut(wires.W_SHOCK))
|
||||
usr << text("The electrification wire has been cut.<br>\n")
|
||||
else if(src.secondsElectrified==-1)
|
||||
usr << text("The door is already indefinitely electrified.<br>\n")
|
||||
@@ -747,7 +719,7 @@ About the new airlock wires panel:
|
||||
|
||||
if (8) // Not in order >.>
|
||||
// Safeties! Maybe we do need some stinking safeties!
|
||||
if (src.isWireCut(AIRLOCK_WIRE_SAFETY))
|
||||
if(wires.is_cut(wires.W_SAFETY))
|
||||
usr << text("Control to door sensors is disabled.")
|
||||
else if (!src.safe)
|
||||
safe = 1
|
||||
@@ -757,7 +729,7 @@ About the new airlock wires panel:
|
||||
|
||||
if(9)
|
||||
// Door speed control
|
||||
if(src.isWireCut(AIRLOCK_WIRE_SPEED))
|
||||
if(wires.is_cut(wires.W_TIMING))
|
||||
usr << text("Control to door timing circuitry has been severed.")
|
||||
else if (!src.normalspeed)
|
||||
normalspeed = 1
|
||||
@@ -775,10 +747,9 @@ About the new airlock wires panel:
|
||||
open()
|
||||
else
|
||||
close()
|
||||
|
||||
if(10)
|
||||
// Bolt lights
|
||||
if(src.isWireCut(AIRLOCK_WIRE_LIGHT))
|
||||
if(wires.is_cut(wires.W_LIGHT))
|
||||
usr << text("Control to door bolt lights has been severed.</a>")
|
||||
else if (!src.lights)
|
||||
lights = 1
|
||||
@@ -786,7 +757,6 @@ About the new airlock wires panel:
|
||||
src.updateUsrDialog()
|
||||
else
|
||||
usr << text("Door bolt lights are already enabled!")
|
||||
|
||||
if(11)
|
||||
// Emergency access
|
||||
if (!src.emergency)
|
||||
@@ -836,8 +806,8 @@ About the new airlock wires panel:
|
||||
src.p_open = !( src.p_open )
|
||||
user << "<span class='notice'>You [p_open ? "open":"close"] the maintenance panel of the airlock.</span>"
|
||||
src.update_icon()
|
||||
else if(wires.IsInteractionTool(C))
|
||||
return src.attack_hand(user)
|
||||
else if(is_wire_tool(C))
|
||||
return attack_hand(user)
|
||||
else if(istype(C, /obj/item/weapon/pai_cable))
|
||||
var/obj/item/weapon/pai_cable/cable = C
|
||||
cable.plugin(src, user)
|
||||
@@ -962,7 +932,7 @@ About the new airlock wires panel:
|
||||
if( operating || welded || locked )
|
||||
return 0
|
||||
if(!forced)
|
||||
if( !hasPower() || isWireCut(AIRLOCK_WIRE_OPEN_DOOR) )
|
||||
if(!hasPower() || wires.is_cut(wires.W_OPEN))
|
||||
return 0
|
||||
if(charge && !detonated)
|
||||
p_open = 1
|
||||
@@ -1016,7 +986,7 @@ About the new airlock wires panel:
|
||||
if(operating || welded || locked)
|
||||
return
|
||||
if(!forced)
|
||||
if( !hasPower() || isWireCut(AIRLOCK_WIRE_DOOR_BOLTS) )
|
||||
if(!hasPower() || wires.is_cut(wires.W_BOLTS))
|
||||
return
|
||||
if(safe)
|
||||
for(var/atom/movable/M in get_turf(src))
|
||||
|
||||
@@ -76,11 +76,11 @@
|
||||
update_icon()
|
||||
user << "<span class='notice'>You [open_panel ? "open" : "close"] the wire panel.</span>"
|
||||
|
||||
else if(wires.IsInteractionTool(I) && open_panel)
|
||||
wires.Interact(user)
|
||||
else if(is_wire_tool(I) && open_panel)
|
||||
wires.interact(user)
|
||||
|
||||
else if(istype(I, /obj/item/weapon/crowbar))
|
||||
if(open_panel && isWireCut(WIRE_BOOM) && isWireCut(WIRE_UNBOLT) && isWireCut(WIRE_DELAY) && isWireCut(WIRE_PROCEED) && isWireCut(WIRE_ACTIVATE))
|
||||
if(open_panel && wires.is_all_cut())
|
||||
if(payload)
|
||||
user << "<span class='notice'>You carefully pry out [payload].</span>"
|
||||
payload.loc = user.loc
|
||||
@@ -110,8 +110,7 @@
|
||||
return
|
||||
|
||||
/obj/machinery/syndicatebomb/interact(mob/user)
|
||||
if(wires)
|
||||
wires.Interact(user)
|
||||
wires.interact(user)
|
||||
if(!open_panel)
|
||||
if(!active)
|
||||
settings(user)
|
||||
@@ -145,9 +144,6 @@
|
||||
log_game("[key_name(user)] has primed a [name] ([payload]) for detonation at [A.name]([bombturf.x],[bombturf.y],[bombturf.z])")
|
||||
payload.adminlog = "The [src.name] that [key_name(user)] had primed detonated!"
|
||||
|
||||
/obj/machinery/syndicatebomb/proc/isWireCut(index)
|
||||
return wires.IsIndexCut(index)
|
||||
|
||||
///Bomb Subtypes///
|
||||
|
||||
/obj/machinery/syndicatebomb/training
|
||||
@@ -217,7 +213,8 @@
|
||||
var/obj/machinery/syndicatebomb/holder = src.loc
|
||||
if(istype(holder))
|
||||
if(holder.wires)
|
||||
holder.wires.Shuffle()
|
||||
holder.wires.repair()
|
||||
holder.wires.randomize()
|
||||
holder.defused = 0
|
||||
holder.open_panel = 0
|
||||
holder.update_icon()
|
||||
|
||||
@@ -316,7 +316,7 @@
|
||||
/obj/machinery/vending/attack_hand(mob/user)
|
||||
var/dat = ""
|
||||
if(panel_open && !isAI(user))
|
||||
return wires.Interact(user)
|
||||
return wires.interact(user)
|
||||
else
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
dat += "<h3>Device Settings</h3><br>"
|
||||
if(radio)
|
||||
dat += "<b>Radio Uplink</b><br>"
|
||||
dat += "Transmit: <A href='byond://?src=\ref[src];wires=[WIRE_TRANSMIT]'>[(radio.wires.IsIndexCut(WIRE_TRANSMIT)) ? "Disabled" : "Enabled"]</A><br>"
|
||||
dat += "Receive: <A href='byond://?src=\ref[src];wires=[WIRE_RECEIVE]'>[(radio.wires.IsIndexCut(WIRE_RECEIVE)) ? "Disabled" : "Enabled"]</A><br>"
|
||||
dat += "Transmit: <A href='byond://?src=\ref[src];wires=[radio.wires.W_TX]'>[(radio.wires.is_cut(radio.wires.W_TX)) ? "Disabled" : "Enabled"]</A><br>"
|
||||
dat += "Receive: <A href='byond://?src=\ref[src];wires=[radio.wires.W_RX]'>[(radio.wires.is_cut(radio.wires.W_RX)) ? "Disabled" : "Enabled"]</A><br>"
|
||||
else
|
||||
dat += "<b>Radio Uplink</b><br>"
|
||||
dat += "<font color=red><i>Radio firmware not loaded. Please install a pAI personality to load firmware.</i></font><br>"
|
||||
@@ -86,9 +86,9 @@
|
||||
pai.death(0)
|
||||
removePersonality()
|
||||
if(href_list["wires"])
|
||||
var/t1 = text2num(href_list["wires"])
|
||||
var/wire = text2num(href_list["wires"])
|
||||
if(radio)
|
||||
radio.wires.CutWireIndex(t1)
|
||||
radio.wires.cut(wire)
|
||||
if(href_list["setlaws"])
|
||||
var/newlaws = copytext(sanitize(input("Enter any additional directives you would like your pAI personality to follow. Note that these directives will not override the personality's allegiance to its imprinted master. Conflicting directives will be ignored.", "pAI Directive Configuration", pai.laws.supplied[1]) as message),1,MAX_MESSAGE_LEN)
|
||||
if(newlaws && pai)
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
if(disarmed)
|
||||
visible_message("<span class='danger'>\icon[src] Sparks briefly jump out of \the [src], but it's disarmed!")
|
||||
return
|
||||
message_admins("a pizza bomb at <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[loc.x];Y=[loc.y];Z=[loc.z]'>(JMP)</a> armed by [key_name_admin(armer)] has exploded.")
|
||||
log_game("a pizza bomb ([loc.x],[loc.y],[loc.z]) armed by [key_name(armer)] has exploded.")
|
||||
src.audible_message("\icon[src] <b>[src]</b> beeps, \"Enjoy the pizza!\"")
|
||||
src.visible_message("<span class='userdanger'>\The [src] violently explodes!</span>")
|
||||
explosion(src.loc,1,2,4,flame_range = 2) //Identical to a minibomb
|
||||
@@ -65,7 +67,7 @@
|
||||
|
||||
/obj/item/device/pizza_bomb/attack_hand(mob/user)
|
||||
if(loc == user || primed)
|
||||
wires.Interact(user)
|
||||
wires.interact(user)
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -90,7 +92,7 @@
|
||||
else
|
||||
attack_hand(user)
|
||||
return
|
||||
if(wires.IsInteractionTool(I))
|
||||
if(is_wire_tool(I))
|
||||
attack_hand(user)
|
||||
return
|
||||
|
||||
@@ -107,7 +109,7 @@
|
||||
|
||||
/obj/item/device/pizza_bomb/proc/disarm()
|
||||
audible_message("\icon[src] \The [src] suddenly stops beeping and seems lifeless.")
|
||||
icon_state = "pizzabox_bomb_[wires.GetColour(PIZZA_WIRE_DISARM)]"
|
||||
icon_state = "pizzabox_bomb_disarmed"
|
||||
name = "pizza bomb"
|
||||
desc = "A devious contraption, made of a small explosive payload hooked up to pressure-sensitive wires. It's disarmed."
|
||||
disarmed = 1
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
/obj/item/device/radio/intercom/receive_range(freq, level)
|
||||
if(!on)
|
||||
return -1
|
||||
if(wires.IsIndexCut(WIRE_RECEIVE))
|
||||
if(wires.is_cut(wires.W_RX))
|
||||
return -1
|
||||
if(!(0 in level))
|
||||
var/turf/position = get_turf(src)
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
/obj/item/device/radio/New()
|
||||
wires = new(src)
|
||||
if(prison_radio)
|
||||
wires.CutWireIndex(WIRE_TRANSMIT)
|
||||
wires.cut(wires.W_TX) // OH GOD WHY
|
||||
secure_radio_connections = new
|
||||
..()
|
||||
if(SSradio)
|
||||
@@ -106,12 +106,11 @@
|
||||
for(var/ch_name in channels)
|
||||
secure_radio_connections[ch_name] = add_radio(src, radiochannels[ch_name])
|
||||
|
||||
|
||||
/obj/item/device/radio/interact(mob/user)
|
||||
if (..())
|
||||
return
|
||||
if(b_stat && !istype(user, /mob/living/silicon/ai))
|
||||
wires.Interact(user)
|
||||
wires.interact(user)
|
||||
else
|
||||
ui_interact(user)
|
||||
|
||||
@@ -188,9 +187,7 @@
|
||||
// Fix for permacell radios, but kinda eh about actually fixing them.
|
||||
if(!M || !message) return
|
||||
|
||||
// Uncommenting this. To the above comment:
|
||||
// The permacell radios aren't suppose to be able to transmit, this isn't a bug and this "fix" is just making radio wires useless. -Giacom
|
||||
if(wires.IsIndexCut(WIRE_TRANSMIT)) // The device has to have all its wires and shit intact
|
||||
if(wires.is_cut(wires.W_TX))
|
||||
return
|
||||
|
||||
if(!M.IsVocal())
|
||||
@@ -449,7 +446,7 @@
|
||||
// what the range is in which mobs will hear the radio
|
||||
// returns: -1 if can't receive, range otherwise
|
||||
|
||||
if (wires.IsIndexCut(WIRE_RECEIVE))
|
||||
if (wires.is_cut(wires.W_RX))
|
||||
return -1
|
||||
if(!listening)
|
||||
return -1
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
if(istype(I, /obj/item/weapon/screwdriver))
|
||||
open_panel = !open_panel
|
||||
user << "<span class='notice'>You [open_panel ? "open" : "close"] the wire panel.</span>"
|
||||
else if(wires.IsInteractionTool(I))
|
||||
wires.Interact(user)
|
||||
else if(is_wire_tool(I))
|
||||
wires.interact(user)
|
||||
else
|
||||
..()
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
//Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct
|
||||
/obj/item/device/assembly/proc/pulse(radio = 0)
|
||||
if(src.connected && src.wires)
|
||||
connected.Pulse(src)
|
||||
connected.pulse_assembly(src)
|
||||
return 1
|
||||
if(holder && (wires & WIRE_PULSE))
|
||||
holder.process_activation(src, 1, 0)
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
if(specialfunctions & IDSCAN)
|
||||
D.aiDisabledIdScanner = !D.aiDisabledIdScanner
|
||||
if(specialfunctions & BOLTS)
|
||||
if(!D.isWireCut(4) && D.hasPower())
|
||||
if(!D.wires.is_cut(D.wires.W_BOLTS) && D.hasPower())
|
||||
D.locked = !D.locked
|
||||
D.update_icon()
|
||||
if(specialfunctions & SHOCK)
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
|
||||
/datum/round_event/brand_intelligence/start()
|
||||
for(var/obj/machinery/vending/V in machines)
|
||||
if(V.z != 1) continue
|
||||
if(V.z != 1)
|
||||
continue
|
||||
vendingMachines.Add(V)
|
||||
if(!vendingMachines.len)
|
||||
kill()
|
||||
@@ -37,7 +38,7 @@
|
||||
|
||||
|
||||
/datum/round_event/brand_intelligence/tick()
|
||||
if(!originMachine || originMachine.gc_destroyed || originMachine.shut_up || originMachine.wires.IsAllCut()) //if the original vending machine is missing or has it's voice switch flipped
|
||||
if(!originMachine || originMachine.gc_destroyed || originMachine.shut_up || originMachine.wires.is_all_cut()) //if the original vending machine is missing or has it's voice switch flipped
|
||||
for(var/obj/machinery/vending/saved in infectedMachines)
|
||||
saved.shoot_inventory = 0
|
||||
if(originMachine)
|
||||
|
||||
@@ -144,8 +144,8 @@
|
||||
return
|
||||
|
||||
if(wires && !primed)
|
||||
if(wires.IsInteractionTool(I))
|
||||
wires.Interact(user)
|
||||
if(is_wire_tool(I))
|
||||
wires.interact(user)
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/weapon/pickaxe) || istype(I, /obj/item/weapon/resonator) || I.force >= 10)
|
||||
@@ -162,7 +162,7 @@
|
||||
|
||||
/obj/item/weapon/twohanded/required/gibtonite/attack_self(user)
|
||||
if(wires)
|
||||
wires.Interact(user)
|
||||
wires.interact(user)
|
||||
else
|
||||
..()
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
/mob/living/silicon/robot/handle_regular_status_updates()
|
||||
if(camera && !scrambledcodes)
|
||||
if(stat == DEAD || wires.IsCameraCut())
|
||||
if(stat == DEAD || wires.is_cut(wires.W_CAMERA))
|
||||
camera.status = 0
|
||||
else
|
||||
camera.status = 1
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
camera = new /obj/machinery/camera(src)
|
||||
camera.c_tag = real_name
|
||||
camera.network = list("SS13")
|
||||
if(wires.IsCameraCut()) // 5 = BORG CAMERA
|
||||
if(wires.is_cut(wires.W_CAMERA))
|
||||
camera.status = 0
|
||||
..()
|
||||
|
||||
@@ -449,7 +449,7 @@
|
||||
else
|
||||
user << "The wires seem fine, there's no need to fix them."
|
||||
|
||||
else if (istype(W, /obj/item/weapon/crowbar)) // crowbar means open or close the cover
|
||||
else if(istype(W, /obj/item/weapon/crowbar)) // crowbar means open or close the cover
|
||||
if(opened)
|
||||
user << "<span class='notice'>You close the cover.</span>"
|
||||
opened = 0
|
||||
@@ -462,7 +462,7 @@
|
||||
opened = 1
|
||||
update_icons()
|
||||
|
||||
else if (istype(W, /obj/item/weapon/stock_parts/cell) && opened) // trying to put a cell inside
|
||||
else if(istype(W, /obj/item/weapon/stock_parts/cell) && opened) // trying to put a cell inside
|
||||
if(wiresexposed)
|
||||
user << "<span class='warning'>Close the cover first!</span>"
|
||||
else if(cell)
|
||||
@@ -476,9 +476,9 @@
|
||||
update_icons()
|
||||
diag_hud_set_borgcell()
|
||||
|
||||
else if (wires.IsInteractionTool(W))
|
||||
else if(is_wire_tool(W))
|
||||
if (wiresexposed)
|
||||
wires.Interact(user)
|
||||
wires.interact(user)
|
||||
else
|
||||
user << "<span class='warning'>You can't reach the wiring!</span>"
|
||||
|
||||
@@ -990,7 +990,7 @@
|
||||
|
||||
/mob/living/silicon/robot/proc/SetLockdown(state = 1)
|
||||
// They stay locked down if their wire is cut.
|
||||
if(wires.LockedCut())
|
||||
if(wires.is_cut(wires.W_LOCKDOWN))
|
||||
state = 1
|
||||
if(state)
|
||||
throw_alert("locked", /obj/screen/alert/locked)
|
||||
|
||||
@@ -81,9 +81,6 @@ var/global/mulebot_count = 0
|
||||
..()
|
||||
if(open)
|
||||
on = FALSE
|
||||
icon_state="mulebot-hatch"
|
||||
else
|
||||
icon_state = "mulebot0"
|
||||
else if(istype(I,/obj/item/weapon/stock_parts/cell) && open && !cell)
|
||||
if(!user.drop_item())
|
||||
return
|
||||
@@ -98,7 +95,7 @@ var/global/mulebot_count = 0
|
||||
cell = null
|
||||
visible_message("[user] crowbars out the power cell from [src].",
|
||||
"<span class='notice'>You pry the powercell out of [src].</span>")
|
||||
else if(wires.IsInteractionTool(I) && open)
|
||||
else if(is_wire_tool(I) && open)
|
||||
return attack_hand(user)
|
||||
else if(load && ismob(load)) // chance to knock off rider
|
||||
if(prob(1 + I.force * 2))
|
||||
@@ -110,6 +107,7 @@ var/global/mulebot_count = 0
|
||||
..()
|
||||
else
|
||||
..()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/emag_act(mob/user)
|
||||
@@ -120,12 +118,11 @@ var/global/mulebot_count = 0
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/update_icon()
|
||||
switch(mode)
|
||||
if(BOT_IDLE)
|
||||
icon_state = "mulebot0"
|
||||
if(BOT_IDLE && open)
|
||||
if(open)
|
||||
icon_state="mulebot-hatch"
|
||||
else
|
||||
icon_state = "mulebot0"
|
||||
icon_state = "mulebot[wires.is_cut(wires.W_AVOIDANCE)]"
|
||||
overlays.Cut()
|
||||
if(load && !ismob(load))//buckling handles the mob offsets
|
||||
load.pixel_y = initial(load.pixel_y) + 9
|
||||
@@ -141,9 +138,9 @@ var/global/mulebot_count = 0
|
||||
qdel(src)
|
||||
if(2)
|
||||
for(var/i = 1; i < 3; i++)
|
||||
wires.RandomCut()
|
||||
wires.cut_random()
|
||||
if(3)
|
||||
wires.RandomCut()
|
||||
wires.cut_random()
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/bullet_act(obj/item/projectile/Proj)
|
||||
@@ -152,13 +149,13 @@ var/global/mulebot_count = 0
|
||||
unload(0)
|
||||
if(prob(25))
|
||||
visible_message("<span class='danger'>Something shorts out inside [src]!</span>")
|
||||
wires.RandomCut()
|
||||
wires.cut_random()
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/interact(mob/user)
|
||||
if(open && !istype(user, /mob/living/silicon/ai))
|
||||
wires.Interact(user)
|
||||
wires.interact(user)
|
||||
else
|
||||
if(!wires.RemoteRX() && istype(user, /mob/living/silicon/ai))
|
||||
if(wires.is_cut(wires.W_REMOTE_RX) && istype(user, /mob/living/silicon/ai))
|
||||
return
|
||||
ui_interact(user)
|
||||
|
||||
@@ -213,7 +210,7 @@ var/global/mulebot_count = 0
|
||||
return 1
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/bot_control(command, mob/user, pda = 0)
|
||||
if(pda && !wires.RemoteRX()) //MULE wireless is controlled by wires.
|
||||
if(pda && wires.is_cut(wires.W_REMOTE_RX)) //MULE wireless is controlled by wires.
|
||||
return
|
||||
|
||||
switch(command)
|
||||
@@ -303,7 +300,7 @@ var/global/mulebot_count = 0
|
||||
|
||||
// returns true if the bot has power
|
||||
/mob/living/simple_animal/bot/mulebot/proc/has_power()
|
||||
return !open && cell && cell.charge > 0 && wires.HasPower()
|
||||
return !open && cell && cell.charge > 0 && (!wires.is_cut(wires.W_POWER1) && !wires.is_cut(wires.W_POWER2))
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/proc/buzz(type)
|
||||
switch(type)
|
||||
@@ -342,7 +339,7 @@ var/global/mulebot_count = 0
|
||||
if(istype(AM,/obj/structure/closet/crate))
|
||||
CRATE = AM
|
||||
else
|
||||
if(wires.LoadCheck())
|
||||
if(!wires.is_cut(wires.W_LOADCHECK))
|
||||
buzz(SIGH)
|
||||
return // if not hacked, only allow crates to be loaded
|
||||
|
||||
@@ -427,7 +424,7 @@ var/global/mulebot_count = 0
|
||||
on = 0
|
||||
return
|
||||
if(on)
|
||||
var/speed = (wires.Motor1() ? 1 : 0) + (wires.Motor2() ? 2 : 0)
|
||||
var/speed = (wires.is_cut(wires.W_MOTOR1) ? 0 : 1) + (wires.is_cut(wires.W_MOTOR2) ? 0 : 2)
|
||||
//world << "speed: [speed]"
|
||||
var/num_steps = 0
|
||||
switch(speed)
|
||||
@@ -452,30 +449,26 @@ var/global/mulebot_count = 0
|
||||
/mob/living/simple_animal/bot/mulebot/proc/process_bot()
|
||||
if(!on)
|
||||
return
|
||||
update_icon()
|
||||
|
||||
switch(mode)
|
||||
if(BOT_IDLE) // idle
|
||||
icon_state = "mulebot0"
|
||||
if(BOT_IDLE) // idle
|
||||
return
|
||||
|
||||
if(BOT_DELIVER,BOT_GO_HOME,BOT_BLOCKED) // navigating to deliver,home, or blocked
|
||||
if(loc == target) // reached target
|
||||
if(BOT_DELIVER, BOT_GO_HOME, BOT_BLOCKED) // navigating to deliver,home, or blocked
|
||||
if(loc == target) // reached target
|
||||
at_target()
|
||||
return
|
||||
|
||||
else if(path.len > 0 && target) // valid path
|
||||
|
||||
else if(path.len > 0 && target) // valid path
|
||||
var/turf/next = path[1]
|
||||
reached_target = 0
|
||||
if(next == loc)
|
||||
path -= next
|
||||
return
|
||||
|
||||
|
||||
if(istype( next, /turf/simulated))
|
||||
//world << "at ([x],[y]) moving to ([next.x],[next.y])"
|
||||
|
||||
|
||||
if(bloodiness)
|
||||
var/obj/effect/decal/cleanable/blood/tracks/B = new(loc)
|
||||
B.blood_DNA |= blood_DNA.Copy()
|
||||
@@ -571,7 +564,7 @@ var/global/mulebot_count = 0
|
||||
mode = BOT_GO_HOME
|
||||
else
|
||||
mode = BOT_DELIVER
|
||||
icon_state = "mulebot[(wires.MobAvoid() != 0)]"
|
||||
update_icon()
|
||||
get_nav()
|
||||
|
||||
// starts bot moving to home
|
||||
@@ -582,7 +575,7 @@ var/global/mulebot_count = 0
|
||||
spawn(0)
|
||||
set_destination(home_destination)
|
||||
mode = BOT_BLOCKED
|
||||
icon_state = "mulebot[(wires.MobAvoid() != 0)]"
|
||||
update_icon()
|
||||
|
||||
// called when bot reaches current target
|
||||
/mob/living/simple_animal/bot/mulebot/proc/at_target()
|
||||
@@ -606,9 +599,9 @@ var/global/mulebot_count = 0
|
||||
unload(loaddir)
|
||||
else
|
||||
// not loaded
|
||||
if(auto_pickup) // find a crate
|
||||
if(auto_pickup) // find a crate
|
||||
var/atom/movable/AM
|
||||
if(!wires.LoadCheck()) // if emagged, load first unanchored thing we find
|
||||
if(wires.is_cut(wires.W_LOADCHECK)) // if hacked, load first unanchored thing we find
|
||||
for(var/atom/movable/A in get_step(loc, loaddir))
|
||||
if(!A.anchored)
|
||||
AM = A
|
||||
@@ -632,7 +625,7 @@ var/global/mulebot_count = 0
|
||||
|
||||
// called when bot bumps into anything
|
||||
/mob/living/simple_animal/bot/mulebot/Bump(atom/obs)
|
||||
if(!wires.MobAvoid()) //usually just bumps, but if avoidance disabled knock over mobs
|
||||
if(wires.is_cut(wires.W_AVOIDANCE)) // usually just bumps, but if avoidance disabled knock over mobs
|
||||
var/mob/M = obs
|
||||
if(ismob(M))
|
||||
if(istype(M,/mob/living/silicon/robot))
|
||||
@@ -674,8 +667,7 @@ var/global/mulebot_count = 0
|
||||
|
||||
//Update navigation data. Called when commanded to deliver, return home, or a route update is needed...
|
||||
/mob/living/simple_animal/bot/mulebot/proc/get_nav()
|
||||
//Formerly the beacon reception proc, except that it is no longer a potential lag bomb called TEN TIMES A SECOND OR MORE in some cases!
|
||||
if(!on || !wires.BeaconRX())
|
||||
if(!on || wires.is_cut(wires.W_BEACON_RX))
|
||||
return
|
||||
|
||||
for(var/obj/machinery/navbeacon/NB in deliverybeacons)
|
||||
@@ -688,7 +680,7 @@ var/global/mulebot_count = 0
|
||||
loaddir = text2num(direction)
|
||||
else
|
||||
loaddir = 0
|
||||
icon_state = "mulebot[(wires.MobAvoid() != null)]"
|
||||
update_icon()
|
||||
if(destination) // No need to calculate a path if you do not have a destination set!
|
||||
calc_path()
|
||||
|
||||
|
||||
+16
-23
@@ -1,9 +1,3 @@
|
||||
#define APC_RESET_IDSCAN 1
|
||||
#define APC_RESET_MAIN_POWER1 2
|
||||
#define APC_RESET_MAIN_POWER2 4
|
||||
#define APC_RESET_AI_CONTROL 8
|
||||
#define APC_RESET_EMP 5
|
||||
|
||||
//update_state
|
||||
#define UPSTATE_CELL_IN 1
|
||||
#define UPSTATE_OPENED1 2
|
||||
@@ -14,6 +8,8 @@
|
||||
#define UPSTATE_WIREEXP 64
|
||||
#define UPSTATE_ALLGOOD 128
|
||||
|
||||
#define APC_RESET_EMP "emp"
|
||||
|
||||
//update_overlay
|
||||
#define APC_UPOVERLAY_CHARGEING0 1
|
||||
#define APC_UPOVERLAY_CHARGEING1 2
|
||||
@@ -458,7 +454,7 @@
|
||||
else if(stat & (BROKEN|MAINT))
|
||||
user << "<span class='warning'>Nothing happens!</span>"
|
||||
else
|
||||
if(src.allowed(usr) && !wires.IsIndexCut(APC_WIRE_IDSCAN))
|
||||
if(allowed(usr) && !wires.is_cut(wires.W_IDSCAN))
|
||||
locked = !locked
|
||||
user << "<span class='notice'>You [ locked ? "lock" : "unlock"] the APC interface.</span>"
|
||||
update_icon()
|
||||
@@ -551,9 +547,8 @@
|
||||
opened = 1
|
||||
update_icon()
|
||||
else
|
||||
if((!opened && wiresexposed && wires.IsInteractionTool(W)) || (issilicon(user) && !(stat & BROKEN) &&!malfhack))
|
||||
if(!opened && wiresexposed && is_wire_tool(W))
|
||||
return attack_hand(user)
|
||||
|
||||
..()
|
||||
if( ((stat & BROKEN) || malfhack) && !opened && W.force >= 5 && W.w_class >= 3 && prob(20) )
|
||||
opened = 2
|
||||
@@ -605,17 +600,15 @@
|
||||
user.visible_message("<span class='danger'>[user.name] slashes at the [src.name]!</span>", "<span class='notice'>You slash at the [src.name]!</span>")
|
||||
playsound(src.loc, 'sound/weapons/slash.ogg', 100, 1)
|
||||
|
||||
var/allcut = wires.IsAllCut()
|
||||
|
||||
if(beenhit >= pick(3, 4) && wiresexposed != 1)
|
||||
wiresexposed = 1
|
||||
src.update_icon()
|
||||
src.visible_message("<span class='danger'>The [src.name]'s cover flies open, exposing the wires!</span>")
|
||||
update_icon()
|
||||
visible_message("<span class='danger'>The [src.name]'s cover flies open, exposing the wires!</span>")
|
||||
|
||||
else if(wiresexposed == 1 && allcut == 0)
|
||||
wires.CutAll()
|
||||
src.update_icon()
|
||||
src.visible_message("<span class='danger'>The [src.name]'s wires are shredded!</span>")
|
||||
else if(wiresexposed == 1 && !wires.is_all_cut())
|
||||
wires.cut_all()
|
||||
update_icon()
|
||||
visible_message("<span class='danger'>The [src.name]'s wires are shredded!</span>")
|
||||
else
|
||||
beenhit += 1
|
||||
return
|
||||
@@ -623,7 +616,7 @@
|
||||
|
||||
/obj/machinery/power/apc/interact(mob/user)
|
||||
if(wiresexposed && !istype(user, /mob/living/silicon/ai))
|
||||
wires.Interact(user)
|
||||
wires.interact(user)
|
||||
else
|
||||
ui_interact(user)
|
||||
|
||||
@@ -1067,16 +1060,16 @@
|
||||
|
||||
return val
|
||||
|
||||
/obj/machinery/power/apc/proc/reset(state)
|
||||
switch(state)
|
||||
if(APC_RESET_IDSCAN)
|
||||
/obj/machinery/power/apc/proc/reset(wire)
|
||||
switch(wire)
|
||||
if(WIRE_IDSCAN)
|
||||
locked = 1
|
||||
updateDialog()
|
||||
if(APC_RESET_MAIN_POWER1, APC_RESET_MAIN_POWER2)
|
||||
if(WIRE_POWER1, WIRE_POWER2)
|
||||
if(!wires.IsIndexCut(APC_WIRE_MAIN_POWER1) && !wires.IsIndexCut(APC_WIRE_MAIN_POWER2))
|
||||
shorted = 0
|
||||
updateDialog()
|
||||
if(APC_RESET_AI_CONTROL)
|
||||
if(WIRE_AI)
|
||||
if(!wires.IsIndexCut(APC_WIRE_AI_CONTROL))
|
||||
aidisabled = 0
|
||||
updateDialog()
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
var/list/obj/structure/particle_accelerator/connected_parts
|
||||
var/assembled = 0
|
||||
var/parts = null
|
||||
var/datum/wires/particle_acc/control_box/wires = null
|
||||
var/datum/wires/particle_accelerator/control_box/wires = null
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/New()
|
||||
wires = new(src)
|
||||
@@ -37,7 +37,7 @@
|
||||
if(construction_state >= 3)
|
||||
interact(user)
|
||||
else if(construction_state == 2) // Wires exposed
|
||||
wires.Interact(user)
|
||||
wires.interact(user)
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_state()
|
||||
if(construction_state < 3)
|
||||
@@ -91,18 +91,18 @@
|
||||
usr.unset_machine()
|
||||
return
|
||||
if(href_list["togglep"])
|
||||
if(!wires.IsIndexCut(PARTICLE_TOGGLE_WIRE))
|
||||
if(!wires.is_cut(wires.W_POWER))
|
||||
src.toggle_power()
|
||||
|
||||
else if(href_list["scan"])
|
||||
src.part_scan()
|
||||
|
||||
else if(href_list["strengthup"])
|
||||
if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
|
||||
if(!wires.is_cut(wires.W_STRENGTH))
|
||||
add_strength()
|
||||
|
||||
else if(href_list["strengthdown"])
|
||||
if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
|
||||
if(!wires.is_cut(wires.W_STRENGTH))
|
||||
remove_strength()
|
||||
|
||||
src.updateDialog()
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
if(shocked)
|
||||
shock(user,50)
|
||||
if(panel_open)
|
||||
wires.Interact(user)
|
||||
wires.interact(user)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
/**
|
||||
* tgui state: wire_state
|
||||
*
|
||||
* Checks specifically designed for wire datums.
|
||||
**/
|
||||
|
||||
/var/global/datum/ui_state/wire_state/wire_state = new()
|
||||
|
||||
/datum/ui_state/wire_state/can_use_topic(src_object, mob/user)
|
||||
var/datum/wires/W = src_object
|
||||
if(!istype(W))
|
||||
return UI_CLOSE
|
||||
if(!user.Adjacent(W.holder))
|
||||
return UI_CLOSE
|
||||
return W.CanUse(user) ? UI_INTERACTIVE : UI_CLOSE
|
||||
if(istype(W) && user.Adjacent(W.holder) && W.interactable(user))
|
||||
return UI_INTERACTIVE
|
||||
return UI_CLOSE
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.2 KiB |
+4
-4
File diff suppressed because one or more lines are too long
@@ -50,8 +50,13 @@ export function js () {
|
||||
.pipe(g.bytediff.stop())
|
||||
.pipe(gulp.dest(f.dest))
|
||||
}
|
||||
import gulplog from 'gulplog'
|
||||
export function watch_js () {
|
||||
bundle.plugin(b.watchify)
|
||||
bundle.on('update', js)
|
||||
bundle.on('error', err => {
|
||||
gulplog.error(err.toString())
|
||||
this.emit('end')
|
||||
})
|
||||
return js()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<section class='{{#candystripe}}candystripe{{/candystripe}}'>
|
||||
{{#if label}}
|
||||
<span class='label'>{{label}}:</span>
|
||||
<span class='label' style='{{#labelcolor}}color:{{labelcolor}}{{/labelcolor}}'>{{label}}:</span>
|
||||
{{/if}}
|
||||
{{#if nowrap}}
|
||||
{{yield}}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
<ui-display title="Exposed Wires">
|
||||
{{#each data.wires}}
|
||||
<ui-section style='text-align:center'>
|
||||
<span style='color:{{colour}};display:inline-block;width:50px;'>{{colour}}</span>
|
||||
<ui-button action='cut' params='{"wire":"{{colour}}"}'>{{isCut ? "Mend" : "Cut"}}</ui-button>
|
||||
<ui-button action='pulse' params='{"wire":"{{colour}}"}'>Pulse</ui-button>
|
||||
<ui-button action='attach' params='{"wire":"{{colour}}"}'>{{hasAttachment ? "Detach" : "Attach"}}</ui-button>
|
||||
</ui-section>
|
||||
{{/each}}
|
||||
{{#each data.holderInfo}}
|
||||
<ui-section>{{.}}</ui-section>
|
||||
{{/each}}
|
||||
</ui-display>
|
||||
<ui-display>
|
||||
{{#each data.wires}}
|
||||
<ui-section label='{{color}}{{wire ? " (" + wire + ")" : ""}}' labelcolor='{{color}}' right>
|
||||
<ui-button action='cut' params='{"wire":"{{color}}"}'>{{cut ? "Mend" : "Cut"}}</ui-button>
|
||||
<ui-button action='pulse' params='{"wire":"{{color}}"}'>Pulse</ui-button>
|
||||
<ui-button action='attach' params='{"wire":"{{color}}"}'>{{attached ? "Detach" : "Attach"}}</ui-button>
|
||||
</ui-section>
|
||||
{{/each}}
|
||||
</ui-display>
|
||||
{{#if data.status}}
|
||||
<ui-display>
|
||||
{{#each data.status}}
|
||||
<ui-section>{{.}}</ui-section>
|
||||
{{/each}}
|
||||
</ui-display>
|
||||
{{/if}}
|
||||
|
||||
Reference in New Issue
Block a user