mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-24 16:13:20 +00:00
This adds two atom procs, attack_tk() and attack_self_tk(). attack_tk is used as per attack_hand; attack_self_tk exists on all atoms (not just items) but is similar to the item proc, but without the assumption that it is in the user's hand. Removes the functionality where entering throw mode would create a tk grab, as it is redundant. As a default, attack_tk does the following: * Creates a telekinetic throw for items and un-anchored objects * Does an attack_hand (paw, animal, etc) for anchored objects * Does nothing to mobs As a default, attack_self_tk does nothing. An attack_self_tk was added to closets to open and close them since that's a common thing. The following items have added attack_tk procs: * Fire axe cabinet, extinguisher cabinet, and bedsheet bin will drop into their square instead of putting it in your hand * Doors only open telekinetically if they require no access * Chairs will rotate if nobody is buckled to them * Filing cabinets will remove a paper at random. * Tables and racks return to prevent telehulk smash This is INCOMPLETE. Adding proper TK interaction to everything is something best done in pieces. In particular, interacting with mobs and items both open up the floodgates for bugs, so we/I need to decide how we want it to go before we commit, and then fix bugs along the way. Stumbling forward, fixing bugs, and then changing course halfway would be a bad idea.
160 lines
6.4 KiB
Plaintext
160 lines
6.4 KiB
Plaintext
/* Filing cabinets!
|
|
* Contains:
|
|
* Filing Cabinets
|
|
* Security Record Cabinets
|
|
* Medical Record Cabinets
|
|
*/
|
|
|
|
|
|
/*
|
|
* Filing Cabinets
|
|
*/
|
|
/obj/structure/filingcabinet
|
|
name = "filing cabinet"
|
|
desc = "A large cabinet with drawers."
|
|
icon = 'icons/obj/bureaucracy.dmi'
|
|
icon_state = "filingcabinet"
|
|
density = 1
|
|
anchored = 1
|
|
|
|
/obj/structure/filingcabinet/chestdrawer
|
|
name = "chest drawer"
|
|
icon_state = "chestdrawer"
|
|
|
|
/obj/structure/filingcabinet/chestdrawer/wheeled
|
|
name = "rolling chest drawer"
|
|
desc = "A small cabinet with drawers. This one has wheels!"
|
|
anchored = 0
|
|
|
|
/obj/structure/filingcabinet/filingcabinet //not changing the path to avoid unecessary map issues, but please don't name stuff like this in the future -Pete
|
|
icon_state = "tallcabinet"
|
|
|
|
|
|
/obj/structure/filingcabinet/initialize()
|
|
for(var/obj/item/I in loc)
|
|
if(istype(I, /obj/item/weapon/paper) || istype(I, /obj/item/weapon/folder) || istype(I, /obj/item/weapon/photo))
|
|
I.loc = src
|
|
|
|
|
|
/obj/structure/filingcabinet/attackby(obj/item/P, mob/user)
|
|
if(istype(P, /obj/item/weapon/paper) || istype(P, /obj/item/weapon/folder) || istype(P, /obj/item/weapon/photo))
|
|
user << "<span class='notice'>You put [P] in [src].</span>"
|
|
user.drop_item()
|
|
P.loc = src
|
|
icon_state = "[initial(icon_state)]-open"
|
|
sleep(5)
|
|
icon_state = initial(icon_state)
|
|
updateUsrDialog()
|
|
else if(istype(P, /obj/item/weapon/wrench))
|
|
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
|
|
anchored = !anchored
|
|
user << "<span class='notice'>You [anchored ? "wrench" : "unwrench"] [src].</span>"
|
|
else
|
|
user << "<span class='notice'>You can't put [P] in [src]!</span>"
|
|
|
|
|
|
/obj/structure/filingcabinet/attack_hand(mob/user)
|
|
if(contents.len <= 0)
|
|
user << "<span class='notice'>[src] is empty.</span>"
|
|
return
|
|
|
|
user.set_machine(src)
|
|
var/dat = "<center><table>"
|
|
var/i
|
|
for(i=contents.len, i>=1, i--)
|
|
var/obj/item/P = contents[i]
|
|
dat += "<tr><td><a href='?src=\ref[src];retrieve=\ref[P]'>[P.name]</a></td></tr>"
|
|
dat += "</table></center>"
|
|
user << browse("<html><head><title>[name]</title></head><body>[dat]</body></html>", "window=filingcabinet;size=350x300")
|
|
|
|
/obj/structure/filingcabinet/attack_tk(mob/user)
|
|
if(anchored)
|
|
attack_self_tk(user)
|
|
else
|
|
..()
|
|
|
|
/obj/structure/filingcabinet/attack_self_tk(mob/user)
|
|
if(contents.len)
|
|
if(prob(40 + contents.len * 5))
|
|
var/obj/item/I = pick(contents)
|
|
I.loc = loc
|
|
if(prob(25))
|
|
step_rand(I)
|
|
user << "<span class='notice'>You pull \a [I] out of [src] at random.</span>"
|
|
return
|
|
user << "<span class='notice'>You find nothing in [src].</span>"
|
|
|
|
/obj/structure/filingcabinet/Topic(href, href_list)
|
|
if(href_list["retrieve"])
|
|
usr << browse("", "window=filingcabinet") // Close the menu
|
|
|
|
//var/retrieveindex = text2num(href_list["retrieve"])
|
|
var/obj/item/P = locate(href_list["retrieve"])//contents[retrieveindex]
|
|
if(istype(P) && P.loc == src && in_range(src, usr))
|
|
usr.put_in_hands(P)
|
|
updateUsrDialog()
|
|
icon_state = "[initial(icon_state)]-open"
|
|
sleep(5)
|
|
icon_state = initial(icon_state)
|
|
|
|
|
|
/*
|
|
* Security Record Cabinets
|
|
*/
|
|
/obj/structure/filingcabinet/security
|
|
var/virgin = 1
|
|
|
|
/obj/structure/filingcabinet/security/proc/populate()
|
|
if(virgin)
|
|
for(var/datum/data/record/G in data_core.general)
|
|
var/datum/data/record/S = find_record("name", G.fields["name"], data_core.security)
|
|
if(!S) continue
|
|
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(src)
|
|
P.info = "<CENTER><B>Security Record</B></CENTER><BR>"
|
|
P.info += "Name: [G.fields["name"]] ID: [G.fields["id"]]<BR>\nSex: [G.fields["sex"]]<BR>\nAge: [G.fields["age"]]<BR>\nFingerprint: [G.fields["fingerprint"]]<BR>\nPhysical Status: [G.fields["p_stat"]]<BR>\nMental Status: [G.fields["m_stat"]]<BR>"
|
|
P.info += "<BR>\n<CENTER><B>Security Data</B></CENTER><BR>\nCriminal Status: [S.fields["criminal"]]<BR>\n<BR>\nMinor Crimes: [S.fields["mi_crim"]]<BR>\nDetails: [S.fields["mi_crim_d"]]<BR>\n<BR>\nMajor Crimes: [S.fields["ma_crim"]]<BR>\nDetails: [S.fields["ma_crim_d"]]<BR>\n<BR>\nImportant Notes:<BR>\n\t[S.fields["notes"]]<BR>\n<BR>\n<CENTER><B>Comments/Log</B></CENTER><BR>"
|
|
var/counter = 1
|
|
while(S.fields["com_[counter]"])
|
|
P.info += "[S.fields["com_[counter]"]]<BR>"
|
|
counter++
|
|
P.info += "</TT>"
|
|
P.name = "paper - '[G.fields["name"]]'"
|
|
virgin = 0 //tabbing here is correct- it's possible for people to try and use it
|
|
//before the records have been generated, so we do this inside the loop.
|
|
/obj/structure/filingcabinet/security/attack_hand()
|
|
populate()
|
|
..()
|
|
/obj/structure/filingcabinet/security/attack_tk()
|
|
populate()
|
|
..()
|
|
|
|
/*
|
|
* Medical Record Cabinets
|
|
*/
|
|
/obj/structure/filingcabinet/medical
|
|
var/virgin = 1
|
|
|
|
/obj/structure/filingcabinet/medical/proc/populate()
|
|
if(virgin)
|
|
for(var/datum/data/record/G in data_core.general)
|
|
var/datum/data/record/M = find_record("name", G.fields["name"], data_core.medical)
|
|
if(!M) continue
|
|
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(src)
|
|
P.info = "<CENTER><B>Medical Record</B></CENTER><BR>"
|
|
P.info += "Name: [G.fields["name"]] ID: [G.fields["id"]]<BR>\nSex: [G.fields["sex"]]<BR>\nAge: [G.fields["age"]]<BR>\nFingerprint: [G.fields["fingerprint"]]<BR>\nPhysical Status: [G.fields["p_stat"]]<BR>\nMental Status: [G.fields["m_stat"]]<BR>"
|
|
P.info += "<BR>\n<CENTER><B>Medical Data</B></CENTER><BR>\nBlood Type: [M.fields["blood_type"]]<BR>\nDNA: [M.fields["b_dna"]]<BR>\n<BR>\nMinor Disabilities: [M.fields["mi_dis"]]<BR>\nDetails: [M.fields["mi_dis_d"]]<BR>\n<BR>\nMajor Disabilities: [M.fields["ma_dis"]]<BR>\nDetails: [M.fields["ma_dis_d"]]<BR>\n<BR>\nAllergies: [M.fields["alg"]]<BR>\nDetails: [M.fields["alg_d"]]<BR>\n<BR>\nCurrent Diseases: [M.fields["cdi"]] (per disease info placed in log/comment section)<BR>\nDetails: [M.fields["cdi_d"]]<BR>\n<BR>\nImportant Notes:<BR>\n\t[M.fields["notes"]]<BR>\n<BR>\n<CENTER><B>Comments/Log</B></CENTER><BR>"
|
|
var/counter = 1
|
|
while(M.fields["com_[counter]"])
|
|
P.info += "[M.fields["com_[counter]"]]<BR>"
|
|
counter++
|
|
P.info += "</TT>"
|
|
P.name = "paper - '[G.fields["name"]]'"
|
|
virgin = 0 //tabbing here is correct- it's possible for people to try and use it
|
|
//before the records have been generated, so we do this inside the loop.
|
|
/obj/structure/filingcabinet/medical/attack_hand()
|
|
populate()
|
|
..()
|
|
/obj/structure/filingcabinet/medical/attack_tk()
|
|
populate()
|
|
..()
|