Various Minor Fixes/Backend-Changes (#17419)

* Removes the dynamic maps system

* Adds some basic doc strings to the gear tweaks / Fix startup lag

* Adds the pull request labeler to (partially) replace the bot

* Changelog

* Fix spelling mistake

* Fix compile error
Add javascript and sounds to labeler

* Log Query during SQL Errors

* Use log_sql for sql connection errors

* Fix extra space in dbcore

* Fix mapping label names

---------

Co-authored-by: Werner <Arrow768@users.noreply.github.com>
This commit is contained in:
Werner
2023-09-24 11:15:34 +02:00
committed by GitHub
parent ef11eeec8a
commit 97bae226e0
9 changed files with 136 additions and 74 deletions

View File

@@ -16,7 +16,6 @@
current_map.finalize_load()
log_subsystem_mapfinalization("Finalized map in [(world.time - time)/10] seconds.")
select_ruin()
load_space_ruin()
if(config.dungeon_chance > 0)
@@ -45,71 +44,6 @@
sortTim(all_areas, GLOBAL_PROC_REF(cmp_name_asc))
/datum/controller/subsystem/finalize/proc/select_ruin()
//Get all the folders in dynamic maps and check if they contain a config.json
var/map_directory = "dynamic_maps/"
var/list/mission_list = list()
var/list/weighted_mission_list = list()
var/list/subfolders = get_subfolders(map_directory)
//Build the list of available missions
for(var/folder in subfolders)
var/list/mission_config = null
var/datum/away_mission/am = null
if(!fexists("[folder]config.json"))
log_subsystem_mapfinalization("Found no cofiguration file in [folder] - Skipping")
continue
try
mission_config = json_decode(file2text("[folder]config.json"))
catch(var/exception/ed)
log_config("SSMapfinalization: Invalid config.json in [folder]: [ed]")
log_subsystem_mapfinalization("Invalid config.json in [folder]: [ed]")
continue
try
am = new(mission_config, folder)
catch(var/exception/ec)
log_subsystem_mapfinalization_error("Error while creating away mission datum: [ec]")
continue
if(length(am.valid_sectors))
if(!(SSatlas.current_sector.name in am.valid_sectors))
log_subsystem_mapfinalization_error("[SSatlas.current_sector.name] is not a valid map for [am.name]")
continue
if(!am.validate_maps(folder))
continue
mission_list[am.name] = am
if(am.autoselect)
weighted_mission_list[am.name] = am.weight
else
log_subsystem_mapfinalization("[am.name] has a disabled autoselect")
if(!length(mission_list))
log_subsystem_mapfinalization("Found no valid ruins for the current map.")
return
log_subsystem_mapfinalization("Loaded ruin config.")
//Check if we have a enforced mission we should try to load.
if(SSpersist_config.forced_awaymission)
if(SSpersist_config.forced_awaymission in mission_list)
selected_mission = mission_list[SSpersist_config.forced_awaymission]
log_subsystem_mapfinalization("Selected enforced away mission.")
admin_notice(SPAN_DANGER("Selected enforced away mission."), R_DEBUG)
return
else
log_subsystem_mapfinalization("Failed to selected enforced away mission. Fallback to weighted selection.")
admin_notice(SPAN_DANGER("Failed to selected enforced away mission. Fallback to weighted selection."), R_DEBUG)
var/mission_name = pickweight(weighted_mission_list)
selected_mission = mission_list[mission_name]
admin_notice(SPAN_DANGER("Selected away mission."), R_DEBUG)
return
/datum/controller/subsystem/finalize/proc/load_space_ruin()
maploader = new

View File

@@ -103,7 +103,7 @@ You are expected to do your own escaping of the data, and expected to provide yo
The duplicate_key arg can be true to automatically generate this part of the query
or set to a string that is appended to the end of the query
Ignore_errors instructes mysql to continue inserting rows if some of them have errors.
the erroneous row(s) aren't inserted and there isn't really any way to know why or why errored
the erroneous row(s) aren't inserted and there isn't really any way to know why or why errored
Delayed insert mode was removed in mysql 7 and only works with MyISAM type tables,
It was included because it is still supported in mariadb.
It does not work with duplicate_key and the mysql server ignores it in those cases
@@ -194,6 +194,7 @@ Delayed insert mode was removed in mysql 7 and only works with MyISAM type table
var/error = ErrorMsg()
if (error)
log_sql("SQL Error: '[error]'")
log_sql(" - during query: [sql_query]")
// This is hacky and should probably be changed
if (error == "MySQL server has gone away")
log_game("MySQL connection drop detected, attempting to reconnect.")

View File

@@ -1,18 +1,40 @@
/**
* Displays information about the currently active tweak.
* For example: a color tweak might show the user the currently selected color
*/
/datum/gear_tweak/proc/get_contents(var/metadata)
return
/**
* Queries the user for additional information about the tweak.
* For example: A color tweak might display a color selection menu to the user
*/
/datum/gear_tweak/proc/get_metadata(var/user, var/metadata, var/title, var/gear_path)
return
/**
* Returns a sensible default value for the tweak that is used when the tweak is newly applied.
* For example: A alpha tweak might return 255
*/
/datum/gear_tweak/proc/get_default()
return
/**
* Returns a random (valid) value for the tweak.
* For example: A alpha tweak might return something between 0 and 255
*/
/datum/gear_tweak/proc/get_random()
return get_default()
/datum/gear_tweak/proc/tweak_gear_data(var/metadata, var/datum/gear_data)
/**
* Tweaks the gear data (parameter) based on the metadata (parameter)
*/
/datum/gear_tweak/proc/tweak_gear_data(var/metadata, var/datum/gear_data/gear_data)
return
/**
* Applies the tweak to the item
*/
/datum/gear_tweak/proc/tweak_item(var/obj/item/I, var/metadata, var/mob/living/carbon/human/H)
return
@@ -272,8 +294,9 @@ var/datum/gear_tweak/custom_desc/gear_tweak_free_desc = new()
return sanitize(input(user, "Choose the item's description. Leave it blank to use the default description.", "Item Description", metadata) as message|null, extra = 0)
/datum/gear_tweak/custom_desc/tweak_item(var/obj/item/I, var/metadata, var/mob/living/carbon/human/H)
if (!metadata && ("stored_name" in I.vars))
I.vars["stored_name"] = H.real_name
if (!metadata && istype(I, /obj/item/clothing/accessory/badge))
var/obj/item/clothing/accessory/badge/B = I
B.stored_name = H.real_name
return I.desc += "\nThe name [H.real_name] is written on it."
if (!metadata)
return I.desc

View File

@@ -440,12 +440,12 @@ var/list/world_api_rate_limit = list()
return FALSE
if (!con)
log_world("ERROR: No DBConnection object passed to establish_db_connection() proc.")
log_sql("ERROR: No DBConnection object passed to establish_db_connection() proc.")
return FALSE
if (con.failed_connections > FAILED_DB_CONNECTION_CUTOFF)
if(world.timeofday < con.last_fail + 100) // 10 seconds
log_world("ERROR: DB connection cutoff exceeded for a database object in establish_db_connection().")
log_sql("ERROR: DB connection cutoff exceeded for a database object in establish_db_connection().")
return FALSE
con.failed_connections = 0