From d0b957de5576c274100d5bcc39b78a00ddc0abe2 Mon Sep 17 00:00:00 2001 From: dutchie032 Date: Wed, 9 Oct 2024 13:30:30 +0200 Subject: [PATCH] started config stuff --- SpearheadConfig.lua | 2 -- classes/configuration/CapConfig.lua | 41 +++++++++++++++++++++++++++++ config.lua | 40 ++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) delete mode 100644 SpearheadConfig.lua create mode 100644 classes/configuration/CapConfig.lua create mode 100644 config.lua diff --git a/SpearheadConfig.lua b/SpearheadConfig.lua deleted file mode 100644 index b2771f1..0000000 --- a/SpearheadConfig.lua +++ /dev/null @@ -1,2 +0,0 @@ ----KEEP THIS LINE -if not SpearheadConfig then SpearheadConfig = {} end diff --git a/classes/configuration/CapConfig.lua b/classes/configuration/CapConfig.lua new file mode 100644 index 0000000..be34256 --- /dev/null +++ b/classes/configuration/CapConfig.lua @@ -0,0 +1,41 @@ + + +local CapConfig = {}; +function CapConfig:new() + local o = {} + setmetatable(o, { __index = self }) + + if SpearheadConfig == nil then SpearheadConfig = {} end + if SpearheadConfig.CapConfig == nil then SpearheadConfig.CapConfig = {} end + + local enabled = SpearheadConfig.CapConfig.enabled or true + ---@return boolean + o.isEnabled = function() return enabled == true end + + local minSpeed = tonumber(SpearheadConfig.CapConfig.minSpeed) or 400 + ---@return number + o.getMinSpeed = function() return minSpeed end + + local maxSpeed = tonumber(SpearheadConfig.CapConfig.maxSpeed) or 400 + ---@return number + o.getMaxSpeed = function() return maxSpeed end + + local minAlt = tonumber(SpearheadConfig.CapConfig.minAlt) or 18000 + ---@return number + o.getMinAlt = function() return minAlt end + + local maxAlt = tonumber(SpearheadConfig.CapConfig.maxAlt) or 28000 + ---@return number + o.getMaxAlt = function() return maxAlt end + + local rearmDelay = tonumber(SpearheadConfig.CapConfig.rearmDelay) or 600 + ---@return number + o.getRearmDelay = function() return rearmDelay end + + local deathDelay = tonumber(SpearheadConfig.CapConfig.deathDelay) or 1800 + ---@return number + o.getDeathDelay = function() return deathDelay end + + return o; +end +Spearhead.internal.configuration.CapConfig = CapConfig; \ No newline at end of file diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..968a166 --- /dev/null +++ b/config.lua @@ -0,0 +1,40 @@ + +SpearheadConfig = { + + CapConfig = { + --quickly enable of disable the entire CAP Logic + --(you can also just rename all units to not be named "CAP_") + enabled = true, + + --min ground speed for CAP aircraft during patrol + -- unit: knots + minSpeed = 400, + + --max speed for CAP aircraft during patrol + -- unit: knots + maxSpeed = 500, + + --minAlt for aircraft on patrol + -- unit: feet + minAlt = 18000, + + --maxAlt for aircraft on patrol + -- unit: feet + maxAlt = 28000, + + --Delay for aircraft from touchdown to off the chocks. + -- unit: seconds + rearmDelay = 600, + + --Delay for aircraft from death to takeoff. + --When the seconds remaining is the same at the rearmDelay it will be spawned on the ramp and follow the rearm logic. + -- !! Can not be lower than rearmDelay + -- unit: seconds + deathDelay = 1800, + }, + + StageConfig = { + -- currently no configurable options + } +} +