From ad8938cd7495113eeb8ef0ce1853e251988817cd Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sat, 15 Apr 2023 16:17:01 +0200 Subject: [PATCH 1/3] #CTLD * Small fix allowing minus signs in template names for repairs --- Moose Development/Moose/Ops/CTLD.lua | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index 891afc964..de81e6604 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -22,7 +22,7 @@ -- @module Ops.CTLD -- @image OPS_CTLD.jpg --- Last Update Mar 2023 +-- Last Update Apr 2023 do @@ -1220,7 +1220,7 @@ CTLD.UnitTypes = { --- CTLD class version. -- @field #string version -CTLD.version="1.0.33" +CTLD.version="1.0.34" --- Instantiate a new CTLD. -- @param #CTLD self @@ -2007,6 +2007,7 @@ end function CTLD:_FindRepairNearby(Group, Unit, Repairtype) self:T(self.lid .. " _FindRepairNearby") + --self:I({Group:GetName(),Unit:GetName(),Repairtype}) local unitcoord = Unit:GetCoordinate() -- find nearest group of deployed groups @@ -2023,7 +2024,9 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype) nearestDistance = distance end end - + + --self:I("Distance: ".. nearestDistance) + -- found one and matching distance? if nearestGroup == nil or nearestDistance > self.EngineerSearch then self:_SendMessage("No unit close enough to repair!", 10, false, Group) @@ -2035,8 +2038,10 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype) -- helper to find matching template local function matchstring(String,Table) local match = false - if type(Table) == "table" then + String = string.gsub(String,"-"," ") + if type(Table) == "table" then for _,_name in pairs (Table) do + _name = string.gsub(_name,"-"," ") if string.find(String,_name) then match = true break @@ -2044,6 +2049,7 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype) end else if type(String) == "string" then + Table = string.gsub(Table,"-"," ") if string.find(String,Table) then match = true end end end @@ -2053,6 +2059,7 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype) -- walk through generics and find matching type local Cargotype = nil for k,v in pairs(self.Cargo_Crates) do + --self:I({groupname,v.Templates,Repairtype}) if matchstring(groupname,v.Templates) and matchstring(groupname,Repairtype) then Cargotype = v -- #CTLD_CARGO break @@ -2062,6 +2069,7 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype) if Cargotype == nil then return nil, nil else + --self:I({groupname,Cargotype}) return nearestGroup, Cargotype end @@ -2076,7 +2084,7 @@ end -- @param #number Number Number of objects in Crates (found) to limit search. -- @param #boolean Engineering If true it is an Engineering repair. function CTLD:_RepairObjectFromCrates(Group,Unit,Crates,Build,Number,Engineering) - self:T(self.lid .. " _RepairObjectFromCrates") + self:T(self.lid .. " _RepairObjectFromCrates") local build = Build -- -- #CTLD.Buildable local Repairtype = build.Template -- #string local NearestGroup, CargoType = self:_FindRepairNearby(Group,Unit,Repairtype) -- Wrapper.Group#GROUP, #CTLD_CARGO From b402a99a253a94ef9efb5c9cdfa0e4447fbc9f0a Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sat, 15 Apr 2023 16:19:35 +0200 Subject: [PATCH 2/3] #CTLD * Small fix allowing minus signs in template names for repairs --- Moose Development/Moose/Ops/CTLD.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index 8da145b64..9ce71bb8f 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -22,7 +22,7 @@ -- @module Ops.CTLD -- @image OPS_CTLD.jpg --- Last Update Mar 2023 +-- Last Update Apr 2023 do @@ -2005,6 +2005,7 @@ end function CTLD:_FindRepairNearby(Group, Unit, Repairtype) self:T(self.lid .. " _FindRepairNearby") + --self:I({Group:GetName(),Unit:GetName(),Repairtype}) local unitcoord = Unit:GetCoordinate() -- find nearest group of deployed groups @@ -2035,6 +2036,7 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype) local match = false if type(Table) == "table" then for _,_name in pairs (Table) do + _name = string.gsub(_name,"-"," ") if string.find(String,_name) then match = true break @@ -2042,6 +2044,7 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype) end else if type(String) == "string" then + Table = string.gsub(Table,"-"," ") if string.find(String,Table) then match = true end end end @@ -2051,6 +2054,7 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype) -- walk through generics and find matching type local Cargotype = nil for k,v in pairs(self.Cargo_Crates) do + --self:I({groupname,v.Templates,Repairtype}) if matchstring(groupname,v.Templates) and matchstring(groupname,Repairtype) then Cargotype = v -- #CTLD_CARGO break @@ -2060,6 +2064,7 @@ function CTLD:_FindRepairNearby(Group, Unit, Repairtype) if Cargotype == nil then return nil, nil else + --self:I({groupname,Cargotype}) return nearestGroup, Cargotype end From 49b702106a695c6f5dac35adea861880c4de79c6 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 16 Apr 2023 12:29:57 +0200 Subject: [PATCH 3/3] Update Weapon.lua - Decreased min possible time step to 0.00001 seconds --- Moose Development/Moose/Wrapper/Weapon.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Weapon.lua b/Moose Development/Moose/Wrapper/Weapon.lua index b8437d7ca..3e6e98092 100644 --- a/Moose Development/Moose/Wrapper/Weapon.lua +++ b/Moose Development/Moose/Wrapper/Weapon.lua @@ -804,7 +804,7 @@ function WEAPON:_TrackWeapon(time) -- Return next time the function is called or nil to stop the scheduler. if self.tracking then - if self.dtTrack and self.dtTrack>0.001 then + if self.dtTrack and self.dtTrack>=0.00001 then return time+self.dtTrack else return nil