feat: UI editor for company squad composition#1210
Conversation
There was a problem hiding this comment.
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 triggerscr_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_clickedno longer updated via removeddraw()path), and dropping_can_buyallows 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, andscripts/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
|
|
||
| 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({ |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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>
| w = y2 - y1; | |
| h = y2 - y1; |
| y1 : _y + 2 | ||
| }); | ||
|
|
||
| buy_button.draw(_can_afford); |
There was a problem hiding this comment.
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>
| buy_button.draw(_can_afford); | |
| buy_button.draw(_can_buy && _can_afford); |
| } | ||
|
|
||
| function scr_draw_company_settings_ui(){ | ||
| squad_arrangement.draw(); |
There was a problem hiding this comment.
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>
| squad_arrangement.draw(); | |
| if (settings != 0 && is_struct(squad_arrangement)) { | |
| squad_arrangement.draw(); | |
| } |
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>
There was a problem hiding this comment.
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
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
obj_ini.chapter_squad_arrangement.SETTINGS,COMPANY_SETTINGS,ROLE_SETTINGS, andFORMATIONS_SETTINGS; back arrow viaSpriteButton. Formation screen has inline name input (TextBarArea), anAttack/RaidRadioSet(locked for defaults), and clearer player/enemy deployment columns with tooltips.Box,ValueShifter(increment/decrement control), overhauled data-firstSpriteButtonwith.update()/.draw(), andsr_hit_structfor simple hit-testing.Refactors
scr_ui_settingsintosetup_ui_chapter_settings()plus focused select/draw helpers; controller now draws the settings background and routes menus inDraw_64.eROLEtoscripts/macros/macros.gmland removed the duplicate enum.Armamentariumto the newSpriteButtonAPI; squad initialization reads fromobj_ini.chapter_squad_arrangement.Written for commit def56a8. Summary will update on new commits.