mirror of
https://github.com/weyne85/DML.git
synced 2025-10-29 16:57:49 +00:00
Version 2.4.0
Happy new year! smoking smoke trails module
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
fogger = {}
|
||||
fogger.version = "1.0.0"
|
||||
fogger.version = "1.1.0"
|
||||
fogger.requiredLibs = {
|
||||
"dcsCommon",
|
||||
"cfxZones",
|
||||
@@ -9,7 +9,9 @@ fogger.zones = {}
|
||||
--[[-- Version history
|
||||
A DML module (c) 2024 by Christian FRanz
|
||||
|
||||
- 1.0.0 - Initial version
|
||||
- 1.0.0 - Initial version
|
||||
- 1.1.0 - added lcl attribute
|
||||
- added onStart
|
||||
--]]--
|
||||
|
||||
function fogger.createFogZone(theZone)
|
||||
@@ -22,7 +24,25 @@ function fogger.createFogZone(theZone)
|
||||
if theZone:hasProperty("thickness") then
|
||||
theZone.thickMin, theZone.thickMax = theZone:getPositiveRangeFromZoneProperty("thickness", 0,0)
|
||||
end
|
||||
theZone.lcl = theZone:getBoolFromZoneProperty("lcl", false)
|
||||
theZone.durMin, theZone.durMax = theZone:getPositiveRangeFromZoneProperty ("duration", 1, 1)
|
||||
if theZone:hasProperty("onStart") then
|
||||
--trigger.action.outText("+++fog: zone <" .. theZone.name .. "> HAS 'onStart' attribute", 30)
|
||||
theZone.onStart = theZone:getBoolFromZoneProperty("onStart", false)
|
||||
if theZone.onStart then
|
||||
if theZone.verbose then
|
||||
trigger.action.outText("+++fog: will schedule onStart fog in zone <" .. theZone.name .. ">", 30)
|
||||
end
|
||||
timer.scheduleFunction(fogger.doFog, theZone, timer.getTime() + 0.5)
|
||||
else
|
||||
--trigger.action.outText("+++ fog: onstart turned OFF", 30)
|
||||
end
|
||||
else
|
||||
--trigger.action.outText("+++fog: zone <" .. theZone.name .. "> no 'onStart' attribute, turned off", 30)
|
||||
end
|
||||
if theZone.verbose then
|
||||
trigger.action.outText("+++fog: zone <" .. theZone.name .. "> processed.", 30)
|
||||
end
|
||||
end
|
||||
|
||||
function fogger.doFog(theZone)
|
||||
@@ -31,7 +51,11 @@ function fogger.doFog(theZone)
|
||||
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
|
||||
if thick < 100 then thick = 0
|
||||
elseif theZone.lcl then
|
||||
local p = theZone:getPoint()
|
||||
thick = thick + land.getHeight({x = p.x, y = p.z})
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user