mirror of
https://github.com/weyne85/DML.git
synced 2025-10-29 16:57:49 +00:00
Version 1.03
The Debugger
This commit is contained in:
parent
cb3cd4ccd2
commit
780797aba3
Binary file not shown.
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
rndFlags = {}
|
||||
rndFlags.version = "1.3.0"
|
||||
rndFlags.version = "1.3.1"
|
||||
rndFlags.verbose = false
|
||||
rndFlags.requiredLibs = {
|
||||
"dcsCommon", -- always
|
||||
@ -25,6 +25,10 @@ rndFlags.requiredLibs = {
|
||||
1.2.0 - Watchflag integration
|
||||
1.3.0 - DML simplification: RND!
|
||||
zone-local verbosity
|
||||
1.3.1 - 'done+1' --> 'done!', using rndMethod instead of 'inc'
|
||||
- added zonal verbosity
|
||||
- added 'rndDone!' flag
|
||||
- rndMethod defaults to "inc"
|
||||
|
||||
--]]
|
||||
rndFlags.rndGen = {}
|
||||
@ -147,12 +151,15 @@ function rndFlags.createRNDWithZone(theZone)
|
||||
theZone.onStart = cfxZones.getBoolFromZoneProperty(theZone, "onStart", false)
|
||||
|
||||
if not theZone.onStart and not theZone.triggerFlag then
|
||||
theZone.onStart = true
|
||||
-- theZone.onStart = true
|
||||
if true or theZone.verbose or rndFlags.verbose then
|
||||
trigger.action.outText("+++RND - WARNING: no triggers and no onStart, RND in <" .. theZone.name .. "> can't be triggered.", 30)
|
||||
end
|
||||
end
|
||||
|
||||
theZone.rndMethod = cfxZones.getStringFromZoneProperty(theZone, "method", "on")
|
||||
theZone.rndMethod = cfxZones.getStringFromZoneProperty(theZone, "method", "inc")
|
||||
if cfxZones.hasProperty(theZone, "rndMethod") then
|
||||
theZone.rndMethod = cfxZones.getStringFromZoneProperty(theZone, "rndMethod", "on")
|
||||
theZone.rndMethod = cfxZones.getStringFromZoneProperty(theZone, "rndMethod", "inc")
|
||||
end
|
||||
|
||||
theZone.reshuffle = cfxZones.getBoolFromZoneProperty(theZone, "reshuffle", false)
|
||||
@ -161,10 +168,17 @@ function rndFlags.createRNDWithZone(theZone)
|
||||
theZone.flagStore = dcsCommon.copyArray(theFlags)
|
||||
end
|
||||
|
||||
-- done flag
|
||||
-- done flag OLD, to be deprecated
|
||||
if cfxZones.hasProperty(theZone, "done+1") then
|
||||
theZone.doneFlag = cfxZones.getStringFromZoneProperty(theZone, "done+1", "none")
|
||||
theZone.doneFlag = cfxZones.getStringFromZoneProperty(theZone, "done+1", "<none>")
|
||||
|
||||
-- now NEW replacements
|
||||
elseif cfxZones.hasProperty(theZone, "done!") then
|
||||
theZone.doneFlag = cfxZones.getStringFromZoneProperty(theZone, "done!", "<none>")
|
||||
elseif cfxZones.hasProperty(theZone, "rndDone!") then
|
||||
theZone.doneFlag = cfxZones.getStringFromZoneProperty(theZone, "rndDone!", "<none>")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function rndFlags.reshuffle(theZone)
|
||||
@ -197,7 +211,7 @@ function rndFlags.fire(theZone)
|
||||
end
|
||||
|
||||
if theZone.doneFlag then
|
||||
cfxZones.pollFlag(theZone.doneFlag, "inc", theZone)
|
||||
cfxZones.pollFlag(theZone.doneFlag, theZone.rndMethod, theZone)
|
||||
end
|
||||
|
||||
return
|
||||
@ -262,7 +276,7 @@ end
|
||||
function rndFlags.startCycle()
|
||||
for idx, theZone in pairs(rndFlags.rndGen) do
|
||||
if theZone.onStart then
|
||||
if rndFlags.verbose then
|
||||
if rndFlags.verbose or theZone.verbose then
|
||||
trigger.action.outText("+++RND: starting " .. theZone.name, 30)
|
||||
end
|
||||
rndFlags.fire(theZone)
|
||||
|
||||
@ -1,16 +1,20 @@
|
||||
baseCaptured={}
|
||||
baseCaptured.version = "1.0.0"
|
||||
baseCaptured.version = "1.0.1"
|
||||
baseCaptured.verbose = false
|
||||
baseCaptured.ups = 1
|
||||
baseCaptured.requiredLibs = {
|
||||
"dcsCommon", -- always
|
||||
"cfxZones", -- Zones, of course
|
||||
}
|
||||
baseCaptured.handleContested = true --
|
||||
|
||||
--[[--
|
||||
baseCaptured - Detects when the assigned base has been captured, idea and first implementation by cloose
|
||||
|
||||
Version History
|
||||
1.0.0 - Initial version based on cloose's code
|
||||
1.0.1 - contested! flag
|
||||
- update and handleContested
|
||||
|
||||
--]]--
|
||||
|
||||
@ -50,6 +54,10 @@ function baseCaptured.createZone(theZone)
|
||||
theZone.redCap = cfxZones.getStringFromZoneProperty(theZone, "red!", "*none")
|
||||
end
|
||||
|
||||
if cfxZones.hasProperty(theZone, "contested!") then
|
||||
theZone.contested = cfxZones.getStringFromZoneProperty(theZone, "contested!", "*none")
|
||||
end
|
||||
|
||||
if cfxZones.hasProperty(theZone, "baseOwner") then
|
||||
theZone.baseOwner = cfxZones.getStringFromZoneProperty(theZone, "baseOwner", "*none")
|
||||
cfxZones.setFlagValueMult(theZone.baseOwner, theZone.currentOwner, theZone)
|
||||
@ -79,7 +87,10 @@ function baseCaptured.triggerZone(theZone)
|
||||
cfxZones.pollFlag(theZone.blueCap, theZone.capturedMethod, theZone)
|
||||
end
|
||||
else
|
||||
-- possibly a new side? Neutral doesn't cap
|
||||
-- contested
|
||||
if theZone.contested then
|
||||
cfxZones.pollFlag(theZone.contested, theZone.capturedMethod, theZone)
|
||||
end
|
||||
end
|
||||
|
||||
if baseCaptured.verbose or theZone.verbose then
|
||||
@ -118,6 +129,31 @@ function baseCaptured:onEvent(event)
|
||||
end
|
||||
end
|
||||
|
||||
function baseCaptured.update()
|
||||
-- call me in a second to poll triggers
|
||||
timer.scheduleFunction(baseCaptured.update, {}, timer.getTime() + 1/baseCaptured.ups)
|
||||
|
||||
-- look for contested event - it's not covered with capture event!
|
||||
for idx, aZone in pairs(baseCaptured.zones) do
|
||||
local newOwner = aZone.theBase:getCoalition()
|
||||
|
||||
if (newOwner ~= aZone.currentOwner) and (newOwner == 3) then
|
||||
if aZone.contested then
|
||||
cfxZones.pollFlag(aZone.contested, aZone.capturedMethod, aZone)
|
||||
end
|
||||
|
||||
aZone.currentOwner = newOwner
|
||||
if aZone.verbose or baseCaptured.verbose then
|
||||
trigger.action.outText("+++bCap: zone <" .. aZone.name .. "> has become contested!", 30)
|
||||
end
|
||||
if aZone.baseOwner then
|
||||
cfxZones.setFlagValueMult(aZone.baseOwner, newOwner, aZone)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function baseCaptured.readConfigZone()
|
||||
-- search for configuration zone
|
||||
local theZone = cfxZones.getZoneByName("baseCapturedConfig")
|
||||
@ -127,6 +163,8 @@ function baseCaptured.readConfigZone()
|
||||
|
||||
baseCaptured.verbose = cfxZones.getBoolFromZoneProperty(theZone, "verbose", false)
|
||||
|
||||
baseCaptured.handleContested = cfxZones.getBoolFromZoneProperty(theZone, "handleContested", true)
|
||||
|
||||
if baseCaptured.verbose then
|
||||
trigger.action.outText("+++bCap: read configuration from zone", 30)
|
||||
end
|
||||
@ -155,6 +193,11 @@ function baseCaptured.start()
|
||||
-- listen for events
|
||||
world.addEventHandler(baseCaptured)
|
||||
|
||||
-- start update to look for contested
|
||||
if baseCaptured.handleContested then
|
||||
baseCaptured.update()
|
||||
end
|
||||
|
||||
trigger.action.outText("baseCaptured v" .. baseCaptured.version .. " started.", 30)
|
||||
return true
|
||||
end
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
cfxZones = {}
|
||||
cfxZones.version = "2.8.3"
|
||||
|
||||
-- cf/x zone management module
|
||||
-- reads dcs zones and makes them accessible and mutable
|
||||
-- by scripting.
|
||||
--
|
||||
-- Copyright (c) 2021, 2022 by Christian Franz and cf/x AG
|
||||
--
|
||||
cfxZones = {}
|
||||
cfxZones.version = "2.8.1"
|
||||
|
||||
--[[-- VERSION HISTORY
|
||||
- 2.2.4 - getCoalitionFromZoneProperty
|
||||
- getStringFromZoneProperty
|
||||
@ -82,6 +84,10 @@ cfxZones.version = "2.8.1"
|
||||
- setFlagValue QoL for <none>
|
||||
- 2.8.0 - new allGroupNamesInZone()
|
||||
- 2.8.1 - new zonesLinkedToUnit()
|
||||
- 2.8.2 - flagArrayFromString trims elements before range check
|
||||
- 2.8.3 - new verifyMethod()
|
||||
- changed extractPropertyFromDCS() to also match attributes with blanks like "the Attr" to "theAttr"
|
||||
- new expandFlagName()
|
||||
|
||||
--]]--
|
||||
cfxZones.verbose = false
|
||||
@ -1222,6 +1228,32 @@ function cfxZones.pollFlag(theFlag, method, theZone)
|
||||
|
||||
end
|
||||
|
||||
function cfxZones.expandFlagName(theFlag, theZone)
|
||||
if not theFlag then return "!NIL" end
|
||||
local zoneName = "<dummy>"
|
||||
if theZone then
|
||||
zoneName = theZone.name -- for flag wildcards
|
||||
end
|
||||
|
||||
if type(theFlag) == "number" then
|
||||
-- straight number, return
|
||||
return theFlag
|
||||
end
|
||||
|
||||
-- we assume it's a string now
|
||||
theFlag = dcsCommon.trim(theFlag) -- clear leading/trailing spaces
|
||||
local nFlag = tonumber(theFlag)
|
||||
if nFlag then -- a number, legal
|
||||
return theFlag
|
||||
end
|
||||
|
||||
-- now do wildcard processing. we have alphanumeric
|
||||
if dcsCommon.stringStartsWith(theFlag, "*") then
|
||||
theFlag = zoneName .. theFlag
|
||||
end
|
||||
return theFlag
|
||||
end
|
||||
|
||||
function cfxZones.setFlagValueMult(theFlag, theValue, theZone)
|
||||
local allFlags = {}
|
||||
if dcsCommon.containsString(theFlag, ",") then
|
||||
@ -1297,7 +1329,7 @@ function cfxZones.getFlagValue(theFlag, theZone)
|
||||
|
||||
-- some QoL: detect "<none>"
|
||||
if dcsCommon.containsString(theFlag, "<none>") then
|
||||
trigger.action.outText("+++Zone: warning - getFlag has '<none>' flag name in zone <" .. zoneName .. ">", 30)
|
||||
trigger.action.outText("+++Zone: warning - getFlag has '<none>' flag name in zone <" .. zoneName .. ">", 30) -- break here
|
||||
end
|
||||
|
||||
-- now do wildcard processing. we have alphanumeric
|
||||
@ -1316,6 +1348,68 @@ function cfxZones.isMEFlag(inFlag)
|
||||
-- return dcsCommon.stringIsPositiveNumber(inFlag)
|
||||
end
|
||||
|
||||
function cfxZones.verifyMethod(theMethod, theZone)
|
||||
local lMethod = string.lower(theMethod)
|
||||
if lMethod == "#" or lMethod == "change" then
|
||||
return true
|
||||
end
|
||||
|
||||
if lMethod == "0" or lMethod == "no" or lMethod == "false"
|
||||
or lMethod == "off" then
|
||||
return true
|
||||
end
|
||||
|
||||
if lMethod == "1" or lMethod == "yes" or lMethod == "true"
|
||||
or lMethod == "on" then
|
||||
return true
|
||||
end
|
||||
|
||||
if lMethod == "inc" or lMethod == "+1" then
|
||||
return true
|
||||
end
|
||||
|
||||
if lMethod == "dec" or lMethod == "-1" then
|
||||
return true
|
||||
end
|
||||
|
||||
if lMethod == "lohi" or lMethod == "pulse" then
|
||||
return true
|
||||
end
|
||||
|
||||
if lMethod == "hilo" then
|
||||
return true
|
||||
end
|
||||
|
||||
-- number constraints
|
||||
-- or flag constraints -- ONLY RETURN TRUE IF CHANGE AND CONSTRAINT MET
|
||||
local op = string.sub(theMethod, 1, 1)
|
||||
local remainder = string.sub(theMethod, 2)
|
||||
remainder = dcsCommon.trim(remainder) -- remove all leading and trailing spaces
|
||||
-- local rNum = tonumber(remainder)
|
||||
|
||||
if true then
|
||||
-- we have a comparison = ">", "=", "<" followed by a number
|
||||
-- THEY TRIGGER EACH TIME lastVal <> currVal AND condition IS MET
|
||||
if op == "=" then
|
||||
return true
|
||||
end
|
||||
|
||||
if op == "#" or op == "~" then
|
||||
return true
|
||||
end
|
||||
|
||||
if op == "<" then
|
||||
return true
|
||||
end
|
||||
|
||||
if op == ">" then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- method-based flag testing
|
||||
function cfxZones.evalFlagMethodImmediate(currVal, theMethod, theZone)
|
||||
-- immediate eval - does not look at last val.
|
||||
@ -1569,6 +1663,7 @@ function cfxZones.flagArrayFromString(inString)
|
||||
local rawElements = dcsCommon.splitString(inString, ",")
|
||||
-- go over all elements
|
||||
for idx, anElement in pairs(rawElements) do
|
||||
anElement = dcsCommon.trim(anElement)
|
||||
if dcsCommon.stringStartsWithDigit(anElement) and dcsCommon.containsString(anElement, "-") then
|
||||
-- interpret this as a range
|
||||
local theRange = dcsCommon.splitString(anElement, "-")
|
||||
@ -1649,6 +1744,12 @@ function cfxZones.extractPropertyFromDCS(theKey, theProperties)
|
||||
if existingKey == theKey then
|
||||
return theP.value
|
||||
end
|
||||
|
||||
-- now check after removing all blanks
|
||||
existingKey = dcsCommon.removeBlanks(existingKey)
|
||||
if existingKey == theKey then
|
||||
return theP.value
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
changer = {}
|
||||
changer.version = "1.0.1"
|
||||
changer.version = "1.0.2"
|
||||
changer.verbose = false
|
||||
changer.ups = 1
|
||||
changer.requiredLibs = {
|
||||
@ -11,6 +11,7 @@ changer.changers = {}
|
||||
Version History
|
||||
1.0.0 - Initial version
|
||||
1.0.1 - Better guards in config to avoid <none> Zone getter warning
|
||||
1.0.2 - on/off: verbosity
|
||||
|
||||
Transmogrify an incoming signal to an output signal
|
||||
- not
|
||||
@ -210,6 +211,10 @@ function changer.update()
|
||||
if aZone.changerOnOff then
|
||||
if cfxZones.getFlagValue(aZone.changerOnOff, aZone) > 0 then
|
||||
changer.process(aZone)
|
||||
else
|
||||
if changer.verbose or aZone.verbose then
|
||||
trigger.action.outText("+++chgr: " .. aZone.name .. " gate closed.", 30)
|
||||
end
|
||||
end
|
||||
else
|
||||
changer.process(aZone)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
dcsCommon = {}
|
||||
dcsCommon.version = "2.6.5"
|
||||
dcsCommon.version = "2.6.6"
|
||||
--[[-- VERSION HISTORY
|
||||
2.2.6 - compassPositionOfARelativeToB
|
||||
- clockPositionOfARelativeToB
|
||||
@ -77,6 +77,11 @@ dcsCommon.version = "2.6.5"
|
||||
2.6.5 - new bearing2compass()
|
||||
- new bearingdegrees2compass()
|
||||
- new latLon2Text() - based on mist
|
||||
2.6.6 - new nowString()
|
||||
- new str2num()
|
||||
- new stringRemainsStartingWith()
|
||||
- new stripLF()
|
||||
- new removeBlanks()
|
||||
|
||||
--]]--
|
||||
|
||||
@ -1746,6 +1751,14 @@ dcsCommon.version = "2.6.5"
|
||||
return trimmedArray
|
||||
end
|
||||
|
||||
function dcsCommon.stripLF(theString)
|
||||
return theString:gsub("[\r\n]", "")
|
||||
end
|
||||
|
||||
function dcsCommon.removeBlanks(theString)
|
||||
return theString:gsub("%s", "")
|
||||
end
|
||||
|
||||
function dcsCommon.stringIsPositiveNumber(theString)
|
||||
-- only full integer positive numbers supported
|
||||
if not theString then return false end
|
||||
@ -1818,8 +1831,8 @@ dcsCommon.version = "2.6.5"
|
||||
if not p then return "<!NIL!>" end
|
||||
local t = "[x="
|
||||
if p.x then t = t .. p.x .. ", " else t = t .. "<nil>, " end
|
||||
if p.y then t = t .. p.y .. ", " else t = t .. "<nil>, " end
|
||||
if p.z then t = t .. p.z .. "]" else t = t .. "<nil>]" end
|
||||
if p.y then t = t .. "y=" .. p.y .. ", " else t = t .. "y=<nil>, " end
|
||||
if p.z then t = t .. "z=" .. p.z .. "]" else t = t .. "z=<nil>]" end
|
||||
return t
|
||||
end
|
||||
|
||||
@ -2047,6 +2060,33 @@ dcsCommon.version = "2.6.5"
|
||||
return msg
|
||||
end
|
||||
|
||||
function dcsCommon.nowString()
|
||||
local absSecs = timer.getAbsTime()-- + env.mission.start_time
|
||||
while absSecs > 86400 do
|
||||
absSecs = absSecs - 86400 -- subtract out all days
|
||||
end
|
||||
return dcsCommon.processHMS("<:h>:<:m>:<:s>", absSecs)
|
||||
end
|
||||
|
||||
function dcsCommon.str2num(inVal, default)
|
||||
if not default then default = 0 end
|
||||
if not inVal then return default end
|
||||
if type(inVal) == "number" then return inVal end
|
||||
local num = nil
|
||||
if type(inVal) == "string" then num = tonumber(inVal) end
|
||||
if not num then return default end
|
||||
return num
|
||||
end
|
||||
|
||||
function dcsCommon.stringRemainsStartingWith(theString, startingWith)
|
||||
-- find the first position where startingWith starts
|
||||
local pos = theString:find(startingWith)
|
||||
if not pos then return theString end
|
||||
-- now return the entire remainder of the string from pos
|
||||
local nums = theString:len() - pos + 1
|
||||
return theString:sub(-nums)
|
||||
end
|
||||
|
||||
--
|
||||
--
|
||||
-- V E C T O R M A T H
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
guardianAngel = {}
|
||||
guardianAngel.version = "3.0.1"
|
||||
guardianAngel.version = "3.0.2"
|
||||
guardianAngel.ups = 10
|
||||
guardianAngel.name = "Guardian Angel" -- just in case someone accesses .name
|
||||
guardianAngel.launchWarning = true -- detect launches and warn pilot
|
||||
guardianAngel.intervention = true -- remove missiles just before hitting
|
||||
guardianAngel.explosion = -1 -- small poof when missile explodes. -1 = off.
|
||||
@ -56,6 +57,7 @@ guardianAngel.requiredLibs = {
|
||||
3.0.1 - corrected error on collateral (missing delay)
|
||||
- Supporst cloned units
|
||||
- removed legacy code
|
||||
3.0.2 - added guardianAngel.name for those who use local flags on activate
|
||||
|
||||
|
||||
This script detects missiles launched against protected aircraft an
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
impostors={}
|
||||
|
||||
impostors.version = "1.0.0"
|
||||
impostors.version = "1.0.1"
|
||||
impostors.verbose = false
|
||||
impostors.ups = 1
|
||||
impostors.requiredLibs = {
|
||||
@ -15,6 +15,11 @@ impostors.callbacks = {}
|
||||
impostors.uniqueCounter = 8200000 -- clones start at 9200000
|
||||
|
||||
--[[--
|
||||
Version History
|
||||
1.0.0 - initial version
|
||||
1.0.1 - added some verbosity
|
||||
|
||||
|
||||
LIMITATIONS:
|
||||
must be on ground (or would be very silly
|
||||
does not work with any units deployed on ships
|
||||
@ -379,6 +384,12 @@ function impostors.delayedSpawn(args)
|
||||
local newGroup = coalition.addGroup(ctry, cat, rawData)
|
||||
impostors.relinkZonesForGroup(relinkZones, newGroup)
|
||||
|
||||
if newGroup then
|
||||
-- trigger.action.outText("+++ipst: SUCCESS!!! Spawned group <" .. newGroup:getName() .. "> for impostor <" .. rawData.name .. ">", 30)
|
||||
else
|
||||
trigger.action.outText("+++ipst: failed to spawn group for impostor <" .. rawData.name .. ">", 30)
|
||||
end
|
||||
|
||||
if theZone.trackWith and groupTracker.addGroupToTrackerNamed then
|
||||
-- add these groups to the group tracker
|
||||
if theZone.verbose or impostors.verbose then
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
pulseFlags = {}
|
||||
pulseFlags.version = "1.2.1"
|
||||
pulseFlags.version = "1.2.3"
|
||||
pulseFlags.verbose = false
|
||||
pulseFlags.requiredLibs = {
|
||||
"dcsCommon", -- always
|
||||
@ -32,6 +32,9 @@ pulseFlags.requiredLibs = {
|
||||
- 1.2.1 pulseInterval synonym for time
|
||||
pulses now supports range
|
||||
zone-local verbosity
|
||||
- 1.2.2 outputMethod synonym
|
||||
- 1.2.3 deprecated paused/pulsePaused
|
||||
returned onStart, defaulting to true
|
||||
|
||||
--]]--
|
||||
|
||||
@ -111,17 +114,27 @@ function pulseFlags.createPulseWithZone(theZone)
|
||||
theZone.lastPauseValue = cfxZones.getFlagValue(theZone.pausePulseFlag, theZone)-- trigger.misc.getUserFlag(theZone.pausePulseFlag) -- save last value
|
||||
end
|
||||
|
||||
-- harmonizing on onStart, and converting to old pulsePaused
|
||||
local onStart = cfxZones.getBoolFromZoneProperty(theZone, "onStart", true)
|
||||
theZone.pulsePaused = not (onStart)
|
||||
-- old code, to be deprecated
|
||||
if cfxZones.hasProperty(theZone, "paused") then
|
||||
theZone.pulsePaused = cfxZones.getBoolFromZoneProperty(theZone, "paused", false)
|
||||
|
||||
if cfxZones.hasProperty(theZone, "pulseStopped") then
|
||||
elseif cfxZones.hasProperty(theZone, "pulseStopped") then
|
||||
theZone.pulsePaused = cfxZones.getBoolFromZoneProperty(theZone, "pulseStopped", false)
|
||||
end
|
||||
--]]--
|
||||
|
||||
theZone.pulseMethod = cfxZones.getStringFromZoneProperty(theZone, "method", "flip")
|
||||
|
||||
if cfxZones.hasProperty(theZone, "pulseMethod") then
|
||||
theZone.pulseMethod = cfxZones.getStringFromZoneProperty(theZone, "pulseMethod", "flip")
|
||||
end
|
||||
|
||||
if cfxZones.hasProperty(theZone, "outputMethod") then
|
||||
theZone.pulseMethod = cfxZones.getStringFromZoneProperty(theZone, "outputMethod", "flip")
|
||||
end
|
||||
-- done flag
|
||||
if cfxZones.hasProperty(theZone, "done+1") then
|
||||
theZone.pulseDoneFlag = cfxZones.getStringFromZoneProperty(theZone, "done+1", "*none")
|
||||
|
||||
1175
modules/theDebugger.lua
Normal file
1175
modules/theDebugger.lua
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
unitZone={}
|
||||
unitZone.version = "1.2.2"
|
||||
unitZone.version = "1.2.3"
|
||||
unitZone.verbose = false
|
||||
unitZone.ups = 1
|
||||
unitZone.requiredLibs = {
|
||||
@ -14,6 +14,8 @@ unitZone.requiredLibs = {
|
||||
1.2.0 - uzOn?, uzOff?, triggerMethod
|
||||
1.2.1 - uzDirect
|
||||
1.2.2 - uzDirectInv
|
||||
1.2.3 - better guards for enterZone!, exitZone!, chsngeZone!
|
||||
- better guards for uzOn? and uzOff?
|
||||
|
||||
--]]--
|
||||
|
||||
@ -86,9 +88,16 @@ function unitZone.createUnitZone(theZone)
|
||||
theZone.uzMethod = cfxZones.getStringFromZoneProperty(theZone, "uzMethod", "inc")
|
||||
end
|
||||
|
||||
theZone.enterZone = cfxZones.getStringFromZoneProperty(theZone, "enterZone!", "<none>")
|
||||
theZone.exitZone = cfxZones.getStringFromZoneProperty(theZone, "exitZone!", "<none>")
|
||||
theZone.changeZone = cfxZones.getStringFromZoneProperty(theZone, "changeZone!", "<none>")
|
||||
if cfxZones.hasProperty(theZone, "enterZone!") then
|
||||
theZone.enterZone = cfxZones.getStringFromZoneProperty(theZone, "enterZone!", "*<none>")
|
||||
end
|
||||
if cfxZones.hasProperty(theZone, "exitZone!") then
|
||||
theZone.exitZone = cfxZones.getStringFromZoneProperty(theZone, "exitZone!", "*<none>")
|
||||
end
|
||||
|
||||
if cfxZones.hasProperty(theZone, "changeZone!") then
|
||||
theZone.changeZone = cfxZones.getStringFromZoneProperty(theZone, "changeZone!", "*<none>")
|
||||
end
|
||||
|
||||
if cfxZones.hasProperty(theZone, "filterFor") then
|
||||
local filterString = cfxZones.getStringFromZoneProperty(theZone, "filterFor", "1") -- ground
|
||||
@ -108,11 +117,15 @@ function unitZone.createUnitZone(theZone)
|
||||
|
||||
-- on/off flags
|
||||
theZone.uzPaused = false -- we are turned on
|
||||
if cfxZones.hasProperty(theZone, "uzOn?") then
|
||||
theZone.triggerOnFlag = cfxZones.getStringFromZoneProperty(theZone, "uzOn?", "*<none1>")
|
||||
theZone.lastTriggerOnValue = cfxZones.getFlagValue(theZone.triggerOnFlag, theZone)
|
||||
end
|
||||
|
||||
if cfxZones.hasProperty(theZone, "uzOff?") then
|
||||
theZone.triggerOffFlag = cfxZones.getStringFromZoneProperty(theZone, "uzOff?", "*<none2>")
|
||||
theZone.lastTriggerOffValue = cfxZones.getFlagValue(theZone.triggerOffFlag, theZone)
|
||||
end
|
||||
|
||||
theZone.uzTriggerMethod = cfxZones.getStringFromZoneProperty(theZone, "triggerMethod", "change")
|
||||
if cfxZones.hasProperty(theZone, "uzTriggerMethod") then
|
||||
@ -227,18 +240,24 @@ end
|
||||
--
|
||||
function unitZone.bangState(theZone, newState)
|
||||
|
||||
if theZone.changeZone then
|
||||
cfxZones.pollFlag(theZone.changeZone, theZone.uzMethod, theZone)
|
||||
end
|
||||
if newState then
|
||||
if theZone.enterZone then
|
||||
cfxZones.pollFlag(theZone.enterZone, theZone.uzMethod, theZone)
|
||||
if unitZone.verbose then
|
||||
trigger.action.outText("+++uZone: banging enter! with <" .. theZone.uzMethod .. "> on <" .. theZone.enterZone .. "> for " .. theZone.name, 30)
|
||||
end
|
||||
end
|
||||
else
|
||||
if theZone.exitZone then
|
||||
cfxZones.pollFlag(theZone.exitZone, theZone.uzMethod, theZone)
|
||||
if unitZone.verbose then
|
||||
trigger.action.outText("+++uZone: banging exit! with <" .. theZone.uzMethod .. "> on <" .. theZone.exitZone .. "> for " .. theZone.name, 30)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function unitZone.update()
|
||||
@ -247,14 +266,14 @@ function unitZone.update()
|
||||
|
||||
for idx, aZone in pairs(unitZone.unitZones) do
|
||||
-- check if we need to pause/unpause
|
||||
if cfxZones.testZoneFlag(aZone, aZone.triggerOnFlag, aZone.uzTriggerMethod, "lastTriggerOnValue") then
|
||||
if aZone.triggerOnFlag and cfxZones.testZoneFlag(aZone, aZone.triggerOnFlag, aZone.uzTriggerMethod, "lastTriggerOnValue") then
|
||||
if unitZone.verbose or aZone.verbose then
|
||||
trigger.action.outText("+++uZone: turning " .. aZone.name .. " on", 30)
|
||||
end
|
||||
aZone.uzPaused = false
|
||||
end
|
||||
|
||||
if cfxZones.testZoneFlag(aZone, aZone.triggerOffFlag, aZone.uzTriggerMethod, "lastTriggerOffValue") then
|
||||
if aZone.triggerOffFlag and cfxZones.testZoneFlag(aZone, aZone.triggerOffFlag, aZone.uzTriggerMethod, "lastTriggerOffValue") then
|
||||
if unitZone.verbose or aZone.verbose then
|
||||
trigger.action.outText("+++uZone: turning " .. aZone.name .. " OFF", 30)
|
||||
end
|
||||
|
||||
BIN
tutorial & demo missions/demo - Bug Hunt.miz
Normal file
BIN
tutorial & demo missions/demo - Bug Hunt.miz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user