adds var/client/parent to /datum/preferences

allows users to change client fps with a preference
This commit is contained in:
uraniummeltdown
2018-01-24 20:44:10 +05:00
parent bf89cffbb3
commit 5b53582f0e
5 changed files with 19 additions and 4 deletions
+1
View File
@@ -418,6 +418,7 @@
preferences_datums[ckey] = prefs
prefs.last_ip = address //these are gonna be used for banning
prefs.last_id = computer_id //these are gonna be used for banning
fps = prefs.clientfps
spawn() // Goonchat does some non-instant checks in start()
chatOutput.start()
+10 -2
View File
@@ -68,6 +68,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
#define TAB_GEAR 2
/datum/preferences
var/client/parent
//doohickeys for savefiles
// var/path
var/default_slot = 1 //Holder so it doesn't default to slot 1, rather the last one used
@@ -94,6 +95,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
var/UI_style_color = "#ffffff"
var/UI_style_alpha = 255
var/windowflashing = TRUE
var/clientfps = 0
//ghostly preferences
var/ghost_anonsay = 0
@@ -203,6 +205,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
var/gear_tab = "General"
/datum/preferences/New(client/C)
parent = C
b_type = pick(4;"O-", 36;"O+", 3;"A-", 28;"A+", 1;"B-", 20;"B+", 1;"AB-", 5;"AB+")
max_gear_slots = config.max_loadout_points
@@ -448,7 +451,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
dat += "<b>Ghost sight:</b> <a href='?_src_=prefs;preference=ghost_sight'><b>[(toggles & CHAT_GHOSTSIGHT) ? "Nearest Creatures" : "All Emotes"]</b></a><br>"
dat += "<b>Ghost radio:</b> <a href='?_src_=prefs;preference=ghost_radio'><b>[(toggles & CHAT_GHOSTRADIO) ? "Nearest Speakers" : "All Chatter"]</b></a><br>"
dat += "<b>Deadchat anonymity:</b> <a href='?_src_=prefs;preference=ghost_anonsay'><b>[ghost_anonsay ? "Anonymous" : "Not Anonymous"]</b></a><br>"
dat += "<b>FPS:</b> <a href='?_src_=prefs;preference=clientfps;task=input'>[clientfps]</a><br>"
dat += "</td><td width='300px' height='300px' valign='top'>"
dat += "<h2>Special Role Settings</h2>"
if(jobban_isbanned(user, "Syndicate"))
@@ -1887,6 +1890,12 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
if("Mechanical")
organ_data[organ] = "mechanical"
if("clientfps")
var/desiredfps = input(user, "Choose your desired fps. (0 = synced with server tick rate (currently:[world.fps]))", "Character Preference", clientfps) as null|num
if(!isnull(desiredfps))
clientfps = desiredfps
parent.fps = clientfps
/*
if("skin_style")
var/skin_style_name = input(user, "Select a new skin style") as null|anything in list("default1", "default2", "default3")
@@ -1932,7 +1941,6 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
if("hear_adminhelps")
sound ^= SOUND_ADMINHELP
if("ui")
switch(UI_style)
if("Midnight")
@@ -16,7 +16,8 @@
lastchangelog,
windowflashing,
ghost_anonsay,
exp
exp,
clientfps
FROM [format_table_name("player")]
WHERE ckey='[C.ckey]'"}
)
@@ -46,6 +47,7 @@
windowflashing = text2num(query.item[14])
ghost_anonsay = text2num(query.item[15])
exp = query.item[16]
clientfps = query.item[17]
//Sanitize
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
@@ -63,6 +65,7 @@
windowflashing = sanitize_integer(windowflashing, 0, 1, initial(windowflashing))
ghost_anonsay = sanitize_integer(ghost_anonsay, 0, 1, initial(ghost_anonsay))
exp = sanitize_text(exp, initial(exp))
clientfps = sanitize_integer(clientfps, 0, 1000, initial(clientfps))
return 1
/datum/preferences/proc/save_preferences(client/C)
@@ -89,7 +92,8 @@
show_ghostitem_attack='[show_ghostitem_attack]',
lastchangelog='[lastchangelog]',
windowflashing='[windowflashing]',
ghost_anonsay='[ghost_anonsay]'
ghost_anonsay='[ghost_anonsay]',
clientfps='[clientfps]'
WHERE ckey='[C.ckey]'"}
)