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

@@ -41,7 +41,7 @@ Tick = function()
end
ProduceUnits = function(factory, count)
if ussr.IsProducing("e1") then
if USSR.IsProducing("e1") then
Trigger.AfterDelay(DateTime.Seconds(5), function() ProduceUnits(factory, count) end)
return
end
@@ -53,14 +53,14 @@ ProduceUnits = function(factory, count)
if not factory.IsDead then
factory.IsPrimaryBuilding = true
ussr.Build(units, function(soldiers)
USSR.Build(units, function(soldiers)
Utils.Do(soldiers, function(unit) IdleHunt(unit) end)
end)
end
end
SetupAlliedUnits = function()
Tanya = Actor.Create(TanyaType, true, { Owner = player, Location = TanyaWaypoint.Location, Facing = Angle.South })
Tanya = Actor.Create(TanyaType, true, { Owner = Greece, Location = TanyaWaypoint.Location, Facing = Angle.South })
if TanyaType == "e7.noautotarget" then
Trigger.AfterDelay(DateTime.Seconds(2), function()
@@ -74,18 +74,18 @@ SetupAlliedUnits = function()
InsertionHeli.Move(InsertionHeliExit.Location)
InsertionHeli.Destroy()
Trigger.OnKilled(Tanya, function() player.MarkFailedObjective(TanyaSurvive) end)
Trigger.OnKilled(Tanya, function() Greece.MarkFailedObjective(TanyaSurvive) end)
end
SetupTopRightIsland = function()
player.MarkCompletedObjective(FindAllies)
Media.PlaySpeechNotification(player, "AlliedReinforcementsArrived")
Reinforcements.Reinforce(player, AlliedIslandReinforcements, { AlliedIslandReinforcementsEntry.Location, IslandParadropReinforcementsDropzone.Location })
Greece.MarkCompletedObjective(FindAllies)
Media.PlaySpeechNotification(Greece, "AlliedReinforcementsArrived")
Reinforcements.Reinforce(Greece, AlliedIslandReinforcements, { AlliedIslandReinforcementsEntry.Location, IslandParadropReinforcementsDropzone.Location })
SendUSSRParadrops(Angle.New(720), IslandParadropReinforcementsDropzone)
end
SendUSSRParadrops = function(facing, dropzone)
local paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr })
local paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR })
local aircraft = paraproxy.TargetParatroopers(dropzone.CenterPosition, facing)
Utils.Do(aircraft, function(a)
@@ -98,8 +98,8 @@ SendUSSRParadrops = function(facing, dropzone)
end
SendUSSRTankReinforcements = function()
local camera = Actor.Create("camera", true, { Owner = player, Location = USSRReinforcementsCameraWaypoint.Location })
local ussrTanks = Reinforcements.Reinforce(ussr, USSRTankReinforcements, USSRTankReinforcementsWaypoints)
local camera = Actor.Create("camera", true, { Owner = Greece, Location = USSRReinforcementsCameraWaypoint.Location })
local ussrTanks = Reinforcements.Reinforce(USSR, USSRTankReinforcements, USSRTankReinforcementsWaypoints)
Trigger.OnAllRemovedFromWorld(ussrTanks, function()
Trigger.AfterDelay(DateTime.Seconds(3), function()
if not camera.IsDead then
@@ -110,7 +110,7 @@ SendUSSRTankReinforcements = function()
end
JeepCheckpointMove = function()
JeepCamera = Actor.Create("camera.jeep", true, { Owner = player })
JeepCamera = Actor.Create("camera.jeep", true, { Owner = Greece })
TeleportJeepCamera = true
Trigger.OnIdle(Jeep, function()
@@ -129,7 +129,7 @@ end
JeepSuicideMove = function()
if not JeepCamera then
JeepCamera = Actor.Create("camera.jeep", true, { Owner = player })
JeepCamera = Actor.Create("camera.jeep", true, { Owner = Greece })
TeleportJeepCamera = true
end
@@ -156,7 +156,7 @@ AlertFirstBase = function()
end)
for i = 0, 2 do
Trigger.AfterDelay(DateTime.Seconds(i), function()
Media.PlaySoundNotification(player, "AlertBuzzer")
Media.PlaySoundNotification(Greece, "AlertBuzzer")
end)
end
ProduceUnits(ProductionBuildings[1], Utils.RandomInteger(4, 8))
@@ -164,42 +164,42 @@ AlertFirstBase = function()
end
InitPlayers = function()
player = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR")
Greece = Player.GetPlayer("Greece")
USSR = Player.GetPlayer("USSR")
ussr.Cash = 10000
USSR.Cash = 10000
end
AddObjectives = function()
InitObjectives(player)
InitObjectives(Greece)
KillBridges = AddPrimaryObjective(player, "destroy-bridges")
TanyaSurvive = AddPrimaryObjective(player, "tanya-survive")
FindAllies = AddSecondaryObjective(player, "find-lost-tanks")
FreePrisoners = AddSecondaryObjective(player, "free-prisoners")
KillBridges = AddPrimaryObjective(Greece, "destroy-bridges")
TanyaSurvive = AddPrimaryObjective(Greece, "tanya-survive")
FindAllies = AddSecondaryObjective(Greece, "find-lost-tanks")
FreePrisoners = AddSecondaryObjective(Greece, "free-prisoners")
end
InitTriggers = function()
Utils.Do(ussr.GetGroundAttackers(), function(unit)
Utils.Do(USSR.GetGroundAttackers(), function(unit)
Trigger.OnDamaged(unit, function() IdleHunt(unit) end)
end)
Trigger.OnAnyKilled(Prisoners, function() player.MarkFailedObjective(FreePrisoners) end)
Trigger.OnKilled(PrisonedMedi, function() player.MarkFailedObjective(FreePrisoners) end)
Trigger.OnAnyKilled(Prisoners, function() Greece.MarkFailedObjective(FreePrisoners) end)
Trigger.OnKilled(PrisonedMedi, function() Greece.MarkFailedObjective(FreePrisoners) end)
Trigger.OnKilled(MediHideaway, function()
if not MediFreed then
MediFreed = true
player.MarkFailedObjective(FreePrisoners)
Greece.MarkFailedObjective(FreePrisoners)
end
end)
Trigger.OnKilled(ExplosiveBarrel, function()
if reinforcementsTriggered then
if ReinforcementsTriggered then
return
end
if not ExplodingBridge.IsDead then ExplodingBridge.Kill() end
reinforcementsTriggered = true
ReinforcementsTriggered = true
Trigger.AfterDelay(DateTime.Seconds(1), SendUSSRTankReinforcements)
end)
@@ -215,19 +215,19 @@ InitTriggers = function()
if not tank.IsDead then tank.Kill() end
end)
jeepTriggered = true
JeepTriggered = true
JeepSuicideMove()
end)
Utils.Do(FirstUSSRBase, function(unit)
Trigger.OnDamaged(unit, function()
if not baseCamera then baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) end
if not BaseCamera then BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location }) end
AlertFirstBase()
end)
end)
Trigger.OnAllKilledOrCaptured(FirstUSSRBase, function()
if baseCamera and baseCamera.IsInWorld then
baseCamera.Destroy()
if BaseCamera and BaseCamera.IsInWorld then
BaseCamera.Destroy()
end
end)
@@ -239,19 +239,19 @@ InitTriggers = function()
end)
Trigger.OnCapture(USSRRadarDome, function()
largeCameraA = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint1.Location })
largeCameraB = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint2.Location })
largeCameraC = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint3.Location })
LargeCameraA = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint1.Location })
LargeCameraB = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint2.Location })
LargeCameraC = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint3.Location })
end)
Trigger.OnRemovedFromWorld(USSRRadarDome, function()
if largeCameraA and largeCameraA.IsInWorld then largeCameraA.Destroy() end
if largeCameraB and largeCameraB.IsInWorld then largeCameraB.Destroy() end
if largeCameraC and largeCameraC.IsInWorld then largeCameraC.Destroy() end
if LargeCameraA and LargeCameraA.IsInWorld then LargeCameraA.Destroy() end
if LargeCameraB and LargeCameraB.IsInWorld then LargeCameraB.Destroy() end
if LargeCameraC and LargeCameraC.IsInWorld then LargeCameraC.Destroy() end
end)
Trigger.OnEnteredFootprint(TrukTriggerArea, function(a, id)
if a.Owner == player and not trukTriggered then
trukTriggered = true
if a.Owner == Greece and not TrukTriggered then
TrukTriggered = true
Trigger.RemoveFootprintTrigger(id)
if USSRTruk.IsDead then
@@ -262,7 +262,7 @@ InitTriggers = function()
if USSRTruk.Location == BaseCameraWaypoint.Location then
Trigger.ClearAll(USSRTruk)
local driver = Actor.Create("e1", true, { Owner = ussr, Location = USSRTruk.Location })
local driver = Actor.Create("e1", true, { Owner = USSR, Location = USSRTruk.Location })
if not PGuard5.IsDead then
driver.AttackMove(PGuard5.Location)
else
@@ -276,57 +276,57 @@ InitTriggers = function()
end
end)
Trigger.OnEnteredProximityTrigger(BaseCameraWaypoint.CenterPosition, WDist.New(7 * 1024), function(a, id)
if a.Type == "truk" and not baseCamera then
if a.Type == "truk" and not BaseCamera then
Trigger.RemoveProximityTrigger(id)
baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location })
BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location })
end
end)
end
end)
Trigger.OnEnteredFootprint(FreeMediTriggerArea, function(a, id)
if a.Owner == player and not MediFreed then
if a.Owner == Greece and not MediFreed then
MediFreed = true
Trigger.RemoveFootprintTrigger(id)
Reinforcements.Reinforce(player, { "medi" }, { MediSpawnpoint.Location, MediRallypoint.Location })
Reinforcements.Reinforce(Greece, { "medi" }, { MediSpawnpoint.Location, MediRallypoint.Location })
end
end)
Trigger.OnEnteredFootprint(CameraTriggerArea, function(a, id)
if a.Owner == player and not baseCamera then
if a.Owner == Greece and not BaseCamera then
Trigger.RemoveFootprintTrigger(id)
baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location })
BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location })
end
end)
Trigger.OnEnteredFootprint(BeachTriggerArea, function(a, id)
if a.Owner == player and not beachTransportTriggered then
beachTransportTriggered = true
if a.Owner == Greece and not BeachTransportTriggered then
BeachTransportTriggered = true
Trigger.RemoveFootprintTrigger(id)
SetupTopRightIsland()
end
end)
Trigger.OnEnteredFootprint(ParadropTriggerArea, function(a, id)
if a.Owner == player and a.Type ~= "jeep.mission" and not paradropsTriggered then
paradropsTriggered = true
if a.Owner == Greece and a.Type ~= "jeep.mission" and not ParadropsTriggered then
ParadropsTriggered = true
Trigger.RemoveFootprintTrigger(id)
SendUSSRParadrops(Angle.New(216), ParadropReinforcementsDropzone)
end
end)
Trigger.OnEnteredFootprint(ReinforcementsTriggerArea, function(a, id)
if a.Owner == player and not reinforcementsTriggered then
reinforcementsTriggered = true
if a.Owner == Greece and not ReinforcementsTriggered then
ReinforcementsTriggered = true
Trigger.RemoveFootprintTrigger(id)
Trigger.AfterDelay(DateTime.Seconds(1), SendUSSRTankReinforcements)
end
end)
Trigger.OnEnteredFootprint(Barracks3TriggerArea, function(a, id)
if a.Owner == player and not Barracks3Producing then
if a.Owner == Greece and not Barracks3Producing then
Barracks3Producing = true
Trigger.RemoveFootprintTrigger(id)
ProduceUnits(ProductionBuildings[3], Utils.RandomInteger(2, 5))
end
end)
Trigger.OnEnteredFootprint(JeepTriggerArea, function(a, id)
if a.Owner == player and not jeepTriggered then
jeepTriggered = true
if a.Owner == Greece and not JeepTriggered then
JeepTriggered = true
Trigger.RemoveFootprintTrigger(id)
JeepCheckpointMove()
end
@@ -345,12 +345,12 @@ InitTriggers = function()
ExplodingBridge = bridges[1]
Trigger.OnAllKilled(bridges, function()
player.MarkCompletedObjective(KillBridges)
player.MarkCompletedObjective(TanyaSurvive)
Greece.MarkCompletedObjective(KillBridges)
Greece.MarkCompletedObjective(TanyaSurvive)
-- The medic is freed once his guard is dead
if MediFreed and MediGuard.IsDead and EngisFreed then
player.MarkCompletedObjective(FreePrisoners)
Greece.MarkCompletedObjective(FreePrisoners)
end
end)
end)