diff --git a/Moose Development/Moose/Core/Database.lua b/Moose Development/Moose/Core/Database.lua index e1a1e732d..040969abb 100644 --- a/Moose Development/Moose/Core/Database.lua +++ b/Moose Development/Moose/Core/Database.lua @@ -1820,7 +1820,7 @@ function DATABASE:_EventOnPlayerEnterUnit( Event ) if Event.IniDCSUnit then -- Player entering a CA slot - if Event.IniObjectCategory == 1 and Event.IniGroup and Event.IniGroup:IsGround() then + if Event.IniObjectCategory == 1 and Event.IniUnit and Event.IniUnit:IsGround() then local IsPlayer = Event.IniDCSUnit:getPlayerName() if IsPlayer then diff --git a/Moose Development/Moose/Core/MarkerOps_Base.lua b/Moose Development/Moose/Core/MarkerOps_Base.lua index 222866321..ae124bacf 100644 --- a/Moose Development/Moose/Core/MarkerOps_Base.lua +++ b/Moose Development/Moose/Core/MarkerOps_Base.lua @@ -50,7 +50,7 @@ MARKEROPS_BASE = { ClassName = "MARKEROPS", Tag = "mytag", Keywords = {}, - version = "0.1.4", + version = "0.1.5", debug = false, Casesensitive = true, } @@ -59,9 +59,8 @@ MARKEROPS_BASE = { -- @param #MARKEROPS_BASE self -- @param #string Tagname Name to identify us from the event text. -- @param #table Keywords Table of keywords recognized from the event text. --- @param #boolean Casesensitive (Optional) Switch case sensitive identification of Tagname. Defaults to true. -- @return #MARKEROPS_BASE self -function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive) +function MARKEROPS_BASE:New(Tagname,Keywords) -- Inherit FSM local self=BASE:Inherit(self, FSM:New()) -- #MARKEROPS_BASE @@ -72,11 +71,7 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive) self.Keywords = Keywords or {} -- #table - might want to use lua regex here, too self.debug = false self.Casesensitive = true - - if Casesensitive and Casesensitive == false then - self.Casesensitive = false - end - + ----------------------- --- FSM Transitions --- ----------------------- @@ -145,7 +140,7 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive) end ---- (internal) Handle events. +--- (Internal) Handle events. -- @param #MARKEROPS_BASE self -- @param Core.Event#EVENTDATA Event function MARKEROPS_BASE:OnEventMark(Event) @@ -201,15 +196,17 @@ function MARKEROPS_BASE:OnEventMark(Event) end end ---- (internal) Match tag. +--- (Internal) Match tag. -- @param #MARKEROPS_BASE self -- @param #string Eventtext Text added to the marker. -- @return #boolean function MARKEROPS_BASE:_MatchTag(Eventtext) local matches = false - if not self.Casesensitive then + self:I(self.lid .. "Casesensitive "..tostring(self.Casesensitive)) + if self.Casesensitive == false then + self:I(self.lid .. "Marker non-casesensitive "..Eventtext) local type = string.lower(self.Tag) -- #string - if string.find(string.lower(Eventtext),type) then + if string.find(string.lower(Eventtext),type,1,true) then matches = true --event text contains tag end else @@ -221,7 +218,7 @@ function MARKEROPS_BASE:_MatchTag(Eventtext) return matches end ---- (internal) Match keywords table. +--- (Internal) Match keywords table. -- @param #MARKEROPS_BASE self -- @param #string Eventtext Text added to the marker. -- @return #table @@ -286,6 +283,22 @@ function MARKEROPS_BASE:onenterStopped(From,Event,To) self:UnHandleEvent(EVENTS.MarkRemoved) end +--- Switch off case sensitive matching + -- @param #MARKEROPS_BASE self + -- @return self +function MARKEROPS_BASE:SwitchCaseSensitiveOff() + self.Casesensitive = false + return self +end + +--- Switch on case sensitive matching + -- @param #MARKEROPS_BASE self + -- @return self +function MARKEROPS_BASE:SwitchCaseSensitiveOn() + self.Casesensitive = true + return self +end + -------------------------------------------------------------------------- -- MARKEROPS_BASE Class Definition End. -------------------------------------------------------------------------- diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index 8306b83b2..1a00d02f7 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -141,7 +141,7 @@ CTLD_CARGO = { self.ResourceMap = nil self.StaticType = "container_cargo" -- "container_cargo" if self:IsStatic() then - self.StaticType = Templates or "container_cargo" + self.StaticType = self.Templates end self.StaticShape = nil self.TypeNames = nil @@ -7763,7 +7763,7 @@ end for _, _cgo in pairs(loadedcargo) do local cargo = _cgo local type = cargo.CargoType - local gname = cargo.Name + local gname = cargo:GetName() local gcargo = self:_FindCratesCargoObject(gname) or self:_FindTroopsCargoObject(gname) self:T("Looking at " .. gname .. " in the helo - type = "..tostring(type)) if (type == CTLD_CARGO.Enum.TROOPS or type == CTLD_CARGO.Enum.ENGINEERS or type == CTLD_CARGO.Enum.VEHICLE or type == CTLD_CARGO.Enum.FOB) then @@ -9238,8 +9238,12 @@ end elseif cargotype == CTLD_CARGO.Enum.STATIC or cargotype == CTLD_CARGO.Enum.REPAIR then injectstatic = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass) injectstatic:SetStaticTypeAndShape(StaticCategory,StaticType,StaticShape) - local map=cargotype:GetStaticResourceMap() - injectstatic:SetStaticResourceMap(map) + local unittemplate = _DATABASE:GetStaticUnitTemplate(cargoname) + local ResourceMap = nil + if unittemplate and unittemplate.resourcePayload then + ResourceMap = UTILS.DeepCopy(unittemplate.resourcePayload) + end + injectstatic:SetStaticResourceMap(ResourceMap) end if injectstatic then self:InjectStatics(dropzone,injectstatic,false,true)