diff --git a/Doc/DML Documentation.pdf b/Doc/DML Documentation.pdf index 8bef0e5..7b73647 100644 Binary files a/Doc/DML Documentation.pdf and b/Doc/DML Documentation.pdf differ diff --git a/Doc/DML Quick Reference.pdf b/Doc/DML Quick Reference.pdf index 4d098bd..badc390 100644 Binary files a/Doc/DML Quick Reference.pdf and b/Doc/DML Quick Reference.pdf differ diff --git a/modules/cloneZone.lua b/modules/cloneZone.lua index c6a5ede..91697d9 100644 --- a/modules/cloneZone.lua +++ b/modules/cloneZone.lua @@ -59,6 +59,7 @@ cloneZones.respawnOnGroupID = true 2.4.0 - reworked masterOwner to fit with dmlZone 2.5.0 - re-establish spawn zone in persistence to provide empty! detection through saves (missed hasClones) + 2.5.1 - f? and in? put on notice for depreciation --]]-- -- @@ -215,9 +216,9 @@ function cloneZones.createClonerWithZone(theZone) -- has "Cloner" theZone.cloneTriggerMethod = theZone:getStringFromZoneProperty("cloneTriggerMethod", "change") end - if theZone:hasProperty("f?") then + if theZone:hasProperty("f?") then -- deprecated! theZone.spawnFlag = theZone:getStringFromZoneProperty("f?", "none") - elseif theZone:hasProperty("in?") then + elseif theZone:hasProperty("in?") then -- deprecated theZone.spawnFlag = theZone:getStringFromZoneProperty("in?", "none") elseif theZone:hasProperty("spawn?") then theZone.spawnFlag = theZone:getStringFromZoneProperty("spawn?", "none") diff --git a/modules/fogger.lua b/modules/fogger.lua new file mode 100644 index 0000000..dad2e08 --- /dev/null +++ b/modules/fogger.lua @@ -0,0 +1,90 @@ +fogger = {} +fogger.version = "1.0.0" +fogger.requiredLibs = { + "dcsCommon", + "cfxZones", +} +fogger.zones = {} + +--[[-- Version history + A DML module (c) 2024 by Christian FRanz + +- 1.0.0 - Initial version +--]]-- + +function fogger.createFogZone(theZone) + theZone.fogger = theZone:getStringFromZoneProperty("fog?", "") + theZone.lastFogger = trigger.misc.getUserFlag(theZone.fogger) + fogger.triggerMethod = theZone:getStringFromZoneProperty("triggerMethod", "change") + if theZone:hasProperty("visibility") then + theZone.visMin, theZone.visMax = theZone:getPositiveRangeFromZoneProperty("visibility", 0, 0) + end + if theZone:hasProperty("thickness") then + theZone.thickMin, theZone.thickMax = theZone:getPositiveRangeFromZoneProperty("thickness", 0,0) + end + theZone.durMin, theZone.durMax = theZone:getPositiveRangeFromZoneProperty ("duration", 1, 1) +end + +function fogger.doFog(theZone) + local vis = world.weather.getFogVisibilityDistance() + if theZone.visMin then vis = dcsCommon.randomBetween(theZone.visMin, theZone.visMax) end + if vis < 100 then vis = 0 end + local thick = world.weather.getFogThickness() + if theZone.thickMin then thick = dcsCommon.randomBetween(theZone.thickMin, theZone.thickMax) end + if thick < 100 then thick = 0 end + local dur = dcsCommon.randomBetween(theZone.durMin, theZone.durMax) + if theZone.verbose or fogger.verbose then + trigger.action.outText("+++fog: will set fog vis = <" .. vis .. ">, thick = <" .. thick .. ">, transition <" .. dur .. "> secs", 30) + end + world.weather.setFogAnimation({{dur, vis, thick}}) +end + +-- update +function fogger.update() + timer.scheduleFunction(fogger.update, nil, timer.getTime() + 1/fogger.ups) + for idx, theZone in pairs(fogger.zones) do + if theZone:testZoneFlag(theZone.fogger, theZone.triggerMethod, "lastFogger") then fogger.doFog(theZone) end + end +end + +-- config +function fogger.readConfigZone() + -- note: must match exactly!!!! + local theZone = cfxZones.getZoneByName("foggerConfig") + if not theZone then + theZone = cfxZones.createSimpleZone("foggerConfig") + end + fogger.ups = theZone:getNumberFromZoneProperty("ups", 1) + fogger.name = "fogger" + fogger.verbose = theZone.verbose +end + +-- go go go +function fogger.start() + -- lib check + if not dcsCommon.libCheck then + trigger.action.outText("fogger requires dcsCommon", 30) + return false + end + if not dcsCommon.libCheck("fogger", fogger.requiredLibs) then + return false + end + -- read config + fogger.readConfigZone() + -- process "fog?" Zones + local attrZones = cfxZones.getZonesWithAttributeNamed("fog?") + for k, aZone in pairs(attrZones) do + fogger.createFogZone(aZone) + fogger.zones[aZone.name] = aZone + end + -- invoke update + fogger.update() + trigger.action.outText("Fogger v" .. fogger.version .. " started.", 30) + return true +end + +-- let's go! +if not fogger.start() then + trigger.action.outText("fogger aborted: error on start", 30) + fogger = nil +end diff --git a/modules/playerScore.lua b/modules/playerScore.lua index 4181482..8746d08 100644 --- a/modules/playerScore.lua +++ b/modules/playerScore.lua @@ -1,5 +1,5 @@ cfxPlayerScore = {} -cfxPlayerScore.version = "5.0.0" +cfxPlayerScore.version = "5.0.1" cfxPlayerScore.name = "cfxPlayerScore" -- compatibility with flag bangers cfxPlayerScore.firstSave = true -- to force overwrite --[[-- VERSION HISTORY @@ -20,6 +20,7 @@ cfxPlayerScore.firstSave = true -- to force overwrite 5.0.0 - resolve killed units via cfxMX to patch DCS error - reworked unit2score to use MX - code cleanup + 5.0.1 - code hardening against name, type nilling TODO: Kill event no longer invoked for map objetcs, attribute to faction now, reverse invocation direction with PlayerScore @@ -283,15 +284,16 @@ function cfxPlayerScore.unit2score(inUnit) -- simply extend by adding items to the typescore table.concat -- we first try by unit name. This allows individual -- named hi-value targets to have individual scores - local uScore = cfxPlayerScore.typeScore[vicName:upper()] + local uScore + if vicName then uScore = cfxPlayerScore.typeScore[vicName:upper()] end -- see if all members of group score if (not uScore) then -- and vicGroup then local grpName = cfxMX.spawnedUnitGroupNameByName[vicName]--vicGroup:getName() - uScore = cfxPlayerScore.typeScore[grpName:upper()] + if grpName then uScore = cfxPlayerScore.typeScore[grpName:upper()] end end if not uScore then - -- WE NOW TRY TO ACCESS BY VICTIM'S TYPE STRING - uScore = cfxPlayerScore.typeScore[vicType:upper()] + -- WE NOW TRY TO ACCESS BY VICTIM'S TYPE STRING + if vicType then uScore = cfxPlayerScore.typeScore[vicType:upper()] end end if type(uScore) == "string" then -- convert string to number diff --git a/tutorial & demo missions/demo - foggy bottoms.miz b/tutorial & demo missions/demo - foggy bottoms.miz new file mode 100644 index 0000000..fab0844 Binary files /dev/null and b/tutorial & demo missions/demo - foggy bottoms.miz differ