From 187b9be57a627f08a4c85c27410100094c7a6e42 Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Fri, 8 Dec 2023 11:54:12 +0100 Subject: [PATCH] Added ability to add mods --- .../bundle.js.tmp-browserify-38414992840504180727 | 0 scripts/OlympusCommand.lua | 10 ++++++++-- scripts/mods.lua | 11 +++++++++++ src/core/src/core.cpp | 3 +++ src/core/src/scriptloader.cpp | 1 + 5 files changed, 23 insertions(+), 2 deletions(-) delete mode 100644 client/public/javascripts/bundle.js.tmp-browserify-38414992840504180727 create mode 100644 scripts/mods.lua diff --git a/client/public/javascripts/bundle.js.tmp-browserify-38414992840504180727 b/client/public/javascripts/bundle.js.tmp-browserify-38414992840504180727 deleted file mode 100644 index e69de29b..00000000 diff --git a/scripts/OlympusCommand.lua b/scripts/OlympusCommand.lua index 85dccfb8..f68c67e6 100644 --- a/scripts/OlympusCommand.lua +++ b/scripts/OlympusCommand.lua @@ -984,10 +984,16 @@ function Olympus.setUnitsData(arg, time) table["category"] = "GroundUnit" elseif unit:getDesc().category == Unit.Category.SHIP then table["category"] = "NavyUnit" + elseif Olympus.modsList ~= nil and Olympus.modsList[unit:getDesc().typeName] ~= nil then + table["category"] = Olympus.modsList[unit:getDesc().typeName] end else - units[ID] = {isAlive = false} - Olympus.units[ID] = nil + if Olympus.modsList ~= nil and Olympus.modsList[unit:getDesc().typeName] ~= nil then + table["category"] = Olympus.modsList[unit:getDesc().typeName] + else + units[ID] = {isAlive = false} + Olympus.units[ID] = nil + end end -- If the category is handled by Olympus, get the data diff --git a/scripts/mods.lua b/scripts/mods.lua new file mode 100644 index 00000000..4107733b --- /dev/null +++ b/scripts/mods.lua @@ -0,0 +1,11 @@ +-- Enter here any mods required by your mission as in the example below. +-- Possible categories are: +-- Aircraft +-- Helicopter +-- GroundUnit +-- NavyUnit + +Olympus.modsList = { + ["A-4E-C"] = "Aircraft", + ["Bronco-OV-10A"] = "Aircraft" +} diff --git a/src/core/src/core.cpp b/src/core/src/core.cpp index cf31da84..bb669de1 100644 --- a/src/core/src/core.cpp +++ b/src/core/src/core.cpp @@ -59,6 +59,9 @@ extern "C" DllExport int coreInit(lua_State* L, const char* path) log("Initializing core.dll with instance path " + instancePath); sessionHash = random_string(16); + + log("Random session hash " + sessionHash); + unitsManager = new UnitsManager(L); weaponsManager = new WeaponsManager(L); server = new Server(L); diff --git a/src/core/src/scriptloader.cpp b/src/core/src/scriptloader.cpp index aefc793e..9b6b713f 100644 --- a/src/core/src/scriptloader.cpp +++ b/src/core/src/scriptloader.cpp @@ -42,4 +42,5 @@ void registerLuaFunctions(lua_State* L) executeLuaScript(L, instancePath + "..\\Scripts\\OlympusCommand.lua"); executeLuaScript(L, instancePath + "..\\Scripts\\unitPayloads.lua"); executeLuaScript(L, instancePath + "..\\Scripts\\templates.lua"); + executeLuaScript(L, instancePath + "..\\Scripts\\mods.lua"); }