**TODO:**
- finish Range:activeTartgets()
- add function Range:addTargetPreset(group/groupName,targetType)
- add function Range:RemoveTargetPreset(group/groupName,targetType)
This commit is contained in:
@@ -41,6 +41,8 @@ Localizations = {
|
|||||||
--AutoRespawn
|
--AutoRespawn
|
||||||
['Auto Respawn Targets: On'] = 'Auto Respawn Targets: On',
|
['Auto Respawn Targets: On'] = 'Auto Respawn Targets: On',
|
||||||
['Auto Respawn Targets: Off'] = 'Auto Respawn Targets: Off',
|
['Auto Respawn Targets: Off'] = 'Auto Respawn Targets: Off',
|
||||||
|
--Message
|
||||||
|
['There is no range section of %s left.'] = 'There is no range section of %s left.',
|
||||||
},
|
},
|
||||||
|
|
||||||
--中文
|
--中文
|
||||||
@@ -83,6 +85,8 @@ Localizations = {
|
|||||||
--AutoRespawn
|
--AutoRespawn
|
||||||
['Auto Respawn Targets: On'] = '目标自动重生: 开',
|
['Auto Respawn Targets: On'] = '目标自动重生: 开',
|
||||||
['Auto Respawn Targets: Off'] = '目标自动重生: 关',
|
['Auto Respawn Targets: Off'] = '目标自动重生: 关',
|
||||||
|
--Message
|
||||||
|
['There is no range section of %s left.'] = '没有 %s 类型靶场空闲了.',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+73
-6
@@ -1,3 +1,12 @@
|
|||||||
|
--[[
|
||||||
|
24.13.31.1714
|
||||||
|
TODO:
|
||||||
|
- finish Range:activeTartgets()
|
||||||
|
- add function Range:addTargetPreset(group/groupName,targetType)
|
||||||
|
- add function Range:RemoveTargetPreset(group/groupName,targetType)
|
||||||
|
]]
|
||||||
|
|
||||||
|
|
||||||
Range = {
|
Range = {
|
||||||
MonitorRepeatTime = 5, --Seconds
|
MonitorRepeatTime = 5, --Seconds
|
||||||
MonitorID = nil,
|
MonitorID = nil,
|
||||||
@@ -27,6 +36,8 @@ Range = {
|
|||||||
-- TELE = 'Tele',
|
-- TELE = 'Tele',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
targetPresets = {},
|
||||||
|
|
||||||
sections = {},
|
sections = {},
|
||||||
|
|
||||||
playerList = {},
|
playerList = {},
|
||||||
@@ -201,8 +212,7 @@ do
|
|||||||
local FightBackSwitchName = Localizations:translate(string.format('Targets open fire: %s',switch),'cn')
|
local FightBackSwitchName = Localizations:translate(string.format('Targets open fire: %s',switch),'cn')
|
||||||
missionCommands.addCommandForGroup(groupID,FightBackSwitchName,SettingsMenu,function (vars)
|
missionCommands.addCommandForGroup(groupID,FightBackSwitchName,SettingsMenu,function (vars)
|
||||||
local self = vars.context
|
local self = vars.context
|
||||||
self.playerList[playerName].isTargerRedAlert = not self.playerList[playerName].isTargerRedAlert
|
self:setTargetFightBack(playerGroup)
|
||||||
self:createMenu(playerGroup)
|
|
||||||
end,{context = self})
|
end,{context = self})
|
||||||
|
|
||||||
switch = 'Off'
|
switch = 'Off'
|
||||||
@@ -213,8 +223,7 @@ do
|
|||||||
local AutoRespawnSwitchName = Localizations:translate(string.format('Auto Respawn Targets: %s',switch),'cn')
|
local AutoRespawnSwitchName = Localizations:translate(string.format('Auto Respawn Targets: %s',switch),'cn')
|
||||||
missionCommands.addCommandForGroup(groupID,AutoRespawnSwitchName,SettingsMenu,function (vars)
|
missionCommands.addCommandForGroup(groupID,AutoRespawnSwitchName,SettingsMenu,function (vars)
|
||||||
local self = vars.context
|
local self = vars.context
|
||||||
self.playerList[playerName].autoRespawn = not self.playerList[playerName].autoRespawn
|
self:setTargetAutoRespawn(playerGroup)
|
||||||
self:createMenu(playerGroup)
|
|
||||||
end,{context = self})
|
end,{context = self})
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -237,6 +246,7 @@ do
|
|||||||
autoRespawn = false,
|
autoRespawn = false,
|
||||||
isTargerRedAlert = false,
|
isTargerRedAlert = false,
|
||||||
activeTarget = nil,
|
activeTarget = nil,
|
||||||
|
targetData = {},
|
||||||
menu = nil,
|
menu = nil,
|
||||||
}
|
}
|
||||||
self:createMenu(playerGroup)
|
self:createMenu(playerGroup)
|
||||||
@@ -253,13 +263,46 @@ do
|
|||||||
self.playerList[PlayerName] = nil
|
self.playerList[PlayerName] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function Range:activeTartgets(section,targetType,AAType,Move)
|
function Range:activeTartgets(sectionType,targetType,AAType,Move)
|
||||||
|
if not sectionType then return end
|
||||||
|
if not targetType then return end
|
||||||
|
|
||||||
AAType = AAType or 'none'
|
AAType = AAType or 'none'
|
||||||
|
Move = Move or false
|
||||||
|
|
||||||
|
--Debug
|
||||||
local isMove = 'Stationary'
|
local isMove = 'Stationary'
|
||||||
if Move then
|
if Move then
|
||||||
isMove = 'Moving'
|
isMove = 'Moving'
|
||||||
end
|
end
|
||||||
Utils.Debug('section:'..section..' targetType: '..' AAType: '..AAType..' Move: '..isMove)
|
Utils.Debug('section:'..sectionType..' targetType: '..' AAType: '..AAType..' Move: '..isMove)
|
||||||
|
|
||||||
|
--Get sectionZone
|
||||||
|
local sectionZone = nil
|
||||||
|
for i=1,#self.sections[sectionType],1 do
|
||||||
|
local zoneNum = math.random(1,#self.sections[sectionType])
|
||||||
|
if not self.sections[sectionType][zoneNum].active then
|
||||||
|
sectionZone = self.sections[sectionType][zoneNum]
|
||||||
|
self.sections[sectionType][zoneNum].active = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not sectionZone then
|
||||||
|
for i=1,#self.sections[sectionType],1 do
|
||||||
|
if not self.sections[sectionType][i].active then
|
||||||
|
sectionZone = self.sections[sectionType][i]
|
||||||
|
self.sections[sectionType][i].active = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not sectionZone then
|
||||||
|
trigger.action.outTextForGroup(string.format(Localizations:translate('There is no range section of %s left.','cn'),Localizations:translate(sectionType,'cn')))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
--Get target types
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Range:deactivateTargets(PlayerName)
|
function Range:deactivateTargets(PlayerName)
|
||||||
@@ -277,8 +320,32 @@ do
|
|||||||
if not playerUnit then return end
|
if not playerUnit then return end
|
||||||
if not playerUnit:isActive() then return end
|
if not playerUnit:isActive() then return end
|
||||||
|
|
||||||
|
local playerName = playerUnit:getPlayerName()
|
||||||
|
if not playerName then return end
|
||||||
|
|
||||||
|
self.playerList[playerName].isTargerRedAlert = not self.playerList[playerName].isTargerRedAlert
|
||||||
|
if self.playerList[playerName].activeTarget then
|
||||||
|
local Controller = self.playerList[playerName].activeTarget:getController()
|
||||||
|
if Controller then
|
||||||
|
Controller:setOption(AI.Option.Ground.id.ROE,AI.Option.Ground.val.ROE.WEAPON_HOLD)
|
||||||
|
Controller:setOption(AI.Option.Ground.id.ALARM_STATE,AI.Option.Ground.val.ALARM_STATE.GREEN)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self:createMenu(playerGroup)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Range:setTargetAutoRespawn(playerGroup)
|
||||||
|
if not playerGroup then return end
|
||||||
|
|
||||||
|
local playerUnit = playerGroup:getUnit(1)
|
||||||
|
if not playerUnit then return end
|
||||||
|
if not playerUnit:isActive() then return end
|
||||||
|
|
||||||
|
local playerName = playerUnit:getPlayerName()
|
||||||
|
if not playerName then return end
|
||||||
|
|
||||||
|
self.playerList[playerName].autoRespawn = not self.playerList[playerName].autoRespawn
|
||||||
|
|
||||||
self:createMenu(playerGroup)
|
self:createMenu(playerGroup)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user