Compare commits
16 Commits
devtest-20
...
devtest-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b73210f706 | ||
|
|
a111f1299c | ||
|
|
d21e52b33c | ||
|
|
4e6912a22c | ||
|
|
80c2ac1350 | ||
|
|
776894445b | ||
|
|
a4369dc804 | ||
|
|
ae35880900 | ||
|
|
9900dc47d2 | ||
|
|
4d251d6fc3 | ||
|
|
e226eb2ae5 | ||
|
|
cf2d4b24e2 | ||
|
|
a160797f71 | ||
|
|
7c96b69303 | ||
|
|
2b50d99a62 | ||
|
|
f0d910357d |
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
@@ -30,9 +28,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Chance (out of 100) the unit has to enter panic mode when attacking.")]
|
||||
public readonly int AttackPanicChance = 20;
|
||||
|
||||
[Desc("The terrain types that this actor should avoid running on to while panicing.")]
|
||||
public readonly HashSet<string> AvoidTerrainTypes = new HashSet<string>();
|
||||
|
||||
[SequenceReference(prefix: true)]
|
||||
public readonly string PanicSequencePrefix = "panic-";
|
||||
|
||||
@@ -44,7 +39,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly ScaredyCatInfo info;
|
||||
readonly Mobile mobile;
|
||||
readonly Actor self;
|
||||
readonly Func<CPos, bool> avoidTerrainFilter;
|
||||
|
||||
[Sync]
|
||||
int panicStartedTick;
|
||||
@@ -58,9 +52,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
this.self = self;
|
||||
this.info = info;
|
||||
mobile = self.Trait<Mobile>();
|
||||
|
||||
if (info.AvoidTerrainTypes.Count > 0)
|
||||
avoidTerrainFilter = c => info.AvoidTerrainTypes.Contains(self.World.Map.GetTerrainInfo(c).Type);
|
||||
}
|
||||
|
||||
public void Panic()
|
||||
@@ -88,10 +79,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!Panicking)
|
||||
return;
|
||||
|
||||
// Note: This is just a modified copy of Mobile.Nudge
|
||||
var cell = mobile.GetAdjacentCell(self.Location, avoidTerrainFilter);
|
||||
if (cell != null)
|
||||
self.QueueActivity(false, mobile.MoveTo(cell.Value, 0));
|
||||
mobile.Nudge(self);
|
||||
}
|
||||
|
||||
void INotifyDamage.Damaged(Actor self, AttackInfo e)
|
||||
|
||||
@@ -364,14 +364,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.QueueActivity(false, MoveTo(cell.Value, 0));
|
||||
}
|
||||
|
||||
public CPos? GetAdjacentCell(CPos nextCell, Func<CPos, bool> preferToAvoid = null)
|
||||
public CPos? GetAdjacentCell(CPos nextCell)
|
||||
{
|
||||
var availCells = new List<CPos>();
|
||||
var notStupidCells = new List<CPos>();
|
||||
foreach (CVec direction in CVec.Directions)
|
||||
{
|
||||
var p = ToCell + direction;
|
||||
if (CanEnterCell(p) && CanStayInCell(p) && (preferToAvoid == null || !preferToAvoid(p)))
|
||||
if (CanEnterCell(p) && CanStayInCell(p))
|
||||
availCells.Add(p);
|
||||
else if (p != nextCell && p != ToCell)
|
||||
notStupidCells.Add(p);
|
||||
|
||||
@@ -148,12 +148,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
void INotifyAttack.PreparingAttack(Actor self, in Target target, Armament a, Barrel barrel)
|
||||
{
|
||||
// Lambdas can't use 'in' variables, so capture a copy for later
|
||||
var attackTarget = target;
|
||||
|
||||
// HACK: The FrameEndTask makes sure that this runs after Tick(), preventing that from
|
||||
// overriding the animation when an infantry unit stops to attack
|
||||
self.World.AddFrameEndTask(_ => Attacking(self, attackTarget, a));
|
||||
Attacking(self, target, a);
|
||||
}
|
||||
|
||||
void INotifyAttack.Attacking(Actor self, in Target target, Armament a, Barrel barrel) { }
|
||||
@@ -165,6 +160,10 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
protected virtual void Tick(Actor self)
|
||||
{
|
||||
// Attacking takes care of reverting back to PlayStandAnimation
|
||||
if (state == AnimationState.Attacking)
|
||||
return;
|
||||
|
||||
if (rsm != null)
|
||||
{
|
||||
if (wasModifying != rsm.IsModifyingSequence)
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
@@ -29,9 +27,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Maximum amount of ticks the actor will sit idly before starting to wander.")]
|
||||
public readonly int MaxMoveDelay = 0;
|
||||
|
||||
[Desc("The terrain types that this actor should avoid wandering on to.")]
|
||||
public readonly HashSet<string> AvoidTerrainTypes = new HashSet<string>();
|
||||
|
||||
public override object Create(ActorInitializer init) { return new Wanders(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -80,8 +75,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
var targetCell = PickTargetLocation();
|
||||
if (targetCell.HasValue)
|
||||
DoAction(self, targetCell.Value);
|
||||
if (targetCell != CPos.Zero)
|
||||
DoAction(self, targetCell);
|
||||
}
|
||||
|
||||
void INotifyIdle.TickIdle(Actor self)
|
||||
@@ -89,7 +84,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
TickIdle(self);
|
||||
}
|
||||
|
||||
CPos? PickTargetLocation()
|
||||
CPos PickTargetLocation()
|
||||
{
|
||||
var target = self.CenterPosition + new WVec(0, -1024 * effectiveMoveRadius, 0).Rotate(WRot.FromFacing(self.World.SharedRandom.Next(255)));
|
||||
var targetCell = self.World.Map.CellContaining(target);
|
||||
@@ -100,14 +95,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (++ticksIdle % info.ReduceMoveRadiusDelay == 0)
|
||||
effectiveMoveRadius--;
|
||||
|
||||
return null; // We'll be back the next tick; better to sit idle for a few seconds than prolong this tick indefinitely with a loop
|
||||
}
|
||||
|
||||
if (info.AvoidTerrainTypes.Count > 0)
|
||||
{
|
||||
var terrainType = self.World.Map.GetTerrainInfo(targetCell).Type;
|
||||
if (Info.AvoidTerrainTypes.Contains(terrainType))
|
||||
return null;
|
||||
return CPos.Zero; // We'll be back the next tick; better to sit idle for a few seconds than prolong this tick indefinitely with a loop
|
||||
}
|
||||
|
||||
ticksIdle = 0;
|
||||
|
||||
@@ -468,7 +468,6 @@
|
||||
Notification: CivilianKilled
|
||||
NotifyAll: true
|
||||
ScaredyCat:
|
||||
AvoidTerrainTypes: Tiberium, BlueTiberium
|
||||
Crushable:
|
||||
CrushSound: squish2.aud
|
||||
Voiced:
|
||||
@@ -476,7 +475,6 @@
|
||||
Wanders:
|
||||
MinMoveDelay: 150
|
||||
MaxMoveDelay: 750
|
||||
AvoidTerrainTypes: Tiberium, BlueTiberium
|
||||
MapEditorData:
|
||||
Categories: Civilian infantry
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ Player:
|
||||
RequiresCondition: enable-omnius-ai
|
||||
SquadSize: 8
|
||||
MaxBaseRadius: 40
|
||||
ExcludeFromSquadsTypes: harvester, mcv, carryall, carryall.reinforce
|
||||
ExcludeFromSquadsTypes: harvester, mcv, carryall
|
||||
ConstructionYardTypes: construction_yard
|
||||
IgnoredEnemyTargetTypes: Creep
|
||||
UnitBuilderBotModule@omnius:
|
||||
@@ -263,7 +263,7 @@ Player:
|
||||
RequiresCondition: enable-vidious-ai
|
||||
SquadSize: 6
|
||||
MaxBaseRadius: 40
|
||||
ExcludeFromSquadsTypes: harvester, mcv, carryall, carryall.reinforce
|
||||
ExcludeFromSquadsTypes: harvester, mcv
|
||||
ConstructionYardTypes: construction_yard
|
||||
IgnoredEnemyTargetTypes: Creep
|
||||
UnitBuilderBotModule@vidious:
|
||||
@@ -302,7 +302,7 @@ Player:
|
||||
RequiresCondition: enable-gladius-ai
|
||||
SquadSize: 10
|
||||
MaxBaseRadius: 40
|
||||
ExcludeFromSquadsTypes: harvester, mcv, carryall, carryall.reinforce
|
||||
ExcludeFromSquadsTypes: harvester, mcv
|
||||
ConstructionYardTypes: construction_yard
|
||||
IgnoredEnemyTargetTypes: Creep
|
||||
UnitBuilderBotModule@gladius:
|
||||
|
||||
Reference in New Issue
Block a user