[MOD 0.15] Wear and Tear (plus automated maintenance)

Topics and discussion about specific mods
Maglay
Inserter
Inserter
Posts: 30
Joined: Tue Dec 06, 2016 7:52 am
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by Maglay »

Hi withers,

are you still working on the mod? If not I would like to take the mod over and keep it up to date.
Coffee Daemon wrote:Ok, update.

The mods I listed as what I thought might be an issue were not, and I tested on a vanilla game to see and yes even on vanilla it refuses to replace recipes.
You can fix the bug for yourself:

Open the control.lua and go to line 70
move the line "local old_recipe" two lines up so that it comes before "if roster_entry.entity.type == "assembling-machine" then"
save the file

that's it

Greetings
Coffee Daemon
Inserter
Inserter
Posts: 48
Joined: Tue May 03, 2016 1:02 am
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by Coffee Daemon »

Maglay wrote:Hi withers,

are you still working on the mod? If not I would like to take the mod over and keep it up to date.
Coffee Daemon wrote:Ok, update.

The mods I listed as what I thought might be an issue were not, and I tested on a vanilla game to see and yes even on vanilla it refuses to replace recipes.
You can fix the bug for yourself:

Open the control.lua and go to line 70
move the line "local old_recipe" two lines up so that it comes before "if roster_entry.entity.type == "assembling-machine" then"
save the file

that's it

Greetings
Well played sir! You have saved me a major headache and I can continue my twitch streams. I'll re-read the code later so I can understand it better. Using mods to get a basic idea on coding XD
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14.x] Wear and Tear (now with full automation)

Post by Earendel »

withers wrote:
Earendel wrote:I had an idea for how to run logistic robot failure.

On a set interval (maybe a randomised interval):
Get the number of active logistic robots.
Calculate the chance or number of logictic robot failures based on number active.
Scan roboports and run the 'robot failure actions' on inactive robots.
If insufficient inactive robots are found then find active robots and run the 'robot failure actions' on them (dropping the carried item?)

The robot failure actions could be downgrading the robot to a Dilapidated one, but for simplicity I think it would be better to just delete it so circuit conditions can make a replacement.

The thing that I really like about Wear and Tear on Logistic robots is that it would promote robot use for high value low quantity jobs, and make things robo stations and like botbases less competitive.
I like this idea. Of course time needs to be a factor in the equation so well. So using lots of bots over an extended time results in failures. The decision loop would be: If your base is poor, use belts and inserters to not worry about breakdowns. Use bots as convenience on low quantity jobs. If your base is wealthy and has lots of replacement parts, use bots as much as you can afford.

EDIT: Looks like automation of replacing bots is already possible in the vanilla game, since you can read bot statistics into the circuit network. So the above is all that would need to be added. I'll put this on my todo list.
I ended up making my idea into its own mod. viewtopic.php?f=94&t=49507
Coffee Daemon
Inserter
Inserter
Posts: 48
Joined: Tue May 03, 2016 1:02 am
Contact:

Re: [MOD 0.14.x] Wear and Tear (now with full automation)

Post by Coffee Daemon »

Earendel wrote:
withers wrote:
Earendel wrote:I had an idea for how to run logistic robot failure.

On a set interval (maybe a randomised interval):
Get the number of active logistic robots.
Calculate the chance or number of logictic robot failures based on number active.
Scan roboports and run the 'robot failure actions' on inactive robots.
If insufficient inactive robots are found then find active robots and run the 'robot failure actions' on them (dropping the carried item?)

The robot failure actions could be downgrading the robot to a Dilapidated one, but for simplicity I think it would be better to just delete it so circuit conditions can make a replacement.

The thing that I really like about Wear and Tear on Logistic robots is that it would promote robot use for high value low quantity jobs, and make things robo stations and like botbases less competitive.
I like this idea. Of course time needs to be a factor in the equation so well. So using lots of bots over an extended time results in failures. The decision loop would be: If your base is poor, use belts and inserters to not worry about breakdowns. Use bots as convenience on low quantity jobs. If your base is wealthy and has lots of replacement parts, use bots as much as you can afford.

