Skip to content

Commit

Permalink
Create a mission for every terrain to get Airbase.Wrapper data
Browse files Browse the repository at this point in the history
  • Loading branch information
kaltokri committed Feb 29, 2024
1 parent 1b2aef4 commit c7cb9ca
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 7 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
--
-- # 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!
--
Expand All @@ -18,22 +21,24 @@
-- 1. Start 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.
-- 4. The file airbase-normandy.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
-- 4. The file airbase-<terrain>.txt should be saved there and contain all needed data.
-- 5. This data can be used to replace the specific parts of Wrapper.Airbase.lua

-- Create a SET with all airbase of this map.
local bases = SET_AIRBASE:New():FilterOnce()

local Airbases1 = {}
local Airbases2 = {}

local terrainName = UTILS.GetDCSMap()

bases:ForEachAirbase(
function(afb)
local ab = afb -- Wrapper.Airbase#AIRBASE
local name = ab:GetName()
local nice = string.gsub(name,"([%s%c%p]+","_")
local text1 = string.format(' ["%s"] = "%s",',nice,name)
local text2 = string.format('-- * AIRBASE.Normandy.%s',nice)
local nice = string.gsub( name, "([%s%c%p]+", "_" )
local text1 = string.format( ' ["%s"] = "%s",', nice, name )
local text2 = string.format( '-- * AIRBASE.%s.%s', terrainName, nice )
MESSAGE:New(nice, 10):ToLog()
Airbases1[nice] = text1
Airbases2[nice] = text2
Expand All @@ -60,7 +65,7 @@ for _, k in ipairs(tkeys2) do
list2 = list2 .. Airbases2[k] .. "\n"
end

filename = lfs.writedir() ..[[Missions\airbase-normandy.txt]]
filename = lfs.writedir() .."Missions\\airbase-" .. terrainName .. ".txt"
filehandle = io.open( filename, "w")
filehandle:write(list1)
filehandle:write(list2)
Expand Down

0 comments on commit c7cb9ca

Please sign in to comment.