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 smudges incorrectly generating on slopes #21292

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions OpenRA.Mods.Common/Traits/World/SmudgeLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,13 @@ public void AddSmudge(CPos loc)

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)));
Expand Down