Infinite Resources - Normal Yields (with optional depletion)


An infinite resource mod that allows miners to continue mining ore resources at the normal vanilla rates (no insane yields!), and then can optionally start decreasing to lower yields after the initial spawned resource amounts are mined, with only a single code execution per resource tile. Includes settings for minimum depletion level and rate of depletion. This mod is for those that want the benefit of infinite resources (never running out), while preserving the vanilla rate and feel.

Tweaks
7 months ago
1.1
20.7K
Mining

i Any plans to support Factorio 2.x?

2 months ago

Hi,

Just wondering do you have any plans to update your excellent mod to support Factorio 2.x? I know it's few hours after 2.x was published :-)
Stupid me rushed to upgrade to 2.x and (almost) ruined by game :-(

2 months ago

I haven't even downloaded it yet and probably won't for some time (potentially weeks or months). Is this mod actually having issues with it?

I haven't even downloaded it yet and probably won't for some time (potentially weeks or months). Is this mod actually having issues with it?

you can't play with mods that are not updated.

2 months ago

I haven't even downloaded it yet and probably won't for some time (potentially weeks or months). Is this mod actually having issues with it?

you can't play with mods that are not updated.

You can update the json file for 2.0....

2 months ago

Hello everyone,
i have updated the mod for me locally.
This is only a quick and dirty solution.
download: https://file.io/aF2IUkCKTnOc
Changes:
- Version of the mod to 0.0.8
- Set the Factorio Version to 2.0
- prototypes\shortcuts.lua API changes from "icon" to "icons" ( array) and "small_icon" to "small_icons" (array)
- prototypes\items.lua API changes for "select" and "alt_select" (two objects instead of two sets of values)
- control.lua API changes. "global.infinite_resources" to "storage.infinite_resources" and "game.technology_prototypes" to "prototypes.technology"

With these changes i can start a new game with space age and a ore patch changes to infinite-ore after it depleted normally.
I didn't test it further.
I only startet Space Age today.

2 months ago

Hello everyone,
i have updated the mod for me locally.
This is only a quick and dirty solution.
download: https://file.io/aF2IUkCKTnOc
Changes:
- Version of the mod to 0.0.8
- Set the Factorio Version to 2.0
- prototypes\shortcuts.lua API changes from "icon" to "icons" ( array) and "small_icon" to "small_icons" (array)
- prototypes\items.lua API changes for "select" and "alt_select" (two objects instead of two sets of values)
- control.lua API changes. "global.infinite_resources" to "storage.infinite_resources" and "game.technology_prototypes" to "prototypes.technology"

With these changes i can start a new game with space age and a ore patch changes to infinite-ore after it depleted normally.
I didn't test it further.
I only startet Space Age today.

Could you upload this as a fork so that I can use it on a server?

2 months ago

Hello everyone,
i have updated the mod for me locally.
This is only a quick and dirty solution.
download: https://file.io/aF2IUkCKTnOc
Changes:
- Version of the mod to 0.0.8
- Set the Factorio Version to 2.0
- prototypes\shortcuts.lua API changes from "icon" to "icons" ( array) and "small_icon" to "small_icons" (array)
- prototypes\items.lua API changes for "select" and "alt_select" (two objects instead of two sets of values)
- control.lua API changes. "global.infinite_resources" to "storage.infinite_resources" and "game.technology_prototypes" to "prototypes.technology"

With these changes i can start a new game with space age and a ore patch changes to infinite-ore after it depleted normally.
I didn't test it further.
I only startet Space Age today.

Yes please re-upload the file, I am having trouble understanding your changes as I am not familiar with Lua.

2 months ago
(updated 2 months ago)

Hello everyone,
i have updated the mod for me locally.
This is only a quick and dirty solution.
download: https://file.io/aF2IUkCKTnOc
Changes:
- Version of the mod to 0.0.8
- Set the Factorio Version to 2.0
- prototypes\shortcuts.lua API changes from "icon" to "icons" ( array) and "small_icon" to "small_icons" (array)
- prototypes\items.lua API changes for "select" and "alt_select" (two objects instead of two sets of values)
- control.lua API changes. "global.infinite_resources" to "storage.infinite_resources" and "game.technology_prototypes" to "prototypes.technology"

With these changes i can start a new game with space age and a ore patch changes to infinite-ore after it depleted normally.
I didn't test it further.
I only startet Space Age today.

Yes please re-upload the file, I am having trouble understanding your changes as I am not familiar with Lua.

I have applied Evil Erwin's modifications amongst others. His fixes are about half of what needs to be done to get the mod working, the game wont even launch.
This is what i did:
-Changed JSON to 2.0, mod to version 0.07 (0.0.8 is skipping a version, dont do that)
-Updated "data-updates.lua" : line 47 "flags = { "hidden" }" changed to "hidden = true"
-Simplified all 3 deprecated icon-related arrays in "shortcuts.lua" to:
icon = "InfiniteResourcesNormalYieldDepletion/graphics/icons/shortcut-toolbar/infinite-resource-remover-x32.png",
icon_size = 32,
small_icon = "InfiniteResourcesNormalYieldDepletion/graphics/icons/shortcut-toolbar/infinite-resource-remover-x24.png",
small_icon_size = 24

-Updated API interactions in "control.lua" "global.infinite_resources" to "storage.infinite_resources" and "game.technology_prototypes" to "prototypes.technology"
-Updated "items.lua" API interactions to adhere to newly required "select" and "alt_select" array format:
select = {
border_color = {r = 1, g = 0.1, b = 0.1}, -- Normalized RGB color
mode = {"any-entity"}, -- Normal selection
cursor_box_type = "entity", -- Visual feedback type
entity_filter_mode = "whitelist", -- Define the filter mode
entity_type_filters = {"resource"} -- Entities that can be selected
},

alt_select = {
border_color = {r = 1, b = 1}, -- Alternate selection color
mode = {"nothing"}, -- No selection allowed in alt mode
cursor_box_type = "not-allowed", -- Visual feedback for alt mode
entity_filter_mode = "whitelist",
entity_type_filters = {"resource"} -- Entities filtered for alt mode
},

and changed the hidden flag into "hidden = true"

The mod launches, and the ressources are properly replaced by their infinite version when depleted, and these deplete to the minimum value as expected.
HOWEVER, infinite ressources do not give ANYTHING when mined below 100% yields, by miners or manually. i have no idea why or how to fix it. I'm a programmer but not a factorio modder, so I lack the appropriate experience. Basically the mod only works with 100%+ yields.

This mod is one of the most important for me, i love having a small 10% trickle of stuff coming from old mines so i dont have to destroy them. I sincerely hope the mod author takes a moment to get the last 1-2 fixes needed for 2.0 compatibility

2 months ago
(updated 2 months ago)

This mod is a fork of an old mod called infinite ressource-depletion, which has been updated to 2.0. It makes all ore patches infinite but go down to 15% yields slowly.
It suffers from the same problem as this mod - yields are properly calculated above 100% - eg.150% gives 1 ressource + 50% chance of another, but anything below 1 just gives 0. this may actually be a newly introduced bug with factorio core, as yields seem to be a core property that these mods change, as i cannot find a single line of code that these mods have detailing ressource giving logic.

2 months ago

This might be due to a bad cast in l.37 data-updates.lua?

With this git-patch everything should work fine:

diff --git a/control.lua b/control.lua
index 61cd9fa..426946f 100644
--- a/control.lua
+++ b/control.lua
@@ -19,9 +19,9 @@ local function QualifiesForInfinite(resource)
 end

 local function loadResources()
-   global.infinite_resources = {}
-   for _, effect in pairs(game.technology_prototypes.infiniteresourcenormalyielddepletion_infiniteresources.effects) do
-       global.infinite_resources[effect.item] = true
+   storage.infinite_resources = {}
+   for _, effect in pairs(prototypes.technology.infiniteresourcenormalyielddepletion_infiniteresources.effects) do
+       storage.infinite_resources[effect.item] = true
    end
 end

@@ -31,7 +31,7 @@ local function onInitAndConfigChanged(event)
        for _, surface in pairs(game.surfaces) do
            local resources = surface.find_entities_filtered{type = "resource"}
            for _, resource in pairs(resources) do
-               if global.infinite_resources[resource.name] then
+               if storage.infinite_resources[resource.name] then
                    if not QualifiesForInfinite(resource) then
                        resource.destroy()
                    else
@@ -50,7 +50,7 @@ end

 local function onResourceDepleted(event)
    local resource = event.entity
-   if not resource.prototype.infinite_resource and global.infinite_resources[resource.name .. "-infinite"] and QualifiesForInfinite(resource) then
+   if not resource.prototype.infinite_resource and storage.infinite_resources[resource.name .. "-infinite"] and QualifiesForInfinite(resource) then
        resource.surface.create_entity({name = resource.name .. "-infinite", amount = settings.startup["InfiniteResourcesNormalYieldDepletion_normal"].value, position = resource.position, force = resource.force, raise_built = true})
    end
 end
@@ -69,7 +69,7 @@ local function onRuntimeModSettingChanged(event)
    for _, surface in pairs(game.surfaces) do
        local resources = surface.find_entities_filtered{type = "resource"}
        for _, resource in pairs(resources) do
-           if resource.prototype.infinite_resource and global.infinite_resources[resource.name] and not QualifiesForInfinite(resource) then
+           if resource.prototype.infinite_resource and storage.infinite_resources[resource.name] and not QualifiesForInfinite(resource) then
                resource.destroy()
            end
        end
diff --git a/data-updates.lua b/data-updates.lua
index d0f1940..03f9de4 100644
--- a/data-updates.lua
+++ b/data-updates.lua
@@ -34,7 +34,7 @@ for _, resource in pairs(data.raw.resource) do
        infiniteresource.name = resource.name .. "-infinite"
        infiniteresource.localised_name = {"entity-name." .. resource.name}
        infiniteresource.infinite = true
-       infiniteresource.minimum = settings.startup["InfiniteResourcesNormalYieldDepletion_minimum"].value * (settings.startup["InfiniteResourcesNormalYieldDepletion_normal"].value / 100)
+       infiniteresource.minimum = math.floor((settings.startup["InfiniteResourcesNormalYieldDepletion_minimum"].value * settings.startup["InfiniteResourcesNormalYieldDepletion_normal"].value / 100.0))
        infiniteresource.normal = settings.startup["InfiniteResourcesNormalYieldDepletion_normal"].value
        infiniteresource.autoplace = nil

@@ -44,7 +44,7 @@ for _, resource in pairs(data.raw.resource) do
            icon = "__core__/graphics/icons/unknown.png",
            icon_size = 64,
            stack_size = 1,
-           flags = { "hidden" }
+           hidden = true
        }
        table.insert(dummy_tech.effects, {type = "give-item", item = dummy_item.name})

