Rewrite SSUs, tweak newly added UIs

This commit is contained in:
Bjorn Neergaard
2016-01-24 18:41:28 -06:00
parent 87642fa588
commit 961eeea661
10 changed files with 401 additions and 637 deletions

View File

@@ -123,8 +123,8 @@
..()
update_icon()
/obj/machinery/atmospherics/components/unary/cryo_cell/relaymove(mob/user) // Prevent ventcrawl in this machine.
return
/obj/machinery/atmospherics/components/unary/cryo_cell/relaymove(mob/user)
container_resist()
/obj/machinery/atmospherics/components/unary/cryo_cell/open_machine()
if(!state_open && !panel_open)
@@ -175,7 +175,7 @@
I.loc = src
user.visible_message("[user] places [I] in [src].", \
"<span class='notice'>You place [I] in [src].</span>")
if(!(on || occupant || state_open))
if(!on && !occupant && !state_open)
if(default_deconstruction_screwdriver(user, "cell-o", "cell-off", I))
return
if(exchange_parts(user, I))

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)

View File

@@ -1,12 +1,3 @@
//////////////////////////////////////
// SUIT STORAGE UNIT /////////////////
//////////////////////////////////////
#define REPAIR_NEEDS_WIRECUTTERS 1
#define REPAIR_NEEDS_WIRES 2
#define REPAIR_NEEDS_CROWBAR 3
#define REPAIR_NEEDS_METAL 4
/obj/machinery/suit_storage_unit
name = "suit storage unit"
desc = "An industrial unit made to hold space suits. It comes with a built-in UV cauterization mechanism. A small warning label advises that organic matter should not be placed into the unit."
@@ -14,197 +5,294 @@
icon_state = "close"
anchored = 1
density = 1
//Vars to hold internal items
var/obj/item/clothing/suit/space/suit = null
var/obj/item/clothing/head/helmet/space/helmet = null
var/obj/item/clothing/mask/mask = null
var/obj/item/storage = null
//Base types on creation
var/SUIT_TYPE = null
var/HELMET_TYPE = null
var/MASK_TYPE = null
var/STORAGE_TYPE = null
//Machine related vars
var/maintenance_mode = 0
var/isopen = 0
var/islocked = 0
var/isUV = 0
var/ispowered = 1
var/isbroken = 0
var/issuperUV = 0
var/safetieson = 1
var/cycletime_left = 0
var/repair_stage = 0
/obj/machinery/suit_storage_unit/examine(mob/user)
..()
if(isbroken && isopen)
if(!maintenance_mode)
user << "<span class='warning'>A small LED above the maintenance panel is flashing red.</span>"
return
switch(repair_stage)
if(REPAIR_NEEDS_WIRECUTTERS)
user << "<span class='warning'>The wires inside are charred and snapped.</span>"
if(REPAIR_NEEDS_WIRES)
user << "<span class='warning'>There are no wires inside.</span>"
if(REPAIR_NEEDS_CROWBAR)
user << "<span class='warning'>Some of the interior metal is burnt and broken.</span>"
if(REPAIR_NEEDS_METAL)
user << "<span class='warning'>It lacks interior plating.</span>"
var/suit_type = null
var/helmet_type = null
var/mask_type = null
var/storage_type = null
state_open = FALSE
var/locked = FALSE
panel_open = FALSE
var/safeties = TRUE
var/uv = FALSE
var/uv_super = FALSE
var/uv_cycles = 6
/obj/machinery/suit_storage_unit/standard_unit
SUIT_TYPE = /obj/item/clothing/suit/space/eva
HELMET_TYPE = /obj/item/clothing/head/helmet/space/eva
MASK_TYPE = /obj/item/clothing/mask/breath
suit_type = /obj/item/clothing/suit/space/eva
helmet_type = /obj/item/clothing/head/helmet/space/eva
mask_type = /obj/item/clothing/mask/breath
/obj/machinery/suit_storage_unit/captain
SUIT_TYPE = /obj/item/clothing/suit/space/captain
HELMET_TYPE = /obj/item/clothing/head/helmet/space/captain
MASK_TYPE = /obj/item/clothing/mask/gas
STORAGE_TYPE = /obj/item/weapon/tank/jetpack/oxygen/captain
suit_type = /obj/item/clothing/suit/space/captain
helmet_type = /obj/item/clothing/head/helmet/space/captain
mask_type = /obj/item/clothing/mask/gas
storage_type = /obj/item/weapon/tank/jetpack/oxygen/captain
/obj/machinery/suit_storage_unit/engine
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/engine
MASK_TYPE = /obj/item/clothing/mask/breath
suit_type = /obj/item/clothing/suit/space/hardsuit/engine
mask_type = /obj/item/clothing/mask/breath
/obj/machinery/suit_storage_unit/ce
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/engine/elite
MASK_TYPE = /obj/item/clothing/mask/breath
STORAGE_TYPE= /obj/item/clothing/shoes/magboots/advance
suit_type = /obj/item/clothing/suit/space/hardsuit/engine/elite
mask_type = /obj/item/clothing/mask/breath
storage_type= /obj/item/clothing/shoes/magboots/advance
/obj/machinery/suit_storage_unit/security
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/security
MASK_TYPE = /obj/item/clothing/mask/gas/sechailer
suit_type = /obj/item/clothing/suit/space/hardsuit/security
mask_type = /obj/item/clothing/mask/gas/sechailer
/obj/machinery/suit_storage_unit/hos
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/security/hos
MASK_TYPE = /obj/item/clothing/mask/gas/sechailer
suit_type = /obj/item/clothing/suit/space/hardsuit/security/hos
mask_type = /obj/item/clothing/mask/gas/sechailer
/obj/machinery/suit_storage_unit/atmos
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/engine/atmos
MASK_TYPE = /obj/item/clothing/mask/gas
STORAGE_TYPE = /obj/item/weapon/watertank/atmos
suit_type = /obj/item/clothing/suit/space/hardsuit/engine/atmos
mask_type = /obj/item/clothing/mask/gas
storage_type = /obj/item/weapon/watertank/atmos
/obj/machinery/suit_storage_unit/mining
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/mining
MASK_TYPE = /obj/item/clothing/mask/breath
suit_type = /obj/item/clothing/suit/space/hardsuit/mining
mask_type = /obj/item/clothing/mask/breath
/obj/machinery/suit_storage_unit/cmo
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/medical
MASK_TYPE = /obj/item/clothing/mask/breath
suit_type = /obj/item/clothing/suit/space/hardsuit/medical
mask_type = /obj/item/clothing/mask/breath
/obj/machinery/suit_storage_unit/rd
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/rd
MASK_TYPE = /obj/item/clothing/mask/breath
suit_type = /obj/item/clothing/suit/space/hardsuit/rd
mask_type = /obj/item/clothing/mask/breath
/obj/machinery/suit_storage_unit/syndicate
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/syndi
MASK_TYPE = /obj/item/clothing/mask/gas/syndicate
STORAGE_TYPE = /obj/item/weapon/tank/jetpack/oxygen/harness
suit_type = /obj/item/clothing/suit/space/hardsuit/syndi
mask_type = /obj/item/clothing/mask/gas/syndicate
storage_type = /obj/item/weapon/tank/jetpack/oxygen/harness
/obj/machinery/suit_storage_unit/ertCom
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/ert
MASK_TYPE = /obj/item/clothing/mask/breath
STORAGE_TYPE = /obj/item/weapon/tank/internals/emergency_oxygen/double
/obj/machinery/suit_storage_unit/ert/command
suit_type = /obj/item/clothing/suit/space/hardsuit/ert
mask_type = /obj/item/clothing/mask/breath
storage_type = /obj/item/weapon/tank/internals/emergency_oxygen/double
/obj/machinery/suit_storage_unit/ertSec
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/ert/sec
MASK_TYPE = /obj/item/clothing/mask/breath
STORAGE_TYPE = /obj/item/weapon/tank/internals/emergency_oxygen/double
/obj/machinery/suit_storage_unit/ert/security
suit_type = /obj/item/clothing/suit/space/hardsuit/ert/sec
mask_type = /obj/item/clothing/mask/breath
storage_type = /obj/item/weapon/tank/internals/emergency_oxygen/double
/obj/machinery/suit_storage_unit/ertEngi
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/ert/engi
MASK_TYPE = /obj/item/clothing/mask/breath
STORAGE_TYPE = /obj/item/weapon/tank/internals/emergency_oxygen/double
/obj/machinery/suit_storage_unit/ert/engineer
suit_type = /obj/item/clothing/suit/space/hardsuit/ert/engi
mask_type = /obj/item/clothing/mask/breath
storage_type = /obj/item/weapon/tank/internals/emergency_oxygen/double
/obj/machinery/suit_storage_unit/ertMed
SUIT_TYPE = /obj/item/clothing/suit/space/hardsuit/ert/med
MASK_TYPE = /obj/item/clothing/mask/breath
STORAGE_TYPE = /obj/item/weapon/tank/internals/emergency_oxygen/double
/obj/machinery/suit_storage_unit/ert/medical
suit_type = /obj/item/clothing/suit/space/hardsuit/ert/med
mask_type = /obj/item/clothing/mask/breath
storage_type = /obj/item/weapon/tank/internals/emergency_oxygen/double
/obj/machinery/suit_storage_unit/New()
wires = new /datum/wires/suit_storage_unit(src)
if(suit_type)
suit = new suit_type(src)
if(helmet_type)
helmet = new helmet_type(src)
if(mask_type)
mask = new mask_type(src)
if(storage_type)
storage = new storage_type(src)
update_icon()
if(SUIT_TYPE)
suit = new SUIT_TYPE(src)
if(HELMET_TYPE)
helmet = new HELMET_TYPE(src)
if(MASK_TYPE)
mask = new MASK_TYPE(src)
if(STORAGE_TYPE)
storage = new STORAGE_TYPE(src)
/obj/machinery/suit_storage_unit/update_icon() //overlays yaaaay - Jordie
overlays = 0
/obj/machinery/suit_storage_unit/update_icon()
overlays.Cut()
if(!isopen)
overlays += "close"
if(occupant)
overlays += "human"
if(occupant && isUV)
overlays += "uvhuman"
if(isUV)
overlays += "uv"
if(issuperUV && isUV)
overlays += "super"
if(isopen)
overlays += "open"
if(suit)
overlays += "suit"
if(helmet)
overlays += "helm"
if(storage)
overlays += "storage"
if(isbroken)
if(uv)
if(uv_super)
overlays += "super"
else if(occupant)
overlays += "uvhuman"
else
overlays += "uv"
else if(state_open)
if(stat & BROKEN)
overlays += "broken"
return
else
overlays += "open"
if(suit)
overlays += "suit"
if(helmet)
overlays += "helm"
if(storage)
overlays += "storage"
else if(occupant)
overlays += "human"
/obj/machinery/suit_storage_unit/power_change()
..()
ispowered = !(stat & NOPOWER)
if((stat & NOPOWER) && isopen)
dump_everything()
if(!is_operational() && state_open)
open_machine(dump = TRUE)
update_icon()
/obj/machinery/suit_storage_unit/open_machine(dump = FALSE)
state_open = TRUE
if(dump)
dropContents()
helmet = null
suit = null
mask = null
storage = null
occupant = null
update_icon()
/obj/machinery/suit_storage_unit/ex_act(severity, target)
switch(severity)
if(1)
if(prob(50))
dump_everything() //So suits dont survive all the time
open_machine(dump = TRUE)
qdel(src)
return
if(2)
if(prob(50))
dump_everything()
open_machine(dump = TRUE)
qdel(src)
return
else
return
return
/obj/machinery/suit_storage_unit/get_ui_data()
var/list/data = list()
data["isBroken"] = isbroken
data["isLocked"] = islocked
data["isOpen"] = isopen
data["isBaking"] = isUV
data["uv"] = issuperUV
data["safety"] = safetieson
data["maintenance"] = maintenance_mode
if(helmet)
data["helmet"] = helmet.name
if(suit)
data["suit"] = suit.name
if(mask)
data["mask"] = mask.name
if(storage)
data["aux"] = storage.name
if(occupant)
data["occupied"] = 1
return data
/obj/machinery/suit_storage_unit/MouseDrop_T(mob/target, mob/user)
stuff_mob(target, user)
/obj/machinery/suit_storage_unit/proc/stuff_mob(mob/target, mob/user)
if(user.stat || user.lying || !Adjacent(user) || !Adjacent(target))
return
if(!state_open)
user << "<span class='warning'>The unit's doors are shut!</span>"
return
if(!is_operational())
user << "<span class='warning'>The unit is not operational!</span>"
return
if(occupant || helmet || suit || storage)
user << "<span class='warning'>It's too cluttered inside to fit in!</span>"
return
if(target == user)
visible_message("<span class='warning'>[user] squeezes into [src]!</span>", "<span class='notice'>You squeeze into [src].</span>")
else
visible_message("<span class='warning'>[user] starts putting [target] into [src]!</span>", "<span class='userdanger'>[user] starts shoving you into [src]!</span>")
if(do_mob(user, target, 10))
close_machine(target)
add_fingerprint(user)
/obj/machinery/suit_storage_unit/proc/cook()
if(uv_cycles)
uv_cycles--
uv = TRUE
locked = TRUE
update_icon()
if(occupant)
if(uv_super)
occupant.adjustFireLoss(rand(20, 36))
else
occupant.adjustFireLoss(rand(10, 16))
if(iscarbon(occupant))
occupant.emote("scream")
addtimer(src, "cook", 50, FALSE)
else
uv_cycles = initial(uv_cycles)
uv = FALSE
locked = FALSE
if(uv_super)
visible_message("<span class='warning'>With a loud whining noise, [src]'s door grinds open. A foul cloud of smoke emanates from the chamber.</span>")
helmet = null
qdel(helmet)
suit = null
qdel(suit) // Delete everything but the occupant.
mask = null
qdel(mask)
storage = null
qdel(storage)
// The wires get damaged too.
wires.cut_all()
else
visible_message("<span class='warning'>With a loud whining noise, [src]'s door grinds open. A light cloud of steam escapes from the chamber.</span>")
for(var/obj/item/I in src)
I.clean_blood()
open_machine(dump = !!occupant)
/obj/machinery/suit_storage_unit/proc/shock(mob/user, prb)
if(!prob(prb))
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(5, 1, src)
s.start()
if(electrocute_mob(user, src, src))
return 1
/obj/machinery/suit_storage_unit/relaymove(mob/user)
container_resist()
/obj/machinery/suit_storage_unit/container_resist()
var/mob/living/user = usr
add_fingerprint(user)
if(locked)
visible_message("<span class='notice'>You see [user] kicking against the doors of [src]!</span>", "<span class='notice'>You start kicking against the doors...</span>")
addtimer(src, "resist_open", 300, FALSE, user)
else
open_machine()
/obj/machinery/suit_storage_unit/proc/resist_open(mob/user)
if(!state_open && occupant && (user in src) && user.stat == 0) // Check they're still here.
visible_message("<span class='notice'>You see [user] bursts out of [src]!</span>", "<span class='notice'>You escape the cramped confines of [src]!</span>")
open_machine()
/obj/machinery/suit_storage_unit/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weapon/grab))
var/obj/item/weapon/grab/G = I
stuff_mob(G.affecting, user)
else if(state_open && is_operational())
if(istype(I, /obj/item/clothing/suit/space))
if(suit)
user << "<span class='warning'>The unit already contains a suit!.</span>"
return
if(!user.drop_item())
return
suit = I
else if(istype(I, /obj/item/clothing/head/helmet))
if(helmet)
user << "<span class='warning'>The unit already contains a helmet!</span>"
return
if(!user.drop_item())
return
helmet = I
else if(istype(I, /obj/item/clothing/mask))
if(mask)
user << "<span class='warning'>The unit already contains a mask!</span>"
return
if(!user.drop_item())
return
mask = I
else if(istype(I, /obj/item))
if(storage)
user << "<span class='warning'>The auxiliary storage compartment is full!</span>"
return
if(!user.drop_item())
return
storage = I
I.loc = src
visible_message("<span class='notice'>[user] inserts [I] into [src]</span>", "<span class='notice'>You load [I] into [src].</span>")
if(panel_open && is_wire_tool(I))
wires.interact(user)
if(!state_open)
if(default_deconstruction_screwdriver(user, "panel", "close", I))
return
if(default_pry_open(I))
return
update_icon()
return
/obj/machinery/suit_storage_unit/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
datum/tgui/master_ui = null, datum/ui_state/state = physical_state)
@@ -213,401 +301,61 @@
ui = new(user, src, ui_key, "suit_storage", name, 400, 305, master_ui, state)
ui.open()
/obj/machinery/suit_storage_unit/get_ui_data()
var/list/data = list()
data["locked"] = locked
data["open"] = state_open
data["safeties"] = safeties
data["uv_active"] = uv
data["uv_super"] = uv_super
if(helmet)
data["helmet"] = helmet.name
if(suit)
data["suit"] = suit.name
if(mask)
data["mask"] = mask.name
if(storage)
data["storage"] = storage.name
if(occupant)
data["occupied"] = 1
return data
/obj/machinery/suit_storage_unit/ui_act(action, params)
if(..() || uv)
return
switch(action)
if ("uv")
toggleUV(usr)
if ("safety")
togglesafeties(usr)
if ("helmet")
dispense_helmet(usr)
if ("suit")
dispense_suit(usr)
if ("mask")
dispense_mask(usr)
if ("aux")
eject_storage(usr)
if ("toggle_open")
toggle_open(usr)
if ("toggle_lock")
toggle_lock(usr)
if ("uv_start")
start_UV(usr)
if ("mob")
eject_occupant(usr)
update_icon()
return 1
/obj/machinery/suit_storage_unit/proc/toggleUV(mob/user)
if(!maintenance_mode)
return
else
if(issuperUV)
user << "<span class='notice'>You slide the dial back towards \"185nm\".</span>"
issuperUV = 0
else
user << "<span class='notice'>You crank the dial all the way up to \"15nm\".</span>"
issuperUV = 1
return
/obj/machinery/suit_storage_unit/proc/togglesafeties(mob/user)
if(!maintenance_mode) //Needed check due to bugs
return
else
user << "<span class='notice'>You push the button. The coloured LED next to it changes.</span>"
safetieson = !safetieson
/obj/machinery/suit_storage_unit/proc/dispense_helmet()
eject(helmet)
helmet = null
/obj/machinery/suit_storage_unit/proc/dispense_suit()
eject(suit)
suit = null
/obj/machinery/suit_storage_unit/proc/dispense_mask()
eject(mask)
mask = null
/obj/machinery/suit_storage_unit/proc/eject_storage()
eject(storage)
storage = null
/obj/machinery/suit_storage_unit/proc/eject(atom/movable/ITEM)
//Check item still exists - if not, then usually someone has already ejected the item
if(ITEM)
ITEM.loc = loc
/obj/machinery/suit_storage_unit/proc/dump_everything()
for(var/obj/item/ITEM in src)
eject(ITEM)
suit = null
helmet = null
mask = null
storage = null
if(occupant)
eject_occupant(occupant)
return
/obj/machinery/suit_storage_unit/proc/toggle_open(mob/user)
if(islocked || isUV)
user << "<span class='warning'>You're unable to open unit!</span>"
return 0
if(occupant)
eject_occupant(user)
return 1 // eject_occupant opens the door, so we need to return
isopen = !isopen
return 1
/obj/machinery/suit_storage_unit/proc/toggle_lock(mob/user)
if(occupant && safetieson)
user << "<span class='warning'>The unit's safety protocols disallow locking when a biological form is detected inside its compartments.</span>"
return
if(isopen)
return
islocked = !islocked
return
/obj/machinery/suit_storage_unit/proc/start_UV(mob/user)
if(isUV || isopen) //I'm bored of all these sanity checks
return
if(occupant && safetieson)
user << "<font color='red'><B>WARNING:</B> Biological entity detected in the confines of the unit's storage. Cannot initiate cycle.</font>"
return
if(!helmet && !mask && !suit && !storage && !occupant )
user << "<font color='red'>Unit storage bays empty. Nothing to disinfect -- Aborting.</font>"
return
user << "<span class='notice'>You start the unit's cauterisation cycle.</span>"
cycletime_left = 20
isUV = 1
if(occupant && !islocked)
islocked = 1 //Let's lock it for good measure
update_icon()
var/i
spawn(0)
for(i=0,i<4,++i)
sleep(50)
if(occupant)
var/burndamage = rand(6,10)
if(issuperUV)
burndamage = rand(28,35)
if(iscarbon(occupant))
occupant.take_organ_damage(0,burndamage)
occupant.emote("scream")
else
occupant.take_organ_damage(burndamage)
if(i==3) //End of the cycle
if(!issuperUV)
for(var/obj/item/ITEM in src)
ITEM.clean_blood()
if(istype(storage, /obj/item/weapon/reagent_containers/food))
qdel(storage)
else //It was supercycling, destroy everything
helmet = null
suit = null
mask = null
qdel(storage)
visible_message("<span class='warning'>With a loud whining noise, [src]'s door grinds open. A foul cloud of smoke emanates from the chamber.</span>")
isbroken = 1
isopen = 1
islocked = 0
repair_stage = REPAIR_NEEDS_WIRECUTTERS
eject_occupant(occupant)
isUV = 0 //Cycle ends
update_icon()
return
/obj/machinery/suit_storage_unit/proc/cycletimeleft()
if(cycletime_left >= 1)
cycletime_left--
return cycletime_left
/obj/machinery/suit_storage_unit/proc/eject_occupant(mob/user)
if (islocked)
return
if (!occupant)
return
if (occupant.client)
if(user != occupant)
occupant << "<span class='warning'>The machine kicks you out!</span>"
if(user.loc != loc)
occupant << "<span class='warning'>You leave the not-so-cozy confines of [src].</span>"
occupant.client.eye = occupant.client.mob
occupant.client.perspective = MOB_PERSPECTIVE
if(occupant.loc == src)
occupant.loc = loc
occupant = null
if(!isopen)
isopen = 1
update_icon()
return
/obj/machinery/suit_storage_unit/relaymove(mob/user)
if(user.stat || !isturf(loc))
return
container_resist()
/obj/machinery/suit_storage_unit/container_resist()
var/mob/living/user = usr
if(islocked)
user.changeNext_move(CLICK_CD_BREAKOUT)
user.last_special = world.time + CLICK_CD_BREAKOUT
var/breakout_time = 2
user << "<span class='notice'>You start kicking against the doors to escape... (This will take about [breakout_time] minutes.)</span>"
visible_message("You see [user] kicking against the doors of \the [src]!")
if(do_after(user,(breakout_time*60*10), target = src))
if(!user || user.stat != CONSCIOUS || user.loc != src || isopen || !islocked)
if("door")
if(state_open)
close_machine()
else
open_machine(!!occupant) // Dump out contents if someone is in there.
. = TRUE
if("lock")
locked = !locked
. = TRUE
if("uv")
if(occupant && safeties)
return
else if(!helmet && !mask && !suit && !storage && !occupant)
return
else
isopen = 1
islocked = 0
visible_message("<span class='warning'>[user] kicks their way out of [src]!</span>")
else
return
eject_occupant(user)
add_fingerprint(user)
update_icon()
return
/obj/machinery/suit_storage_unit/MouseDrop_T(mob/M, mob/user)
store_mob(M, user)
/obj/machinery/suit_storage_unit/proc/store_mob(mob/living/M, mob/user)
if(!istype(M))
return
if (user.stat != 0)
return
if (!isopen)
user << "<span class='warning'>The unit's doors are shut!</span>"
return
if (!ispowered || isbroken)
user << "<span class='warning'>The unit is not operational!</span>"
return
if ( occupant || helmet || suit || storage )
user << "<span class='warning'>It's too cluttered inside to fit in!</span>"
return
if(M == user)
visible_message("<span class='warning'>[user] squeezes into [src]!</span>", "<span class='notice'>You squeeze into [src].</span>")
else
M.visible_message("<span class='warning'>[user] starts putting [M] into [src]!</span>", "<span class='userdanger'>[user] starts shoving you into [src]!</span>")
if(do_mob(user, M, 10))
user.stop_pulling()
if(M.client)
M.client.perspective = EYE_PERSPECTIVE
M.client.eye = src
M.loc = src
occupant = M
isopen = 0
update_icon()
add_fingerprint(user)
return
return
/obj/machinery/suit_storage_unit/proc/fix()
audible_message("<span class='notice'>[src] beeps and comes back online!</span>")
playsound(src, 'sound/machines/defib_ready.ogg', 50, 1)
repair_stage = 0
isbroken = 0
update_icon()
/obj/machinery/suit_storage_unit/attackby(obj/item/I, mob/user, params)
if(!ispowered)
if(istype(I, /obj/item/weapon/crowbar) && !isopen)
if(toggle_open(user))
dump_everything()
user << text("<span class='notice'>You pry open [src]'s doors.</span>")
update_icon()
return
if(istype(I, /obj/item/weapon/screwdriver))
maintenance_mode = !maintenance_mode
playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1)
user << text("<span class='notice'>You [] the unit's maintenance panel.</span>",(maintenance_mode ? "open up" : "close") )
return
if(isbroken && maintenance_mode)
if(istype(I, /obj/item/weapon/wirecutters) && repair_stage == REPAIR_NEEDS_WIRECUTTERS)
user.visible_message("<span class='notice'>[user] starts removing [src]'s damaged wires.</span>", \
"<span class='notice'>You begin removing the damaged wires from [src]...</span>")
playsound(src, 'sound/items/Wirecutter.ogg', 50, 1)
if(!do_after(user, 30/I.toolspeed, target = src))
cook()
. = TRUE
if("dispense")
if(!state_open)
return
user.visible_message("<span class='notice'>[user] removes the damaged wires from [src].</span>", \
"<spna class='notice'>You remove the damaged wiring from [src].</span>")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
repair_stage = REPAIR_NEEDS_WIRES
return
if(istype(I, /obj/item/stack/cable_coil) && repair_stage == REPAIR_NEEDS_WIRES)
var/obj/item/stack/cable_coil/C = I
if(C.amount < 5)
user << "<span class='warning'>You need at least five cables to rewire [src]!</span>"
return
user.visible_message("<span class='notice'>[user] begins replacing [src] wires.</span>", \
"<span class='notice'>You begin rewiring [src]...</span>")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(!do_after(user, 30, target = src))
return
user.visible_message("<span class='notice'>[user] adds wires to [src].</span>", \
"<span class='notice'>You rewire [src].</span>")
C.amount -= 5
if(C.amount <= 0)
user.drop_item()
qdel(C)
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
repair_stage = REPAIR_NEEDS_CROWBAR
return
if(istype(I, /obj/item/weapon/crowbar) && repair_stage == REPAIR_NEEDS_CROWBAR)
user.visible_message("<span class='notice'>[user] starts removing [src]'s broken interior plating.</span>", \
"<span class='notice'>You begin removing the damaged interior plating from [src]...</span>")
playsound(src, 'sound/items/Crowbar.ogg', 50, 1)
if(!do_after(user, 30/I.toolspeed, target = src))
return
user.visible_message("<span class='notice'>[user] removes the damaged interior plating from [src].</span>", \
"<spna class='notice'>You remove the damaged interior plating from [src].</span>")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
repair_stage = REPAIR_NEEDS_METAL
return
if(istype(I, /obj/item/stack/sheet/metal) && repair_stage == REPAIR_NEEDS_METAL)
var/obj/item/stack/sheet/metal/M = I
if(M.amount < 3)
user << "<span class='warning'>You need at least three sheets of metal to repair [src]!</span>"
return
user.visible_message("<span class='notice'>[user] starts adding interior plating to [src].</span>", \
"<span class='notice'>You begin adding interior plating to [src]...</span>")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(!do_after(user, 30, target = src))
return
user.visible_message("<span class='notice'>[user] adds interior plating to [src].</span>", \
"<spna class='notice'>You add interior plating to [src].</span>")
fix()
return
if ( istype(I, /obj/item/weapon/grab) )
var/obj/item/weapon/grab/G = I
store_mob(G.affecting, user)
return
if( istype(I,/obj/item/clothing/suit/space) )
if(!isopen || isbroken)
return
var/obj/item/clothing/suit/space/S = I
if(suit)
user << "<span class='notice'>The unit already contains a suit.</span>"
return
if(!user.drop_item())
user << "<span class='warning'>[S] is stuck to your hand, you cannot put it in [src]!</span>"
return
user << "<span class='notice'>You load [S] into the suit storage compartment.</span>"
S.loc = src
suit = S
update_icon()
return
if( istype(I,/obj/item/clothing/head/helmet) )
if(!isopen || isbroken)
return
var/obj/item/clothing/head/helmet/H = I
if(helmet)
user << "<span class='warning'>The unit already contains a helmet!</span>"
return
if(!user.drop_item())
user << "<span class='warning'>[H] is stuck to your hand, you cannot put it in the Suit Storage Unit!</span>"
return
user << "<span class='notice'>You load [H] into the helmet storage compartment.</span>"
H.loc = src
helmet = H
update_icon()
return
if( istype(I,/obj/item/clothing/mask) )
if(!isopen || isbroken)
return
var/obj/item/clothing/mask/M = I
if(mask)
user << "<span class='warning'>The unit already contains a mask!</span>"
return
if(!user.drop_item())
user << "<span class='warning'>[M] is stuck to your hand, you cannot put it in the Suit Storage Unit!</span>"
return
user << "<span class='notice'>You load [M] into the mask storage compartment.</span>"
M.loc = src
mask = M
update_icon()
return
if( istype(I,/obj/item) )
if(!isopen || isbroken)
return
var/obj/item/ITEM = I
if(storage)
user << "<span class='warning'>The auxiliary storage compartment is full!</span>"
return
if(!user.drop_item())
user << "<span class='warning'>[ITEM] is stuck to your hand, you cannot put it in the Suit Storage Unit!</span>"
return
user << "<span class='notice'>You load [ITEM] into the auxiliary storage compartment.</span>"
ITEM.loc = src
storage = ITEM
update_icon()
return
/obj/machinery/suit_storage_unit/attack_ai(mob/user)
return attack_hand(user)
/obj/machinery/suit_storage_unit/attack_paw(mob/user)
user << "<span class='warning'>You don't know how to work this!</span>"
return
#undef REPAIR_NEEDS_WIRECUTTERS
#undef REPAIR_NEEDS_WIRES
#undef REPAIR_NEEDS_CROWBAR
#undef REPAIR_NEEDS_METAL
switch(params["item"])
if("helmet")
helmet.loc = loc
helmet = null
if("suit")
suit.loc = loc
suit = null
if("mask")
mask.loc = loc
mask = null
if("storage")
storage.loc = loc
storage = null
. = TRUE
update_icon()

