Code: Select all
for k, v in pairs(data.raw.resource) do
data.raw.resource[k].infinite = true
data.raw.resource[k].minimum = 100
data.raw.resource[k].normal = 100
end
Code: Select all
data.raw.resource[k].maximum = 100
Code: Select all
for k, v in pairs(data.raw.resource) do
data.raw.resource[k].infinite = true
data.raw.resource[k].minimum = 100
data.raw.resource[k].normal = 100
end
Code: Select all
data.raw.resource[k].maximum = 100
As far as I know, there is no field called resource.maximum. I just tried it and it didn't change anything Is it possible to prevent depletion of resources without activating the infinite mode?BlueTemplar wrote: ↑Thu Aug 15, 2019 5:41 pm Well, that's a short mod !Have you tied addingCode: Select all
for k, v in pairs(data.raw.resource) do data.raw.resource[k].infinite = true data.raw.resource[k].minimum = 100 data.raw.resource[k].normal = 100 end
?Code: Select all
data.raw.resource[k].maximum = 100
Would make sense because the mods and the data is loaded on game start and the amounts are set when generating a map which is obviously later in the process. What I dont understand is, if I set the depletion amount of an infinte resource that has its normal and minimum settings on 1 to a really big number, and then mine one of it, it drops its yield to 10000% and not to 100%. I also don't see any change if I change the normal and minimum numbers no matter if I make the resources infinite or not. I also tried to use the remains_when_mined data field but I don't know what string I have to write there that the remainings of a resource are the resource itself.BlueTemplar wrote: ↑Thu Aug 15, 2019 7:09 pm So, the resources amounts are scaled after the mod's data stage ?
As I said, I set minimum and normal to 1 and not to 100 like the mod originally does.BlueTemplar wrote: ↑Thu Aug 15, 2019 10:17 pm 10000% = 100 * 100% ?
(Note that the default value for data.raw.resource.normal is 1 !)
That exceeds my abilities by far. If you know how to do this, tell me, but my modding knowledge ends at adding/modifying entities and simple manipulations of data.raw like the ones above. Is it possible to set the minimum without infinite resources so that you just mine the patch until 1 ore and this one doesn't deplete?BlueTemplar wrote: ↑Thu Aug 15, 2019 10:17 pm Sounds like one solution could be a mod that, when a new chunk is generated, goes through every non-infinite resource, and replaces them by (100%) infinite ones ?
Manipulations on data.raw won't set all your resources to 100% unless you change resource autoplace.BlueTemplar wrote: ↑Fri Aug 16, 2019 12:46 pm My bad !
I'm afraid that my mod knowledge is pretty fragmentary too, you probably should ask someone like orzelek ?
OK, but the exceeding 100% is exactly what I don't want. The goal is a normal mining process like in vanilla but with non-depleting deposits. Is this achievable in any form using the minimum and normal values? If I understand correctly what you wrote, it is necessary that minimum equals normal if the deposits shall stay at 100%. And the higher the normal value gets, the lower are the percentages on initial generation. But how do I achieve that this: richness/normal * 100% equals 100% on every stack?orzelek wrote: ↑Fri Aug 16, 2019 3:09 pm Manipulations on data.raw won't set all your resources to 100% unless you change resource autoplace.
If you want to have 100% on any resource you need a mod that will set each and every ore tile to 100%.
If you don't mind that ore will go over 100% and then slowly drop to 100% as it's mined then you need a mod that sets minimum and normal to something low like 100 in example above or even 10. Not sure how it will behave if you set both to 1 - but that would mean that normally generated tiles would reach thousands of % when generated.
As far as I know it works like this (I didn't look at this closely recently so it might be outdated):
You have minimum and normal values in prototype. And separately each resource pile also has it's own richness when it's generated or spawned from script.
%-age displayed on the resource when infinite will be richness/normal * 100%. Minimum value defines how far infnite resource will deplete. So with minimum = normal it won't deplete below 100%. With minimum = 1/10th of normal it will deplete to 10% etc.
https://wiki.factorio.com/Prototype/ResourceEntityPhiluminati wrote: ↑Fri Aug 16, 2019 8:33 pmOK, but the exceeding 100% is exactly what I don't want. The goal is a normal mining process like in vanilla but with non-depleting deposits. Is this achievable in any form using the minimum and normal values? If I understand correctly what you wrote, it is necessary that minimum equals normal if the deposits shall stay at 100%. And the higher the normal value gets, the lower are the percentages on initial generation. But how do I achieve that this: richness/normal * 100% equals 100% on every stack?
Code: Select all
require "defines"
game.onevent(defines.events.onchunkgenerated, function(event)
for _, resource in pairs(game.findentitiesfiltered{area=event.area, type="resource"}) do resource.amount=-1 end
end)
remote.addinterface("infinite", --used to find unknown power, aka DyTech added to already started game.
{
scan = function()
local resources=game.findentitiesfiltered{type="resource", area={{game.player.position.x-100, game.player.position.y-100},{game.player.position.x+100, game.player.position.y+100}}}
for _, resource in pairs(resources) do resource.amount=-1 end
end
})
// info.json for credit:
{
"name":"practically_infinite_resources",
"author":"FreeER",
"version":"0.0.1",
"title":"Practically Infinite Resources",
"homepage":"https://forums.factorio.com/forum/viewtopic.php?f=14&t=1568",
"description":"A mod that makes resources infinite",
"dependencies": ["base >= 0.7.4"]
}
So the data-final-fixes.lua isn't a problem but how do I make the control.lua work? I edited the code you sent me for (minimum and normal value = 100):MasterBuilder wrote: ↑Fri Aug 16, 2019 8:52 pm control.lua with a listener for the chunk generation event. Find all generated resources in the new chunk and set the value to exactly 100%.
Code: Select all
require "defines"
game.onevent(defines.events.onchunkgenerated, function(event)
for _, resource in pairs(game.findentitiesfiltered{area=event.area, type="resource"}) do resource.amount=10000 end
end)
remote.addinterface("infinite", --used to find unknown power, aka DyTech added to already started game.
{
scan = function()
local resources=game.findentitiesfiltered{type="resource", area={{game.player.position.x-100, game.player.position.y-100},{game.player.position.x+100, game.player.position.y+100}}}
for _, resource in pairs(resources) do resource.amount=10000 end
end
})
Well guys WE ARE!!! And we have Doppler effect as well!aka13 wrote: ↑Wed Aug 14, 2019 8:18 pmWell, if we ARE getting into space in vanilla, the doppler effect is the last thing I will missconn11 wrote: ↑Wed Aug 14, 2019 6:15 pmWhy? Probably getting ready to enter space in Vanilla...aka13 wrote: ↑Wed Aug 14, 2019 5:16 pmThat's what I thought of first as well, but boy would this be unnecessaryBlueTemplar wrote: ↑Wed Aug 14, 2019 4:31 pm Aww, for a second I thought that you added the Doppler effect in the game...