Page 1 of 1
Allow construction robots use modded repair packs
Posted: Sat May 21, 2016 9:24 am
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:
It could be changed to something like this:
... 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 ?
Re: Allow construction robots use modded repair packs
Posted: Sat May 21, 2016 9:44 am
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.
Re: Allow construction robots use modded repair packs
Posted: Sat May 21, 2016 9:55 am
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 ?
Re: Allow construction robots use modded repair packs
Posted: Sat May 21, 2016 10:12 am
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.
Re: Allow construction robots use modded repair packs
Posted: Sat May 21, 2016 11:17 am
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...
Re: Allow construction robots use modded repair packs
Posted: Sat May 21, 2016 11:45 am
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.
Re: Allow construction robots use modded repair packs
Posted: Sat May 21, 2016 2:09 pm
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 ?
Re: Allow construction robots use modded repair packs
Posted: Sat May 21, 2016 2:55 pm
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.
Re: Allow construction robots use modded repair packs
Posted: Sat May 21, 2016 3:07 pm
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 ?
Re: Allow construction robots use modded repair packs
Posted: Sat May 21, 2016 4:10 pm
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.