diff --git a/.github/workflows/gobo_check.yml b/.github/workflows/gobo_check.yml new file mode 100644 index 0000000000..9e6885b8b8 --- /dev/null +++ b/.github/workflows/gobo_check.yml @@ -0,0 +1,45 @@ +name: GoboLintCheck + +on: + pull_request: + types: [opened, edited, ready_for_review, synchronize] + paths: + - '**.gml' + +jobs: + format-check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get Changed Files + id: changed-files + uses: tj-actions/changed-files@v44 + with: + files: '**.gml' + + - name: Setup Gobo + if: steps.changed-files.outputs.any_changed == 'true' + run: | + curl -LO https://github.com/EttyKitty/Gobo/releases/download/v1.0.0/gobo-ubuntu.zip + unzip gobo-ubuntu.zip + chmod +x ./gobo + + - name: Run Formatter + if: steps.changed-files.outputs.any_changed == 'true' + run: | + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + echo "Formatting $file..." + ./gobo "$file" + done + + - name: Verify Formatting + run: | + if ! git diff --quiet; then + echo "::error::Files not formatted. Please run Gobo locally." + git diff --name-only + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/gobo_lint.yml b/.github/workflows/gobo_lint.yml new file mode 100644 index 0000000000..a4b884a8a8 --- /dev/null +++ b/.github/workflows/gobo_lint.yml @@ -0,0 +1,74 @@ +name: Gobo Lint + +on: + issue_comment: + types: [created] + +jobs: + format: + if: > + github.event.issue.pull_request && + startsWith(github.event.comment.body, '/format') && + (github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'COLLABORATOR') + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Fetch PR Details + id: pr + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Use the GitHub CLI to get the branch name and the full repository name (owner/repo) + PR_JSON=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json headRefName,headRepositoryOwner,headRepository) + + # Extract values using jq + HEAD_REF=$(echo "$PR_JSON" | jq -r .headRefName) + HEAD_OWNER=$(echo "$PR_JSON" | jq -r .headRepositoryOwner.login) + HEAD_REPO_NAME=$(echo "$PR_JSON" | jq -r .headRepository.name) + + echo "head_ref=$HEAD_REF" >> $GITHUB_OUTPUT + echo "head_repo=$HEAD_OWNER/$HEAD_REPO_NAME" >> $GITHUB_OUTPUT + + - name: Checkout PR Branch + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ steps.pr.outputs.head_repo }} + ref: ${{ steps.pr.outputs.head_ref }} + fetch-depth: 0 + + - name: Get Changed Files + id: changed-files + uses: tj-actions/changed-files@v44 + with: + base_sha: ${{ github.event.issue.pull_request.base.sha }} + files: '**.gml' + + - name: Setup Gobo + if: steps.changed-files.outputs.any_changed == 'true' + run: | + curl -LO https://github.com/EttyKitty/Gobo/releases/download/v1.0.0/gobo-ubuntu.zip + unzip gobo-ubuntu.zip + chmod +x ./gobo + + - name: Run Formatter + if: steps.changed-files.outputs.any_changed == 'true' + run: | + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + if [ -f "$file" ]; then + echo "Formatting $file..." + ./gobo "$file" + fi + done + + - name: Commit and Push changes + if: steps.changed-files.outputs.any_changed == 'true' + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "style: Auto-format GML files with Gobo" + file_pattern: '**.gml' \ No newline at end of file diff --git a/objects/obj_fleet_select/Draw_0.gml b/objects/obj_fleet_select/Draw_0.gml index 6f77291d53..d1bbddae74 100644 --- a/objects/obj_fleet_select/Draw_0.gml +++ b/objects/obj_fleet_select/Draw_0.gml @@ -135,7 +135,7 @@ if (__b__) { } eta += speed_string; - draw_text_transformed(sys.x + 17, sys.y, string_hash_to_newline(eta), scale, scale, 0); + draw_text_transformed_outline(sys.x + 17, sys.y, string_hash_to_newline(eta), scale, scale, 0); if (mouse_check_button(mb_right) && viable) { var ship_count = player_fleet_ship_count(player_fleet); var fleet_selected = player_fleet_selected_count(player_fleet); diff --git a/objects/obj_formation_bar/Draw_0.gml b/objects/obj_formation_bar/Draw_0.gml index 93212e3cd3..6009269030 100644 --- a/objects/obj_formation_bar/Draw_0.gml +++ b/objects/obj_formation_bar/Draw_0.gml @@ -7,10 +7,11 @@ if (tist=true){ }*/ draw_set_alpha(1); if (dragging == false) { - draw_sprite_ext(spr_formation_bars, image_index, x, y, image_xscale, image_yscale, 0, c_white, 1); + draw_rectangle_outline(x, y, x + 39, y + 47, color, c_black); } + if (dragging == true) { - draw_sprite_ext(spr_formation_bars, image_index, x, y + 1000, image_xscale, image_yscale, 0, c_white, 1); + draw_rectangle_outline(x, y + 100, x + 39, y + 47 + 100, color, c_black); } draw_set_alpha(1); diff --git a/objects/obj_ncombat/Alarm_5.gml b/objects/obj_ncombat/Alarm_5.gml index 48c9d30604..90c53c9418 100644 --- a/objects/obj_ncombat/Alarm_5.gml +++ b/objects/obj_ncombat/Alarm_5.gml @@ -468,7 +468,7 @@ if (defeat == 0 && _reduce_power) { if (dropping == true || defending == true) { power_reduction = 1; } else { - power_reduction = 2; + power_reduction = enemy_power; } new_power = enemy_power - power_reduction; new_power = max(new_power, 0); diff --git a/scripts/scr_animated_scanline/scr_animated_scanline.gml b/scripts/scr_animated_scanline/scr_animated_scanline.gml index 91b39a4af0..11394b9ea6 100644 --- a/scripts/scr_animated_scanline/scr_animated_scanline.gml +++ b/scripts/scr_animated_scanline/scr_animated_scanline.gml @@ -6,9 +6,8 @@ function draw_animated_scanline(x1, y1, width, height, time = 10, color = 599838 if (anim <= 10) { draw_set_alpha(anim / 10); } else { - draw_set_alpha(2 - (anim / 10)); - } - line_move = y1 + (height * ((anim % 20) / 20)); + draw_set_alpha(2-(anim / 10)); + }line_move = y1 + (height * ((anim % 20) / 20)); if (irandom(100) <= 5) { line_move -= 4; } diff --git a/scripts/scr_draw_rectangle/scr_draw_rectangle.gml b/scripts/scr_draw_rectangle/scr_draw_rectangle.gml index 7becca33cb..7ad6eee0e7 100644 --- a/scripts/scr_draw_rectangle/scr_draw_rectangle.gml +++ b/scripts/scr_draw_rectangle/scr_draw_rectangle.gml @@ -19,6 +19,7 @@ function draw_rectangle_outline(_x, _y, _x2, _y2, _bg_color = c_black, _outline_ draw_rectangle(_x, _y, _x2, _y2, 0); draw_set_color(_outline_color); draw_rectangle(_x, _y, _x2, _y2, 1); + draw_rectangle(_x + 2, _y + 2, _x2 - 2, _y2 - 2, 1); draw_set_color(_cur_color); draw_set_alpha(_cur_alpha); diff --git a/scripts/scr_fleet_functions/scr_fleet_functions.gml b/scripts/scr_fleet_functions/scr_fleet_functions.gml index 7de2a3490a..cb8525a9ab 100644 --- a/scripts/scr_fleet_functions/scr_fleet_functions.gml +++ b/scripts/scr_fleet_functions/scr_fleet_functions.gml @@ -274,13 +274,13 @@ function calculate_action_speed(fleet = "none", selected = false) { escorts = types[2]; } } - var fleet_speed = 128; + var fleet_speed = 384; if (capitals > 0) { - fleet_speed = 100; + fleet_speed = 300; } else if (frigates > 0) { - fleet_speed = 128; + fleet_speed = 384; } else if (escorts > 0) { - fleet_speed = 174; + fleet_speed = 522; } if (_is_player_fleet) { if ((obj_controller.stc_ships >= 6) && (fleet_speed >= 100)) { diff --git a/scripts/scr_ui_formation_bars/scr_ui_formation_bars.gml b/scripts/scr_ui_formation_bars/scr_ui_formation_bars.gml index 061fbab78b..96b9301034 100644 --- a/scripts/scr_ui_formation_bars/scr_ui_formation_bars.gml +++ b/scripts/scr_ui_formation_bars/scr_ui_formation_bars.gml @@ -28,42 +28,42 @@ function scr_ui_formation_bars() { for (var ii = 1; ii <= 17; ii++) { if ((ii == 1) && (bat_comm_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 2, 0, "HQ"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "HQ", c_yellow); } else if ((ii == 2) && (bat_hono_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 1, 1, "Hono"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "HG", c_yellow); } else if ((ii == 3) && (bat_libr_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 1, 8, "Lib"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "LIB", c_aqua); } else if ((ii == 4) && (bat_tech_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 1, 9, "Tech"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "TEC", c_red); } else if ((ii == 5) && (bat_term_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 1, 10, "Term"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "TER", c_white); } else if ((ii == 6) && (bat_vete_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 2, 6, "Veteran"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "VET", c_white); } else if ((ii == 7) && (bat_tact_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 6, 3, "Tactical"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "TAC", c_navy); } else if ((ii == 8) && (bat_deva_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 3, 2, "Devastator"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "DEV", c_purple); } else if ((ii == 9) && (bat_assa_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 3, 5, "Assault"); - } else if ((ii == 10) && (bat_scou_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 1, 4, "Sco"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "ASS"); } else if ((ii == 11) && (bat_drea_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 2, 11, "Dread"); - } else if ((ii == 12) && (bat_hire_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 1, 7, "???"); - } else if ((ii == 16) && (bat_landspee_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 2, 14, "Land Speeder"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "DRD", c_orange); } if (bat_formation_type[_formatting] != 2) { if ((ii == 13) && (bat_rhin_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 4, 12, "Rhino"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "RHN"); } else if ((ii == 14) && (bat_pred_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 2, 13, "Predator"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "PRD"); } else if ((ii == 15) && (bat_landraid_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 2, 14, "Land Raider"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "LND"); + } else if ((ii == 16) && (bat_landspee_for[_formatting] == bar)) { + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "SPD"); } else if ((ii == 17) && (bat_whirl_for[_formatting] == bar)) { - init_combat_bars(bar, ii, ui_formations_data, 2, 14, "Whirlwind"); + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "WHR"); + } else if ((ii == 12) && (bat_hire_for[_formatting] == bar)) { + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "AUX"); + } else if ((ii == 10) && (bat_scou_for[_formatting] == bar)) { + init_combat_bars(bar, ii, ui_formations_data, 1, 1, "SCU", c_green); } } @@ -78,10 +78,10 @@ function scr_ui_formation_bars() { bat_vete_for[bar] = 2; bat_hire_for[bar] = 3; bat_libr_for[bar] = 3; - bat_comm_for[bar] = 3; - bat_tech_for[bar] = 3; + bat_comm_for[bar] = 4; + bat_tech_for[bar] = 4; bat_term_for[bar] = 3; - bat_hono_for[bar] = 3; + bat_hono_for[bar] = 6; bat_drea_for[bar] = 5; bat_rhin_for[bar] = 6; bat_pred_for[bar] = 7; @@ -99,7 +99,7 @@ function scr_ui_formation_bars() { } /// @mixin -function init_combat_bars(bar, ii, formations_data, size, image_index, unit_type) { +function init_combat_bars(bar, ii, formations_data, size, image_index, unit_type, color = c_gray) { formations_data.nbar = instance_create(formations_data.x9, formations_data.y9 + temp[formations_data.te], obj_formation_bar); formations_data.nbar.size = size; formations_data.nbar.height = formations_data.nbar.size * 47; @@ -111,6 +111,7 @@ function init_combat_bars(bar, ii, formations_data, size, image_index, unit_type temp[formations_data.te + 100] += formations_data.nbar.size; formations_data.nbar.image_index = image_index; formations_data.nbar.unit_type = unit_type; + formations_data.nbar.color = color; formations_data.nbar.unit_id = ii; formations_data.nbar.col_parent = bar; }