# Conflicts:
#	Moose Development/Moose/Ops/CTLD.lua
This commit is contained in:
Shafik
2025-12-18 10:03:54 +02:00
3 changed files with 35 additions and 18 deletions
+1 -1
View File
@@ -1820,7 +1820,7 @@ function DATABASE:_EventOnPlayerEnterUnit( Event )
if Event.IniDCSUnit then if Event.IniDCSUnit then
-- Player entering a CA slot -- 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() local IsPlayer = Event.IniDCSUnit:getPlayerName()
if IsPlayer then if IsPlayer then
+26 -13
View File
@@ -50,7 +50,7 @@ MARKEROPS_BASE = {
ClassName = "MARKEROPS", ClassName = "MARKEROPS",
Tag = "mytag", Tag = "mytag",
Keywords = {}, Keywords = {},
version = "0.1.4", version = "0.1.5",
debug = false, debug = false,
Casesensitive = true, Casesensitive = true,
} }
@@ -59,9 +59,8 @@ MARKEROPS_BASE = {
-- @param #MARKEROPS_BASE self -- @param #MARKEROPS_BASE self
-- @param #string Tagname Name to identify us from the event text. -- @param #string Tagname Name to identify us from the event text.
-- @param #table Keywords Table of keywords recognized 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 -- @return #MARKEROPS_BASE self
function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive) function MARKEROPS_BASE:New(Tagname,Keywords)
-- Inherit FSM -- Inherit FSM
local self=BASE:Inherit(self, FSM:New()) -- #MARKEROPS_BASE 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.Keywords = Keywords or {} -- #table - might want to use lua regex here, too
self.debug = false self.debug = false
self.Casesensitive = true self.Casesensitive = true
if Casesensitive and Casesensitive == false then
self.Casesensitive = false
end
----------------------- -----------------------
--- FSM Transitions --- --- FSM Transitions ---
----------------------- -----------------------
@@ -145,7 +140,7 @@ function MARKEROPS_BASE:New(Tagname,Keywords,Casesensitive)
end end
--- (internal) Handle events. --- (Internal) Handle events.
-- @param #MARKEROPS_BASE self -- @param #MARKEROPS_BASE self
-- @param Core.Event#EVENTDATA Event -- @param Core.Event#EVENTDATA Event
function MARKEROPS_BASE:OnEventMark(Event) function MARKEROPS_BASE:OnEventMark(Event)
@@ -201,15 +196,17 @@ function MARKEROPS_BASE:OnEventMark(Event)
end end
end end
--- (internal) Match tag. --- (Internal) Match tag.
-- @param #MARKEROPS_BASE self -- @param #MARKEROPS_BASE self
-- @param #string Eventtext Text added to the marker. -- @param #string Eventtext Text added to the marker.
-- @return #boolean -- @return #boolean
function MARKEROPS_BASE:_MatchTag(Eventtext) function MARKEROPS_BASE:_MatchTag(Eventtext)
local matches = false 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 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 matches = true --event text contains tag
end end
else else
@@ -221,7 +218,7 @@ function MARKEROPS_BASE:_MatchTag(Eventtext)
return matches return matches
end end
--- (internal) Match keywords table. --- (Internal) Match keywords table.
-- @param #MARKEROPS_BASE self -- @param #MARKEROPS_BASE self
-- @param #string Eventtext Text added to the marker. -- @param #string Eventtext Text added to the marker.
-- @return #table -- @return #table
@@ -286,6 +283,22 @@ function MARKEROPS_BASE:onenterStopped(From,Event,To)
self:UnHandleEvent(EVENTS.MarkRemoved) self:UnHandleEvent(EVENTS.MarkRemoved)
end 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. -- MARKEROPS_BASE Class Definition End.
-------------------------------------------------------------------------- --------------------------------------------------------------------------
+8 -4
View File
@@ -141,7 +141,7 @@ CTLD_CARGO = {
self.ResourceMap = nil self.ResourceMap = nil
self.StaticType = "container_cargo" -- "container_cargo" self.StaticType = "container_cargo" -- "container_cargo"
if self:IsStatic() then if self:IsStatic() then
self.StaticType = Templates or "container_cargo" self.StaticType = self.Templates
end end
self.StaticShape = nil self.StaticShape = nil
self.TypeNames = nil self.TypeNames = nil
@@ -7763,7 +7763,7 @@ end
for _, _cgo in pairs(loadedcargo) do for _, _cgo in pairs(loadedcargo) do
local cargo = _cgo local cargo = _cgo
local type = cargo.CargoType local type = cargo.CargoType
local gname = cargo.Name local gname = cargo:GetName()
local gcargo = self:_FindCratesCargoObject(gname) or self:_FindTroopsCargoObject(gname) local gcargo = self:_FindCratesCargoObject(gname) or self:_FindTroopsCargoObject(gname)
self:T("Looking at " .. gname .. " in the helo - type = "..tostring(type)) 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 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 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 = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
injectstatic:SetStaticTypeAndShape(StaticCategory,StaticType,StaticShape) injectstatic:SetStaticTypeAndShape(StaticCategory,StaticType,StaticShape)
local map=cargotype:GetStaticResourceMap() local unittemplate = _DATABASE:GetStaticUnitTemplate(cargoname)
injectstatic:SetStaticResourceMap(map) local ResourceMap = nil
if unittemplate and unittemplate.resourcePayload then
ResourceMap = UTILS.DeepCopy(unittemplate.resourcePayload)
end
injectstatic:SetStaticResourceMap(ResourceMap)
end end
if injectstatic then if injectstatic then
self:InjectStatics(dropzone,injectstatic,false,true) self:InjectStatics(dropzone,injectstatic,false,true)