- Remove debug messages for Range.lua
- Add hint message when spawning targets.
This commit is contained in:
Binary file not shown.
@@ -44,6 +44,10 @@ Localizations = {
|
|||||||
['Auto Respawn Targets: Off'] = 'Auto Respawn Targets: Off',
|
['Auto Respawn Targets: Off'] = 'Auto Respawn Targets: Off',
|
||||||
--Message
|
--Message
|
||||||
['There is no range section of %s left.'] = 'There is no range section of %s left.',
|
['There is no range section of %s left.'] = 'There is no range section of %s left.',
|
||||||
|
['Spawn target at %s section area. targetType: %s state: %s'] = 'Spawn target at %s section area. targetType: %s state: %s',
|
||||||
|
['Spawn target at %s section area. targetType: %s AAType: %s state: %s'] = 'Spawn target at %s section area. targetType: %s AAType: %s state: %s',
|
||||||
|
['Stationary'] = 'Stationary',
|
||||||
|
['Moving'] = 'Moving',
|
||||||
},
|
},
|
||||||
|
|
||||||
--中文
|
--中文
|
||||||
@@ -89,6 +93,10 @@ Localizations = {
|
|||||||
['Auto Respawn Targets: Off'] = '目标自动重生: 关',
|
['Auto Respawn Targets: Off'] = '目标自动重生: 关',
|
||||||
--Message
|
--Message
|
||||||
['There is no range section of %s left.'] = '没有 %s 类型靶场空闲了.',
|
['There is no range section of %s left.'] = '没有 %s 类型靶场空闲了.',
|
||||||
|
['Spawn target at %s section area. targetType: %s state: %s'] = '在 %s 区域刷新目标. 目标类型: %s 状态: %s',
|
||||||
|
['Spawn target at %s section area. targetType: %s AAType: %s state: %s'] = '在 %s 区域 刷新目标. 目标类型: %s 防空类型: %s 状态: %s',
|
||||||
|
['Stationary'] = '静止目标',
|
||||||
|
['Moving'] = '运动目标',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+39
-45
@@ -60,6 +60,10 @@ do
|
|||||||
self.points = points
|
self.points = points
|
||||||
|
|
||||||
Utils.drawPolygon(-1,Utils.getMarkID(),points,{0,1,1,1},{0,1,0,0},2)
|
Utils.drawPolygon(-1,Utils.getMarkID(),points,{0,1,1,1},{0,1,0,0},2)
|
||||||
|
local dangerZonePoints = Utils.getWayPoints(zoneName..'-1')
|
||||||
|
if dangerZonePoints then
|
||||||
|
Utils.drawPolygon(-1,Utils.getMarkID(),dangerZonePoints,{1,0,0,1},{1,0,0,0},2)
|
||||||
|
end
|
||||||
|
|
||||||
for type, value in pairs(self.sectionTypes) do
|
for type, value in pairs(self.sectionTypes) do
|
||||||
for j=1,100,1 do
|
for j=1,100,1 do
|
||||||
@@ -71,7 +75,7 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Debug
|
--Debug
|
||||||
self.drawPolygon(points)
|
-- self.drawPolygon(points)
|
||||||
-- trigger.action.textToAll(-1,Utils.getMarkID(),Utils.makeVec3(points[1]),{1,1,1,1},{0,0,0,0},8,false,sectionName)
|
-- trigger.action.textToAll(-1,Utils.getMarkID(),Utils.makeVec3(points[1]),{1,1,1,1},{0,0,0,0},8,false,sectionName)
|
||||||
|
|
||||||
local sectionData = {
|
local sectionData = {
|
||||||
@@ -159,28 +163,27 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Utils.Debug(mist.utils.tableShow(self.playerList))
|
-- --Debug
|
||||||
--Debug
|
-- for sectionType,sections in pairs(self.sections) do
|
||||||
for sectionType,sections in pairs(self.sections) do
|
-- for i, section in ipairs(sections) do
|
||||||
for i, section in ipairs(sections) do
|
-- local text = 'not active'
|
||||||
local text = 'not active'
|
-- if section.active then
|
||||||
if section.active then
|
-- text = 'active'
|
||||||
text = 'active'
|
-- end
|
||||||
end
|
|
||||||
|
|
||||||
local point = {
|
-- local point = {
|
||||||
x = section.points[1].x,
|
-- x = section.points[1].x,
|
||||||
y = 0,
|
-- y = 0,
|
||||||
z = section.points[1].y,
|
-- z = section.points[1].y,
|
||||||
}
|
-- }
|
||||||
if not section.tagID then
|
-- if not section.tagID then
|
||||||
section.tagID = Utils.getMarkID()
|
-- section.tagID = Utils.getMarkID()
|
||||||
trigger.action.textToAll(-1,section.tagID,point,{1,1,0,1},{0,0,0,0},12,false,text)
|
-- trigger.action.textToAll(-1,section.tagID,point,{1,1,0,1},{0,0,0,0},12,false,text)
|
||||||
end
|
-- end
|
||||||
|
|
||||||
trigger.action.setMarkupText(section.tagID,text)
|
-- trigger.action.setMarkupText(section.tagID,text)
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
|
|
||||||
|
|
||||||
return time+repeatTime
|
return time+repeatTime
|
||||||
@@ -215,13 +218,11 @@ do
|
|||||||
local playerName = playerUnit:getPlayerName()
|
local playerName = playerUnit:getPlayerName()
|
||||||
if self.playerList[playerName] then
|
if self.playerList[playerName] then
|
||||||
if self.playerList[playerName].menu then
|
if self.playerList[playerName].menu then
|
||||||
Utils.Debug('removeMenu')
|
|
||||||
missionCommands.removeItemForGroup(groupID,self.playerList[playerName].menu)
|
missionCommands.removeItemForGroup(groupID,self.playerList[playerName].menu)
|
||||||
self.playerList[playerName].menu = nil
|
self.playerList[playerName].menu = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Utils.Debug('createMenu')
|
|
||||||
local MainMenuName = Localizations:translate('Range','cn')
|
local MainMenuName = Localizations:translate('Range','cn')
|
||||||
local menu = missionCommands.addSubMenuForGroup(groupID,MainMenuName)
|
local menu = missionCommands.addSubMenuForGroup(groupID,MainMenuName)
|
||||||
|
|
||||||
@@ -287,7 +288,7 @@ do
|
|||||||
if self.playerList[playerName].isTargerRedAlert then
|
if self.playerList[playerName].isTargerRedAlert then
|
||||||
switch = 'On'
|
switch = 'On'
|
||||||
end
|
end
|
||||||
Utils.Debug('switch: '..switch)
|
|
||||||
local SettingsMenuName = Localizations:translate('Settings','cn')
|
local SettingsMenuName = Localizations:translate('Settings','cn')
|
||||||
local SettingsMenu = missionCommands.addSubMenuForGroup(groupID,SettingsMenuName,menu)
|
local SettingsMenu = missionCommands.addSubMenuForGroup(groupID,SettingsMenuName,menu)
|
||||||
|
|
||||||
@@ -301,7 +302,6 @@ do
|
|||||||
if self.playerList[playerName].autoRespawn then
|
if self.playerList[playerName].autoRespawn then
|
||||||
switch = 'On'
|
switch = 'On'
|
||||||
end
|
end
|
||||||
Utils.Debug('switch: '..switch)
|
|
||||||
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
|
||||||
@@ -322,8 +322,6 @@ do
|
|||||||
local playerGroup = playerUnit:getGroup()
|
local playerGroup = playerUnit:getGroup()
|
||||||
if not playerGroup then return end
|
if not playerGroup then return end
|
||||||
|
|
||||||
Utils.Debug('createPlayerProfile')
|
|
||||||
|
|
||||||
self.playerList[PlayerName] = {
|
self.playerList[PlayerName] = {
|
||||||
group = playerGroup,
|
group = playerGroup,
|
||||||
groupID = playerGroup:getID(),
|
groupID = playerGroup:getID(),
|
||||||
@@ -357,15 +355,22 @@ do
|
|||||||
|
|
||||||
self:deactivateTargets(playerName)
|
self:deactivateTargets(playerName)
|
||||||
|
|
||||||
--Debug
|
--Send message
|
||||||
local isMove = 'Stationary'
|
local isMove = Localizations:translate('Stationary','cn')
|
||||||
if Move then
|
if Move then
|
||||||
isMove = 'Moving'
|
isMove = Localizations:translate('Moving','cn')
|
||||||
end
|
end
|
||||||
|
|
||||||
--Debug
|
local baseText = Localizations:translate('Spawn target at %s section area. targetType: %s state: %s','cn')
|
||||||
local tAAtype = AAType or 'None'
|
local tSectionType = Localizations:translate(sectionType,'cn')
|
||||||
Utils.Debug('section:'..sectionType..' targetType: '..targetType..' AAType: '..tAAtype..' Move: '..isMove)
|
local ttargetType = Localizations:translate(targetType,'cn')
|
||||||
|
local messageText = string.format(baseText,tSectionType,ttargetType,isMove)
|
||||||
|
if AAType then
|
||||||
|
baseText = Localizations:translate('Spawn target at %s section area. targetType: %s AAType: %s state: %s','cn')
|
||||||
|
local tAAtype = Localizations:translate(AAType,'cn')
|
||||||
|
messageText = string.format(baseText,tSectionType,ttargetType,tAAtype,isMove)
|
||||||
|
end
|
||||||
|
trigger.action.outTextForGroup(self.playerList[playerName].groupID,messageText,10)
|
||||||
|
|
||||||
--Get sectionZone
|
--Get sectionZone
|
||||||
local sectionZone = self.playerList[playerName].assignedSection or nil
|
local sectionZone = self.playerList[playerName].assignedSection or nil
|
||||||
@@ -377,7 +382,6 @@ do
|
|||||||
|
|
||||||
if not Move then
|
if not Move then
|
||||||
self.sections[sectionType][zoneNum].active = true
|
self.sections[sectionType][zoneNum].active = true
|
||||||
Utils.Debug('Active: '..self.sections[sectionType][zoneNum].name)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
break
|
break
|
||||||
@@ -391,7 +395,6 @@ do
|
|||||||
|
|
||||||
if not Move then
|
if not Move then
|
||||||
self.sections[sectionType][i].active = true
|
self.sections[sectionType][i].active = true
|
||||||
Utils.Debug('Active: '..self.sections[sectionType][i].name)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
break
|
break
|
||||||
@@ -412,7 +415,6 @@ do
|
|||||||
}
|
}
|
||||||
-- self.playerList[playerName].assignedSection = sectionZone.name
|
-- self.playerList[playerName].assignedSection = sectionZone.name
|
||||||
self.playerList[playerName].assignedSection = sectionZone
|
self.playerList[playerName].assignedSection = sectionZone
|
||||||
Utils.Debug('assignedSection: '..sectionZone.name)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--Get targets(typeNames)
|
--Get targets(typeNames)
|
||||||
@@ -426,7 +428,6 @@ do
|
|||||||
if AAType then
|
if AAType then
|
||||||
targetList = self.targetPresets[targetType][AAType]
|
targetList = self.targetPresets[targetType][AAType]
|
||||||
end
|
end
|
||||||
Utils.Debug('targetType: '..targetType)
|
|
||||||
|
|
||||||
for i=1,6,1 do
|
for i=1,6,1 do
|
||||||
local randomNum = math.random(1,#targetList)
|
local randomNum = math.random(1,#targetList)
|
||||||
@@ -459,7 +460,7 @@ do
|
|||||||
local spawnPoint = {}
|
local spawnPoint = {}
|
||||||
|
|
||||||
for i=1,100,1 do
|
for i=1,100,1 do
|
||||||
local tPoint = Utils.vecTranslate(centerPoint,tDir,math.random(10,150))
|
local tPoint = Utils.vecTranslate(centerPoint,tDir,math.random(10,500))
|
||||||
if Utils.pointInPolygon(tPoint,sectionZone.points) then
|
if Utils.pointInPolygon(tPoint,sectionZone.points) then
|
||||||
if land.getSurfaceType(tPoint) ~= land.SurfaceType.WATER or land.getSurfaceType(tPoint) ~= land.SurfaceType.SHALLOW_WATER then
|
if land.getSurfaceType(tPoint) ~= land.SurfaceType.WATER or land.getSurfaceType(tPoint) ~= land.SurfaceType.SHALLOW_WATER then
|
||||||
spawnPoint = tPoint
|
spawnPoint = tPoint
|
||||||
@@ -603,9 +604,6 @@ do
|
|||||||
AAtype = Range.AATypes.AAA
|
AAtype = Range.AATypes.AAA
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Utils.Debug('typeName: '..targetDesc['typeName'])
|
|
||||||
-- Utils.Debug(' AAtype: '..AAtype)
|
|
||||||
-- Utils.Debug(targetDesc.attributes)
|
|
||||||
|
|
||||||
self.targetPresets[targetType] = self.targetPresets[targetType] or {}
|
self.targetPresets[targetType] = self.targetPresets[targetType] or {}
|
||||||
self.targetPresets[targetType][AAtype] = self.targetPresets[targetType][AAtype] or {}
|
self.targetPresets[targetType][AAtype] = self.targetPresets[targetType][AAtype] or {}
|
||||||
@@ -714,14 +712,10 @@ do
|
|||||||
for i=1,20,1 do
|
for i=1,20,1 do
|
||||||
local unit = Unit.getByName('test-'..i..'-1')
|
local unit = Unit.getByName('test-'..i..'-1')
|
||||||
if unit then
|
if unit then
|
||||||
-- local desc = unit:getDesc()
|
|
||||||
-- Utils.Debug(desc['typeName']..' desc:')
|
|
||||||
-- Utils.Debug(desc.attributes)
|
|
||||||
range1:addTargetPreset(unit)
|
range1:addTargetPreset(unit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Utils.Debug(range1.targetPresets)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- local group = Group.getByName('Buta_target')
|
-- local group = Group.getByName('Buta_target')
|
||||||
|
|||||||
Reference in New Issue
Block a user