From 53e8d7456dcfe7e7b68ad5296cb5de0d579cf1cb Mon Sep 17 00:00:00 2001 From: Pao Date: Sat, 14 Jan 2023 01:55:57 +0100 Subject: [PATCH] Adding ModOptions --- media/lua/client/TOC_ClientOptions.lua | 14 ++++++++++++++ media/lua/client/TOC_main.lua | 2 +- media/lua/server/TOC_ServerOptions.lua | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 media/lua/client/TOC_ClientOptions.lua create mode 100644 media/lua/server/TOC_ServerOptions.lua diff --git a/media/lua/client/TOC_ClientOptions.lua b/media/lua/client/TOC_ClientOptions.lua new file mode 100644 index 0000000..68b80e1 --- /dev/null +++ b/media/lua/client/TOC_ClientOptions.lua @@ -0,0 +1,14 @@ +--Default options. +local options = { + box1 = true, + box2 = false +} + +-- Connecting the options to the menu, so user can change them. +if ModOptions and ModOptions.getInstance then + ModOptions:getInstance(options, "Amputation2", "The Only Cure but better") +end + +--Make a link +TOC_Options = {} +TOC_Options = options \ No newline at end of file diff --git a/media/lua/client/TOC_main.lua b/media/lua/client/TOC_main.lua index 2c0ee8d..e51f5e8 100644 --- a/media/lua/client/TOC_main.lua +++ b/media/lua/client/TOC_main.lua @@ -116,7 +116,7 @@ function TheOnlyCure.DeclareTraits() TraitFactory.setMutualExclusive("amputee2", "amputee3") end - +-- ModOptions implement it you cuck diff --git a/media/lua/server/TOC_ServerOptions.lua b/media/lua/server/TOC_ServerOptions.lua new file mode 100644 index 0000000..92e1edb --- /dev/null +++ b/media/lua/server/TOC_ServerOptions.lua @@ -0,0 +1,9 @@ +local options = TOC_Options + +-- Check actual options at game loading. +Events.OnGameStart.Add(function() + if not isClient() then -- only host may take these options + print("checkbox1 = ", options.box1) + print("checkbox2 = ", options.box2) + end +end) \ No newline at end of file