From b9b5938a911397973fafc2ef16f2e6b5304f467c Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 13 Nov 2021 20:08:22 +0100 Subject: [PATCH] OPS - Fixed refuel system always true. --- Moose Development/Moose/Ops/Cohort.lua | 2 +- Moose Development/Moose/Ops/Legion.lua | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Ops/Cohort.lua b/Moose Development/Moose/Ops/Cohort.lua index f23704450..3dde5b505 100644 --- a/Moose Development/Moose/Ops/Cohort.lua +++ b/Moose Development/Moose/Ops/Cohort.lua @@ -75,7 +75,7 @@ COHORT = { --- COHORT class version. -- @field #string version -COHORT.version="0.0.2" +COHORT.version="0.1.0" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list diff --git a/Moose Development/Moose/Ops/Legion.lua b/Moose Development/Moose/Ops/Legion.lua index 6a6704717..d85b696da 100644 --- a/Moose Development/Moose/Ops/Legion.lua +++ b/Moose Development/Moose/Ops/Legion.lua @@ -1947,7 +1947,19 @@ function LEGION.RecruitCohortAssets(Cohorts, MissionTypeRecruit, MissionTypeOpt, local InRange=(RangeMax and math.max(RangeMax, cohort.engageRange) or cohort.engageRange) >= TargetDistance -- Has the requested refuelsystem? - local Refuel=RefuelSystem and RefuelSystem==cohort.tankerSystem or true + local Refuel=RefuelSystem~=nil and (RefuelSystem==cohort.tankerSystem) or true + + -- STRANGE: Why did the above line did not give the same result?! Above Refuel is always true! + local Refuel=true + if RefuelSystem then + if cohort.tankerSystem then + Refuel=RefuelSystem==cohort.tankerSystem + else + Refuel=false + end + end + + --env.info(string.format("Cohort=%s: RefuelSystem=%s, TankerSystem=%s ==> Refuel=%s", cohort.name, tostring(RefuelSystem), tostring(cohort.tankerSystem), tostring(Refuel))) -- Is capable of the mission type? local Capable=AUFTRAG.CheckMissionCapability({MissionTypeRecruit}, cohort.missiontypes)