mirror of
https://github.com/weyne85/DML.git
synced 2025-10-29 16:57:49 +00:00
Version 0.9992
PvP Zones, bug fixes
This commit is contained in:
parent
82f59f5728
commit
bc5ac5771c
Binary file not shown.
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
cloneZones = {}
|
cloneZones = {}
|
||||||
cloneZones.version = "1.4.6"
|
cloneZones.version = "1.4.7"
|
||||||
cloneZones.verbose = false
|
cloneZones.verbose = false
|
||||||
cloneZones.requiredLibs = {
|
cloneZones.requiredLibs = {
|
||||||
"dcsCommon", -- always
|
"dcsCommon", -- always
|
||||||
@ -45,6 +45,7 @@
|
|||||||
1.4.5 - randomizeLoc, rndLoc keyword
|
1.4.5 - randomizeLoc, rndLoc keyword
|
||||||
- cargo manager integration - pass cargo objects when present
|
- cargo manager integration - pass cargo objects when present
|
||||||
1.4.6 - removed some verbosity for spawned aircraft with airfields on their routes
|
1.4.6 - removed some verbosity for spawned aircraft with airfields on their routes
|
||||||
|
1.4.7 - DML watchflag and DML Flag polish, method-->cloneMethod
|
||||||
|
|
||||||
|
|
||||||
--]]--
|
--]]--
|
||||||
@ -236,7 +237,6 @@
|
|||||||
theZone.lastDeSpawnValue = cfxZones.getFlagValue(theZone.deSpawnFlag, theZone)
|
theZone.lastDeSpawnValue = cfxZones.getFlagValue(theZone.deSpawnFlag, theZone)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- to be deprecated
|
|
||||||
theZone.onStart = cfxZones.getBoolFromZoneProperty(theZone, "onStart", false)
|
theZone.onStart = cfxZones.getBoolFromZoneProperty(theZone, "onStart", false)
|
||||||
|
|
||||||
theZone.moveRoute = cfxZones.getBoolFromZoneProperty(theZone, "moveRoute", false)
|
theZone.moveRoute = cfxZones.getBoolFromZoneProperty(theZone, "moveRoute", false)
|
||||||
@ -252,7 +252,10 @@
|
|||||||
theZone.emptyBangFlag = cfxZones.getStringFromZoneProperty(theZone, "empty!", "<None>") -- note string on number default
|
theZone.emptyBangFlag = cfxZones.getStringFromZoneProperty(theZone, "empty!", "<None>") -- note string on number default
|
||||||
end
|
end
|
||||||
|
|
||||||
theZone.method = cfxZones.getStringFromZoneProperty(theZone, "method", "inc")
|
theZone.cloneMethod = cfxZones.getStringFromZoneProperty(theZone, "cloneMethod", "inc")
|
||||||
|
if cfxZones.hasProperty(theZone, "method") then
|
||||||
|
theZone.cloneMethod = cfxZones.getStringFromZoneProperty(theZone, "method", "inc") -- note string on number default
|
||||||
|
end
|
||||||
|
|
||||||
if cfxZones.hasProperty(theZone, "masterOwner") then
|
if cfxZones.hasProperty(theZone, "masterOwner") then
|
||||||
theZone.masterOwner = cfxZones.getStringFromZoneProperty(theZone, "masterOwner", "<none>")
|
theZone.masterOwner = cfxZones.getStringFromZoneProperty(theZone, "masterOwner", "<none>")
|
||||||
@ -1010,7 +1013,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
if aZone.emptyBangFlag then
|
if aZone.emptyBangFlag then
|
||||||
cfxZones.pollFlag(aZone.emptyBangFlag, aZone.method, aZone)
|
cfxZones.pollFlag(aZone.emptyBangFlag, aZone.cloneMethod, aZone)
|
||||||
if cloneZones.verbose then
|
if cloneZones.verbose then
|
||||||
trigger.action.outText("+++clnZ: bang! on " .. aZone.emptyBangFlag, 30)
|
trigger.action.outText("+++clnZ: bang! on " .. aZone.emptyBangFlag, 30)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
csarManager = {}
|
csarManager = {}
|
||||||
csarManager.version = "2.1.1"
|
csarManager.version = "2.1.3"
|
||||||
csarManager.verbose = false
|
csarManager.verbose = false
|
||||||
csarManager.ups = 1
|
csarManager.ups = 1
|
||||||
|
|
||||||
@ -36,6 +36,12 @@ csarManager.ups = 1
|
|||||||
- finally fixed smoke performance bug
|
- finally fixed smoke performance bug
|
||||||
- csarManager.vectoring optional
|
- csarManager.vectoring optional
|
||||||
- 2.1.1 - zone-local verbosity
|
- 2.1.1 - zone-local verbosity
|
||||||
|
- 2.1.2 - 'downed' machinations (paranthese)S
|
||||||
|
- verbosity
|
||||||
|
- 2.1.3 - theMassObject now local
|
||||||
|
- winch pickup now also adds weight so they can be returned
|
||||||
|
- made some improvements to performance by making vars local
|
||||||
|
|
||||||
|
|
||||||
--]]--
|
--]]--
|
||||||
-- modules that need to be loaded BEFORE I run
|
-- modules that need to be loaded BEFORE I run
|
||||||
@ -202,13 +208,16 @@ function csarManager.createCSARMissionData(point, theSide, freq, name, numCrew,
|
|||||||
if not point then return nil end
|
if not point then return nil end
|
||||||
local newMission = {}
|
local newMission = {}
|
||||||
newMission.side = theSide
|
newMission.side = theSide
|
||||||
if dcsCommon.stringStartsWith(name, "(downed) ") then
|
if dcsCommon.stringStartsWith(name, "downed ") then
|
||||||
-- remove "downed" - it will be added again later
|
-- remove "downed" - it will be added again later
|
||||||
name = dcsCommon.removePrefix(name, "(downed) ")
|
name = dcsCommon.removePrefix(name, "downed ")
|
||||||
|
if csarManager.verbose then
|
||||||
|
trigger.action.outText("+++csar: 'downed' procced for <" .. name .. ">", 30)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if not inRadius then inRadius = csarManager.rescueRadius end
|
if not inRadius then inRadius = csarManager.rescueRadius end
|
||||||
|
|
||||||
newMission.name = "(downed) " .. name .. "-" .. csarManager.missionID -- make it uuid-capable
|
newMission.name = "downed " .. name .. "-" .. csarManager.missionID -- make it uuid-capable
|
||||||
newMission.zone = cfxZones.createSimpleZone(newMission.name, point, inRadius) --csarManager.rescueRadius)
|
newMission.zone = cfxZones.createSimpleZone(newMission.name, point, inRadius) --csarManager.rescueRadius)
|
||||||
newMission.marker = mapMarker -- so it can be removed later
|
newMission.marker = mapMarker -- so it can be removed later
|
||||||
newMission.isHot = false -- creating adversaries will make it hot, or when units are near. maybe implement a search later?
|
newMission.isHot = false -- creating adversaries will make it hot, or when units are near. maybe implement a search later?
|
||||||
@ -388,7 +397,9 @@ function csarManager.successMission(who, where, theMission)
|
|||||||
|
|
||||||
if csarManager.csarDelivered then
|
if csarManager.csarDelivered then
|
||||||
cfxZones.pollFlag(csarManager.csarDelivered, "inc", csarManager.configZone)
|
cfxZones.pollFlag(csarManager.csarDelivered, "inc", csarManager.configZone)
|
||||||
trigger.action.outText("+++csar: banging csarDelivered: <" .. csarManager.csarDelivered .. ">", 30)
|
if csarManager.verbose then
|
||||||
|
trigger.action.outText("+++csar: banging csarDelivered: <" .. csarManager.csarDelivered .. ">", 30)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -410,8 +421,19 @@ function csarManager.heloLanded(theUnit)
|
|||||||
-- points or airframes
|
-- points or airframes
|
||||||
local allEvacuees = cargoSuper.getManifestFor(myName, "Evacuees") -- returns unlinked array
|
local allEvacuees = cargoSuper.getManifestFor(myName, "Evacuees") -- returns unlinked array
|
||||||
|
|
||||||
|
if csarManager.verbose then
|
||||||
|
trigger.action.outText("+++csar: helo <" .. myName .. "> landed with <" .. #allEvacuees .. "> evacuees on board.",30)
|
||||||
|
end
|
||||||
|
|
||||||
if #allEvacuees > 0 then -- wasif #conf.troopsOnBoard > 0 then
|
if #allEvacuees > 0 then -- wasif #conf.troopsOnBoard > 0 then
|
||||||
|
if csarManager.verbose then
|
||||||
|
trigger.action.outText("+++csar: checking bases:", 30)
|
||||||
|
end
|
||||||
|
|
||||||
for idx, base in pairs(csarManager.csarBases) do
|
for idx, base in pairs(csarManager.csarBases) do
|
||||||
|
if csarManager.verbose then
|
||||||
|
trigger.action.outText("+++csar: base <" .. base.zone.name .. ">", 30)
|
||||||
|
end
|
||||||
-- check if the attached zone has changed hands
|
-- check if the attached zone has changed hands
|
||||||
-- this can happen if zone has its own owner
|
-- this can happen if zone has its own owner
|
||||||
-- attribute and is conquered by another side
|
-- attribute and is conquered by another side
|
||||||
@ -428,6 +450,10 @@ function csarManager.heloLanded(theUnit)
|
|||||||
currentBaseSide == 0
|
currentBaseSide == 0
|
||||||
then -- can always land in neutral
|
then -- can always land in neutral
|
||||||
if cfxZones.pointInZone(thePoint, base.zone) then
|
if cfxZones.pointInZone(thePoint, base.zone) then
|
||||||
|
if csarManager.verbose or base.zone.verbose then
|
||||||
|
trigger.action.outText("+++csar: <" .. myName .. "> touch down in CSAR drop-off zone <" .. base.zone.name .. ">", 30)
|
||||||
|
end
|
||||||
|
|
||||||
for idx, msn in pairs(conf.troopsOnBoard) do
|
for idx, msn in pairs(conf.troopsOnBoard) do
|
||||||
-- each troopsOnboard is actually the
|
-- each troopsOnboard is actually the
|
||||||
-- csar mission that I picked up
|
-- csar mission that I picked up
|
||||||
@ -454,9 +480,21 @@ function csarManager.heloLanded(theUnit)
|
|||||||
conf.troopsOnBoard = {} -- empty out troops on board
|
conf.troopsOnBoard = {} -- empty out troops on board
|
||||||
-- we do *not* return so we can pick up troops on
|
-- we do *not* return so we can pick up troops on
|
||||||
-- a CSARBASE if they were dropped there
|
-- a CSARBASE if they were dropped there
|
||||||
|
|
||||||
|
else
|
||||||
|
if csarManager.verbose or base.zone.verbose then
|
||||||
|
trigger.action.outText("+++csar: touchdown of <" .. myName .. "> occured outside of csar zone <" .. base.zone.name .. ">", 30)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
else -- not on my side
|
||||||
|
if csarManager.verbose or base.zone.verbose then
|
||||||
|
trigger.action.outText("+++csar: base <" .. base.zone.name .. "> is on side <" .. currentBaseSide .. ">, which is not on my side <" .. mySide .. ">.", 30)
|
||||||
|
end
|
||||||
end -- my side?
|
end -- my side?
|
||||||
|
end -- for all bases
|
||||||
|
if csarManager.verbose then
|
||||||
|
trigger.action.outText("+++csar: complete bases check", 30)
|
||||||
end
|
end
|
||||||
end -- check only if I'm carrying evacuees
|
end -- check only if I'm carrying evacuees
|
||||||
|
|
||||||
@ -469,7 +507,7 @@ function csarManager.heloLanded(theUnit)
|
|||||||
-- see if we are inside the mission's rescue range
|
-- see if we are inside the mission's rescue range
|
||||||
local d = dcsCommon.distFlat(thePoint, mission.zone.point)
|
local d = dcsCommon.distFlat(thePoint, mission.zone.point)
|
||||||
if d < csarManager.rescueRadius then
|
if d < csarManager.rescueRadius then
|
||||||
-- pick up this mission an remove it from the
|
-- pick up this mission and remove it from the
|
||||||
table.insert(pickups, mission)
|
table.insert(pickups, mission)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -488,7 +526,7 @@ function csarManager.heloLanded(theUnit)
|
|||||||
theMission.group:destroy() -- will shut up radio as well
|
theMission.group:destroy() -- will shut up radio as well
|
||||||
theMission.group = nil
|
theMission.group = nil
|
||||||
-- now adapt for cargoSuper
|
-- now adapt for cargoSuper
|
||||||
theMassObject = cargoSuper.createMassObject(
|
local theMassObject = cargoSuper.createMassObject(
|
||||||
csarManager.pilotWeight,
|
csarManager.pilotWeight,
|
||||||
theMission.name,
|
theMission.name,
|
||||||
theMission)
|
theMission)
|
||||||
@ -788,6 +826,8 @@ function csarManager.unloadOne(args)
|
|||||||
-- create a new missions in 50m radius
|
-- create a new missions in 50m radius
|
||||||
csarManager.createCSARforUnit(theUnit, theRescuedPilot, 50, true)
|
csarManager.createCSARforUnit(theUnit, theRescuedPilot, 50, true)
|
||||||
conf.troopsOnBoard[i] = nil -- remove this mission
|
conf.troopsOnBoard[i] = nil -- remove this mission
|
||||||
|
--TODO: remove weight for this pilot!
|
||||||
|
|
||||||
trigger.action.outTextForCoalition(theSide, myName .. " has aborted evacuating " .. msn.name .. ". New CSAR available.", 30)
|
trigger.action.outTextForCoalition(theSide, myName .. " has aborted evacuating " .. msn.name .. ". New CSAR available.", 30)
|
||||||
trigger.action.outSoundForCoalition(theSide, "Quest Snare 3.wav")
|
trigger.action.outSoundForCoalition(theSide, "Quest Snare 3.wav")
|
||||||
|
|
||||||
@ -944,8 +984,8 @@ function csarManager.update() -- every second
|
|||||||
trigger.action.outSoundForGroup(uID, "Quest Snare 3.wav")
|
trigger.action.outSoundForGroup(uID, "Quest Snare 3.wav")
|
||||||
table.insert(csarMission.messagedUnits, uName) -- remember that we messaged them so we don't do again
|
table.insert(csarMission.messagedUnits, uName) -- remember that we messaged them so we don't do again
|
||||||
end
|
end
|
||||||
-- also pop smoke if not popped already, or more than 3 minutes ago
|
-- also pop smoke if not popped already, or more than 5 minutes ago
|
||||||
if csarManager.useSmoke and timer.getTime() - csarMission.lastSmokeTime > 179 then
|
if csarManager.useSmoke and (timer.getTime() - csarMission.lastSmokeTime) >= 5 * 60 then
|
||||||
local smokePoint = dcsCommon.randomPointOnPerimeter(
|
local smokePoint = dcsCommon.randomPointOnPerimeter(
|
||||||
50, csarMission.zone.point.x, csarMission.zone.point.z) --cfxZones.createHeightCorrectedPoint(csarMission.zone.point)
|
50, csarMission.zone.point.x, csarMission.zone.point.z) --cfxZones.createHeightCorrectedPoint(csarMission.zone.point)
|
||||||
-- trigger.action.smoke(smokePoint, 4 )
|
-- trigger.action.smoke(smokePoint, 4 )
|
||||||
@ -958,7 +998,7 @@ function csarManager.update() -- every second
|
|||||||
-- WARNING: WE ALWAYS ONLY CHECK A SINGLE UNIT - the first alive
|
-- WARNING: WE ALWAYS ONLY CHECK A SINGLE UNIT - the first alive
|
||||||
local evacuee = csarMission.group:getUnit(1)
|
local evacuee = csarMission.group:getUnit(1)
|
||||||
if evacuee then
|
if evacuee then
|
||||||
ep = evacuee:getPoint()
|
local ep = evacuee:getPoint()
|
||||||
d = dcsCommon.distFlat(uPoint, ep)
|
d = dcsCommon.distFlat(uPoint, ep)
|
||||||
d = math.floor(d * 10) / 10
|
d = math.floor(d * 10) / 10
|
||||||
if d < csarManager.hoverRadius * 2 then
|
if d < csarManager.hoverRadius * 2 then
|
||||||
@ -976,7 +1016,7 @@ function csarManager.update() -- every second
|
|||||||
csarMission.hoveringUnits[uName] = timer.getTime()
|
csarMission.hoveringUnits[uName] = timer.getTime()
|
||||||
end
|
end
|
||||||
hoverTime = timer.getTime() - hoverTime -- calculate number of seconds
|
hoverTime = timer.getTime() - hoverTime -- calculate number of seconds
|
||||||
remainder = math.floor(csarManager.hoverDuration - hoverTime)
|
local remainder = math.floor(csarManager.hoverDuration - hoverTime)
|
||||||
if remainder < 1 then remainder = 1 end
|
if remainder < 1 then remainder = 1 end
|
||||||
hoverMsg = "Steady... " .. d * 3 .. "ft to your " .. oclock .. " o'clock, winching... (" .. remainder .. ")"
|
hoverMsg = "Steady... " .. d * 3 .. "ft to your " .. oclock .. " o'clock, winching... (" .. remainder .. ")"
|
||||||
if hoverTime > csarManager.hoverDuration then
|
if hoverTime > csarManager.hoverDuration then
|
||||||
@ -987,6 +1027,24 @@ function csarManager.update() -- every second
|
|||||||
table.insert(conf.troopsOnBoard, csarMission)
|
table.insert(conf.troopsOnBoard, csarMission)
|
||||||
csarMission.group:destroy() -- will shut up radio as well
|
csarMission.group:destroy() -- will shut up radio as well
|
||||||
csarMission.group = nil
|
csarMission.group = nil
|
||||||
|
|
||||||
|
-- now handle weight using cargoSuper
|
||||||
|
local theMassObject = cargoSuper.createMassObject(
|
||||||
|
csarManager.pilotWeight,
|
||||||
|
csarMission.name,
|
||||||
|
csarMission)
|
||||||
|
cargoSuper.addMassObjectTo(
|
||||||
|
uName,
|
||||||
|
"Evacuees",
|
||||||
|
theMassObject)
|
||||||
|
local totalMass = cargoSuper.calculateTotalMassFor(uName)
|
||||||
|
trigger.action.setUnitInternalCargo(uName, totalMass)
|
||||||
|
|
||||||
|
if csarManager.verbose then
|
||||||
|
local allEvacuees = cargoSuper.getManifestFor(myName, "Evacuees") -- returns unlinked array
|
||||||
|
trigger.action.outText("+++csar: <" .. uName .. "> now has <" .. #allEvacuees .. "> groups of evacuees on board, totalling " .. totalMass .. "kg", 30)
|
||||||
|
end
|
||||||
|
|
||||||
trigger.action.outTextForGroup(uID, hoverMsg, 30, true)
|
trigger.action.outTextForGroup(uID, hoverMsg, 30, true)
|
||||||
trigger.action.outSoundForGroup(uID, "Quest Snare 3.wav")
|
trigger.action.outSoundForGroup(uID, "Quest Snare 3.wav")
|
||||||
|
|
||||||
@ -1310,5 +1368,9 @@ end
|
|||||||
- compatibility: side/owner - make sure it is compatible
|
- compatibility: side/owner - make sure it is compatible
|
||||||
with FARP, and landing on a FARP with opposition ownership
|
with FARP, and landing on a FARP with opposition ownership
|
||||||
will not disembark
|
will not disembark
|
||||||
|
|
||||||
|
- suppress multi smoke
|
||||||
|
|
||||||
|
- when unloading one by menu, update weight!!!
|
||||||
|
|
||||||
--]]--
|
--]]--
|
||||||
@ -1,5 +1,5 @@
|
|||||||
dcsCommon = {}
|
dcsCommon = {}
|
||||||
dcsCommon.version = "2.6.2"
|
dcsCommon.version = "2.6.3"
|
||||||
--[[-- VERSION HISTORY
|
--[[-- VERSION HISTORY
|
||||||
2.2.6 - compassPositionOfARelativeToB
|
2.2.6 - compassPositionOfARelativeToB
|
||||||
- clockPositionOfARelativeToB
|
- clockPositionOfARelativeToB
|
||||||
@ -72,6 +72,7 @@ dcsCommon.version = "2.6.2"
|
|||||||
2.6.0 - unified uuid, removed uuIdent
|
2.6.0 - unified uuid, removed uuIdent
|
||||||
2.6.1 - removed bug in rotateUnitData: cy --> cz param passing
|
2.6.1 - removed bug in rotateUnitData: cy --> cz param passing
|
||||||
2.6.2 - new combineTables()
|
2.6.2 - new combineTables()
|
||||||
|
2.6.3 - new tacan2freq()
|
||||||
|
|
||||||
--]]--
|
--]]--
|
||||||
|
|
||||||
@ -1972,6 +1973,25 @@ dcsCommon.version = "2.6.2"
|
|||||||
trigger.action.smoke(newPoint, smokeColor)
|
trigger.action.smoke(newPoint, smokeColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- based on buzzer1977's idea, channel is number, eg in 74X, channel is 74, mode is "X"
|
||||||
|
function tacan2freq(channel, mode)
|
||||||
|
if not mode then mode = "X" end
|
||||||
|
if not channel then channel = 1 end
|
||||||
|
if type(mode) ~= "string" then mode = "X" end
|
||||||
|
mode = mode:upper()
|
||||||
|
local offset = 1000000 * channel
|
||||||
|
if channel < 64 then
|
||||||
|
if mode == "Y" then
|
||||||
|
return 1087000000 + offset
|
||||||
|
end
|
||||||
|
return 961000000 + offset -- mode x
|
||||||
|
end
|
||||||
|
|
||||||
|
if mode == "Y" then
|
||||||
|
return 961000000 + offset
|
||||||
|
end
|
||||||
|
return 1087000000 + offset -- mode x
|
||||||
|
end
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
-- V E C T O R M A T H
|
-- V E C T O R M A T H
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
groupTracker = {}
|
groupTracker = {}
|
||||||
groupTracker.version = "1.1.1"
|
groupTracker.version = "1.1.2"
|
||||||
groupTracker.verbose = false
|
groupTracker.verbose = false
|
||||||
groupTracker.ups = 1
|
groupTracker.ups = 1
|
||||||
groupTracker.requiredLibs = {
|
groupTracker.requiredLibs = {
|
||||||
@ -15,6 +15,8 @@ groupTracker.trackers = {}
|
|||||||
- array support for trackers
|
- array support for trackers
|
||||||
- array support for trackers
|
- array support for trackers
|
||||||
1.1.1 - corrected clone zone reference bug
|
1.1.1 - corrected clone zone reference bug
|
||||||
|
1.1.2 - corrected naming (removed bang from flags), deprecated old
|
||||||
|
- more zone-local verbosity
|
||||||
|
|
||||||
--]]--
|
--]]--
|
||||||
|
|
||||||
@ -97,20 +99,32 @@ function groupTracker.createTrackerWithZone(theZone)
|
|||||||
-- init group tracking set
|
-- init group tracking set
|
||||||
theZone.trackedGroups = {}
|
theZone.trackedGroups = {}
|
||||||
|
|
||||||
if cfxZones.hasProperty(theZone, "numGroups!") then
|
|
||||||
theZone.tNumGroups = cfxZones.getStringFromZoneProperty(theZone, "numGroups!", "<none>")
|
if cfxZones.hasProperty(theZone, "numGroups") then
|
||||||
|
theZone.tNumGroups = cfxZones.getStringFromZoneProperty(theZone, "numGroups", "*<none>")
|
||||||
|
-- we may need to zero this flag
|
||||||
|
elseif cfxZones.hasProperty(theZone, "numGroups!") then -- DEPRECATED!
|
||||||
|
theZone.tNumGroups = cfxZones.getStringFromZoneProperty(theZone, "numGroups!", "*<none>")
|
||||||
-- we may need to zero this flag
|
-- we may need to zero this flag
|
||||||
end
|
end
|
||||||
|
|
||||||
if cfxZones.hasProperty(theZone, "addGroup!") then
|
if cfxZones.hasProperty(theZone, "addGroup") then
|
||||||
theZone.tAddGroup = cfxZones.getStringFromZoneProperty(theZone, "addGroup!", "<none>")
|
theZone.tAddGroup = cfxZones.getStringFromZoneProperty(theZone, "addGroup", "*<none>")
|
||||||
|
-- we may need to zero this flag
|
||||||
|
elseif cfxZones.hasProperty(theZone, "addGroup!") then -- DEPRECATED
|
||||||
|
theZone.tAddGroup = cfxZones.getStringFromZoneProperty(theZone, "addGroup!", "*<none>")
|
||||||
|
-- we may need to zero this flag
|
||||||
|
end
|
||||||
|
|
||||||
|
if cfxZones.hasProperty(theZone, "removeGroup") then
|
||||||
|
theZone.tRemoveGroup = cfxZones.getStringFromZoneProperty(theZone, "removeGroup", "*<none>")
|
||||||
|
-- we may need to zero this flag
|
||||||
|
elseif cfxZones.hasProperty(theZone, "removeGroup!") then -- DEPRECATED!
|
||||||
|
theZone.tRemoveGroup = cfxZones.getStringFromZoneProperty(theZone, "removeGroup!", "*<none>")
|
||||||
-- we may need to zero this flag
|
-- we may need to zero this flag
|
||||||
end
|
end
|
||||||
|
|
||||||
if cfxZones.hasProperty(theZone, "removeGroup!") then
|
|
||||||
theZone.tRemoveGroup = cfxZones.getStringFromZoneProperty(theZone, "removeGroup!", "<none>")
|
|
||||||
-- we may need to zero this flag
|
|
||||||
end
|
|
||||||
|
|
||||||
if cfxZones.hasProperty(theZone, "groupFilter") then
|
if cfxZones.hasProperty(theZone, "groupFilter") then
|
||||||
local filterString = cfxZones.getStringFromZoneProperty(theZone, "groupFilter", "2") -- ground
|
local filterString = cfxZones.getStringFromZoneProperty(theZone, "groupFilter", "2") -- ground
|
||||||
@ -119,6 +133,10 @@ function groupTracker.createTrackerWithZone(theZone)
|
|||||||
trigger.action.outText("+++gTrck: filtering " .. theZone.groupFilter .. " in " .. theZone.name, 30)
|
trigger.action.outText("+++gTrck: filtering " .. theZone.groupFilter .. " in " .. theZone.name, 30)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if theZone.verbose or groupTracker.verbose then
|
||||||
|
trigger.action.outText("gTrck: processed <" .. theZone.name .. ">", 30)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -145,10 +163,13 @@ function groupTracker.checkGroups(theZone)
|
|||||||
if isDead then
|
if isDead then
|
||||||
-- bang deceased
|
-- bang deceased
|
||||||
if groupTracker.verbose or theZone.verbose then
|
if groupTracker.verbose or theZone.verbose then
|
||||||
trigger.action.outText("+++gTrk: dead group detected in " .. theZone.name .. ", discarding.", 30)
|
trigger.action.outText("+++gTrk: dead group detected in " .. theZone.name .. ", removing.", 30)
|
||||||
end
|
end
|
||||||
if theZone.tRemoveGroup then
|
if theZone.tRemoveGroup then
|
||||||
cfxZones.pollFlag(theZone.tRemoveGroup, "inc", theZone)
|
cfxZones.pollFlag(theZone.tRemoveGroup, "inc", theZone)
|
||||||
|
if theZone.verbose then
|
||||||
|
trigger.action.outText("+++gTrk: <" .. theZone.name .. "> incrementing remove flag <" .. theZone.tRemoveGroup .. ">", 30)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- transfer alive group
|
-- transfer alive group
|
||||||
@ -207,24 +228,6 @@ function groupTracker.trackGroupsInZone(theZone)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- old code, non-array capable
|
|
||||||
--[[--
|
|
||||||
if trackerName == "*" then trackerName = theZone.name end
|
|
||||||
|
|
||||||
local theTracker = groupTracker.getTrackerByName(trackerName)
|
|
||||||
if not theTracker then
|
|
||||||
trigger.action.outText("+++gTrk: trackGroupsInZone - no zone named <" .. trackerName .. ">", 30 )
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local theGroups = cfxZones.allGroupsInZone(theZone, nil)
|
|
||||||
for idx, aGroup in pairs(theGroups) do
|
|
||||||
if groupTracker.verbose then
|
|
||||||
trigger.action.outText("+++gTrk: <" .. theZone.name .. "> passed off group <" .. aGroup:getName() .. "> to <" .. trackerName .. ">", 30)
|
|
||||||
end
|
|
||||||
groupTracker.addGroupToTracker(aGroup, theTracker)
|
|
||||||
end
|
|
||||||
--]]--
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
unGrief = {}
|
unGrief = {}
|
||||||
unGrief.version = "1.1.0"
|
unGrief.version = "1.2.0"
|
||||||
unGrief.verbose = false
|
unGrief.verbose = false
|
||||||
|
unGrief.ups = 1
|
||||||
unGrief.requiredLibs = {
|
unGrief.requiredLibs = {
|
||||||
"dcsCommon", -- always
|
"dcsCommon", -- always
|
||||||
"cfxZones", -- Zones, of course
|
"cfxZones", -- Zones, of course
|
||||||
@ -16,11 +17,48 @@ unGrief.disabledFlagValue = unGrief.enabledFlagValue + 100 -- DO NOT CHANGE
|
|||||||
1.1.0 - wrathful option
|
1.1.0 - wrathful option
|
||||||
- pve option
|
- pve option
|
||||||
- ignoreAI option
|
- ignoreAI option
|
||||||
|
1.2.0 - allow PVP zones
|
||||||
|
- strict rules
|
||||||
|
- warnings on enter/exit
|
||||||
|
- warnings optional
|
||||||
|
|
||||||
--]]--
|
--]]--
|
||||||
|
|
||||||
unGrief.griefers = {} -- offenders are stored here
|
unGrief.griefers = {} -- offenders are stored here
|
||||||
|
|
||||||
|
-- PVP stuff here
|
||||||
|
unGrief.pvpZones = {}
|
||||||
|
unGrief.playerPilotZone = {} -- for messaging when leaving/entering pvp zones
|
||||||
|
|
||||||
|
|
||||||
|
function unGrief.addPvpZone(theZone)
|
||||||
|
table.insert(unGrief.pvpZones, theZone)
|
||||||
|
end
|
||||||
|
|
||||||
|
function unGrief.getPvpZoneByName(aName)
|
||||||
|
for idx, aZone in pairs(unGrief.pvpZones) do
|
||||||
|
if aName == aZone.name then return aZone end
|
||||||
|
end
|
||||||
|
if unGrief.verbose then
|
||||||
|
trigger.action.outText("+++unGrief: no pvpZone with name <" .. aName ..">", 30)
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- read pvp zone
|
||||||
|
--
|
||||||
|
function unGrief.createPvpWithZone(theZone)
|
||||||
|
-- read pvp data - there's currently really nothing to do
|
||||||
|
if theZone.verbose or unGrief.verbose then
|
||||||
|
trigger.action.outText("+++uGrf: <" .. theZone.name .. "> is designated as PVP legal", 30)
|
||||||
|
end
|
||||||
|
|
||||||
|
theZone.strictPVP = cfxZones.getBoolFromZoneProperty(theZone, "strict", false)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- vengeance: if player killed before, they are no longer welcome
|
-- vengeance: if player killed before, they are no longer welcome
|
||||||
function unGrief.exactVengance(theEvent)
|
function unGrief.exactVengance(theEvent)
|
||||||
if theEvent.id == 20 then -- S_EVENT_PLAYER_ENTER_UNIT
|
if theEvent.id == 20 then -- S_EVENT_PLAYER_ENTER_UNIT
|
||||||
@ -90,6 +128,31 @@ function unGrief:onEvent(theEvent)
|
|||||||
local pvpTransgression = false
|
local pvpTransgression = false
|
||||||
if unGrief.pve and stiff.getPlayerName and stiff:getPlayerName() then
|
if unGrief.pve and stiff.getPlayerName and stiff:getPlayerName() then
|
||||||
pvpTransgression = true
|
pvpTransgression = true
|
||||||
|
if pvpTransgression then
|
||||||
|
-- check if this happened in a pvp zone.
|
||||||
|
local crimeScene = stiff:getPoint()
|
||||||
|
for idx, theZone in pairs (unGrief.pvpZones) do
|
||||||
|
-- if the VIC is in a pvp zone, that was legal
|
||||||
|
if cfxZones.isPointInsideZone(crimeScene, theZone) then
|
||||||
|
-- see if strict rules apply
|
||||||
|
if theZone.strictPVP then
|
||||||
|
-- also check killer
|
||||||
|
crimeScene = killer:getPoint()
|
||||||
|
if cfxZones.isPointInsideZone(crimeScene, theZone) then
|
||||||
|
pvpTransgression = false
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- relaxed pvp
|
||||||
|
pvpTransgression = false
|
||||||
|
end
|
||||||
|
|
||||||
|
if (not pvpTransgression) and
|
||||||
|
(unGrief.verbose or theZone.verbose) then
|
||||||
|
trigger.action.outText("+++uGrf: legal PVP kill of <" .. stiff:getName() .. "> in <" .. theZone.name .. ">", 30)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if unGrief.ignoreAI then
|
if unGrief.ignoreAI then
|
||||||
@ -115,7 +178,7 @@ function unGrief:onEvent(theEvent)
|
|||||||
if not pvpTransgression then
|
if not pvpTransgression then
|
||||||
trigger.action.outText(playerName .. " has killed one of their own. YOU ARE ON NOTICE!", 30)
|
trigger.action.outText(playerName .. " has killed one of their own. YOU ARE ON NOTICE!", 30)
|
||||||
else
|
else
|
||||||
trigger.action.outText(playerName .. " has killed a fellow Player. YOU ARE ON NOTICE!", 30)
|
trigger.action.outText(playerName .. " has illegally killed a fellow Player. YOU ARE ON NOTICE!", 30)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -145,6 +208,45 @@ function unGrief:onEvent(theEvent)
|
|||||||
-- (or kick via SSB or do some other stuff. be creative to boot this idiot)
|
-- (or kick via SSB or do some other stuff. be creative to boot this idiot)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function unGrief.update()
|
||||||
|
timer.scheduleFunction(unGrief.update, {}, timer.getTime() + 1/unGrief.ups)
|
||||||
|
-- iterate all players
|
||||||
|
for side = 1, 2 do
|
||||||
|
local playersOnThisSide = coalition.getPlayers(side)
|
||||||
|
for idx, p in pairs (playersOnThisSide) do
|
||||||
|
local pName = p:getPlayerName()
|
||||||
|
if pName then
|
||||||
|
local pLoc = p:getPoint()
|
||||||
|
local lastZone = unGrief.playerPilotZone[pName]
|
||||||
|
local currZone = nil
|
||||||
|
local isStrict = false
|
||||||
|
for idy, theZone in pairs(unGrief.pvpZones) do
|
||||||
|
if cfxZones.isPointInsideZone(pLoc, theZone) then
|
||||||
|
currZone = theZone
|
||||||
|
isStrict = theZone.strictPVP
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if currZone ~= lastZone then
|
||||||
|
local pG = p:getGroup()
|
||||||
|
local gID = pG:getID()
|
||||||
|
if currZone then
|
||||||
|
local strictness = ""
|
||||||
|
if isStrict then
|
||||||
|
strictness = " STRICT PvP rules apply!"
|
||||||
|
end
|
||||||
|
|
||||||
|
trigger.action.outTextForGroup(gID, "WARNING: you are entering a PVP zone!" .. strictness, 30)
|
||||||
|
else
|
||||||
|
-- left a pvp zone
|
||||||
|
trigger.action.outTextForGroup(gID, "NOTE: you are leaving a PVP area!", 30)
|
||||||
|
end
|
||||||
|
unGrief.playerPilotZone[pName] = currZone
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function unGrief.readConfigZone()
|
function unGrief.readConfigZone()
|
||||||
local theZone = cfxZones.getZoneByName("unGriefConfig")
|
local theZone = cfxZones.getZoneByName("unGriefConfig")
|
||||||
if not theZone then
|
if not theZone then
|
||||||
@ -170,6 +272,8 @@ function unGrief.readConfigZone()
|
|||||||
|
|
||||||
unGrief.ignoreAI = cfxZones.getBoolFromZoneProperty(theZone, "ignoreAI", false)
|
unGrief.ignoreAI = cfxZones.getBoolFromZoneProperty(theZone, "ignoreAI", false)
|
||||||
|
|
||||||
|
unGrief.PVPwarnings = cfxZones.getBoolFromZoneProperty(theZone, "warnings", true)
|
||||||
|
|
||||||
if unGrief.verbose then
|
if unGrief.verbose then
|
||||||
trigger.action.outText("+++uGrf: read config", 30)
|
trigger.action.outText("+++uGrf: read config", 30)
|
||||||
end
|
end
|
||||||
@ -188,6 +292,22 @@ function unGrief.start()
|
|||||||
-- read config
|
-- read config
|
||||||
unGrief.readConfigZone()
|
unGrief.readConfigZone()
|
||||||
|
|
||||||
|
-- read pvp zones if pve is enabled
|
||||||
|
if unGrief.pve then
|
||||||
|
if unGrief.verbose then
|
||||||
|
trigger.action.outText("PVE mode - scanning for PVP zones", 30)
|
||||||
|
end
|
||||||
|
local attrZones = cfxZones.getZonesWithAttributeNamed("pvp")
|
||||||
|
for k, aZone in pairs(attrZones) do
|
||||||
|
unGrief.createPvpWithZone(aZone) -- process attributes
|
||||||
|
unGrief.addPvpZone(aZone) -- add to list
|
||||||
|
end
|
||||||
|
|
||||||
|
if unGrief.PVPwarnings then
|
||||||
|
unGrief.update() -- start update tracking for player warnings
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- connect event proccer
|
-- connect event proccer
|
||||||
world.addEventHandler(unGrief)
|
world.addEventHandler(unGrief)
|
||||||
|
|
||||||
@ -201,6 +321,3 @@ if not unGrief.start() then
|
|||||||
unGrief = nil
|
unGrief = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- to be developed:
|
|
||||||
-- ungrief on and off flags
|
|
||||||
-- pvp and pve zones in addition to global attributes
|
|
||||||
BIN
tutorial & demo missions/demo - The Danger Zone.miz
Normal file
BIN
tutorial & demo missions/demo - The Danger Zone.miz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user