mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 11:34:19 +01:00
Allows clients to reload their UI assets
This commit is contained in:
@@ -92,3 +92,6 @@
|
||||
var/next_keysend_reset = 0
|
||||
var/next_keysend_trip_reset = 0
|
||||
var/keysend_tripped = FALSE
|
||||
|
||||
// Last world.time that the player tried to request their resources.
|
||||
var/last_ui_resource_send = 0
|
||||
|
||||
@@ -906,3 +906,33 @@
|
||||
return TRUE
|
||||
|
||||
#undef SSD_WARNING_TIMER
|
||||
|
||||
/client/verb/resend_ui_resources()
|
||||
set name = "Reload UI Resources"
|
||||
set desc = "Reload your UI assets if they are not working"
|
||||
set category = "Special Verbs"
|
||||
|
||||
var/choice = alert(usr, "This will reload your NanoUI and TGUI resources. If you have any open UIs this may break them. Are you sure?", "Resource Reloading", "Yes", "No")
|
||||
if(choice == "Yes")
|
||||
// 600 deciseconds = 1 minute
|
||||
if((last_ui_resource_send) < world.time)
|
||||
last_ui_resource_send = world.time + 600
|
||||
|
||||
// Close their open UIs
|
||||
SSnanoui.close_user_uis(usr)
|
||||
SStgui.close_user_uis(usr)
|
||||
|
||||
// Resend the resources
|
||||
var/datum/asset/nano_assets = get_asset_datum(/datum/asset/nanoui)
|
||||
nano_assets.register()
|
||||
|
||||
var/datum/asset/tgui_assets = get_asset_datum(/datum/asset/simple/tgui)
|
||||
tgui_assets.register()
|
||||
|
||||
// Clear the user's cache so they get resent.
|
||||
// This is not fully clearing their BYOND cache, just their assets sent from the server this round
|
||||
cache = list()
|
||||
|
||||
to_chat(usr, "<span class='notice'>UI resource files resent successfully</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You requested your UI resource files too quickly. Please try again in [(last_ui_resource_send - world.time)/10] seconds.</span>")
|
||||
|
||||
Reference in New Issue
Block a user