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
Cycle through all Armament.LocalOffsets if weapon has Burst: 1 #14579
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
83ff50c
When Armament has multiple LocalOffsets but weapon has Burst: 1, cycl…
reaperrr 237578e
Remove dysfunctional TS yaml hacks
reaperrr 8c12e40
Make RA heli weapons alternate between offsets
reaperrr cc60f37
Fix TD Orca missiles alternating between offsets
reaperrr File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,8 @@ public class ArmamentInfo : PausableConditionalTraitInfo, Requires<AttackBaseInf | |
[Desc("Time (in frames) until the weapon can fire again.")] | ||
public readonly int FireDelay = 0; | ||
|
||
[Desc("Muzzle position relative to turret or body. (forward, right, up) triples")] | ||
[Desc("Muzzle position relative to turret or body, (forward, right, up) triples.", | ||
"If weapon Burst = 1, it cycles through all listed offsets, otherwise the offset corresponding to current burst is used.")] | ||
public readonly WVec[] LocalOffset = { }; | ||
|
||
[Desc("Muzzle yaw relative to turret or body.")] | ||
|
@@ -113,6 +114,8 @@ public class Armament : PausableConditionalTrait<ArmamentInfo>, ITick, IExplodeM | |
IEnumerable<int> inaccuracyModifiers; | ||
|
||
int ticksSinceLastShot; | ||
int currentBarrel; | ||
int barrelCount; | ||
|
||
List<Pair<int, Action>> delayedActions = new List<Pair<int, Action>>(); | ||
|
||
|
@@ -141,6 +144,8 @@ public Armament(Actor self, ArmamentInfo info) | |
if (barrels.Count == 0) | ||
barrels.Add(new Barrel { Offset = WVec.Zero, Yaw = WAngle.Zero }); | ||
|
||
barrelCount = barrels.Count; | ||
|
||
Barrels = barrels.ToArray(); | ||
} | ||
|
||
|
@@ -232,7 +237,10 @@ public virtual Barrel CheckFire(Actor self, IFacing facing, Target target) | |
|
||
ticksSinceLastShot = 0; | ||
|
||
var barrel = Barrels[Burst % Barrels.Length]; | ||
// If Weapon.Burst == 1, cycle through all LocalOffsets, otherwise use the offset corresponding to current Burst | ||
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. Can you please document this in the 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. |
||
currentBarrel %= barrelCount; | ||
var barrel = Weapon.Burst == 1 ? Barrels[currentBarrel] : Barrels[Burst % Barrels.Length]; | ||
currentBarrel++; | ||
|
||
FireBarrel(self, facing, target, barrel); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
current shot in the burst, right?
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.
According to what I found online, 'burst' stands for a shot in a salvo.
Edit: Googling for "burst salvo" brought up this (quote from F4 Phantom manual):
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.
See #13090 in relation to this ongoing confusion.