Make infantry crushable, refactoring, fix UIM (in)sanity crash, fix unit production
This commit is contained in:
@@ -28,7 +28,7 @@ namespace OpenRa.Game.Traits
|
|||||||
public IEnumerable<UnitMovementType> CrushableBy()
|
public IEnumerable<UnitMovementType> CrushableBy()
|
||||||
{
|
{
|
||||||
yield return UnitMovementType.Track;
|
yield return UnitMovementType.Track;
|
||||||
yield return UnitMovementType.Wheel;
|
//yield return UnitMovementType.Wheel; // Can infantry be crushed by wheel?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,31 +84,16 @@ namespace OpenRa.Game.Traits
|
|||||||
{
|
{
|
||||||
if (Game.BuildingInfluence.GetBuildingAt(a) != null) return false;
|
if (Game.BuildingInfluence.GetBuildingAt(a) != null) return false;
|
||||||
|
|
||||||
var actors = Game.UnitInfluence.GetUnitsAt(a);
|
|
||||||
var crushable = true;
|
var crushable = true;
|
||||||
foreach (Actor actor in actors)
|
foreach (Actor actor in Game.UnitInfluence.GetUnitsAt(a))
|
||||||
{
|
{
|
||||||
if (actor == self) continue;
|
if (actor == self) continue;
|
||||||
|
|
||||||
var c = actor.traits.WithInterface<ICrushable>();
|
if (!Game.IsActorCrushableByActor(actor, self))
|
||||||
if (c == null)
|
|
||||||
{
|
{
|
||||||
crushable = false;
|
crushable = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var crush in c)
|
|
||||||
{
|
|
||||||
// TODO: Unhack this. I can't wrap my head around this right now...
|
|
||||||
if (!(((crush.IsCrushableByEnemy() && actor.Owner != Game.LocalPlayer) || (crush.IsCrushableByFriend() && actor.Owner == Game.LocalPlayer))
|
|
||||||
&& crush.CrushableBy().Contains(GetMovementType())))
|
|
||||||
{
|
|
||||||
crushable = false;
|
|
||||||
Log.Write("{0} is NOT crushable by {1} (mobile)", actor.Info.Name, self.Info.Name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Log.Write("{0} is crushable by {1} (mobile)", actor.Info.Name, self.Info.Name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!crushable) return false;
|
if (!crushable) return false;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRa.Game.Traits
|
|||||||
public bool Produce( Actor self, UnitInfo producee )
|
public bool Produce( Actor self, UnitInfo producee )
|
||||||
{
|
{
|
||||||
var location = CreationLocation( self, producee );
|
var location = CreationLocation( self, producee );
|
||||||
if( location == null || !Game.UnitInfluence.GetUnitsAt( location.Value ).Any() )
|
if( location == null || Game.UnitInfluence.GetUnitsAt( location.Value ).Any() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var newUnit = new Actor( producee, location.Value, self.Owner );
|
var newUnit = new Actor( producee, location.Value, self.Owner );
|
||||||
|
|||||||
@@ -46,9 +46,11 @@ namespace OpenRa.Game
|
|||||||
[Conditional( "SANITY_CHECKS" )]
|
[Conditional( "SANITY_CHECKS" )]
|
||||||
void SanityCheckAdd( IOccupySpace a )
|
void SanityCheckAdd( IOccupySpace a )
|
||||||
{
|
{
|
||||||
|
/* This check is too strict now that we can have multiple units in a cell
|
||||||
foreach( var c in a.OccupiedCells() )
|
foreach( var c in a.OccupiedCells() )
|
||||||
if( influence[c.X, c.Y].Any())
|
if( influence[c.X, c.Y].Any())
|
||||||
throw new InvalidOperationException( "UIM: Sanity check failed (Add)" );
|
throw new InvalidOperationException( "UIM: Sanity check failed (Add)" );
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Actor> GetUnitsAt( int2 a )
|
public IEnumerable<Actor> GetUnitsAt( int2 a )
|
||||||
|
|||||||
20
units.ini
20
units.ini
@@ -522,52 +522,52 @@ MEDI
|
|||||||
Description=Attack Dog
|
Description=Attack Dog
|
||||||
BuiltAt=KENN
|
BuiltAt=KENN
|
||||||
Voice=DogVoice
|
Voice=DogVoice
|
||||||
Traits=Unit, Mobile, RenderInfantry
|
Traits=Unit, Mobile, RenderInfantry, Infantry
|
||||||
LongDesc=Anti-infantry unit. Not fooled by the \nSpy's disguise.\n Strong vs Infantry\n Weak vs Vehicles
|
LongDesc=Anti-infantry unit. Not fooled by the \nSpy's disguise.\n Strong vs Infantry\n Weak vs Vehicles
|
||||||
[E1]
|
[E1]
|
||||||
Description=Rifle Infantry
|
Description=Rifle Infantry
|
||||||
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover
|
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry
|
||||||
LongDesc=General-purpose infantry. Strong vs Infantry\n Weak vs Vehicles
|
LongDesc=General-purpose infantry. Strong vs Infantry\n Weak vs Vehicles
|
||||||
[E2]
|
[E2]
|
||||||
Description=Grenadier
|
Description=Grenadier
|
||||||
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover
|
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry
|
||||||
FireDelay=15
|
FireDelay=15
|
||||||
PrimaryOffset=0,0,0,-13
|
PrimaryOffset=0,0,0,-13
|
||||||
LongDesc=Infantry armed with grenades. \n Strong vs Buildings, Infantry\n Weak vs Vehicles
|
LongDesc=Infantry armed with grenades. \n Strong vs Buildings, Infantry\n Weak vs Vehicles
|
||||||
[E3]
|
[E3]
|
||||||
Description=Rocket Soldier
|
Description=Rocket Soldier
|
||||||
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover
|
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry
|
||||||
PrimaryOffset=0,0,0,-13
|
PrimaryOffset=0,0,0,-13
|
||||||
LongDesc=Anti-tank/Anti-aircraft infantry.\n Strong vs Tanks, Aircraft\n Weak vs Infantry
|
LongDesc=Anti-tank/Anti-aircraft infantry.\n Strong vs Tanks, Aircraft\n Weak vs Infantry
|
||||||
[E4]
|
[E4]
|
||||||
Description=Flamethrower
|
Description=Flamethrower
|
||||||
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover
|
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry
|
||||||
FireDelay=8
|
FireDelay=8
|
||||||
LongDesc=Advanced Anti-infantry unit.\n Strong vs Infantry, Buildings\n Weak vs Vehicles
|
LongDesc=Advanced Anti-infantry unit.\n Strong vs Infantry, Buildings\n Weak vs Vehicles
|
||||||
[E6]
|
[E6]
|
||||||
Description=Engineer
|
Description=Engineer
|
||||||
Traits=Unit, Mobile, RenderInfantry, TakeCover
|
Traits=Unit, Mobile, RenderInfantry, TakeCover, Infantry
|
||||||
Voice=EngineerVoice
|
Voice=EngineerVoice
|
||||||
LongDesc=Infiltrates and captures enemy structures.\n Strong vs Nothing\n Weak vs Everything
|
LongDesc=Infiltrates and captures enemy structures.\n Strong vs Nothing\n Weak vs Everything
|
||||||
[SPY]
|
[SPY]
|
||||||
Description=Spy
|
Description=Spy
|
||||||
Voice=SpyVoice
|
Voice=SpyVoice
|
||||||
Traits=Unit, Mobile, RenderInfantry, TakeCover
|
Traits=Unit, Mobile, RenderInfantry, TakeCover, Infantry
|
||||||
LongDesc=Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised
|
LongDesc=Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised
|
||||||
[THF]
|
[THF]
|
||||||
Description=Thief
|
Description=Thief
|
||||||
Voice=ThiefVoice
|
Voice=ThiefVoice
|
||||||
Traits=Unit, Mobile, RenderInfantry, TakeCover
|
Traits=Unit, Mobile, RenderInfantry, TakeCover, Infantry
|
||||||
LongDesc=Infiltrates enemy refineries & \nsilos, and steals money stored there.\n Unarmed
|
LongDesc=Infiltrates enemy refineries & \nsilos, and steals money stored there.\n Unarmed
|
||||||
[E7]
|
[E7]
|
||||||
Description=Tanya
|
Description=Tanya
|
||||||
Voice=TanyaVoice
|
Voice=TanyaVoice
|
||||||
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover
|
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry
|
||||||
LongDesc=Elite commando infantry, armed with \ndual pistols and C4.\n Strong vs Infantry, Buildings\n Weak vs Vehicles\n Special Ability: Destroy Building with C4
|
LongDesc=Elite commando infantry, armed with \ndual pistols and C4.\n Strong vs Infantry, Buildings\n Weak vs Vehicles\n Special Ability: Destroy Building with C4
|
||||||
[MEDI]
|
[MEDI]
|
||||||
Description=Medic
|
Description=Medic
|
||||||
Voice=MedicVoice
|
Voice=MedicVoice
|
||||||
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover
|
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry
|
||||||
LongDesc=Heals nearby infantry.\n Strong vs Nothing\n Weak vs Everything
|
LongDesc=Heals nearby infantry.\n Strong vs Nothing\n Weak vs Everything
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user