Merge pull request #3023 from Citadel-Station-13/upstream-merge-31069

[MIRROR] Cleanup to various loc assignments and nearby code
This commit is contained in:
LetterJay
2017-10-01 15:08:21 -04:00
committed by GitHub
31 changed files with 712 additions and 724 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ GLOBAL_LIST_EMPTY(blobs_legit) //used for win-score calculations, contains only
var/mob/camera/blob/B = blob.current.become_overmind(TRUE, round(blob_base_starting_points/blob_overminds.len))
B.mind.name = B.name
var/turf/T = pick(GLOB.blobstart)
B.loc = T
B.forceMove(T)
B.base_point_rate = blob_point_rate
SSshuttle.registerHostileEnvironment(src)
+1 -1
View File
@@ -59,7 +59,7 @@
set name = "Jump to Core"
set desc = "Move your camera to your core."
if(blob_core)
src.loc = blob_core.loc
forceMove(blob_core.drop_location())
/mob/camera/blob/verb/jump_to_node()
set category = "Blob"
+1 -1
View File
@@ -190,7 +190,7 @@
B.density = TRUE
if(T.Enter(B,src)) //NOW we can attempt to move into the tile
B.density = initial(B.density)
B.loc = T
B.forceMove(T)
B.update_icon()
if(B.overmind && expand_reaction)
B.overmind.blob_reagent_datum.expand_reaction(src, B, T, controller)
@@ -30,7 +30,7 @@
sleep(5) // So it's not killed in explosion
var/mob/living/simple_animal/hostile/headcrab/crab = new(turf)
for(var/obj/item/organ/I in organs)
I.loc = crab
I.forceMove(crab)
crab.origin = M
if(crab.origin)
crab.origin.active = 1
@@ -60,9 +60,8 @@
/obj/machinery/abductor/gland_dispenser/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/organ/heart/gland))
if(!user.drop_item())
if(!user.transferItemToLoc(W, src))
return
W.loc = src
for(var/i=1,i<=gland_colors.len,i++)
if(gland_types[i] == W.type)
amounts[i]++
@@ -502,7 +502,7 @@
var/obj/item/stack/sheet/metal/M = new /obj/item/stack/sheet/metal(target.loc)
M.amount = 5
for(var/obj/item/I in target.component_parts)
I.loc = M.loc
I.forceMove(M.drop_location())
var/obj/effect/temp_visual/swarmer/disintegration/N = new /obj/effect/temp_visual/swarmer/disintegration(get_turf(target))
N.pixel_x = target.pixel_x
N.pixel_y = target.pixel_y
@@ -511,7 +511,7 @@
if(istype(target, /obj/machinery/computer))
var/obj/machinery/computer/C = target
if(C.circuit)
C.circuit.loc = M.loc
C.circuit.forceMove(M.drop_location())
qdel(target)
@@ -77,7 +77,7 @@
/mob/living/simple_animal/hostile/morph/proc/eat(atom/movable/A)
if(A && A.loc != src)
visible_message("<span class='warning'>[src] swallows [A] whole!</span>")
A.loc = src
A.forceMove(src)
return 1
return 0
@@ -153,7 +153,7 @@
/mob/living/simple_animal/hostile/morph/proc/barf_contents()
for(var/atom/movable/AM in src)
AM.loc = loc
AM.forceMove(loc)
if(prob(90))
step(AM, pick(GLOB.alldirs))
+1 -1
View File
@@ -110,7 +110,7 @@
P.info = "The nuclear authorization code is: <b>[nuke_code]</b>"
P.name = "nuclear bomb code"
var/mob/living/carbon/human/H = synd_mind.current
P.loc = H.loc
P.forceMove(H.drop_location())
H.put_in_hands_or_del(P)
H.update_icons()
else
+4 -4
View File
@@ -140,7 +140,7 @@ GLOBAL_VAR_INIT(hsboxspawn, TRUE)
var/mob/living/carbon/human/P = usr
if(!istype(P)) return
if(P.wear_suit)
P.wear_suit.loc = P.loc
P.wear_suit.forceMove(P.drop_location())
P.wear_suit.layer = initial(P.wear_suit.layer)
P.wear_suit.plane = initial(P.wear_suit.plane)
P.wear_suit = null
@@ -149,7 +149,7 @@ GLOBAL_VAR_INIT(hsboxspawn, TRUE)
P.wear_suit.plane = ABOVE_HUD_PLANE
P.update_inv_wear_suit()
if(P.head)
P.head.loc = P.loc
P.head.forceMove(P.drop_location())
P.head.layer = initial(P.head.layer)
P.head.plane = initial(P.head.plane)
P.head = null
@@ -158,7 +158,7 @@ GLOBAL_VAR_INIT(hsboxspawn, TRUE)
P.head.plane = ABOVE_HUD_PLANE
P.update_inv_head()
if(P.wear_mask)
P.wear_mask.loc = P.loc
P.wear_mask.forceMove(P.drop_location())
P.wear_mask.layer = initial(P.wear_mask.layer)
P.wear_mask.plane = initial(P.wear_mask.plane)
P.wear_mask = null
@@ -167,7 +167,7 @@ GLOBAL_VAR_INIT(hsboxspawn, TRUE)
P.wear_mask.plane = ABOVE_HUD_PLANE
P.update_inv_wear_mask()
if(P.back)
P.back.loc = P.loc
P.back.forceMove(P.drop_location())
P.back.layer = initial(P.back.layer)
P.back.plane = initial(P.back.plane)
P.back = null
+4 -5
View File
@@ -234,11 +234,10 @@
if(!link)
if(I.loc == user && istype(I) && I.w_class <= WEIGHT_CLASS_SMALL)
user.drop_item()
I.loc = src
link = I
to_chat(user, "You attach [I] to the doll.")
update_targets()
if (user.transferItemToLoc(I,src))
link = I
to_chat(user, "You attach [I] to the doll.")
update_targets()
/obj/item/voodoo/check_eye(mob/user)
if(loc != user)
+1 -1
View File
@@ -164,7 +164,7 @@
if(contents.len)
to_chat(user, "<span class='userdanger'>Capture failed!</span>: The soulstone is full! Free an existing soul to make room.")
else
T.loc = src //put shade in stone
T.forceMove(src) //put shade in stone
T.status_flags |= GODMODE
T.canmove = 0
T.health = T.maxHealth
+1 -1
View File
@@ -30,7 +30,7 @@
to_chat(wizard.current, "<span class='boldannounce'>A starting location for you could not be found, please report this bug!</span>")
return 0
for(var/datum/mind/wiz in wizards)
wiz.current.loc = pick(GLOB.wizardstart)
wiz.current.forceMove(pick(GLOB.wizardstart))
return 1
+2 -2
View File
@@ -44,10 +44,10 @@
var/turf/T = loc
Beacon = new /obj/item/device/radio/beacon
Beacon.invisibility = INVISIBILITY_MAXIMUM
Beacon.loc = T
Beacon.forceMove(T)
if(Beacon)
if(Beacon.loc != loc)
Beacon.loc = loc
Beacon.forceMove(loc)
updateicon()
+1 -1
View File
@@ -429,7 +429,7 @@ Class Procs:
W.handle_item_insertion(A, 1)
component_parts -= A
component_parts += B
B.loc = null
B.moveToNullspace()
to_chat(user, "<span class='notice'>[A.name] replaced with [B.name].</span>")
shouldplaysound = 1 //Only play the sound when parts are actually replaced!
break
+1 -1
View File
@@ -43,7 +43,7 @@
say("Station funds depleted. Halting siphon.")
siphoning = FALSE
else
new /obj/item/stack/spacecash/c200(get_turf(src)) // will autostack
new /obj/item/stack/spacecash/c200(drop_location()) // will autostack
playsound(src.loc, 'sound/items/poster_being_created.ogg', 100, 1)
SSshuttle.points -= 200
if(next_warning < world.time && prob(15))
+2 -2
View File
@@ -127,10 +127,10 @@
if(panel_open)
if(device || board)
if(device)
device.loc = get_turf(src)
device.forceMove(drop_location())
device = null
if(board)
board.loc = get_turf(src)
board.forceMove(drop_location())
req_access = list()
req_one_access = list()
board = null
+1 -1
View File
@@ -246,7 +246,7 @@
if(disassembled)
if(!assembly)
assembly = new()
assembly.loc = src.loc
assembly.forceMove(drop_location())
assembly.state = 1
assembly.setDir(dir)
assembly = null
+141 -141
View File
@@ -1,145 +1,145 @@
/obj/item/wallframe/camera
name = "camera assembly"
desc = "The basic construction for Nanotrasen-Always-Watching-You cameras."
icon = 'icons/obj/monitors.dmi'
icon_state = "cameracase"
materials = list(MAT_METAL=400, MAT_GLASS=250)
result_path = /obj/structure/camera_assembly
/obj/structure/camera_assembly
name = "camera assembly"
desc = "The basic construction for Nanotrasen-Always-Watching-You cameras."
icon = 'icons/obj/monitors.dmi'
icon_state = "camera1"
max_integrity = 150
// Motion, EMP-Proof, X-Ray
var/static/list/possible_upgrades = typecacheof(list(/obj/item/device/assembly/prox_sensor, /obj/item/stack/sheet/mineral/plasma, /obj/item/device/analyzer))
var/list/upgrades
var/state = 1
/*
1 = Wrenched in place
2 = Welded in place
3 = Wires attached to it (you can now attach/dettach upgrades)
4 = Screwdriver panel closed and is fully built (you cannot attach upgrades)
*/
/obj/structure/camera_assembly/Initialize(mapload, ndir, building)
. = ..()
if(building)
setDir(ndir)
upgrades = list()
/obj/structure/camera_assembly/Destroy()
QDEL_LIST(upgrades)
return ..()
/obj/structure/camera_assembly/attackby(obj/item/W, mob/living/user, params)
switch(state)
if(1)
// State 1
if(istype(W, /obj/item/weldingtool))
if(weld(W, user))
to_chat(user, "<span class='notice'>You weld the assembly securely into place.</span>")
/obj/item/wallframe/camera
name = "camera assembly"
desc = "The basic construction for Nanotrasen-Always-Watching-You cameras."
icon = 'icons/obj/monitors.dmi'
icon_state = "cameracase"
materials = list(MAT_METAL=400, MAT_GLASS=250)
result_path = /obj/structure/camera_assembly
/obj/structure/camera_assembly
name = "camera assembly"
desc = "The basic construction for Nanotrasen-Always-Watching-You cameras."
icon = 'icons/obj/monitors.dmi'
icon_state = "camera1"
max_integrity = 150
// Motion, EMP-Proof, X-Ray
var/static/list/possible_upgrades = typecacheof(list(/obj/item/device/assembly/prox_sensor, /obj/item/stack/sheet/mineral/plasma, /obj/item/device/analyzer))
var/list/upgrades
var/state = 1
/*
1 = Wrenched in place
2 = Welded in place
3 = Wires attached to it (you can now attach/dettach upgrades)
4 = Screwdriver panel closed and is fully built (you cannot attach upgrades)
*/
/obj/structure/camera_assembly/Initialize(mapload, ndir, building)
. = ..()
if(building)
setDir(ndir)
upgrades = list()
/obj/structure/camera_assembly/Destroy()
QDEL_LIST(upgrades)
return ..()
/obj/structure/camera_assembly/attackby(obj/item/W, mob/living/user, params)
switch(state)
if(1)
// State 1
if(istype(W, /obj/item/weldingtool))
if(weld(W, user))
to_chat(user, "<span class='notice'>You weld the assembly securely into place.</span>")
anchored = TRUE
state = 2
return
else if(istype(W, /obj/item/wrench))
playsound(src.loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You unattach the assembly from its place.</span>")
new /obj/item/wallframe/camera(get_turf(src))
qdel(src)
return
if(2)
// State 2
if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = W
if(C.use(2))
to_chat(user, "<span class='notice'>You add wires to the assembly.</span>")
state = 3
else
to_chat(user, "<span class='warning'>You need two lengths of cable to wire a camera!</span>")
return
return
else if(istype(W, /obj/item/weldingtool))
if(weld(W, user))
to_chat(user, "<span class='notice'>You unweld the assembly from its place.</span>")
state = 1
state = 2
return
else if(istype(W, /obj/item/wrench))
playsound(src.loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You unattach the assembly from its place.</span>")
new /obj/item/wallframe/camera(get_turf(src))
qdel(src)
return
if(2)
// State 2
if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = W
if(C.use(2))
to_chat(user, "<span class='notice'>You add wires to the assembly.</span>")
state = 3
else
to_chat(user, "<span class='warning'>You need two lengths of cable to wire a camera!</span>")
return
return
else if(istype(W, /obj/item/weldingtool))
if(weld(W, user))
to_chat(user, "<span class='notice'>You unweld the assembly from its place.</span>")
state = 1
anchored = TRUE
return
if(3)
// State 3
if(istype(W, /obj/item/screwdriver))
playsound(src.loc, W.usesound, 50, 1)
return
if(3)
// State 3
if(istype(W, /obj/item/screwdriver))
playsound(src.loc, W.usesound, 50, 1)
var/input = stripped_input(user, "Which networks would you like to connect this camera to? Separate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Set Network", "SS13")
if(!input)
to_chat(user, "<span class='warning'>No input found, please hang up and try your call again!</span>")
return
var/list/tempnetwork = splittext(input, ",")
if(tempnetwork.len < 1)
to_chat(user, "<span class='warning'>No network found, please hang up and try your call again!</span>")
return
state = 4
var/obj/machinery/camera/C = new(src.loc)
src.loc = C
C.assembly = src
C.setDir(src.dir)
C.network = tempnetwork
var/area/A = get_area(src)
C.c_tag = "[A.name] ([rand(1, 999)])"
else if(istype(W, /obj/item/wirecutters))
new/obj/item/stack/cable_coil(get_turf(src), 2)
playsound(src.loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You cut the wires from the circuits.</span>")
state = 2
return
// Upgrades!
if(is_type_in_typecache(W, possible_upgrades) && !is_type_in_list(W, upgrades)) // Is a possible upgrade and isn't in the camera already.
if(!user.drop_item(W))
return
to_chat(user, "<span class='notice'>You attach \the [W] into the assembly inner circuits.</span>")
upgrades += W
W.forceMove(src)
return
// Taking out upgrades
else if(istype(W, /obj/item/crowbar) && upgrades.len)
var/obj/U = locate(/obj) in upgrades
if(U)
to_chat(user, "<span class='notice'>You unattach an upgrade from the assembly.</span>")
playsound(src.loc, W.usesound, 50, 1)
U.loc = get_turf(src)
upgrades -= U
return
return ..()
/obj/structure/camera_assembly/proc/weld(obj/item/weldingtool/WT, mob/living/user)
if(!WT.remove_fuel(0, user))
return 0
to_chat(user, "<span class='notice'>You start to weld \the [src]...</span>")
playsound(src.loc, WT.usesound, 50, 1)
if(do_after(user, 20*WT.toolspeed, target = src))
if(WT.isOn())
playsound(loc, 'sound/items/welder2.ogg', 50, 1)
return 1
return 0
/obj/structure/camera_assembly/deconstruct(disassembled = TRUE)
if(!input)
to_chat(user, "<span class='warning'>No input found, please hang up and try your call again!</span>")
return
var/list/tempnetwork = splittext(input, ",")
if(tempnetwork.len < 1)
to_chat(user, "<span class='warning'>No network found, please hang up and try your call again!</span>")
return
state = 4
var/obj/machinery/camera/C = new(src.loc)
forceMove(C)
C.assembly = src
C.setDir(src.dir)
C.network = tempnetwork
var/area/A = get_area(src)
C.c_tag = "[A.name] ([rand(1, 999)])"
else if(istype(W, /obj/item/wirecutters))
new/obj/item/stack/cable_coil(get_turf(src), 2)
playsound(src.loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You cut the wires from the circuits.</span>")
state = 2
return
// Upgrades!
if(is_type_in_typecache(W, possible_upgrades) && !is_type_in_list(W, upgrades)) // Is a possible upgrade and isn't in the camera already.
if(!user.drop_item(W))
return
to_chat(user, "<span class='notice'>You attach \the [W] into the assembly inner circuits.</span>")
upgrades += W
W.forceMove(src)
return
// Taking out upgrades
else if(istype(W, /obj/item/crowbar) && upgrades.len)
var/obj/U = locate(/obj) in upgrades
if(U)
to_chat(user, "<span class='notice'>You unattach an upgrade from the assembly.</span>")
playsound(src.loc, W.usesound, 50, 1)
U.forceMove(drop_location())
upgrades -= U
return
return ..()
/obj/structure/camera_assembly/proc/weld(obj/item/weldingtool/WT, mob/living/user)
if(!WT.remove_fuel(0, user))
return 0
to_chat(user, "<span class='notice'>You start to weld \the [src]...</span>")
playsound(src.loc, WT.usesound, 50, 1)
if(do_after(user, 20*WT.toolspeed, target = src))
if(WT.isOn())
playsound(loc, 'sound/items/welder2.ogg', 50, 1)
return 1
return 0
/obj/structure/camera_assembly/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
new /obj/item/stack/sheet/metal(loc)
qdel(src)
new /obj/item/stack/sheet/metal(loc)
qdel(src)
+5 -6
View File
@@ -45,14 +45,13 @@
if(!isarea(a))
return
if(a.power_equip == 0) // There's no APC in this area, don't try to cheat power!
to_chat(user, "<span class='warning'>The [name] blinks red as you try to insert the cell!</span>")
to_chat(user, "<span class='warning'>The [src] blinks red as you try to insert the cell!</span>")
return
if(!user.drop_item())
if(!user.transferItemToLoc(W,src))
return
W.loc = src
charging = W
user.visible_message("[user] inserts a cell into the charger.", "<span class='notice'>You insert a cell into the charger.</span>")
user.visible_message("[user] inserts a cell into [src].", "<span class='notice'>You insert a cell into [src].</span>")
chargelevel = -1
updateicon()
else if(istype(W, /obj/item/wrench))
@@ -61,7 +60,7 @@
return
anchored = !anchored
to_chat(user, "<span class='notice'>You [anchored ? "attach" : "detach"] the cell charger [anchored ? "to" : "from"] the ground</span>")
to_chat(user, "<span class='notice'>You [anchored ? "attach" : "detach"] [src] [anchored ? "to" : "from"] the ground</span>")
playsound(src.loc, W.usesound, 75, 1)
else
return ..()
@@ -80,7 +79,7 @@
user.put_in_hands(charging)
charging.add_fingerprint(user)
user.visible_message("[user] removes the cell from the charger.", "<span class='notice'>You remove the cell from the charger.</span>")
user.visible_message("[user] removes [charging] from [src].", "<span class='notice'>You remove [charging] from [src].</span>")
removecell()
+146 -146
View File
@@ -1,146 +1,146 @@
/obj/machinery/computer/aifixer
name = "\improper AI system integrity restorer"
desc = "Used with intelliCards containing nonfunctioning AIs to restore them to working order."
req_access = list(ACCESS_CAPTAIN, ACCESS_ROBOTICS, ACCESS_HEADS)
var/mob/living/silicon/ai/occupier = null
var/active = 0
circuit = /obj/item/circuitboard/computer/aifixer
icon_keyboard = "tech_key"
icon_screen = "ai-fixer"
light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/aifixer/attackby(obj/I, mob/user, params)
if(occupier && istype(I, /obj/item/screwdriver))
if(stat & (NOPOWER|BROKEN))
to_chat(user, "<span class='warning'>The screws on [name]'s screen won't budge.</span>")
else
to_chat(user, "<span class='warning'>The screws on [name]'s screen won't budge and it emits a warning beep.</span>")
else
return ..()
/obj/machinery/computer/aifixer/attack_hand(mob/user)
if(..())
return
interact(user)
/obj/machinery/computer/aifixer/interact(mob/user)
var/dat = ""
if (src.occupier)
var/laws
dat += "<h3>Stored AI: [src.occupier.name]</h3>"
dat += "<b>System integrity:</b> [(src.occupier.health+100)/2]%<br>"
if (src.occupier.laws.zeroth)
laws += "<b>0:</b> [src.occupier.laws.zeroth]<BR>"
for (var/index = 1, index <= src.occupier.laws.ion.len, index++)
var/law = src.occupier.laws.ion[index]
if (length(law) > 0)
var/num = ionnum()
laws += "<b>[num]:</b> [law]<BR>"
var/number = 1
for (var/index = 1, index <= src.occupier.laws.inherent.len, index++)
var/law = src.occupier.laws.inherent[index]
if (length(law) > 0)
laws += "<b>[number]:</b> [law]<BR>"
number++
for (var/index = 1, index <= src.occupier.laws.supplied.len, index++)
var/law = src.occupier.laws.supplied[index]
if (length(law) > 0)
laws += "<b>[number]:</b> [law]<BR>"
number++
dat += "<b>Laws:</b><br>[laws]<br>"
if (src.occupier.stat == DEAD)
dat += "<span class='bad'>AI non-functional</span>"
else
dat += "<span class='good'>AI functional</span>"
if (!src.active)
dat += {"<br><br><A href='byond://?src=\ref[src];fix=1'>Begin Reconstruction</A>"}
else
dat += "<br><br>Reconstruction in process, please wait.<br>"
dat += {"<br><A href='?src=\ref[user];mach_close=computer'>Close</A>"}
var/datum/browser/popup = new(user, "computer", "AI System Integrity Restorer", 400, 500)
popup.set_content(dat)
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.open()
return
/obj/machinery/computer/aifixer/proc/Fix()
use_power(1000)
occupier.adjustOxyLoss(-1, 0)
occupier.adjustFireLoss(-1, 0)
occupier.adjustToxLoss(-1, 0)
occupier.adjustBruteLoss(-1, 0)
occupier.updatehealth()
occupier.updatehealth()
if(occupier.health >= 0 && occupier.stat == DEAD)
occupier.revive()
return occupier.health < 100
/obj/machinery/computer/aifixer/process()
if(..())
if(active)
active = Fix()
updateDialog()
update_icon()
/obj/machinery/computer/aifixer/Topic(href, href_list)
if(..())
return
if(href_list["fix"])
to_chat(usr, "<span class='notice'>Reconstruction in progress. This will take several minutes.</span>")
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 25, 0)
active = TRUE
add_fingerprint(usr)
/obj/machinery/computer/aifixer/update_icon()
..()
if(stat & (NOPOWER|BROKEN))
return
else
if(active)
add_overlay("ai-fixer-on")
if (occupier)
switch (occupier.stat)
if (0)
add_overlay("ai-fixer-full")
if (2)
add_overlay("ai-fixer-404")
else
add_overlay("ai-fixer-empty")
/obj/machinery/computer/aifixer/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/device/aicard/card)
if(!..())
return
//Downloading AI from card to terminal.
if(interaction == AI_TRANS_FROM_CARD)
if(stat & (NOPOWER|BROKEN))
to_chat(user, "[src] is offline and cannot take an AI at this time!")
return
AI.forceMove(src)
occupier = AI
AI.control_disabled = 1
AI.radio_enabled = 0
to_chat(AI, "You have been uploaded to a stationary terminal. Sadly, there is no remote access from here.")
to_chat(user, "<span class='boldnotice'>Transfer successful</span>: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed.")
card.AI = null
update_icon()
else //Uploading AI from terminal to card
if(occupier && !active)
to_chat(occupier, "You have been downloaded to a mobile storage device. Still no remote access.")
to_chat(user, "<span class='boldnotice'>Transfer successful</span>: [occupier.name] ([rand(1000,9999)].exe) removed from host terminal and stored within local memory.")
occupier.loc = card
card.AI = occupier
occupier = null
update_icon()
else if (active)
to_chat(user, "<span class='boldannounce'>ERROR</span>: Reconstruction in progress.")
else if (!occupier)
to_chat(user, "<span class='boldannounce'>ERROR</span>: Unable to locate artificial intelligence.")
/obj/machinery/computer/aifixer
name = "\improper AI system integrity restorer"
desc = "Used with intelliCards containing nonfunctioning AIs to restore them to working order."
req_access = list(ACCESS_CAPTAIN, ACCESS_ROBOTICS, ACCESS_HEADS)
var/mob/living/silicon/ai/occupier = null
var/active = 0
circuit = /obj/item/circuitboard/computer/aifixer
icon_keyboard = "tech_key"
icon_screen = "ai-fixer"
light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/aifixer/attackby(obj/I, mob/user, params)
if(occupier && istype(I, /obj/item/screwdriver))
if(stat & (NOPOWER|BROKEN))
to_chat(user, "<span class='warning'>The screws on [name]'s screen won't budge.</span>")
else
to_chat(user, "<span class='warning'>The screws on [name]'s screen won't budge and it emits a warning beep.</span>")
else
return ..()
/obj/machinery/computer/aifixer/attack_hand(mob/user)
if(..())
return
interact(user)
/obj/machinery/computer/aifixer/interact(mob/user)
var/dat = ""
if (src.occupier)
var/laws
dat += "<h3>Stored AI: [src.occupier.name]</h3>"
dat += "<b>System integrity:</b> [(src.occupier.health+100)/2]%<br>"
if (src.occupier.laws.zeroth)
laws += "<b>0:</b> [src.occupier.laws.zeroth]<BR>"
for (var/index = 1, index <= src.occupier.laws.ion.len, index++)
var/law = src.occupier.laws.ion[index]
if (length(law) > 0)
var/num = ionnum()
laws += "<b>[num]:</b> [law]<BR>"
var/number = 1
for (var/index = 1, index <= src.occupier.laws.inherent.len, index++)
var/law = src.occupier.laws.inherent[index]
if (length(law) > 0)
laws += "<b>[number]:</b> [law]<BR>"
number++
for (var/index = 1, index <= src.occupier.laws.supplied.len, index++)
var/law = src.occupier.laws.supplied[index]
if (length(law) > 0)
laws += "<b>[number]:</b> [law]<BR>"
number++
dat += "<b>Laws:</b><br>[laws]<br>"
if (src.occupier.stat == DEAD)
dat += "<span class='bad'>AI non-functional</span>"
else
dat += "<span class='good'>AI functional</span>"
if (!src.active)
dat += {"<br><br><A href='byond://?src=\ref[src];fix=1'>Begin Reconstruction</A>"}
else
dat += "<br><br>Reconstruction in process, please wait.<br>"
dat += {"<br><A href='?src=\ref[user];mach_close=computer'>Close</A>"}
var/datum/browser/popup = new(user, "computer", "AI System Integrity Restorer", 400, 500)
popup.set_content(dat)
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.open()
return
/obj/machinery/computer/aifixer/proc/Fix()
use_power(1000)
occupier.adjustOxyLoss(-1, 0)
occupier.adjustFireLoss(-1, 0)
occupier.adjustToxLoss(-1, 0)
occupier.adjustBruteLoss(-1, 0)
occupier.updatehealth()
occupier.updatehealth()
if(occupier.health >= 0 && occupier.stat == DEAD)
occupier.revive()
return occupier.health < 100
/obj/machinery/computer/aifixer/process()
if(..())
if(active)
active = Fix()
updateDialog()
update_icon()
/obj/machinery/computer/aifixer/Topic(href, href_list)
if(..())
return
if(href_list["fix"])
to_chat(usr, "<span class='notice'>Reconstruction in progress. This will take several minutes.</span>")
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 25, 0)
active = TRUE
add_fingerprint(usr)
/obj/machinery/computer/aifixer/update_icon()
..()
if(stat & (NOPOWER|BROKEN))
return
else
if(active)
add_overlay("ai-fixer-on")
if (occupier)
switch (occupier.stat)
if (0)
add_overlay("ai-fixer-full")
if (2)
add_overlay("ai-fixer-404")
else
add_overlay("ai-fixer-empty")
/obj/machinery/computer/aifixer/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/device/aicard/card)
if(!..())
return
//Downloading AI from card to terminal.
if(interaction == AI_TRANS_FROM_CARD)
if(stat & (NOPOWER|BROKEN))
to_chat(user, "[src] is offline and cannot take an AI at this time!")
return
AI.forceMove(src)
occupier = AI
AI.control_disabled = 1
AI.radio_enabled = 0
to_chat(AI, "You have been uploaded to a stationary terminal. Sadly, there is no remote access from here.")
to_chat(user, "<span class='boldnotice'>Transfer successful</span>: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed.")
card.AI = null
update_icon()
else //Uploading AI from terminal to card
if(occupier && !active)
to_chat(occupier, "You have been downloaded to a mobile storage device. Still no remote access.")
to_chat(user, "<span class='boldnotice'>Transfer successful</span>: [occupier.name] ([rand(1000,9999)].exe) removed from host terminal and stored within local memory.")
occupier.forceMove(card)
card.AI = occupier
occupier = null
update_icon()
else if (active)
to_chat(user, "<span class='boldannounce'>ERROR</span>: Reconstruction in progress.")
else if (!occupier)
to_chat(user, "<span class='boldannounce'>ERROR</span>: Unable to locate artificial intelligence.")
@@ -19,7 +19,7 @@
var/obj/item/weldingtool/WT = P
if(!WT.remove_fuel(0, user))
if(!WT.isOn())
to_chat(user, "<span class='warning'>The welding tool must be on to complete this task!</span>")
to_chat(user, "<span class='warning'>[WT] must be on to complete this task!</span>")
return
playsound(src.loc, P.usesound, 50, 1)
to_chat(user, "<span class='notice'>You start deconstructing the frame...</span>")
@@ -40,14 +40,13 @@
state = 0
return
if(istype(P, /obj/item/circuitboard/computer) && !circuit)
if(!user.drop_item())
if(!user.transferItemToLoc(P, null))
return
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
to_chat(user, "<span class='notice'>You place the circuit board inside the frame.</span>")
to_chat(user, "<span class='notice'>You place [P] inside the frame.</span>")
icon_state = "1"
circuit = P
circuit.add_fingerprint(user)
P.loc = null
return
else if(istype(P, /obj/item/circuitboard) && !circuit)
@@ -55,16 +54,16 @@
return
if(istype(P, /obj/item/screwdriver) && circuit)
playsound(src.loc, P.usesound, 50, 1)
to_chat(user, "<span class='notice'>You screw the circuit board into place.</span>")
to_chat(user, "<span class='notice'>You screw [circuit] into place.</span>")
state = 2
icon_state = "2"
return
if(istype(P, /obj/item/crowbar) && circuit)
playsound(src.loc, P.usesound, 50, 1)
to_chat(user, "<span class='notice'>You remove the circuit board.</span>")
to_chat(user, "<span class='notice'>You remove [circuit].</span>")
state = 1
icon_state = "0"
circuit.loc = src.loc
circuit.forceMove(drop_location())
circuit.add_fingerprint(user)
circuit = null
return
+9 -14
View File
@@ -54,22 +54,19 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
var/obj/item/card/id/idcard = O
if(check_access(idcard))
if(!scan)
if(!usr.drop_item())
if (!user.transferItemToLoc(idcard,src))
return
idcard.loc = src
scan = idcard
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
else if(!modify)
if(!usr.drop_item())
if (!user.transferItemToLoc(idcard,src))
return
idcard.loc = src
modify = idcard
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
else
if(!modify)
if(!usr.drop_item())
if (!user.transferItemToLoc(idcard,src))
return
idcard.loc = src
modify = idcard
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
else
@@ -95,10 +92,10 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
/obj/machinery/computer/card/on_deconstruction()
if(scan)
scan.forceMove(loc)
scan.forceMove(drop_location())
scan = null
if(modify)
modify.forceMove(loc)
modify.forceMove(drop_location())
modify = null
//Check if you can't open a new position for a certain job
@@ -355,7 +352,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
if (modify)
GLOB.data_core.manifest_modify(modify.registered_name, modify.assignment)
modify.update_label()
modify.loc = loc
modify.forceMove(drop_location())
modify.verb_pickup()
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
modify = null
@@ -364,26 +361,24 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
else
var/obj/item/I = usr.get_active_held_item()
if (istype(I, /obj/item/card/id))
if(!usr.drop_item())
if (!usr.transferItemToLoc(I,src))
return
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
I.loc = src
modify = I
authenticated = 0
if ("scan")
if (scan)
scan.loc = src.loc
scan.forceMove(drop_location())
scan.verb_pickup()
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
scan = null
else
var/obj/item/I = usr.get_active_held_item()
if (istype(I, /obj/item/card/id))
if(!usr.drop_item())
if (!usr.transferItemToLoc(I,src))
return
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
I.loc = src
scan = I
authenticated = 0
if ("auth")
+2 -3
View File
@@ -117,9 +117,8 @@
/obj/machinery/computer/cloning/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/disk/data)) //INSERT SOME DISKETTES
if (!src.diskette)
if(!user.drop_item())
if (!user.transferItemToLoc(W,src))
return
W.loc = src
src.diskette = W
to_chat(user, "<span class='notice'>You insert [W].</span>")
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
@@ -373,7 +372,7 @@
if("eject")
if(src.diskette)
src.diskette.loc = src.loc
src.diskette.forceMove(drop_location())
src.diskette = null
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
if("save")
+2 -3
View File
@@ -43,9 +43,8 @@
/obj/machinery/computer/scan_consolenew/attackby(obj/item/I, mob/user, params)
if (istype(I, /obj/item/disk/data)) //INSERT SOME DISKETTES
if (!src.diskette)
if(!user.drop_item())
if (!user.transferItemToLoc(I,src))
return
I.loc = src
src.diskette = I
to_chat(user, "<span class='notice'>You insert [I].</span>")
src.updateUsrDialog()
@@ -448,7 +447,7 @@
diskette.fields = buffer_slot.Copy()
if("ejectdisk")
if(diskette)
diskette.loc = get_turf(src)
diskette.forceMove(drop_location())
diskette = null
if("setdelayed")
if(num)
@@ -27,9 +27,8 @@
/obj/machinery/computer/gulag_teleporter_computer/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/card/id/prisoner))
if(!id)
if(!user.drop_item())
if (!user.transferItemToLoc(W,src))
return
W.forceMove(src)
id = W
to_chat(user, "<span class='notice'>You insert [W].</span>")
return