From 19c436e99403a9f8690b3da4a1166b25318b7927 Mon Sep 17 00:00:00 2001 From: SandPoot Date: Tue, 17 Sep 2024 16:52:54 -0300 Subject: [PATCH 1/3] push --- code/modules/client/preferences.dm | 17 +++++++++++++++-- code/modules/client/preferences_savefile.dm | 15 +++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index f2a9c131cc..4a8460635c 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -229,7 +229,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) ///loadout stuff var/gear_points = 10 var/list/gear_categories - var/list/loadout_data = list() + var/list/loadout_data[MAXIMUM_LOADOUT_SAVES] var/list/unlockable_loadout_data = list() var/loadout_slot = 1 //goes from 1 to MAXIMUM_LOADOUT_SAVES var/gear_category @@ -367,7 +367,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) //calculate your gear points from the chosen item gear_points = CONFIG_GET(number/initial_gear_points) var/list/chosen_gear = loadout_data["SAVE_[loadout_slot]"] - if(chosen_gear) + if(islist(chosen_gear)) loadout_errors = 0 for(var/loadout_item in chosen_gear) var/loadout_item_path = loadout_item[LOADOUT_ITEM] @@ -910,6 +910,11 @@ GLOBAL_LIST_EMPTY(preferences_datums) dat += "" if(LOADOUT_CHAR_TAB) dat += "" + dat += "" + dat += "" dat += "" dat += "
Loadout slot
" + for(var/iteration in 1 to MAXIMUM_LOADOUT_SAVES) + dat += "[iteration]" + dat += "
You can only choose one item per category, unless it's an item that spawns in your backpack or hands.
" @@ -3240,6 +3245,14 @@ GLOBAL_LIST_EMPTY(preferences_datums) preferences_tab = text2num(href_list["tab"]) if(href_list["preference"] == "gear") + if(href_list["select_slot"]) + var/chosen = text2num(href_list["select_slot"]) + if(!chosen) + return + chosen = floor(chosen) + if(chosen > MAXIMUM_LOADOUT_SAVES || chosen < 1) + return + loadout_slot = chosen if(href_list["clear_loadout"]) loadout_data["SAVE_[loadout_slot]"] = list() save_preferences() diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 6c65cc0720..d457f85e07 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -911,10 +911,13 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car belly_prefs = json_from_file["belly_prefs"] //gear loadout - if(S["loadout"]) + if(istext(S["loadout"])) loadout_data = safe_json_decode(S["loadout"]) else - loadout_data = list() + var/list/make_new[MAXIMUM_LOADOUT_SAVES] + loadout_data = make_new + //let's remember their last used slot, i'm sure "oops i brought the wrong stuff" will be an issue now + S["loadout_slot"] >> loadout_slot //try to fix any outdated data if necessary //preference updating will handle saving the updated data for us. @@ -1094,6 +1097,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car vore_smell = copytext(vore_smell, 1, MAX_TASTE_LEN) belly_prefs = SANITIZE_LIST(belly_prefs) + loadout_slot = sanitize_num_clamp(loadout_slot, 1, MAXIMUM_LOADOUT_SAVES, 1, TRUE) + cit_character_pref_load(S) return TRUE @@ -1278,10 +1283,12 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car //gear loadout - if(length(loadout_data)) + if(islist(loadout_data)) S["loadout"] << safe_json_encode(loadout_data) else - S["loadout"] << safe_json_encode(list()) + var/list/make_new[MAXIMUM_LOADOUT_SAVES] + S["loadout"] << safe_json_encode(make_new) + WRITE_FILE(S["loadout_slot"], loadout_slot) if(length(tcg_cards)) S["tcg_cards"] << safe_json_encode(tcg_cards) From b0dd5b48ed340b271fa3f1087996360aa81475ab Mon Sep 17 00:00:00 2001 From: SandPoot Date: Wed, 25 Sep 2024 03:42:51 -0300 Subject: [PATCH 2/3] uh oh --- .github/workflows/ci_suite.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_suite.yml b/.github/workflows/ci_suite.yml index 46871b3852..7e9650f98e 100644 --- a/.github/workflows/ci_suite.yml +++ b/.github/workflows/ci_suite.yml @@ -8,7 +8,7 @@ on: - master jobs: run_linters: - if: !contains(github.event.head_commit.message, '[ci skip]') + if: "!contains(github.event.head_commit.message, '[ci skip]')" name: Run Linters runs-on: ubuntu-22.04 steps: @@ -51,7 +51,7 @@ jobs: outputFile: output-annotations.txt compile_all_maps: - if: !contains(github.event.head_commit.message, '[ci skip]') + if: "!contains(github.event.head_commit.message, '[ci skip]')" name: Compile Maps runs-on: ubuntu-22.04 steps: @@ -67,7 +67,7 @@ jobs: source $HOME/BYOND/byond/bin/byondsetup tools/build/build --ci dm -DCIBUILDING -DCITESTING -DALL_MAPS run_all_tests: - if: !contains(github.event.head_commit.message, '[ci skip]') + if: "!contains(github.event.head_commit.message, '[ci skip]')" name: Integration Tests runs-on: ubuntu-22.04 services: @@ -118,7 +118,7 @@ jobs: tools/build/build --ci -DCIBUILDING bash tools/ci/run_server.sh test_windows: - if: !contains(github.event.head_commit.message, '[ci skip]') + if: "!contains(github.event.head_commit.message, '[ci skip]')" name: Windows Build runs-on: windows-latest steps: From b65df409d748879514f58888a2062a79647eab09 Mon Sep 17 00:00:00 2001 From: SandPoot Date: Sun, 29 Sep 2024 17:11:32 -0300 Subject: [PATCH 3/3] that was weird --- code/modules/client/preferences.dm | 2 +- code/modules/client/preferences_savefile.dm | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 4a8460635c..ddf2d71cec 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -229,7 +229,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) ///loadout stuff var/gear_points = 10 var/list/gear_categories - var/list/loadout_data[MAXIMUM_LOADOUT_SAVES] + var/list/loadout_data var/list/unlockable_loadout_data = list() var/loadout_slot = 1 //goes from 1 to MAXIMUM_LOADOUT_SAVES var/gear_category diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index d457f85e07..1f74ca9031 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -914,8 +914,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car if(istext(S["loadout"])) loadout_data = safe_json_decode(S["loadout"]) else - var/list/make_new[MAXIMUM_LOADOUT_SAVES] - loadout_data = make_new + loadout_data = list() //let's remember their last used slot, i'm sure "oops i brought the wrong stuff" will be an issue now S["loadout_slot"] >> loadout_slot @@ -1286,8 +1285,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car if(islist(loadout_data)) S["loadout"] << safe_json_encode(loadout_data) else - var/list/make_new[MAXIMUM_LOADOUT_SAVES] - S["loadout"] << safe_json_encode(make_new) + S["loadout"] << safe_json_encode(list()) WRITE_FILE(S["loadout_slot"], loadout_slot) if(length(tcg_cards))