Skip to content

Commit 0d93191

Browse files
committed
Merge remote-tracking branch 'darkademic/dev'
2 parents c4c1579 + a7bad5d commit 0d93191

File tree

75 files changed

+555
-219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+555
-219
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#region Copyright & License Information
2+
/**
3+
* Copyright (c) The OpenRA Combined Arms Developers (see CREDITS).
4+
* This file is part of OpenRA Combined Arms, which is free software.
5+
* It is made available to you under the terms of the GNU General Public License
6+
* as published by the Free Software Foundation, either version 3 of the License,
7+
* or (at your option) any later version. For more information, see COPYING.
8+
*/
9+
#endregion
10+
11+
using Eluant;
12+
using OpenRA.Mods.Common.Traits;
13+
using OpenRA.Scripting;
14+
15+
namespace OpenRA.Mods.Common.Scripting
16+
{
17+
[ScriptGlobal("ActorCA")]
18+
public class ActorCAGlobal : ScriptGlobal
19+
{
20+
public ActorCAGlobal(ScriptContext context)
21+
: base(context) { }
22+
23+
public int CostOrDefault(string type, int defaultCost = 0)
24+
{
25+
if (!Context.World.Map.Rules.Actors.TryGetValue(type, out var ai))
26+
throw new LuaException($"Unknown actor type '{type}'");
27+
28+
var vi = ai.TraitInfoOrDefault<ValuedInfo>();
29+
if (vi == null)
30+
return defaultCost;
31+
32+
return vi.Cost;
33+
}
34+
}
35+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#region Copyright & License Information
2+
/**
3+
* Copyright (c) The OpenRA Combined Arms Developers (see CREDITS).
4+
* This file is part of OpenRA Combined Arms, which is free software.
5+
* It is made available to you under the terms of the GNU General Public License
6+
* as published by the Free Software Foundation, either version 3 of the License,
7+
* or (at your option) any later version. For more information, see COPYING.
8+
*/
9+
#endregion
10+
11+
using System.Collections.Generic;
12+
using System.Linq;
13+
using OpenRA.Mods.Common.Traits;
14+
using OpenRA.Scripting;
15+
16+
namespace OpenRA.Mods.Common.Scripting
17+
{
18+
[ScriptPropertyGroup("PlayerCA")]
19+
public class PlayerCAProperties : ScriptPlayerProperties
20+
{
21+
public PlayerCAProperties(ScriptContext context, Player player)
22+
: base(context, player) { }
23+
24+
[Desc("Returns all living actors of the specified target types of this player.")]
25+
public Actor[] GetActorsByTargetTypes(string[] targetTypes)
26+
{
27+
var result = new List<Actor>();
28+
29+
result.AddRange(Player.World.Actors
30+
.Where(actor => actor.Owner == Player && !actor.IsDead && actor.IsInWorld &&
31+
actor.GetEnabledTargetTypes().Any(t => targetTypes.Contains(t.ToString()))));
32+
33+
return result.ToArray();
34+
}
35+
36+
[Desc("Returns all living actors of the specified armor type of this player.")]
37+
public Actor[] GetActorsByArmorType(string armorType)
38+
{
39+
var result = new List<Actor>();
40+
41+
result.AddRange(Player.World.Actors
42+
.Where(actor => actor.Owner == Player && !actor.IsDead && actor.IsInWorld &&
43+
actor.Info.TraitInfos<ArmorInfo>().Any(ai => ai.Type == armorType)));
44+
45+
return result.ToArray();
46+
}
47+
}
48+
}

OpenRA.Mods.CA/Scripting/UtilsCAGlobal.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
#endregion
1212

13+
using OpenRA.Mods.Common.Traits;
1314
using OpenRA.Mods.Common.Widgets;
1415
using OpenRA.Scripting;
1516

@@ -52,5 +53,17 @@ public string Hotkey(string hotkeyName)
5253
var hotkey = reference.GetValue();
5354
return hotkey.DisplayString();
5455
}
56+
57+
[Desc("Returns whether a specified building type can be placed at a given cell location.")]
58+
public bool CanPlaceBuilding(string type, CPos cell)
59+
{
60+
var ai = world.Map.Rules.Actors[type];
61+
var bi = ai.TraitInfoOrDefault<BuildingInfo>();
62+
63+
if (bi == null)
64+
return false;
65+
66+
return BuildingUtils.CanPlaceBuilding(world, cell, ai, bi, null);
67+
}
5568
}
5669
}

mods/ca/maps/ca01-crossrip/crossrip.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,8 @@ end
620620
GetPlayerArmyValue = function()
621621
local value = 0
622622
Utils.Do(Greece.GetActors(), function(a)
623-
if a.HasProperty("Attack") and a.Type ~= "badr.bomber" and a.Type ~= "a10.bomber" then
624-
value = value + Actor.Cost(a.Type)
623+
if a.HasProperty("Attack") then
624+
value = value + ActorCA.CostOrDefault(a.Type)
625625
end
626626
end)
627627
return value

