Jump to content

Recommended Posts

I have this code:

local specialtyfoods =
{
	sweetpotatosouffle =
	{
		test = function(cooker, names, tags) return (names.carrot and names.carrot == 2) and tags.egg and tags.egg >= 2 end,
		priority = 30,
		foodtype = FOODTYPE.VEGGIE,
		health = TUNING.HEALING_MED,
		hunger = TUNING.CALORIES_LARGE,
		perishtime = TUNING.PERISH_MED,
		sanity = TUNING.SANITY_MED,
		cooktime = 2,
	},
}

Then I use this code to add recipe:

for k,v in pairs(specialtyfoods) do
	v.name = k
	v.weight = v.weight or 1
	v.priority = v.priority or 0
	AddCookerRecipe("portablecookpot", v)
end

But the code above not work, if I want it to work I must change "portablecookpot" to "cookpot". But this code below works:

local foods = require("preparedfoods")
for k,recipe in pairs (foods) do
	AddCookerRecipe("portablecookpot", recipe)
end

So any ideas? Thanks you.

Edited by zUsername
On 29. 2. 2016 at 6:21 AM, zUsername said:

But the code above not work, if I want it to work I must change "portablecookpot" to "cookpot".

I haven't tried to add custom recipes or custom cookpot, so I have no idea what could possibly go wrong.

Could you be more specific what is not working? Is it crashing at some point? Is the cooker not producing according to recipes?

All my testing was done using sweetpotatosouffle (i.e. 2*carrot+2*egg) on locally hosted game.

With enabled SmarterCrockpot mod, the result was indeed not as expected (ratatouille). With disabled SmartCrockpot mod, the result was sweetpotatosouffle.

Following advice in

, I have renamed stuff in sweetpotatosouffle.scml (which I got from anim/sweetpotatosouffle.zip using krane tool) - all symbol0 to sweetpotatosouffle, plus renamed files and folders as appropriate (I guess not all of them need to be named the same, I just didn't experiment which ones are needed). The cooked sweetpotatosouffle did appear on the portablecookpot, although it was not centered; I guess the pivot point will have to be moved.

There was also another issue: loading the game with cooked sweetpotatosouffle left on the cooker, the image was not visible, because the loading of the cooker was executed before the games started (i.e. before mod's GamePostInit), thus recipe was not yet added. Moving AddCookerRecipes out of recipepostinit fixed that.

Edited by Muche
56 minutes ago, Muche said:

All my testing was done using sweetpotatosouffle (i.e. 2*carrot+2*egg) on locally hosted game.

With enabled SmarterCrockpot mod, the result was indeed not as expected (ratatouille). With disabled SmartCrockpot mod, the result was sweetpotatosouffle.

Following advice in

, I have renamed stuff in sweetpotatosouffle.scml (which I got from anim/sweetpotatosouffle.zip using krane tool) - all symbol0 to sweetpotatosouffle, plus renamed files and folders as appropriate (I guess not all of them need to be named the same, I just didn't experiment which ones are needed). The cooked sweetpotatosouffle did appear on the portablecookpot, although it was not centered; I guess the pivot point will have to be moved.

There was also another issue: loading the game with cooked sweetpotatosouffle left on the cooker, the image was not visible, because the loading of the cooker was executed before the games started (i.e. before mod's GamePostInit), thus recipe was not yet added. Moving AddCookerRecipes out of recipepostinit fixed that.

How to I change symbol0 to food name? I'm open sweetpotatosouffle.scml with Spriter and I can't find symbol0. Or I have to change symbol0 in anim.bin and build.bin with hex editor??

Edited by zUsername
Just now, Muche said:

I did use Spriter to change the pivot point. I haven't yet learned how to use it properly, so I did renaming directly in the scml file.

 

Found it. Thanks you very much. I'll try now and feedback you later.

1 hour ago, SenL said:

When you fixed/figured this out, can you post a quick "how to" or tutorial?

I tried myself awhile back and couldn't get it -- same issue: it's invisible etc.

Thanks.

Open ,scml file with Notepad++  then look for what I did "--this" . Make sure it same name.

<?xml version="1.0" encoding="UTF-8"?>
<spriter_data scml_version="1.0" generator="BrashMonkey Spriter" generator_version="b5">
    <folder id="0" name="freshfruitcrepes"> -- this
        <file id="0" name="freshfruitcrepes-0.png" width="200" height="116" pivot_x="0.541248" pivot_y="0.509918"/>
    </folder>
    <entity id="0" name="freshfruitcrepes"> -- this
        <animation id="0" name="idle" length="34">
            <mainline>
                <key id="0" time="0">
                    <object_ref id="0" name="freshfruitcrepes" folder="0" file="0" abs_x="0" abs_y="0" abs_pivot_x="0.541248" abs_pivot_y="0.509918" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="0" z_index="1"/> --this
                </key>
            </mainline>
            <timeline id="0" name="freshfruitcrepes"> --this
                <key id="0" time="0" spin="1">
					<object folder="0" file="0" x="2" y="4.799" scale_x="1" scale_y="1" angle="0" />
                </key>
            </timeline>
        </animation>
    </entity>
</spriter_data>

 

2 hours ago, Muche said:

I did use Spriter to change the pivot point. I haven't yet learned how to use it properly, so I did renaming directly in the scml file.

With your help everything work fine for now but I'm have also another issue. If I use: AddCookerRecipe("cookpot", sweetpotatosouffle_recipe). Food on Portable Cookpot will invisible and the Food on Cookpot will visible. Any ideas? @Muche

[DST]Warly.rar

I didn't see anything unusual.

With warly_recipes option set to No the cookpot produced sweetpotatosouffle and it was visible on cookpot (and invisible on portablecookpot, if left on it previously).

With warly_recipes option set to Yes the portablecookpot produced sweetpotatosouffle and it was visible on portablecookpot (and invisible on cookpot, if left on it previously).

Using AddCookerRecipe in modmain adds the recipe for specified cooker and marks the recipe as mod recipe, so prefabs/cookpot.lua|ShowProduct function can distinguish between core and mod recipes.

Edited by Muche
16 hours ago, Muche said:

I didn't see anything unusual.

With warly_recipes option set to No the cookpot produced sweetpotatosouffle and it was visible on cookpot (and invisible on portablecookpot, if left on it previously).

With warly_recipes option set to Yes the portablecookpot produced sweetpotatosouffle and it was visible on portablecookpot (and invisible on cookpot, if left on it previously).

Using AddCookerRecipe in modmain adds the recipe for specified cooker and marks the recipe as mod recipe, so prefabs/cookpot.lua|ShowProduct function can distinguish between core and mod recipes.

Really thanks you @Muche

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