EDIT: Looks like automation of replacing bots is already possible in the vanilla game, since you can read bot statistics into the circuit network. So the above is all that would need to be added. I'll put this on my todo list.
I ended up making my idea into its own mod. viewtopic.php?f=94&t=49507
Damnit you guys keep on making my hard mode playthough harder
Coffee Daemon
Inserter
Inserter
Posts: 48
Joined: Tue May 03, 2016 1:02 am
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by Coffee Daemon »

Maglay wrote:Hi withers,

are you still working on the mod? If not I would like to take the mod over and keep it up to date.
Coffee Daemon wrote:Ok, update.

The mods I listed as what I thought might be an issue were not, and I tested on a vanilla game to see and yes even on vanilla it refuses to replace recipes.
You can fix the bug for yourself:

Open the control.lua and go to line 70
move the line "local old_recipe" two lines up so that it comes before "if roster_entry.entity.type == "assembling-machine" then"
save the file

that's it

Greetings
So from what I understand the mod is supposed to:
1. Make a space to store the recipe info,
2. Store Recipe info,
3. Re-write info to machine.

Instead it tried to write the info first, but had no-where to put it, then create a blank space for the info to go. Finally called the blank info to write into the machine.

How close was I?
User avatar
withers
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Apr 08, 2016 4:54 pm
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by withers »

Maglay wrote:Hi withers,

are you still working on the mod? If not I would like to take the mod over and keep it up to date.
Hi Maglay. I'm okay with you taking over this mod if you want. Haven't played factorio for awhile and it would probably be a while before I had the time to update anything. Cheers.
User avatar
withers
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Apr 08, 2016 4:54 pm
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by withers »

Coffee Daemon wrote: So from what I understand the mod is supposed to:
1. Make a space to store the recipe info,
2. Store Recipe info,
3. Re-write info to machine.

Instead it tried to write the info first, but had no-where to put it, then create a blank space for the info to go. Finally called the blank info to write into the machine.

How close was I?
I had a local variable declared inside a "if" block and than tried to use it again outside the block. New bug introduced when I was cleaning up code for the .15 update. I'll fix it tomorrow and test before posting an update. I'll take a look at 10x Harder too.
User avatar
withers
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Apr 08, 2016 4:54 pm
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by withers »

diongham wrote:Sorry i can't find a forum post about 10x Harder.

I found a potential conflict with your 10x Harder mod with AAI Industries. Machinery doesn't seem to apply on entities affected by motors; in fact it when both are installed it seems to be random which items get what. I tested with creative mode and Bob's+Angel's (don't have a mod list right now).

Also i have a request for the mod, can you turn the config file into settings so we can change the mod in game?

Cheers.
I'll take look tomorrow.
User avatar
withers
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Apr 08, 2016 4:54 pm
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by withers »

Well it looks like the devs have gone and borked up this mod good. Been playing a bit. I notice the system I had in place to track the age of entities when you remove / replace them around your base is no longer working. I had it set up so whenever you remove an entity, it gets assigned an index number and records the index number, age and health in a table, and then "damages" the item such that the decimal part of it's health equals the index. (eg. Index #1 would get a health of 300.001. Index #2 health = 300.002, and so on.) The when you place it again it finds the index, applies the age and restores the health to what it was before. It was working perfectly before and I was quite proud of being able to pull this off.

But now it appears when you have multiple damaged items in your inventory the game just merges them into a single stack using some sort of average. In other words, they alter the damage in a somewhat random way that I am unable to control. So my method of tracking item age is now broken.

Not sure how to fix this. I could maybe look at some sort of "first in first out" method that ignores damage but that wouldn't distinguish between newly crafted items and removed items.

EDIT: Okay I just made it so all the age-able stuff is forced to have a stack size of 1. That's the only way I can think of to fix the age-tracking on removed items. This means even brand new equipment that is age-able will have a stack size of 1, unfortunately. But at least it's not broken.

