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

Fix AttackGroundTries and Othuy Lightning Storm #6166

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9893495
Draft annotation for AttackGroundTries
lL1l1 May 9, 2024
80aa368
Add state change and lost target debug log
lL1l1 May 10, 2024
fdf7c45
Annotate DefaultProjWep's ReloadState OnLostTarget
lL1l1 May 10, 2024
7f611de
Add comment for what breaks attackgroundtries
lL1l1 May 10, 2024
98161b7
Don't check for target in firing state
lL1l1 May 10, 2024
e22538b
Revert FiringState to steam behavior but with fix
lL1l1 May 10, 2024
cf7f304
Prevent skipping rack reload by losing target in firing state
lL1l1 May 10, 2024
5e3be9a
Update AttackGroundTries annotation
lL1l1 May 10, 2024
3c8c58b
Don't let bombers retarget over time
lL1l1 May 10, 2024
3d04ae2
Annotate ResetTarget
lL1l1 May 16, 2024
7221521
Update DefaultProjectileWeapon ResetTarget comments
lL1l1 May 16, 2024
e775431
Fix MuzzleVelocityReduceDistance condition
lL1l1 May 16, 2024
9623ee5
Annotate `Current[Salvo|RackSalvo]Number`
lL1l1 May 16, 2024
039dfe7
Annotate UnitWeapon functions
lL1l1 May 18, 2024
dde57af
Add sim freeze warnings for AttackerImpl
lL1l1 May 19, 2024
feee00f
More weapon behavior annotations
lL1l1 May 19, 2024
825bee2
Add weapon debugging code
lL1l1 May 19, 2024
b327268
Use correct rof for `DisabledWhileReloadingThread`
lL1l1 May 20, 2024
e760e8a
Make fire recharge bar track the actual fire clock
lL1l1 May 20, 2024
83c8da4
Note that weapons do not track within `MinRadius`
lL1l1 May 20, 2024
66c3764
Remove unused field in Cybran ACU laser bp
lL1l1 May 25, 2024
d272978
Format URB2301_Script.lua
lL1l1 May 25, 2024
4f8debd
More debug logging
lL1l1 May 25, 2024
3182f68
Add Salvo Retargeting feature
lL1l1 May 20, 2024
3075443
Simplify RenderFireClock
lL1l1 May 25, 2024
32877f2
Fix spelling
lL1l1 May 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion engine/Core/Blueprints/WeaponBlueprint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
---@field ArtilleryShieldBlocks? boolean
--- information about the audio files used by the weapon
---@field Audio WeaponBlueprintAudio
--- How many times the engine calls OnFire for the weapon when attacking ground before moving on to the next ground attack order. Defaults to 3
---@field AttackGroundTries?
--- if the unit has no issued commands and has a weapon that has `AutoInitiateAttackCommand` set,
--- then if it finds a suitable target it will issue an attack command to go after the target
---@field AutoInitiateAttackCommand? boolean
Expand Down Expand Up @@ -311,7 +313,7 @@
---@field ToggleWeapon? string
--- The radius at which the weapon starts tracking the target. This does not mean that the weapon
--- will fire. The weapon will only fire when a target enters the maxradius. This is a multiplier of
--- the weapon's `MaxRadius`.
--- the weapon's `MaxRadius`. Weapons do not track targets within the weapon's `MinRadius`.
---@field TrackingRadius? number
--- the second muzzle bone for a turret, used for arms on bots as weapons
---@field TurretBoneDualMuzzle? Bone
Expand Down
3 changes: 3 additions & 0 deletions engine/Sim/CAiAttackerImpl.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---@meta

-- The attacker implementation is unfinished, and using any of these methods freezes the sim!

--- "tactical attack manager object"
---@class moho.CAiAttackerImpl_methods
local CAiAttackerImpl = {}

Expand Down
1 change: 1 addition & 0 deletions engine/Sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function Unit:GetArmorMult(damageTypeName)
end

--- Returns the tactical attack manager object of this unit
--- The attacker implementation is unfinished, so using this freezes the sim!
---@return Attacker
function Unit:GetAttacker()
end
Expand Down
21 changes: 12 additions & 9 deletions engine/Sim/UnitWeapon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local UnitWeapon = {}
function UnitWeapon:BeenDestroyed()
end

---
--- Returns true if the weapon is aiming at the target as allowed by the FiringTolerance blueprint value and the target is within the weapon's range
---@return boolean
function UnitWeapon:CanFire()
end
Expand Down Expand Up @@ -96,8 +96,9 @@ end
function UnitWeapon:GetCurrentTargetPos()
end

--- Gets the firing clock percent, `0.0` - `1.0`
---@return number
--- Returns the progress of the engine's firing clock determined by RateOfFire, usually from the blueprint
---@see ChangeRateOfFire
---@return number # within [0.0, 1.0]
function UnitWeapon:GetFireClockPct()
end

Expand All @@ -111,8 +112,9 @@ end
function UnitWeapon:GetProjectileBlueprint()
end

---
---@param label string
--- Returns true if the given AimManipulator is the weapon's fire control
---@see SetFireControl
---@param label string label that was used to create the AimManipulator
---@return boolean
function UnitWeapon:IsFireControl(label)
end
Expand All @@ -122,7 +124,7 @@ end
function UnitWeapon:PlaySound(params)
end

---
--- Force the weapon to recheck its targets. Also resets the counter for AttackGroundTries
function UnitWeapon:ResetTarget()
end

Expand All @@ -131,8 +133,8 @@ end
function UnitWeapon:SetEnabled(enabled)
end

---
---@param label string
--- Set which AimManipulator will call OnFire for the weapon when that manipulator has finished tracking
---@param label string label that was used to create the AimManipulator
function UnitWeapon:SetFireControl(label)
end

Expand Down Expand Up @@ -165,7 +167,8 @@ end
function UnitWeapon:TransferTarget()
end

---
--- Returns true if the weapon currently has a target.
--- This only updates at the end of a tick, so it shouldn't be used in behavior relating to OnLostTarget or OnGotTarget callbacks
---@return boolean
function UnitWeapon:WeaponHasTarget()
end
Expand Down
1 change: 1 addition & 0 deletions lua/sim/weapon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ Weapon = ClassWeapon(WeaponMethods) {

---@param self Weapon
OnLostTarget = function(self)
LOG("weapon.lua:losttarget")
local animator = self.unit.Animator
if self.DisabledFiringBones and animator then
for _, value in self.DisabledFiringBones do
Expand Down
4 changes: 2 additions & 2 deletions lua/sim/weapons/DefaultBeamWeapon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ DefaultBeamWeapon = ClassWeapon(DefaultProjectileWeapon) {
-- enable the beam
beam:Enable()

-- non-continious beams that just end
-- non-continuous beams that just end
if bp.BeamLifetime > 0 then
self:ForkThread(self.BeamLifetimeThread, beam, bp.BeamLifetime or 1)
end

-- continious beams
-- continuous beams
if bp.BeamLifetime == 0 then
self.HoldFireThread = self:ForkThread(self.WatchForHoldFire, beam)
end
Expand Down
Loading