Remove custom cnc behavior
This commit is contained in:
@@ -205,7 +205,6 @@
|
|||||||
<Compile Include="GameRules\MusicInfo.cs" />
|
<Compile Include="GameRules\MusicInfo.cs" />
|
||||||
<Compile Include="Widgets\ImageWidget.cs" />
|
<Compile Include="Widgets\ImageWidget.cs" />
|
||||||
<Compile Include="Traits\SharesCell.cs" />
|
<Compile Include="Traits\SharesCell.cs" />
|
||||||
<Compile Include="Traits\World\AircraftInfluence.cs" />
|
|
||||||
<Compile Include="Widgets\TextFieldWidget.cs" />
|
<Compile Include="Widgets\TextFieldWidget.cs" />
|
||||||
<Compile Include="Widgets\ChatDisplayWidget.cs" />
|
<Compile Include="Widgets\ChatDisplayWidget.cs" />
|
||||||
<Compile Include="Widgets\Delegates\MapChooserDelegate.cs" />
|
<Compile Include="Widgets\Delegates\MapChooserDelegate.cs" />
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation. For more information,
|
|
||||||
* see LICENSE.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using OpenRA.FileFormats;
|
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
|
||||||
{
|
|
||||||
public class AircraftInfluenceInfo : ITraitInfo
|
|
||||||
{
|
|
||||||
public object Create( ActorInitializer init ) { return new AircraftInfluence( init.world ); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AircraftInfluence : ITick
|
|
||||||
{
|
|
||||||
List<Actor>[,] influence;
|
|
||||||
Map map;
|
|
||||||
|
|
||||||
public AircraftInfluence( World world )
|
|
||||||
{
|
|
||||||
map = world.Map;
|
|
||||||
influence = new List<Actor>[world.Map.MapSize.X, world.Map.MapSize.Y];
|
|
||||||
for (int i = 0; i < world.Map.MapSize.X; i++)
|
|
||||||
for (int j = 0; j < world.Map.MapSize.Y; j++)
|
|
||||||
influence[ i, j ] = new List<Actor>();
|
|
||||||
|
|
||||||
world.ActorRemoved += a => Remove( a, a.traits.GetOrDefault<IOccupyAir>() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Tick( Actor self )
|
|
||||||
{
|
|
||||||
SanityCheck( self );
|
|
||||||
}
|
|
||||||
|
|
||||||
[Conditional( "SANITY_CHECKS" )]
|
|
||||||
void SanityCheck( Actor self )
|
|
||||||
{
|
|
||||||
for( int x = 0 ; x < self.World.Map.MapSize.X ; x++ )
|
|
||||||
for( int y = 0 ; y < self.World.Map.MapSize.Y ; y++ )
|
|
||||||
if( influence[ x, y ] != null )
|
|
||||||
foreach (var a in influence[ x, y ])
|
|
||||||
if (!a.traits.Get<IOccupyAir>().OccupiedAirCells().Contains( new int2( x, y ) ) )
|
|
||||||
throw new InvalidOperationException( "AIM: Sanity check failed A" );
|
|
||||||
|
|
||||||
foreach( var t in self.World.Queries.WithTraitMultiple<IOccupyAir>() )
|
|
||||||
foreach( var cell in t.Trait.OccupiedAirCells() )
|
|
||||||
if (!influence[cell.X, cell.Y].Contains(t.Actor))
|
|
||||||
throw new InvalidOperationException( "AIM: Sanity check failed B" );
|
|
||||||
}
|
|
||||||
|
|
||||||
Actor[] noActors = { };
|
|
||||||
public IEnumerable<Actor> GetUnitsAt( int2 a )
|
|
||||||
{
|
|
||||||
if (!map.IsInMap(a)) return noActors;
|
|
||||||
return influence[ a.X, a.Y ];
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Add( Actor self, IOccupyAir unit )
|
|
||||||
{
|
|
||||||
foreach( var c in unit.OccupiedAirCells() )
|
|
||||||
influence[c.X, c.Y].Add(self);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Remove( Actor self, IOccupyAir unit )
|
|
||||||
{
|
|
||||||
if (unit != null)
|
|
||||||
foreach (var c in unit.OccupiedAirCells())
|
|
||||||
influence[c.X, c.Y].Remove(self);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Update(Actor self, IOccupyAir unit)
|
|
||||||
{
|
|
||||||
Remove(self, unit);
|
|
||||||
if (!self.IsDead()) Add(self, unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation. For more information,
|
|
||||||
* see LICENSE.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
|
||||||
{
|
|
||||||
public class MobileAirInfo : MobileInfo
|
|
||||||
{
|
|
||||||
public readonly int CruiseAltitude = 20;
|
|
||||||
public readonly float InstabilityMagnitude = 2.0f;
|
|
||||||
public readonly int InstabilityTicks = 5;
|
|
||||||
public readonly bool LandWhenIdle = true;
|
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new MobileAir(init, this); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MobileAir : Mobile, ITick, IOccupyAir
|
|
||||||
{
|
|
||||||
MobileAirInfo AirInfo;
|
|
||||||
public MobileAir (ActorInitializer init, MobileAirInfo info)
|
|
||||||
: base(init, info)
|
|
||||||
{
|
|
||||||
AirInfo = info;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void AddInfluence()
|
|
||||||
{
|
|
||||||
self.World.WorldActor.traits.Get<AircraftInfluence>().Add( self, this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void RemoveInfluence()
|
|
||||||
{
|
|
||||||
self.World.WorldActor.traits.Get<AircraftInfluence>().Remove( self, this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanEnterCell(int2 p, Actor ignoreBuilding, bool checkTransientActors)
|
|
||||||
{
|
|
||||||
if (!checkTransientActors)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return self.World.WorldActor.traits.Get<AircraftInfluence>().GetUnitsAt(p).Count() == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void FinishedMoving(Actor self) {}
|
|
||||||
|
|
||||||
public override float MovementCostForCell(Actor self, int2 cell)
|
|
||||||
{
|
|
||||||
return (!self.World.Map.IsInMap(cell.X,cell.Y)) ? float.PositiveInfinity : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override float MovementSpeedForCell(Actor self, int2 cell)
|
|
||||||
{
|
|
||||||
var modifier = self.traits
|
|
||||||
.WithInterface<ISpeedModifier>()
|
|
||||||
.Select(t => t.GetSpeedModifier())
|
|
||||||
.Product();
|
|
||||||
return Info.Speed * modifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IEnumerable<int2> OccupiedCells()
|
|
||||||
{
|
|
||||||
// Todo: do the right thing when landed
|
|
||||||
return new int2[] {};
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<int2> OccupiedAirCells()
|
|
||||||
{
|
|
||||||
return (fromCell == toCell)
|
|
||||||
? new[] { fromCell }
|
|
||||||
: CanEnterCell(toCell)
|
|
||||||
? new[] { toCell }
|
|
||||||
: new[] { fromCell, toCell };
|
|
||||||
}
|
|
||||||
|
|
||||||
int offsetTicks = 0;
|
|
||||||
public void Tick(Actor self)
|
|
||||||
{
|
|
||||||
var move = self.traits.Get<IMove>();
|
|
||||||
//if (unit.Altitude <= 0)
|
|
||||||
// return;
|
|
||||||
|
|
||||||
if (move.Altitude < AirInfo.CruiseAltitude)
|
|
||||||
move.Altitude++;
|
|
||||||
|
|
||||||
if (--offsetTicks <= 0)
|
|
||||||
{
|
|
||||||
self.CenterLocation += AirInfo.InstabilityMagnitude * self.World.SharedRandom.Gauss2D(5);
|
|
||||||
move.Altitude += (int)(AirInfo.InstabilityMagnitude * self.World.SharedRandom.Gauss1D(5));
|
|
||||||
offsetTicks = AirInfo.InstabilityTicks;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -58,7 +58,6 @@
|
|||||||
<Compile Include="ProductionAirdrop.cs" />
|
<Compile Include="ProductionAirdrop.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="TiberiumRefineryDockAction.cs" />
|
<Compile Include="TiberiumRefineryDockAction.cs" />
|
||||||
<Compile Include="MobileAir.cs" />
|
|
||||||
<Compile Include="DeadBuildingState.cs" />
|
<Compile Include="DeadBuildingState.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -51,12 +51,13 @@
|
|||||||
TargetTypes: Air
|
TargetTypes: Air
|
||||||
Selectable:
|
Selectable:
|
||||||
Voice: VehicleVoice
|
Voice: VehicleVoice
|
||||||
|
Helicopter:
|
||||||
|
RepairBuildings: hpad
|
||||||
|
RearmBuildings:
|
||||||
|
LandWhenIdle: false
|
||||||
HiddenUnderFog:
|
HiddenUnderFog:
|
||||||
GainsExperience:
|
GainsExperience:
|
||||||
GivesExperience:
|
GivesExperience:
|
||||||
MobileAir:
|
|
||||||
TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River
|
|
||||||
TerrainSpeeds: 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%
|
|
||||||
DrawLineToTarget:
|
DrawLineToTarget:
|
||||||
ActorLostNotification:
|
ActorLostNotification:
|
||||||
Notification: unitlost.aud
|
Notification: unitlost.aud
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ HPAD:
|
|||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 5
|
Range: 5
|
||||||
Bib:
|
Bib:
|
||||||
Production:
|
ProducesHelicopters:
|
||||||
SpawnOffset: 0,-4
|
SpawnOffset: 0,-4
|
||||||
Produces: Plane
|
Produces: Plane
|
||||||
BelowUnits:
|
BelowUnits:
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ World:
|
|||||||
# WaterPaletteRotation:
|
# WaterPaletteRotation:
|
||||||
BuildingInfluence:
|
BuildingInfluence:
|
||||||
UnitInfluence:
|
UnitInfluence:
|
||||||
AircraftInfluence:
|
|
||||||
BridgeLayer:
|
BridgeLayer:
|
||||||
Bridges: bridge1, bridge2, bridge3, bridge4
|
Bridges: bridge1, bridge2, bridge3, bridge4
|
||||||
PaletteFromCurrentTheatre:
|
PaletteFromCurrentTheatre:
|
||||||
|
|||||||
@@ -400,8 +400,8 @@ TRAN:
|
|||||||
Cost: 1500
|
Cost: 1500
|
||||||
Description: Chinook Transport
|
Description: Chinook Transport
|
||||||
LongDesc: Fast Infantry Transport Helicopter.\n Unarmed
|
LongDesc: Fast Infantry Transport Helicopter.\n Unarmed
|
||||||
MobileAir:
|
Helicopter:
|
||||||
InitialFacing: 20
|
LandWhenIdle: true
|
||||||
ROT: 5
|
ROT: 5
|
||||||
Speed: 15
|
Speed: 15
|
||||||
Health:
|
Health:
|
||||||
@@ -428,8 +428,7 @@ HELI:
|
|||||||
Cost: 1200
|
Cost: 1200
|
||||||
Description: Apache Longbow
|
Description: Apache Longbow
|
||||||
LongDesc: Helicopter Gunship with AG Missiles.\n Strong vs Buildings, Tanks\n Weak vs Infantry
|
LongDesc: Helicopter Gunship with AG Missiles.\n Strong vs Buildings, Tanks\n Weak vs Infantry
|
||||||
MobileAir:
|
Helicopter:
|
||||||
InitialFacing: 20
|
|
||||||
ROT: 4
|
ROT: 4
|
||||||
Speed: 20
|
Speed: 20
|
||||||
Health:
|
Health:
|
||||||
@@ -437,7 +436,7 @@ HELI:
|
|||||||
Armor: heavy
|
Armor: heavy
|
||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 8
|
Range: 8
|
||||||
AttackBase:
|
AttackHeli:
|
||||||
PrimaryWeapon: HighV
|
PrimaryWeapon: HighV
|
||||||
SecondaryWeapon: HighV
|
SecondaryWeapon: HighV
|
||||||
PrimaryOffset: -5,0,0,2
|
PrimaryOffset: -5,0,0,2
|
||||||
@@ -457,8 +456,7 @@ ORCA:
|
|||||||
Cost: 1200
|
Cost: 1200
|
||||||
Description: Orca
|
Description: Orca
|
||||||
LongDesc: Helicopter Gunship with AG Missiles.\n Strong vs Buildings, Tanks\n Weak vs Infantry
|
LongDesc: Helicopter Gunship with AG Missiles.\n Strong vs Buildings, Tanks\n Weak vs Infantry
|
||||||
MobileAir:
|
Helicopter:
|
||||||
InitialFacing: 20
|
|
||||||
ROT: 4
|
ROT: 4
|
||||||
Speed: 20
|
Speed: 20
|
||||||
Health:
|
Health:
|
||||||
@@ -466,7 +464,7 @@ ORCA:
|
|||||||
Armor: heavy
|
Armor: heavy
|
||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 8
|
Range: 8
|
||||||
AttackBase:
|
AttackHeli:
|
||||||
PrimaryWeapon: Rockets.Orca
|
PrimaryWeapon: Rockets.Orca
|
||||||
SecondaryWeapon: Rockets.Orca
|
SecondaryWeapon: Rockets.Orca
|
||||||
PrimaryOffset: -5,0,0,2
|
PrimaryOffset: -5,0,0,2
|
||||||
|
|||||||
Reference in New Issue
Block a user