fix bug wrt tiberium infantry damage splashing; fix bug where Mobile+Production units didn't work right
This commit is contained in:
@@ -195,7 +195,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public int2 TopLeft { get { return toCell; } }
|
public int2 TopLeft { get { return toCell; } }
|
||||||
|
|
||||||
public virtual IEnumerable<int2> OccupiedCells()
|
public IEnumerable<int2> OccupiedCells()
|
||||||
{
|
{
|
||||||
return (fromCell == toCell)
|
return (fromCell == toCell)
|
||||||
? new[] { fromCell }
|
? new[] { fromCell }
|
||||||
@@ -209,7 +209,7 @@ namespace OpenRA.Traits
|
|||||||
return CanEnterCell( p, null, true);
|
return CanEnterCell( p, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool CanEnterCell( int2 cell, Actor ignoreActor, bool checkTransientActors )
|
public bool CanEnterCell( int2 cell, Actor ignoreActor, bool checkTransientActors )
|
||||||
{
|
{
|
||||||
return CanEnterCell( Info, self.World, cell, ignoreActor, checkTransientActors );
|
return CanEnterCell( Info, self.World, cell, ignoreActor, checkTransientActors );
|
||||||
}
|
}
|
||||||
@@ -238,23 +238,22 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check mobile actors
|
// Check mobile actors
|
||||||
if (checkTransientActors && uim.AnyUnitsAt(cell))
|
var blockingActors = uim.GetUnitsAt( cell ).Where( x => x != ignoreActor ).ToList();
|
||||||
|
if (checkTransientActors && blockingActors.Count > 0)
|
||||||
{
|
{
|
||||||
var actors = uim.GetUnitsAt(cell).Where(a => a != ignoreActor).ToArray();
|
|
||||||
// We can enter a cell with nonshareable units only if we can crush all of them
|
// We can enter a cell with nonshareable units only if we can crush all of them
|
||||||
if (mobileInfo.Crushes == null && actors.Length > 0)
|
if (mobileInfo.Crushes == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (actors.Length > 0 && actors.Any(a => !(a.HasTrait<ICrushable>() &&
|
if (blockingActors.Any(a => !(a.HasTrait<ICrushable>() &&
|
||||||
a.TraitsImplementing<ICrushable>().Any(b => b.CrushClasses.Intersect(mobileInfo.Crushes).Any()))))
|
a.TraitsImplementing<ICrushable>().Any(b => b.CrushClasses.Intersect(mobileInfo.Crushes).Any()))))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void FinishedMoving(Actor self)
|
public void FinishedMoving(Actor self)
|
||||||
{
|
{
|
||||||
var crushable = uim.GetUnitsAt(toCell).Where(a => a != self && a.HasTrait<ICrushable>());
|
var crushable = uim.GetUnitsAt(toCell).Where(a => a != self && a.HasTrait<ICrushable>());
|
||||||
foreach (var a in crushable)
|
foreach (var a in crushable)
|
||||||
@@ -282,7 +281,7 @@ namespace OpenRA.Traits
|
|||||||
return info.TerrainSpeeds[type].Cost;
|
return info.TerrainSpeeds[type].Cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual float MovementSpeedForCell(Actor self, int2 cell)
|
public float MovementSpeedForCell(Actor self, int2 cell)
|
||||||
{
|
{
|
||||||
var type = self.World.GetTerrainType(cell);
|
var type = self.World.GetTerrainType(cell);
|
||||||
|
|
||||||
@@ -304,12 +303,12 @@ namespace OpenRA.Traits
|
|||||||
return Enumerable.Reverse(move.path).Select( c => Util.CenterOfCell(c) );
|
return Enumerable.Reverse(move.path).Select( c => Util.CenterOfCell(c) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void AddInfluence()
|
public void AddInfluence()
|
||||||
{
|
{
|
||||||
uim.Add( self, this );
|
uim.Add( self, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void RemoveInfluence()
|
public void RemoveInfluence()
|
||||||
{
|
{
|
||||||
uim.Remove( self, this );
|
uim.Remove( self, this );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ namespace OpenRA.Traits
|
|||||||
var sp = self.TraitsImplementing<Production>().Where(p => p.Info.Produces.Contains(Info.Type)).FirstOrDefault();
|
var sp = self.TraitsImplementing<Production>().Where(p => p.Info.Produces.Contains(Info.Type)).FirstOrDefault();
|
||||||
if (sp != null && !IsDisabledBuilding(self) && sp.Produce(self, Rules.Info[ name ]))
|
if (sp != null && !IsDisabledBuilding(self) && sp.Produce(self, Rules.Info[ name ]))
|
||||||
FinishProduction();
|
FinishProduction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,26 +33,17 @@ namespace OpenRA.Mods.Cnc
|
|||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (--poisonTicks <= 0)
|
if (--poisonTicks > 0) return;
|
||||||
{
|
|
||||||
var rl = self.World.WorldActor.Trait<ResourceLayer>();
|
|
||||||
var r = rl.GetResource(self.Location);
|
|
||||||
|
|
||||||
if (r != null && info.Resources.Contains(r.info.Name))
|
var rl = self.World.WorldActor.Trait<ResourceLayer>();
|
||||||
Combat.DoImpacts(new ProjectileArgs
|
var r = rl.GetResource(self.Location);
|
||||||
{
|
if( r == null ) return;
|
||||||
src = self.CenterLocation.ToInt2(),
|
if( !info.Resources.Contains(r.info.Name) ) return;
|
||||||
dest = self.CenterLocation.ToInt2(),
|
|
||||||
srcAltitude = 0,
|
|
||||||
destAltitude = 0,
|
|
||||||
facing = 0,
|
|
||||||
firedBy = self,
|
|
||||||
target = Target.FromActor(self),
|
|
||||||
weapon = Rules.Weapons[info.Weapon.ToLowerInvariant()]
|
|
||||||
});
|
|
||||||
|
|
||||||
poisonTicks = Rules.Weapons[info.Weapon.ToLowerInvariant()].ROF;
|
var weapon = Rules.Weapons[info.Weapon.ToLowerInvariant()];
|
||||||
}
|
|
||||||
|
self.InflictDamage( self.World.WorldActor, weapon.Warheads[ 0 ].Damage, weapon.Warheads[ 0 ] );
|
||||||
|
poisonTicks = weapon.ROF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user