prevent inappropriate weapons from being used
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.Game.GameRules;
|
||||
using OpenRa.Game.Effects;
|
||||
using OpenRa.Game.Traits;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
@@ -50,5 +51,14 @@ namespace OpenRa.Game
|
||||
|
||||
return rawDamage * multiplier;
|
||||
}
|
||||
|
||||
public static bool WeaponValidForTarget(WeaponInfo weapon, Actor target)
|
||||
{
|
||||
var projectile = Rules.ProjectileInfo[weapon.Projectile];
|
||||
|
||||
if (projectile.ASW) return false; // we don't support ASW yet. change this when subs can be identified.
|
||||
if (projectile.AA && target.traits.Contains<Helicopter>()) return true;
|
||||
return projectile.AG;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user