resetrecipes

Post Reply
User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

resetrecipes

Post 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)
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: resetrecipes

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

User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

Re: resetrecipes

Post 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?
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: resetrecipes

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

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: resetrecipes

Post 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.
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net

User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

Re: resetrecipes

Post 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
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: resetrecipes

Post 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)

User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

Re: resetrecipes

Post by Dysoch »

Thx, that is what i wanted to know ;)
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6

Post Reply

Return to “Implemented mod requests”