Actor.traits is implementation detail
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
#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 OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Traits.Activities;
|
||||
#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 OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Traits.Activities;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
@@ -24,31 +24,31 @@ namespace OpenRA.Mods.RA
|
||||
Actor dockedHarv = null;
|
||||
public void OnDock(Actor self, Actor harv, DeliverResources dockOrder)
|
||||
{
|
||||
var harvester = harv.traits.Get<Harvester>();
|
||||
var harvester = harv.Trait<Harvester>();
|
||||
|
||||
if (harv.traits.Get<IFacing>().Facing != 64)
|
||||
if (harv.Trait<IFacing>().Facing != 64)
|
||||
harv.QueueActivity (new Turn (64));
|
||||
|
||||
harv.QueueActivity (new CallFunc (() =>
|
||||
{
|
||||
dockedHarv = harv;
|
||||
var renderUnit = harv.traits.Get<RenderUnit> ();
|
||||
var renderUnit = harv.Trait<RenderUnit> ();
|
||||
if (renderUnit.anim.CurrentSequence.Name != "empty")
|
||||
renderUnit.PlayCustomAnimation (harv, "empty", () =>
|
||||
{
|
||||
harvester.Deliver(harv, self);
|
||||
harv.QueueActivity( new CallFunc( () => dockedHarv = null, false ) );
|
||||
|
||||
if (harvester.LastHarvestedCell != int2.Zero)
|
||||
if (harvester.LastHarvestedCell != int2.Zero)
|
||||
{
|
||||
harv.QueueActivity( new Move(harvester.LastHarvestedCell, 5) );
|
||||
if (harv.Owner == self.World.LocalPlayer)
|
||||
self.World.AddFrameEndTask( w =>
|
||||
{
|
||||
var line = harv.traits.GetOrDefault<DrawLineToTarget>();
|
||||
if (line != null)
|
||||
line.SetTargetSilently(harv, Target.FromCell(harvester.LastHarvestedCell), Color.Green);
|
||||
});
|
||||
harv.QueueActivity( new Move(harvester.LastHarvestedCell, 5) );
|
||||
if (harv.Owner == self.World.LocalPlayer)
|
||||
self.World.AddFrameEndTask( w =>
|
||||
{
|
||||
var line = harv.TraitOrDefault<DrawLineToTarget>();
|
||||
if (line != null)
|
||||
line.SetTargetSilently(harv, Target.FromCell(harvester.LastHarvestedCell), Color.Green);
|
||||
});
|
||||
}
|
||||
harv.QueueActivity( new Harvest() );
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user