LuaEntity result

Things that we aren't going to implement
Post Reply
Simcra
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Wed Apr 06, 2016 6:05 am
Contact:

LuaEntity result

Post by Simcra »

It is not impossible to make a mod determine what would be dropped by an entity when it was mined, see here: https://github.com/Simcra/Surfaces/blob ... l.lua#L110
This would be useful as a function of LuaEntity as I'm not entirely sure if this is equivalent to how it is done in the game engine. I use this function to gather the result of an entity so that it may be placed on the ground if invalidated by my entity pairing system.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13217
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: LuaEntity result

Post by Rseding91 »

First off, this does absolutely nothing - Factorio uses a deterministic random generator and calling the lua seed functions is just ignored. All RNG comes from the Factorio generator and will be based off the map seed and how many previous calls to generate random numbers have been done up to that point.

Code: Select all

math.rerandomize(api.game.tick()) -- calls math.randomseed to ensure truly random results from randomizer
Secondly, there's no way to tell what you will get when mining an entity until you actually mine it because of possible RNG with the results. The game doesn't know it and there's no programmatic way to know it without calling the RNG to actually get the results which means you've already mined it.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Won't implement”