From 7711c644a0a9e08aedeb7daf65b3af6685c79207 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Sat, 31 May 2025 15:55:24 -0500 Subject: [PATCH] congif from .cell/cell.toml --- .cell/cell.toml | 7 +++++++ .gitignore | 2 +- scripts/engine.cm | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .cell/cell.toml diff --git a/.cell/cell.toml b/.cell/cell.toml new file mode 100644 index 00000000..1e16599f --- /dev/null +++ b/.cell/cell.toml @@ -0,0 +1,7 @@ +# Cell configuration + +# ENet service interval in seconds +ENETSERVICE = 0.05 + +# Reply timeout in seconds +REPLYTIMEOUT = 30 \ No newline at end of file diff --git a/.gitignore b/.gitignore index f7d575f3..296523d8 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,4 @@ icon.ico steam/ subprojects/*/ build_dbg/ -.cell +modules/ diff --git a/scripts/engine.cm b/scripts/engine.cm index 910264e4..b452d23b 100644 --- a/scripts/engine.cm +++ b/scripts/engine.cm @@ -232,6 +232,27 @@ globalThis.use = function use(file, ...args) { return ret } +var configPath = '.cell/cell.toml' +if (io.exists(configPath)) { + try { + var toml = use('toml') + var configText = io.slurp(configPath) + var config = toml.decode(configText) + + // Override defaults with config values + if (config.ENETSERVICE !== undefined) { + ENETSERVICE = config.ENETSERVICE + log.system(`Loaded ENETSERVICE from config: ${ENETSERVICE}`) + } + if (config.REPLYTIMEOUT !== undefined) { + REPLYTIMEOUT = config.REPLYTIMEOUT + log.system(`Loaded REPLYTIMEOUT from config: ${REPLYTIMEOUT}`) + } + } catch (err) { + log.error(`Failed to load config from ${configPath}: ${err}`) + } +} + globalThis.json = use('json') var time = use('time')