Resolve Lua language server diagnosed problems.

This commit is contained in:
Matthias Mailänder
2023-03-01 10:40:46 +01:00
committed by abcdefg30
parent 3d0efa1cbe
commit 378f66a1ff
122 changed files with 3006 additions and 3012 deletions

View File

@@ -39,7 +39,7 @@ ProduceInfantry = function()
return
end
greece.Build({ Utils.Random(AlliedInfantry) }, function(units)
Greece.Build({ Utils.Random(AlliedInfantry) }, function(units)
table.insert(AttackGroup, units[1])
SendAttackGroup()
Trigger.AfterDelay(DateTime.Seconds(10), ProduceInfantry)
@@ -47,29 +47,29 @@ ProduceInfantry = function()
end
WorldLoaded = function()
player = Player.GetPlayer("USSR")
greece = Player.GetPlayer("Greece")
USSR = Player.GetPlayer("USSR")
Greece = Player.GetPlayer("Greece")
InitObjectives(player)
InitObjectives(USSR)
CommandCenterIntact = AddPrimaryObjective(player, "protect-command-center")
DestroyAllAllied = AddPrimaryObjective(player, "destroy-allied-units-structures")
CommandCenterIntact = AddPrimaryObjective(USSR, "protect-command-center")
DestroyAllAllied = AddPrimaryObjective(USSR, "destroy-allied-units-structures")
Camera.Position = CameraWaypoint.CenterPosition
Trigger.OnKilled(CommandCenter, function()
player.MarkFailedObjective(CommandCenterIntact)
USSR.MarkFailedObjective(CommandCenterIntact)
end)
Trigger.AfterDelay(0, function()
local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == greece and self.HasProperty("StartBuildingRepairs") end)
local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.HasProperty("StartBuildingRepairs") end)
Utils.Do(buildings, function(actor)
Trigger.OnDamaged(actor, function(building, attacker)
if building.Owner == greece and building.Health < building.MaxHealth * 0.8 then
if building.Owner == Greece and building.Health < building.MaxHealth * 0.8 then
building.StartBuildingRepairs()
if attacker.Type ~= "yak" and not AlreadyHunting then
AlreadyHunting = true
Utils.Do(greece.GetGroundAttackers(), function(unit)
Utils.Do(Greece.GetGroundAttackers(), function(unit)
Trigger.OnIdle(unit, unit.Hunt)
end)
end
@@ -78,15 +78,15 @@ WorldLoaded = function()
end)
-- Find the bridge actors
bridgepart1 = Map.ActorsInBox(Box1.CenterPosition, Box2.CenterPosition, function(self) return self.Type == "br1" end)[1]
bridgepart2 = Map.ActorsInBox(Box1.CenterPosition, Box2.CenterPosition, function(self) return self.Type == "br2" end)[1]
BridgePart1 = Map.ActorsInBox(Box1.CenterPosition, Box2.CenterPosition, function(self) return self.Type == "br1" end)[1]
BridgePart2 = Map.ActorsInBox(Box1.CenterPosition, Box2.CenterPosition, function(self) return self.Type == "br2" end)[1]
end)
-- Discover the area around the bridge exposing the two german soldiers
-- When the two infantry near the bridge are discovered move them across the bridge to waypoint4
-- in the meanwhile one USSR soldier hunts them down
Trigger.AfterDelay(DateTime.Seconds(1), function()
Actor.Create("camera", true, { Owner = player, Location = Box1.Location })
Actor.Create("camera", true, { Owner = USSR, Location = Box1.Location })
Utils.Do(FleeingUnits, function(unit)
unit.Move(RifleRetreat.Location)
@@ -97,21 +97,21 @@ WorldLoaded = function()
-- To make it look more smooth we will blow up the bridge when the barrel closest to it blows up
Trigger.OnAnyKilled({ BridgeBarrel1, BridgeBarrel2 }, function()
-- Destroy the bridge
if not bridgepart1.IsDead then
bridgepart1.Kill()
if not BridgePart1.IsDead then
BridgePart1.Kill()
end
if not bridgepart2.IsDead then
bridgepart2.Kill()
if not BridgePart2.IsDead then
BridgePart2.Kill()
end
end)
-- If player passes over the bridge, blow up the barrel and destroy the bridge
Trigger.OnEnteredFootprint(PassingBridgeLocation, function(unit, id)
if unit.Owner == player then
if unit.Owner == USSR then
Trigger.RemoveFootprintTrigger(id)
-- Also don't if the bridge is already dead
if bridgepart1.IsDead and bridgepart2.IsDead then
if BridgePart1.IsDead and BridgePart2.IsDead then
return
end
@@ -140,27 +140,27 @@ WorldLoaded = function()
-- When destroying the allied radar dome or the refinery drop 2 badgers with 5 grenadiers each
Trigger.OnAnyKilled({ AlliedDome, AlliedProc }, function()
local powerproxy = Actor.Create("powerproxy.paratroopers", true, { Owner = player })
local powerproxy = Actor.Create("powerproxy.paratroopers", true, { Owner = USSR })
powerproxy.TargetParatroopers(ParadropLZ.CenterPosition, Angle.South)
powerproxy.TargetParatroopers(ParadropLZ.CenterPosition, Angle.SouthEast)
powerproxy.Destroy()
end)
greece.Resources = 2000
Greece.Resources = 2000
Trigger.AfterDelay(DateTime.Seconds(30), ProduceInfantry)
end
Tick = function()
if greece.HasNoRequiredUnits() then
player.MarkCompletedObjective(CommandCenterIntact)
player.MarkCompletedObjective(DestroyAllAllied)
if Greece.HasNoRequiredUnits() then
USSR.MarkCompletedObjective(CommandCenterIntact)
USSR.MarkCompletedObjective(DestroyAllAllied)
end
if player.HasNoRequiredUnits() then
player.MarkFailedObjective(DestroyAllAllied)
if USSR.HasNoRequiredUnits() then
USSR.MarkFailedObjective(DestroyAllAllied)
end
if greece.Resources > greece.ResourceCapacity / 2 then
greece.Resources = greece.ResourceCapacity / 2
if Greece.Resources > Greece.ResourceCapacity / 2 then
Greece.Resources = Greece.ResourceCapacity / 2
end
end