Add civilian nudging for new shellmap
This commit is contained in:
@@ -22,6 +22,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
World world;
|
World world;
|
||||||
Player allies;
|
Player allies;
|
||||||
Player soviets;
|
Player soviets;
|
||||||
|
Player neutral;
|
||||||
|
|
||||||
List<int2> viewportTargets = new List<int2>();
|
List<int2> viewportTargets = new List<int2>();
|
||||||
int2 viewportTarget;
|
int2 viewportTarget;
|
||||||
@@ -31,6 +32,8 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
float div = 400;
|
float div = 400;
|
||||||
int waitTicks = 0;
|
int waitTicks = 0;
|
||||||
|
|
||||||
|
int nextCivilianMove = 1;
|
||||||
|
|
||||||
Actor attackLocation;
|
Actor attackLocation;
|
||||||
Actor coastRP1;
|
Actor coastRP1;
|
||||||
Actor coastRP2;
|
Actor coastRP2;
|
||||||
@@ -69,6 +72,17 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
u.QueueActivity(new AttackMove.AttackMoveActivity(u, new Move.Move(attackLocation.Location, 0)));
|
u.QueueActivity(new AttackMove.AttackMoveActivity(u, new Move.Move(attackLocation.Location, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (world.FrameNumber == nextCivilianMove)
|
||||||
|
{
|
||||||
|
var civilians = world.Actors.Where(a => !a.IsDead() && a.IsInWorld && a.Owner == neutral && a.HasTrait<Mobile>());
|
||||||
|
if (civilians.Any())
|
||||||
|
{
|
||||||
|
var civilian = civilians.Random(world.SharedRandom);
|
||||||
|
civilian.Trait<Mobile>().Nudge(civilian, civilian, true);
|
||||||
|
nextCivilianMove += world.SharedRandom.Next(1, 75);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (--waitTicks <= 0)
|
if (--waitTicks <= 0)
|
||||||
{
|
{
|
||||||
if (++mul <= div)
|
if (++mul <= div)
|
||||||
@@ -96,6 +110,7 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
|
|
||||||
allies = w.Players.Single(p => p.InternalName == "Allies");
|
allies = w.Players.Single(p => p.InternalName == "Allies");
|
||||||
soviets = w.Players.Single(p => p.InternalName == "Soviets");
|
soviets = w.Players.Single(p => p.InternalName == "Soviets");
|
||||||
|
neutral = w.Players.Single(p => p.InternalName == "Neutral");
|
||||||
|
|
||||||
mapActors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
mapActors = w.WorldActor.Trait<SpawnMapActors>().Actors;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user