mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 12:07:27 +01:00
Implement /vg/'s global asset cache
This commit is contained in:
@@ -214,6 +214,8 @@
|
||||
///////////
|
||||
/client/New(TopicData)
|
||||
TopicData = null //Prevent calls to client.Topic from connect
|
||||
client_cache += src
|
||||
client_cache[src] = list()
|
||||
|
||||
if(connection != "seeker") //Invalid connection type.
|
||||
return null
|
||||
@@ -277,8 +279,6 @@
|
||||
|
||||
send_resources()
|
||||
|
||||
nanomanager.send_resources(src)
|
||||
|
||||
//////////////
|
||||
//DISCONNECT//
|
||||
//////////////
|
||||
@@ -377,65 +377,13 @@
|
||||
if(inactivity > duration) return inactivity
|
||||
return 0
|
||||
|
||||
//send resources to the client. It's here in its own proc so we can move it around easiliy if need be
|
||||
//Sned resources to the client.
|
||||
/client/proc/send_resources()
|
||||
// preload_vox() //Causes long delays with initial start window and subsequent windows when first logged in.
|
||||
|
||||
// Most assets are now handled through global_cache.dm
|
||||
getFiles(
|
||||
'html/search.js',
|
||||
'html/panels.css',
|
||||
'html/painew.png',
|
||||
'html/loading.gif',
|
||||
'icons/pda_icons/pda_atmos.png',
|
||||
'icons/pda_icons/pda_back.png',
|
||||
'icons/pda_icons/pda_bell.png',
|
||||
'icons/pda_icons/pda_blank.png',
|
||||
'icons/pda_icons/pda_boom.png',
|
||||
'icons/pda_icons/pda_bucket.png',
|
||||
'icons/pda_icons/pda_crate.png',
|
||||
'icons/pda_icons/pda_cuffs.png',
|
||||
'icons/pda_icons/pda_eject.png',
|
||||
'icons/pda_icons/pda_exit.png',
|
||||
'icons/pda_icons/pda_flashlight.png',
|
||||
'icons/pda_icons/pda_honk.png',
|
||||
'icons/pda_icons/pda_mail.png',
|
||||
'icons/pda_icons/pda_medical.png',
|
||||
'icons/pda_icons/pda_menu.png',
|
||||
'icons/pda_icons/pda_mule.png',
|
||||
'icons/pda_icons/pda_notes.png',
|
||||
'icons/pda_icons/pda_power.png',
|
||||
'icons/pda_icons/pda_rdoor.png',
|
||||
'icons/pda_icons/pda_reagent.png',
|
||||
'icons/pda_icons/pda_refresh.png',
|
||||
'icons/pda_icons/pda_scanner.png',
|
||||
'icons/pda_icons/pda_signaler.png',
|
||||
'icons/pda_icons/pda_status.png',
|
||||
'icons/spideros_icons/sos_1.png',
|
||||
'icons/spideros_icons/sos_2.png',
|
||||
'icons/spideros_icons/sos_3.png',
|
||||
'icons/spideros_icons/sos_4.png',
|
||||
'icons/spideros_icons/sos_5.png',
|
||||
'icons/spideros_icons/sos_6.png',
|
||||
'icons/spideros_icons/sos_7.png',
|
||||
'icons/spideros_icons/sos_8.png',
|
||||
'icons/spideros_icons/sos_9.png',
|
||||
'icons/spideros_icons/sos_10.png',
|
||||
'icons/spideros_icons/sos_11.png',
|
||||
'icons/spideros_icons/sos_12.png',
|
||||
'icons/spideros_icons/sos_13.png',
|
||||
'icons/spideros_icons/sos_14.png',
|
||||
'icons/stamp_icons/large_stamp-clown.png',
|
||||
'icons/stamp_icons/large_stamp-deny.png',
|
||||
'icons/stamp_icons/large_stamp-ok.png',
|
||||
'icons/stamp_icons/large_stamp-hop.png',
|
||||
'icons/stamp_icons/large_stamp-cmo.png',
|
||||
'icons/stamp_icons/large_stamp-ce.png',
|
||||
'icons/stamp_icons/large_stamp-hos.png',
|
||||
'icons/stamp_icons/large_stamp-rd.png',
|
||||
'icons/stamp_icons/large_stamp-cap.png',
|
||||
'icons/stamp_icons/large_stamp-qm.png',
|
||||
'icons/stamp_icons/large_stamp-law.png',
|
||||
'icons/stamp_icons/large_stamp-cent.png',
|
||||
'html/talisman.png',
|
||||
'html/images/ntlogo.png'
|
||||
)
|
||||
'html/search.js', // Used in various non-NanoUI HTML windows for search functionality
|
||||
'html/panels.css' // Used for styling certain panels, such as in the new player panel
|
||||
)
|
||||
|
||||
// Send NanoUI resources to this client
|
||||
spawn nanomanager.send_resources(src)
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
//We store a list of all clients, with a list of all file names that the client received.
|
||||
/var/global/list/client_cache = list()
|
||||
|
||||
//List of ALL assets for the above, format is list(filename = asset).
|
||||
/var/global/list/asset_cache = list()
|
||||
|
||||
//This proc sends the asset to the client, but only if it needs it.
|
||||
/proc/send_asset(var/client/client, var/asset_name)
|
||||
var/list/client_list = client_cache[client]
|
||||
ASSERT(client_list)
|
||||
|
||||
if(asset_name in client_list)
|
||||
return
|
||||
|
||||
//world << "sending a client the asset '[asset_name]'"
|
||||
client << browse_rsc(asset_cache[asset_name], asset_name)
|
||||
client_list += asset_name
|
||||
|
||||
/proc/send_asset_list(var/client/client, var/list/asset_list)
|
||||
for(var/asset_name in asset_list)
|
||||
send_asset(client, asset_name)
|
||||
|
||||
//This proc "registers" an asset, it adds it to the cache for further use, you cannot touch it from this point on or you'll fuck things up.
|
||||
//if it's an icon or something be careful, you'll have to copy it before further use.
|
||||
/proc/register_asset(var/asset_name, var/asset)
|
||||
asset_cache |= asset_name
|
||||
asset_cache[asset_name] = asset
|
||||
|
||||
//From here on out it's populating the asset cache.
|
||||
/proc/populate_asset_cache()
|
||||
for(var/type in typesof(/datum/asset) - list(/datum/asset, /datum/asset/simple))
|
||||
var/datum/asset/A = new type()
|
||||
|
||||
A.register()
|
||||
|
||||
//These datums are used to populate the asset cache, the proc "register()" does this.
|
||||
/datum/asset/proc/register()
|
||||
return
|
||||
|
||||
//If you don't need anything complicated.
|
||||
/datum/asset/simple
|
||||
var/assets = list()
|
||||
|
||||
/datum/asset/simple/register()
|
||||
for(var/asset_name in assets)
|
||||
register_asset(asset_name, assets[asset_name])
|
||||
|
||||
//DEFINITIONS FOR ASSET DATUMS START HERE.
|
||||
/datum/asset/simple/spider_os
|
||||
assets = list(
|
||||
"sos_1.png" = 'icons/spideros_icons/sos_1.png',
|
||||
"sos_2.png" = 'icons/spideros_icons/sos_2.png',
|
||||
"sos_3.png" = 'icons/spideros_icons/sos_3.png',
|
||||
"sos_4.png" = 'icons/spideros_icons/sos_4.png',
|
||||
"sos_5.png" = 'icons/spideros_icons/sos_5.png',
|
||||
"sos_6.png" = 'icons/spideros_icons/sos_6.png',
|
||||
"sos_7.png" = 'icons/spideros_icons/sos_7.png',
|
||||
"sos_8.png" = 'icons/spideros_icons/sos_8.png',
|
||||
"sos_9.png" = 'icons/spideros_icons/sos_9.png',
|
||||
"sos_10.png" = 'icons/spideros_icons/sos_10.png',
|
||||
"sos_11.png" = 'icons/spideros_icons/sos_11.png',
|
||||
"sos_12.png" = 'icons/spideros_icons/sos_12.png',
|
||||
"sos_13.png" = 'icons/spideros_icons/sos_13.png',
|
||||
"sos_14.png" = 'icons/spideros_icons/sos_14.png'
|
||||
)
|
||||
|
||||
/datum/asset/simple/paper
|
||||
assets = list(
|
||||
"large_stamp-clown.png" = 'icons/paper_icons/large_stamp-clown.png',
|
||||
"large_stamp-deny.png" = 'icons/paper_icons/large_stamp-deny.png',
|
||||
"large_stamp-ok.png" = 'icons/paper_icons/large_stamp-ok.png',
|
||||
"large_stamp-hop.png" = 'icons/paper_icons/large_stamp-hop.png',
|
||||
"large_stamp-cmo.png" = 'icons/paper_icons/large_stamp-cmo.png',
|
||||
"large_stamp-ce.png" = 'icons/paper_icons/large_stamp-ce.png',
|
||||
"large_stamp-hos.png" = 'icons/paper_icons/large_stamp-hos.png',
|
||||
"large_stamp-rd.png" = 'icons/paper_icons/large_stamp-rd.png',
|
||||
"large_stamp-cap.png" = 'icons/paper_icons/large_stamp-cap.png',
|
||||
"large_stamp-qm.png" = 'icons/paper_icons/large_stamp-qm.png',
|
||||
"large_stamp-law.png" = 'icons/paper_icons/large_stamp-law.png',
|
||||
"large_stamp-cent.png" = 'icons/paper_icons/large_stamp-cent.png',
|
||||
"talisman.png" = 'icons/paper_icons/talisman.png',
|
||||
"ntlogo.png" = 'icons/paper_icons/ntlogo.png'
|
||||
)
|
||||
@@ -110,8 +110,6 @@
|
||||
|
||||
/mob/living/silicon/pai/Login()
|
||||
..()
|
||||
usr << browse_rsc('html/paigrid.png') // Go ahead and cache the interface resources as early as possible
|
||||
|
||||
|
||||
// this function shows the information about being silenced as a pAI in the Status panel
|
||||
/mob/living/silicon/pai/proc/show_silenced()
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
if(!affecting) return//If no mob is wearing the suit. I almost forgot about this variable.
|
||||
var/mob/living/carbon/human/U = affecting
|
||||
var/display_to = U//Who do we want to display certain messages to?
|
||||
|
||||
if(U.client) // Send the spider OS images to the client
|
||||
var/datum/asset/simple/S = new/datum/asset/simple/spider_os()
|
||||
send_asset_list(U.client, S.assets)
|
||||
|
||||
var/dat = "<html><head><title>SpiderOS</title></head><body bgcolor=\"#3D5B43\" text=\"#DB2929\"><style>a, a:link, a:visited, a:active, a:hover { color: #DB2929; }img {border-style:none;}</style>"
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Refresh'><img src=sos_7.png> Refresh</a>"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//^ Old coder words may be false these days, Not taking the risk for now.
|
||||
|
||||
/obj/item/clothing/suit/space/space_ninja/verb/toggle_suit()
|
||||
set category = "Space Ninja - Equiptment"
|
||||
set category = "Space Ninja - Equipment"
|
||||
set name = "Toggle Suit"
|
||||
|
||||
if(usr.mind.special_role == "Ninja")
|
||||
@@ -68,7 +68,9 @@
|
||||
usr<< "<span style='color: #0000ff;'>VOID-shift device status: <b>ONLINE</b>.\nCLOAK-tech device status:<b>ONLINE</b></span>"
|
||||
|
||||
sleep(5)
|
||||
usr<< "<span style='color: #0000ff;'>Primary system status: <b>ONLINE</b>.\nBackup system status: <b>ONLINE</b>.\nCurrent energy capacity: <b>[suitCell.charge]/[suitCell.maxcharge]</b>.</span>"
|
||||
usr<< "<span style='color: #0000ff;'>Primary system status: <b>ONLINE</b>.\nBackup system status: <b>ONLINE</b>.</span>"
|
||||
if(suitCell)
|
||||
usr<< "<span style='color: #0000ff;'>Current energy capacity: <b>[suitCell.charge]/[suitCell.maxcharge]</b>.</span>"
|
||||
|
||||
sleep(10)
|
||||
usr<< "<span style='color: #0000ff;'>All systems operational. Welcome to <b>SpiderOS</b>, [usr.real_name].</span>"
|
||||
|
||||
@@ -134,13 +134,7 @@
|
||||
var/obj/item/weapon/paper/P = locate(href_list["read"])
|
||||
|
||||
if(P && (P.loc == src) && istype(P, /obj/item/weapon/paper) )
|
||||
|
||||
if(!(istype(usr, /mob/living/carbon/human) || istype(usr, /mob/dead/observer) || istype(usr, /mob/living/silicon)))
|
||||
usr << browse("<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[stars(P.info)][P.stamps]</BODY></HTML>", "window=[P.name]")
|
||||
onclose(usr, "[P.name]")
|
||||
else
|
||||
usr << browse("<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[P.info][P.stamps]</BODY></HTML>", "window=[P.name]")
|
||||
onclose(usr, "[P.name]")
|
||||
P.show_content(usr)
|
||||
|
||||
else if(href_list["look"])
|
||||
var/obj/item/weapon/photo/P = locate(href_list["look"])
|
||||
|
||||
@@ -72,12 +72,7 @@
|
||||
else if(href_list["read"])
|
||||
var/obj/item/weapon/paper/P = locate(href_list["read"])
|
||||
if(P && (P.loc == src) && istype(P))
|
||||
if(!(istype(usr, /mob/living/carbon/human) || istype(usr, /mob/dead/observer) || istype(usr, /mob/living/silicon)))
|
||||
usr << browse("<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[stars(P.info)][P.stamps]</BODY></HTML>", "window=[P.name]")
|
||||
onclose(usr, "[P.name]")
|
||||
else
|
||||
usr << browse("<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[P.info][P.stamps]</BODY></HTML>", "window=[P.name]")
|
||||
onclose(usr, "[P.name]")
|
||||
P.show_content(usr)
|
||||
else if(href_list["look"])
|
||||
var/obj/item/weapon/photo/P = locate(href_list["look"])
|
||||
if(P && (P.loc == src) && istype(P))
|
||||
|
||||
@@ -59,14 +59,24 @@
|
||||
usr << "<span class='notice'>You have to go closer if you want to read it.</span>"
|
||||
return
|
||||
|
||||
/obj/item/weapon/paper/proc/show_content(var/mob/user, var/forceshow=0)
|
||||
/obj/item/weapon/paper/proc/show_content(var/mob/user, var/forceshow = 0, var/forcestars = 0, var/infolinks = 0, var/view = 1)
|
||||
set src in oview(1)
|
||||
if(!(istype(usr, /mob/living/carbon/human) || istype(usr, /mob/dead/observer) || istype(usr, /mob/living/silicon)) && !forceshow)
|
||||
usr << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[stars(info)][stamps]</BODY></HTML>", "window=[name]")
|
||||
onclose(usr, "[name]")
|
||||
if(user.client) // Send the paper images to the client
|
||||
var/datum/asset/simple/S = new/datum/asset/simple/paper()
|
||||
send_asset_list(user.client, S.assets)
|
||||
|
||||
var/data
|
||||
if((!(istype(usr, /mob/living/carbon/human) || istype(usr, /mob/dead/observer) || istype(usr, /mob/living/silicon)) && !forceshow) || forcestars)
|
||||
data = "<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[stars(info)][stamps]</BODY></HTML>"
|
||||
if(view)
|
||||
usr << browse(data, "window=[name]")
|
||||
onclose(usr, "[name]")
|
||||
else
|
||||
usr << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[info][stamps]</BODY></HTML>", "window=[name]")
|
||||
onclose(usr, "[name]")
|
||||
data = "<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[infolinks ? info_links : info][stamps]</BODY></HTML>"
|
||||
if(view)
|
||||
usr << browse(data, "window=[name]")
|
||||
onclose(usr, "[name]")
|
||||
return data
|
||||
|
||||
/obj/item/weapon/paper/verb/rename()
|
||||
set name = "Rename paper"
|
||||
@@ -101,11 +111,9 @@
|
||||
else //cyborg or AI not seeing through a camera
|
||||
dist = get_dist(src, user)
|
||||
if(dist < 2)
|
||||
usr << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[info][stamps]</BODY></HTML>", "window=[name]")
|
||||
onclose(usr, "[name]")
|
||||
show_content(user, forceshow = 1)
|
||||
else
|
||||
usr << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[stars(info)][stamps]</BODY></HTML>", "window=[name]")
|
||||
onclose(usr, "[name]")
|
||||
show_content(user, forcestars = 1)
|
||||
return
|
||||
|
||||
/obj/item/weapon/paper/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
|
||||
@@ -347,7 +355,7 @@
|
||||
info += t // Oh, he wants to edit to the end of the file, let him.
|
||||
updateinfolinks()
|
||||
|
||||
usr << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[info_links][stamps]</BODY></HTML>", "window=[name]") // Update the window
|
||||
show_content(usr, forceshow = 1, infolinks = 1)
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -414,7 +422,7 @@
|
||||
if ( istype(P, /obj/item/weapon/pen/robopen) && P:mode == 2 )
|
||||
P:RenamePaper(user,src)
|
||||
else
|
||||
user << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[info_links][stamps]</BODY></HTML>", "window=[name]")
|
||||
show_content(user, forceshow = 1, infolinks = 1)
|
||||
//openhelp(user)
|
||||
return
|
||||
|
||||
|
||||
@@ -121,10 +121,7 @@
|
||||
dat+= "<DIV STYLE='float;left; text-align:right; with:33.33333%'></DIV>"
|
||||
if(istype(src[page], /obj/item/weapon/paper))
|
||||
var/obj/item/weapon/paper/P = W
|
||||
if(!(istype(usr, /mob/living/carbon/human) || istype(usr, /mob/dead/observer) || istype(usr, /mob/living/silicon)))
|
||||
dat+= "<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[stars(P.info)][P.stamps]</BODY></HTML>"
|
||||
else
|
||||
dat+= "<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[P.info][P.stamps]</BODY></HTML>"
|
||||
dat += P.show_content(usr, view = 0)
|
||||
usr << browse(dat, "window=[name]")
|
||||
else if(istype(src[page], /obj/item/weapon/photo))
|
||||
var/obj/item/weapon/photo/P = W
|
||||
|
||||
Reference in New Issue
Block a user