mirror of
https://github.com/weyne85/DML.git
synced 2025-10-29 16:57:49 +00:00
Version 2.3.9
2024 year's end release Fogger.
This commit is contained in:
parent
88026bf851
commit
bb301ecb30
Binary file not shown.
Binary file not shown.
@ -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")
|
||||
|
||||
90
modules/fogger.lua
Normal file
90
modules/fogger.lua
Normal file
@ -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?", "<none>")
|
||||
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
|
||||
@ -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()]
|
||||
if vicType then uScore = cfxPlayerScore.typeScore[vicType:upper()] end
|
||||
end
|
||||
if type(uScore) == "string" then
|
||||
-- convert string to number
|
||||
|
||||
BIN
tutorial & demo missions/demo - foggy bottoms.miz
Normal file
BIN
tutorial & demo missions/demo - foggy bottoms.miz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user