-
Notifications
You must be signed in to change notification settings - Fork 256
randomise default air unit elevation #7096
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
base: develop
Are you sure you want to change the base?
Changes from 2 commits
29f2fef
1fd0a28
74a30d2
be2bc8e
9a73b25
2844ab9
4bd6490
0c18c0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ AirUnit = ClassUnit(MobileUnit) { | |
| MobileUnitOnCreate(self) | ||
| self.HasFuel = true | ||
| self:AddPingPong() | ||
| self:RandomiseElevation() | ||
| end, | ||
|
|
||
| ---@param self AirUnit | ||
|
|
@@ -40,6 +41,27 @@ AirUnit = ClassUnit(MobileUnit) { | |
| end | ||
| end, | ||
|
|
||
| --@param self AirUnit | ||
| RandomiseElevation = function(self) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be |
||
| local maxElevationDelta = 5 | ||
|
cx-koraka marked this conversation as resolved.
Outdated
|
||
| local maxElevationPercentageIncrease = 5 | ||
| local maxElevationPercentageDecrease = 5 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why 2 different values for increase and decrease when they are the same?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I moved these outside of the function, similar to the existing destruction params, would they be able to be changed by mods?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, if they are saved on the class, mods can easily adjust them without touching the function
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Hopefully this will make it easier to experiment whilst testing as well |
||
|
|
||
| local blueprintPhysics = self.Blueprint.Physics | ||
| local originalElevation = blueprintPhysics.Elevation | ||
| local elevationMultiplier = math.random(100-maxElevationPercentageDecrease, 100+maxElevationPercentageIncrease) * 0.01 | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| local newElevation | ||
|
|
||
| if elevationMultiplier > 1 then | ||
| newElevation = math.min(originalElevation * elevationMultiplier, originalElevation + 5) | ||
| else | ||
| newElevation = math.max(originalElevation * elevationMultiplier, originalElevation - 5) | ||
| end | ||
|
|
||
| self:SetElevation(newElevation) | ||
| end, | ||
|
|
||
| ---@param self AirUnit | ||
| ---@param new VerticalMovementState | ||
| ---@param old VerticalMovementState | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to start with 3 --- to be a valid annotation