Also added new recyclers. They can detect old equipment in nearby storage chests and automatically set the recipe as needed. This way you can set up only one recycler for the whole base to take care of all the recycling and not have to micromanage the recipe. I'll upload shortly.

Maybe I'll add in-game config settings if I have time. Need to learn how to set that up. If someone wants to take custody of this mod, I'd be fine that. :)
Maglay
Inserter
Inserter
Posts: 30
Joined: Tue Dec 06, 2016 7:52 am
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by Maglay »

withers wrote:Maybe I'll add in-game config settings if I have time. Need to learn how to set that up. If someone wants to take custody of this mod, I'd be fine that. :)
I already mentioned that I would take this mod to make shure it keeps working. But as long as you continue pushing updates despite saying that you don't have time I wont do anything. There is no need for us to do the same thing twice :)

I can learn how to add ingame settings this weekend. Either I will send to the files then or reupload the mod (with proper credits of course). Simply say what you prefer.

Greetings

Btw. I would say its legit to remove the damage recording at all. Once a factory is running on its own there should not be any aging item in the chests, because the construction bots only pick up old buildings. Thus the only aging items that occur are those created by the player, e.g. when picking up miners from a depleted field. In my opinion it is not "cheating" if you get a couple of miners back, that have full health once placed. Compared to the remaining factory, the gained health points (i.e. the increased lifetime of the miner if I am correct) wont be noticable in the consumed resources to produce new miners.
User avatar
ZombieMooose
Filter Inserter
Filter Inserter
Posts: 289
Joined: Mon Feb 09, 2015 7:23 am
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by ZombieMooose »

Personally I love this mod, but it may be too difficult for some people. Especially if you add all the difficulty mods I add.

Whatever happens with this mod it's staying in my load order.
"men will literally learn everything about ancient Rome instead of going to therapy"
Coffee Daemon
Inserter
Inserter
Posts: 48
Joined: Tue May 03, 2016 1:02 am
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by Coffee Daemon »

Fixed removed item age tracking which was broken by Factorio .15 release. Unfortunately I had force the stack size of all "age-able" items to 1 to fix this..
You caused item explosions. LOTS of item explosions.
User avatar
withers
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Apr 08, 2016 4:54 pm
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by withers »

Maglay wrote:
withers wrote:Maybe I'll add in-game config settings if I have time. Need to learn how to set that up. If someone wants to take custody of this mod, I'd be fine that. :)
I already mentioned that I would take this mod to make shure it keeps working. But as long as you continue pushing updates despite saying that you don't have time I wont do anything. There is no need for us to do the same thing twice :)

I can learn how to add ingame settings this weekend. Either I will send to the files then or reupload the mod (with proper credits of course). Simply say what you prefer.

Greetings

Btw. I would say its legit to remove the damage recording at all. Once a factory is running on its own there should not be any aging item in the chests, because the construction bots only pick up old buildings. Thus the only aging items that occur are those created by the player, e.g. when picking up miners from a depleted field. In my opinion it is not "cheating" if you get a couple of miners back, that have full health once placed. Compared to the remaining factory, the gained health points (i.e. the increased lifetime of the miner if I am correct) wont be noticable in the consumed resources to produce new miners.
Lol Just when I thought I was out.... Yeah these games are so addictive. I went ahead and added the in-game settings along with changing the stack size to 1 on age-ables and added the recyclers.

Also went ahead and added an option for whether the game keeps track of age when you place items in inventory, so you can turn it off if you don't like the stack size limitations. Currently the network is broken so I can't upload yet.
User avatar
withers
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Apr 08, 2016 4:54 pm
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by withers »

Coffee Daemon wrote:
Fixed removed item age tracking which was broken by Factorio .15 release. Unfortunately I had force the stack size of all "age-able" items to 1 to fix this..
You caused item explosions. LOTS of item explosions.
Made an option for tracking age of items and forcing the stack size to 1. I'll get it uploaded once they fix the network errors.
Sworn
Filter Inserter
Filter Inserter
Posts: 314
Joined: Sun Apr 03, 2016 8:10 pm
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by Sworn »