mods/ca/maps/ca02-displacement/displacement.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ OncePerSecondChecks = function()
268268
end
269269
end
270270

271-
if DateTime.GameTime > DateTime.Minutes(15) and #Scrin.GetActorsByTypes({ "reac", "rea2", "sfac", "proc.scrin", "port", "wsph", "nerv", "grav", "scrt", "srep" }) == 0 then
271+
if DateTime.GameTime > DateTime.Minutes(15) and not PlayerHasBuildings(Scrin) then
272272
if ObjectiveDestroyScrinBase ~= nil and not Greece.IsObjectiveCompleted(ObjectiveDestroyScrinBase) then
273273
Greece.MarkCompletedObjective(ObjectiveDestroyScrinBase)
274274
end

mods/ca/maps/ca03-deliverance/deliverance-rules.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ World:
88
Briefing: We have been contacted by forces belonging to a group calling themselves the Global Defense Initiative. Though we have no knowledge of such an organization, we have reason to believe they can shed some light on everything that has been happening.\n\nA GDI base apparently materialized inside Soviet territory. Their commander was taken prisoner and they are soon to be overrun by Soviet forces.\n\nTake a detachment to find the base and—assuming this is not a Soviet ruse—defend it until reinforcements arrive.\n\nWith their commander captured and their chain of command in disarray due to the temporal and dimensional upheaval, the GDI forces have agreed to follow your orders. Once our position is secure, locate and rescue the GDI commander.\n\nWe don't know yet if we can trust these people, so remain vigilant. Hopefully we have found ourselves a new ally, and rescuing their commander is surely a good first step towards securing such an alliance.
99
LossVideo: battle.vqa
1010
MapOptions:
11-
ShortGameCheckboxEnabled: True
11+
ShortGameCheckboxEnabled: False
1212
ScriptLobbyDropdown@DIFFICULTY:
1313
ID: difficulty
1414
Label: dropdown-difficulty.label
@@ -209,7 +209,7 @@ MISS:
209209
Name: Prison
210210
TooltipDescription:
211211
Description: Prisoners of war are kept here.
212-
ValidRelationships: Ally
212+
ValidRelationships: Ally, Enemy, Neutral
213213
Health:
214214
HP: 200000
215215

mods/ca/maps/ca03-deliverance/deliverance.lua

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ OncePerSecondChecks = function()
325325
UpdateReinforcementCountdown()
326326
end
327327

328-
if PlayerForcesDefeated() or not GDICommanderAlive then
328+
if Greece.HasNoRequiredUnits() or not GDICommanderAlive then
329329
if ObjectiveFindBase ~= nil and not Greece.IsObjectiveCompleted(ObjectiveFindBase) then
330330
Greece.MarkFailedObjective(ObjectiveFindBase)
331331
end
@@ -466,15 +466,6 @@ RevealPrison = function()
466466
end
467467
end
468468

469-
PlayerForcesDefeated = function()
470-
if ObjectiveFindBase ~= nil and not Greece.IsObjectiveCompleted(ObjectiveFindBase) then
471-
local playerActors = Greece.GetActors()
472-
return #playerActors == 0
473-
else
474-
return Greece.HasNoRequiredUnits()
475-
end
476-
end
477-
478469
InitUSSR = function()
479470
if Difficulty == "easy" then
480471
RebuildExcludes.USSR = { Types = { "tsla", "ftur" }, Actors = { NorthSAM1, NorthSAM2 } }

mods/ca/maps/ca06-machinations/machinations-rules.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ World:
77
MissionData:
88
Briefing: Intelligence gathered from the Nod naval base has put us hot on Nod's trail. The transports we captured were waiting to board a disguised cargo vessel which has now also been captured. Based on its navigational logs we have used our satellites and located what appears to be a research facility hidden in a disused quarry in North Africa.\n\nNod submarines will make a large scale landing difficult, but if we can establish a base on the coast we'll be able to launch an offensive from there.\n\nWith GDI's assistance we have been able to augment our harvesters and refineries to harvest the Tiberium crystals that are becoming widespread. Nod also has a harvesting operation in the area. Gather what resources you can without alerting Nod to our presence, build up your forces, then capture their research facility.
99
MapOptions:
10-
ShortGameCheckboxEnabled: True
10+
ShortGameCheckboxEnabled: False
1111
ScriptLobbyDropdown@DIFFICULTY:
1212
ID: difficulty
1313
Label: dropdown-difficulty.label

