Further RA project cleanup

This commit is contained in:
penev92
2014-12-21 18:17:57 +02:00
parent 7c19f710b8
commit 681042caec
30 changed files with 53 additions and 35 deletions

View File

@@ -10,6 +10,7 @@
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;

View File

@@ -9,6 +9,7 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;

View File

@@ -10,6 +10,7 @@
using System.Drawing;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;

View File

@@ -8,11 +8,11 @@
*/
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;

View File

@@ -8,8 +8,8 @@
*/
#endregion
using System.Collections.Generic;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities

View File

@@ -11,7 +11,8 @@
using System.Collections.Generic;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
@@ -48,8 +49,4 @@ namespace OpenRA.Mods.RA.Activities
this);
}
}
[Desc("Can be targeted by the Hunt activity.")]
public class HuntableInfo : TraitInfo<Huntable> { }
public class Huntable { }
}

View File

@@ -10,6 +10,7 @@
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;

View File

@@ -11,8 +11,8 @@
using System;
using System.Collections.Generic;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;

View File

@@ -1,45 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2014 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 COPYING.
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
{
public class Turn : Activity
{
readonly IEnumerable<IDisableMove> moveDisablers;
readonly int desiredFacing;
public Turn(Actor self, int desiredFacing)
{
moveDisablers = self.TraitsImplementing<IDisableMove>();
this.desiredFacing = desiredFacing;
}
public override Activity Tick( Actor self )
{
if (IsCanceled)
return NextActivity;
if (moveDisablers.Any(d => d.MoveDisabled(self)))
return this;
var facing = self.Trait<IFacing>();
if( desiredFacing == facing.Facing )
return NextActivity;
facing.Facing = Util.TickFacing(facing.Facing, desiredFacing, facing.ROT);
return this;
}
}
}

View File

@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;

View File

@@ -1,70 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2014 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 COPYING.
*/
#endregion
using System;
using OpenRA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
{
public class Wait : Activity
{
int remainingTicks;
bool interruptable = true;
public Wait(int period) { remainingTicks = period; }
public Wait(int period, bool interruptable)
{
remainingTicks = period;
this.interruptable = interruptable;
}
public override Activity Tick(Actor self)
{
return (remainingTicks-- == 0) ? NextActivity : this;
}
public override void Cancel( Actor self )
{
if( !interruptable )
return;
remainingTicks = 0;
base.Cancel(self);
}
}
public class WaitFor : Activity
{
Func<bool> f;
bool interruptable = true;
public WaitFor(Func<bool> f) { this.f = f; }
public WaitFor(Func<bool> f, bool interruptable)
{
this.f = f;
this.interruptable = interruptable;
}
public override Activity Tick(Actor self)
{
return (f == null || f()) ? NextActivity : this;
}
public override void Cancel( Actor self )
{
if (!interruptable)
return;
f = null;
base.Cancel(self);
}
}
}