Fix Weapons factory
This commit is contained in:
@@ -7,6 +7,8 @@ namespace OpenRa.Traits
|
||||
public class ProductionInfo : ITraitInfo
|
||||
{
|
||||
public readonly int[] SpawnOffset = null;
|
||||
public readonly int[] ProductionOffset = null;
|
||||
public readonly int[] ExitOffset = null;
|
||||
public readonly string[] Produces = { };
|
||||
|
||||
public virtual object Create(Actor self) { return new Production(self); }
|
||||
@@ -21,9 +23,22 @@ namespace OpenRa.Traits
|
||||
|
||||
public virtual int2? CreationLocation( Actor self, ActorInfo producee )
|
||||
{
|
||||
return ( 1 / 24f * self.CenterLocation ).ToInt2();
|
||||
var pos = (1 / 24f * self.CenterLocation).ToInt2();
|
||||
var pi = self.Info.Traits.Get<ProductionInfo>();
|
||||
if (pi.ProductionOffset != null)
|
||||
pos += new int2(pi.ProductionOffset[0], pi.ProductionOffset[1]);
|
||||
return pos;
|
||||
}
|
||||
|
||||
public virtual int2? ExitLocation(Actor self, ActorInfo producee)
|
||||
{
|
||||
var pos = (1 / 24f * self.CenterLocation).ToInt2();
|
||||
var pi = self.Info.Traits.Get<ProductionInfo>();
|
||||
if (pi.ExitOffset != null)
|
||||
pos += new int2(pi.ExitOffset[0], pi.ExitOffset[1]);
|
||||
return pos;
|
||||
}
|
||||
|
||||
public virtual int CreationFacing( Actor self, Actor newUnit )
|
||||
{
|
||||
return newUnit.Info.Traits.GetOrDefault<UnitInfo>().InitialFacing;
|
||||
@@ -38,15 +53,22 @@ namespace OpenRa.Traits
|
||||
var newUnit = self.World.CreateActor( producee.Name, location.Value, self.Owner );
|
||||
newUnit.traits.Get<Unit>().Facing = CreationFacing( self, newUnit ); ;
|
||||
|
||||
var pi = self.Info.Traits.Get<ProductionInfo>();
|
||||
var rp = self.traits.GetOrDefault<RallyPoint>();
|
||||
if( rp != null )
|
||||
if( rp != null || pi.ExitOffset != null)
|
||||
{
|
||||
var mobile = newUnit.traits.GetOrDefault<Mobile>();
|
||||
if( mobile != null )
|
||||
newUnit.QueueActivity( new Activities.Move( rp.rallyPoint, 1 ) );
|
||||
{
|
||||
if (pi.ExitOffset != null)
|
||||
newUnit.QueueActivity(new Activities.Move(ExitLocation( self, producee).Value, 1));
|
||||
|
||||
if (rp != null)
|
||||
newUnit.QueueActivity( new Activities.Move( rp.rallyPoint, 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
var pi = self.Info.Traits.Get<ProductionInfo>();
|
||||
|
||||
if (pi != null && pi.SpawnOffset != null)
|
||||
newUnit.CenterLocation = self.CenterLocation
|
||||
+ new float2(pi.SpawnOffset[0], pi.SpawnOffset[1]);
|
||||
|
||||
@@ -59,9 +59,9 @@
|
||||
<sequence name="idle" start="0" />
|
||||
<sequence name="damaged-idle" start="1" />
|
||||
<sequence name="critical-idle" start="2" />
|
||||
<sequence name="build-top" start="0" length="4" src="weap2" />
|
||||
<sequence name="damaged-build-top" start="4" length="4" src="weap2" />
|
||||
<sequence name="critical-build-top" start="4" length="4" src="weap2" />
|
||||
<sequence name="build-top" start="0" length="10" src="weap2" />
|
||||
<sequence name="damaged-build-top" start="10" length="10" src="weap2" />
|
||||
<sequence name="critical-build-top" start="10" length="10" src="weap2" />
|
||||
<sequence name="idle-top" start="0" length="1" src="weap2" />
|
||||
<sequence name="damaged-idle-top" start="4" length="1" src="weap2" />
|
||||
<sequence name="critical-idle-top" start="4" length="1" src="weap2" />
|
||||
|
||||
@@ -167,7 +167,7 @@ WEAP:
|
||||
LongDesc: Assembly point for vehicle reinforcements
|
||||
Building:
|
||||
Power: -30
|
||||
Footprint: ___ xxx xxx
|
||||
Footprint: ___ xxx ===
|
||||
Dimensions: 3,3
|
||||
Capturable: true
|
||||
Bib: yes
|
||||
@@ -178,8 +178,8 @@ WEAP:
|
||||
RenderWarFactory:
|
||||
RallyPoint:
|
||||
Production:
|
||||
ExitOffset:-1,1
|
||||
Produces: Vehicle
|
||||
|
||||
HQ:
|
||||
RequiresPower:
|
||||
CanPowerDown:
|
||||
|
||||
Reference in New Issue
Block a user