Add unit production and other buildings to desert shellmap

This commit is contained in:
Scott_NZ
2013-04-12 19:32:43 +12:00
parent f931706664
commit e8ad630e9d
5 changed files with 279 additions and 84 deletions

View File

@@ -347,10 +347,7 @@ namespace OpenRA.Mods.RA.Missions
void BuildSovietUnit(string category, string unit) void BuildSovietUnit(string category, string unit)
{ {
var queue = MissionUtils.FindQueues(world, soviets, category).FirstOrDefault(q => q.CurrentItem() == null); MissionUtils.StartProduction(world, soviets, category, unit);
if (queue == null) return;
queue.ResolveOrder(queue.self, Order.StartProduction(queue.self, unit, 1));
} }
void StartReinforcementsTimer() void StartReinforcementsTimer()

View File

@@ -65,6 +65,11 @@ namespace OpenRA.Mods.RA.Missions
static readonly string[] ChinookCargo = { "e1", "e1", "e1", "e1", "e3", "e3" }; static readonly string[] ChinookCargo = { "e1", "e1", "e1", "e1", "e3", "e3" };
static readonly string[] InfantryProductionUnits = { "e1", "e3" };
static readonly string[] VehicleProductionUnits = { "jeep", "1tnk", "2tnk", "arty" };
Actor alliedBarracks;
Actor alliedWarFactory;
Dictionary<string, Actor> actors; Dictionary<string, Actor> actors;
Actor chronosphere; Actor chronosphere;
@@ -95,9 +100,14 @@ namespace OpenRA.Mods.RA.Missions
} }
if (world.FrameNumber % 25 == 0) if (world.FrameNumber % 25 == 0)
{
foreach (var actor in world.Actors.Where(a => a.IsInWorld && a.IsIdle && !a.IsDead() foreach (var actor in world.Actors.Where(a => a.IsInWorld && a.IsIdle && !a.IsDead()
&& a.HasTrait<AttackBase>() && a.HasTrait<Mobile>()).Except(actors.Values)) && a.HasTrait<AttackBase>() && a.HasTrait<Mobile>()).Except(actors.Values))
MissionUtils.AttackNearestLandActor(true, actor, actor.Owner == soviets ? allies : soviets); MissionUtils.AttackNearestLandActor(true, actor, actor.Owner == soviets ? allies : soviets);
MissionUtils.StartProduction(world, allies, "Infantry", InfantryProductionUnits.Random(world.SharedRandom));
MissionUtils.StartProduction(world, allies, "Vehicle", VehicleProductionUnits.Random(world.SharedRandom));
}
if (world.FrameNumber % 20 == 0 && coastUnitsLeft-- > 0) if (world.FrameNumber % 20 == 0 && coastUnitsLeft-- > 0)
{ {
@@ -217,6 +227,12 @@ namespace OpenRA.Mods.RA.Missions
chinook.QueueActivity(new RemoveSelf()); chinook.QueueActivity(new RemoveSelf());
} }
void InitializeAlliedFactories()
{
alliedBarracks.Trait<PrimaryBuilding>().SetPrimaryProducer(alliedBarracks, true);
alliedWarFactory.Trait<PrimaryBuilding>().SetPrimaryProducer(alliedWarFactory, true);
}
public void WorldLoaded(World w) public void WorldLoaded(World w)
{ {
world = w; world = w;
@@ -262,6 +278,11 @@ namespace OpenRA.Mods.RA.Missions
chinook2Entry = actors["Chinook2Entry"]; chinook2Entry = actors["Chinook2Entry"];
chinook1LZ = actors["Chinook1LZ"]; chinook1LZ = actors["Chinook1LZ"];
chinook2LZ = actors["Chinook2LZ"]; chinook2LZ = actors["Chinook2LZ"];
alliedBarracks = actors["AlliedBarracks"];
alliedWarFactory = actors["AlliedWarFactory"];
InitializeAlliedFactories();
foreach (var actor in actors.Values.Where(a => a.Owner == allies || a.HasTrait<Bridge>())) foreach (var actor in actors.Values.Where(a => a.Owner == allies || a.HasTrait<Bridge>()))
{ {

View File

@@ -116,6 +116,13 @@ namespace OpenRA.Mods.RA.Missions
.Select(a => a.Trait); .Select(a => a.Trait);
} }
public static void StartProduction(World world, Player player, string category, string item)
{
var queue = FindQueues(world, player, category).FirstOrDefault(q => q.CurrentItem() == null);
if (queue != null)
queue.ResolveOrder(queue.self, Order.StartProduction(queue.self, item, 1));
}
public static Actor UnitContaining(this World world, Actor actor) public static Actor UnitContaining(this World world, Actor actor)
{ {
return world.Actors.FirstOrDefault(a => a.HasTrait<Cargo>() && a.Trait<Cargo>().Passengers.Contains(actor)); return world.Actors.FirstOrDefault(a => a.HasTrait<Cargo>() && a.Trait<Cargo>().Passengers.Contains(actor));

Binary file not shown.

View File

@@ -129,8 +129,8 @@ Actors:
Actor27: barl Actor27: barl
Location: 42,45 Location: 42,45
Owner: Neutral Owner: Neutral
Actor47: brik Actor333: syrf
Location: 74,74 Location: 67,95
Owner: Allies Owner: Allies
Actor198: sbag Actor198: sbag
Location: 68,63 Location: 68,63
@@ -150,8 +150,8 @@ Actors:
Actor194: sbag Actor194: sbag
Location: 60,60 Location: 60,60
Owner: Allies Owner: Allies
Actor160: hpad Actor160: brik
Location: 86,77 Location: 87,75
Owner: Allies Owner: Allies
Actor202: sbag Actor202: sbag
Location: 69,65 Location: 69,65
@@ -171,8 +171,8 @@ Actors:
Actor180: sbag Actor180: sbag
Location: 57,59 Location: 57,59
Owner: Allies Owner: Allies
Actor263: brik Actor38: brik
Location: 69,76 Location: 83,73
Owner: Allies Owner: Allies
Actor230: cycl Actor230: cycl
Location: 55,66 Location: 55,66
@@ -180,8 +180,8 @@ Actors:
Actor55: sbag Actor55: sbag
Location: 39,63 Location: 39,63
Owner: Allies Owner: Allies
Actor33: brik Actor47: brik
Location: 86,73 Location: 74,73
Owner: Allies Owner: Allies
Actor32: sbag Actor32: sbag
Location: 36,68 Location: 36,68
@@ -306,7 +306,7 @@ Actors:
Location: 52,60 Location: 52,60
Owner: Allies Owner: Allies
Actor116: mine Actor116: mine
Location: 82,36 Location: 78,21
Owner: Neutral Owner: Neutral
Actor93: ca Actor93: ca
Location: 20,86 Location: 20,86
@@ -323,7 +323,7 @@ Actors:
Location: 12,75 Location: 12,75
Owner: Neutral Owner: Neutral
AttackLocation: waypoint AttackLocation: waypoint
Location: 55,61 Location: 55,67
Owner: Neutral Owner: Neutral
CoastWP1: waypoint CoastWP1: waypoint
Location: 1,79 Location: 1,79
@@ -491,8 +491,8 @@ Actors:
Actor147: rock1 Actor147: rock1
Location: 118,54 Location: 118,54
Owner: Neutral Owner: Neutral
Actor66: brik Actor263: powr
Location: 70,73 Location: 52,74
Owner: Allies Owner: Allies
Actor148: pbox.e1 Actor148: pbox.e1
Location: 70,89 Location: 70,89
@@ -519,8 +519,8 @@ Actors:
Actor156: pbox.e1 Actor156: pbox.e1
Location: 94,91 Location: 94,91
Owner: Allies Owner: Allies
Actor43: brik Actor49: brik
Location: 85,74 Location: 72,73
Owner: Allies Owner: Allies
Actor186: 3tnk Actor186: 3tnk
Location: 107,50 Location: 107,50
@@ -529,8 +529,8 @@ Actors:
Actor174: tc01 Actor174: tc01
Location: 98,37 Location: 98,37
Owner: Neutral Owner: Neutral
Actor184: atek Actor159: fact
Location: 75,87 Location: 75,86
Owner: Allies Owner: Allies
Actor74: cycl Actor74: cycl
Location: 60,66 Location: 60,66
@@ -541,8 +541,8 @@ Actors:
Actor92: sbag Actor92: sbag
Location: 55,59 Location: 55,59
Owner: Allies Owner: Allies
Actor76: dome Actor76: silo
Location: 82,81 Location: 83,81
Owner: Allies Owner: Allies
Actor120: cycl Actor120: cycl
Location: 59,66 Location: 59,66
@@ -554,8 +554,8 @@ Actors:
Actor65: cycl Actor65: cycl
Location: 54,68 Location: 54,68
Owner: Neutral Owner: Neutral
Actor36: brik Actor48: brik
Location: 86,74 Location: 73,73
Owner: Allies Owner: Allies
Actor169: barr Actor169: barr
Location: 109,48 Location: 109,48
@@ -569,17 +569,17 @@ Actors:
Actor182: rock6 Actor182: rock6
Location: 96,45 Location: 96,45
Owner: Neutral Owner: Neutral
Actor34: brik Actor45: brik
Location: 85,73 Location: 75,73
Owner: Allies Owner: Allies
Chronosphere: pdox Chronosphere: pdox
Location: 78,91 Location: 78,91
Owner: Allies Owner: Allies
Actor53: brik Actor313: brik
Location: 71,73 Location: 56,79
Owner: Allies Owner: Allies
Actor75: tent AlliedWarFactory: weap
Location: 76,80 Location: 75,81
Owner: Allies Owner: Allies
Actor178: pbox.e1 Actor178: pbox.e1
Location: 101,81 Location: 101,81
@@ -593,14 +593,14 @@ Actors:
Actor187: ftur Actor187: ftur
Location: 104,47 Location: 104,47
Owner: Soviets Owner: Soviets
Actor45: brik Actor342: lst
Location: 74,73 Location: 67,98
Owner: Allies Owner: Allies
Actor90: sbag Actor90: sbag
Location: 54,59 Location: 54,59
Owner: Allies Owner: Allies
Actor38: brik Actor326: brik
Location: 73,74 Location: 49,77
Owner: Allies Owner: Allies
Actor188: ftur Actor188: ftur
Location: 107,52 Location: 107,52
@@ -612,11 +612,11 @@ Actors:
Actor172: apwr Actor172: apwr
Location: 81,87 Location: 81,87
Owner: Allies Owner: Allies
Actor89: brik Actor89: atek
Location: 69,73 Location: 68,73
Owner: Allies Owner: Allies
Actor49: brik Actor324: brik
Location: 72,73 Location: 47,77
Owner: Allies Owner: Allies
Actor196: pt Actor196: pt
Location: 55,92 Location: 55,92
@@ -689,8 +689,8 @@ Actors:
Actor176: sbag Actor176: sbag
Location: 53,60 Location: 53,60
Owner: Allies Owner: Allies
Actor48: brik Actor325: brik
Location: 73,73 Location: 48,77
Owner: Allies Owner: Allies
Actor193: sbag Actor193: sbag
Location: 59,60 Location: 59,60
@@ -733,8 +733,8 @@ Actors:
HeavyTankWP: waypoint HeavyTankWP: waypoint
Location: 79,69 Location: 79,69
Owner: Neutral Owner: Neutral
Actor221: powr Actor220: apwr
Location: 74,84 Location: 116,80
Owner: Allies Owner: Allies
Actor82: 2tnk Actor82: 2tnk
Location: 82,72 Location: 82,72
@@ -749,8 +749,8 @@ Actors:
MediumTankChronoSpawn: waypoint MediumTankChronoSpawn: waypoint
Location: 80,65 Location: 80,65
Owner: Neutral Owner: Neutral
Actor220: powr Actor221: apwr
Location: 76,84 Location: 113,80
Owner: Allies Owner: Allies
Actor64: cycl Actor64: cycl
Location: 54,67 Location: 54,67
@@ -809,11 +809,11 @@ Actors:
Paradrop2Entry: waypoint Paradrop2Entry: waypoint
Location: 56,22 Location: 56,22
Owner: Neutral Owner: Neutral
Actor299: sbag Actor299: e1
Location: 54,77 Location: 50,70
Owner: Allies Owner: Allies
Actor300: sbag Actor312: brik
Location: 55,77 Location: 56,78
Owner: Allies Owner: Allies
Actor234: sbag Actor234: sbag
Location: 53,63 Location: 53,63
@@ -853,8 +853,8 @@ Actors:
Location: 58,65 Location: 58,65
Owner: Allies Owner: Allies
Facing: 192 Facing: 192
Actor298: sbag Actor314: brik
Location: 53,77 Location: 47,76
Owner: Allies Owner: Allies
Actor233: 2tnk Actor233: 2tnk
Location: 66,62 Location: 66,62
@@ -895,11 +895,11 @@ Actors:
Actor250: sbag Actor250: sbag
Location: 44,67 Location: 44,67
Owner: Allies Owner: Allies
Actor254: tent AlliedBarracks: tent
Location: 50,66 Location: 50,66
Owner: Allies Owner: Allies
Actor222: brik Actor66: gap
Location: 68,74 Location: 62,70
Owner: Allies Owner: Allies
Actor218: sbag Actor218: sbag
Location: 43,68 Location: 43,68
@@ -919,8 +919,8 @@ Actors:
Actor232: cycl Actor232: cycl
Location: 60,68 Location: 60,68
Owner: Neutral Owner: Neutral
Actor262: pbox.e1 Actor328: apwr
Location: 68,78 Location: 122,77
Owner: Allies Owner: Allies
Actor264: v27 Actor264: v27
Location: 20,49 Location: 20,49
@@ -940,8 +940,8 @@ Actors:
Actor269: v26 Actor269: v26
Location: 21,54 Location: 21,54
Owner: Neutral Owner: Neutral
Actor159: brik Actor281: powr
Location: 68,73 Location: 54,74
Owner: Allies Owner: Allies
Actor270: v28 Actor270: v28
Location: 18,49 Location: 18,49
@@ -976,8 +976,8 @@ Actors:
Actor280: c10 Actor280: c10
Location: 23,55 Location: 23,55
Owner: Neutral Owner: Neutral
Actor281: powr Actor184: tent
Location: 51,70 Location: 83,75
Owner: Allies Owner: Allies
Actor282: e1 Actor282: e1
Location: 42,62 Location: 42,62
@@ -1015,8 +1015,8 @@ Actors:
Actor293: e3 Actor293: e3
Location: 36,69 Location: 36,69
Owner: Allies Owner: Allies
Actor297: sbag Actor311: brik
Location: 52,77 Location: 50,77
Owner: Allies Owner: Allies
Chinook2LZ: hpad Chinook2LZ: hpad
Location: 47,71 Location: 47,71
@@ -1032,7 +1032,7 @@ Actors:
Actor239: 1tnk Actor239: 1tnk
Location: 44,65 Location: 44,65
Owner: Allies Owner: Allies
Facing: 120 Facing: 30
Actor236: jeep Actor236: jeep
Location: 46,62 Location: 46,62
Owner: Allies Owner: Allies
@@ -1061,29 +1061,29 @@ Actors:
Actor301: rock5 Actor301: rock5
Location: 72,66 Location: 72,66
Owner: Neutral Owner: Neutral
Actor307: e1 Actor294: e1
Location: 54,75 Location: 58,76
Owner: Allies Owner: Allies
Chinook1LZ: hpad Chinook1LZ: hpad
Location: 44,71 Location: 44,71
Owner: Allies Owner: Allies
Actor309: sbag Actor310: brik
Location: 51,77 Location: 51,77
Owner: Allies Owner: Allies
Actor310: sbag Actor309: brik
Location: 50,77 Location: 52,77
Owner: Allies Owner: Allies
Actor311: sbag Actor307: brik
Location: 49,77 Location: 53,77
Owner: Allies Owner: Allies
Actor312: sbag Actor300: brik
Location: 48,77 Location: 54,77
Owner: Allies Owner: Allies
Actor313: sbag Actor298: brik
Location: 47,77 Location: 55,77
Owner: Allies Owner: Allies
Actor314: sbag Actor297: brik
Location: 47,76 Location: 56,77
Owner: Allies Owner: Allies
Actor315: sbag Actor315: sbag
Location: 38,73 Location: 38,73
@@ -1106,21 +1106,21 @@ Actors:
Actor321: e1 Actor321: e1
Location: 45,76 Location: 45,76
Owner: Allies Owner: Allies
Actor294: powr Actor222: powr
Location: 62,68 Location: 50,74
Owner: Allies Owner: Allies
Actor257: arty Actor257: arty
Location: 72,74 Location: 72,74
Owner: Allies Owner: Allies
Facing: 0 Facing: 0
Actor324: brik Actor33: brik
Location: 68,76 Location: 86,73
Owner: Allies Owner: Allies
Actor325: brik Actor43: brik
Location: 69,75 Location: 76,73
Owner: Allies Owner: Allies
Actor326: brik Actor53: brik
Location: 68,75 Location: 71,73
Owner: Allies Owner: Allies
Actor256: gap Actor256: gap
Location: 74,75 Location: 74,75
@@ -1140,6 +1140,176 @@ Actors:
Actor260: rock2 Actor260: rock2
Location: 46,85 Location: 46,85
Owner: Neutral Owner: Neutral
Actor254: proc
Location: 84,81
Owner: Allies
Actor261: mine
Location: 104,90
Owner: Neutral
Actor308: mine
Location: 111,89
Owner: Neutral
Actor322: oilb
Location: 58,78
Owner: Allies
Actor323: oilb
Location: 109,68
Owner: Allies
Actor327: apwr
Location: 119,80
Owner: Allies
Actor262: apwr
Location: 119,77
Owner: Allies
Actor329: mine
Location: 90,21
Owner: Neutral
Actor330: apwr
Location: 113,77
Owner: Allies
Actor331: apwr
Location: 116,77
Owner: Allies
Actor332: fix
Location: 69,80
Owner: Allies
Actor34: brik
Location: 85,73
Owner: Allies
Actor75: oilb
Location: 4,126
Owner: Allies
Actor334: oilb
Location: 6,126
Owner: Allies
Actor335: oilb
Location: 8,126
Owner: Allies
Actor336: oilb
Location: 10,126
Owner: Allies
Actor337: oilb
Location: 12,126
Owner: Allies
Actor338: oilb
Location: 14,126
Owner: Allies
Actor339: oilb
Location: 2,126
Owner: Allies
Actor340: oilb
Location: 0,126
Owner: Allies
Actor341: dome
Location: 63,73
Owner: Allies
Actor36: brik
Location: 84,73
Owner: Allies
Actor343: brik
Location: 70,73
Owner: Allies
Actor344: brik
Location: 70,72
Owner: Allies
Actor345: brik
Location: 69,72
Owner: Allies
Actor346: brik
Location: 68,72
Owner: Allies
Actor347: brik
Location: 67,72
Owner: Allies
Actor348: brik
Location: 67,71
Owner: Allies
Actor349: brik
Location: 67,70
Owner: Allies
Actor350: brik
Location: 67,69
Owner: Allies
Actor351: brik
Location: 67,68
Owner: Allies
Actor352: brik
Location: 76,74
Owner: Allies
Actor353: brik
Location: 75,74
Owner: Allies
Actor354: brik
Location: 83,74
Owner: Allies
Actor355: brik
Location: 84,74
Owner: Allies
Actor356: brik
Location: 66,68
Owner: Allies
Actor357: brik
Location: 66,69
Owner: Allies
Actor358: brik
Location: 57,79
Owner: Allies
Actor359: brik
Location: 57,78
Owner: Allies
Actor360: brik
Location: 48,76
Owner: Allies
Actor361: pbox.e1
Location: 71,96
Owner: Allies
Actor362: silo
Location: 82,82
Owner: Allies
Actor363: silo
Location: 83,82
Owner: Allies
Actor364: silo
Location: 82,81
Owner: Allies
Actor365: hpad
Location: 64,78
Owner: Allies
Actor366: apwr
Location: 122,80
Owner: Allies
Actor367: brik
Location: 86,74
Owner: Allies
Actor368: brik
Location: 86,75
Owner: Allies
Actor369: brik
Location: 87,76
Owner: Allies
Actor370: brik
Location: 87,77
Owner: Allies
Actor371: brik
Location: 87,78
Owner: Allies
Actor372: brik
Location: 86,78
Owner: Allies
Actor373: brik
Location: 86,77
Owner: Allies
Actor374: hpad
Location: 71,75
Owner: Allies
Actor375: gun
Location: 51,72
Owner: Allies
Facing: 48
Actor376: gun
Location: 63,68
Owner: Allies
Facing: 0
Smudges: Smudges: