Port Intervention to the new Lua API
This commit is contained in:
@@ -62,6 +62,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Red Alert Lua scripts", "Re
|
|||||||
mods\ra\maps\allies-01-classic\allies01.lua = mods\ra\maps\allies-01-classic\allies01.lua
|
mods\ra\maps\allies-01-classic\allies01.lua = mods\ra\maps\allies-01-classic\allies01.lua
|
||||||
mods\ra\maps\allies-02-classic\allies02.lua = mods\ra\maps\allies-02-classic\allies02.lua
|
mods\ra\maps\allies-02-classic\allies02.lua = mods\ra\maps\allies-02-classic\allies02.lua
|
||||||
mods\ra\maps\desert-shellmap\desert-shellmap.lua = mods\ra\maps\desert-shellmap\desert-shellmap.lua
|
mods\ra\maps\desert-shellmap\desert-shellmap.lua = mods\ra\maps\desert-shellmap\desert-shellmap.lua
|
||||||
|
mods\ra\maps\intervention\intervention.lua = mods\ra\maps\intervention\intervention.lua
|
||||||
mods\ra\maps\fort-lonestar\fort-lonestar.lua = mods\ra\maps\fort-lonestar\fort-lonestar.lua
|
mods\ra\maps\fort-lonestar\fort-lonestar.lua = mods\ra\maps\fort-lonestar\fort-lonestar.lua
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
|||||||
279
mods/ra/maps/intervention/intervention.lua
Normal file
279
mods/ra/maps/intervention/intervention.lua
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
BeachheadTrigger =
|
||||||
|
{
|
||||||
|
CPos.New(120, 90), CPos.New(120, 89), CPos.New(120, 88), CPos.New(121, 88), CPos.New(122, 88), CPos.New(123, 88), CPos.New(124, 88),
|
||||||
|
CPos.New(125, 88), CPos.New(126, 88), CPos.New(126, 89), CPos.New(127, 89), CPos.New(128, 89), CPos.New(128, 90), CPos.New(129, 90),
|
||||||
|
CPos.New(130, 90), CPos.New(130, 91), CPos.New(131, 91), CPos.New(132, 91), CPos.New(133, 91), CPos.New(134, 91), CPos.New(134, 92),
|
||||||
|
CPos.New(135, 92), CPos.New(136, 92), CPos.New(137, 92), CPos.New(137, 93), CPos.New(138, 93), CPos.New(139, 93), CPos.New(140, 93),
|
||||||
|
CPos.New(140, 94), CPos.New(140, 95), CPos.New(140, 96), CPos.New(140, 97), CPos.New(140, 98), CPos.New(140, 99), CPos.New(140, 100),
|
||||||
|
CPos.New(139, 100), CPos.New(139, 101), CPos.New(139, 102), CPos.New(138, 102), CPos.New(138, 103), CPos.New(138, 104),
|
||||||
|
CPos.New(137, 104), CPos.New(137, 105), CPos.New(137, 106), CPos.New(136, 106), CPos.New(136, 107)
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseRaidInterval = Utils.Minutes(3)
|
||||||
|
BaseFrontAttackInterval = Utils.Minutes(3) + Utils.Seconds(30)
|
||||||
|
BaseRearAttackInterval = Utils.Minutes(8)
|
||||||
|
UBoatPatrolDelay = Utils.Minutes(2) + Utils.Seconds(30)
|
||||||
|
BaseFrontAttackWpts = { PatrolWpt1.Location, BaseRaidWpt1.Location }
|
||||||
|
|
||||||
|
Village = { FarmHouse1, FarmHouse2, FarmHouse3, FarmHouse4, FarmHouse5, FarmHouse6, FarmHouse7, FarmHouse8, FarmHouse9, Church }
|
||||||
|
VillageRaidInterval = Utils.Minutes(3)
|
||||||
|
VillageRaidAircraft = { "mig", "mig" }
|
||||||
|
VillageRaidWpts = { VillageRaidEntrypoint.Location, VillageRaidWpt1.Location, VillageRaidWpt2.Location }
|
||||||
|
|
||||||
|
BaseRaidAircraft = { "mig", "mig" }
|
||||||
|
BaseRaidWpts = { BaseRaidEntrypoint.Location, UboatPatrolWpt1.Location, BaseRaidWpt2.Location }
|
||||||
|
|
||||||
|
BaseFrontAttackUnits = { "e3", "e3", "e1", "e1", "e1", "3tnk", "3tnk", "apc" }
|
||||||
|
BaseRearAttackUnits = { "e3", "e3", "e1", "e1", "3tnk", "3tnk", "v2rl" }
|
||||||
|
BaseRearAttackWpts = { GroundAttackWpt1.Location, BaseRearAttackWpt1.Location, BaseRearAttackWpt2.Location, BaseRearAttackWpt3.Location }
|
||||||
|
|
||||||
|
SovietHarvesters = { Harvester1, Harvester2, Harvester3 }
|
||||||
|
HarvesterGuard = { HarvGuard1, HarvGuard2, HarvGuard3 }
|
||||||
|
|
||||||
|
UBoats = { Uboat1, Uboat2, Uboat3, Uboat4, Uboat5, Uboat6 }
|
||||||
|
UboatPatrolWpts1 = { UboatPatrolWpt1.Location, UboatPatrolWpt2.Location, UboatPatrolWpt3.Location, UboatPatrolWpt4.Location }
|
||||||
|
UboatPatrolWpts2 = { UboatPatrolWpt4.Location, UboatPatrolWpt2.Location, UboatPatrolWpt1.Location }
|
||||||
|
UBoatPatrolUnits = { "ss" }
|
||||||
|
|
||||||
|
HunterSubs = { "ss", "ss" }
|
||||||
|
|
||||||
|
GroundPatrolWpts = { PatrolWpt1.Location, PatrolWpt2.Location }
|
||||||
|
GroundPatrolUnits =
|
||||||
|
{
|
||||||
|
{ "e1", "e1", "e1", "e3", "e3", "dog" },
|
||||||
|
{ "apc", "apc", "ftrk" },
|
||||||
|
{ "3tnk", "3tnk" }
|
||||||
|
}
|
||||||
|
Paratroopers = { "e1", "e1", "e1", "e3", "e3" }
|
||||||
|
|
||||||
|
ParadropSovietUnits = function()
|
||||||
|
local start = BaseRaidEntrypoint.CenterPosition + WVec.New(0, 0, Actor.CruiseAltitude("badr"))
|
||||||
|
local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Utils.CenterOfCell(MCVDeployLocation.Location) - start).Facing })
|
||||||
|
|
||||||
|
Utils.Do(Paratroopers, function(type)
|
||||||
|
local a = Actor.Create(type, false, { Owner = soviets })
|
||||||
|
transport.LoadPassenger(a)
|
||||||
|
Trigger.OnIdle(a, function(b) b.Hunt() end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
transport.Paradrop(MCVDeployLocation.Location)
|
||||||
|
end
|
||||||
|
|
||||||
|
AirRaid = function(planeTypes, ingress, egress, target)
|
||||||
|
if target == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1, #planeTypes do
|
||||||
|
Trigger.AfterDelay((i - 1) * Utils.Seconds(1), function()
|
||||||
|
local start = Utils.CenterOfCell(ingress[1]) + WVec.New(0, 0, Actor.CruiseAltitude(planeTypes[i]))
|
||||||
|
local plane = Actor.Create(planeTypes[i], true, { CenterPosition = start, Owner = soviets, Facing = (Utils.CenterOfCell(ingress[2]) - start).Facing })
|
||||||
|
|
||||||
|
Utils.Do(ingress, function(wpt) plane.Move(wpt) end)
|
||||||
|
plane.Attack(target)
|
||||||
|
Utils.Do(egress, function(wpt) plane.Move(wpt) end)
|
||||||
|
plane.Destroy()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
BaseRaid = function()
|
||||||
|
local targets = Map.ActorsInBox(AlliedAreaTopLeft.CenterPosition, AlliedAreaBottomRight.CenterPosition, function(actor)
|
||||||
|
return actor.Owner == player and actor.HasProperty("StartBuildingRepairs")
|
||||||
|
end)
|
||||||
|
|
||||||
|
if #targets == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local target = Utils.Random(targets)
|
||||||
|
|
||||||
|
AirRaid(BaseRaidAircraft, BaseRaidWpts, { VillageRaidEntrypoint.Location }, target)
|
||||||
|
|
||||||
|
Trigger.AfterDelay(BaseRaidInterval, BaseRaid)
|
||||||
|
end
|
||||||
|
|
||||||
|
VillageRaid = function()
|
||||||
|
local target = nil
|
||||||
|
Utils.Do(Village, function(tgt)
|
||||||
|
if target == nil and not tgt.IsDead then
|
||||||
|
target = tgt
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
if target == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
AirRaid(VillageRaidAircraft, VillageRaidWpts, { BaseRaidEntrypoint.Location }, target)
|
||||||
|
|
||||||
|
Trigger.AfterDelay(VillageRaidInterval, VillageRaid)
|
||||||
|
end
|
||||||
|
|
||||||
|
SendUboatPatrol = function(team)
|
||||||
|
Trigger.AfterDelay(UBoatPatrolDelay, function()
|
||||||
|
Utils.Do(team, function(uboat)
|
||||||
|
if not uboat.IsDead then
|
||||||
|
uboat.PatrolUntil(UboatPatrolWpts1, function()
|
||||||
|
return Time.GameTime > Utils.Minutes(2) + UBoatPatrolDelay
|
||||||
|
end)
|
||||||
|
uboat.Patrol(UboatPatrolWpts2)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
SendGroundPatrol = function(team)
|
||||||
|
Utils.Do(team, function(unit) unit.Patrol(GroundPatrolWpts, true, Utils.Seconds(3)) end)
|
||||||
|
Utils.Do(team, function(unit)
|
||||||
|
Trigger.OnIdle(unit, function(actor) actor.Hunt() end)
|
||||||
|
end)
|
||||||
|
Trigger.OnAllKilled(team, function()
|
||||||
|
Build(Utils.Random(GroundPatrolUnits), SendGroundPatrol)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
BaseFrontAttack = function(team)
|
||||||
|
Utils.Do(team, function(unit) unit.Patrol(BaseFrontAttackWpts, false) end)
|
||||||
|
Utils.Do(team, function(unit)
|
||||||
|
Trigger.OnIdle(unit, function(actor) actor.Hunt() end)
|
||||||
|
end)
|
||||||
|
Trigger.AfterDelay(BaseFrontAttackInterval, function() Build(BaseFrontAttackUnits, BaseFrontAttack) end)
|
||||||
|
end
|
||||||
|
|
||||||
|
BaseRearAttack = function(team)
|
||||||
|
Utils.Do(team, function(unit) unit.Patrol(BaseRearAttackWpts, false) end)
|
||||||
|
Utils.Do(team, function(unit)
|
||||||
|
Trigger.OnIdle(unit, function(actor) actor.Hunt() end)
|
||||||
|
end)
|
||||||
|
Trigger.AfterDelay(BaseRearAttackInterval, function() Build(BaseRearAttackUnits, BaseRearAttack) end)
|
||||||
|
end
|
||||||
|
|
||||||
|
Build = function(units, action)
|
||||||
|
if not soviets.Build(units, action) then
|
||||||
|
Trigger.AfterDelay(Utils.Seconds(15), function()
|
||||||
|
Build(units, action)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
SetupWorld = function()
|
||||||
|
Utils.Do(SovietHarvesters, function(a) a.FindResources() end)
|
||||||
|
|
||||||
|
Utils.Do(SovietHarvesters, function(harvester)
|
||||||
|
Trigger.OnDamaged(harvester, function(h)
|
||||||
|
Utils.Do(HarvesterGuard, function(g)
|
||||||
|
if not g.IsDead then
|
||||||
|
g.Stop()
|
||||||
|
g.AttackMove(h.Location, 3)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
Utils.Do(UBoats, function(a) a.Stance = "Defend" end)
|
||||||
|
|
||||||
|
Utils.Do(Map.NamedActors, function(actor)
|
||||||
|
if actor.Owner == soviets and actor.HasProperty("StartBuildingRepairs") then
|
||||||
|
Trigger.OnDamaged(actor, function(building)
|
||||||
|
if building.Owner == soviets then
|
||||||
|
building.StartBuildingRepairs()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
WarFactory.RallyPoint = Rallypoint.Location
|
||||||
|
WarFactory.IsPrimaryBuilding = true
|
||||||
|
Barracks.IsPrimaryBuilding = true
|
||||||
|
SubPen.IsPrimaryBuilding = true
|
||||||
|
end
|
||||||
|
|
||||||
|
Tick = function()
|
||||||
|
if soviets.Resources > soviets.ResourceCapacity * 0.75 then
|
||||||
|
soviets.Resources = soviets.Resources - ((soviets.ResourceCapacity * 0.01) / 25)
|
||||||
|
end
|
||||||
|
|
||||||
|
if player.HasNoRequiredUnits() then
|
||||||
|
player.MarkFailedObjective(villageObjective)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
WorldLoaded = function()
|
||||||
|
player = Player.GetPlayer("Allies")
|
||||||
|
soviets = Player.GetPlayer("Soviets")
|
||||||
|
|
||||||
|
Trigger.OnObjectiveAdded(player, function(p, id)
|
||||||
|
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
|
||||||
|
end)
|
||||||
|
Trigger.OnObjectiveCompleted(player, function(p, id)
|
||||||
|
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
|
||||||
|
end)
|
||||||
|
Trigger.OnObjectiveFailed(player, function(p, id)
|
||||||
|
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
|
||||||
|
end)
|
||||||
|
|
||||||
|
Trigger.OnPlayerWon(player, function()
|
||||||
|
Media.PlaySpeechNotification(player, "Win")
|
||||||
|
end)
|
||||||
|
|
||||||
|
Trigger.OnPlayerLost(player, function()
|
||||||
|
Media.PlaySpeechNotification(player, "Lose")
|
||||||
|
end)
|
||||||
|
|
||||||
|
sovietObjective = soviets.AddPrimaryObjective("Destroy the village.")
|
||||||
|
villageObjective = player.AddPrimaryObjective("Save the village.")
|
||||||
|
beachheadObjective = player.AddSecondaryObjective("Get your MCV to the main island.")
|
||||||
|
|
||||||
|
beachheadTrigger = false
|
||||||
|
Trigger.OnExitedFootprint(BeachheadTrigger, function(a, id)
|
||||||
|
if not beachheadTrigger and a.Owner == player and a.Type == "mcv" then
|
||||||
|
beachheadTrigger = true
|
||||||
|
Trigger.RemoveFootprintTrigger(id)
|
||||||
|
player.MarkCompletedObjective(beachheadObjective)
|
||||||
|
|
||||||
|
captureObjective = player.AddPrimaryObjective("Locate and capture the enemy's Air Force HQ.")
|
||||||
|
Trigger.OnCapture(AirForceHQ, function()
|
||||||
|
Trigger.AfterDelay(Utils.Seconds(3), function()
|
||||||
|
player.MarkCompletedObjective(captureObjective)
|
||||||
|
player.MarkCompletedObjective(villageObjective)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
Trigger.OnKilled(AirForceHQ, function() player.MarkFailedObjective(captureObjective) end)
|
||||||
|
|
||||||
|
Trigger.AfterDelay(BaseFrontAttackInterval, function()
|
||||||
|
Build(BaseFrontAttackUnits, BaseFrontAttack)
|
||||||
|
ParadropSovietUnits()
|
||||||
|
end)
|
||||||
|
Trigger.AfterDelay(BaseRearAttackInterval, function()
|
||||||
|
Build(BaseRearAttackUnits, BaseRearAttack)
|
||||||
|
end)
|
||||||
|
Trigger.AfterDelay(BaseRaidInterval, BaseRaid)
|
||||||
|
|
||||||
|
Trigger.AfterDelay(UBoatPatrolDelay, function()
|
||||||
|
Build(HunterSubs, function(subs)
|
||||||
|
Utils.Do(subs, function(sub)
|
||||||
|
Trigger.OnIdle(sub, function(s) s.Hunt() end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
Trigger.OnAllKilled(Village, function() player.MarkFailedObjective(villageObjective) end)
|
||||||
|
|
||||||
|
SetupWorld()
|
||||||
|
|
||||||
|
Trigger.AfterDelay(VillageRaidInterval, VillageRaid)
|
||||||
|
|
||||||
|
Trigger.AfterDelay(1, function() Build(UBoatPatrolUnits, SendUboatPatrol) end)
|
||||||
|
Trigger.AfterDelay(1, function() Build(Utils.Random(GroundPatrolUnits), SendGroundPatrol) end)
|
||||||
|
|
||||||
|
Reinforcements.Reinforce(player, { "mcv" }, { MCVInsertLocation.Location, MCVDeployLocation.Location }, 0, function(mcv)
|
||||||
|
mcv.Deploy()
|
||||||
|
end)
|
||||||
|
|
||||||
|
Camera.Position = CameraSpot.CenterPosition
|
||||||
|
Trigger.AfterDelay(Utils.Seconds(5), function() CameraSpot.Destroy() end)
|
||||||
|
end
|
||||||
@@ -2205,7 +2205,7 @@ Actors:
|
|||||||
Actor14: wood
|
Actor14: wood
|
||||||
Location: 23,57
|
Location: 23,57
|
||||||
Owner: Neutral
|
Owner: Neutral
|
||||||
Camera: CAMERA
|
CameraSpot: CAMERA
|
||||||
Location: 79,137
|
Location: 79,137
|
||||||
Owner: Allies
|
Owner: Allies
|
||||||
|
|
||||||
@@ -2220,8 +2220,8 @@ Rules:
|
|||||||
-CrateSpawner:
|
-CrateSpawner:
|
||||||
-SpawnMPUnits:
|
-SpawnMPUnits:
|
||||||
-MPStartLocations:
|
-MPStartLocations:
|
||||||
LuaScriptInterface:
|
LuaScript:
|
||||||
LuaScripts: mission.lua
|
Scripts: intervention.lua
|
||||||
ObjectivesPanel:
|
ObjectivesPanel:
|
||||||
PanelName: MISSION_OBJECTIVES
|
PanelName: MISSION_OBJECTIVES
|
||||||
CAMERA:
|
CAMERA:
|
||||||
@@ -2229,17 +2229,26 @@ Rules:
|
|||||||
Range: 18c0
|
Range: 18c0
|
||||||
MISS:
|
MISS:
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Air Force HQ
|
Name: Soviet Air Force HQ
|
||||||
Capturable:
|
Capturable:
|
||||||
Type: building
|
Type: building
|
||||||
AllowAllies: False
|
AllowAllies: False
|
||||||
AllowNeutral: False
|
AllowNeutral: False
|
||||||
AllowEnemies: True
|
AllowEnemies: True
|
||||||
CaptureThreshold: 1.0
|
CaptureThreshold: 1.0
|
||||||
E6:
|
E6.MOD:
|
||||||
|
Inherits: E6
|
||||||
|
Buildable:
|
||||||
|
Prerequisites: ~barracks
|
||||||
|
-RepairsBridges:
|
||||||
Captures:
|
Captures:
|
||||||
CaptureTypes: building
|
CaptureTypes: building
|
||||||
Sabotage: False
|
Sabotage: False
|
||||||
|
RenderInfantry:
|
||||||
|
Image: e6
|
||||||
|
E6:
|
||||||
|
Buildable:
|
||||||
|
Prerequisites: ~disabled
|
||||||
HPAD:
|
HPAD:
|
||||||
ProvidesCustomPrerequisite:
|
ProvidesCustomPrerequisite:
|
||||||
Prerequisite: givefix
|
Prerequisite: givefix
|
||||||
@@ -2254,12 +2263,12 @@ Rules:
|
|||||||
Name: Weapons Factory or Helipad
|
Name: Weapons Factory or Helipad
|
||||||
MIG:
|
MIG:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: afld
|
Prerequisites: ~afld
|
||||||
LimitedAmmo:
|
LimitedAmmo:
|
||||||
Ammo: 2
|
Ammo: 2
|
||||||
HELI:
|
HELI:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: hpad
|
Prerequisites: ~hpad
|
||||||
Valued:
|
Valued:
|
||||||
Cost: 1500
|
Cost: 1500
|
||||||
SAM:
|
SAM:
|
||||||
@@ -2270,19 +2279,49 @@ Rules:
|
|||||||
TSLA:
|
TSLA:
|
||||||
Power:
|
Power:
|
||||||
Amount: -50
|
Amount: -50
|
||||||
^Vehicles:
|
^Building:
|
||||||
|
Tooltip:
|
||||||
|
GenericVisibility: Enemy
|
||||||
|
ShowOwnerRow: false
|
||||||
|
^Vehicle:
|
||||||
MustBeDestroyed:
|
MustBeDestroyed:
|
||||||
|
Tooltip:
|
||||||
|
GenericVisibility: Enemy
|
||||||
|
ShowOwnerRow: false
|
||||||
^Tank:
|
^Tank:
|
||||||
MustBeDestroyed:
|
MustBeDestroyed:
|
||||||
|
Tooltip:
|
||||||
|
GenericVisibility: Enemy
|
||||||
|
ShowOwnerRow: false
|
||||||
^Infantry:
|
^Infantry:
|
||||||
MustBeDestroyed:
|
MustBeDestroyed:
|
||||||
|
Tooltip:
|
||||||
|
GenericVisibility: Enemy
|
||||||
|
ShowOwnerRow: false
|
||||||
^Plane:
|
^Plane:
|
||||||
MustBeDestroyed:
|
MustBeDestroyed:
|
||||||
|
Tooltip:
|
||||||
|
GenericVisibility: Enemy
|
||||||
|
ShowOwnerRow: false
|
||||||
^Ship:
|
^Ship:
|
||||||
MustBeDestroyed:
|
MustBeDestroyed:
|
||||||
|
Tooltip:
|
||||||
|
GenericVisibility: Enemy
|
||||||
|
ShowOwnerRow: false
|
||||||
|
^Wall:
|
||||||
|
Tooltip:
|
||||||
|
ShowOwnerRow: false
|
||||||
|
^Husk:
|
||||||
|
Tooltip:
|
||||||
|
GenericVisibility: Enemy, Ally, Neutral
|
||||||
|
GenericStancePrefix: false
|
||||||
|
ShowOwnerRow: false
|
||||||
ATEK:
|
ATEK:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
|
STEK:
|
||||||
|
Buildable:
|
||||||
|
Prerequisites: ~disabled
|
||||||
GAP:
|
GAP:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
@@ -2292,9 +2331,24 @@ Rules:
|
|||||||
PDOX:
|
PDOX:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
|
E4:
|
||||||
|
Buildable:
|
||||||
|
Prerequisites: ~disabled
|
||||||
E7:
|
E7:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
|
THF:
|
||||||
|
Buildable:
|
||||||
|
Prerequisites: ~disabled
|
||||||
|
HIJACKER:
|
||||||
|
Buildable:
|
||||||
|
Prerequisites: ~disabled
|
||||||
|
SHOK:
|
||||||
|
Buildable:
|
||||||
|
Prerequisites: ~disabled
|
||||||
|
SNIPER:
|
||||||
|
Buildable:
|
||||||
|
Prerequisites: ~disabled
|
||||||
2TNK:
|
2TNK:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
@@ -2310,6 +2364,9 @@ Rules:
|
|||||||
MNLY.AT:
|
MNLY.AT:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
|
MNLY.AP:
|
||||||
|
Buildable:
|
||||||
|
Prerequisites: ~disabled
|
||||||
MRJ:
|
MRJ:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
@@ -2319,6 +2376,9 @@ Rules:
|
|||||||
HIND:
|
HIND:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
|
YAK:
|
||||||
|
Buildable:
|
||||||
|
Prerequisites: ~disabled
|
||||||
CA:
|
CA:
|
||||||
Buildable:
|
Buildable:
|
||||||
Prerequisites: ~disabled
|
Prerequisites: ~disabled
|
||||||
|
|||||||
@@ -1,272 +0,0 @@
|
|||||||
difficulty = OpenRA.GetDifficulty()
|
|
||||||
|
|
||||||
if difficulty == "Medium" then
|
|
||||||
BaseRaidInterval = Utils.Minutes(3)
|
|
||||||
BaseFrontAttackInterval = Utils.Minutes(3) + Utils.Seconds(30)
|
|
||||||
BaseRearAttackInterval = Utils.Minutes(8)
|
|
||||||
UBoatPatrolDelay = Utils.Minutes(2) + Utils.Seconds(30)
|
|
||||||
BaseFrontAttackWpts = { PatrolWpt1, BaseRaidWpt1 }
|
|
||||||
else
|
|
||||||
BaseRaidInterval = Utils.Minutes(2) + Utils.Seconds(30)
|
|
||||||
BaseFrontAttackInterval = Utils.Minutes(2)
|
|
||||||
BaseRearAttackInterval = Utils.Minutes(5)
|
|
||||||
UBoatPatrolDelay = Utils.Minutes(2)
|
|
||||||
BaseFrontAttackWpts = { PatrolWpt1 }
|
|
||||||
end
|
|
||||||
|
|
||||||
Village = { FarmHouse1, FarmHouse2, FarmHouse3, FarmHouse4, FarmHouse5, FarmHouse6, FarmHouse7, FarmHouse8, FarmHouse9, Church }
|
|
||||||
VillageRaidInterval = Utils.Minutes(3)
|
|
||||||
VillageRaidAircraft = { "mig", "mig" }
|
|
||||||
VillageRaidWpts = { VillageRaidWpt1, VillageRaidWpt2 }
|
|
||||||
|
|
||||||
BaseRaidAircraft = { "mig", "mig" }
|
|
||||||
BaseRaidWpts = { UboatPatrolWpt1, BaseRaidWpt2 }
|
|
||||||
|
|
||||||
BaseFrontAttackUnits = {
|
|
||||||
{ Barracks, {"e3", "e3", "e1", "e1", "e1"} },
|
|
||||||
{ WarFactory, {"3tnk", "3tnk", "apc"} }
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseRearAttackUnits = {
|
|
||||||
{ Barracks, {"e3", "e3", "e1", "e1"} },
|
|
||||||
{ WarFactory, {"3tnk", "3tnk", "v2rl"} }
|
|
||||||
}
|
|
||||||
BaseRearAttackWpts = { GroundAttackWpt1, BaseRearAttackWpt1, BaseRearAttackWpt2, BaseRearAttackWpt3 }
|
|
||||||
|
|
||||||
SovietHarvesters = { Harvester1, Harvester2, Harvester3 }
|
|
||||||
HarvesterGuard = { HarvGuard1, HarvGuard2, HarvGuard3 }
|
|
||||||
|
|
||||||
UBoats = { Uboat1, Uboat2, Uboat3, Uboat4, Uboat5, Uboat6 }
|
|
||||||
UboatPatrolWpts1 = { UboatPatrolWpt1, UboatPatrolWpt2, UboatPatrolWpt3, UboatPatrolWpt4 }
|
|
||||||
UboatPatrolWpts2 = { UboatPatrolWpt4, UboatPatrolWpt2, UboatPatrolWpt1 }
|
|
||||||
UBoatPatrolUnits = { { SubPen, {"ss"} } }
|
|
||||||
|
|
||||||
HunterSubs = { { SubPen, {"ss", "ss"} } }
|
|
||||||
|
|
||||||
GroundPatrolWpts = { PatrolWpt1, PatrolWpt2 }
|
|
||||||
GroundPatrolUnits = {
|
|
||||||
{ { Barracks, {"e1", "e1", "e1", "e3", "e3"} }, { Kennel, {"dog"} } },
|
|
||||||
{ { WarFactory, {"apc", "apc", "ftrk"} } },
|
|
||||||
{ { WarFactory, {"3tnk", "3tnk"} } }
|
|
||||||
}
|
|
||||||
|
|
||||||
Reinforcements.ReinforceAir = function(owner, planeNames, entrypoint, rallypoint, interval, onCreateFunc)
|
|
||||||
local facing = { Map.GetFacing(CPos.op_Subtraction(rallypoint.Location, entrypoint.Location), 0), "Int32" }
|
|
||||||
local flight = { }
|
|
||||||
|
|
||||||
for i, planeName in ipairs(planeNames) do
|
|
||||||
local enterPosition = WPos.op_Addition(entrypoint.CenterPosition, WVec.New(0, 0, Rules.InitialAltitude(planeName)))
|
|
||||||
local plane = Actor.Create(planeName, { AddToWorld = false, Location = entrypoint.Location, CenterPosition = enterPosition, Owner = owner, Facing = facing })
|
|
||||||
flight[i] = plane
|
|
||||||
OpenRA.RunAfterDelay((i - 1) * interval, function()
|
|
||||||
World:Add(plane)
|
|
||||||
Actor.Fly(plane, rallypoint.CenterPosition)
|
|
||||||
if onCreateFunc ~= nil then
|
|
||||||
onCreateFunc(plane)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
return flight
|
|
||||||
end
|
|
||||||
|
|
||||||
FollowWaypoints = function(team, waypoints)
|
|
||||||
Utils.Do(waypoints, function(wpt)
|
|
||||||
Team.Do(team, function(a) Actor.Fly(a, wpt.CenterPosition) end)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
PlaneExitMap = function(actor, exitPoint)
|
|
||||||
Actor.Fly(actor, exitPoint.CenterPosition)
|
|
||||||
Actor.FlyOffMap(actor)
|
|
||||||
Actor.RemoveSelf(actor)
|
|
||||||
end
|
|
||||||
|
|
||||||
BaseRaid = function()
|
|
||||||
local base = Map.FindStructuresInBox(player, AlliedAreaTopLeft, AlliedAreaBottomRight)
|
|
||||||
if #base == 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local target = base[OpenRA.GetRandomInteger(1, #base + 1)]
|
|
||||||
|
|
||||||
local flight = Team.New(Reinforcements.ReinforceAir(soviets, BaseRaidAircraft, BaseRaidEntrypoint, BaseRaidWpts[1], Utils.Seconds(1)))
|
|
||||||
FollowWaypoints(flight, BaseRaidWpts)
|
|
||||||
|
|
||||||
Team.Do(flight, function(plane)
|
|
||||||
Actor.FlyAttackActor(plane, target)
|
|
||||||
PlaneExitMap(plane, VillageRaidEntrypoint)
|
|
||||||
end)
|
|
||||||
|
|
||||||
OpenRA.RunAfterDelay(BaseRaidInterval, BaseRaid)
|
|
||||||
end
|
|
||||||
|
|
||||||
VillageRaid = function()
|
|
||||||
local target = nil
|
|
||||||
Utils.Do(Village, function(tgt)
|
|
||||||
if target == nil and not Actor.IsDead(tgt) then
|
|
||||||
target = tgt
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
if target == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local flight = Team.New(Reinforcements.ReinforceAir(soviets, VillageRaidAircraft, VillageRaidEntrypoint, VillageRaidWpts[1], Utils.Seconds(1)))
|
|
||||||
FollowWaypoints(flight, VillageRaidWpts)
|
|
||||||
|
|
||||||
Team.Do(flight, function(plane)
|
|
||||||
Actor.FlyAttackActor(plane, target)
|
|
||||||
PlaneExitMap(plane, BaseRaidEntrypoint)
|
|
||||||
end)
|
|
||||||
|
|
||||||
OpenRA.RunAfterDelay(VillageRaidInterval, VillageRaid)
|
|
||||||
end
|
|
||||||
|
|
||||||
SendUboatPatrol = function(team)
|
|
||||||
OpenRA.RunAfterDelay(UBoatPatrolDelay, function()
|
|
||||||
if difficulty == "Medium" then
|
|
||||||
Team.Patrol(team, UboatPatrolWpts1, 0, false)
|
|
||||||
else
|
|
||||||
Team.Do(team, Actor.Hunt)
|
|
||||||
end
|
|
||||||
OpenRA.RunAfterDelay(Utils.Minutes(2), function()
|
|
||||||
Team.Do(team, Actor.Stop)
|
|
||||||
Team.Patrol(team, UboatPatrolWpts2)
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
SendGroundPatrol = function(team)
|
|
||||||
Team.Patrol(team, GroundPatrolWpts, Utils.Seconds(3))
|
|
||||||
Team.Do(team, function(actor) Actor.OnIdle(actor, Actor.Hunt) end)
|
|
||||||
|
|
||||||
Team.AddEventHandler(team.OnAllKilled, function()
|
|
||||||
Production.BuildTeamFromTemplate(soviets, GroundPatrolUnits[OpenRA.GetRandomInteger(1, #GroundPatrolUnits + 1)], SendGroundPatrol)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
BaseFrontAttack = function(team)
|
|
||||||
Team.Patrol(team, BaseFrontAttackWpts, 0, false)
|
|
||||||
Team.Do(team, function(actor) Actor.OnIdle(actor, Actor.Hunt) end)
|
|
||||||
OpenRA.RunAfterDelay(BaseFrontAttackInterval, function() Production.BuildTeamFromTemplate(soviets, BaseFrontAttackUnits, BaseFrontAttack) end)
|
|
||||||
end
|
|
||||||
|
|
||||||
BaseRearAttack = function(team)
|
|
||||||
Team.Patrol(team, BaseRearAttackWpts, 0, false)
|
|
||||||
Team.Do(team, function(actor) Actor.OnIdle(actor, Actor.Hunt) end)
|
|
||||||
OpenRA.RunAfterDelay(BaseRearAttackInterval, function() Production.BuildTeamFromTemplate(soviets, BaseRearAttackUnits, BaseRearAttack) end)
|
|
||||||
end
|
|
||||||
|
|
||||||
InsertMCV = function ()
|
|
||||||
local mcv = Actor.Create("mcv", { Owner = player, Location = MCVInsertLocation.Location, Facing = Facing.North })
|
|
||||||
Actor.Move(mcv, MCVDeployLocation.Location)
|
|
||||||
Actor.DeployTransform(mcv)
|
|
||||||
end
|
|
||||||
|
|
||||||
SetupWorld = function()
|
|
||||||
if difficulty ~= "Medium" then
|
|
||||||
Actor.RemoveSelf(EasyMine)
|
|
||||||
end
|
|
||||||
|
|
||||||
Utils.Do(SovietHarvesters, Actor.Harvest)
|
|
||||||
|
|
||||||
harvesterGuard = Team.New(HarvesterGuard)
|
|
||||||
Utils.Do(SovietHarvesters, function(harvester)
|
|
||||||
Actor.OnDamaged(harvester, function(h)
|
|
||||||
Team.Do(harvesterGuard, function(g)
|
|
||||||
Actor.Stop(g)
|
|
||||||
Actor.AttackMove(g, h.Location, 3)
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
Utils.Do(UBoats, function(a) Actor.SetStance(a, "Defend") end)
|
|
||||||
|
|
||||||
Utils.Do(Actor.ActorsWithTrait("RepairableBuilding"), function(building)
|
|
||||||
if Actor.Owner(building) == soviets then
|
|
||||||
Actor.OnDamaged(building, function(b)
|
|
||||||
if Actor.Owner(b) == soviets then
|
|
||||||
Actor.RepairBuilding(b)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Production.SetRallyPoint(WarFactory, Rallypoint)
|
|
||||||
Production.EventHandlers.Setup(soviets)
|
|
||||||
|
|
||||||
-- RunAfterDelay is used so that the 'Building captured' and 'Mission accomplished' sounds don't play at the same time
|
|
||||||
Actor.OnCaptured(AirForceHQ, function() OpenRA.RunAfterDelay(Utils.Seconds(3), MissionAccomplished) end)
|
|
||||||
Actor.OnKilled(AirForceHQ, MissionFailed)
|
|
||||||
|
|
||||||
village = Team.New(Village)
|
|
||||||
Team.AddEventHandler(village.OnAllKilled, MissionFailed)
|
|
||||||
end
|
|
||||||
|
|
||||||
tick = 0
|
|
||||||
alliedBaseEstablished = false
|
|
||||||
Tick = function()
|
|
||||||
tick = tick + 1
|
|
||||||
|
|
||||||
if OpenRA.GetOre(soviets) > (OpenRA.GetOreCapacity(soviets) * 0.75) then
|
|
||||||
Mission.TickTakeOre(soviets)
|
|
||||||
end
|
|
||||||
|
|
||||||
if Mission.RequiredUnitsAreDestroyed(player) then
|
|
||||||
OpenRA.RunAfterDelay(Utils.Seconds(1), MissionFailed)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not alliedBaseEstablished and tick > Utils.Minutes(5) and tick % Utils.Seconds(10) == 0 then
|
|
||||||
-- FIXME: replace with cell trigger when available
|
|
||||||
local base = Map.FindStructuresInBox(player, AlliedAreaTopLeft, AlliedAreaBottomRight)
|
|
||||||
if #base > 0 then
|
|
||||||
alliedBaseEstablished = true
|
|
||||||
|
|
||||||
OpenRA.RunAfterDelay(BaseFrontAttackInterval, function()
|
|
||||||
Production.BuildTeamFromTemplate(soviets, BaseFrontAttackUnits, BaseFrontAttack)
|
|
||||||
|
|
||||||
local plane, paratroopers = SupportPowers.Paradrop(soviets, "badr", {"e1", "e1", "e1", "e3", "e3"}, BaseRaidEntrypoint.Location, MCVDeployLocation.Location)
|
|
||||||
Utils.Do(paratroopers, function(actor) Actor.OnIdle(actor, Actor.Hunt) end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
OpenRA.RunAfterDelay(BaseRearAttackInterval, function()
|
|
||||||
Production.BuildTeamFromTemplate(soviets, BaseRearAttackUnits, BaseRearAttack)
|
|
||||||
end)
|
|
||||||
|
|
||||||
Production.BuildTeamFromTemplate(soviets, HunterSubs, function(team)
|
|
||||||
Team.Do(team, function(actor) Actor.OnIdle(actor, Actor.Hunt) end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
OpenRA.RunAfterDelay(BaseRaidInterval, BaseRaid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
WorldLoaded = function()
|
|
||||||
player = OpenRA.GetPlayer("Allies")
|
|
||||||
soviets = OpenRA.GetPlayer("Soviets")
|
|
||||||
civvies = OpenRA.GetPlayer("Civilians")
|
|
||||||
|
|
||||||
SetupWorld()
|
|
||||||
|
|
||||||
OpenRA.RunAfterDelay(1, function()
|
|
||||||
Production.BuildTeamFromTemplate(soviets, UBoatPatrolUnits, SendUboatPatrol)
|
|
||||||
Production.BuildTeamFromTemplate(soviets, GroundPatrolUnits[OpenRA.GetRandomInteger(1, #GroundPatrolUnits + 1)], SendGroundPatrol)
|
|
||||||
end)
|
|
||||||
OpenRA.RunAfterDelay(VillageRaidInterval, VillageRaid)
|
|
||||||
|
|
||||||
InsertMCV()
|
|
||||||
|
|
||||||
OpenRA.SetViewportCenterPosition(Camera.CenterPosition)
|
|
||||||
OpenRA.RunAfterDelay(Utils.Seconds(5), function() Actor.RemoveSelf(Camera) end)
|
|
||||||
end
|
|
||||||
|
|
||||||
MissionFailed = function()
|
|
||||||
Mission.MissionOver(nil, { player }, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
MissionAccomplished = function()
|
|
||||||
Mission.MissionOver({ player }, nil, true)
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user