Merge branch 'develop' into faction_refactor

This commit is contained in:
Khopa
2020-10-21 19:51:25 +02:00
58 changed files with 8449 additions and 636 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,84 @@
# LUA Plugin system
This plugin system was made for injecting LUA scripts in dcs-liberation missions.
The resources for the plugins are stored in the `resources/plugins` folder ; each plugin has its own folder.
## How does the system work ?
The application first reads the `resources/plugins/plugins.json` file to get a list of plugins to load, in order.
Each entry in this list should correspond to a subfolder of the `resources/plugins` directory, where a `plugin.json` file exists.
This file is the description of the plugin.
### plugin.json
The *base* and *jtacautolase* plugins both are included in the standard dcs-liberation distribution.
You can check their respective `plugin.json` files to understand how they work.
Here's a quick rundown of the file's components :
- `mnemonic` : the short, technical name of the plugin. It's the name of the folder, and the name of the plugin in the application's settings
- `skipUI` : if *true*, this plugin will not appear in the plugins selection user interface. Useful to force a plugin ON or OFF (see the *base* plugin)
- `nameInUI` : the title of the plugin as it will appear in the plugins selection user interface.
- `defaultValue` : the selection value of the plugin, when first installed ; if true, plugin is selected.
- `specificOptions` : a list of specific plugin options
- `nameInUI` : the title of the option as it will appear in the plugins specific options user interface.
- `mnemonic` : the short, technical name of the option. It's the name of the LUA variable passed to the configuration script, and the name of the option in the application's settings
- `defaultValue` : the selection value of the option, when first installed ; if true, option is selected.
- `scriptsWorkOrders` : a list of work orders that can be used to load or disable loading a specific LUA script
- `file` : the name of the LUA file in the plugin folder.
- `mnemonic` : the technical name of the LUA component. The filename may be more precise than needed (e.g. include a version number) ; this is used to load each file only once, and also to disable loading a file
- `disable` : if true, the script will be disabled instead of loaded
- `configurationWorkOrders` : a list of work orders that can be used to load a configuration LUA script (same description as above)
## Standard plugins
### The *base* plugin
The *base* plugin contains the scripts that are going to be injected in every dcs-liberation missions.
It is mandatory.
### The *JTACAutolase* plugin
This plugin replaces the vanilla JTAC functionality in dcs-liberation.
### The *VEAF framework* plugin
When enabled, this plugin will inject and configure the VEAF Framework scripts in the mission.
These scripts add a lot of runtime functionalities :
- spawning of units and groups (and portable TACANs)
- air-to-ground missions
- air-to-air missions
- transport missions
- carrier operations (not Moose)
- tanker move
- weather and ATC
- shelling a zone, lighting it up
- managing assets (tankers, awacs, aircraft carriers) : getting info, state, respawning them if needed
- managing named points (position, info, ATC)
- managing a dynamic radio menu
- managing remote calls to the mission through NIOD (RPC) and SLMOD (LUA sockets)
- managing security (not allowing everyone to do every action)
- define groups templates
You can find the *VEAF Framework* plugin [on GitHub](https://github.com/VEAF/dcs-liberation-veaf-framework/releases)
For more information, please visit the [VEAF Framework documentation site](https://veaf.github.io/VEAF-Mission-Creation-Tools/) (work in progress)
## Custom plugins
The easiest way to create a custom plugin is to copy an existing plugin, and modify the files.
## New settings pages
![New settings pages](0.png "New settings pages")
Custom plugins can be enabled or disabled in the new *LUA Plugins* settings page.
![LUA Plugins settings page](1.png "LUA Plugins settings page")
For plugins which expose specific options (such as "use smoke" for the *JTACAutoLase* plugin), the *LUA Plugins Options* settings page lists these options.
![LUA Plugins Options settings page](2.png "LUA Plugins settings page")

View File

@@ -39,46 +39,54 @@ write_state = function()
-- messageAll("Done writing DCS Liberation state.")
end
debriefing_file_location = nil
if dcsLiberation then
debriefing_file_location = dcsLiberation.installPath
end
if debriefing_file_location then
logger:info("Using DCS Liberation install folder for state.json")
else
local function discoverDebriefingFilePath()
local function insertFileName(directoryOrFilePath, overrideFileName)
if overrideFileName then
logger:info("Using LIBERATION_EXPORT_STAMPED_STATE to locate the state.json")
return directoryOrFilePath .. os.time() .. "-state.json"
end
local filename = "state.json"
if not (directoryOrFilePath:sub(-#filename) == filename) then
return directoryOrFilePath .. filename
end
return directoryOrFilePath
end
-- establish a search pattern into the following modes
-- 1. Environment variable mode, to support dedicated server hosting
-- 2. Embedded DCS Liberation Generation, to support locally hosted single player
-- 3. Retain the classic TEMP directory logic
if os then
debriefing_file_location = os.getenv("LIBERATION_EXPORT_DIR")
if debriefing_file_location then debriefing_file_location = debriefing_file_location .. "\\" end
end
if debriefing_file_location then
logger:info("Using LIBERATION_EXPORT_DIR environment variable for state.json")
else
if os then
debriefing_file_location = os.getenv("TEMP")
if debriefing_file_location then debriefing_file_location = debriefing_file_location .. "\\" end
end
if debriefing_file_location then
logger:info("Using TEMP environment variable for state.json")
else
if lfs then
debriefing_file_location = lfs.writedir()
end
if debriefing_file_location then
logger:info("Using DCS working directory for state.json")
end
local exportDirectory = os.getenv("LIBERATION_EXPORT_DIR")
if exportDirectory then
logger:info("Using LIBERATION_EXPORT_DIR to locate the state.json")
local useCurrentStamping = os.getenv("LIBERATION_EXPORT_STAMPED_STATE")
exportDirectory = exportDirectory .. "\\"
return insertFileName(exportDirectory, useCurrentStamping)
end
end
end
if debriefing_file_location then
local filename = "state.json"
if not debriefing_file_location:sub(-#filename) == filename then
debriefing_file_location = debriefing_file_location .. filename
if dcsLiberation then
logger:info("Using DCS Liberation install folder for state.json")
return insertFileName(dcsLiberation.installPath)
end
if lfs then
logger:info("Using DCS working directory for state.json")
return insertFileName(lfs.writedir())
end
logger:info(string.format("DCS Liberation state will be written as json to [[%s]]",debriefing_file_location))
else
logger:error("No usable storage path for state.json")
end
debriefing_file_location = discoverDebriefingFilePath()
logger:info(string.format("DCS Liberation state will be written as json to [[%s]]",debriefing_file_location))
write_state_error_handling = function()
if pcall(write_state) then
-- messageAll("Written DCS Liberation state to "..debriefing_file_location)

View File

@@ -0,0 +1,22 @@
{
"mnemonic": "base",
"skipUI": true,
"nameInUI": "",
"defaultValue": true,
"specificOptions": [],
"scriptsWorkOrders": [
{
"file": "mist_4_3_74.lua",
"mnemonic": "mist"
},
{
"file": "json.lua",
"mnemonic": "json"
},
{
"file": "dcs_liberation.lua",
"mnemonic": "liberation"
}
],
"configurationWorkOrders": []
}

View File

@@ -0,0 +1,37 @@
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- configuration file for the JTAC Autolase framework
--
-- This configuration is tailored for a mission generated by DCS Liberation
-- see https://github.com/Khopa/dcs_liberation
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- JTACAutolase plugin - configuration
env.info("DCSLiberation|JTACAutolase plugin - configuration")
if dcsLiberation then
env.info(string.format("DCSLiberation|JTACAutolase plugin - dcsLiberation"))
-- specific options
local smoke = false
-- retrieve specific options values
if dcsLiberation.plugins then
env.info(string.format("DCSLiberation|JTACAutolase plugin - dcsLiberation.plugins"))
if dcsLiberation.plugins.jtacautolase then
env.info(string.format("DCSLiberation|JTACAutolase plugin - dcsLiberation.plugins.jtacautolase"))
smoke = dcsLiberation.plugins.jtacautolase.smoke
env.info(string.format("DCSLiberation|JTACAutolase plugin - smoke = %s",tostring(smoke)))
end
end
-- actual configuration code
for _, jtac in pairs(dcsLiberation.JTACs) do
env.info(string.format("DCSLiberation|JTACAutolase plugin - setting up %s",jtac.dcsUnit))
if JTACAutoLase then
env.info(string.format("DCSLiberation|JTACAutolase plugin - calling dcsLiberation.JTACAutoLase"))
JTACAutoLase(jtac.dcsUnit, jtac.laserCode, smoke, 'vehicle')
end
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
{
"mnemonic": "jtacautolase",
"nameInUI": "JTAC Autolase",
"defaultValue": true,
"specificOptions": [
{
"nameInUI": "Use smoke",
"mnemonic": "smoke",
"defaultValue": true
}
],
"scriptsWorkOrders": [
{
"file": "mist_4_3_74.lua",
"mnemonic": "mist"
},
{
"file": "JTACAutoLase.lua",
"mnemonic": "jtacautolase-script"
}
],
"configurationWorkOrders": [
{
"file": "jtacautolase-config.lua",
"mnemonic": "jtacautolase-config"
}
]
}

View File

@@ -0,0 +1,5 @@
[
"veaf",
"jtacautolase",
"base"
]

View File

@@ -1,29 +0,0 @@
# this is a list of lua scripts that will be injected in the mission, in the same order
mist.lua
Moose.lua
CTLD.lua
NIOD.lua
WeatherMark.lua
veaf.lua
dcsUnits.lua
# JTACAutoLase is an empty file, only there to disable loading the official script (already included in CTLD)
JTACAutoLase.lua
veafAssets.lua
veafCarrierOperations.lua
veafCarrierOperations2.lua
veafCasMission.lua
veafCombatMission.lua
veafCombatZone.lua
veafGrass.lua
veafInterpreter.lua
veafMarkers.lua
veafMove.lua
veafNamedPoints.lua
veafRadio.lua
veafRemote.lua
veafSecurity.lua
veafShortcuts.lua
veafSpawn.lua
veafTransportMission.lua
veafUnits.lua
missionConfig.lua

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB