mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-29 07:59:01 +01:00
Fixes Boogaloo (#1345)
Re-adds IPC APC feeding Removes more of the horror that is type paths in text strings when they don't have to be there :ree: Fix a bunch of lore blurbs SQL saving is fixededed Mark-up REGEX now requires whitespace or line ending/starts between tokens. It doesn't grab tokens surrounded by non-whitespace characters. Updated the server greeting to only updated saved hashes if a user actively clicks on a tab. C4 now forces old system for itself, due to raisins. Admin verb to toggle between global default explosion type. One round only. Requires R_DEBUG or R_SERVER, is hideable.
This commit is contained in:
@@ -136,50 +136,58 @@
|
||||
// JSlink switch.
|
||||
if (href_list["JSlink"])
|
||||
switch (href_list["JSlink"])
|
||||
// Warnings panel for each user.
|
||||
if ("warnings")
|
||||
src.warnings_check()
|
||||
|
||||
// Linking request handling.
|
||||
if ("linking")
|
||||
src.check_linking_requests()
|
||||
|
||||
// Notification dismissal from the server greeting.
|
||||
if ("dismiss")
|
||||
if (href_list["notification"])
|
||||
var/datum/client_notification/a = locate(href_list["notification"])
|
||||
if (a && isnull(a.gcDestroyed))
|
||||
a.dismiss()
|
||||
|
||||
// Forum link from various panels.
|
||||
if ("github")
|
||||
if (!config.githuburl)
|
||||
src << "<span class='danger'>Github URL not set in the config. Unable to open the site.</span>"
|
||||
else if (alert("This will open the issue tracker in your browser. Are you sure?",, "Yes", "No") == "Yes")
|
||||
src << link(config.githuburl)
|
||||
|
||||
// Forum link from various panels.
|
||||
if ("forums")
|
||||
src.forum()
|
||||
|
||||
// Wiki link from various panels.
|
||||
if ("wiki")
|
||||
src.wiki()
|
||||
|
||||
// Web interface href link from various panels.
|
||||
if ("webint")
|
||||
src.open_webint()
|
||||
|
||||
if ("logie")
|
||||
if (config.sql_stats && href_list["ie_data"])
|
||||
var/list/data = json_decode(href_list["ie_data"])
|
||||
data["_ckey"] = src.ckey
|
||||
if (data.len != 7)
|
||||
return
|
||||
|
||||
if (!establish_db_connection(dbcon))
|
||||
return
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO ss13_stats_ie (ckey, IsIE, IsEdge, EdgeHtmlVersion, TrueVersion, ActingVersion, CompatibilityMode, DateUpdated) VALUES (_ckey, _IsIE, _IsEdge, _EdgeHtmlVersion, _TrueVersion, _ActingVersion, _CompatibilityMode, NOW()) ON DUPLICATE KEY UPDATE IsIE = VALUES(IsIe), IsEdge = VALUES(IsEdge), EdgeHtmlVersion = VALUES(EdgeHtmlVersion), TrueVersion = VALUES(TrueVersion), ActingVersion = VALUES(ActingVersion), CompatibilityMode = VALUES(CompatibilityMode), DateUpdated = NOW()")
|
||||
query.Execute(data)
|
||||
|
||||
// Forward appropriate topics to the server greeting datum.
|
||||
if ("greeting")
|
||||
if (server_greeting)
|
||||
server_greeting.handle_call(href_list, src)
|
||||
|
||||
// Handle the updating of MotD and Memo tabs upon click.
|
||||
if ("updateHashes")
|
||||
var/save = 0
|
||||
if (href_list["#motd-tab"])
|
||||
src.prefs.motd_hash = href_list["#motd-tab"]
|
||||
save = 1
|
||||
if (href_list["#memo-tab"])
|
||||
src.prefs.memo_hash = href_list["#memo-tab"]
|
||||
save = 1
|
||||
|
||||
if (save)
|
||||
src.prefs.save_preferences()
|
||||
|
||||
return
|
||||
|
||||
// Antag contest shit
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// These are not flags, binary operations not intended
|
||||
#define TOPIC_NOACTION 0
|
||||
#define TOPIC_HANDLED 1
|
||||
#define TOPIC_REFRESH 2
|
||||
#define TOPIC_NOACTION 0
|
||||
#define TOPIC_HANDLED 1
|
||||
#define TOPIC_REFRESH 2
|
||||
|
||||
#define SQL_CHARACTER 1
|
||||
#define SQL_PREFERENCES 2
|
||||
// These are bitflags. Use wisely.
|
||||
#define SQL_CHARACTER 0x1
|
||||
#define SQL_PREFERENCES 0x2
|
||||
|
||||
/datum/category_group/player_setup_category/general_preferences
|
||||
name = "General"
|
||||
@@ -150,7 +151,7 @@
|
||||
else
|
||||
if (modified)
|
||||
// No save here, because this is only called from the menu and needs to save /everything/.
|
||||
handle_sql_saving(0)
|
||||
handle_sql_saving(SQL_PREFERENCES|SQL_CHARACTER)
|
||||
modified = 0
|
||||
|
||||
/datum/category_group/player_setup_category/proc/load_preferences(var/savefile/S)
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// Set this to 1 if you want to debug the SQL saves.
|
||||
// I got tired as hell from writing these debug lines and deleting them later.
|
||||
#define SQL_PREF_DEBUG 0
|
||||
|
||||
/*
|
||||
* A proc for dynamically loading a character from the database.
|
||||
* See the category items for procs on what pieces are given.
|
||||
@@ -8,7 +12,10 @@
|
||||
var/static/list/query_cache
|
||||
|
||||
// We aren't loading this category. Bye.
|
||||
if (role_type && sql_role != role_type)
|
||||
if (role_type && !(sql_role & role_type))
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER LOAD: Bad role_type, returned. Looking for: [role_type], had: [sql_role]. Conjunction: [sql_role & role_type].")
|
||||
#endif
|
||||
return
|
||||
|
||||
if (isnull(query_cache))
|
||||
@@ -72,6 +79,9 @@
|
||||
else
|
||||
query += ";"
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER LOAD: Cached query [query] with variables [json_encode(var_names)]")
|
||||
#endif
|
||||
// Save it.
|
||||
query_cache[type][query] = var_names
|
||||
|
||||
@@ -80,6 +90,11 @@
|
||||
|
||||
// Actually utilize the queries.
|
||||
var/list/arg_list = gather_load_parameters()
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER LOAD: Started loading with arguments: [json_encode(arg_list)]. Role type: [role_type]")
|
||||
#endif
|
||||
|
||||
for (var/query_text in query_cache[type])
|
||||
var/DBQuery/query = dbcon.NewQuery(query_text)
|
||||
query.Execute(arg_list, 1)
|
||||
@@ -88,6 +103,11 @@
|
||||
log_debug("SQL CHARACTER LOAD: SQL query error: [query.ErrorMsg()]")
|
||||
log_debug("SQL CHARACTER LOAD: query args: [json_encode(arg_list)]")
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
else
|
||||
log_debug("SQL CHARACTER LOAD: Successfully executed query: [query_text]")
|
||||
#endif
|
||||
|
||||
continue
|
||||
|
||||
// Each query should only return exactly 1 row.
|
||||
@@ -122,7 +142,10 @@
|
||||
var/static/list/query_cache
|
||||
|
||||
// We aren't loading this category. Bye.
|
||||
if (role_type && sql_role != role_type)
|
||||
if (role_type && !(sql_role & role_type))
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Bad role_type, returned. Looking for: [role_type], had: [sql_role]. Conjunction: [sql_role & role_type].")
|
||||
#endif
|
||||
return
|
||||
|
||||
if (isnull(query_cache))
|
||||
@@ -175,12 +198,20 @@
|
||||
// Remove any potentially damaging commas from the end.
|
||||
query = replacetext(query, ",", "", length(query) - 1)
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Cached query [query].")
|
||||
#endif
|
||||
|
||||
// Save it.
|
||||
query_cache[type] += query
|
||||
|
||||
// Actually utilize the queries.
|
||||
var/list/arg_list = gather_save_parameters()
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Started saving with arguments: [json_encode(arg_list)]. Role type: [role_type]")
|
||||
#endif
|
||||
|
||||
// Typecast the collection so we can access its preferences var.
|
||||
var/datum/category_collection/player_setup_collection/cc = collection
|
||||
for (var/query_text in query_cache[type])
|
||||
@@ -194,7 +225,12 @@
|
||||
|
||||
continue
|
||||
|
||||
if (role_type == SQL_CHARACTER && !cc.preferences.current_character)
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
else
|
||||
log_debug("SQL CHARACTER SAVE: Successfully executed query: [query_text]")
|
||||
#endif
|
||||
|
||||
if ((role_type & SQL_CHARACTER) && !cc.preferences.current_character)
|
||||
// No current character, means we're doing insert queries.
|
||||
// Quickly nab the new ID and substitute it within the args.
|
||||
query = dbcon.NewQuery("SELECT LAST_INSERT_ID() AS new_id")
|
||||
@@ -204,6 +240,11 @@
|
||||
arg_list[":id"] = text2num(query.item[1])
|
||||
arg_list[":char_id"] = text2num(query.item[1])
|
||||
cc.preferences.current_character = text2num(query.item[1])
|
||||
|
||||
#ifdef SQL_PREF_DEBUG
|
||||
log_debug("SQL CHARACTER SAVE: Successfully set character ID to [cc.preferences.current_character]")
|
||||
#endif
|
||||
|
||||
else
|
||||
error("SQL CHARACTER SAVE: New ID was not recovered.")
|
||||
log_debug("SQL CHARACTER SAVE: New ID was not recovered.")
|
||||
@@ -217,3 +258,5 @@
|
||||
arg_list |= PI.gather_save_parameters()
|
||||
|
||||
return arg_list
|
||||
|
||||
#undef SQL_PREF_DEBUG
|
||||
|
||||
Reference in New Issue
Block a user