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

@@ -83,13 +83,13 @@ end
Attack = 0
ProduceInfantry = function()
if SovietBarracks.IsDead or SovietBarracks.Owner ~= ussr then
if SovietBarracks.IsDead or SovietBarracks.Owner ~= USSR then
return
end
Attack = Attack + 1
local toBuild = Utils.Random(InfTypes)
ussr.Build(toBuild, function(units)
USSR.Build(toBuild, function(units)
if Attack == 2 and not AttackTnk1.IsDead then
units[#units + 1] = AttackTnk1
elseif Attack == 4 and not AttackTnk2.IsDead then
@@ -102,10 +102,10 @@ ProduceInfantry = function()
end
ProduceVehicles = function()
if WeaponsFactory.IsDead or WeaponsFactory.Owner ~= ussr then
if WeaponsFactory.IsDead or WeaponsFactory.Owner ~= USSR then
return
end
ussr.Build(VehicleTypes, function(units)
USSR.Build(VehicleTypes, function(units)
Utils.Do(units, function(unit)
if unit.Type ~= "harv" then
IdlingTanks[#IdlingTanks + 1] = unit
@@ -115,18 +115,18 @@ ProduceVehicles = function()
end
ProduceNaval = function()
if not shouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == player and self.Type == "syrd" end) < 1 then
if not ShouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.Type == "syrd" end) < 1 then
Trigger.AfterDelay(DateTime.Minutes(1), ProduceNaval)
return
end
shouldProduce = true
ShouldProduce = true
if SubPen.IsDead or SubPen.Owner ~= ussr then
if SubPen.IsDead or SubPen.Owner ~= USSR then
return
end
ussr.Build(WaterAttackTypes, function(units)
USSR.Build(WaterAttackTypes, function(units)
Utils.Do(units, function(unit)
IdlingNavalUnits[#IdlingNavalUnits + 1] = unit
end)
@@ -141,11 +141,11 @@ ProduceNaval = function()
end
ProduceAircraft = function()
if Airfield.IsDead or Airfield.Owner ~= ussr then
if Airfield.IsDead or Airfield.Owner ~= USSR then
return
end
ussr.Build(SovietAircraftType, function(units)
USSR.Build(SovietAircraftType, function(units)
local yak = units[1]
Yaks[#Yaks + 1] = yak
@@ -154,7 +154,7 @@ ProduceAircraft = function()
Trigger.AfterDelay(DateTime.Seconds(BuildDelays), ProduceAircraft)
end
InitializeAttackAircraft(yak, player)
InitializeAttackAircraft(yak, Greece)
end)
end
@@ -185,7 +185,7 @@ end
WTransWaves = function()
local way = Utils.Random(WTransWays)
local units = Utils.Random(WTransUnits)
local attackUnits = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2]
local attackUnits = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2]
Utils.Do(attackUnits, function(a)
Trigger.OnAddedToWorld(a, function()
a.AttackMove(UnitBStopLocation.Location)

View File

@@ -95,41 +95,41 @@ InitialSovietPatrols = function()
end
InitialAlliedReinforcements = function()
local camera = Actor.Create("Camera", true, { Owner = player, Location = DefaultCameraPosition.Location })
local camera = Actor.Create("Camera", true, { Owner = Greece, Location = DefaultCameraPosition.Location })
Trigger.AfterDelay(DateTime.Seconds(30), camera.Destroy)
Reinforcements.Reinforce(player, AlliedReinforcementsA, { AlliedEntry1.Location, UnitBStopLocation.Location }, 2)
Reinforcements.Reinforce(Greece, AlliedReinforcementsA, { AlliedEntry1.Location, UnitBStopLocation.Location }, 2)
Trigger.AfterDelay(DateTime.Seconds(2), function()
Reinforcements.Reinforce(player, AlliedReinforcementsB, { AlliedEntry2.Location, UnitAStopLocation.Location }, 2)
Reinforcements.Reinforce(Greece, AlliedReinforcementsB, { AlliedEntry2.Location, UnitAStopLocation.Location }, 2)
end)
Trigger.AfterDelay(DateTime.Seconds(5), function()
Reinforcements.Reinforce(player, { "mcv" }, { AlliedEntry3.Location, MCVStopLocation.Location })
Reinforcements.Reinforce(Greece, { "mcv" }, { AlliedEntry3.Location, MCVStopLocation.Location })
end)
end
CaptureRadarDome = function()
Trigger.OnKilled(RadarDome, function()
player.MarkFailedObjective(CaptureRadarDomeObj)
Greece.MarkFailedObjective(CaptureRadarDomeObj)
end)
Trigger.OnCapture(RadarDome, function()
player.MarkCompletedObjective(CaptureRadarDomeObj)
Greece.MarkCompletedObjective(CaptureRadarDomeObj)
Utils.Do(SovietTechLabs, function(a)
if a.IsDead then
return
end
Beacon.New(player, a.CenterPosition)
Beacon.New(Greece, a.CenterPosition)
if Difficulty ~= "hard" then
Actor.Create("TECH.CAM", true, { Owner = player, Location = a.Location + CVec.New(1, 1) })
Actor.Create("TECH.CAM", true, { Owner = Greece, Location = a.Location + CVec.New(1, 1) })
end
end)
Media.DisplayMessage(UserInterface.Translate("soviet-tech-centers-discovered"))
if Difficulty == "easy" then
Actor.Create("Camera", true, { Owner = player, Location = Weapcam.Location })
Actor.Create("Camera", true, { Owner = Greece, Location = Weapcam.Location })
end
end)
end
@@ -137,14 +137,14 @@ end
InfiltrateTechCenter = function()
Utils.Do(SovietTechLabs, function(a)
Trigger.OnInfiltrated(a, function()
if infiltrated then
if Infiltrated then
return
end
infiltrated = true
DestroySovietsObj = AddPrimaryObjective(player, "destroy-soviet-buildings-units")
player.MarkCompletedObjective(InfiltrateTechCenterObj)
Infiltrated = true
DestroySovietsObj = AddPrimaryObjective(Greece, "destroy-soviet-buildings-units")
Greece.MarkCompletedObjective(InfiltrateTechCenterObj)
local Proxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr })
local Proxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR })
Utils.Do(ParadropWaypoints[Difficulty], function(waypoint)
Proxy.TargetParatroopers(waypoint.CenterPosition, Angle.South)
end)
@@ -152,37 +152,37 @@ InfiltrateTechCenter = function()
end)
Trigger.OnCapture(a, function()
if not infiltrated then
if not Infiltrated then
Media.DisplayMessage(UserInterface.Translate("dont-capture-tech-centers"))
end
end)
end)
Trigger.OnAllKilledOrCaptured(SovietTechLabs, function()
if not player.IsObjectiveCompleted(InfiltrateTechCenterObj) then
player.MarkFailedObjective(InfiltrateTechCenterObj)
if not Greece.IsObjectiveCompleted(InfiltrateTechCenterObj) then
Greece.MarkFailedObjective(InfiltrateTechCenterObj)
end
end)
end
Tick = function()
if DateTime.GameTime > DateTime.Seconds(10) and player.HasNoRequiredUnits() then
player.MarkFailedObjective(InfiltrateTechCenterObj)
if DateTime.GameTime > DateTime.Seconds(10) and Greece.HasNoRequiredUnits() then
Greece.MarkFailedObjective(InfiltrateTechCenterObj)
end
if DestroySovietsObj and ussr.HasNoRequiredUnits() then
player.MarkCompletedObjective(DestroySovietsObj)
if DestroySovietsObj and USSR.HasNoRequiredUnits() then
Greece.MarkCompletedObjective(DestroySovietsObj)
end
end
WorldLoaded = function()
player = Player.GetPlayer("Greece")
ussr = Player.GetPlayer("USSR")
Greece = Player.GetPlayer("Greece")
USSR = Player.GetPlayer("USSR")
InitObjectives(player)
InitObjectives(Greece)
InfiltrateTechCenterObj = AddPrimaryObjective(player, "infiltrate-tech-center-spy")
CaptureRadarDomeObj = AddSecondaryObjective(player, "capture-radar-shore")
InfiltrateTechCenterObj = AddPrimaryObjective(Greece, "infiltrate-tech-center-spy")
CaptureRadarDomeObj = AddSecondaryObjective(Greece, "capture-radar-shore")
Camera.Position = DefaultCameraPosition.CenterPosition
@@ -196,9 +196,9 @@ WorldLoaded = function()
end)
Trigger.OnEnteredProximityTrigger(SovietMiniBaseCam.CenterPosition, WDist.New(1024 * 6), function(a, id)
if a.Owner == player then
if a.Owner == Greece then
Trigger.RemoveProximityTrigger(id)
local cam = Actor.Create("Camera", true, { Owner = player, Location = SovietMiniBaseCam.Location })
local cam = Actor.Create("Camera", true, { Owner = Greece, Location = SovietMiniBaseCam.Location })
Trigger.AfterDelay(DateTime.Seconds(15), cam.Destroy)
end
end)