Restore cnc helicopters (reservable etc changes deferred)
This commit is contained in:
@@ -24,46 +24,48 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
public ProducesHelicopters(ProducesHelicoptersInfo info) : base(info) {}
|
||||
|
||||
/*
|
||||
|
||||
// Hack around visibility bullshit in Production
|
||||
public override bool Produce( Actor self, ActorInfo producee )
|
||||
{
|
||||
var location = CreationLocation( self, producee );
|
||||
if( location == null || self.World.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt( location.Value ).Any() )
|
||||
return false;
|
||||
// Pick an exit that we can move to
|
||||
var exit = int2.Zero;
|
||||
var spawn = float2.Zero;
|
||||
var success = false;
|
||||
|
||||
var pi = self.Info.Traits.Get<ProductionInfo>();
|
||||
// Pick a spawn/exit point
|
||||
// Todo: Reorder in a synced random way
|
||||
foreach (var s in Spawns)
|
||||
{
|
||||
exit = self.Location + s.Value;
|
||||
spawn = self.CenterLocation + s.Key;
|
||||
if (!self.World.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt( exit ).Any())
|
||||
{
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Todo: Once Helicopter supports it, update UIM if its docked/landed
|
||||
var newUnit = self.World.CreateActor( producee.Name, new TypeDictionary
|
||||
{
|
||||
new LocationInit( location.Value ),
|
||||
new LocationInit( exit ),
|
||||
new OwnerInit( self.Owner ),
|
||||
new FacingInit( pi.ProductionFacing ),
|
||||
});
|
||||
|
||||
newUnit.CenterLocation = spawn;
|
||||
|
||||
var rp = self.traits.GetOrDefault<RallyPoint>();
|
||||
if( rp != null || pi.ExitOffset != null)
|
||||
if( rp != null )
|
||||
{
|
||||
if( newUnit.traits.Contains<Helicopter>() )
|
||||
{
|
||||
if (pi.ExitOffset != null)
|
||||
newUnit.QueueActivity(new Activities.HeliFly(Util.CenterOfCell(ExitLocation( self, producee ).Value)));
|
||||
|
||||
if (rp != null)
|
||||
newUnit.QueueActivity( new Activities.HeliFly( Util.CenterOfCell(rp.rallyPoint)) );
|
||||
}
|
||||
newUnit.QueueActivity( new Activities.HeliFly( Util.CenterOfCell(rp.rallyPoint)) );
|
||||
}
|
||||
|
||||
if (pi != null && pi.SpawnOffset != null)
|
||||
newUnit.CenterLocation = self.CenterLocation
|
||||
+ new float2(pi.SpawnOffset[0], pi.SpawnOffset[1]);
|
||||
|
||||
foreach (var t in self.traits.WithInterface<INotifyProduction>())
|
||||
t.UnitProduced(self, newUnit);
|
||||
|
||||
Log.Write("debug", "{0} #{1} produced by {2} #{3}", newUnit.Info.Name, newUnit.ActorID, self.Info.Name, self.ActorID);
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,6 +340,7 @@ HPAD:
|
||||
Bib:
|
||||
ProducesHelicopters:
|
||||
SpawnOffsets: 0,-4
|
||||
ExitCells: 0,0
|
||||
Produces: Plane
|
||||
BelowUnits:
|
||||
Reservable:
|
||||
|
||||
Reference in New Issue
Block a user