diff --git a/info.json b/info.json
index 2b41abd..9de2e5f 100644
--- a/info.json
+++ b/info.json
@@ -1,11 +1,11 @@
 {
    "name": "InfiniteResourcesNormalYieldDepletion",
-   "version": "0.0.7",
+   "version": "0.0.8",
    "title": "Infinite Resources - Normal Yields (with optional depletion)",
    "author": "FuryoftheStars",
    "contact": "",
    "homepage": "https://forums.factorio.com/viewtopic.php?f=190&t=101063",
    "description": "An infinite resource mod that allows miners to continue mining ore resources at the normal vanilla rates (no insane yields!), and then can optionally start decreasing to lower yields after the initial spawned resource amounts are mined, with only a single code execution per resource tile.  Includes settings for minimum depletion level and rate of depletion.  This mod is for those that want the benefit of infinite resources (never running out), while preserving the vanilla rate and feel.",
-   "factorio_version": "1.1",
+   "factorio_version": "2.0",
    "dependencies": []
 }
diff --git a/prototypes/items.lua b/prototypes/items.lua
index b37596c..4032b46 100644
--- a/prototypes/items.lua
+++ b/prototypes/items.lua
@@ -4,17 +4,23 @@ data:extend({
        name = "infinite-resource-remover",
        icon = "__InfiniteResourcesNormalYieldDepletion__/graphics/icons/infinite-resource-remover.png",
        icon_size = 64,
-       flags = {"only-in-cursor", "hidden", "spawnable"},
+       flags = { "only-in-cursor", "spawnable" },
+       hidden = true,
        stack_size = 1,
        stackable = false,
-       selection_color = {255, 24, 24},
-       selection_count_button_color = {195, 52, 52},
-       selection_mode = "any-entity",
-       alt_selection_color = {r = 1, b = 1},
-       alt_selection_mode = {"nothing"},
-       selection_cursor_box_type = "not-allowed",
-       alt_selection_cursor_box_type = "not-allowed",
+       select = {
+           border_color = { r = 1, g = 0.1, b = 0.1 }, -- Normalized RGB color
+           mode = { "any-entity" },         -- Normal selection
+           cursor_box_type = "entity",      -- Visual feedback type
+           entity_filter_mode = "whitelist", -- Define the filter mode
+           entity_type_filters = { "resource" } -- Entities that can be selected
+       },
+       alt_select = {
+           border_color = { r = 1, b = 1 }, -- Alternate selection color
+           mode = { "nothing" },     -- No selection allowed in alt mode
+           cursor_box_type = "not-allowed", -- Visual feedback for alt mode
            entity_filter_mode = "whitelist",
-       entity_type_filters = {"resource"},
+           entity_type_filters = { "resource" } -- Entities filtered for alt mode
+       },
    }
 })

For me, that seemed to work, but please have a look at it yourself.
Feel free to use it. I would rather not add another fork of the mod.

a month ago

Hey, any updates on getting this working fully with 2.0? I see that there's an issue with <100% yield tiles too. Would like to use this mod as it seems like it aligns most with my interests for an infinite ore mod.

a month ago

While not exactly the same as the original, the longer “Mining Time” can probably be an alternative to lower yields.

30 days ago
(updated 30 days ago)

Great news all, the bug preventing the mod from working as intended in 2.0 is slated to be fixed next patch https://forums.factorio.com/118214

My fix should be thus working with no issues soon.

Ill release it as its own mod with proper credits, then delete it when the author decides to update it.

3 days ago
(updated 3 days ago)

Great news all, the bug preventing the mod from working as intended in 2.0 is slated to be fixed next patch https://forums.factorio.com/118214

My fix should be thus working with no issues soon.

Ill release it as its own mod with proper credits, then delete it when the author decides to update it.

pokes with stick

5 hours ago

I came up with similar patches before finding this thread (how unfortunate!), and can confirm that yields <100% seem to work as intended. Haven't done a full playthrough yet though.

I'm happy to open a PR if there's a repo available, and/or I'm also happy to rehost this as a new mod.

New response