diff --git a/modular_chomp/code/modules/paperwork/filingcabinet.dm b/modular_chomp/code/modules/paperwork/filingcabinet.dm new file mode 100644 index 0000000000..a4141b6c9a --- /dev/null +++ b/modular_chomp/code/modules/paperwork/filingcabinet.dm @@ -0,0 +1,190 @@ +/* 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 = TRUE + anchored = TRUE + +/obj/structure/filingcabinet/chestdrawer + name = "chest drawer" + icon_state = "chestdrawer" + +/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) || istype(I, /obj/item/weapon/paper_bundle)) + I.loc = src + . = ..() + +/obj/structure/filingcabinet/attackby(obj/item/P as obj, mob/user as mob) + if(istype(P, /obj/item/weapon/paper) || istype(P, /obj/item/weapon/folder) || istype(P, /obj/item/weapon/photo) || istype(P, /obj/item/weapon/paper_bundle)) + to_chat(user, "You put [P] in [src].") + user.drop_item() + P.loc = src + open_animation() + SStgui.update_uis(src) + else if(P.has_tool_quality(TOOL_WRENCH)) + playsound(src, P.usesound, 50, 1) + anchored = !anchored + to_chat(user, "You [anchored ? "wrench" : "unwrench"] \the [src].") + else if(P.has_tool_quality(TOOL_SCREWDRIVER)) + to_chat(user, "You begin taking the [name] apart.") + playsound(src, P.usesound, 50, 1) + if(do_after(user, 10 * P.toolspeed)) + playsound(src, P.usesound, 50, 1) + to_chat(user, "You take the [name] apart.") + new /obj/item/stack/material/steel( src.loc, 4 ) + for(var/obj/item/I in contents) + I.forceMove(loc) + qdel(src) + return + else + to_chat(user, "You can't put [P] in [src]!") + +/obj/structure/filingcabinet/attack_hand(mob/user as mob) + tgui_interact(user) + +/obj/structure/filingcabinet/attack_tk(mob/user) + if(anchored) + return attack_self_tk(user) + return ..() + +/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) + to_chat(user, "You pull \a [I] out of [src] at random.") + return + to_chat(user, "You find nothing in [src].") + +/obj/structure/filingcabinet/tgui_state(mob/user) + return GLOB.tgui_physical_state + +/obj/structure/filingcabinet/tgui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "FilingCabinet", name) + ui.set_autoupdate(FALSE) + ui.open() + +/obj/structure/filingcabinet/tgui_data(mob/user) + var/list/data = list() + + data["cabinet_name"] = "[name]" + data["contents"] = list() + data["contents_ref"] = list() + for(var/obj/item/content in src) + data["contents"] += "[content]" + data["contents_ref"] += "[REF(content)]" + + return data + +/obj/structure/filingcabinet/tgui_act(action, params) + . = ..() + if(.) + return + + switch(action) + if("remove_object") + var/obj/item/content = locate(params["ref"]) in src + if(istype(content) && (content.loc == src) && usr.Adjacent(src)) + usr.put_in_hands(content) + open_animation() + SStgui.update_uis(src) + +/obj/structure/filingcabinet/proc/open_animation() + flick("[initial(icon_state)]-open",src) + playsound(src, 'sound/bureaucracy/filingcabinet.ogg', 50, 1) + spawn(0) + sleep(20) + 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 + for(var/datum/data/record/R in data_core.security) + if((R.fields["name"] == G.fields["name"] || R.fields["id"] == G.fields["id"])) + S = R + break + var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(src) + P.info = "
Security Record

" + P.info += "Name: [G.fields["name"]] ID: [G.fields["id"]]
\nSex: [G.fields["sex"]]
\nAge: [G.fields["age"]]
\nFingerprint: [G.fields["fingerprint"]]
\nPhysical Status: [G.fields["p_stat"]]
\nMental Status: [G.fields["m_stat"]]
" + P.info += "
\n
Security Data

\nCriminal Status: [S.fields["criminal"]]
\n
\nMinor Crimes: [S.fields["mi_crim"]]
\nDetails: [S.fields["mi_crim_d"]]
\n
\nMajor Crimes: [S.fields["ma_crim"]]
\nDetails: [S.fields["ma_crim_d"]]
\n
\nImportant Notes:
\n\t[S.fields["notes"]]
\n
\n
Comments/Log

" + var/counter = 1 + while(S.fields["com_[counter]"]) + P.info += "[S.fields["com_[counter]"]]
" + counter++ + P.info += "" + P.name = "Security Record ([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 + for(var/datum/data/record/R in data_core.medical) + if((R.fields["name"] == G.fields["name"] || R.fields["id"] == G.fields["id"])) + M = R + break + if(M) + var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(src) + P.info = "
Medical Record

" + P.info += "Name: [G.fields["name"]] ID: [G.fields["id"]]
\nSex: [G.fields["sex"]]
\nAge: [G.fields["age"]]
\nFingerprint: [G.fields["fingerprint"]]
\nPhysical Status: [G.fields["p_stat"]]
\nMental Status: [G.fields["m_stat"]]
" + + P.info += "
\n
Medical Data

\nBlood Type: [M.fields["b_type"]]
\nDNA: [M.fields["b_dna"]]
\n
\nMinor Disabilities: [M.fields["mi_dis"]]
\nDetails: [M.fields["mi_dis_d"]]
\n
\nMajor Disabilities: [M.fields["ma_dis"]]
\nDetails: [M.fields["ma_dis_d"]]
\n
\nAllergies: [M.fields["alg"]]
\nDetails: [M.fields["alg_d"]]
\n
\nCurrent Diseases: [M.fields["cdi"]] (per disease info placed in log/comment section)
\nDetails: [M.fields["cdi_d"]]
\n
\nImportant Notes:
\n\t[M.fields["notes"]]
\n
\n
Comments/Log

" + var/counter = 1 + while(M.fields["com_[counter]"]) + P.info += "[M.fields["com_[counter]"]]
" + counter++ + P.info += "" + P.name = "Medical Record ([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() + ..() diff --git a/tgui/packages/tgui_ch/interfaces/FileCabinet.js b/tgui/packages/tgui_ch/interfaces/FileCabinet.js deleted file mode 100644 index aa19e35f5d..0000000000 --- a/tgui/packages/tgui_ch/interfaces/FileCabinet.js +++ /dev/null @@ -1,31 +0,0 @@ -import { sortBy } from 'common/collections'; -import { useBackend } from '../backend'; -import { Button, Section } from '../components'; -import { Window } from '../layouts'; - -export const FileCabinet = (props, context) => { - const { act, data } = useBackend(context); - - const { contents } = data; - - // Wow, the filing cabinets sort themselves in 2320. - const sortedContents = sortBy((val) => val.name)(contents || []); - - return ( - - -
- {sortedContents.map((item) => ( -
-
-
- ); -}; diff --git a/tgui/packages/tgui_ch/interfaces/FilingCabinet.js b/tgui/packages/tgui_ch/interfaces/FilingCabinet.js new file mode 100644 index 0000000000..4fd52adc51 --- /dev/null +++ b/tgui/packages/tgui_ch/interfaces/FilingCabinet.js @@ -0,0 +1,41 @@ +import { useBackend } from '../backend'; +import { Box, Button, Flex, Section } from '../components'; +import { Window } from '../layouts'; + +export const FilingCabinet = (props, context) => { + const { act, data } = useBackend(context); + const { cabinet_name, contents, contents_ref } = data; + return ( + + + {contents.map((object, index) => ( + + + {object} + + + ",rt+='
',rt+='
',rt+="Addons:
"+function(e){var t=[];return null==e||e.forEach((function(e){t.push(''+e+"")})),0===t.length&&t.push("No Addons Set"),t}(p)+"

",rt+="== Descriptions ==
",rt+="Vore Verb:
"+a+"

",rt+="Release Verb:
"+i+"

",rt+='Description:
"'+o+'"

',rt+='Absorbed Description:
"'+r+'"

',rt+="
",rt+="== Messages ==
",rt+='
',rt+='
",rt+='
',rt+='
',rt+='
',null==M||M.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==E||E.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==O||O.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==P||P.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==F||F.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==D||D.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==R||R.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==j||j.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==W||W.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==z||z.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==U||U.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==H||H.forEach((function(e){rt+=e+"
"})),rt+="
",rt+="
",rt+="
",rt+="
",rt+="
= Idle Messages =

",rt+="

Idle Messages (Hold):

",null==G||G.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Hold Absorbed):

",null==K||K.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Digest):

",null==q||q.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Absorb):

",null==Y||Y.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Unabsorb):

",null==te||te.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Drain):

",null==X||X.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Heal):

",null==$||$.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Size Steal):

",null==Q||Q.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Shrink):

",null==Z||Z.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Grow):

",null==ee||ee.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="
Idle Messages (Encase In Egg):

",null==J||J.forEach((function(e){rt+=e+"
"})),rt+="


",rt+="


",rt+="
",rt+='
',rt+='
',rt+='

',rt+='

",rt+='
',rt+='
',rt+='
    ',rt+='
  • Can Taste: '+(N?'Yes':'No')+"
  • ",rt+='
  • Feedable: '+(g?'Yes':'No')+"
  • ",rt+='
  • Contaminates: '+(V?'Yes':'No')+"
  • ",rt+='
  • Contamination Flavor: '+v+"
  • ",rt+='
  • Contamination Color: '+_+"
  • ",rt+='
  • Nutritional Gain: '+y+"%
  • ",rt+='
  • Required Examine Size: '+100*k+"%
  • ",rt+='
  • Display Absorbed Examines: '+(x?'True':'False')+"
  • ",rt+='
  • Save Digest Mode: '+(w?'True':'False')+"
  • ",rt+='
  • Idle Emotes: '+(L?'Active':'Inactive')+"
  • ",rt+='
  • Idle Emote Delay: '+B+" seconds
  • ",rt+='
  • Shrink/Grow Size: '+100*S+"%
  • ",rt+='
  • Vore Spawn Blacklist: '+(I?'Yes':'No')+"
  • ",rt+='
  • Egg Type: '+T+"
  • ",rt+='
  • Selective Mode Preference: '+A+"
  • ",rt+="
",rt+="
",rt+='
',rt+='

',rt+='

",rt+='
',rt+='
',rt+='
    ',rt+='
  • Fleshy Belly: '+(ne?'Yes':'No')+"
  • ",rt+='
  • Internal Loop: '+(oe?'Yes':'No')+"
  • ",rt+='
  • Use Fancy Sounds: '+(re?'Yes':'No')+"
  • ",rt+='
  • Vore Sound: '+ae+"
  • ",rt+='
  • Release Sound: '+ie+"
  • ",rt+="
",rt+="
",rt+='
',rt+='

',rt+='

",rt+='
",rt+='
',rt+="Vore Sprites",rt+='
    ',rt+='
  • Affect Vore Sprites: '+(ce?'Yes':'No')+"
  • ",rt+='
  • Count Absorbed prey for vore sprites: '+(le?'Yes':'No')+"
  • ",rt+='
  • Animation when prey resist: '+(de?'Yes':'No')+"
  • ",rt+='
  • Vore Sprite Size Factor: '+se+"
  • ",rt+='
  • Belly Sprite to affect: '+ue+"
  • ",rt+="
",rt+="Belly Fullscreens Preview and Coloring",rt+='
    ',rt+='
  • Color: '+me+"",rt+="
",rt+="Vore FX",rt+='
    ',rt+='
  • Disable Prey HUD: '+(pe?'Yes':'No')+"
  • ",rt+="
",rt+="
",rt+='
',rt+='

',rt+='

",rt+='
',rt+='
',rt+="Belly Interactions ("+(he?'Enabled':'Disabled')+")",rt+='
    ',rt+='
  • Escape Chance: '+fe+"%
  • ",rt+='
  • Escape Time: '+Ce/10+"s
  • ",rt+='
  • Transfer Chance: '+be+"%
  • ",rt+='
  • Transfer Location: '+Ne+"
  • ",rt+='
  • Secondary Transfer Chance: '+ge+"%
  • ",rt+='
  • Secondary Transfer Location: '+Ve+"
  • ",rt+='
  • Absorb Chance: '+ve+"%
  • ",rt+='
  • Digest Chance: '+_e+"%
  • ",rt+="
",rt+="
",rt+="Auto-Transfer Options ("+(Be?'Enabled':'Disabled')+")",rt+='
    ',rt+='
  • Auto-Transfer Time: '+ye/10+"s
  • ",rt+='
  • Auto-Transfer Min Amount: '+Se+"
  • ",rt+='
  • Auto-Transfer Max Amount: '+Ie+"
  • ",rt+='
  • Auto-Transfer Primary Chance: '+ke+"%
  • ",rt+='
  • Auto-Transfer Primary Location: '+xe+"
  • ",rt+='
  • Auto-Transfer Primary Whitelist (Mobs): '+m(Te,!0)+"
  • ",rt+='
  • Auto-Transfer Primary Whitelist (Items): '+m(Oe,!0)+"
  • ",rt+='
  • Auto-Transfer Primary Blacklist (Mobs): '+m(Ae,!1)+"
  • ",rt+='
  • Auto-Transfer Primary Blacklist (Items): '+m(Pe,!1)+"
  • ",rt+='
  • Auto-Transfer Secondary Chance: '+we+"%
  • ",rt+='
  • Auto-Transfer Secondary Location: '+Le+"
  • ",rt+='
  • Auto-Transfer Secondary Whitelist (Mobs): '+m(Me,!0)+"
  • ",rt+='
  • Auto-Transfer Secondary Whitelist (Items): '+m(Fe,!0)+"
  • ",rt+='
  • Auto-Transfer Secondary Blacklist (Mobs): '+m(Ee,!1)+"
  • ",rt+='
  • Auto-Transfer Secondary Blacklist (Items): '+m(De,!1)+"
  • ",rt+="
",rt+="
",rt+='
',rt+='

',rt+='

",rt+='
',rt+='
',rt+='
    ',rt+='
  • Generate Liquids: '+(je?'On':'Off')+"
  • ",rt+='
  • Liquid Type: '+We+"
  • ",rt+='
  • Liquid Name: '+ze+"
  • ",rt+='
  • Transfer Verb: '+Ue+"
  • ",rt+='
  • Generation Time: '+He+"
  • ",rt+='
  • Liquid Capacity: '+qe+"
  • ",rt+='
  • Slosh Sounds: '+(Ge?'On':'Off')+"
  • ",rt+='
  • Liquid Addons: '+function(e){var t=[];return null==e||e.forEach((function(e){t.push(''+e+"")})),0===t.length&&t.push("No Addons Set"),t}(Ke)+"
  • ",rt+="
",rt+="
",rt+='
',rt+='

',rt+='

",rt+='
',rt+='
',rt+='
',rt+='
",rt+='
',rt+='
',rt+='
',null==Ze||Ze.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==et||et.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==tt||tt.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==nt||nt.forEach((function(e){rt+=e+"
"})),rt+="
",rt+='
',null==ot||ot.forEach((function(e){rt+=e+"
"})),rt+="
",rt+="
",rt+="
",rt+="
",rt+="
",rt+="
"},h=function(e,t){var n,o=(0,r.useBackend)(e),a=(o.act,o.data),i=a.db_version,c=a.db_repo,l=a.mob_name,d=a.bellies,s=function(){var e=new Date,t=String(e.getHours());t.length<2&&(t="0"+t);var n=String(e.getMinutes());n.length<2&&(n="0"+n);var o=String(e.getDate());o.length<2&&(o="0"+o);var r=String(e.getMonth()+1);return r.length<2&&(r="0"+r)," "+String(e.getFullYear())+"-"+r+"-"+o+" ("+t+" "+n+")"}(),u=l+s+t;if(".html"===t){n=new Blob([''+d.length+" Exported Bellies (DB_VER: "+c+"-"+i+')

Bellies of '+l+'

Generated on: '+s+'

'],{type:"text/html;charset=utf8"}),d.forEach((function(e,t){n=new Blob([n,p(e,t)],{type:"text/html;charset=utf8"})})),n=new Blob([n,"
",'