Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3a391f883 |
@@ -1,3 +1,6 @@
|
|||||||
# DCS_Jet_Spawner
|
# DCS_Jet_Spawner
|
||||||
|
|
||||||
A simple dynamic plane spawner mostly aim for MP server, but can alse run as single player.
|
A simple dynamic plane spawner mostly aim for MP server, but can alse run as single player.
|
||||||
|
|
||||||
|
### 这个是狸猫服-秘密花园(高加索)专用JetSpawner
|
||||||
|
- 添加了敌机刷新音效 & 玩家死亡音效
|
||||||
+89
-16
@@ -6,31 +6,77 @@ jetSpawner = {
|
|||||||
-------------------------------------
|
-------------------------------------
|
||||||
-- 配置参数区 --
|
-- 配置参数区 --
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
version = '0.0.3',
|
version = '0.0.4',
|
||||||
|
|
||||||
DebugMode = true, -- 调试模式开关
|
DebugMode = false, -- 调试模式开关
|
||||||
|
|
||||||
|
PlaySound = true,
|
||||||
|
SoundFilePathEnemy = 'Sound/enemy/',
|
||||||
|
SoundFilePathPlayer = 'Sound/ally/',
|
||||||
|
EnemySpawnSFX = {
|
||||||
|
'enemy_1',
|
||||||
|
'enemy_2',
|
||||||
|
'enemy_3',
|
||||||
|
'enemy_4',
|
||||||
|
'enemy_5',
|
||||||
|
},
|
||||||
|
PlayerKilledSFX = {
|
||||||
|
'ally_1',
|
||||||
|
'ally_2',
|
||||||
|
'ally_3',
|
||||||
|
'ally_4',
|
||||||
|
'ally_5',
|
||||||
|
'ally_6',
|
||||||
|
'ally_7',
|
||||||
|
'ally_8',
|
||||||
|
'ally_9',
|
||||||
|
'ally_10',
|
||||||
|
},
|
||||||
|
|
||||||
-- 定义预设红方飞机群组
|
-- 定义预设红方飞机群组
|
||||||
jetPresets = {
|
jetPresets = {
|
||||||
{
|
{
|
||||||
categoryName = 'fighters_light', -- 飞机类型预设
|
categoryName = '1', -- 飞机类型预设
|
||||||
groups = {'Aerial-1','Aerial-2','Aerial-4'}, -- 预设的群组名, 每次刷新随机抽取
|
groups = {'1-2','2-2','3-2','4-2','5-2','6-2','7-2','8-2','9-2','10-2','11-2','12-2','13-2','14-2','15-2','16-2'}, -- 预设的群组名, 每次刷新随机抽取
|
||||||
baseTime = 60, -- 基础刷新时间
|
baseTime = 909, -- 基础刷新时间
|
||||||
maxSpawn = 6, -- 最大数量限制, 暂未使用
|
maxSpawn = 1, -- 最大数量限制, 设置为 >0 的数视为启用, 设置为 <=0 的数或者 nil/false 视为不启用.
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
categoryName = 'fighters_heavy',
|
categoryName = '2',
|
||||||
groups = {'Aerial-3','Aerial-5'},
|
groups = {'1-3','2-3','3-3','4-3','5-3','6-3','7-3','8-3','9-3','10-3','11-3','12-3','13-3','14-3','15-3','16-3'},
|
||||||
baseTime = 60,
|
baseTime = 1824,
|
||||||
maxSpawn = 6,
|
maxSpawn = 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
categoryName = 'AWACS',
|
categoryName = '3',
|
||||||
groups = {'Aerial-6','Aerial-7'},
|
groups = {'1-4','2-4','3-4','4-4','5-4','6-4','7-4','8-4','9-4','10-4','11-4','12-4','13-4','14-4','15-4','16-4'},
|
||||||
baseTime = 90,
|
baseTime = 1430,
|
||||||
|
maxSpawn = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
categoryName = '4',
|
||||||
|
groups = {'1-5','2-5','3-5','4-5','5-5','6-5','7-5','8-5','9-5','10-5','11-5','12-5','13-5','14-5','15-5','16-5'},
|
||||||
|
baseTime = 1879,
|
||||||
maxSpawn = 2,
|
maxSpawn = 2,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
categoryName = '5',
|
||||||
|
groups = {'1-6','2-6','3-6','4-6','5-6','6-6','7-6','8-6','9-6','10-6','11-6','12-6','13-6','14-6','15-6','16-6'},
|
||||||
|
baseTime = 2346,
|
||||||
|
maxSpawn = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
categoryName = '6',
|
||||||
|
groups = {'1-7','2-7','3-7','4-7','5-7','6-7','7-7','8-7','9-7','10-7','11-7','12-7','13-7','14-7','15-7','16-7'},
|
||||||
|
baseTime = 2878,
|
||||||
|
maxSpawn = 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
categoryName = '7',
|
||||||
|
groups = {'1-8','2-8','3-8','4-8','5-8','6-8','7-8','8-8','9-8','10-8','11-8','12-8','13-8','14-8','15-8','16-8'},
|
||||||
|
baseTime = 2010,
|
||||||
|
maxSpawn = 1,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- 根据玩家调整刷新率
|
-- 根据玩家调整刷新率
|
||||||
@@ -88,12 +134,15 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 获取红方机预设
|
-- 获取红方机预设
|
||||||
local red_jets = env.mission.coalition.red.country[1].plane.group
|
local red_jets = env.mission.coalition.red.country
|
||||||
for i, presetData in ipairs(jetSpawner.jetPresets) do
|
for i, presetData in ipairs(jetSpawner.jetPresets) do
|
||||||
jetSpawner.jetTemplate[presetData.categoryName] = jetSpawner.jetTemplate[presetData.categoryName] or {}
|
jetSpawner.jetTemplate[presetData.categoryName] = jetSpawner.jetTemplate[presetData.categoryName] or {}
|
||||||
for j, groupName in ipairs(presetData.groups) do
|
for j, groupName in ipairs(presetData.groups) do
|
||||||
for k, groupData in ipairs(red_jets) do
|
local found = false
|
||||||
|
for k, countryData in ipairs(red_jets) do
|
||||||
|
for n, groupData in ipairs(countryData.plane.group) do
|
||||||
if groupData.name == groupName then
|
if groupData.name == groupName then
|
||||||
|
found = true
|
||||||
local tempData = deepCopy(groupData)
|
local tempData = deepCopy(groupData)
|
||||||
tempData.lateActivation = false
|
tempData.lateActivation = false
|
||||||
-- 直接以群组名为键存储
|
-- 直接以群组名为键存储
|
||||||
@@ -101,6 +150,11 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if not found then
|
||||||
|
Debug("Group not found: " .. groupName)
|
||||||
|
env.error('jetSpawner: '.. groupName .. ' not found in mission!')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 更新玩家数量
|
-- 更新玩家数量
|
||||||
@@ -123,6 +177,14 @@ do
|
|||||||
self.playerList[playerName] = nil
|
self.playerList[playerName] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--播放音频
|
||||||
|
if self.PlaySound then
|
||||||
|
local soundfile = self.SoundFilePathPlayer..self.PlayerKilledSFX[math.random(1,#self.PlayerKilledSFX)]..'.ogg'
|
||||||
|
-- trigger.action.outSound(soundfile)
|
||||||
|
trigger.action.outSoundForCoalition(coalition.side.BLUE,soundfile)
|
||||||
|
Debug('PlaySound - Player soundfile: '..soundfile)
|
||||||
|
end
|
||||||
|
|
||||||
--Debug
|
--Debug
|
||||||
if not event then return end
|
if not event then return end
|
||||||
local eventTable = {
|
local eventTable = {
|
||||||
@@ -251,6 +313,14 @@ do
|
|||||||
self.spawnedGroups[preset.categoryName] = self.spawnedGroups[preset.categoryName] or {}
|
self.spawnedGroups[preset.categoryName] = self.spawnedGroups[preset.categoryName] or {}
|
||||||
self.spawnedGroups[preset.categoryName][newGroupName] = self.spawnedGroups[preset.categoryName][newGroupName] or {}
|
self.spawnedGroups[preset.categoryName][newGroupName] = self.spawnedGroups[preset.categoryName][newGroupName] or {}
|
||||||
self.spawnedGroups[preset.categoryName][newGroupName][spawnGroupData.name] = newGroup
|
self.spawnedGroups[preset.categoryName][newGroupName][spawnGroupData.name] = newGroup
|
||||||
|
|
||||||
|
--播放音频
|
||||||
|
if self.PlaySound then
|
||||||
|
local soundfile = self.SoundFilePathEnemy..self.EnemySpawnSFX[math.random(1,#self.EnemySpawnSFX)]..'.ogg'
|
||||||
|
-- trigger.action.outSound(soundfile)
|
||||||
|
trigger.action.outSoundForCoalition(coalition.side.BLUE,soundfile)
|
||||||
|
Debug('PlaySound - Enemy soundfile: '..soundfile)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -321,5 +391,8 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Author: Buta
|
-- Author: Buta
|
||||||
-- Date: 2025-03-02
|
-- Date: 2025-03-02
|
||||||
Reference in New Issue
Block a user