I have the scenario ready, I have the aging on 2 minutes all settings. Looks like it happens when trying to replace for the "old" entity.
Mod list
Last edited by Sworn on Tue Jun 20, 2017 3:46 am, edited 2 times in total.
Sworn
Filter Inserter
Filter Inserter
Posts: 314
Joined: Sun Apr 03, 2016 8:10 pm
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by Sworn »

I have this two print, maybe it's helpful, somehow...

Normal map [see image normal_play.png]

Test Settings, 2 minute aging [see image test_play.png]

Code changed: before 280:

Code: Select all

game.print('============== '..entity.name .. ' ==============')
	
	if (entity.localised_name[0] == nil) then
		game.print('entity.localised_name[0]: nil')
	else
		game.print('entity.localised_name[0]: ' .. entity.localised_name[0])
	end

	if (entity.localised_name[1] == nil) then
		game.print('entity.localised_name[1]: nil')
	else
		game.print('entity.localised_name[1]: ' .. entity.localised_name[1])
	end

	if (entity.localised_name[2] == nil) then
		game.print('entity.localised_name[2]: nil')
	else
		game.print('entity.localised_name[2]: ' .. entity.localised_name[2])
	end
Attachments
Test Play
Test Play
test_play.png (3.02 MiB) Viewed 8125 times
Normal play
Normal play
normal_play.png (3.01 MiB) Viewed 8125 times
User avatar
withers
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Apr 08, 2016 4:54 pm
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by withers »

Sworn wrote:I have the scenario ready, I have the aging on 2 minutes all settings. Looks like it happens when trying to replace for the "old" entity.
Mod list

It looks like there's a conflict with AAI Industry. Should be fixed now.
Maglay
Inserter
Inserter
Posts: 30
Joined: Tue Dec 06, 2016 7:52 am
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by Maglay »

Greetings

there is another bug in line 148 in control.lua.
The variable b cannot be used there cause it is defined local in the if block above. I stumbled across it after I added buildings to the ignore list. Maybe you also want to extend it with the following buildings:

"solaire-power", "wind-turbine", "droid-assembling-machine", "droid-guard-station", "reverse-factory"

The first one is the hidden solar panel of the "Solaire Lights" mod
User avatar
withers
Fast Inserter
Fast Inserter
Posts: 125
Joined: Fri Apr 08, 2016 4:54 pm
Contact:

Re: [MOD 0.14.x] Wear and Tear (plus automated maintenance)

Post by withers »

Maglay wrote:Greetings

there is another bug in line 148 in control.lua.
The variable b cannot be used there cause it is defined local in the if block above. I stumbled across it after I added buildings to the ignore list. Maybe you also want to extend it with the following buildings:

"solaire-power", "wind-turbine", "droid-assembling-machine", "droid-guard-station", "reverse-factory"

The first one is the hidden solar panel of the "Solaire Lights" mod
*pounds keyboard with fists*

BUGS BUGS BUGS!

Okay thanks for that feedback. I'll get it corrected and also add the items you found to the default "ignore" list.
Maglay
Inserter
Inserter
Posts: 30
Joined: Tue Dec 06, 2016 7:52 am
Contact:

Re: [MOD 0.15] Wear and Tear (plus automated maintenance)

Post by Maglay »

Just discovered a new thing. When a building gets replaced, the items that are used in the current cycle and those that are stored in the inventories are lost.

In the most cases the amount of lost wares can be ignored, however for the satelitte this is quite expensive. But even worse the kovarex enrichment process now consumes more u235 than it produces.
Without fancy combinator magic, which limits the amount of uran in the inventories, the enchricment process is unusable.

Can the inventory be stored similar to the modules or the recipe in the global replace list, maybe even the progress of the current running cycle?

The quick and dirty solution is to add the centrifuge to the ignore list :)
Post Reply

Return to “Mods”