From 18a6d0c8314d6d3e24c2296e9e21b34d19651d57 Mon Sep 17 00:00:00 2001 From: Arwent Date: Sun, 3 Jul 2022 18:26:15 +0200 Subject: [PATCH] fix for embedded json, and move save to h1-mod folder --- data/ui_scripts/custom_depot/__init__.lua | 26 ++++++++----------- .../custom_depot/depot_override.lua | 2 -- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/data/ui_scripts/custom_depot/__init__.lua b/data/ui_scripts/custom_depot/__init__.lua index 42ad29d7..4e5f287f 100644 --- a/data/ui_scripts/custom_depot/__init__.lua +++ b/data/ui_scripts/custom_depot/__init__.lua @@ -1,28 +1,24 @@ -local json = require("dkjson") - custom_depot = { collection_details_menu = nil, data = { currencies = { - [1] = 0, -- LaunchCredits - [2] = 0, -- Credits - [3] = 0, -- Parts - [4] = 0, -- CoDPoints - [5] = 0 -- Bonus + ["1"] = 0, -- LaunchCredits + ["2"] = 0, -- Credits + ["3"] = 0, -- Parts + ["4"] = 0, -- CoDPoints + ["5"] = 0 -- Bonus }, items = {}, reward_splashes = {}, has_accepted_mod_eula = false, has_seen_mod_eula = false, }, - directory_path = "data/ui_scripts", + directory_path = "h1-mod", file_name = "depot_save.json", file_path = nil, - functions = {}, - mod_name = "custom_depot" + functions = {} } -custom_depot.directory_path = string.format("%s/%s", custom_depot.directory_path, custom_depot.mod_name) custom_depot.file_path = string.format("%s/%s", custom_depot.directory_path, custom_depot.file_name) custom_depot.get_function = function(function_name) @@ -52,19 +48,19 @@ custom_depot.functions["load_depot_data"] = function() end custom_depot.functions["add_currency"] = function(currency_type, amount) - custom_depot.data.currencies[currency_type] = custom_depot.data.currencies[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[currency_type] = custom_depot.data.currencies[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) - if not currency_type or not custom_depot.data.currencies[currency_type] then + if not currency_type or not custom_depot.data.currencies[tostring(currency_type)] then return nil end - return custom_depot.data.currencies[currency_type] + return custom_depot.data.currencies[tostring(currency_type)] end custom_depot.functions["add_item"] = function(item, value) diff --git a/data/ui_scripts/custom_depot/depot_override.lua b/data/ui_scripts/custom_depot/depot_override.lua index 9f74f651..88073ff3 100644 --- a/data/ui_scripts/custom_depot/depot_override.lua +++ b/data/ui_scripts/custom_depot/depot_override.lua @@ -211,8 +211,6 @@ MPDepotOpenLootMenu = function(unk1, unk2) .SuppyDropLootStream[unk2.crateType]].lootTableColName) local random_item = items_list[math.random(#items_list)] - print(random_item.inventoryItemType ~= Cac.InventoryItemType.Loot) - print(random_item.inventoryItemType) while random_item.inventoryItemType ~= Cac.InventoryItemType.Loot do random_item = items_list[math.random(#items_list)] end