Merge remote-tracking branch 'origin/master' into rustsql

This commit is contained in:
Letter N
2021-01-20 15:40:41 +08:00
606 changed files with 9932 additions and 4818 deletions
+1
View File
@@ -31,6 +31,7 @@
var/datum/preferences/prefs = null
var/last_turn = 0
var/move_delay = 0
var/last_move = 0
var/area = null
/// Last time we Click()ed. No clicking twice in one tick!
+26 -2
View File
@@ -147,6 +147,8 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
/client/proc/handle_statpanel_click(list/href_list)
var/atom/target = locate(href_list["statpanel_item_target"])
if(!target)
return
Click(target, target.loc, null, "[href_list["statpanel_item_shiftclick"]?"shift=1;":null][href_list["statpanel_item_ctrlclick"]?"ctrl=1;":null]&alt=[href_list["statpanel_item_altclick"]?"alt=1;":null]", FALSE, "statpanel")
/client/proc/is_content_unlocked()
@@ -496,7 +498,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
GLOB.directory -= ckey
log_access("Logout: [key_name(src)]")
GLOB.ahelp_tickets.ClientLogout(src)
// SSserver_maint.UpdateHubStatus()
SSserver_maint.UpdateHubStatus()
if(credits)
QDEL_LIST(credits)
if(holder)
@@ -668,7 +670,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
query_log_connection.Execute()
qdel(query_log_connection)
// SSserver_maint.UpdateHubStatus()
SSserver_maint.UpdateHubStatus()
if(new_player)
player_age = -1
@@ -1061,3 +1063,25 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
verb_tabs |= verb_to_init.category
verblist[++verblist.len] = list(verb_to_init.category, verb_to_init.name)
src << output("[url_encode(json_encode(verb_tabs))];[url_encode(json_encode(verblist))]", "statbrowser:init_verbs")
//increment progress for an unlockable loadout item
/client/proc/increment_progress(key, amount)
if(prefs)
var/savefile/S = new /savefile(prefs.path)
var/list/unlockable_loadout_data = prefs.unlockable_loadout_data
if(!length(unlockable_loadout_data))
unlockable_loadout_data = list()
unlockable_loadout_data[key] = amount
WRITE_FILE(S["unlockable_loadout"], safe_json_encode(unlockable_loadout_data))
prefs.unlockable_loadout_data = unlockable_loadout_data
return TRUE
else
if(unlockable_loadout_data[key])
unlockable_loadout_data[key] += amount
else
unlockable_loadout_data[key] = amount
WRITE_FILE(S["unlockable_loadout"], safe_json_encode(unlockable_loadout_data))
prefs.unlockable_loadout_data = unlockable_loadout_data
return TRUE
return FALSE
+23 -3
View File
@@ -198,6 +198,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/gear_points = 10
var/list/gear_categories
var/list/loadout_data = list()
var/list/unlockable_loadout_data = list()
var/loadout_slot = 1 //goes from 1 to MAXIMUM_LOADOUT_SAVES
var/gear_category
var/gear_subcategory
@@ -907,12 +908,14 @@ GLOBAL_LIST_EMPTY(preferences_datums)
loadout_color_non_poly = loadout_item[LOADOUT_COLOR][1]
extra_color_data += "<BR><a href='?_src_=prefs;preference=gear;loadout_color=1;loadout_gear_name=[html_encode(gear.name)];'>Color</a>"
extra_color_data += "<span style='border: 1px solid #161616; background-color: [loadout_color_non_poly];'>&nbsp;&nbsp;&nbsp;</span>"
else if(gear_points <= 0)
else if((gear_points - gear.cost) < 0)
class_link = "style='white-space:normal;' class='linkOff'"
else if(donoritem)
class_link = "style='white-space:normal;background:#ebc42e;' href='?_src_=prefs;preference=gear;toggle_gear_path=[html_encode(name)];toggle_gear=1'"
else
else if(!istype(gear, /datum/gear/unlockable) || can_use_unlockable(gear))
class_link = "style='white-space:normal;' href='?_src_=prefs;preference=gear;toggle_gear_path=[html_encode(name)];toggle_gear=1'"
else
class_link = "style='white-space:normal;background:#eb2e2e;' class='linkOff'"
dat += "<tr style='vertical-align:top;'><td width=15%><a [class_link]>[name]</a>[extra_color_data]</td>"
dat += "<td width = 5% style='vertical-align:top'>[gear.cost]</td><td>"
if(islist(gear.restricted_roles))
@@ -925,7 +928,16 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<font size=2>"
dat += gear.restricted_roles.Join(";")
dat += "</font>"
dat += "</td><td><font size=2><i>[gear.description]</i></font></td></tr>"
if(!istype(gear, /datum/gear/unlockable))
dat += "</td><td><font size=2><i>[gear.description]</i></font></td></tr>"
else
//we add the user's progress to the description assuming they have progress
var/datum/gear/unlockable/unlockable = gear
var/progress_made = unlockable_loadout_data[unlockable.progress_key]
if(!progress_made)
progress_made = 0
dat += "</td><td><font size=2><i>[gear.description] Progress: [min(progress_made, unlockable.progress_required)]/[unlockable.progress_required]</i></font></td></tr>"
dat += "</table>"
if(4) // Content preferences
dat += "<table><tr><td width='340px' height='300px' valign='top'>"
@@ -2677,6 +2689,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(G.donoritem && !G.donator_ckey_check(user.ckey))
to_chat(user, "<span class='danger'>This is an item intended for donator use only. You are not authorized to use this item.</span>")
return
if(istype(G, /datum/gear/unlockable) && !can_use_unlockable(G))
to_chat(user, "<span class='danger'>To use this item, you need to meet the defined requirements!</span>")
return
if(gear_points >= initial(G.cost))
var/list/new_loadout_data = list(LOADOUT_ITEM = "[G.type]")
if(length(G.loadout_initial_colors))
@@ -2962,6 +2977,11 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(find_gear)
loadout_data["SAVE_[save_slot]"] -= list(find_gear)
/datum/preferences/proc/can_use_unlockable(datum/gear/unlockable/unlockable_gear)
if(unlockable_loadout_data[unlockable_gear.progress_key] >= unlockable_gear.progress_required)
return TRUE
return FALSE
#undef DEFAULT_SLOT_AMT
#undef HANDS_SLOT_AMT
#undef BACKPACK_SLOT_AMT
+18 -2
View File
@@ -5,7 +5,7 @@
// You do not need to raise this if you are adding new values that have sane defaults.
// Only raise this value when changing the meaning/format/name/layout of an existing value
// where you would want the updater procs below to run
#define SAVEFILE_VERSION_MAX 47
#define SAVEFILE_VERSION_MAX 48
/*
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
@@ -285,6 +285,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["loadout"] = safe_json_encode(loadout_data)
if(current_version < 48) //unlockable loadout items but we need to clear bad data from a mistake
S["unlockable_loadout"] = list()
/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
if(!ckey)
return
@@ -427,6 +430,11 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
verify_keybindings_valid() // one of these days this will runtime and you'll be glad that i put it in a different proc so no one gets their saves wiped
if(S["unlockable_loadout"])
unlockable_loadout_data = safe_json_decode(S["unlockable_loadout"])
else
unlockable_loadout_data = list()
if(needs_update >= 0) //save the updated version
var/old_default_slot = default_slot
var/old_max_save_slots = max_save_slots
@@ -532,6 +540,11 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["auto_ooc"], auto_ooc)
WRITE_FILE(S["no_tetris_storage"], no_tetris_storage)
if(length(unlockable_loadout_data))
WRITE_FILE(S["unlockable_loadout"], safe_json_encode(unlockable_loadout_data))
else
WRITE_FILE(S["unlockable_loadout"], safe_json_encode(list()))
return 1
/datum/preferences/proc/load_character(slot, bypass_cooldown = FALSE)
@@ -736,7 +749,10 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
belly_prefs = json_from_file["belly_prefs"]
//gear loadout
loadout_data = safe_json_decode(S["loadout"])
if(S["loadout"])
loadout_data = safe_json_decode(S["loadout"])
else
loadout_data = list()
//try to fix any outdated data if necessary
//preference updating will handle saving the updated data for us.
+3 -3
View File
@@ -17,7 +17,7 @@ GLOBAL_VAR_INIT(normal_looc_colour, "#6699CC")
if(!msg)
return
if(!(prefs.toggles & CHAT_OOC))
if(!(prefs.chat_toggles & CHAT_OOC))
to_chat(src, "<span class='danger'> You have OOC muted.</span>")
return
if(jobban_isbanned(mob, "OOC"))
@@ -63,14 +63,14 @@ GLOBAL_VAR_INIT(normal_looc_colour, "#6699CC")
if (isobserver(M))
continue //Also handled later.
if(C.prefs.toggles & CHAT_OOC)
if(C.prefs.chat_toggles & CHAT_OOC)
if(GLOB.LOOC_COLOR)
to_chat(C, "<font color='[GLOB.LOOC_COLOR]'><b><span class='prefix'>LOOC:</span> <EM>[src.mob.name]:</EM> <span class='message'>[msg]</span></b></font>")
else
to_chat(C, "<span class='looc'><span class='prefix'>LOOC:</span> <EM>[src.mob.name]:</EM> <span class='message'>[msg]</span></span>")
for(var/client/C in GLOB.admins)
if(C.prefs.toggles & CHAT_OOC)
if(C.prefs.chat_toggles & CHAT_OOC)
var/prefix = "(R)LOOC"
if (C.mob in heard)
prefix = "LOOC"