Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor weapon turret setup validation #6662

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

lL1l1
Copy link
Contributor

@lL1l1 lL1l1 commented Feb 18, 2025

Issue

When turret setup fails it does not give very clear information because the error messages are vague or the stack trace is incorrect due to bone validation itself erroring. Most commonly this occurs when developing mods.

Description of the proposed changes

  • Refactors turret validation so the issues are clear.
  • Change turret setup failure from error to return.
  • Change Unit:ValidateBone so it doesn't error there, and instead just returns false.
  • Fix ValidateBone not dealing with nil bones, a common case when turrets are setup incorrectly (forgetting a bone).
  • Format weapon.lua

Testing done on the proposed changes

Remove bones for a unit's turret setup and check the new warning message.

Checklist

  • Changes are annotated, including comments where useful
  • Changes are documented in the changelog for the next game version

Weapons are created before the unit so they may access unit data in their OnCreate function (for example UnitId in bone validation)
@lL1l1 lL1l1 added type: enhancement area: sim Area that is affected by the Simulation of the Game labels Feb 18, 2025
@lL1l1 lL1l1 marked this pull request as ready for review February 18, 2025 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: sim Area that is affected by the Simulation of the Game type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant