Converts all machines relying on RandomAPCWires() to the new wire datum system.

This commit is contained in:
PsiOmega
2014-10-13 21:46:45 +02:00
parent f190acf7c5
commit 97a5186cee
8 changed files with 209 additions and 311 deletions
+52
View File
@@ -0,0 +1,52 @@
/datum/wires/smartfridge
holder_type = /obj/machinery/smartfridge
wire_count = 3
var/const/SMARTFRIDGE_WIRE_ELECTRIFY = 1
var/const/SMARTFRIDGE_WIRE_THROW = 2
var/const/SMARTFRIDGE_WIRE_IDSCAN = 4
/datum/wires/smartfridge/CanUse(var/mob/living/L)
var/obj/machinery/smartfridge/S = holder
if(!istype(L, /mob/living/silicon))
if(S.seconds_electrified)
if(S.shock(L, 100))
return 0
if(S.panel_open)
return 1
return 0
/datum/wires/smartfridge/Interact(var/mob/living/user)
if(CanUse(user))
var/obj/machinery/smartfridge/S = holder
S.attack_hand(user)
/datum/wires/smartfridge/GetInteractWindow()
var/obj/machinery/smartfridge/S = holder
. += ..()
. += "<BR>The orange light is [S.seconds_electrified ? "off" : "on"].<BR>"
. += "The red light is [S.shoot_inventory ? "off" : "blinking"].<BR>"
. += "A [S.scan_id ? "purple" : "yellow"] light is on.<BR>"
/datum/wires/smartfridge/UpdatePulsed(var/index)
var/obj/machinery/smartfridge/S = holder
switch(index)
if(SMARTFRIDGE_WIRE_THROW)
S.shoot_inventory = !S.shoot_inventory
if(SMARTFRIDGE_WIRE_ELECTRIFY)
S.seconds_electrified = 30
if(SMARTFRIDGE_WIRE_IDSCAN)
S.scan_id = !S.scan_id
/datum/wires/smartfridge/UpdateCut(var/index, var/mended)
var/obj/machinery/smartfridge/S = holder
switch(index)
if(SMARTFRIDGE_WIRE_THROW)
S.shoot_inventory = !mended
if(SMARTFRIDGE_WIRE_ELECTRIFY)
if(mended)
S.seconds_electrified = 0
else
S.seconds_electrified = -1
if(SMARTFRIDGE_WIRE_IDSCAN)
S.scan_id = 1
+52
View File
@@ -0,0 +1,52 @@
/datum/wires/suit_storage_unit
holder_type = /obj/machinery/suit_cycler
wire_count = 3
var/const/SUIT_STORAGE_WIRE_ELECTRIFY = 1
var/const/SUIT_STORAGE_WIRE_SAFETY = 2
var/const/SUIT_STORAGE_WIRE_LOCKED = 4
/datum/wires/suit_storage_unit/CanUse(var/mob/living/L)
var/obj/machinery/suit_cycler/S = holder
if(!istype(L, /mob/living/silicon))
if(S.electrified)
if(S.shock(L, 100))
return 0
if(S.panel_open)
return 1
return 0
/datum/wires/suit_storage_unit/Interact(var/mob/living/user)
if(CanUse(user))
var/obj/machinery/suit_cycler/S = holder
S.attack_hand(user)
/datum/wires/suit_storage_unit/GetInteractWindow()
var/obj/machinery/suit_cycler/S = holder
. += ..()
. += "<BR>The orange light is [S.electrified ? "off" : "on"].<BR>"
. += "The red light is [S.safeties ? "off" : "blinking"].<BR>"
. += "The yellow light is [S.locked ? "on" : "off"].<BR>"
/datum/wires/suit_storage_unit/UpdatePulsed(var/index)
var/obj/machinery/suit_cycler/S = holder
switch(index)
if(SUIT_STORAGE_WIRE_SAFETY)
S.safeties = !S.safeties
if(SUIT_STORAGE_WIRE_ELECTRIFY)
S.electrified = 30
if(SUIT_STORAGE_WIRE_LOCKED)
S.locked = !S.locked
/datum/wires/suit_storage_unit/UpdateCut(var/index, var/mended)
var/obj/machinery/suit_cycler/S = holder
switch(index)
if(SUIT_STORAGE_WIRE_SAFETY)
S.safeties = mended
if(SUIT_STORAGE_WIRE_LOCKED)
S.locked = mended
if(SUIT_STORAGE_WIRE_ELECTRIFY)
if(mended)
S.electrified = 0
else
S.electrified = -1
+58
View File
@@ -0,0 +1,58 @@
/datum/wires/vending
holder_type = /obj/machinery/vending
wire_count = 4
var/const/VENDING_WIRE_THROW = 1
var/const/VENDING_WIRE_CONTRABAND = 2
var/const/VENDING_WIRE_ELECTRIFY = 4
var/const/VENDING_WIRE_IDSCAN = 8
/datum/wires/vending/CanUse(var/mob/living/L)
var/obj/machinery/vending/V = holder
if(!istype(L, /mob/living/silicon))
if(V.seconds_electrified)
if(V.shock(L, 100))
return 0
if(V.panel_open)
return 1
return 0
/datum/wires/vending/Interact(var/mob/living/user)
if(CanUse(user))
var/obj/machinery/vending/V = holder
V.attack_hand(user)
/datum/wires/vending/GetInteractWindow()
var/obj/machinery/vending/V = holder
. += ..()
. += "<BR>The orange light is [V.seconds_electrified ? "off" : "on"].<BR>"
. += "The red light is [V.shoot_inventory ? "off" : "blinking"].<BR>"
. += "The green light is [V.extended_inventory ? "on" : "off"].<BR>"
. += "The [V.scan_id ? "purple" : "yellow"] light is on.<BR>"
/datum/wires/vending/UpdatePulsed(var/index)
var/obj/machinery/vending/V = holder
switch(index)
if(VENDING_WIRE_THROW)
V.shoot_inventory = !V.shoot_inventory
if(VENDING_WIRE_CONTRABAND)
V.extended_inventory = !V.extended_inventory
if(VENDING_WIRE_ELECTRIFY)
V.seconds_electrified = 30
if(VENDING_WIRE_IDSCAN)
V.scan_id = !V.scan_id
/datum/wires/vending/UpdateCut(var/index, var/mended)
var/obj/machinery/vending/V = holder
switch(index)
if(VENDING_WIRE_THROW)
V.shoot_inventory = !mended
if(VENDING_WIRE_CONTRABAND)
V.extended_inventory = 0
if(VENDING_WIRE_ELECTRIFY)
if(mended)
V.seconds_electrified = 0
else
V.seconds_electrified = -1
if(VENDING_WIRE_IDSCAN)
V.scan_id = 1