Fix smudges incorrectly generating on slopes

This commit is contained in:
Gustas
2024-01-07 18:24:04 +02:00
committed by abcdefg30
parent 0741439dd6
commit 1a037c06bf

View File

@@ -157,14 +157,13 @@ namespace OpenRA.Mods.Common.Traits
if (hasSmoke && Game.CosmeticRandom.Next(0, 100) <= Info.SmokeChance)
{
var maxOffsetDistance = Info.MaxSmokeOffsetDistance.Length;
// TODO: With offset added height is not accurate for TS maps
var position = world.Map.CenterOfCell(loc);
var maxOffsetDistance = Info.MaxSmokeOffsetDistance.Length;
if (maxOffsetDistance != 0)
position += new WVec(Game.CosmeticRandom.Next(-maxOffsetDistance, maxOffsetDistance),
Game.CosmeticRandom.Next(-maxOffsetDistance, maxOffsetDistance),
0);
{
position += new WVec(Game.CosmeticRandom.Next(-maxOffsetDistance, maxOffsetDistance), Game.CosmeticRandom.Next(-maxOffsetDistance, maxOffsetDistance), 0);
position = new WPos(position.X, position.Y, position.Z - world.Map.DistanceAboveTerrain(position).Length);
}
world.AddFrameEndTask(w => w.Add(new SpriteEffect(
position, w, Info.SmokeImage, Info.SmokeSequences.Random(Game.CosmeticRandom), Info.SmokePalette)));