mirror of
https://github.com/weyne85/DML.git
synced 2025-10-29 16:57:49 +00:00
Version 2.3.7
"drivable" support for spawners, some QoL, attribute deconflict
This commit is contained in:
parent
b498a4e803
commit
491a9d0838
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
cfxZones = {}
|
||||
cfxZones.version = "4.4.3"
|
||||
cfxZones.version = "4.4.4"
|
||||
|
||||
-- cf/x zone management module
|
||||
-- reads dcs zones and makes them accessible and mutable
|
||||
@ -33,6 +33,7 @@ cfxZones.version = "4.4.3"
|
||||
-4.4.1 - better verbosity for error in doPollFlag()
|
||||
-4.4.2 - twn support for wildcards <twn: > and <loc:>
|
||||
-4.4.3 - property name is trimmed (double check)
|
||||
-4.4.4 - createGroundUnitsInZoneForCoalition supports drivable
|
||||
--]]--
|
||||
|
||||
--
|
||||
@ -1397,12 +1398,21 @@ end
|
||||
|
||||
|
||||
-- creating units in a zone
|
||||
function cfxZones.createGroundUnitsInZoneForCoalition (theCoalition, groupName, theZone, theUnits, formation, heading, liveries)
|
||||
function cfxZones.createGroundUnitsInZoneForCoalition (theCoalition, groupName, theZone, theUnits, formation, heading, liveries, drivable)
|
||||
-- theUnits can be string or table of string
|
||||
if not groupName then groupName = "G_"..theZone.name end
|
||||
if not drivable then drivable = false end
|
||||
-- group name will be taken from zone name and prependend with "G_"
|
||||
local theGroup = dcsCommon.createGroundGroupWithUnits(groupName, theUnits, theZone.radius, nil, formation, nil, liveries)
|
||||
|
||||
theGroup.uncontrollable = false -- just for completeness
|
||||
if drivable then
|
||||
local units = theGroup.units
|
||||
for idx, theUnit in pairs(units) do
|
||||
theUnit.playerCanDrive = drivable
|
||||
end
|
||||
end
|
||||
|
||||
-- turn the entire formation to heading
|
||||
if (not heading) then heading = 0 end
|
||||
dcsCommon.rotateGroupData(theGroup, heading) -- currently, group is still at origin, no cx, cy
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
countDown = {}
|
||||
countDown.version = "2.0.0"
|
||||
countDown.version = "2.0.1"
|
||||
countDown.verbose = false
|
||||
countDown.ups = 1
|
||||
countDown.requiredLibs = {
|
||||
@ -17,6 +17,8 @@ countDown.requiredLibs = {
|
||||
output method defaults to "inc"
|
||||
better config parsing
|
||||
cleanup
|
||||
2.0.1 - deconflicting 'count?' attribute: removed
|
||||
|
||||
--]]--
|
||||
|
||||
countDown.counters = {}
|
||||
@ -91,19 +93,21 @@ function countDown.createCountDownWithZone(theZone)
|
||||
theZone.ctdwnTriggerMethod = theZone:getStringFromZoneProperty("ctdwnTriggerMethod", "change")
|
||||
end
|
||||
|
||||
-- trigger flag "count" / "start?"
|
||||
-- using deprecated input "count?"
|
||||
if theZone:hasProperty("count?") then
|
||||
theZone.triggerCountFlag = theZone:getStringFromZoneProperty("count?", "<none>")
|
||||
elseif theZone:hasProperty("clock?") then
|
||||
theZone.triggerCountFlag = theZone:getStringFromZoneProperty("clock?", "<none>")
|
||||
-- can also use in? for counting. we always use triggerCountFlag
|
||||
elseif theZone:hasProperty("in?") then
|
||||
theZone.triggerCountFlag = theZone:getStringFromZoneProperty("in?", "<none>")
|
||||
end
|
||||
|
||||
if theZone.triggerCountFlag then
|
||||
theZone.lastCountTriggerValue = cfxZones.getFlagValue(theZone.triggerCountFlag, theZone)
|
||||
end
|
||||
trigger.action.outText("+++WARNING: countdown zone <" .. theZone.name .. "> uses deprecated 'count?' input: ignored, will not trigger.", 30)
|
||||
else
|
||||
if theZone:hasProperty("clock?") then
|
||||
theZone.triggerCountFlag = theZone:getStringFromZoneProperty("clock?", "<none>")
|
||||
elseif theZone:hasProperty("in?") then
|
||||
theZone.triggerCountFlag = theZone:getStringFromZoneProperty("in?", "<none>")
|
||||
else
|
||||
trigger.action.outText("+++WARNING: countdown zone <" .. theZone.name .. "> requires input: 'clock?' or 'in?', cannot trigger.", 30)
|
||||
end
|
||||
if theZone.triggerCountFlag then
|
||||
theZone.lastCountTriggerValue = cfxZones.getFlagValue(theZone.triggerCountFlag, theZone)
|
||||
end
|
||||
end
|
||||
|
||||
-- reset
|
||||
if theZone:hasProperty("reset?") then
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
income = {}
|
||||
income.version = "0.0.0"
|
||||
income.version = "0.9.8"
|
||||
income.requiredLibs = {
|
||||
"dcsCommon", -- always
|
||||
"cfxZones", -- Zones, of course
|
||||
@ -8,7 +8,6 @@ income.requiredLibs = {
|
||||
|
||||
income.sources = {}
|
||||
|
||||
|
||||
function income.addIncomeZone(theZone)
|
||||
income.sources[theZone.name] = theZone
|
||||
end
|
||||
@ -35,12 +34,7 @@ function income.update()
|
||||
-- schedule next round
|
||||
timer.scheduleFunction(income.update, {}, timer.getTime() + income.interval)
|
||||
|
||||
local neuI, redI, blueI = income.neutral, income.red, income.blue
|
||||
-- base income
|
||||
-- bank.addFunds(0, income.neutral)
|
||||
-- bank.addFunds(1, income.red)
|
||||
-- bank.addFunds(2, income.blue)
|
||||
|
||||
local neuI, redI, blueI = income.neutral, income.red, income.blue
|
||||
|
||||
for idx, theZone in pairs(income.sources) do
|
||||
local ni = income.getIncomeForZoneAndCoa(theZone, 0)
|
||||
@ -50,14 +44,26 @@ function income.update()
|
||||
blueI = blueI + bi
|
||||
neuI = neuI + ni
|
||||
end
|
||||
|
||||
bank.addFunds(0, neuI)
|
||||
bank.addFunds(1, redI)
|
||||
bank.addFunds(2, blueI)
|
||||
|
||||
if income.requirePlayers then
|
||||
local p = coalition.getPlayers(0)
|
||||
if #p > 0 then
|
||||
bank.addFunds(0, neuI)
|
||||
end
|
||||
p = coalition.getPlayers(1)
|
||||
if #p > 0 then
|
||||
bank.addFunds(1, redI)
|
||||
end
|
||||
p = coalition.getPlayers(2)
|
||||
if #p > 0 then
|
||||
bank.addFunds(2, blueI)
|
||||
end
|
||||
else
|
||||
bank.addFunds(0, neuI)
|
||||
bank.addFunds(1, redI)
|
||||
bank.addFunds(2, blueI)
|
||||
end
|
||||
|
||||
if income.announceTicks then
|
||||
-- trigger.action.outText(income.tickMessage, 30)
|
||||
local has, balance = bank.getBalance(0)
|
||||
local tick = string.gsub(income.tickMessage, "<i>", neuI)
|
||||
trigger.action.outTextForCoalition(0, "\n" .. tick .. "\nNew balance: §" .. balance .. "\n", 30)
|
||||
@ -81,17 +87,15 @@ function income.readConfigZone()
|
||||
if not theZone then
|
||||
theZone = cfxZones.createSimpleZone("incomeConfig")
|
||||
end
|
||||
|
||||
income.base = theZone:getNumberFromZoneProperty ("base", 10)
|
||||
income.red = theZone:getNumberFromZoneProperty ("red", income.base)
|
||||
income.blue = theZone:getNumberFromZoneProperty ("blue", income.base)
|
||||
income.neutral = theZone:getNumberFromZoneProperty ("neutral", income.base)
|
||||
|
||||
income.interval = theZone:getNumberFromZoneProperty("interval", 10 * 60) -- every 10 minutes
|
||||
income.tickMessage = theZone:getStringFromZoneProperty("tickMessage", "New funds from income available: §<i>")
|
||||
income.announceTicks = theZone:getBoolFromZoneProperty("announceTicks", true)
|
||||
income.reportSound = theZone:getStringFromZoneProperty("reportSound", "<none>")
|
||||
|
||||
income.requirePlayers = theZone:getBoolFromZoneProperty("requirePlayers", true)
|
||||
income.verbose = theZone.verbose
|
||||
end
|
||||
|
||||
@ -118,7 +122,6 @@ function income.start()
|
||||
|
||||
-- schedule first tick
|
||||
timer.scheduleFunction(income.update, {}, timer.getTime() + income.interval)
|
||||
|
||||
trigger.action.outText("income v" .. income.version .. " started.", 30)
|
||||
return true
|
||||
end
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
messenger = {}
|
||||
messenger.version = "3.2.0"
|
||||
messenger.version = "3.2.1"
|
||||
messenger.verbose = false
|
||||
messenger.requiredLibs = {
|
||||
"dcsCommon", -- always
|
||||
@ -14,7 +14,8 @@ messenger.messengers = {}
|
||||
3.1.0 - msgGroup supports multiple groups, separated by comma
|
||||
- msgUnit supports multiple units, separated by comma
|
||||
3.2.0 - loc and twn wildcard support (inherited from zones)
|
||||
|
||||
3.2.1 - corrected typo in verbose on trigger message
|
||||
- increased verbosity when active for audio
|
||||
--]]--
|
||||
|
||||
function messenger.addMessenger(theZone)
|
||||
@ -32,7 +33,6 @@ function messenger.getMessengerByName(aName)
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Dynamic Group and Dynamic Unit processing are
|
||||
-- unique to messenger, and are not available via
|
||||
@ -165,7 +165,6 @@ function messenger.dynamicUnitProcessing(inMsg, theZone, theUnit)
|
||||
return outMsg
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- read attributes
|
||||
--
|
||||
@ -313,8 +312,7 @@ function messenger.getMessage(theZone)
|
||||
|
||||
-- remainder hand-off to cfxZones (refactoring of messenger code
|
||||
msg = cfxZones.processStringWildcards(msg, theZone, theZone.msgTimeFormat, theZone.imperialUnits, theZone.msgResponses)
|
||||
|
||||
|
||||
|
||||
return msg
|
||||
end
|
||||
|
||||
@ -322,7 +320,7 @@ function messenger.isTriggered(theZone)
|
||||
-- this module has triggered
|
||||
if theZone.messageOff then
|
||||
if messenger.verbose or theZone.verbose then
|
||||
trigger.action.outFlag("msg: message for <".. theZone.name .."> is OFF",30)
|
||||
trigger.action.outText("msg: message for <".. theZone.name .."> is OFF",30)
|
||||
end
|
||||
return
|
||||
end
|
||||
@ -341,6 +339,9 @@ function messenger.isTriggered(theZone)
|
||||
trigger.action.outTextForCoalition(theZone.msgCoalition, msg, theZone.duration, theZone.clearScreen)
|
||||
end
|
||||
trigger.action.outSoundForCoalition(theZone.msgCoalition, fileName)
|
||||
if messenger.verbose or theZone.verbose then
|
||||
trigger.action.outText("+++msg: messenger in <" .. theZone.name .. "> playing sound file <" .. fileName .. "> to coa " .. theZone.msgCoalition, 30)
|
||||
end
|
||||
elseif theZone.msgGroup then
|
||||
for idx, aGroupName in pairs(theZone.msgGroup) do
|
||||
local theGroup = Group.getByName(aGroupName)
|
||||
@ -351,6 +352,9 @@ function messenger.isTriggered(theZone)
|
||||
trigger.action.outTextForGroup(ID, msg, theZone.duration, theZone.clearScreen)
|
||||
end
|
||||
trigger.action.outSoundForGroup(ID, fileName)
|
||||
if messenger.verbose or theZone.verbose then
|
||||
trigger.action.outText("+++msg: messenger in <" .. theZone.name .. "> playing sound file <" .. fileName .. "> to unit group ID " .. ID .. " <" .. theGroup:getName() .. ">", 30)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif theZone.msgUnit then
|
||||
@ -363,6 +367,9 @@ function messenger.isTriggered(theZone)
|
||||
trigger.action.outTextForUnit(ID, msg, theZone.duration, theZone.clearScreen)
|
||||
end
|
||||
trigger.action.outSoundForUnit(ID, fileName)
|
||||
if messenger.verbose or theZone.verbose then
|
||||
trigger.action.outText("+++msg: messenger in <" .. theZone.name .. "> playing sound file <" .. fileName .. "> to unit ID " .. ID, 30)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif theZone:getLinkedUnit() then
|
||||
@ -379,19 +386,24 @@ function messenger.isTriggered(theZone)
|
||||
trigger.action.outTextForCoalition(coa, msg, theZone.duration, theZone.clearScreen)
|
||||
end
|
||||
trigger.action.outSoundForCoalition(coa, fileName)
|
||||
if messenger.verbose or theZone.verbose then
|
||||
trigger.action.outText("+++msg: messenger in <" .. theZone.name .. "> playing sound file <" .. fileName .. "> to coa " .. coa, 30)
|
||||
end
|
||||
else
|
||||
-- out to all
|
||||
if #msg > 0 or theZone.clearScreen then
|
||||
trigger.action.outText(msg, theZone.duration, theZone.clearScreen)
|
||||
end
|
||||
trigger.action.outSound(fileName)
|
||||
if messenger.verbose or theZone.verbose then
|
||||
trigger.action.outText("+++msg: messenger in <" .. theZone.name .. "> playing sound file to all <" .. fileName .. ">", 30)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function messenger.update()
|
||||
-- call me in a second to poll triggers
|
||||
timer.scheduleFunction(messenger.update, {}, timer.getTime() + 1)
|
||||
|
||||
timer.scheduleFunction(messenger.update, {}, timer.getTime() + 1)
|
||||
for idx, aZone in pairs(messenger.messengers) do
|
||||
-- make sure to re-start before reading time limit
|
||||
-- new trigger code
|
||||
@ -432,9 +444,7 @@ function messenger.readConfigZone()
|
||||
end
|
||||
theZone = cfxZones.createSimpleZone("messengerConfig")
|
||||
end
|
||||
|
||||
messenger.verbose = theZone:getBoolFromZoneProperty("verbose", false)
|
||||
|
||||
if messenger.verbose then
|
||||
trigger.action.outText("+++msgr: read config", 30)
|
||||
end
|
||||
@ -452,16 +462,7 @@ function messenger.start()
|
||||
|
||||
-- read config
|
||||
messenger.readConfigZone()
|
||||
|
||||
-- process messenger Zones
|
||||
-- old style
|
||||
--[[--
|
||||
local attrZones = cfxZones.getZonesWithAttributeNamed("messenger")
|
||||
for k, aZone in pairs(attrZones) do
|
||||
messenger.createMessengerWithZone(aZone) -- process attributes
|
||||
messenger.addMessenger(aZone) -- add to list
|
||||
end
|
||||
--]]--
|
||||
|
||||
-- new style that saves messageOut? flag by reading flags
|
||||
attrZones = cfxZones.getZonesWithAttributeNamed("messenger?")
|
||||
for k, aZone in pairs(attrZones) do
|
||||
|
||||
@ -7,6 +7,7 @@ cfxSmokeZone.requiredLibs = {
|
||||
--[[--
|
||||
Version History
|
||||
2.0.0 - clean up
|
||||
2.0.1 - deprecating "f?"
|
||||
|
||||
--]]--
|
||||
cfxSmokeZone.smokeZones = {}
|
||||
@ -37,6 +38,7 @@ function cfxSmokeZone.processSmokeZone(aZone)
|
||||
|
||||
if aZone:hasProperty("f?") then
|
||||
aZone.onFlag = aZone:getStringFromZoneProperty("f?", "*<none>")
|
||||
trigger.action.outText("+++smokeZones: WARNING: smoke zone <" .. aZone.name .. "> uses deprecated attribute 'f?' - use 'startSmoke?' instead.", 30)
|
||||
elseif aZone:hasProperty("startSmoke?") then
|
||||
aZone.onFlag = aZone:getStringFromZoneProperty("startSmoke?", "none")
|
||||
end
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
cfxSpawnZones = {}
|
||||
cfxSpawnZones.version = "2.1.0"
|
||||
cfxSpawnZones.version = "2.2.0"
|
||||
cfxSpawnZones.requiredLibs = {
|
||||
"dcsCommon", -- common is of course needed for everything
|
||||
-- pretty stupid to check for this since we
|
||||
@ -31,6 +31,7 @@ cfxSpawnZones.spawnedGroups = {}
|
||||
2.0.3 - corrected type in spawnUnits? attribute
|
||||
2.1.0 - masterOwner update for dmlZones.
|
||||
since spawners don't extend zones, this is still old-school
|
||||
2.2.0 - "drivable" spawner attribute
|
||||
|
||||
--]]--
|
||||
|
||||
@ -109,7 +110,7 @@ function cfxSpawnZones.createSpawner(inZone)
|
||||
end
|
||||
theSpawner.types = theSpawner.types .. repeater
|
||||
end
|
||||
|
||||
theSpawner.drivable = inZone:getBoolFromZoneProperty("drivable", false)
|
||||
theSpawner.country = inZone:getNumberFromZoneProperty("country", 0)
|
||||
if inZone:hasProperty("masterOwner") then
|
||||
theSpawner.masterZoneName = inZone:getStringFromZoneProperty("masterOwner", "")
|
||||
@ -299,7 +300,10 @@ function cfxSpawnZones.spawnWithSpawner(aSpawner)
|
||||
aSpawner.zone,
|
||||
unitTypes,
|
||||
aSpawner.formation,
|
||||
aSpawner.heading)
|
||||
aSpawner.heading,
|
||||
nil, -- liveries
|
||||
aSpawner.drivable
|
||||
)
|
||||
if cfxSpawnZones.verbose or theZone.verbose then
|
||||
-- check created group size versus requested size
|
||||
trigger.action.outText("+++spwn: created <" .. theGroup:getSize() .. "> units, requested <" .. #unitTypes .. "> units, formation <" .. aSpawner.formation .. ">", 30)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user