mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-23 20:17:15 +01:00
TGUI File Cabinets
This commit is contained in:
@@ -36,12 +36,8 @@
|
||||
to_chat(user, "<span class='notice'>You put [P] in [src].</span>")
|
||||
user.drop_item()
|
||||
P.loc = src
|
||||
icon_state = "[initial(icon_state)]-open"
|
||||
flick("[initial(icon_state)]-open",src)
|
||||
playsound(src, 'sound/bureaucracy/filingcabinet.ogg', 50, 1)
|
||||
sleep(40)
|
||||
icon_state = initial(icon_state)
|
||||
updateUsrDialog()
|
||||
open_animation()
|
||||
SStgui.update_uis(src)
|
||||
else if(P.is_wrench())
|
||||
playsound(src, P.usesound, 50, 1)
|
||||
anchored = !anchored
|
||||
@@ -65,20 +61,12 @@
|
||||
to_chat(user, "<span class='notice'>\The [src] is empty.</span>")
|
||||
return
|
||||
|
||||
user.set_machine(src)
|
||||
var/dat = "<center><table>"
|
||||
for(var/obj/item/P in src)
|
||||
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")
|
||||
|
||||
return
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/structure/filingcabinet/attack_tk(mob/user)
|
||||
if(anchored)
|
||||
attack_self_tk(user)
|
||||
else
|
||||
..()
|
||||
return attack_self_tk(user)
|
||||
return ..()
|
||||
|
||||
/obj/structure/filingcabinet/attack_self_tk(mob/user)
|
||||
if(contents.len)
|
||||
@@ -91,20 +79,46 @@
|
||||
return
|
||||
to_chat(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
|
||||
/obj/structure/filingcabinet/tgui_state(mob/user)
|
||||
return GLOB.tgui_physical_state
|
||||
|
||||
//var/retrieveindex = text2num(href_list["retrieve"])
|
||||
var/obj/item/P = locate(href_list["retrieve"])//contents[retrieveindex]
|
||||
if(istype(P) && (P.loc == src) && src.Adjacent(usr))
|
||||
usr.put_in_hands(P)
|
||||
updateUsrDialog()
|
||||
flick("[initial(icon_state)]-open",src)
|
||||
playsound(src, 'sound/bureaucracy/filingcabinet.ogg', 50, 1)
|
||||
spawn(0)
|
||||
sleep(20)
|
||||
icon_state = initial(icon_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, "FileCabinet", name)
|
||||
ui.set_autoupdate(FALSE)
|
||||
ui.open()
|
||||
|
||||
/obj/structure/filingcabinet/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["contents"] = list()
|
||||
for(var/obj/item/P in src)
|
||||
data["contents"].Add(list(list(
|
||||
"name" = P.name,
|
||||
"ref" = "\ref[P]",
|
||||
)))
|
||||
|
||||
return data
|
||||
|
||||
/obj/structure/filingcabinet/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("retrieve")
|
||||
var/obj/item/P = locate(params["ref"])
|
||||
if(istype(P) && (P.loc == src) && usr.Adjacent(src))
|
||||
usr.put_in_hands(P)
|
||||
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
|
||||
@@ -112,7 +126,6 @@
|
||||
/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)
|
||||
|
||||
Reference in New Issue
Block a user