Version 0.17.65

Information about releases and roadmap.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3066
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Version 0.17.65

Post by BlueTemplar »

Well, that's a short mod !

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
Have you tied adding

Code: Select all

   data.raw.resource[k].maximum = 100
?
BobDiggity (mod-scenario-pack)
User avatar
Philuminati
Inserter
Inserter
Posts: 35
Joined: Sun Aug 05, 2018 1:04 am
Contact:

Re: Version 0.17.65

Post by Philuminati »

BlueTemplar wrote: Thu Aug 15, 2019 5:41 pm Well, that's a short mod !

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
Have you tied adding

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?
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3066
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Version 0.17.65

Post by BlueTemplar »

Hmm, yeah...
https://wiki.factorio.com/Prototype/ResourceEntity

So, the resources amounts are scaled after the mod's data stage ?
BobDiggity (mod-scenario-pack)
User avatar
Philuminati
Inserter
Inserter
Posts: 35
Joined: Sun Aug 05, 2018 1:04 am
Contact:

Re: Version 0.17.65

Post by Philuminati »

BlueTemplar wrote: Thu Aug 15, 2019 7:09 pm So, the resources amounts are scaled after the mod's data stage ?
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.

Oh and for the devs, would it be possible to just expand the infinite_depletion_amount function to not infinite resources? This would solve the problem instantly I guess :)
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3066
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Version 0.17.65

Post by BlueTemplar »

10000% = 100 * 100% ?
(Note that the default value for data.raw.resource.normal is 1 !)

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 ?
BobDiggity (mod-scenario-pack)
User avatar
Philuminati
Inserter
Inserter
Posts: 35
Joined: Sun Aug 05, 2018 1:04 am
Contact:

Re: Version 0.17.65

Post by Philuminati »

BlueTemplar wrote: Thu Aug 15, 2019 10:17 pm 10000% = 100 * 100% ?
(Note that the default value for data.raw.resource.normal is 1 !)
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 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 ?
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?
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3066
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Version 0.17.65

Post by BlueTemplar »

My bad !

I'm afraid that my mod knowledge is pretty fragmentary too, you probably should ask someone like orzelek ?
BobDiggity (mod-scenario-pack)
orzelek
Smart Inserter
Smart Inserter
Posts: 3923
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Version 0.17.65

Post by orzelek »

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 ?
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.
User avatar
Philuminati
Inserter
Inserter
Posts: 35
Joined: Sun Aug 05, 2018 1:04 am
Contact:

Re: Version 0.17.65

Post by Philuminati »

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.
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?
User avatar
MasterBuilder
Filter Inserter
Filter Inserter
Posts: 353
Joined: Sun Nov 23, 2014 1:22 am
Contact:

Re: Version 0.17.65

Post by MasterBuilder »

Philuminati 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?
https://wiki.factorio.com/Prototype/ResourceEntity
I see nothing for maximum so you'll have to get creative.

For keeping it at 100% on generation, I present this from a very old mod called "practically_infinite_resources" that I still have around for some reason. (Made in 2013).

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"]
}
Basically, I think you could achieve this if you make a mod with the following:
  • data-final-fixes.lua to set the minimum & normal amounts to 100%. (And infinite to true.)
  • 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%.
That should make up for the missing 'maximum' definition in the prototype.
As a side effect, all resources everywhere would be uniformly the same amount.

Alternatively, you could go make a modding API request to add a maximum to resource prototype. That'll probably take longer though.

PS: I don't know if there's a better way (a better event) to listen for generated resources as I haven't made a mod here in years.
Give a man fire and he'll be warm for a day. Set a man on fire and he'll be warm for the rest of his life.
User avatar
Philuminati
Inserter
Inserter
Posts: 35
Joined: Sun Aug 05, 2018 1:04 am
Contact:

Re: Version 0.17.65

Post by Philuminati »

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%.
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):

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
})
But I don't have a defines.lua and the game says on generating a new world that I tried to access "game" which is a nil value (obviously because the game hasn't started yet) in line 3.
User avatar
Philuminati
Inserter
Inserter
Posts: 35
Joined: Sun Aug 05, 2018 1:04 am
Contact:

Re: Version 0.17.65

Post by Philuminati »

I actually think I did it. Now it is done by other means without setting the resources to infinite. Instead, all 5 minutes, the game checks all resouce patches for deposits with under 1000 units and then sets them on a random number between 1000 and 100000. On big maps this causes a small lag but as said, only every 5 minutes. As long as the ores are not set to infinite there is no problem with high yield percentages. I uploaded the mod here: https://mods.factorio.com/mod/endless_resources

Thank you for your ideas and support! :D
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3066
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Version 0.17.65

Post by BlueTemplar »

Heh, yeah, if you don't want to have a depletion effect, I guess that this is the easiest way to go! :D
BobDiggity (mod-scenario-pack)
Batmates
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Nov 07, 2022 3:31 pm
Contact:

Re: Version 0.17.65

Post by Batmates »

aka13 wrote: Wed Aug 14, 2019 8:18 pm
conn11 wrote: Wed Aug 14, 2019 6:15 pm
aka13 wrote: Wed Aug 14, 2019 5:16 pm
BlueTemplar wrote: Wed Aug 14, 2019 4:31 pm Aww, for a second I thought that you added the Doppler effect in the game... :lol:
That's what I thought of first as well, but boy would this be unnecessary :D
Why? Probably getting ready to enter space in Vanilla...
Well, if we ARE getting into space in vanilla, the doppler effect is the last thing I will miss :D
Well guys WE ARE!!! And we have Doppler effect as well!
Post Reply

Return to “Releases”