Use null propagation

This commit is contained in:
Gustas
2023-02-19 15:29:08 +02:00
committed by Pavel Penev
parent b06cbd7a95
commit 157d1b32dc
12 changed files with 30 additions and 36 deletions

View File

@@ -37,11 +37,8 @@ namespace OpenRA.Mods.Common.Activities
{
if (self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length <= 0)
{
if (info.ExplosionWeapon != null)
{
// Use .FromPos since this actor is killed. Cannot use Target.FromActor
info.ExplosionWeapon.Impact(Target.FromPos(self.CenterPosition), self);
}
// Use .FromPos since this actor is killed. Cannot use Target.FromActor
info.ExplosionWeapon?.Impact(Target.FromPos(self.CenterPosition), self);
self.Kill(self);
Cancel(self);

View File

@@ -74,8 +74,8 @@ namespace OpenRA.Mods.Common.Activities
if (enterLegacyHut != null)
enterLegacyHut.Repair(self);
else if (enterHut != null)
enterHut.Repair(self);
else
enterHut?.Repair(self);
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", speechNotification, self.Owner.Faction.InternalName);
TextNotificationsManager.AddTransientLine(textNotification, self.Owner);