rally point actually works now for WEAP

This commit is contained in:
Chris Forbes
2009-11-09 19:00:47 +13:00
parent 53db5eb491
commit f04a402d7e
3 changed files with 9 additions and 2 deletions

View File

@@ -330,7 +330,11 @@ namespace OpenRa.Game
unit = new Actor(name, (1 / 24f * producer.CenterLocation).ToInt2(), player); unit = new Actor(name, (1 / 24f * producer.CenterLocation).ToInt2(), player);
var mobile = unit.traits.Get<Mobile>(); var mobile = unit.traits.Get<Mobile>();
mobile.facing = 128; mobile.facing = 128;
mobile.QueueActivity(new Traits.Activities.Move(unit.Location + new int2(0, 3), 1));
var rp = producer.traits.GetOrDefault<RallyPoint>();
var dest = rp != null ? rp.rallyPoint : (unit.Location + new int2(0, 3));
mobile.QueueActivity(new Traits.Activities.Move(dest, 1));
} }
world.Add( unit ); world.Add( unit );

View File

@@ -97,6 +97,7 @@ namespace OpenRa.Game.GameRules
public readonly bool Repairable = true; public readonly bool Repairable = true;
public readonly int Storage = 0; public readonly int Storage = 0;
public readonly bool Unsellable = false; public readonly bool Unsellable = false;
public readonly int[] DefaultRallyPoint = { 1, 3 };
public BuildingInfo(string name) : base(name) { } public BuildingInfo(string name) : base(name) { }
} }

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using IjwFramework.Types; using IjwFramework.Types;
using OpenRa.Game.Graphics; using OpenRa.Game.Graphics;
using OpenRa.Game.GameRules;
namespace OpenRa.Game.Traits namespace OpenRa.Game.Traits
{ {
@@ -14,7 +15,8 @@ namespace OpenRa.Game.Traits
public RallyPoint(Actor self) public RallyPoint(Actor self)
{ {
rallyPoint = self.Location + new int2(1, 3); //self.unitInfo.RallyPoint; var bi = (UnitInfo.BuildingInfo)self.unitInfo;
rallyPoint = self.Location + new int2(bi.DefaultRallyPoint[0], bi.DefaultRallyPoint[1]);
anim = new Animation("flagfly"); anim = new Animation("flagfly");
anim.PlayRepeating("idle"); anim.PlayRepeating("idle");
} }