Skip to content

Commit

Permalink
Fix movement effects warning spam due to contrails (#6480)
Browse files Browse the repository at this point in the history
  • Loading branch information
lL1l1 authored Oct 23, 2024
1 parent 1442dad commit ba693b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion changelog/snippets/fix.6436.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- (#6436) Prevent the logging of an unecessary warning when certain units make landfall.
- (#6436, #6480) Prevent the logging of an unecessary warning when certain units make landfall.
11 changes: 6 additions & 5 deletions lua/sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3634,7 +3634,7 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent, DebugUni
---@overload fun(self: Unit, effectTypeGroups: UnitBlueprintEffect[], fxBlockType: "FXImpact", impactType: ImpactType, suffix?: string, bag?: TrashBag, terrainType?: TerrainType)
---@overload fun(self: Unit, effectTypeGroups: UnitBlueprintEffect[], fxBlockType: "FXMotionChange", motionChange: MotionChangeType, suffix?: string, bag?: TrashBag, terrainType?: TerrainType)
---@overload fun(self: Unit, effectTypeGroups: UnitBlueprintEffect[], fxBlockType: "FXLayerChange", layerChange: LayerChangeType, suffix?: string, bag?: TrashBag, terrainType?: TerrainType)
---
--- Creates effects defined in `TerrainTypes.lua` based on the terrain that a movement is moving on.
---@param self Unit
---@param effectTypeGroups UnitBlueprintEffect[]
---@param fxBlockType LayerTerrainEffectType
Expand Down Expand Up @@ -3707,11 +3707,12 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent, DebugUni
end
end,

--- Creates camera shake effects and also movement effects for the terrain a unit is moving on.
---@param self Unit
---@param EffectsBag TrashBag
---@param TypeSuffix string
---@param TerrainType string
---@return boolean
---@param TerrainType TerrainType?
---@return boolean?
CreateMovementEffects = function(self, EffectsBag, TypeSuffix, TerrainType)
local layer = self.Layer
local bpTable = self.Blueprint.Display.MovementEffects
Expand All @@ -3726,8 +3727,8 @@ Unit = ClassUnit(moho.unit_methods, IntelComponent, VeterancyComponent, DebugUni
local effectTypeGroups = bpTable.Effects

if not effectTypeGroups or (effectTypeGroups and (table.empty(effectTypeGroups))) then
-- warning isn't needed if this layer's table is used for Footfall without terrain effects
if not bpTable.Footfall then
-- warning isn't needed if this layer's table is used for Footfall or Contrails without terrain effects
if not bpTable.Footfall and not bpTable.Contrails then
WARN('*No movement effect groups defined for unit ', repr(self.UnitId), ', Effect groups with bone lists must be defined to play movement effects. Add these to the Display.MovementEffects.', layer, '.Effects table in unit blueprint.')
end
return false
Expand Down

0 comments on commit ba693b0

Please sign in to comment.