Skip to content

Commit 8e09af9

Browse files
committed
Merge remote-tracking branch 'darkademic/dev'
2 parents 8f9013d + 6e8a269 commit 8e09af9

15 files changed

Lines changed: 128 additions & 28 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#region Copyright & License Information
2+
/*
3+
* Copyright (c) The OpenRA Developers and Contributors
4+
* This file is part of OpenRA, which is free software. It is made
5+
* available to you under the terms of the GNU General Public License
6+
* as published by the Free Software Foundation, either version 3 of
7+
* the License, or (at your option) any later version. For more
8+
* information, see COPYING.
9+
*/
10+
#endregion
11+
12+
using OpenRA.Traits;
13+
using OpenRA.Mods.Common.Traits;
14+
15+
namespace OpenRA.Mods.CA.Traits
16+
{
17+
[Desc("Grants a condition to this actor when the player has stored funds (cash plus resources).")]
18+
public class GrantConditionOnPlayerFundsInfo : TraitInfo
19+
{
20+
[FieldLoader.Require]
21+
[GrantedConditionReference]
22+
[Desc("Condition to grant.")]
23+
public readonly string Condition = null;
24+
25+
[Desc("Enable condition when funds are greater than this.")]
26+
public readonly int Threshold = 0;
27+
28+
public override object Create(ActorInitializer init) { return new GrantConditionOnPlayerFunds(this); }
29+
}
30+
31+
public class GrantConditionOnPlayerFunds : INotifyCreated, INotifyOwnerChanged, ITick
32+
{
33+
readonly GrantConditionOnPlayerFundsInfo info;
34+
PlayerResources playerResources;
35+
36+
int conditionToken = Actor.InvalidConditionToken;
37+
38+
public GrantConditionOnPlayerFunds(GrantConditionOnPlayerFundsInfo info)
39+
{
40+
this.info = info;
41+
}
42+
43+
void INotifyCreated.Created(Actor self)
44+
{
45+
playerResources = self.Owner.PlayerActor.Trait<PlayerResources>();
46+
}
47+
48+
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
49+
{
50+
playerResources = newOwner.PlayerActor.Trait<PlayerResources>();
51+
}
52+
53+
void ITick.Tick(Actor self)
54+
{
55+
if (string.IsNullOrEmpty(info.Condition))
56+
return;
57+
58+
var enabled = playerResources.GetCashAndResources() > info.Threshold;
59+
if (enabled && conditionToken == Actor.InvalidConditionToken)
60+
conditionToken = self.GrantCondition(info.Condition);
61+
else if (!enabled && conditionToken != Actor.InvalidConditionToken)
62+
conditionToken = self.RevokeCondition(conditionToken);
63+
}
64+
}
65+
}

mods/ca/missions/coop-campaign/ca17-domination-coop/domination-coop-rules.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ YURI.Clone:
3131
-Encyclopedia:
3232
Tooltip:
3333
Name: Yuri Clone
34+
35+
# Captured buildings provide proxy
36+
^BasicBuilding:
37+
CreateProxyActorForAllies:
38+
RequiresPlayableOwner: False

mods/ca/missions/coop-campaign/ca25-enmity-coop/enmity-coop.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ SetupPlayers = function()
1616
end
1717

1818
AfterWorldLoaded = function()
19+
TransferBaseToPlayer(SinglePlayerPlayer, GetFirstActivePlayer())
1920
if #MissionPlayers > 1 then
20-
local player2Buildings = { Actor109, Actor96, Actor100, Actor294 }
21-
Utils.Do(player2Buildings, function(b)
22-
b.Owner = MissionPlayers[2]
21+
Trigger.AfterDelay(2, function()
22+
local player2Buildings = { Actor109, Actor96, Actor100, Actor294 }
23+
Utils.Do(player2Buildings, function(b)
24+
b.Owner = MissionPlayers[2]
25+
end)
2326
end)
2427
end
2528
end

mods/ca/missions/main-campaign/ca25-enmity/enmity.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,17 @@ InitNod = function()
260260
SetupRefAndSilosCaptureCredits(Nod)
261261
AutoReplaceHarvesters(Nod)
262262
AutoRebuildConyards(Nod)
263-
BuildDefenseOnCaptureAttempt(StructuresToSellToAvoidCapture, "ltur", true)
264263
InitAiUpgrades(Nod)
265264
InitAttackSquad(Squads.North, Nod)
266265
InitAttackSquad(Squads.South, Nod)
267266
InitAirAttackSquad(Squads.Air, Nod)
268267

269-
if Difficulty == "brutal" then
270-
InitAirAttackSquad(Squads.BrutalComanches, Nod, nil, { "gtek", "rmbo", "medi", "upgc", "eye" })
268+
if IsHardOrAbove() then
269+
BuildDefenseOnCaptureAttempt(StructuresToSellToAvoidCapture, "ltur", true)
270+
271+
if Difficulty == "brutal" then
272+
InitAirAttackSquad(Squads.BrutalComanches, Nod, nil, { "gtek", "rmbo", "medi", "upgc", "eye" })
273+
end
271274
end
272275

273276
local nodGroundAttackers = Nod.GetGroundAttackers()

mods/ca/missions/main-campaign/ca45-multipolarity/multipolarity.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,11 @@ InitGDI = function()
360360
end)
361361
end)
362362

