Make the ICrushable interface a bit more sane, plus correct defaults for infantry
This commit is contained in:
@@ -243,9 +243,7 @@ namespace OpenRa.Game
|
|||||||
{
|
{
|
||||||
return a != null &&
|
return a != null &&
|
||||||
a.traits.WithInterface<ICrushable>()
|
a.traits.WithInterface<ICrushable>()
|
||||||
.Any(c => c.CrushableBy(umt) &&
|
.Any(c => c.IsCrushableBy(umt, a.Owner));
|
||||||
((c.IsCrushableByEnemy() && a.Owner != Game.LocalPlayer) ||
|
|
||||||
(c.IsCrushableByFriend() && a.Owner == Game.LocalPlayer)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsWater(int2 a)
|
public static bool IsWater(int2 a)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using OpenRa.Game.GameRules;
|
||||||
|
|
||||||
namespace OpenRa.Game.Traits
|
namespace OpenRa.Game.Traits
|
||||||
{
|
{
|
||||||
@@ -13,24 +13,15 @@ namespace OpenRa.Game.Traits
|
|||||||
this.self = self;
|
this.self = self;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsCrushableByFriend()
|
|
||||||
{
|
|
||||||
// HACK: should be false
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public bool IsCrushableByEnemy()
|
|
||||||
{
|
|
||||||
// HACK: should be based off crushable tag
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCrush(Actor crusher)
|
public void OnCrush(Actor crusher)
|
||||||
{
|
{
|
||||||
self.InflictDamage(crusher, self.Health, Rules.WarheadInfo["Crush"]);
|
self.InflictDamage(crusher, self.Health, Rules.WarheadInfo["Crush"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CrushableBy(UnitMovementType umt)
|
public bool IsCrushableBy(UnitMovementType umt, Player player)
|
||||||
{
|
{
|
||||||
|
if (player == Game.LocalPlayer) return false;
|
||||||
|
if (!(self.Info as InfantryInfo).Crushable) return false;
|
||||||
switch (umt)
|
switch (umt)
|
||||||
{
|
{
|
||||||
case UnitMovementType.Track: return true;
|
case UnitMovementType.Track: return true;
|
||||||
|
|||||||
@@ -61,9 +61,7 @@ namespace OpenRa.Game.Traits
|
|||||||
|
|
||||||
interface ICrushable
|
interface ICrushable
|
||||||
{
|
{
|
||||||
bool IsCrushableByFriend();
|
|
||||||
bool IsCrushableByEnemy();
|
|
||||||
void OnCrush(Actor crusher);
|
void OnCrush(Actor crusher);
|
||||||
bool CrushableBy(UnitMovementType umt);
|
bool IsCrushableBy(UnitMovementType umt, Player player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user