View File

@@ -11,7 +11,6 @@
var/mob/living/silicon/ai/AI
origin_tech = "programming=4;materials=4"
/obj/item/device/aicard/afterattack(atom/target, mob/user, proximity)
..()
if(!proximity || !target)
@@ -21,20 +20,21 @@
add_logs(user, AI, "carded", src)
else //No AI on the card, therefore the user wants to download one.
target.transfer_ai(AI_TRANS_TO_CARD, user, null, src)
update_state() //Whatever happened, update the card's state (icon, name) to match.
update_icon() //Whatever happened, update the card's state (icon, name) to match.
/obj/item/device/aicard/proc/update_state()
/obj/item/device/aicard/update_icon()
if(AI)
name = "intelliCard - [AI.name]"
if (AI.stat == DEAD)
name = "[initial(name)]- [AI.name]"
if(AI.stat == DEAD)
icon_state = "aicard-404"
else
icon_state = "aicard-full"
AI.cancel_camera() //AI are forced to move when transferred, so do this whenver one is downloaded.
if(!AI.control_disabled)
overlays += image('icons/obj/aicards.dmi', "aicard-on")
AI.cancel_camera()
else
icon_state = "aicard"
name = "intelliCard"
name = initial(name)
icon_state = initial(icon_state)
overlays.Cut()
/obj/item/device/aicard/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
@@ -44,7 +44,6 @@
ui = new(user, src, ui_key, "intellicard", name, 500, 500, master_ui, state)
ui.open()
/obj/item/device/aicard/get_ui_data()
var/list/data = list()
if(AI)
@@ -61,28 +60,26 @@
/obj/item/device/aicard/ui_act(action,params)
if(..())
return
switch(action)
if("wipe")
var/confirm = alert("Are you sure you want to wipe this card's memory? This cannot be undone once started.", "Confirm Wipe", "Yes", "No")
var/confirm = alert("Are you sure you want to wipe this card's memory? This cannot be undone once started.", name, "Yes", "No")
if(confirm == "Yes" && !..())
flush = 1
flush = TRUE
if(AI && AI.loc == src)
AI.suiciding = 1
AI.suiciding = TRUE
AI << "Your core files are being wiped!"
while(AI.stat != DEAD)
AI.adjustOxyLoss(2)
AI.updatehealth()
sleep(10)
flush = 0
flush = FALSE
. = TRUE
if("wireless")
AI.control_disabled = !AI.control_disabled
AI << "The intellicard's wireless port has been [AI.control_disabled ? "disabled" : "enabled"]!"
if (AI.control_disabled)
overlays -= image('icons/obj/aicards.dmi', "aicard-on")
else
overlays += image('icons/obj/aicards.dmi', "aicard-on")
AI << "[src]'s wireless port has been [AI.control_disabled ? "disabled" : "enabled"]!"
. = TRUE
if("radio")
AI.radio_enabled = !AI.radio_enabled
AI << "Your Subspace Transceiver has been [AI.radio_enabled ? "enabled" : "disabled"]!"
return 1
. = TRUE
update_icon()

View File

@@ -1124,7 +1124,7 @@
s.start()
if(isalien(user))
return 0
if (electrocute_mob(user, src, src))
if(electrocute_mob(user, src, src))
return 1
else
return 0

View File

@@ -58,13 +58,16 @@ var/datum/events/keycard_events = new()
if("red_alert")
if(!event_source)
sendEvent("Red Alert")
. = TRUE
if("emergency_maint")
if(!event_source)
sendEvent("Emergency Maintenance Access")
. = TRUE
if("auth_swipe")
if(event_source)
event_source.trigger_event(usr)
event_source = null
. = TRUE
/obj/machinery/keycard_auth/proc/sendEvent(event_type)
triggerer = usr