363-
local productionBuildings = GDI.GetActorsByTypes({ "pyle", "afac", "weap.td", "afld.gdi" })
364-
for _, b in pairs(productionBuildings) do
365-
BuildDefenseOnCaptureAttempt(b, "gtwr", true)
363+
if IsHardOrAbove() then
364+
local productionBuildings = GDI.GetActorsByTypes({ "pyle", "afac", "weap.td", "afld.gdi" })
365+
for _, b in pairs(productionBuildings) do
366+
BuildDefenseOnCaptureAttempt(b, "gtwr", true)
367+
end
366368
end
367369

368370
UpgradeCenter.GrantCondition("tower-rocket")

mods/ca/missions/main-campaign/ca46-intervention/intervention.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ InitNod = function()
173173
InitAirAttackSquad(Squads.AntiCruiserAir, Nod, MissionPlayers, { "ca" })
174174
InitAirAttackSquad(Squads.AirToAir, Nod, MissionPlayers, { "Aircraft" }, "ArmorType")
175175

176+
local productionBuildings = Nod.GetActorsByTypes({ "hand", "hpad.td", "airs", "afac" })
177+
for _, b in pairs(productionBuildings) do
178+
BuildDefenseOnCaptureAttempt(b, "ltur", true)
179+
end
180+
176181
if Difficulty == "brutal" then
177182
InitNavalAttackSquad(Squads.ICBMSubs, Nod)
178183
end
@@ -188,11 +193,6 @@ InitNod = function()
188193
TargetSwapChance(a, 10)
189194
CallForHelpOnDamagedOrKilled(a, WDist.New(5120), IsNodGroundHunterUnit)
190195
end)
191-
192-
local productionBuildings = Nod.GetActorsByTypes({ "hand", "hpad.td", "airs", "afac" })
193-
for _, b in pairs(productionBuildings) do
194-
BuildDefenseOnCaptureAttempt(b, "ltur", true)
195-
end
196196
end
197197

198198
SetupLightning = function()

mods/ca/missions/main-campaign/ca47-ad-nihilum/ad-nihilum.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ InitMaleficScrin = function()
245245

246246
if IsHardOrAbove() then
247247
InitAirAttackSquad(Squads.AirToAir, MaleficScrin, MissionPlayers, { "Aircraft" }, "ArmorType")
248+
249+
local productionBuildings = MaleficScrin.GetActorsByTypes({ "port", "wsph", "sfac", "grav" })
250+
for _, b in pairs(productionBuildings) do
251+
BuildDefenseOnCaptureAttempt(b, "ptur", true)
252+
end
248253
end
249254

250255
Trigger.AfterDelay(SuperweaponsEnabledTime[Difficulty], function()
@@ -257,11 +262,6 @@ InitMaleficScrin = function()
257262
TargetSwapChance(a, 10)
258263
CallForHelpOnDamagedOrKilled(a, WDist.New(5120), IsScrinGroundHunterUnit)
259264
end)
260-
261-
local productionBuildings = MaleficScrin.GetActorsByTypes({ "port", "wsph", "sfac", "grav" })
262-
for _, b in pairs(productionBuildings) do
263-
BuildDefenseOnCaptureAttempt(b, "ptur", true)
264-
end
265265
end
266266

267267
SendNextVoidEngine = function()

mods/ca/missions/main-campaign/ca48-banishment/banishment.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ WorldLoaded = function()
146146
end)
147147
end)
148148

149-
local productionBuildings = MaleficScrin.GetActorsByTypes({ "port", "wsph", "sfac", "grav" })
150-
for _, b in pairs(productionBuildings) do
151-
BuildDefenseOnCaptureAttempt(b, "ptur", true)
152-
end
153-
154149
if IsHardOrAbove() then
150+
local productionBuildings = MaleficScrin.GetActorsByTypes({ "port", "wsph", "sfac", "grav" })
151+
for _, b in pairs(productionBuildings) do
152+
BuildDefenseOnCaptureAttempt(b, "ptur", true)
153+
end
154+
155155
Trigger.OnAnyKilled(productionBuildings, function()
156156
Trigger.AfterDelay(DateTime.Minutes(5), function()
157157
if not RoamersInitialized then

mods/ca/rules/custom/campaign-rules.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,10 @@ ISU:
10651065
Buildable:
10661066
Prerequisites: anyradar, ~vehicles.soviet, ~techlevel.medium
10671067

1068+
V3RL:
1069+
Buildable:
1070+
Prerequisites: stek, ~vehicles.soviet, ~techlevel.high
1071+
10681072
deso.upgrade:
10691073
Buildable:
10701074
Prerequisites: ~player.soviet, stek, ~techlevel.high

mods/ca/rules/custom/coop-rules.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,20 @@ OILB:
331331
CashTrickler:
332332
UseResourceStorage: True
333333

334+
HQ.UPG:
335+
CashTrickler@Hacker0:
336+
UseResourceStorage: True
337+
CashTrickler@Hacker1:
338+
UseResourceStorage: True
339+
CashTrickler@Hacker2:
340+
UseResourceStorage: True
341+
CashTrickler@Hacker3:
342+
UseResourceStorage: True
343+
CashTrickler@Hacker4:
344+
UseResourceStorage: True
345+
CashTrickler@Hacker5:
346+
UseResourceStorage: True
347+
334348
^BasicBuilding:
335349
CreateProxyActorForAllies:
336350
ProxyNamePrefix: coop

0 commit comments

Comments
 (0)