Skip to content

feat: UI editor for company squad composition#1210

Draft
OH296 wants to merge 12 commits into
Adeptus-Dominus:mainfrom
OH296:player_squad_build_uii
Draft

feat: UI editor for company squad composition#1210
OH296 wants to merge 12 commits into
Adeptus-Dominus:mainfrom
OH296:player_squad_build_uii

Conversation

@OH296
Copy link
Copy Markdown
Collaborator

@OH296 OH296 commented Jun 2, 2026

as on tin actually makes the company buttons in chapter settings do shit to allow the player to edit company dispositions, soonn maybe add a squad editor to ake custom squads

also generally refactor the entire chapter settings screen to use modern ui features


Summary by cubic

Adds a full in-game editor for company squad composition and rebuilds the Chapter Settings into clean Formation, Company, and Role screens. Players can add required and proportional squads per company, with quick controls for min/max/proportion and easy type pickers.

  • New Features

    • Company Squad Editor: add/remove squad types with per-type editors; set min/max for required squads and proportions for others. Pickers only show types not already used, with data read/written from obj_ini.chapter_squad_arrangement.
    • Chapter Settings overhaul: dedicated screens for SETTINGS, COMPANY_SETTINGS, ROLE_SETTINGS, and FORMATIONS_SETTINGS; back arrow via SpriteButton. Formation screen has inline name input (TextBarArea), an Attack/Raid RadioSet (locked for defaults), and clearer player/enemy deployment columns with tooltips.
    • New UI primitives: Box, ValueShifter (increment/decrement control), overhauled data-first SpriteButton with .update()/.draw(), and sr_hit_struct for simple hit-testing.
  • Refactors

    • Split scr_ui_settings into setup_ui_chapter_settings() plus focused select/draw helpers; controller now draws the settings background and routes menus in Draw_64.
    • Moved eROLE to scripts/macros/macros.gml and removed the duplicate enum.
    • Updated Armamentarium to the new SpriteButton API; squad initialization reads from obj_ini.chapter_squad_arrangement.

Written for commit def56a8. Summary will update on new commits.

Review in cubic

@github-actions github-actions Bot added Size: Epic Type: Feature Adds something new labels Jun 2, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

20 issues found across 10 files

Confidence score: 2/5

  • There are multiple high-confidence, user-facing regressions (7–9/10 severity), so this is high risk to merge without fixes.
  • In objects/obj_controller/Draw_64.gml, the range guard uses || instead of &&, which can trigger scr_ui_settings() for nearly all menu values and break expected menu routing.
  • In scripts/Armamentarium/Armamentarium.gml, button flow regressed: sell action appears unreachable (is_clicked no longer updated via removed draw() path), and dropping _can_buy allows purchases of unavailable items.
  • Pay close attention to objects/obj_controller/Draw_64.gml, scripts/Armamentarium/Armamentarium.gml, scripts/scr_ui_settings/scr_ui_settings.gml, and scripts/scr_squads/scr_squads.gml - they contain the highest-impact logic/state regressions (routing, shop actions, settings persistence, and nullable squad lookups).
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/Armamentarium/Armamentarium.gml">

<violation number="1" location="scripts/Armamentarium/Armamentarium.gml:1041">
P1: Buy button enable check dropped `_can_buy`, so unavailable items can still be purchased.</violation>

<violation number="2" location="scripts/Armamentarium/Armamentarium.gml:1049">
P0: Custom agent: **Code Quality Review**

sell_button `draw()` removed but `is_clicked` still read; `is_clicked` is only set inside `SpriteButton.draw()`, so the sell button action is unreachable.</violation>
</file>

<file name="scripts/scr_squads/scr_squads.gml">

<violation number="1" location="scripts/scr_squads/scr_squads.gml:714">
P2: Existence check validates different struct than struct actually dereferenced.</violation>

<violation number="2" location="scripts/scr_squads/scr_squads.gml:738">
P2: Required squad delete path never sets `deleted = true`, so UI list reset not triggered.</violation>

<violation number="3" location="scripts/scr_squads/scr_squads.gml:756">
P2: `max_clamp` gets `ValueShifter` object, not numeric max value.</violation>

<violation number="4" location="scripts/scr_squads/scr_squads.gml:778">
P1: Custom agent: **Code Quality Review**

Missing fail-loud guard on nullable lookup result: `get_compay_squad_arrangement()` returns undefined when company not found, but constructor immediately dereferences `.squads` without validation or error logging.</violation>
</file>

<file name="scripts/scr_buttons/scr_buttons.gml">

<violation number="1" location="scripts/scr_buttons/scr_buttons.gml:66">
P1: Height backfill writes into `w` instead of `h`, corrupting box dimensions.</violation>

<violation number="2" location="scripts/scr_buttons/scr_buttons.gml:188">
P2: `ReactiveString` called with misordered arguments; style struct passed into `x1` slot.</violation>
</file>

<file name="scripts/scr_hit/scr_hit.gml">

