Allow construction robots use modded repair packs

Post Reply
DevilXD
Fast Inserter
Fast Inserter
Posts: 213
Joined: Tue Aug 12, 2014 10:47 am
Contact:

Allow construction robots use modded repair packs

Post by DevilXD »

I'm working on a mod that adds additional repair packs. It would be cool if the construction robots could use them. Right now the code for construction robot looks like this:

Code: Select all

repair_pack = "repair-pack",
It could be changed to something like this:

Code: Select all

repair_pack = { "repair-pack" }
... and then I could simply put this line somewhere in my mod:

Code: Select all

data.raw["construction-robot"]["construction-robot"].repair_pack = { "modded-repair-pack", "repair-pack" }
.. or better:

Code: Select all

table.insert(data.raw["construction-robot"]["construction-robot"].repair_pack, 1, "modded-repair-pack")-- Insert into first position
The code for repairing entities by the construction robots should then be changed to accommodate that the repair_pack is now a table, not a string.

As for the choosing which repair pack to use - Simply choose the first one:

Code: Select all

local repair_packs= data.raw["construction-robot"]["construction-robot"].repair_pack

for n, pack in ipairs(repair_packs) do
    if ExistsInLogisticsNetwork(repair_packs[n]) then
        UseThisPack(pack)
    end
end
Thoughts ?

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Allow construction robots use modded repair packs

Post by prg »

Mod changes in 0.13
- Construction robots will now use any available repair tool items instead of a fixed single item defined in the prototype for the robot.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

DevilXD
Fast Inserter
Fast Inserter
Posts: 213
Joined: Tue Aug 12, 2014 10:47 am
Contact:

Re: Allow construction robots use modded repair packs

Post by DevilXD »

prg wrote:Mod changes in 0.13
- Construction robots will now use any available repair tool items instead of a fixed single item defined in the prototype for the robot.
Oh, okay, but how are they prioritized ?

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Allow construction robots use modded repair packs

Post by prg »

DevilXD wrote:Oh, okay, but how are they prioritized ?
Doesn't seem to be a mention about that. The robots are probably just going to use whatever is readily available nearby. Guess you could request a way to specify a usage priority if you feel it's important.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

DevilXD
Fast Inserter
Fast Inserter
Posts: 213
Joined: Tue Aug 12, 2014 10:47 am
Contact:

Re: Allow construction robots use modded repair packs

Post by DevilXD »

prg wrote:Doesn't seem to be a mention about that. The robots are probably just going to use whatever is readily available nearby. Guess you could request a way to specify a usage priority if you feel it's important.
If they would just use the closest available thing, it's stupid - I could have "better" repair packs a little distance away... I proposed a way how to specify "better" - by going through a table and choosing the first thing available.

Unless the robots are checking for repair_speed and durability automatically, but I doubt it...

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Allow construction robots use modded repair packs

Post by prg »

Getting this right is probably not that straight forward. What if a normal repair pack is available in the chest right next to the robot, but a better modded one is sitting somewhere in storage at the other end of the factory a dozen chunks away? Would it be worth fetching the better one? You'd need to define what "a little distance away" means. Simply ignoring all normal repair packs once a better one is available somewhere doesn't sound like a proper solution.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

DevilXD
Fast Inserter
Fast Inserter
Posts: 213
Joined: Tue Aug 12, 2014 10:47 am
Contact:

Re: Allow construction robots use modded repair packs

Post by DevilXD »

prg wrote:Would it be worth fetching the better one?
IMHO - No. That's a problem to the player, not the algorithm - If I want quicker repairs, I'll just move the chest with better repair packs closer to the repairing area. Or I'll have multiple chests with better repair packs... That's the problem I, as a player can solve...

The problem is, I don't want robots to use "normal" repair packs - I have modded ones and these are better. Is there a a way to tell the robots that I PREFER one kind of repair packs over another, and if that fails choose the other one ? Devs ?

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

Re: Allow construction robots use modded repair packs

Post by Rseding91 »

DevilXD wrote:
prg wrote:Would it be worth fetching the better one?
IMHO - No. That's a problem to the player, not the algorithm - If I want quicker repairs, I'll just move the chest with better repair packs closer to the repairing area. Or I'll have multiple chests with better repair packs... That's the problem I, as a player can solve...

The problem is, I don't want robots to use "normal" repair packs - I have modded ones and these are better. Is there a a way to tell the robots that I PREFER one kind of repair packs over another, and if that fails choose the other one ? Devs ?
Don't make normal ones and they can't use them.
If you want to get ahold of me I'm almost always on Discord.

DevilXD
Fast Inserter
Fast Inserter
Posts: 213
Joined: Tue Aug 12, 2014 10:47 am
Contact:

Re: Allow construction robots use modded repair packs

Post by DevilXD »

Rseding91 wrote:Don't make normal ones and they can't use them.
Yeah, I know, but if multiple kinds of repair packs exist in the network, which will take a priority ? The closest one ?

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

Re: Allow construction robots use modded repair packs

Post by Rseding91 »

DevilXD wrote:
Rseding91 wrote:Don't make normal ones and they can't use them.
Yeah, I know, but if multiple kinds of repair packs exist in the network, which will take a priority ? The closest one ?
Which ever one was added to the prototypes first.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Implemented mod requests”