mods/ca/maps/ca10-zenith/zenith-rules.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ World:
1919
MissionData:
2020
Briefing: Despite my assurances, the Soviets have begun a large scale offensive towards our Temple Prime facility. Stalin always was a short-sighted fool.\n\nTo ensure the safety of the temple, we must take the Soviet nuclear arsenal out of the equation. My informants tell me that the Soviets plan to launch their missiles to wipe out the bulk of our defense forces, and then roll in with their tanks to clean up any survivors.\n\nThe Soviet missile silos are located on a heavily fortified island. We are not in an ideal position to strike, but with the Soviet army moving south we should be able to set up a staging area on the coast and storm the island before the Soviets can send reinforcements.
2121
MapOptions:
22-
ShortGameCheckboxEnabled: True
22+
ShortGameCheckboxEnabled: False
2323
ScriptLobbyDropdown@DIFFICULTY:
2424
ID: difficulty
2525
Label: dropdown-difficulty.label

mods/ca/maps/ca12-supremacy/map.yaml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ Actors:
8383
Actor3: proc.td
8484
Location: 102,114
8585
Owner: Nod2
86-
Health: 45
8786
FreeActor@SHARV: False
8887
FreeActor: False
88+
Health: 45
8989
Actor4: hand
9090
Location: 88,111
9191
Owner: Nod2
@@ -97,7 +97,7 @@ Actors:
9797
Actor6: obli
9898
Location: 100,109
9999
Owner: Nod2
100-
Health: 28
100+
Health: 45
101101
Actor7: hq
102102
Location: 89,125
103103
Owner: Nod2
@@ -131,7 +131,7 @@ Actors:
131131
Actor15: obli
132132
Owner: Nod3
133133
Location: 25,34
134-
Health: 28
134+
Health: 45
135135
Actor16: hq
136136
Owner: Nod3
137137
Location: 16,35
@@ -377,44 +377,44 @@ Actors:
377377
SubCell: 1
378378
Facing: 745
379379
Actor77: n1
380-
Owner: Nod2
381380
SubCell: 3
382381
Location: 22,34
382+
Owner: Nod3
383383
Facing: 618
384384
Actor78: n1
385-
Owner: Nod2
386385
Location: 22,34
387386
SubCell: 1
387+
Owner: Nod3
388388
Facing: 531
389389
Actor79: n1
390-
Owner: Nod2
391390
SubCell: 3
392391
Location: 19,30
392+
Owner: Nod3
393393
Facing: 7
394394
Actor80: n1
395-
Owner: Nod2
396395
SubCell: 3
397396
Location: 12,31
398397
Facing: 0
398+
Owner: Nod3
399399
Actor81: n1
400-
Owner: Nod2
401400
Location: 12,31
402401
SubCell: 1
403402
Facing: 0
403+
Owner: Nod3
404404
Actor82: n1
405-
Owner: Nod2
406405
SubCell: 3
407406
Location: 17,31
408407
Facing: 0
408+
Owner: Nod3
409409
Actor83: n1
410-
Owner: Nod2
411410
SubCell: 3
412411
Location: 22,37
412+
Owner: Nod3
413413
Facing: 808
414414
Actor84: n1
415-
Owner: Nod2
416415
SubCell: 3
417416
Location: 21,40
417+
Owner: Nod3
418418
Facing: 642
419419
Helipad1: hpad.td
420420
Location: 7,38
@@ -455,8 +455,8 @@ Actors:
455455
Actor94: mlrs
456456
Owner: Nod3
457457
Location: 12,37
458-
Facing: 896
459458
TurretFacing: 0
459+
Facing: 896
460460
Banshee2: scrn
461461
Owner: Nod3
462462
Location: 6,42
@@ -2167,17 +2167,17 @@ Actors:
21672167
Facing: 491
21682168
Actor634: bh
21692169
Owner: Nod3
2170-
Facing: 384
21712170
SubCell: 3
21722171
Location: 15,37
2172+
Facing: 384
21732173
Actor635: ftnk
21742174
Location: 95,112
2175-
Facing: 904
21762175
Owner: Nod2
2176+
Facing: 904
21772177
Actor636: bggy
21782178
Owner: Nod3
2179-
Facing: 384
21802179
Location: 10,42
2180+
Facing: 384
21812181
Actor637: bike
21822182
Owner: Nod3
21832183
Location: 16,43
@@ -3256,6 +3256,12 @@ Actors:
32563256
Owner: GDI
32573257
Facing: 512
32583258
Location: 100,70
3259+
Actor893: camera
3260+
Owner: GDI
3261+
Location: 9,40
3262+
Actor894: camera
3263+
Owner: GDI
3264+
Location: 93,123
32593265

32603266
Rules: ca|rules/custom/campaign-rules.yaml, ca|rules/custom/campaign-tooltips.yaml, ca|rules/custom/two-tone-nod.yaml, supremacy-rules.yaml
32613267

0 commit comments

Comments
 (0)