Files
Arrow768 03f313a19d Moves various things to the new DBCore (#21544)
```
- server: "Changed the synthsprites to use the new DBCore"
- server: "Changed the MalfAI to use the new DBCore"
- server: "Changed the Alien Whitelists to use the new DBCore"
- server: "Changed the Requests Console to use the new DBCore"
- server: "Changed the Contracts Uplink to use the new DBCore"
- server: "Changed the Admin Ranks to use the new DBCore"
- server: "Changed the Job Bans to use the new DBCore"
- server: "Changed the Tickets to use the new DBCore"
- server: "Changed the Create Command Report to use the new DBCore"
- server: "Changed the WebInterface interconnect to use the new DBCore"
- server: "Changed the CCIA Recorder to use the new DBCore"
- server: "Changed the IPCTags to use the new DBCore"
- server: "Changed the Main Menu Poll-Check to use the new DBCore"
- server: "Changed the Client-Procs to use the new DBCore"
```

---------

Co-authored-by: Werner <Arrow768@users.noreply.github.com>
2026-04-13 22:45:29 +02:00

75 lines
2.4 KiB
Plaintext

/*
Just some quick documentation about how this works
Synthckey is the players ckey which is represented under the synths name in the json, this is required to have
synthicon is just the sprites name in the dmi
aichassisicon is the ai chassis icon sprite name
aiholoicon is the ai hologram icon sprite name
paiicon is the pai icon sprite name
*/
/datum/custom_synth
var/synthname = ""
var/synthckey = ""
var/synthicon = "robot"
var/aichassisicon = ""
var/aiholoicon = ""
var/paiicon = ""
/proc/loadsynths_from_json()
var/list/customsynthsprites = list()
if(!(rustg_file_exists("config/customsynths.json") == "true"))
log_config("The file config/customsynths.json was not found, custom synth config will not be loaded.")
return
try
customsynthsprites = json_decode(file2text("config/customsynths.json"))
catch(var/exception/ej)
LOG_DEBUG("Error: Warning: Could not load custom synth config, as customsynths.json is missing - [ej]")
return
robot_custom_icons = list()
customsynthsprites = customsynthsprites["synths"]
for (var/synthsprite in customsynthsprites)
var/datum/custom_synth/synth = new()
synth.synthname = synthsprite
synth.synthckey = customsynthsprites[synthsprite]["ckey"]
synth.synthicon = customsynthsprites[synthsprite]["synthicon"]
synth.aichassisicon = customsynthsprites[synthsprite]["aichassisicon"]
synth.aiholoicon = customsynthsprites[synthsprite]["aiholoicon"]
synth.paiicon = customsynthsprites[synthsprite]["paiicon"]
robot_custom_icons[synthsprite] = synth
/proc/loadsynths_from_sql()
if(!GLOB.config.sql_enabled)
LOG_DEBUG("Synthsprites: SQL Disabled - Falling back to JSON")
loadsynths_from_json()
return
if(!SSdbcore.Connect())
LOG_DEBUG("Synthsprites: SQL ERROR - Failed to connect. - Falling back to JSON")
loadsynths_from_json()
return
var/datum/db_query/customsynthsprites = SSdbcore.NewQuery("SELECT synthname, synthckey, synthicon, aichassisicon, aiholoicon, paiicon FROM ss13_customsynths ORDER BY synthckey ASC")
customsynthsprites.Execute()
while(customsynthsprites.NextRow())
CHECK_TICK
var/datum/custom_synth/synth = new()
synth.synthname = customsynthsprites.item[1]
synth.synthckey = customsynthsprites.item[2]
synth.synthicon = customsynthsprites.item[3]
synth.aichassisicon = customsynthsprites.item[4]
synth.aiholoicon = customsynthsprites.item[5]
synth.paiicon = customsynthsprites.item[6]
robot_custom_icons[synth.synthname] = synth
qdel(customsynthsprites)