From be370cb855e88f38438a2f83aa680787dbe81219 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 3 Sep 2017 21:55:02 +0200 Subject: [PATCH] Spatially partition NukeLaunch effect --- OpenRA.Mods.Common/Projectiles/NukeLaunch.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs b/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs index 274f49b929..8d9ae46eaa 100644 --- a/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs +++ b/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs @@ -19,7 +19,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Effects { - public class NukeLaunch : IProjectile + public class NukeLaunch : IProjectile, ISpatiallyPartitionable { readonly Player firedBy; readonly Animation anim; @@ -64,6 +64,8 @@ namespace OpenRA.Mods.Common.Effects if (skipAscent) ticks = turn; + + firedBy.World.ScreenMap.Add(this, pos, anim.Image); } public void Tick(World world) @@ -81,12 +83,14 @@ namespace OpenRA.Mods.Common.Effects if (ticks == delay) Explode(world); + world.ScreenMap.Update(this, pos, anim.Image); + ticks++; } void Explode(World world) { - world.AddFrameEndTask(w => w.Remove(this)); + world.AddFrameEndTask(w => { w.Remove(this); w.ScreenMap.Remove(this); }); weapon.Impact(Target.FromPos(pos), firedBy.PlayerActor, Enumerable.Empty()); world.WorldActor.Trait().AddEffect(20, pos, 5);