Files
Tsar-Salat bb357ce892 Fix tattoo persistence version (#95839)
## About The Pull Request

Hi, strange thing with tattoos.


https://github.com/tgstation/tgstation/blob/55366497a3f156f5553a6446edf4c0b0cbba6716/code/controllers/subsystem/persistence/tattoos.dm#L25-L42

The tattoo persistence version seems to be setting based on engravings'
persistence version, ``ENGRAVING_PERSISTENCE_VERSION``

Yet, in ``load_prisoner_tattoos()``, the conditional checks the value of
TATTOO_PERSISTENCE_VERSION

https://github.com/tgstation/tgstation/blob/55366497a3f156f5553a6446edf4c0b0cbba6716/code/controllers/subsystem/persistence/tattoos.dm#L10-L11

This PR just replaces the engraving version being set with the tattoo
version being set.
## Why It's Good For The Game

This seems rather blatantly incorrect. 
The TATTOO_PERSISTENCE_VERSION has no setter for its value other than
when defined.

Realistically? This does nothing. They are both 0 lol.
2026-04-23 08:58:49 +12:00

56 lines
1.7 KiB
Plaintext

///Loads all tattoos, and select a few based on the amount of prisoner spawn positions.
/datum/controller/subsystem/persistence/proc/load_prisoner_tattoos()
var/json_file = file(PRISONER_TATTOO_SAVE_FILE)
if(!fexists(json_file))
return
var/list/json = json_decode(file2text(json_file))
if(!json)
return
if(json["version"] < TATTOO_PERSISTENCE_VERSION)
update_prisoner_tattoos(json)
var/datum/job/prisoner_datum = SSjob.name_occupations[JOB_PRISONER]
if(!prisoner_datum)
return
var/iterations_allowed = prisoner_datum.spawn_positions
var/list/entries = json["entries"]
if(entries.len)
for(var/index in 1 to iterations_allowed)
prison_tattoos_to_use += list(entries[rand(1, entries.len)])
log_world("Loaded [prison_tattoos_to_use.len] prison tattoos")
///Saves all tattoos, so they can appear on prisoners in future rounds
/datum/controller/subsystem/persistence/proc/save_prisoner_tattoos()
var/json_file = file(PRISONER_TATTOO_SAVE_FILE)
var/list/saved_data = list()
var/list/entries = list()
if(fexists(json_file))
var/list/old_json = json_decode(file2text(json_file))
if(old_json)
entries += old_json["entries"] //Save the old if its there
entries += prison_tattoos_to_save
saved_data["version"] = TATTOO_PERSISTENCE_VERSION
saved_data["entries"] = entries
fdel(json_file)
WRITE_FILE(json_file, json_encode(saved_data))
///This proc can update entries if the format has changed at some point.
/datum/controller/subsystem/persistence/proc/update_prisoner_tattoos(json)
for(var/tattoo_entry in json["entries"])
continue //no versioning yet
//Save it to the file
var/json_file = file(PRISONER_TATTOO_SAVE_FILE)
fdel(json_file)
WRITE_FILE(json_file, json_encode(json))
return json