From 69d950e1c3048f4288529ffef073553d81bf14d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=5B=CC=B8R=CC=B5e=CC=B5d=CC=B4a=CC=B4c=CC=B6t=CC=B8e=CC=B8?= =?UTF-8?q?d=CC=B4=5D=CC=B5?= <61567407+LanceSmites328@users.noreply.github.com> Date: Fri, 1 Dec 2023 19:40:00 -0500 Subject: [PATCH] Updates Management for Abno Weights (#1677) --- code/controllers/subsystem/persistence.dm | 13 +++++++------ code/game/gamemodes/management/management.dm | 5 ++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index cf07f9a8a51e..d4da290c525a 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -180,18 +180,19 @@ SUBSYSTEM_DEF(persistence) pe_status = json_decode(json) /datum/controller/subsystem/persistence/proc/LoadAbnoPicks() + abno_rates = typecacheof(/mob/living/simple_animal/hostile/abnormality, TRUE) var/json = file2text(FILE_ABNO_PICKS) if(!json) var/json_file = file(FILE_ABNO_PICKS) if(!fexists(json_file)) - WARNING("Failed to load agent reputation. File likely corrupt.") - abno_rates = typecacheof(/mob/living/simple_animal/hostile/abnormality, TRUE) + WARNING("Failed to load Abno pick rates. File likely corrupt.") else - abno_rates = json_decode(json) - //var/list/all_abnos = subtypesof(/mob/living/simple_animal/hostile/abnormality) + var/list/pick_rates = json_decode(json) + for(var/path in pick_rates) + abno_rates[text2path(path)] = pick_rates[path] var/highest = max(abno_rates[ReturnHighestValue(abno_rates)] + 1, 2) // Ensures no 0 results for(var/i in abno_rates) - var/mob/living/simple_animal/hostile/abnormality/abno = text2path(i) + var/mob/living/simple_animal/hostile/abnormality/abno = i if(initial(abno.can_spawn)) SSabnormality_queue.possible_abnormalities[initial(abno.threat_level)] += abno var/rate = (abno_rates[i] * -1) + highest @@ -414,7 +415,7 @@ SUBSYSTEM_DEF(persistence) /datum/controller/subsystem/persistence/proc/SaveAbnoPicks() for(var/datum/abnormality/abno_ref in SSlobotomy_corp.all_abnormality_datums) - abno_rates["[abno_ref.abno_path]"] = text2num(abno_rates[abno_ref.abno_path]) + 1 + abno_rates[abno_ref.abno_path] = text2num(abno_rates[abno_ref.abno_path]) + 1 fdel(FILE_ABNO_PICKS) text2file(json_encode(abno_rates), FILE_ABNO_PICKS) diff --git a/code/game/gamemodes/management/management.dm b/code/game/gamemodes/management/management.dm index 163bcf276241..8b0699d62950 100644 --- a/code/game/gamemodes/management/management.dm +++ b/code/game/gamemodes/management/management.dm @@ -19,11 +19,14 @@ var/list/gamemode_abnos = list(ZAYIN_LEVEL = list(), TETH_LEVEL = list(), HE_LEVEL = list(), WAW_LEVEL = list(), ALEPH_LEVEL = list()) /datum/game_mode/management/post_setup() - var/list/all_abnos = subtypesof(/mob/living/simple_animal/hostile/abnormality) + var/list/all_abnos = SSpersistence.abno_rates + var/highest = max(all_abnos[ReturnHighestValue(all_abnos)] + 1, 2) // Ensures no 0 results for(var/i in all_abnos) var/mob/living/simple_animal/hostile/abnormality/abno = i if(initial(abno.can_spawn) && (initial(abno.abnormality_origin) in abno_types)) gamemode_abnos[initial(abno.threat_level)] += abno + var/rate = (all_abnos[i] * -1) + highest + gamemode_abnos[initial(abno.threat_level)][abno] = rate SSabnormality_queue.possible_abnormalities = list() SSabnormality_queue.possible_abnormalities = gamemode_abnos