From c0e5f3d5fe780e4f05eba4839c1d19d819c98c63 Mon Sep 17 00:00:00 2001 From: mjkzy Date: Sun, 3 Jul 2022 11:43:10 -0500 Subject: [PATCH] frontend checks --- data/ui_scripts/custom_depot/__init__.lua | 24 +++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/data/ui_scripts/custom_depot/__init__.lua b/data/ui_scripts/custom_depot/__init__.lua index a0d4b9fa..763127a8 100644 --- a/data/ui_scripts/custom_depot/__init__.lua +++ b/data/ui_scripts/custom_depot/__init__.lua @@ -1,3 +1,7 @@ +if (game:issingleplayer() or not Engine.InFrontend()) then + return +end + custom_depot = { collection_details_menu = nil, data = { @@ -11,7 +15,7 @@ custom_depot = { items = {}, reward_splashes = {}, has_accepted_mod_eula = false, - has_seen_mod_eula = false, + has_seen_mod_eula = false }, directory_path = "h1-mod", file_name = "depot_save.json", @@ -48,11 +52,13 @@ custom_depot.functions["load_depot_data"] = function() end custom_depot.functions["add_currency"] = function(currency_type, amount) - custom_depot.data.currencies[tostring(currency_type)] = custom_depot.data.currencies[tostring(currency_type)] + amount + custom_depot.data.currencies[tostring(currency_type)] = custom_depot.data.currencies[tostring(currency_type)] + + amount end custom_depot.functions["remove_currency"] = function(currency_type, amount) - custom_depot.data.currencies[tostring(currency_type)] = custom_depot.data.currencies[tostring(currency_type)] - amount + custom_depot.data.currencies[tostring(currency_type)] = custom_depot.data.currencies[tostring(currency_type)] - + amount end custom_depot.functions["get_currency"] = function(currency_type) @@ -98,6 +104,12 @@ custom_depot.functions["set_has_seen_mod_eula"] = function(value) end custom_depot.get_function("load_depot_data")() -require("mod_eula") -require("depot_override") -require("scoreboard_override") + +if (Engine.InFrontend()) then + require("mod_eula") + require("depot_override") +end + +if (Engine.InFrontend() == false) then + require("scoreboard_override") +end