Page 1 of 1

resetrecipes

Posted: Fri Dec 27, 2013 9:37 am
by Dysoch
is there anyway to make game.player.force.resetrecipes() with random result_count recipes?

something like:

Code: Select all

  {
    type = "recipe",
    name = "recycling-base-003",
	category = "recycling",
    energy_required = 15,
    ingredients =
    {
      {"steel-plate", 1},
    },
    result = "scrapmetal",
	result_count = math.random(5)
  },
where resetrecipes() would reset the recipes and the math.random(5) (it currently doesnt)

Re: resetrecipes

Posted: Fri Dec 27, 2013 9:41 am
by kovarex
Currently not, we will extend recipes to allow this, but don't use random in the data files definition it is not forbidden now, but it will be in the future.

Re: resetrecipes

Posted: Fri Dec 27, 2013 9:48 am
by Dysoch
kovarex wrote:Currently not, we will extend recipes to allow this, but don't use random in the data files definition it is not forbidden now, but it will be in the future.
Anyway way around math.random? Or are you making a definition for that?

Re: resetrecipes

Posted: Fri Dec 27, 2013 9:56 am
by kovarex
Don't know what do you mean by that, in normal game (script) math.random uses game.random internally and is deterministic. But in data files there should be no randomness, so no way around as well. It doesn't make sense to have random in data files. Not only it is not deterministic, but you can change the value by closing the game and starting it again.

Re: resetrecipes

Posted: Fri Dec 27, 2013 10:01 am
by FreeER
I think he meant will you make it possible to have random outputs through the definitions, like spawner/loot, since math.random will be unavailable.

Re: resetrecipes

Posted: Fri Dec 27, 2013 10:06 am
by Dysoch
FreeER wrote:I think he meant will you make it possible to have random outputs through the definitions, like spawner/loot, since math.random will be unavailable.
right on the dollar :P
it would be simpler with a function like the spawner. that way you can specify everything more accurate the the math.random

Re: resetrecipes

Posted: Fri Dec 27, 2013 10:14 am
by kovarex
Dysoch wrote:
FreeER wrote:I think he meant will you make it possible to have random outputs through the definitions, like spawner/loot, since math.random will be unavailable.
right on the dollar :P
it would be simpler with a function like the spawner. that way you can specify everything more accurate the the math.random
Yes, if you mean randomised result of the recipe, or more results, yes we plan it for 0.9 (as well as recipe containing liquids as inputs/outputs as well)

Re: resetrecipes

Posted: Fri Dec 27, 2013 10:17 am
by Dysoch
Thx, that is what i wanted to know ;)