From 1fae9935938b5ecf61ae26acfef622056c6aaf99 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 18 Apr 2017 20:12:09 +0200 Subject: [PATCH] Prevent attacking while in tunnel/underground --- OpenRA.Mods.Common/Traits/Attack/AttackBase.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs index c9eb95e1ca..da484f47b4 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs @@ -80,6 +80,10 @@ namespace OpenRA.Mods.Common.Traits if (!HasAnyValidWeapons(target)) return false; + var mobile = self.TraitOrDefault(); + if (mobile != null && !mobile.CanInteractWithGroundLayer(self)) + return false; + // Building is under construction or is being sold if (building.Value != null && !building.Value.BuildComplete) return false;