mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-25 13:07:46 +01:00
Server regions (#18867)
This commit is contained in:
@@ -417,6 +417,9 @@
|
||||
if(karmaholder)
|
||||
karmaholder.processRefunds(mob)
|
||||
|
||||
// Tell client about their connection
|
||||
to_chat(src, "<span class='notice'>You are currently connected [prefs.server_region ? "via the <b>[prefs.server_region]</b> relay" : "directly"] to Paradise.</span>")
|
||||
to_chat(src, "<span class='notice'>You can change this using the <code>Change Region</code> verb in the OOC tab, as selecting a region closer to you may reduce latency.</span>")
|
||||
|
||||
/client/proc/is_connecting_from_localhost()
|
||||
var/static/list/localhost_addresses = list("127.0.0.1", "::1")
|
||||
@@ -1196,6 +1199,36 @@
|
||||
popup.set_content(output)
|
||||
popup.open(FALSE)
|
||||
|
||||
/client/verb/change_region()
|
||||
set category = "OOC"
|
||||
set name = "Change Region"
|
||||
|
||||
if(!length(GLOB.configuration.system.region_map))
|
||||
to_chat(usr, "<span class='warning'>Error: No extra regions defined for this server</span>")
|
||||
return
|
||||
|
||||
var/list/target_regions = list("--DIRECT--")
|
||||
for(var/region in GLOB.configuration.system.region_map)
|
||||
target_regions += region
|
||||
|
||||
var/formatted_existing = (prefs.server_region ? prefs.server_region : "--DIRECT--")
|
||||
|
||||
var/choice = input(usr, "Select a region for routing optimisation.\nSelecting --DIRECT-- will bypass routing optimisations.", "Region", formatted_existing) as null|anything in target_regions
|
||||
|
||||
if(!choice || (choice == formatted_existing))
|
||||
return
|
||||
|
||||
prefs.server_region = choice
|
||||
prefs.save_preferences(src)
|
||||
|
||||
alert(usr, "Now routing you from [formatted_existing] to [choice]. You will briefly disconnect.", "ALERT", "Ok")
|
||||
|
||||
if(choice == "--DIRECT--")
|
||||
src << link("byond://[GLOB.configuration.url.server_url]")
|
||||
else
|
||||
src << link(GLOB.configuration.system.region_map[choice])
|
||||
|
||||
|
||||
#undef LIMITER_SIZE
|
||||
#undef CURRENT_SECOND
|
||||
#undef SECOND_COUNT
|
||||
|
||||
Reference in New Issue
Block a user