From b210bee3c3bf75e500ae29d798b8031674c32cc0 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" Date: Tue, 22 Sep 2026 23:27:31 +0000 Subject: [PATCH] fix: reset chapter traits on select Co-authored-by: EttyKitty --- scripts/scr_ChapterTraits/scr_ChapterTraits.gml | 11 +++++++++++ scripts/scr_chapter_new/scr_chapter_new.gml | 1 + scripts/scr_chapter_random/scr_chapter_random.gml | 1 + 3 files changed, 13 insertions(+) diff --git a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml index 48e04e0fae..964b6d4028 100644 --- a/scripts/scr_ChapterTraits/scr_ChapterTraits.gml +++ b/scripts/scr_ChapterTraits/scr_ChapterTraits.gml @@ -348,6 +348,17 @@ function generate_advantages() { return json_to_gamemaker(working_directory + $"main/chapter_advantages.json", json_parse); } +/// @desc Clears activated traits and shared meta so each chapter pick starts clean. +function reset_chapter_traits() { + obj_creation.chapter_trait_meta = []; + for (var i = 0; i < array_length(obj_creation.all_advantages); i++) { + obj_creation.all_advantages[i].activated = false; + } + for (var i = 0; i < array_length(obj_creation.all_disadvantages); i++) { + obj_creation.all_disadvantages[i].activated = false; + } +} + function setup_chapter_traits() { Advantage.id_start = 1; Disadvantage.id_start = 1; diff --git a/scripts/scr_chapter_new/scr_chapter_new.gml b/scripts/scr_chapter_new/scr_chapter_new.gml index 606154be08..fc772b4573 100644 --- a/scripts/scr_chapter_new/scr_chapter_new.gml +++ b/scripts/scr_chapter_new/scr_chapter_new.gml @@ -189,6 +189,7 @@ function ChapterData() constructor { /// @description called when a chapter's icon is clicked on the first page after the main menu. /// used to set up initialise the data that is later fed into `scr_initialize_custom` when the game starts function scr_chapter_new(chapter_identifier) { + reset_chapter_traits(); full_liveries = ""; // until chapter objects are in full use kicks off livery propogation company_liveries = ""; diff --git a/scripts/scr_chapter_random/scr_chapter_random.gml b/scripts/scr_chapter_random/scr_chapter_random.gml index 898246977e..5f1366e24b 100644 --- a/scripts/scr_chapter_random/scr_chapter_random.gml +++ b/scripts/scr_chapter_random/scr_chapter_random.gml @@ -23,6 +23,7 @@ function scr_chapter_random(custom_or_random) { found_secret = 0; points = 0; maxpoints = 100; + reset_chapter_traits(); fleet_type = 1; strength = 5; cooperation = 5;