Create a mission for every terrain to get Airbase.Wrapper data

This commit is contained in:
kaltokri 2024-02-29 10:20:07 +01:00
parent 1b2aef4224
commit c7cb9ca869
9 changed files with 12 additions and 7 deletions

View File

@ -9,7 +9,10 @@
-- --
-- # Description: -- # Description:
-- --
-- This mission can be used to create data for the Wrapper.Airbase class. -- This script can be used to create data for the Wrapper.Airbase class.
-- Create an empty mission with the terrain you want the data for.
-- Add Moose and this script.
-- Or use one of the already created missions in this folder.
-- --
-- NOTE: io & lfs must be desanitized for this mission to work! -- NOTE: io & lfs must be desanitized for this mission to work!
-- --
@ -18,8 +21,8 @@
-- 1. Start the mission. -- 1. Start the mission.
-- 2. When you see the message "Wrapper.Airbase data written..." you can quit the mission. -- 2. When you see the message "Wrapper.Airbase data written..." you can quit the mission.
-- 3. Open your "Saved Games\DCS\Missions" folder. -- 3. Open your "Saved Games\DCS\Missions" folder.
-- 4. The file airbase-normandy.txt should be saved there and contain all needed data. -- 4. The file airbase-<terrain>.txt should be saved there and contain all needed data.
-- 5. This date can be used to replace the specific parts of Wrapper.Airbase.lua -- 5. This data can be used to replace the specific parts of Wrapper.Airbase.lua
-- Create a SET with all airbase of this map. -- Create a SET with all airbase of this map.
local bases = SET_AIRBASE:New():FilterOnce() local bases = SET_AIRBASE:New():FilterOnce()
@ -27,13 +30,15 @@ local bases = SET_AIRBASE:New():FilterOnce()
local Airbases1 = {} local Airbases1 = {}
local Airbases2 = {} local Airbases2 = {}
local terrainName = UTILS.GetDCSMap()
bases:ForEachAirbase( bases:ForEachAirbase(
function(afb) function(afb)
local ab = afb -- Wrapper.Airbase#AIRBASE local ab = afb -- Wrapper.Airbase#AIRBASE
local name = ab:GetName() local name = ab:GetName()
local nice = string.gsub(name,"([%s%c%p]+","_") local nice = string.gsub( name, "([%s%c%p]+", "_" )
local text1 = string.format(' ["%s"] = "%s",',nice,name) local text1 = string.format( ' ["%s"] = "%s",', nice, name )
local text2 = string.format('-- * AIRBASE.Normandy.%s',nice) local text2 = string.format( '-- * AIRBASE.%s.%s', terrainName, nice )
MESSAGE:New(nice, 10):ToLog() MESSAGE:New(nice, 10):ToLog()
Airbases1[nice] = text1 Airbases1[nice] = text1
Airbases2[nice] = text2 Airbases2[nice] = text2
@ -60,7 +65,7 @@ for _, k in ipairs(tkeys2) do
list2 = list2 .. Airbases2[k] .. "\n" list2 = list2 .. Airbases2[k] .. "\n"
end end
filename = lfs.writedir() ..[[Missions\airbase-normandy.txt]] filename = lfs.writedir() .."Missions\\airbase-" .. terrainName .. ".txt"
filehandle = io.open( filename, "w") filehandle = io.open( filename, "w")
filehandle:write(list1) filehandle:write(list1)
filehandle:write(list2) filehandle:write(list2)