<violation number="1" location="scripts/scr_hit/scr_hit.gml:17">
P2: Function name `sr_hit_struct` inconsistent with `scr_` prefix used by all other functions in file</violation>
</file>

<file name="scripts/scr_ui_settings/scr_ui_settings.gml">

<violation number="1" location="scripts/scr_ui_settings/scr_ui_settings.gml:342">
P2: `yy` is used with `-=` without local initialization, creating fragile implicit state dependency.</violation>

<violation number="2" location="scripts/scr_ui_settings/scr_ui_settings.gml:381">
P1: Plasma objective writes from damage-systems toggle, so plasma selection can be wrong or impossible to persist.</violation>

<violation number="3" location="scripts/scr_ui_settings/scr_ui_settings.gml:552">
P1: Company settings draw assumes `squad_arrangement` always exists, but selection path skips initialization for settings 0.</violation>

<violation number="4" location="scripts/scr_ui_settings/scr_ui_settings.gml:727">
P2: Formation type radio can remain non-interactive after visiting base formations because `allow_changes` is only set false, never reset true.</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.

Re-trigger cubic

Comment thread objects/obj_controller/Draw_64.gml Outdated

sell_button.tooltip_text = $"Sell for {round(_item.value * SHOP_SELL_MOD)} (x{SHOP_SELL_MOD} of value)";
sell_button.draw(1480, _y + 2, _can_sell);
sell_button.update({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0: Custom agent: Code Quality Review

sell_button draw() removed but is_clicked still read; is_clicked is only set inside SpriteButton.draw(), so the sell button action is unreachable.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/Armamentarium/Armamentarium.gml, line 1049:

<comment>sell_button `draw()` removed but `is_clicked` still read; `is_clicked` is only set inside `SpriteButton.draw()`, so the sell button action is unreachable.</comment>

<file context>
@@ -1027,17 +1032,25 @@ function Armamentarium(_controller) constructor {
 
-        sell_button.tooltip_text = $"Sell for {round(_item.value * SHOP_SELL_MOD)} (x{SHOP_SELL_MOD} of value)";
-        sell_button.draw(1480, _y + 2, _can_sell);
+        sell_button.update({
+            tooltip_text : $"Sell for {round(_item.value * SHOP_SELL_MOD)} (x{SHOP_SELL_MOD} of value)",
+            x1 : 1480,
</file context>

w = x2 - x1;
}
if (h == 0 && y2 > 0){
w = y2 - y1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Height backfill writes into w instead of h, corrupting box dimensions.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/scr_buttons/scr_buttons.gml, line 66:

<comment>Height backfill writes into `w` instead of `h`, corrupting box dimensions.</comment>

<file context>
@@ -45,15 +45,32 @@ function standard_loc_data() {
+            w = x2 - x1;
+        }
+        if (h == 0 && y2 > 0){
+            w = y2 - y1;
+        }
+
</file context>
Suggested change
w = y2 - y1;
h = y2 - y1;

y1 : _y + 2
});

buy_button.draw(_can_afford);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Buy button enable check dropped _can_buy, so unavailable items can still be purchased.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/Armamentarium/Armamentarium.gml, line 1041:

<comment>Buy button enable check dropped `_can_buy`, so unavailable items can still be purchased.</comment>

<file context>
@@ -1027,17 +1032,25 @@ function Armamentarium(_controller) constructor {
+            y1 : _y + 2
+        });
+
+        buy_button.draw(_can_afford);
 
         if (buy_button.is_clicked) {
</file context>
Suggested change
buy_button.draw(_can_afford);
buy_button.draw(_can_buy && _can_afford);

}

function scr_draw_company_settings_ui(){
squad_arrangement.draw();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Company settings draw assumes squad_arrangement always exists, but selection path skips initialization for settings 0.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/scr_ui_settings/scr_ui_settings.gml, line 552:

<comment>Company settings draw assumes `squad_arrangement` always exists, but selection path skips initialization for settings 0.</comment>

<file context>
@@ -1,316 +1,584 @@
+}
+
+function scr_draw_company_settings_ui(){
+    squad_arrangement.draw();
+}
 
</file context>
Suggested change
squad_arrangement.draw();
if (settings != 0 && is_struct(squad_arrangement)) {
squad_arrangement.draw();
}

Comment thread scripts/scr_ui_settings/scr_ui_settings.gml
Comment thread scripts/scr_ui_settings/scr_ui_settings.gml
Comment thread scripts/scr_hit/scr_hit.gml
Comment thread scripts/scr_squads/scr_squads.gml
Comment thread scripts/scr_hit/scr_hit.gml
OH296 and others added 2 commits June 2, 2026 11:51
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Shadow auto-approve: would not auto-approve. Auto-approval blocked by 13 unresolved issues from previous reviews.

Re-trigger cubic

@EttyKitty EttyKitty changed the title feat: full ui editor for company squad composition feat: UI editor for company squad composition Jun 3, 2026
@EttyKitty EttyKitty marked this pull request as draft June 4, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: Epic Type: Feature Adds something new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant