Jump to content

Runtime Removal Of Recipe


FueledByOCHD

Recommended Posts

Hello all. I'm working on a mod which rearranges some of the crafting recipes as well changes the name of them.

I tried to impliment my own custom code but for some reason the changes are not working

So maybe someone here can tell me what i'm doing wrong, [Working with the latest stable build]
 

Here is the framework code for Recipes Please do not nag about naming convention of function. (I am a Self taught c# Developer)

 

[spoiler][code]

-- Recipies
Realms.Framework.Recipes={};
 
Realms.Framework.Recipes.Rename=function(name,newName)
    for i=0,allRecipes:size()-1 do
        local recipe=GetAll():get(i);
        if recipe.name==name then
            recipe.name=newName;
            break;
        end
    end
end
 
Realms.Framework.Recipes.Remove=function(name
    for i=0,allRecipes:size()-1 do
        local recipe=GetAll():get(i);
        if recipe.name==name then
            GetAll().remove(i);
            break;
        end
    end
end
 
Realms.Framework.Recipes.GetAll=function()
    return getAllRecipes();
end
[/code][/spoiler]

 

Now here is the useage of the code


[spoiler]

[code]

require "Realms/Realms"
require "Realms/Core"
 
if not Realms then
    Realms.Framework.Recipes.Remove("Make Four-Log Stack");
    Realms.Framework.Recipes.Remove("Make Three-Log Stack");
    Realms.Framework.Recipes.Remove("Make Two-Log Stack");
else
 
end
[/code]
[/spoiler]

 

Edited by FueledByOCHD
Link to comment
Share on other sites

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...