Jump to content

[41.73] [Singleplayer] |ClothingRecipesDefinitions["FabricType"]["Cotton"].tools = "Base.Scissors"| not working


zakarum

Recommended Posts

Alright, so ClothingRecipesDefinitions.lua
You can mod both Denim and Leather to require new tools (like Algol does with Advanced Gear as well as other mods). That works. But you cannot make standard, ripped-sheets-giving clothing require tools.

Even if you change the game's ClothingRecipesDefinitions.lua to

 

ClothingRecipesDefinitions = {};

ClothingRecipesDefinitions["Sheet"] = {materials="Base.RippedSheets:4" }
--ClothingRecipesDefinitions["Belt2"] = {materials="Base.LeatherStrips:1"}


ClothingRecipesDefinitions["FabricType"] = {}
ClothingRecipesDefinitions["FabricType"]["Cotton"] = {};
ClothingRecipesDefinitions["FabricType"]["Cotton"].material = "Base.RippedSheets";
ClothingRecipesDefinitions["FabricType"]["Cotton"].tools = "Base.Scissors";

ClothingRecipesDefinitions["FabricType"]["Denim"] = {};
ClothingRecipesDefinitions["FabricType"]["Denim"].material = "Base.DenimStrips";
ClothingRecipesDefinitions["FabricType"]["Denim"].tools = "Base.Scissors";
ClothingRecipesDefinitions["FabricType"]["Denim"].noSheetRope = true;

ClothingRecipesDefinitions["FabricType"]["Leather"] = {}
ClothingRecipesDefinitions["FabricType"]["Leather"].material = "Base.LeatherStrips";
ClothingRecipesDefinitions["FabricType"]["Leather"].tools = "Base.Scissors";
ClothingRecipesDefinitions["FabricType"]["Leather"].noSheetRope = true;


Clothing will still be "rip-able" without scissors. If you create a custom, like, TESTClothingRecipesDefinitions.lua and put in the exact same place in a custom mod, import everything and write it like:
 

require "Definitions/ClothingRecipesDefinitions"

ClothingRecipesDefinitions["FabricType"]["Cotton"].tools = {"Base.Scissors"}


It still doesn't work, while changing FabricType to Denim or Leather will make it so it works perfectly (for Denim/Leather clothes). But anyway, changing the vanilla ClothingRecipesDefinitions makes it for an easy and fast test of what I'm talking about. Meanwhile, ISInventoryPaneContextMenu.lua seems to check if a tool is needed
 

-- check if we need tools for this
    if clothing:getFabricType() and instanceof(clothing, "Clothing") then
        local option = context:addOption(getRecipeDisplayName("Rip clothing"), playerObj, ISInventoryPaneContextMenu.onRipClothing, items)
        -- Item is favourited, add tooltip
        if clothing:isFavorite() then
            local tooltip = ISInventoryPaneContextMenu.addToolTip();
            tooltip.description = getText("ContextMenu_CantRipFavourite");
            option.toolTip = tooltip;
        end
        -- Tool is needed
        local tools = ClothingRecipesDefinitions["FabricType"][clothing:getFabricType()].tools;
        if tools and not playerObj:getInventory():getItemFromType(tools, true, true) then
            option.notAvailable = true;
            local tooltip = ISInventoryPaneContextMenu.addToolTip();
            local toolItem = InventoryItemFactory.CreateItem(tools);
            tooltip.description = getText("ContextMenu_Require", toolItem:getDisplayName());
            option.toolTip = tooltip;
            return;
        end

 

However, it seems this check doesn't work with Cotton. So I'm stumped to what is going wrong, the only conclusion being that there's a bug in the code from ISInventoryPaneContextMenu when checking for tools.

Edited by zakarum
Link to comment
Share on other sites

  • zakarum changed the title to [41.73] [Singleplayer] |ClothingRecipesDefinitions["FabricType"]["Cotton"].tools = "Base.Scissors"| not working

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...