From 808f76eaf3ed3b947083ca9f2e48f4aba6799a3b Mon Sep 17 00:00:00 2001 From: Erthilo Date: Sun, 3 Jun 2012 18:41:51 +0100 Subject: [PATCH] TG: * Added pickup verb to all items * Added "Toggle Open" verb to all closets and crates * Added "Toggle Lock" verb to all lockable closets * Modified the cloning computer's UI slightly, makes more sense, added a little delay when scanning to improve user feedback when trying to clone several braindead bodies. Revision: r3712 Author: daniel.cf.hultgren --- code/defines/obj.dm | 36 ++++- code/defines/obj/closet.dm | 27 ---- code/game/machinery/computer/cloning.dm | 125 ++++++++++-------- code/game/objects/closets.dm | 27 ++++ .../objects/closets/secure/secure_closets.dm | 30 ++++- code/game/objects/items/item.dm | 35 ----- 6 files changed, 160 insertions(+), 120 deletions(-) diff --git a/code/defines/obj.dm b/code/defines/obj.dm index 8deb4de7115..45ad2ccbf98 100644 --- a/code/defines/obj.dm +++ b/code/defines/obj.dm @@ -1,4 +1,4 @@ -//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:04 +//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 /obj //var/datum/module/mod //not used @@ -444,6 +444,40 @@ var/armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0) var/list/allowed = null //suit storage stuff. +/obj/item/verb/verb_pickup() + set src in view(1) + set category = "Object" + set name = "Pickup" + + if(!(usr)) + return + if((!istype(usr, /mob/living/carbon)) || (istype(usr, /mob/living/carbon/brain)))//Is humanoid, and is not a brain + usr << "\red You can't pick things up!" + return + if( usr.stat || usr.restrained() )//Is not asleep/dead and is not restrained + usr << "\red You can't pick things up!" + return + if(src.anchored) //Object isn't anchored + usr << "\red You can't pick that up!" + return + if(!usr.hand && usr.r_hand) //Right hand is not full + usr << "\red Your right hand is full." + return + if(usr.hand && usr.l_hand) //Left hand is not full + usr << "\red Your left hand is full." + return + if(!istype(src.loc, /turf)) //Object is on a turf + usr << "\red You can't pick that up!" + return + //All checks are done, time to pick it up! + if(istype(usr, /mob/living/carbon/human)) + src.attack_hand(usr) + if(istype(usr, /mob/living/carbon/alien)) + src.attack_alien(usr) + if(istype(usr, /mob/living/carbon/monkey)) + src.attack_paw(usr) + return + /obj/item/device icon = 'device.dmi' diff --git a/code/defines/obj/closet.dm b/code/defines/obj/closet.dm index dfc1417e4f7..71b50a0a312 100644 --- a/code/defines/obj/closet.dm +++ b/code/defines/obj/closet.dm @@ -15,33 +15,6 @@ var/lasttry = 0 layer = 2.98 -/obj/structure/closet/verb/open_close() - set name = "Open/Close" - set category = "Object" - set src in view(1) - - if(!(usr)) - return - if(!istype(src.loc, /turf) || usr.stat || usr.restrained() ) - usr << "\red You can't interact with this!" - return - if(src.anchored) - usr << "\red You can't interact with this!" - return - if(istype(usr, /mob/living/silicon/robot)) - src.attack_hand(usr) - return - if((!istype(usr, /mob/living/carbon)) || (istype(usr, /mob/living/carbon/brain))) - usr << "\red You can't interact with this!" - return - if(istype(usr, /mob/living/carbon/human)) - src.attack_hand(usr) - if(istype(usr, /mob/living/carbon/alien)) - src.attack_alien(usr) - if(istype(usr, /mob/living/carbon/monkey)) - src.attack_paw(usr) - return - /obj/structure/closet/detective name = "detective's closet" desc = "Holds the detective's clothes while his coat rack is being repaired." diff --git a/code/game/machinery/computer/cloning.dm b/code/game/machinery/computer/cloning.dm index ceba19671ea..daee3bc1314 100644 --- a/code/game/machinery/computer/cloning.dm +++ b/code/game/machinery/computer/cloning.dm @@ -84,11 +84,13 @@ req_access = list(access_heads) //Only used for record deletion right now. var/obj/machinery/dna_scannernew/scanner = null //Linked scanner. For scanning. var/obj/machinery/clonepod/pod1 = null //Linked cloning pod. - var/temp = "Initializing System..." + var/temp = "" + var/scantemp = "Scanner unoccupied" var/menu = 1 //Which menu screen to display var/list/records = list() var/datum/data/record/active_record = null var/obj/item/weapon/disk/data/diskette = null //Mostly so the geneticist can steal everything. + var/loading = 0 // Nice loading text var/wantsscan = 1 var/wantspod = 1 var/list/message = list() @@ -97,64 +99,45 @@ ..() spawn(5) updatemodules() - /*src.scanner = locate(/obj/machinery/dna_scannernew, get_step(src, scandir)) - src.pod1 = locate(/obj/machinery/clonepod, get_step(src, poddir)) - - src.temp = "" - if (isnull(src.scanner) && wantsscan) - src.temp += " SCNR-ERROR" - if (isnull(src.pod1) && wantspod) - src.temp += " POD1-ERROR" - else if (wantspod) - src.pod1.connected = src - - if (src.temp == "") - src.temp = "System ready."*/ return return /obj/machinery/computer/cloning/proc/updatemodules() - //world << "UPDATING MODULES" - src.scanner = findscanner()//locate(/obj/machinery/dna_scannernew, get_step(src, WEST)) - src.pod1 = findcloner()//locate(/obj/machinery/clonepod, get_step(src, EAST)) - //world << "SEARCHING FOR MACHEIN" - //src.temp = "" - //if (isnull(src.scanner)) - // src.temp += " SCNR-ERROR" - if (!isnull(src.pod1) && !wantspod) - src.pod1.connected = src - // src.temp += " POD1-ERROR" - //else + src.scanner = findscanner() + src.pod1 = findcloner() - //if (src.temp == "") - // src.temp = "System ready." + if (!isnull(src.pod1) && !wantspod) + src.pod1.connected = src // Some variable the pod needs /obj/machinery/computer/cloning/proc/findscanner() - //..() - //world << "SEARCHING FOR SCANNER" var/obj/machinery/dna_scannernew/scannerf = null + + // Loop through every direction for(dir in list(1,2,4,8,5,6,9,10)) - //world << "SEARCHING IN [dir]" + // Try to find a scanner in that direction scannerf = locate(/obj/machinery/dna_scannernew, get_step(src, dir)) + // If found, then we break, and return the scanner if (!isnull(scannerf)) - //world << "FOUND" break if(isnull(scannerf) && wantsscan) src.temp += " SCNR-ERROR" + + // If no scanner was found, it will return null return scannerf /obj/machinery/computer/cloning/proc/findcloner() - //..() - //world << "SEARCHING FOR POD" var/obj/machinery/clonepod/podf = null + for(dir in list(1,2,4,8,5,6,9,10)) - //world << "SEARCHING IN [dir]" + podf = locate(/obj/machinery/clonepod, get_step(src, dir)) + if (!isnull(podf)) - //world << "FOUND" break + if(isnull(podf) && wantspod) src.temp += " POD1-ERROR" + return podf /obj/machinery/computer/cloning/attackby(obj/item/W as obj, mob/user as mob) @@ -195,23 +178,44 @@ switch(src.menu) if(1) + // Modules + dat += "

