Resolve Lua language server diagnosed problems.
This commit is contained in:
committed by
abcdefg30
parent
3d0efa1cbe
commit
378f66a1ff
@@ -7,7 +7,7 @@
|
||||
information, see COPYING.
|
||||
]]
|
||||
IdlingUnits = function()
|
||||
local lazyUnits = enemy.GetGroundAttackers()
|
||||
local lazyUnits = Greece.GetGroundAttackers()
|
||||
|
||||
Utils.Do(lazyUnits, function(unit)
|
||||
Trigger.OnDamaged(unit, function()
|
||||
@@ -38,19 +38,19 @@ end
|
||||
|
||||
BuildBuilding = function(building)
|
||||
Trigger.AfterDelay(Actor.BuildTime(building.type), function()
|
||||
if CYard.IsDead or CYard.Owner ~= enemy then
|
||||
if CYard.IsDead or CYard.Owner ~= Greece then
|
||||
return
|
||||
elseif Harvester.IsDead and enemy.Resources <= 299 then
|
||||
elseif Harvester.IsDead and Greece.Resources <= 299 then
|
||||
return
|
||||
end
|
||||
|
||||
local actor = Actor.Create(building.type, true, { Owner = enemy, Location = CYardLocation.Location + building.pos })
|
||||
enemy.Cash = enemy.Cash - building.cost
|
||||
local actor = Actor.Create(building.type, true, { Owner = Greece, Location = CYardLocation.Location + building.pos })
|
||||
Greece.Cash = Greece.Cash - building.cost
|
||||
|
||||
building.exists = true
|
||||
Trigger.OnKilled(actor, function() building.exists = false end)
|
||||
Trigger.OnDamaged(actor, function(building)
|
||||
if building.Owner == enemy and building.Health < building.MaxHealth * 3/4 then
|
||||
if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then
|
||||
building.StartBuildingRepairs()
|
||||
end
|
||||
end)
|
||||
@@ -62,14 +62,14 @@ end
|
||||
ProduceInfantry = function()
|
||||
if not BaseTent.exists then
|
||||
return
|
||||
elseif Harvester.IsDead and enemy.Resources <= 299 then
|
||||
elseif Harvester.IsDead and Greece.Resources <= 299 then
|
||||
return
|
||||
end
|
||||
|
||||
local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9))
|
||||
local toBuild = { Utils.Random(AlliedInfantryTypes) }
|
||||
local Path = Utils.Random(AttackPaths)
|
||||
enemy.Build(toBuild, function(unit)
|
||||
Greece.Build(toBuild, function(unit)
|
||||
InfAttack[#InfAttack + 1] = unit[1]
|
||||
|
||||
if #InfAttack >= 10 then
|
||||
@@ -85,14 +85,14 @@ end
|
||||
ProduceArmor = function()
|
||||
if not BaseWeap.exists then
|
||||
return
|
||||
elseif Harvester.IsDead and enemy.Resources <= 599 then
|
||||
elseif Harvester.IsDead and Greece.Resources <= 599 then
|
||||
return
|
||||
end
|
||||
|
||||
local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17))
|
||||
local toBuild = { Utils.Random(AlliedArmorTypes) }
|
||||
local Path = Utils.Random(AttackPaths)
|
||||
enemy.Build(toBuild, function(unit)
|
||||
Greece.Build(toBuild, function(unit)
|
||||
ArmorAttack[#ArmorAttack + 1] = unit[1]
|
||||
|
||||
if #ArmorAttack >= 6 then
|
||||
|
||||
@@ -43,20 +43,20 @@ EnemyPaths =
|
||||
{ EnemyEntry2.Location, EnemyRally2.Location }
|
||||
}
|
||||
|
||||
wave = 0
|
||||
Wave = 0
|
||||
SendEnemies = function()
|
||||
Trigger.AfterDelay(EnemyAttackDelay[Difficulty], function()
|
||||
|
||||
wave = wave + 1
|
||||
if wave > 3 then
|
||||
wave = 1
|
||||
Wave = Wave + 1
|
||||
if Wave > 3 then
|
||||
Wave = 1
|
||||
end
|
||||
|
||||
if wave == 1 then
|
||||
local units = Reinforcements.ReinforceWithTransport(enemy, "tran", EnemyReinforcements[Difficulty][wave], EnemyPaths[1], { EnemyPaths[1][1] })[2]
|
||||
if Wave == 1 then
|
||||
local units = Reinforcements.ReinforceWithTransport(Greece, "tran", EnemyReinforcements[Difficulty][Wave], EnemyPaths[1], { EnemyPaths[1][1] })[2]
|
||||
Utils.Do(units, IdleHunt)
|
||||
else
|
||||
local units = Reinforcements.ReinforceWithTransport(enemy, "lst", EnemyReinforcements[Difficulty][wave], EnemyPaths[2], { EnemyPaths[2][1] })[2]
|
||||
local units = Reinforcements.ReinforceWithTransport(Greece, "lst", EnemyReinforcements[Difficulty][Wave], EnemyPaths[2], { EnemyPaths[2][1] })[2]
|
||||
Utils.Do(units, IdleHunt)
|
||||
end
|
||||
|
||||
|
||||
@@ -23,51 +23,51 @@ SovietReinforcements2Waypoints = { McvWaypoint.Location, APCWaypoint2.Location }
|
||||
TruckGoalTrigger = { CPos.New(85, 10), CPos.New(85, 11), CPos.New(85, 12), CPos.New(86, 13), CPos.New(87, 13), CPos.New(88, 13), CPos.New(88, 14), CPos.New(89, 14), CPos.New(90, 14), CPos.New(90, 15), CPos.New(91, 15), CPos.New(91, 16), CPos.New(91, 17), CPos.New(92, 17), CPos.New(93, 17), CPos.New(94, 17), CPos.New(94, 18), CPos.New(95, 18), CPos.New(96, 18), CPos.New(96, 19), CPos.New(97, 19), CPos.New(98, 19)}
|
||||
|
||||
Trigger.OnEnteredFootprint(TruckGoalTrigger, function(a, id)
|
||||
if not truckGoalTrigger and a.Owner == player and a.Type == "truk" then
|
||||
truckGoalTrigger = true
|
||||
player.MarkCompletedObjective(sovietObjective)
|
||||
player.MarkCompletedObjective(SaveAllTrucks)
|
||||
if not TruckGoalTriggered and a.Owner == USSR and a.Type == "truk" then
|
||||
TruckGoalTriggered = true
|
||||
USSR.MarkCompletedObjective(SovietObjective)
|
||||
USSR.MarkCompletedObjective(SaveAllTrucks)
|
||||
end
|
||||
end)
|
||||
|
||||
Trigger.OnAllKilled(Trucks, function()
|
||||
enemy.MarkCompletedObjective(alliedObjective)
|
||||
Greece.MarkCompletedObjective(AlliedObjective)
|
||||
end)
|
||||
|
||||
Trigger.OnAnyKilled(Trucks, function()
|
||||
player.MarkFailedObjective(SaveAllTrucks)
|
||||
USSR.MarkFailedObjective(SaveAllTrucks)
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(Apwr, function(building)
|
||||
Trigger.OnKilled(Apwr, function()
|
||||
BaseApwr.exists = false
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(Barr, function(building)
|
||||
Trigger.OnKilled(Barr, function()
|
||||
BaseTent.exists = false
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(Proc, function(building)
|
||||
Trigger.OnKilled(Proc, function()
|
||||
BaseProc.exists = false
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(Weap, function(building)
|
||||
Trigger.OnKilled(Weap, function()
|
||||
BaseWeap.exists = false
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(Apwr2, function(building)
|
||||
Trigger.OnKilled(Apwr2, function()
|
||||
BaseApwr2.exists = false
|
||||
end)
|
||||
|
||||
Trigger.OnKilledOrCaptured(Dome, function()
|
||||
Trigger.AfterDelay(DateTime.Seconds(2), function()
|
||||
player.MarkCompletedObjective(sovietObjective2)
|
||||
Media.PlaySpeechNotification(player, "ObjectiveMet")
|
||||
USSR.MarkCompletedObjective(SovietObjective2)
|
||||
Media.PlaySpeechNotification(USSR, "ObjectiveMet")
|
||||
end)
|
||||
end)
|
||||
|
||||
Trigger.OnRemovedFromWorld(Mcv, function()
|
||||
if not mcvDeployed then
|
||||
mcvDeployed = true
|
||||
if not McvDeployed then
|
||||
McvDeployed = true
|
||||
BuildBase()
|
||||
SendEnemies()
|
||||
Trigger.AfterDelay(DateTime.Minutes(1), ProduceInfantry)
|
||||
@@ -76,8 +76,8 @@ Trigger.OnRemovedFromWorld(Mcv, function()
|
||||
end)
|
||||
|
||||
WorldLoaded = function()
|
||||
player = Player.GetPlayer("USSR")
|
||||
enemy = Player.GetPlayer("Greece")
|
||||
USSR = Player.GetPlayer("USSR")
|
||||
Greece = Player.GetPlayer("Greece")
|
||||
|
||||
Camera.Position = CameraStart.CenterPosition
|
||||
|
||||
@@ -87,33 +87,33 @@ WorldLoaded = function()
|
||||
IdleHunt(actor)
|
||||
end)
|
||||
|
||||
Reinforcements.ReinforceWithTransport(player, "apc", SovietReinforcements1, SovietReinforcements1Waypoints)
|
||||
Reinforcements.ReinforceWithTransport(player, "apc", SovietReinforcements2, SovietReinforcements2Waypoints)
|
||||
Reinforcements.ReinforceWithTransport(USSR, "apc", SovietReinforcements1, SovietReinforcements1Waypoints)
|
||||
Reinforcements.ReinforceWithTransport(USSR, "apc", SovietReinforcements2, SovietReinforcements2Waypoints)
|
||||
|
||||
Utils.Do(Map.NamedActors, function(actor)
|
||||
if actor.Owner == enemy and actor.HasProperty("StartBuildingRepairs") then
|
||||
if actor.Owner == Greece and actor.HasProperty("StartBuildingRepairs") then
|
||||
Trigger.OnDamaged(actor, function(building)
|
||||
if building.Owner == enemy and building.Health < 3/4 * building.MaxHealth then
|
||||
if building.Owner == Greece and building.Health < 3/4 * building.MaxHealth then
|
||||
building.StartBuildingRepairs()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
InitObjectives(player)
|
||||
alliedObjective = AddPrimaryObjective(enemy, "")
|
||||
sovietObjective = AddPrimaryObjective(player, "escort-convoy")
|
||||
sovietObjective2 = AddSecondaryObjective(player, "destroy-capture-radar-dome-reinforcements")
|
||||
SaveAllTrucks = AddSecondaryObjective(player, "Keep all trucks alive.")
|
||||
InitObjectives(USSR)
|
||||
AlliedObjective = AddPrimaryObjective(Greece, "")
|
||||
SovietObjective = AddPrimaryObjective(USSR, "escort-convoy")
|
||||
SovietObjective2 = AddSecondaryObjective(USSR, "destroy-capture-radar-dome-reinforcements")
|
||||
SaveAllTrucks = AddSecondaryObjective(USSR, "Keep all trucks alive.")
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
enemy.MarkCompletedObjective(alliedObjective)
|
||||
if USSR.HasNoRequiredUnits() then
|
||||
Greece.MarkCompletedObjective(AlliedObjective)
|
||||
end
|
||||
|
||||
if enemy.Resources >= enemy.ResourceCapacity * 0.75 then
|
||||
enemy.Cash = enemy.Cash + enemy.Resources - enemy.ResourceCapacity * 0.25
|
||||
enemy.Resources = enemy.ResourceCapacity * 0.25
|
||||
if Greece.Resources >= Greece.ResourceCapacity * 0.75 then
|
||||
Greece.Cash = Greece.Cash + Greece.Resources - Greece.ResourceCapacity * 0.25
|
||||
Greece.Resources = Greece.ResourceCapacity * 0.25
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user