DiRten Posted November 11, 2021 Share Posted November 11, 2021 (edited) I have trouble. My mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2583221769 My mod changes the nubmer of slots for backpack and boxes. A bug appeared, when I change the slots of the backpack, then regardless of other backpacks, icepack changes the slots too. I create checker in console, my code change only backpack prefab, but slots icepack change too. Even if I assign my number of slots to it, it still changes the slots to the number of backpack slots. Other backpacks are not affected by this bug. My code: MODINFO: Spoiler name = "Customize Everything(TEST)" description = "Customize storage and items" author = "DiRten" forumthread = "" version = "2.92" api_version = 10 priority = 0.00001 dont_starve_compatible = false reign_of_giants_compatible = false dst_compatible = true all_clients_require_mod = true server_only_mod = true server_filter_tags = {"configurablestorage"} icon_atlas = "preview.xml" icon = "preview.tex" russian = ("").utf8len and (russian or language == "ru") local pack_options = { {description = "6", data = 6}, {description = "8", data = 8}, {description = "10", data = 10}, {description = "12", data = 12}, {description = "14", data = 14}, {description = "16", data = 16}, {description = "18", data = 18}, } local storage_options = { {description = "9", data = 9}, {description = "12", data = 12}, {description = "16", data = 16}, {description = "20", data = 20}, {description = "24", data = 24}, } local perish_options = { {description = "0", data = 0}, {description = "0.1", data = 0.1}, {description = "0.2", data = 0.2}, {description = "0.25", data = 0.25}, {description = "0.3", data = 0.3}, {description = "0.4", data = 0.4}, {description = "0.5", data = 0.5}, {description = "0.6", data = 0.6}, {description = "0.7", data = 0.7}, {description = "0.75", data = 0.75}, {description = "0.8", data = 0.8}, {description = "0.9", data = 0.9}, {description = "1", data = 1}, {description = "1.1", data = 1.1}, {description = "1.2", data = 1.2}, {description = "1.25", data = 1.25}, {description = "1.3", data = 1.3}, {description = "1.4", data = 1.4}, {description = "1.5", data = 1.5}, {description = "1.6", data = 1.6}, {description = "1.7", data = 1.7}, {description = "1.75", data = 1.75}, {description = "1.8", data = 1.8}, {description = "1.9", data = 1.9}, {description = "2", data = 2}, } local bool_options = { {description = "false", data = false}, {description = "true", data = true}, } local uses_options = { {description = "1", data = 1}, {description = "2", data = 2}, {description = "3", data = 3}, {description = "4", data = 4}, {description = "5", data = 5}, {description = "6", data = 6}, {description = "7", data = 7}, {description = "8", data = 8}, {description = "9", data = 9}, {description = "10", data = 10}, {description = "20", data = 20}, {description = "30", data = 30}, {description = "40", data = 40}, {description = "50", data = 50}, {description = "60", data = 60}, {description = "70", data = 70}, {description = "80", data = 80}, {description = "90", data = 90}, {description = "100", data = 100}, {description = "max(1M)", data = 1000000}, } local speed_options = { {description = "0%", data = 1}, {description = "5%", data = 1.05}, {description = "10%", data = 1.1}, {description = "15%", data = 1.15}, {description = "20%", data = 1.2}, {description = "25%", data = 1.25}, {description = "30%", data = 1.3}, {description = "35%", data = 1.35}, {description = "40%", data = 1.4}, {description = "45%", data = 1.45}, {description = "50%", data = 1.5}, {description = "55%", data = 1.55}, {description = "60%", data = 1.6}, {description = "65%", data = 1.65}, {description = "70%", data = 1.7}, {description = "75%", data = 1.75}, {description = "80%", data = 1.8}, {description = "85%", data = 1.85}, {description = "90%", data = 1.9}, {description = "95%", data = 1.95}, {description = "100%", data = 2}, } ---Customize local empty_options = {{description = "", data = 0 }} local function Title(title,hover) return { name = "", label = title, hover=hover, options = empty_options, default = 0, } end SPACE = Title("") configuration_options = { Title("Packs slots:", "Change packs slots and perish mult:"), -------PACKS { name = "BackpackSlotMax", label = russian and "Рюкзак" or "Backpack", options = pack_options, default = 8, }, { name = "PiggybackSlotMax", label = russian and "Свиной мешок" or "Piggyback", options = pack_options, default = 12, }, { name = "KrampussackSlotMax", label = russian and "Мешок Крампуса" or "Krampus Sack", options = pack_options, default = 14, }, { name = "IcepackSlotMax", label = russian and "Терморюкзак" or "Insulation Pack", options = pack_options, default = 8, }, { name = "SpicepackSlotMax", label = russian and "Сумка шеф-повара" or "Chef Pouch", options = pack_options, default = 6, }, { name = "SeedpouchSlotMax", label = russian and "Рюкзак для семян" or "Seed Pack-It", options = pack_options, default = 14, }, SPACE, Title("Packs perish:", "Change perish packs"), ----------------------PACKS PERISH { name = "BackpackPerish", label = russian and "Рюкзак" or "Backpack", options = perish_options, default = 1, }, { name = "PiggybackPerish", label = russian and "Свиной Мешок" or "Piggyback", options = perish_options, default = 1, }, { name = "KrampussackPerish", label = russian and "Мешок Крампуса" or "Krampus Sack", options = perish_options, default = 1, }, { name = "SpicepackPerish", label = russian and "Сумка шеф-повара" or "Chef Pouch", options = perish_options, default = 0.75, }, { name = "SeedpouchPerish", label = russian and "Сумка семян" or "Seed Pack-It", options = perish_options, default = 1, }, SPACE, Title("Packs put in inventory:", "Take packs in inventory."), -----------------------PACKS CANGO { name = "BackpackCango", label = russian and "Рюкзак" or "Backpack", options = bool_options, default = false, }, { name = "PiggybackCango", label = russian and "Свиной Мешок" or "Piggyback", options = bool_options, default = false, }, { name = "KrampussackCango", label = russian and "Мешок Крампуса" or "Krampus Sack", options = bool_options, default = false, }, { name = "IcepackCango", label = russian and "Терморюкзак" or "Icepack", options = bool_options, default = false, }, { name = "SpicepackCango", label = russian and "Сумка шеф-повара" or "Chef Pouch", options = bool_options, default = false, }, { name = "SeedpouchCango", label = russian and "Сумка семян" or "Seed Pack-It", options = bool_options, default = false, }, { name = "CandybagCango", label = russian and "Мешочек сладостей" or "Candy Bag", options = bool_options, default = false, }, SPACE, Title("Storage slots:", "Change storage slots."), ------------------------STORAGE { name = "ChestSlotMax", label = russian and "Сундук" or "Chest", options = storage_options, default = 9, }, { name = "IceboxSlotMax", label = russian and "Холодильник" or "Icebox", options = storage_options, default = 9, }, { name = "SaltboxSlotMax", label = russian and "Cоляной ящик" or "Saltbox", options = storage_options, default = 9, }, { name = "DragonflychestSlotMax", label = russian and "Чешуйчатый сундук" or "Dragonfly Chest", options = storage_options, default = 12, }, { name = "BundleSlotMax", label = russian and "Упаковочная обёртка" or "Bundling Wrap", options = { {description = "4(default)", data = 4}, {description = "9", data = 9}, {description = "12", data = 12}, {description = "16", data = 16}, {description = "20", data = 20}, {description = "24", data = 24}, }, default = 4, }, SPACE, Title("Storage perish:", "Change perish in storage."), -------------------STORAGE PERISH { name = "ChestPerish", label = russian and "Сундук" or "Chest", options = perish_options, default = 1, }, { name = "IceboxPerish", label = russian and "Холодильник и Терморюкзак" or "Icebox and Icepack", options = perish_options, default = 0.5, }, { name = "SaltboxPerish", label = russian and "Соляной ящик" or "Saltbox", options = perish_options, default = 0.25, }, { name = "DragonflyPerish", label = russian and "Чешуйчатый сундук" or "Dragonfly Chest", options = perish_options, default = 1, }, SPACE, Title("Custom options:"), --------------------------------------------------------CUSTOM OPTIONS --Sisturn { name = "SisturnPerish", label = russian and "Множитель гниения(Урна Сестры)" or "Perish multiplier(Sisturn)", options = perish_options, default = 1, }, --Temp stone infinity { name = "HeatrockTemperatureInfinityChange", label = russian and "Термальный камень бесконечный?" or "Thermal Stone Infinity?", options = bool_options, default = false, }, SPACE, Title("Count uses items:", "Change uses count."), ----------------------------------------------------COUNT USES ITEMS --Count uses items --Tent { name = "TentUsesCount", label = russian and "Палатка" or "Tent", options = uses_options, default = 6, }, --Siesta { name = "SiestaUsesCount", label = russian and "Сиеста" or "Siesta", options = uses_options, default = 6, }, --Portable tent { name = "PortableTentUsesCount", label = russian and "Портативной Палатка" or "Portable Tent", options = uses_options, default = 10, }, --Trap { name = "TrapUsesCount", label = russian and "Ловушка" or "Trap", options = uses_options, default = 8, }, --Trap teeth { name = "TrapTeethUsesCount", label = russian and "Клыкастая Ловушка" or "Tooth Trap", options = uses_options, default = 10, }, --Trap bramble { name = "TrapBrambleUsesCount", label = russian and "Еживичная ловушка" or "Trap Bramble", options = uses_options, default = 10, }, --Fishingrod { name = "FishingrodUsesCount", label = russian and "Удочка" or "Fishingrod", options = uses_options, default = 9, }, --Bugnet { name = "BugnetUsesCount", label = russian and "Сачок" or "Bugnet", options = uses_options, default = 10, }, --Umbrella { name = "UmbrellaUsesCount", label = russian and "Зонтик" or "Umbrella", options = uses_options, default = 20, }, SPACE, Title("Items add movespeed:", "Adding movespeed."), --------------------------------------------ITEMS MOVESPEED --Speed Mult --Cane { name = "CaneSpeedMult", label = russian and "Скорость Трости+" or "Walking cane", options = speed_options, default = 1.25, }, --Googleshat { name = "GoggleshatMult", label = russian and "Модные очки скорость+" or "Fashion goggles", options = speed_options, default = 1, }, --Garland { name = "FlowerhatMult", label = russian and "Венок скорость+" or "Garland", options = speed_options, default = 1, }, --Raincoat { name = "RaincoatMult", label = russian and "Дождевик скорость+" or "Raincoat", options = speed_options, default = 1, }, --YellowamuletMult { name = "YellowamuletMult", label = russian and "Магосвет скорость+" or "Magiluminescence", options = speed_options, default = 1, }, --Lazy Explorer { name = "OrangestaffMult", label = russian and "Ленивый исследователь скорость+" or "Lazy Explorer", options = speed_options, default = 1, }, SPACE, Title("Floor add road speed:", "Adding movespeed on floor."), -----------------------------------FLOORS --Wood Floor { name = "WoodFloorChange", label = russian and "Деревянный пол скорость дороги" or "Wood Floor", options = bool_options, default = false, }, --Carpet Floor { name = "CarpetFloorChange", label = russian and "Ковер скорость дороги" or "Carpet Floor", options = bool_options, default = false, }, --Checker Floor { name = "CheckerFloorChange", label = russian and "Мраморный пол скорость дороги" or "Checker Floor", options = bool_options, default = false, }, SPACE, Title("Add craftable items:", "Adding new recipe."), { name = "MandrakeCraftable", label = russian and "Мандрагора" or "Mandrake", hover = "1 Carrot, 2 Telltale Heart, 10 Nightmare Fuel -Magic(Magic three)", options = bool_options, default = false, }, { name = "KrampusSackCraftable", label = russian and "Мешок Крампуса" or "Krampus Sack", hover = "5 Silk, 5 Pigskin, 5 Nightmarefuel -Magic(Magic three)", options = bool_options, default = false, }, { name = "DugBerryBushCraftable", label = russian and "Ягодный куст" or "Berry Bush", hover = "10 Juice Berry Bush, 10 Sanity(x10) -Farm(Science two)", options = bool_options, default = false, }, { name = "DugBerryBushJuicyCraftable", label = russian and "Куст сочных ягод" or "Juicy Berry Bush", hover = "10 Berry Bush, 10 Sanity(x10) -Farm(Science two)", options = bool_options, default = false, }, { name = "DugSaplingCraftable", label = russian and "Саженец" or "Dug Sapling", hover = "10 Twiggy Nut, 10 Sanity(x10) -Farm(Science two)", options = bool_options, default = false, }, { name = "TwiggyNutCraftable", label = russian and "Орех ветвистого дерева" or "Twiggy Nut", hover = "10 Sapling, 10 Sanity(x10) -Farm(Science two)", options = bool_options, default = false, }, } MODMAIN: Spoiler --Make Global local require = GLOBAL.require local Vector3 = GLOBAL.Vector3 local net_entity = GLOBAL.net_entity --Require local containers = require("containers") Assets = { Asset("ATLAS", "images/container.xml"), Asset("ATLAS", "images/container_x20.xml"), Asset("ATLAS", "images/krampus_sack_bg.xml"), } --CHECK RUSSIAN _G = GLOBAL mods =_G.rawget(_G,"mods")or(function()local m={}_G.rawset(_G,"mods",m)return m end)() rus = mods.RussianLanguagePack or mods.UniversalTranslator RegisterRussianName = rus and (rus.SelectedLanguage=="ru") and (rus.RegisterRussianName or rus.RegisterNameTranslation) --Lists change local CustomListContainer = { --{"TYPE", SLOTMAX, "ANIMBANK", "ANIMBUILD", {X, Y, Z}, {Y1, Y2, Y3, X1, X2}, {X, X*, X+, Y, Y*, Y+}, {X, X_MODIF_, X_PLUS, Y, Y_MODIF, Y_PLUS, 0}, BG_ATLAS_IMAGE, BG_IMAGE, {BG_IMAGE_TINT_1, BG_IMAGE_TINT_2 ,BG_IMAGE_TINT_3 ,BG_IMAGE_TINT_4}}, {"pack", 6, "ui_icepack_2x3", "ui_icepack_2x3", { -5, -70, 0}, { 0, 2, 1, 0, 0}, {-162, 1, 0, 1, -75, 75 }, {-162, 1, 75, 1, -75, 75, 0}}, {"pack", 8, "ui_backpack_2x4", "ui_backpack_2x4", { -5, -70, 0}, { 0, 3, 1, 0, 0}, {-162, 1, 0, 1, -75, 114 }, {-162, 1, 75, 1, -75, 114, 0}}, {"pack", 10, "ui_krampusbag_2x5", "ui_krampusbag_2x5", { -5, -70, 0}, { 0, 4, 1, 0, 0}, {-162, 1, 0, 1, -75, 115 }, {-162, 1, 75, 1, -75, 115, 0}}, {"pack", 12, "ui_piggyback_2x6", "ui_piggyback_2x6", { -5, -70, 0}, { 0, 5, 1, 0, 0}, {-162, 1, 0, 1, -75, 170 }, {-162, 1, 75, 1, -75, 170, 0}}, {"pack", 14, "ui_krampusbag_2x8", "ui_krampusbag_2x8", { -5, -120, 0}, { 0, 6, 1, 0, 0}, {-162, 1, 0, 1, -75, 240 }, {-162, 1, 75, 1, -75, 240, 0}}, {"pack", 16, "ui_krampusbag_2x8", "ui_krampusbag_2x8", { -5, -50, 0}, { 0, 7, 1, 0, 0}, {-162, 1, 0, 1, -65, 245 }, {-162, 1, 75, 1, -65, 245, 0}}, {"pack", 18, nil, nil, {-76, -70, 0}, { 0, 8, 1, 0, 0}, { -37, 1, 0, 1, -75, 300 }, { -37, 1, 75, 1, -75, 300, 0}, "images/krampus_sack_bg.xml", "krampus_sack_bg.tex"}, {"storage", 9, "ui_chest_3x3", "ui_chest_3x3", { 0, -141, 0}, { 2, 0, -1, 0, 2}, { 1, 80, -80, 1, 80, -80}}, {"storage", 12, "ui_chester_shadow_3x4", "ui_chester_shadow_3x4", { 0, -177, 0}, {2.5, -0.5, -1, 0, 2}, { 1, 75, -75, 1, 75, -75}}, {"storage", 16, nil, nil, { 0, -185, 0}, { 3, 0, -1, 0, 3}, { 1, 80, -120, 1, 80, -120}, nil, "images/container.xml", "container.tex"}, {"storage", 20, nil, nil, { 5, -184, 0}, { 3, 0, -1, 0, 4}, { 1, 75, -150, 1, 75, -110}, nil, "images/container_x20.xml", "container_x20.tex"}, {"storage", 24, nil, nil, { 5 , -184, 0}, { 3, 0, -1, 0, 5}, { 1, 65, -163, 1, 80, -122}, nil, "images/container_x20.xml", "container_x20.tex"} } local ChangeListStorage = { {"backpack", "pack", 8, GetModConfigData("BackpackSlotMax")}, {"piggyback", "pack", 12, GetModConfigData("PiggybackSlotMax")}, {"krampus_sack", "pack", 14, GetModConfigData("KrampussackSlotMax")}, {"icepack", "pack", 8, GetModConfigData("IcepackSlotMax")}, {"spicepack", "pack", 6, GetModConfigData("SpicepackSlotMax")}, {"seedpouch", "pack", 14, GetModConfigData("SeedpouchSlotMax")}, {"treasurechest", "storage", 9, GetModConfigData("ChestSlotMax")}, {"icebox", "storage", 9, GetModConfigData("IceboxSlotMax")}, {"saltbox", "storage", 9, GetModConfigData("SaltboxSlotMax")}, {"dragonflychest", "storage", 12, GetModConfigData("DragonflychestSlotMax")}, {"bundle_container", "storage", 4, GetModConfigData("BundleSlotMax"), "Bundle"} } local ChangeListItems = { {"backpack", "cango", GetModConfigData("BackpackCango")}, {"piggyback", "cango", GetModConfigData("PiggybackCango")}, {"krampus_sack", "cango", GetModConfigData("KrampussackCango")}, {"icepack", "cango", GetModConfigData("IcepackCango")}, {"spicepack", "cango", GetModConfigData("SpicepackCango")}, {"seedpouch", "cango", GetModConfigData("SeedpouchCango")}, {"candybag", "cango", GetModConfigData("CandybagCango")}, {"backpack", "preserver", GetModConfigData("BackpackPerish")}, {"piggyback", "preserver", GetModConfigData("PiggybackPerish")}, {"krampus_sack", "preserver", GetModConfigData("KrampussackPerish")}, {"seedpouch", "preserver", GetModConfigData("SeedpouchPerish")}, {"treasurechest", "preserver", GetModConfigData("ChestPerish")}, {"dragonflychest", "preserver", GetModConfigData("DragonflyPerish")}, {"sisturn", "preserver", GetModConfigData("SisturnPerish")}, {"heatrock", "nofuel", GetModConfigData("HeatrockTemperatureInfinityChange")}, {"flowerhat", "speed", GetModConfigData("FlowerhatMult")}, {"goggleshat", "speed", GetModConfigData("GoggleshatMult")}, {"raincoat", "speed", GetModConfigData("RaincoatMult")}, {"yellowamulet", "speed", GetModConfigData("YellowamuletMult")}, {"orangestaff", "speed", GetModConfigData("OrangestaffMult")}, {"PERISH_FRIDGE_MULT", "tuning", GetModConfigData("IceboxPerish")}, {"PERISH_SALTBOX_MULT", "tuning", GetModConfigData("SaltboxPerish")}, {"PERISH_FOOD_PRESERVER_MULT", "tuning", GetModConfigData("SpicepackPerish")}, {"TENT_USES", "tuning", GetModConfigData("TentUsesCount")}, {"SIESTA_CANOPY_USES", "tuning", GetModConfigData("SiestaUsesCount")}, {"PORTABLE_TENT_USES", "tuning", GetModConfigData("PortableTentUsesCount")}, {"TRAP_USES", "tuning", GetModConfigData("TrapUsesCount")}, {"TRAP_TEETH_USES", "tuning", GetModConfigData("TrapTeethUsesCount")}, {"TRAP_BRAMBLE_USES", "tuning", GetModConfigData("TrapBrambleUsesCount")}, {"FISHINGROD_USES", "tuning", GetModConfigData("FishingrodUsesCount")}, {"BUGNET_USES", "tuning", GetModConfigData("BugnetUsesCount")}, {"UMBRELLA_USES", "tuning", GetModConfigData("UmbrellaUsesCount")}, {"CANE_SPEED_MULT", "tuning", GetModConfigData("CaneSpeedMult")}, {"WOODFLOOR", "floor", GetModConfigData("WoodFloorChange")}, {"CARPET", "floor", GetModConfigData("CarpetFloorChange")}, {"CHECKER", "floor", GetModConfigData("CheckerFloorChange")}, {"mandrake", "recipe", GetModConfigData("MandrakeCraftable"), "MANDRAKE", "A little love will revive anyone.", "Немного любви может оживить любого.", {GLOBAL.Ingredient("carrot", 1), GLOBAL.Ingredient("reviver", 2), GLOBAL.Ingredient("nightmarefuel", 10)}, "MAGIC", "MAGIC_THREE", 1}, {"krampus_sack", "recipe", GetModConfigData("KrampusSackCraftable"), "KRAMPUS_SACK", "Tired of looking? Just do it!", "Устали искать? Просто сделай это!", {GLOBAL.Ingredient("nightmarefuel", 5), GLOBAL.Ingredient("pigskin", 5), GLOBAL.Ingredient("silk", 5)}, "MAGIC", "MAGIC_THREE", 1}, {"dug_berrybush", "recipe", GetModConfigData("DugBerryBushCraftable"), "DUG_BERRYBUSH", "Reduce your mind for gardening!", "Когда вы устали искать альтернативы.", {GLOBAL.Ingredient("dug_berrybush_juicy", 10), GLOBAL.Ingredient(GLOBAL.CHARACTER_INGREDIENT.SANITY, 10)}, "FARM", "SCIENCE_TWO", 10}, {"dug_berrybush_juicy", "recipe", GetModConfigData("DugBerryBushJuicyCraftable"), "DUG_BERRYBUSH_JUICY", "Reduce your mind for gardening!", "Когда вы устали искать альтернативы.", {GLOBAL.Ingredient("dug_berrybush", 10), GLOBAL.Ingredient(GLOBAL.CHARACTER_INGREDIENT.SANITY, 10)}, "FARM", "SCIENCE_TWO", 10}, {"dug_sapling", "recipe", GetModConfigData("DugSaplingCraftable"), "DUG_SAPLING", "Reduce your mind for gardening!", "Когда вы устали искать альтернативы.", {GLOBAL.Ingredient("twiggy_nut", 10), GLOBAL.Ingredient(GLOBAL.CHARACTER_INGREDIENT.SANITY, 10)}, "FARM", "SCIENCE_TWO", 10}, {"twiggy_nut", "recipe", GetModConfigData("TwiggyNutCraftable"), "TWIGGY_NUT", "Reduce your mind for gardening!", "Когда вы устали искать альтернативы.", {GLOBAL.Ingredient("dug_sapling", 10), GLOBAL.Ingredient(GLOBAL.CHARACTER_INGREDIENT.SANITY, 10)}, "FARM", "SCIENCE_TWO", 10} } --Add slots containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, 24) local function addItemSlotNetvarsInContainer(inst) if(#inst._itemspool < containers.MAXITEMSLOTS) then for i = #inst._itemspool+1, containers.MAXITEMSLOTS do table.insert(inst._itemspool, net_entity(inst.GUID, "container._items["..tostring(i).."]", "items["..tostring(i).."]dirty")) end end end AddPrefabPostInit("container_classified", addItemSlotNetvarsInContainer) --Change containers local widgetsetup_Base = containers.widgetsetup or function() return true end function containers.widgetsetup(container, prefab, data, ...) local tempPrefab = prefab or container.inst.prefab local result = widgetsetup_Base(container, prefab, data, ...) function NewCustomContainers(Type, SlotMax, Custom) container.widget.slotpos = {} GLOBAL.removesetter(container, "numslots") container.numslots = SlotMax for i = 1, #CustomListContainer, 1 do if (Type == CustomListContainer[i][1] and SlotMax == CustomListContainer[i][2] and CustomListContainer[i][3] ~= nil) then container.widget.animbank = CustomListContainer[i][3] container.widget.animbuild = CustomListContainer[i][4] elseif (Type == CustomListContainer[i][1] and SlotMax == CustomListContainer[i][2] and CustomListContainer[i][3] == nil) then container.widget.animbank = nil container.widget.animbuild = nil container.widget.bgatlas = CustomListContainer[i][9] container.widget.bgimage = CustomListContainer[i][10] end if (Type == CustomListContainer[i][1] and CustomListContainer[i][1] == "pack" and SlotMax == CustomListContainer[i][2]) then container.widget.pos = Vector3(CustomListContainer[i][5][1], CustomListContainer[i][5][2], CustomListContainer[i][5][3]) for y = CustomListContainer[i][6][1], CustomListContainer[i][6][2], CustomListContainer[i][6][3] do table.insert(container.widget.slotpos, Vector3(CustomListContainer[i][7][1] * CustomListContainer[i][7][2] + CustomListContainer[i][7][3], y * CustomListContainer[i][7][4] * CustomListContainer[i][7][5] + CustomListContainer[i][7][6],0)) table.insert(container.widget.slotpos, Vector3(CustomListContainer[i][8][1] * CustomListContainer[i][8][2] + CustomListContainer[i][8][3], y * CustomListContainer[i][8][4] * CustomListContainer[i][8][5] + CustomListContainer[i][8][6],0)) end elseif (Type == CustomListContainer[i][1] and CustomListContainer[i][1] == "storage" and SlotMax == CustomListContainer[i][2]) then if (Custom == "Bundle") then container.widget.buttoninfo.position = Vector3(CustomListContainer[i][5][1], CustomListContainer[i][5][2], CustomListContainer[i][5][3]) end if (CustomListContainer[i][3] ~= nil) then container.widget.bgimagetint = {r=.82,g=.77,b=.7,a=1} end for y = CustomListContainer[i][6][1], CustomListContainer[i][6][2], CustomListContainer[i][6][3] do for x = CustomListContainer[i][6][4], CustomListContainer[i][6][5] do table.insert(container.widget.slotpos, Vector3(x * CustomListContainer[i][7][1] * CustomListContainer[i][7][2] + CustomListContainer[i][7][3], y * CustomListContainer[i][7][4] * CustomListContainer[i][7][5] + CustomListContainer[i][7][6], 0)) end end end end container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0) end for i = 1, #ChangeListStorage, 1 do if (tempPrefab == ChangeListStorage[i][1] and ChangeListStorage[i][3] ~= ChangeListStorage[i][4]) then print(tempPrefab) NewCustomContainers(ChangeListStorage[i][2], ChangeListStorage[i][4], ChangeListStorage[i][5]) end end return result end --Change items local function Changer(CurrentList) --tuning if CurrentList[2] == "tuning" then TUNING[CurrentList[1]] = CurrentList[3] --Preserver elseif (CurrentList[2] == "preserver" and CurrentList[3] ~= 1) then AddPrefabPostInit( CurrentList[1], function(inst) if GLOBAL.TheWorld.ismastersim then inst:AddComponent("preserver") inst.components.preserver:SetPerishRateMultiplier(CurrentList[3]) end end) --Cango elseif (CurrentList[2] == "cango" and CurrentList[3]) then AddPrefabPostInit( CurrentList[1], function(inst) if GLOBAL.TheWorld.ismastersim then inst.components.inventoryitem.cangoincontainer = true end end) --Nofuel elseif (CurrentList[2] == "nofuel" and CurrentList[3]) then local old_TemperatureChange local old_heatrock_fn local function new_TemperatureChange(inst, data) inst.components.fueled = { GetPercent = function() return 1 end, SetPercent = function() end, } old_TemperatureChange(inst, data) inst.components.fueled = nil end local function new_heatrock_fn(inst) if GLOBAL.TheWorld.ismastersim then inst:RemoveComponent("fueled") local function switchListenerFns(t) local listeners = t["temperaturedelta"] local listener_fns = listeners[inst] old_TemperatureChange = listener_fns[1] listener_fns[1] = new_TemperatureChange end switchListenerFns(inst.event_listeners) switchListenerFns(inst.event_listening) end end AddPrefabPostInit(CurrentList[1], new_heatrock_fn) --Speed elseif CurrentList[2] == "speed" then if CurrentList[3] ~= 1 then AddPrefabPostInit( CurrentList[1], function(inst) if GLOBAL.TheWorld.ismastersim then inst.components.equippable.walkspeedmult = CurrentList[3] end end) end --Floor elseif CurrentList[2] == "floor" then AddPlayerPostInit(function(inst) if (inst.components.locomotor and CurrentList[3]) then inst.components.locomotor:SetFasterOnGroundTile(GROUND[CurrentList[1]], true) end end) elseif (CurrentList[2] == "recipe" and CurrentList[3] == true) then Recipe = AddRecipe STRINGS = GLOBAL.STRINGS RECIPETABS = GLOBAL.RECIPETABS TECH = GLOBAL.TECH CHARACTER_INGREDIENT_SEG = GLOBAL.CHARACTER_INGREDIENT_SEG STRINGS.RECIPE_DESC[CurrentList[4]] = CurrentList[5] if RegisterRussianName then STRINGS.RECIPE_DESC[CurrentList[4]] = CurrentList[6] end AddRecipe(CurrentList[1], CurrentList[7], RECIPETABS[CurrentList[8]], TECH[CurrentList[9]], nil, nil, nil, CurrentList[10]) end end for i = 1, #ChangeListItems, 1 do Changer(ChangeListItems[i]) end Edited November 11, 2021 by DiRten Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now