Modules

" + //dat += "Reload Modules" + if (isnull(src.scanner)) + dat += " Scanner-ERROR
" + else + dat += " Scanner-Found!
" + if (isnull(src.pod1)) + dat += " Pod-ERROR
" + else + dat += " Pod-Found!
" + + // Scanner if(wantsscan) dat += "

Scanner Functions

" - + + if(loading) + dat += "Scanning...
" + else + dat += "[scantemp]
" + if (isnull(src.scanner)) - dat += "No scanner connected!" + dat += "No scanner connected!
" else if (src.scanner.occupant) - dat += "Scan - [src.scanner.occupant]" + if(scantemp == "Scanner unoccupied") scantemp = "" // Stupid check to remove the text + + dat += "Scan - [src.scanner.occupant]
" else - dat += "Scanner unoccupied" - - dat += "
Lock status: [src.scanner.locked ? "Locked" : "Unlocked"]" - - dat += "

Database Functions

" - dat += "View Records
" - if (src.diskette) - dat += "Eject Disk" + scantemp = "Scanner unoccupied" + + dat += "Lock status: [src.scanner.locked ? "Locked" : "Unlocked"]
" + + // Database + dat += "

Database Functions

" + dat += "View Records
" + if (src.diskette) + dat += "Eject Disk" if(2) @@ -271,8 +275,21 @@ if(..()) return + if(loading) + return + if ((href_list["scan"]) && (!isnull(src.scanner))) - src.scan_mob(src.scanner.occupant) + scantemp = "" + + loading = 1 + src.updateUsrDialog() + + spawn(20) + src.scan_mob(src.scanner.occupant) + + loading = 0 + src.updateUsrDialog() + //No locking an open scanner. else if ((href_list["lock"]) && (!isnull(src.scanner))) @@ -386,22 +403,22 @@ /obj/machinery/computer/cloning/proc/scan_mob(mob/living/carbon/human/subject as mob) if ((isnull(subject)) || (!(ishuman(subject))) || (!subject.dna)) - src.temp = "Error: Unable to locate valid genetic data." + scantemp = "Error: Unable to locate valid genetic data." return if (subject.brain_op_stage == 4.0) - src.temp = "Error: No signs of intelligence detected." + scantemp = "Error: No signs of intelligence detected." return // if (subject.suiciding == 1) -// src.temp = "Error: Subject's brain is not responding to scanning stimuli." +// scantemp = "Error: Subject's brain is not responding to scanning stimuli." // return // if ((!subject.ckey) || (!subject.client)) -// src.temp = "Error: Mental interface failure." +// scantemp = "Error: Mental interface failure." // return if (NOCLONE in subject.mutations) - src.temp = "Error: Mental interface failure." + scantemp = "Error: Mental interface failure." return if (!isnull(find_record(subject.ckey))) - src.temp = "Subject already in database." + scantemp = "Subject already in database." return subject.dna.check_integrity() @@ -441,7 +458,7 @@ R.fields["mind"] = "\ref[subject.mind]" geneticsrecords["[copytext(md5(subject.real_name), 2, 6)]"] = R //Save it to the global scan list. - src.temp = "Subject successfully scanned." + scantemp = "Subject successfully scanned." //Find a specific record by key. /obj/machinery/computer/cloning/proc/find_record(var/find_key) diff --git a/code/game/objects/closets.dm b/code/game/objects/closets.dm index 88091cd0344..1ec2acdda74 100644 --- a/code/game/objects/closets.dm +++ b/code/game/objects/closets.dm @@ -232,3 +232,30 @@ if(!src.toggle()) usr << "\blue It won't budge!" + +/obj/structure/closet/verb/verb_toggleopen() + set src in view(1) + set category = "Object" + set name = "Toggle Open" + + if(!(usr)) + return + if(!istype(src.loc, /turf) || usr.stat || usr.restrained() ) + usr << "\red You can't interact with this!" + return + if(src.anchored) + usr << "\red You can't interact with this!" + return + if(istype(usr, /mob/living/silicon/robot)) + src.attack_hand(usr) + return + if((!istype(usr, /mob/living/carbon)) || (istype(usr, /mob/living/carbon/brain))) + usr << "\red You can't interact with this!" + return + if(istype(usr, /mob/living/carbon/human)) + src.attack_hand(usr) + if(istype(usr, /mob/living/carbon/alien)) + src.attack_alien(usr) + if(istype(usr, /mob/living/carbon/monkey)) + src.attack_paw(usr) + return diff --git a/code/game/objects/closets/secure/secure_closets.dm b/code/game/objects/closets/secure/secure_closets.dm index 7abcc6ae059..fdfac4dcda1 100644 --- a/code/game/objects/closets/secure/secure_closets.dm +++ b/code/game/objects/closets/secure/secure_closets.dm @@ -24,6 +24,19 @@ src.req_access += pick(get_all_accesses()) ..() +/obj/structure/closet/secure_closet/proc/togglelock(mob/user as mob) + if(src.allowed(user)) + src.locked = !src.locked + for(var/mob/O in viewers(user, 3)) + if((O.client && !( O.blinded ))) + O << "\blue The locker has been [src.locked ? null : "un"]locked by [user]." + if(src.locked) + src.icon_state = src.icon_locked + else + src.icon_state = src.icon_closed + else + user << "\red Access Denied" + /obj/structure/closet/secure_closet/attackby(obj/item/W as obj, mob/user as mob) if(src.opened) if(istype(W, /obj/item/weapon/grab)) @@ -83,8 +96,7 @@ else user << "You need to stay still!" else - user << "\red Access Denied" - return + togglelock(user) /obj/structure/closet/secure_closet/relaymove(mob/user as mob) if(user.stat) @@ -114,4 +126,16 @@ return src.attackby(null, user) /obj/structure/closet/secure_closet/attack_paw(mob/user as mob) - return src.attack_hand(user) \ No newline at end of file + return src.attack_hand(user) + +/obj/structure/closet/secure_closet/verb/verb_togglelock() + set src in oview(1) // Can only use it from one square distance + set category = "Object" + set name = "Toggle Lock" + + if(!usr.canmove || usr.stat || usr.restrained()) // Don't use it if you're not able to! Checks for stuns, ghost and restrain + return + + if(!opened) // If we let him lock it while it's open, it will close without the items inside going with it + togglelock(usr) + diff --git a/code/game/objects/items/item.dm b/code/game/objects/items/item.dm index 4495931f908..682cfae67d3 100755 --- a/code/game/objects/items/item.dm +++ b/code/game/objects/items/item.dm @@ -70,41 +70,6 @@ src.loc = T - -obj/item/verb/pick_up() - set name = "Pick Up" - set category = "Object" - set src in view(1) - - if(!(usr)) - return - if((!istype(usr, /mob/living/carbon)) || (istype(usr, /mob/living/carbon/brain)))//Is humanoid, and is not a brain - usr << "\red You can't pick things up!" - return - if( usr.stat || usr.restrained() )//Is not asleep/dead and is not restrained - usr << "\red You can't pick things up!" - return - if(src.anchored) //Object isn't anchored - usr << "\red You can't pick that up!" - return - if(!usr.hand && usr.r_hand) //Right hand is not full - usr << "\red Your right hand is full." - return - if(usr.hand && usr.l_hand) //Left hand is not full - usr << "\red Your left hand is full." - return - if(!istype(src.loc, /turf)) //Object is on a turf - usr << "\red You can't pick that up!" - return - //All checks are done, time to pick it up! - if(istype(usr, /mob/living/carbon/human)) - src.attack_hand(usr) - if(istype(usr, /mob/living/carbon/alien)) - src.attack_alien(usr) - if(istype(usr, /mob/living/carbon/monkey)) - src.attack_paw(usr) - return - /obj/item/examine() set src in view()