initial commit - cross reference with 5th port - obviously has compile errors

This commit is contained in:
LetterJay
2016-07-03 02:17:19 -05:00
commit 35a1723e98
4355 changed files with 2221257 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
/datum/wires/airalarm
holder_type = /obj/machinery/airalarm
/datum/wires/airalarm/New(atom/holder)
wires = list(
WIRE_POWER,
WIRE_IDSCAN, WIRE_AI,
WIRE_PANIC, WIRE_ALARM
)
add_duds(3)
..()
/datum/wires/airalarm/interactable(mob/user)
var/obj/machinery/airalarm/A = holder
if(A.panel_open && A.buildstage == 2)
return TRUE
/datum/wires/airalarm/get_status()
var/obj/machinery/airalarm/A = holder
var/list/status = list()
status += "The interface light is [A.locked ? "red" : "green"]."
status += "The short indicator is [A.shorted ? "lit" : "off"]."
status += "The AI connection light is [!A.aidisabled ? "on" : "off"]."
return status
/datum/wires/airalarm/on_pulse(wire)
var/obj/machinery/airalarm/A = holder
switch(wire)
if(WIRE_POWER) // Short out for a long time.
if(!A.shorted)
A.shorted = TRUE
A.update_icon()
addtimer(A, "reset", 1200, FALSE, wire)
if(WIRE_IDSCAN) // Toggle lock.
A.locked = !A.locked
if(WIRE_AI) // Disable AI control for a while.
if(!A.aidisabled)
A.aidisabled = TRUE
addtimer(A, "reset", 100, FALSE, wire)
if(WIRE_PANIC) // Toggle panic siphon.
if(!A.shorted)
if(A.mode == 1) // AALARM_MODE_SCRUB
A.mode = 3 // AALARM_MODE_PANIC
else
A.mode = 1 // AALARM_MODE_SCRUB
A.apply_mode()
if(WIRE_ALARM) // Clear alarms.
var/area/AA = get_area_master(A)
if(AA.atmosalert(0, holder))
A.post_alert(0)
A.update_icon()
/datum/wires/airalarm/on_cut(wire, mend)
var/obj/machinery/airalarm/A = holder
switch(wire)
if(WIRE_POWER) // Short out forever.
A.shock(usr, 50)
A.shorted = !mend
A.update_icon()
if(WIRE_IDSCAN)
if(!mend)
A.locked = TRUE
if(WIRE_AI)
A.aidisabled = mend // Enable/disable AI control.
if(WIRE_PANIC) // Force panic syphon on.
if(!mend && !A.shorted)
A.mode = 3 // AALARM_MODE_PANIC
A.apply_mode()
if(WIRE_ALARM) // Post alarm.
var/area/AA = get_area_master(A)
if(AA.atmosalert(2, holder))
A.post_alert(2)
A.update_icon()
+150
View File
@@ -0,0 +1,150 @@
/datum/wires/airlock
holder_type = /obj/machinery/door/airlock
/datum/wires/airlock/secure
randomize = TRUE
/datum/wires/airlock/New(atom/holder)
wires = list(
WIRE_POWER1, WIRE_POWER2,
WIRE_BACKUP1, WIRE_BACKUP2,
WIRE_OPEN, WIRE_BOLTS, WIRE_IDSCAN, WIRE_AI,
WIRE_SHOCK, WIRE_SAFETY, WIRE_TIMING, WIRE_LIGHT,
WIRE_ZAP1, WIRE_ZAP2
)
add_duds(2)
..()
/datum/wires/airlock/interactable(mob/user)
var/obj/machinery/door/airlock/A = holder
if(!istype(user, /mob/living/silicon) && A.isElectrified() && A.shock(user, 100))
return FALSE
if(A.panel_open)
return TRUE
/datum/wires/airlock/get_status()
var/obj/machinery/door/airlock/A = holder
var/list/status = list()
status += "The door bolts [A.locked ? "have fallen!" : "look up."]"
status += "The test light is [A.hasPower() ? "on" : "off"]."
status += "The AI connection light is [A.aiControlDisabled || A.emagged ? "off" : "on"]."
status += "The check wiring light is [A.safe ? "off" : "on"]."
status += "The timer is powered [A.autoclose ? "on" : "off"]."
status += "The speed light is [A.normalspeed ? "on" : "off"]."
status += "The emergency light is [A.emergency ? "on" : "off"]."
return status
/datum/wires/airlock/on_pulse(wire)
var/obj/machinery/door/airlock/A = holder
switch(wire)
if(WIRE_POWER1, WIRE_POWER2) // Pulse to loose power.
A.loseMainPower()
if(WIRE_BACKUP1, WIRE_BACKUP2) // Pulse to loose backup power.
A.loseBackupPower()
if(WIRE_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(WIRE_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()
if(WIRE_IDSCAN) // Pulse to disable emergency access and flash red lights.
if(A.hasPower() && A.density)
A.do_animate("deny")
if(A.emergency)
A.emergency = FALSE
A.update_icon()
if(WIRE_AI) // Pulse to disable WIRE_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(WIRE_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")
spawn(10)
if(A)
while (A.secondsElectrified > 0)
A.secondsElectrified -= 1
if(A.secondsElectrified < 0)
A.secondsElectrified = 0
sleep(10)
if(WIRE_SAFETY)
A.safe = !A.safe
if(!A.density)
A.close()
if(WIRE_TIMING)
A.normalspeed = !A.normalspeed
if(WIRE_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(WIRE_POWER1, WIRE_POWER2) // Cut to loose power, repair all to gain power.
if(mend && !is_cut(WIRE_POWER1) && !is_cut(WIRE_POWER2))
A.regainMainPower()
A.shock(usr, 50)
else
A.loseMainPower()
A.shock(usr, 50)
if(WIRE_BACKUP1, WIRE_BACKUP2) // Cut to loose backup power, repair all to gain backup power.
if(mend && !is_cut(WIRE_BACKUP1) && !is_cut(WIRE_BACKUP2))
A.regainBackupPower()
A.shock(usr, 50)
else
A.loseBackupPower()
A.shock(usr, 50)
if(WIRE_BOLTS) // Cut to drop bolts, mend does nothing.
if(!mend)
A.bolt()
if(WIRE_AI) // Cut to disable WIRE_AI control, mend to re-enable.
if(mend)
if(A.aiControlDisabled == 1) // 0 = normal, 1 = locked out, 2 = overridden by WIRE_AI, -1 = previously overridden by WIRE_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(WIRE_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")
if(WIRE_SAFETY) // Cut to disable safeties, mend to re-enable.
A.safe = mend
if(WIRE_TIMING) // Cut to disable auto-close, mend to re-enable.
A.autoclose = mend
if(A.autoclose && !A.density)
A.close()
if(WIRE_LIGHT) // Cut to disable lights, mend to re-enable.
A.lights = mend
A.update_icon()
if(WIRE_ZAP1, WIRE_ZAP2) // Ouch.
A.shock(usr, 50)
+54
View File
@@ -0,0 +1,54 @@
/datum/wires/apc
holder_type = /obj/machinery/power/apc
/datum/wires/apc/New(atom/holder)
wires = list(
WIRE_POWER1, WIRE_POWER2,
WIRE_IDSCAN, WIRE_AI
)
add_duds(6)
..()
/datum/wires/apc/interactable(mob/user)
var/obj/machinery/power/apc/A = holder
if(A.panel_open && !A.opened)
return TRUE
/datum/wires/apc/get_status()
var/obj/machinery/power/apc/A = holder
var/list/status = list()
status += "The interface light is [A.locked ? "red" : "green"]."
status += "The short indicator is [A.shorted ? "lit" : "off"]."
status += "The AI connection light is [!A.aidisabled ? "on" : "off"]."
return status
/datum/wires/apc/on_pulse(wire)
var/obj/machinery/power/apc/A = holder
switch(wire)
if(WIRE_POWER1, WIRE_POWER2) // Short for a long while.
if(!A.shorted)
A.shorted = TRUE
addtimer(A, "reset", 1200, FALSE, wire)
if(WIRE_IDSCAN) // Unlock for a little while.
A.locked = FALSE
addtimer(A, "reset", 300, FALSE, wire)
if(WIRE_AI) // Disable AI control for a very short time.
if(!A.aidisabled)
A.aidisabled = TRUE
addtimer(A, "reset", 10, FALSE, wire)
/datum/wires/apc/on_cut(index, mend)
var/obj/machinery/power/apc/A = holder
switch(index)
if(WIRE_POWER1, WIRE_POWER2) // Short out.
if(mend && !is_cut(WIRE_POWER1) && !is_cut(WIRE_POWER2))
A.shorted = FALSE
A.shock(usr, 50)
else
A.shorted = TRUE
A.shock(usr, 50)
if(WIRE_AI) // Disable AI control.
if(mend)
A.aidisabled = FALSE
else
A.aidisabled = TRUE
+47
View File
@@ -0,0 +1,47 @@
/datum/wires/autolathe
holder_type = /obj/machinery/autolathe
/datum/wires/autolathe/New(atom/holder)
wires = list(
WIRE_HACK, WIRE_DISABLE,
WIRE_SHOCK, WIRE_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/get_status()
var/obj/machinery/autolathe/A = holder
var/list/status = list()
status += "The red light is [A.disabled ? "on" : "off"]."
status += "The blue light is [A.hacked ? "on" : "off"]."
return status
/datum/wires/autolathe/on_pulse(wire)
var/obj/machinery/autolathe/A = holder
switch(wire)
if(WIRE_HACK)
A.adjust_hacked(!A.hacked)
addtimer(A, "reset", 60, FALSE, wire)
if(WIRE_SHOCK)
A.shocked = !A.shocked
addtimer(A, "reset", 60, FALSE, wire)
if(WIRE_DISABLE)
A.disabled = !A.disabled
addtimer(A, "reset", 60, FALSE, wire)
/datum/wires/autolathe/on_cut(wire, mend)
var/obj/machinery/autolathe/A = holder
switch(wire)
if(WIRE_HACK)
A.adjust_hacked(!mend)
if(WIRE_HACK)
A.shocked = !mend
if(WIRE_DISABLE)
A.disabled = !mend
if(WIRE_ZAP)
A.shock(usr, 50)
+79
View File
@@ -0,0 +1,79 @@
/datum/wires/explosive/New(atom/holder)
add_duds(2) // In this case duds actually explode.
..()
/datum/wires/explosive/on_pulse(index)
explode()
/datum/wires/explosive/on_cut(index, mend)
explode()
/datum/wires/explosive/proc/explode()
return
/datum/wires/explosive/c4
holder_type = /obj/item/weapon/c4
/datum/wires/explosive/c4/interactable(mob/user)
var/obj/item/weapon/c4/P = holder
if(P.open_panel)
return TRUE
/datum/wires/explosive/c4/explode()
var/obj/item/weapon/c4/P = holder
P.explode()
/datum/wires/explosive/pizza
holder_type = /obj/item/pizzabox
randomize = TRUE
/datum/wires/explosive/pizza/New(atom/holder)
wires = list(
WIRE_DISARM
)
add_duds(3) // Duds also explode here.
..()
/datum/wires/explosive/pizza/interactable(mob/user)
var/obj/item/pizzabox/P = holder
if(P.open && P.bomb)
return TRUE
/datum/wires/explosive/pizza/get_status()
var/obj/item/pizzabox/P = holder
var/list/status = list()
status += "The red light is [P.bomb_active ? "on" : "off"]."
status += "The green light is [P.bomb_defused ? "on": "off"]."
return status
/datum/wires/explosive/pizza/on_pulse(wire)
var/obj/item/pizzabox/P = holder
switch(wire)
if(WIRE_DISARM) // Pulse to toggle
P.bomb_defused = !P.bomb_defused
else // Boom
explode()
/datum/wires/explosive/pizza/on_cut(wire, mend)
var/obj/item/pizzabox/P = holder
switch(wire)
if(WIRE_DISARM) // Disarm and untrap the box.
if(!mend)
P.bomb_defused = TRUE
else
if(!mend && !P.bomb_defused)
explode()
/datum/wires/explosive/pizza/explode()
var/obj/item/pizzabox/P = holder
P.bomb.detonate()
/datum/wires/explosive/gibtonite
holder_type = /obj/item/weapon/twohanded/required/gibtonite
/datum/wires/explosive/gibtonite/explode()
var/obj/item/weapon/twohanded/required/gibtonite/P = holder
P.GibtoniteReaction(null, 2)
+31
View File
@@ -0,0 +1,31 @@
/datum/wires/mulebot
holder_type = /mob/living/simple_animal/bot/mulebot
randomize = TRUE
/datum/wires/mulebot/New(atom/holder)
wires = list(
WIRE_POWER1, WIRE_POWER2,
WIRE_AVOIDANCE, WIRE_LOADCHECK,
WIRE_MOTOR1, WIRE_MOTOR2,
WIRE_RX, WIRE_TX, WIRE_BEACON
)
..()
/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(WIRE_POWER1, WIRE_POWER2)
holder.visible_message("<span class='notice'>\icon[M] The charge light flickers.</span>")
if(WIRE_AVOIDANCE)
holder.visible_message("<span class='notice'>\icon[M] The external warning lights flash briefly.</span>")
if(WIRE_LOADCHECK)
holder.visible_message("<span class='notice'>\icon[M] The load platform clunks.</span>")
if(WIRE_MOTOR1, WIRE_MOTOR2)
holder.visible_message("<span class='notice'>\icon[M] The drive motor whines briefly.</span>")
else
holder.visible_message("<span class='notice'>\icon[M] You hear a radio crackle.</span>")
+44
View File
@@ -0,0 +1,44 @@
/datum/wires/particle_accelerator/control_box
holder_type = /obj/machinery/particle_accelerator/control_box
/datum/wires/particle_accelerator/control_box/New(atom/holder)
wires = list(
WIRE_POWER, WIRE_STRENGTH, WIRE_LIMIT,
WIRE_INTERFACE
)
add_duds(2)
..()
/datum/wires/particle_accelerator/control_box/interactable(mob/user)
var/obj/machinery/particle_accelerator/control_box/C = holder
if(C.construction_state == 2)
return TRUE
/datum/wires/particle_accelerator/control_box/on_pulse(wire)
var/obj/machinery/particle_accelerator/control_box/C = holder
switch(wire)
if(WIRE_POWER)
C.toggle_power()
if(WIRE_STRENGTH)
C.add_strength()
if(WIRE_INTERFACE)
C.interface_control = !C.interface_control
if(WIRE_LIMIT)
C.visible_message("\icon[C]<b>[C]</b> makes a large whirring noise.")
/datum/wires/particle_accelerator/control_box/on_cut(wire, mend)
var/obj/machinery/particle_accelerator/control_box/C = holder
switch(wire)
if(WIRE_POWER)
if(C.active == !mend)
C.toggle_power()
if(WIRE_STRENGTH)
for(var/i = 1; i < 3; i++)
C.remove_strength()
if(WIRE_INTERFACE)
if(!mend)
C.interface_control = FALSE
if(WIRE_LIMIT)
C.strength_upper_limit = (mend ? 2 : 3)
if(C.strength_upper_limit < C.strength)
C.remove_strength()
+47
View File
@@ -0,0 +1,47 @@
/datum/wires/r_n_d
holder_type = /obj/machinery/r_n_d
randomize = TRUE
/datum/wires/r_n_d/New(atom/holder)
wires = list(
WIRE_HACK, WIRE_DISABLE,
WIRE_SHOCK
)
add_duds(5)
..()
/datum/wires/r_n_d/interactable(mob/user)
var/obj/machinery/r_n_d/R = holder
if(R.panel_open)
return TRUE
/datum/wires/r_n_d/get_status()
var/obj/machinery/r_n_d/R = holder
var/list/status = list()
status += "The red light is [R.disabled ? "off" : "on"]."
status += "The green light is [R.shocked ? "off" : "on"]."
status += "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(WIRE_HACK)
R.hacked = !R.hacked
if(WIRE_DISABLE)
R.disabled = !R.disabled
if(WIRE_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(WIRE_HACK)
R.hacked = !mend
if(WIRE_DISABLE)
R.disabled = !mend
if(WIRE_SHOCK)
R.shocked = !mend
+25
View File
@@ -0,0 +1,25 @@
/datum/wires/radio
holder_type = /obj/item/device/radio
/datum/wires/radio/New(atom/holder)
wires = list(
WIRE_SIGNAL,
WIRE_RX, WIRE_TX
)
..()
/datum/wires/radio/interactable(mob/user)
var/obj/item/device/radio/R = holder
if(R.b_stat)
return TRUE
/datum/wires/radio/on_pulse(index)
var/obj/item/device/radio/R = holder
switch(index)
if(WIRE_SIGNAL)
R.listening = !R.listening
R.broadcasting = R.listening
if(WIRE_RX)
R.listening = !R.listening
if(WIRE_TX)
R.broadcasting = !R.broadcasting
+66
View File
@@ -0,0 +1,66 @@
/datum/wires/robot
holder_type = /mob/living/silicon/robot
randomize = TRUE
/datum/wires/robot/New(atom/holder)
wires = list(
WIRE_AI, WIRE_CAMERA,
WIRE_LAWSYNC, WIRE_LOCKDOWN
)
add_duds(2)
..()
/datum/wires/robot/interactable(mob/user)
var/mob/living/silicon/robot/R = holder
if(R.wiresexposed)
return TRUE
/datum/wires/robot/get_status()
var/mob/living/silicon/robot/R = holder
var/list/status = list()
status += "The law sync module is [R.lawupdate ? "on" : "off"]."
status += "The intelligence link display shows [R.connected_ai ? R.connected_ai.name : "NULL"]."
status += "The camera light is [!isnull(R.camera) && R.camera.status ? "on" : "off"]."
status += "The lockdown indicator is [R.lockcharge ? "on" : "off"]."
return status
/datum/wires/robot/on_pulse(wire)
var/mob/living/silicon/robot/R = holder
switch(wire)
if(WIRE_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(TRUE)
if(WIRE_CAMERA) // Pulse to disable the camera.
if(!isnull(R.camera) && !R.scrambledcodes)
R.camera.toggle_cam(usr, 0)
R.visible_message("[R]'s camera lense focuses loudly.", "Your camera lense focuses loudly.")
if(WIRE_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(WIRE_LOCKDOWN)
R.SetLockdown(!R.lockcharge) // Toggle
/datum/wires/robot/on_cut(wire, mend)
var/mob/living/silicon/robot/R = holder
switch(wire)
if(WIRE_AI) // Cut the AI wire to reset AI control.
if(!mend)
R.connected_ai = null
if(WIRE_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 (WIRE_CAMERA) // Disable the camera.
if(!isnull(R.camera) && !R.scrambledcodes)
R.camera.status = mend
R.camera.toggle_cam(usr, 0)
R.visible_message("[R]'s camera lense focuses loudly.", "Your camera lense focuses loudly.")
if(WIRE_LOCKDOWN) // Simple lockdown.
R.SetLockdown(!mend)
+42
View File
@@ -0,0 +1,42 @@
/datum/wires/suit_storage_unit
holder_type = /obj/machinery/suit_storage_unit
/datum/wires/suit_storage_unit/New(atom/holder)
wires = list(
WIRE_HACK, WIRE_SAFETY,
WIRE_ZAP
)
add_duds(2)
..()
/datum/wires/suit_storage_unit/interactable(mob/user)
var/obj/machinery/suit_storage_unit/SSU = holder
if(SSU.panel_open)
return TRUE
/datum/wires/suit_storage_unit/get_status()
var/obj/machinery/suit_storage_unit/SSU = holder
var/list/status = list()
status += "The UV bulb is [SSU.uv_super ? "glowing" : "dim"]."
status += "The service light is [SSU.safeties ? "off" : "on"]."
return status
/datum/wires/suit_storage_unit/on_pulse(wire)
var/obj/machinery/suit_storage_unit/SSU = holder
switch(wire)
if(WIRE_HACK)
SSU.uv_super = !SSU.uv_super
if(WIRE_SAFETY)
SSU.safeties = !SSU.safeties
if(WIRE_ZAP)
SSU.shock(usr)
/datum/wires/suit_storage_unit/on_cut(wire, mend)
var/obj/machinery/suit_storage_unit/SSU = holder
switch(wire)
if(WIRE_HACK)
SSU.uv_super = !mend
if(WIRE_SAFETY)
SSU.safeties = mend
if(WIRE_ZAP)
SSU.shock(usr)
+91
View File
@@ -0,0 +1,91 @@
/datum/wires/syndicatebomb
holder_type = /obj/machinery/syndicatebomb
randomize = TRUE
/datum/wires/syndicatebomb/New(atom/holder)
wires = list(
WIRE_BOOM, WIRE_UNBOLT,
WIRE_ACTIVATE, WIRE_DELAY, WIRE_PROCEED
)
..()
/datum/wires/syndicatebomb/interactable(mob/user)
var/obj/machinery/syndicatebomb/P = holder
if(P.open_panel)
return TRUE
/datum/wires/syndicatebomb/on_pulse(wire)
var/obj/machinery/syndicatebomb/B = holder
switch(wire)
if(WIRE_BOOM)
if(B.active)
holder.visible_message("<span class='danger'>\icon[B] An alarm sounds! It's go-</span>")
B.timer = 0
tell_admins(B)
if(WIRE_UNBOLT)
holder.visible_message("<span class='notice'>\icon[B] The bolts spin in place for a moment.</span>")
if(WIRE_DELAY)
if(B.delayedbig)
holder.visible_message("<span class='notice'>\icon[B] The bomb has already been delayed.</span>")
else
holder.visible_message("<span class='notice'>\icon[B] The bomb chirps.</span>")
playsound(B, 'sound/machines/chime.ogg', 30, 1)
B.timer += 30
B.delayedbig = TRUE
if(WIRE_PROCEED)
holder.visible_message("<span class='danger'>\icon[B] The bomb buzzes ominously!</span>")
playsound(B, '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(WIRE_ACTIVATE)
if(!B.active && !B.defused)
holder.visible_message("<span class='danger'>\icon[B] You hear the bomb start ticking!</span>")
playsound(B, 'sound/machines/click.ogg', 30, 1)
B.active = TRUE
B.update_icon()
else if(B.delayedlittle)
holder.visible_message("<span class='notice'>\icon[B] Nothing happens.</span>")
else
holder.visible_message("<span class='notice'>\icon[B] The bomb seems to hesitate for a moment.</span>")
B.timer += 10
B.delayedlittle = TRUE
/datum/wires/syndicatebomb/on_cut(wire, mend)
var/obj/machinery/syndicatebomb/B = holder
switch(wire)
if(WIRE_BOOM)
if(mend)
B.defused = FALSE // Cutting and mending all the wires of an inactive bomb will thus cure any sabotage.
else
if(B.active)
holder.visible_message("<span class='danger'>\icon[B] An alarm sounds! It's go-</span>")
B.timer = 0
tell_admins(B)
else
B.defused = TRUE
if(WIRE_UNBOLT)
if(!mend && B.anchored)
holder.visible_message("<span class='notice'>\icon[B] The bolts lift out of the ground!</span>")
playsound(B, 'sound/effects/stealthoff.ogg', 30, 1)
B.anchored = 0
if(WIRE_PROCEED)
if(!mend && B.active)
holder.visible_message("<span class='danger'>\icon[B] An alarm sounds! It's go-</span>")
B.timer = 0
tell_admins(B)
if(WIRE_ACTIVATE)
if(!mend && B.active)
holder.visible_message("<span class='notice'>\icon[B] The timer stops! The bomb has been defused!</span>")
B.active = FALSE
B.defused = TRUE
B.update_icon()
/datum/wires/syndicatebomb/proc/tell_admins(obj/machinery/syndicatebomb/B)
if(istype(B, /obj/machinery/syndicatebomb/training))
return
log_game("A [B.name] was detonated via boom wire at X=[B.x], Y=[B.y], Z=[B.z].")
message_admins("A [B.name] was detonated via boom wire at <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[B.x];Y=[B.y];Z=[B.z]'> (JMP)</a>.")
+58
View File
@@ -0,0 +1,58 @@
/datum/wires/vending
holder_type = /obj/machinery/vending
/datum/wires/vending/New(atom/holder)
wires = list(
WIRE_THROW, WIRE_ELECTRIFY, WIRE_SPEAKER,
WIRE_CONTRABAND, WIRE_IDSCAN
)
add_duds(1)
..()
/datum/wires/vending/interactable(mob/user)
var/obj/machinery/vending/V = holder
if(!istype(user, /mob/living/silicon) && V.seconds_electrified && V.shock(user, 100))
return FALSE
if(V.panel_open)
return TRUE
/datum/wires/vending/get_status()
var/obj/machinery/vending/V = holder
var/list/status = list()
status += "The orange light is [V.seconds_electrified ? "on" : "off"]."
status += "The red light is [V.shoot_inventory ? "off" : "blinking"]."
status += "The green light is [V.extended_inventory ? "on" : "off"]."
status += "A [V.scan_id ? "purple" : "yellow"] light is on."
status += "The speaker light is [V.shut_up ? "off" : "on"]."
return status
/datum/wires/vending/on_pulse(wire)
var/obj/machinery/vending/V = holder
switch(wire)
if(WIRE_THROW)
V.shoot_inventory = !V.shoot_inventory
if(WIRE_CONTRABAND)
V.extended_inventory = !V.extended_inventory
if(WIRE_ELECTRIFY)
V.seconds_electrified = 30
if(WIRE_IDSCAN)
V.scan_id = !V.scan_id
if(WIRE_SPEAKER)
V.shut_up = !V.shut_up
/datum/wires/vending/on_cut(wire, mend)
var/obj/machinery/vending/V = holder
switch(wire)
if(WIRE_THROW)
V.shoot_inventory = !mend
if(WIRE_CONTRABAND)
V.extended_inventory = FALSE
if(WIRE_ELECTRIFY)
if(mend)
V.seconds_electrified = FALSE
else
V.seconds_electrified = -1
if(WIRE_IDSCAN)
V.scan_id = mend
if(WIRE_SPEAKER)
V.shut_up = mend
+344
View File
@@ -0,0 +1,344 @@
var/list/wire_colors = list( // http://www.crockford.com/wrrrld/color.html
"aliceblue",
"antiquewhite",
"aqua",
"aquamarine",
"beige",
"blanchedalmond",
"blue",
"blueviolet",
"brown",
"burlywood",
"cadetblue",
"chartreuse",
"chocolate",
"coral",
"cornflowerblue",
"cornsilk",
"crimson",
"cyan",
"deeppink",
"deepskyblue",
"dimgray",
"dodgerblue",
"firebrick",
"floralwhite",
"forestgreen",
"fuchsia",
"gainsboro",
"ghostwhite",
"gold",
"goldenrod",
"gray",
"green",
"greenyellow",
"honeydew",
"hotpink",
"indianred",
"ivory",
"khaki",
"lavender",
"lavenderblush",
"lawngreen",
"lemonchiffon",
"lightblue",
"lightcoral",
"lightcyan",
"lightgoldenrodyellow",
"lightgray",
"lightgreen",
"lightpink",
"lightsalmon",
"lightseagreen",
"lightskyblue",
"lightslategray",
"lightsteelblue",
"lightyellow",
"lime",
"limegreen",
"linen",
"magenta",
"maroon",
"mediumaquamarine",
"mediumblue",
"mediumorchid",
"mediumpurple",
"mediumseagreen",
"mediumslateblue",
"mediumspringgreen",
"mediumturquoise",
"mediumvioletred",
"mintcream",
"mistyrose",
"moccasin",
"navajowhite",
"oldlace",
"olive",
"olivedrab",
"orange",
"orangered",
"orchid",
"palegoldenrod",
"palegreen",
"paleturquoise",
"palevioletred",
"papayawhip",
"peachpuff",
"peru",
"pink",
"plum",
"powderblue",
"purple",
"red",
"rosybrown",
"royalblue",
"saddlebrown",
"salmon",
"sandybrown",
"seagreen",
"seashell",
"sienna",
"silver",
"skyblue",
"slateblue",
"slategray",
"snow",
"springgreen",
"steelblue",
"tan",
"teal",
"thistle",
"tomato",
"turquoise",
"violet",
"wheat",
"white",
"whitesmoke",
"yellow",
"yellowgreen",
)
var/list/wire_color_directory = list()
/proc/is_wire_tool(obj/item/I)
if(istype(I, /obj/item/device/multitool))
return TRUE
if(istype(I, /obj/item/weapon/wirecutters))
return TRUE
if(istype(I, /obj/item/device/assembly))
var/obj/item/device/assembly/A = I
if(A.attachable)
return TRUE
return
/atom
var/datum/wires/wires = null
/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).
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.
/datum/wires/New(atom/holder)
..()
if(!istype(holder, holder_type))
CRASH("Wire holder is not of the expected type!")
return
src.holder = holder
if(randomize)
randomize()
else
if(!wire_color_directory[holder_type])
randomize()
wire_color_directory[holder_type] = colors
else
colors = wire_color_directory[holder_type]
/datum/wires/Destroy()
holder = null
assemblies = list()
return ..()
/datum/wires/proc/add_duds(duds)
while(duds)
var/dud = "dud[--duds]"
if(dud in wires)
continue
wires += dud
/datum/wires/proc/randomize()
var/list/possible_colors = wire_colors.Copy()
for(var/wire in shuffle(wires))
colors[pick_n_take(possible_colors)] = wire
/datum/wires/proc/shuffle_wires()
colors.Cut()
randomize()
/datum/wires/proc/repair()
cut_wires.Cut()
/datum/wires/proc/get_wire(color)
return colors[color]
/datum/wires/proc/get_attached(color)
if(assemblies[color])
return assemblies[color]
return null
/datum/wires/proc/is_attached(color)
if(assemblies[color])
return TRUE
/datum/wires/proc/is_cut(wire)
return (wire in cut_wires)
/datum/wires/proc/is_color_cut(color)
return is_cut(get_wire(color))
/datum/wires/proc/is_all_cut()
if(cut_wires.len == wires.len)
return TRUE
/datum/wires/proc/cut(wire)
if(is_cut(wire))
cut_wires -= wire
on_cut(wire, mend = TRUE)
else
cut_wires += wire
on_cut(wire, mend = FALSE)
/datum/wires/proc/cut_color(color)
cut(get_wire(color))
/datum/wires/proc/cut_random()
cut(wires[rand(1, wires.len)])
/datum/wires/proc/cut_all()
for(var/wire in wires)
cut(wire)
/datum/wires/proc/pulse(wire)
if(is_cut(wire))
return
on_pulse(wire)
/datum/wires/proc/pulse_color(color)
pulse(get_wire(color))
/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, mend = FALSE)
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_host()
return holder
/datum/wires/ui_status(mob/user)
if(interactable(user))
return ..()
return UI_CLOSE
/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 = physical_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/ui_data(mob/user)
var/list/data = list()
var/list/payload = list()
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["status"] = get_status()
return data
/datum/wires/ui_act(action, params)
if(..() || !interactable(usr))
return
var/target_wire = params["wire"]
var/mob/living/L = usr
var/obj/item/I = L.get_active_hand()
switch(action)
if("cut")
if(istype(I, /obj/item/weapon/wirecutters) || IsAdminGhost(usr))
playsound(holder, 'sound/items/Wirecutter.ogg', 20, 1)
cut_color(target_wire)
. = TRUE
else
L << "<span class='warning'>You need wirecutters!</span>"
if("pulse")
if(istype(I, /obj/item/device/multitool) || IsAdminGhost(usr))
playsound(holder, 'sound/weapons/empty.ogg', 20, 1)
pulse_color(target_wire)
. = TRUE
else
L << "<span class='warning'>You need a multitool!</span>"
if("attach")
if(is_attached(target_wire))
var/obj/item/O = detach_assembly(target_wire)
if(O)
L.put_in_hands(O)
. = TRUE
else
if(istype(I, /obj/item/device/assembly))
var/obj/item/device/assembly/A = I
if(A.attachable)
if(!L.drop_item())
return
attach_assembly(target_wire, A)
. = TRUE
else
L << "<span class='warning'>You need an attachable assembly!</span>"