Page 2 of 8

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

Posted: Thu Jun 08, 2017 10:02 pm
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

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

Posted: Thu Jun 08, 2017 10:20 pm
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

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

Posted: Thu Jun 08, 2017 10:36 pm
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

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

Posted: Fri Jun 09, 2017 7:33 pm
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

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

Posted: Fri Jun 09, 2017 8:43 pm
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?

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

Posted: Sat Jun 10, 2017 8:14 am
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.

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

Posted: Sat Jun 10, 2017 9:12 am
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.

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

Posted: Sat Jun 10, 2017 9:15 am
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.

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

Posted: Fri Jun 16, 2017 3:24 am
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. :)

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

Posted: Fri Jun 16, 2017 8:33 am
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.

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

Posted: Fri Jun 16, 2017 8:40 am
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.

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

Posted: Sat Jun 17, 2017 9:59 pm
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.

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

Posted: Sat Jun 17, 2017 10:51 pm
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.

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

Posted: Sat Jun 17, 2017 10:52 pm
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.

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

Posted: Tue Jun 20, 2017 2:56 am
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

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

Posted: Tue Jun 20, 2017 3:44 am
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

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

Posted: Tue Jun 20, 2017 4:38 am
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.

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

Posted: Tue Jun 20, 2017 8:09 am
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

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

Posted: Tue Jun 20, 2017 9:54 am
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.

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

Posted: Tue Jun 20, 2017 5:49 pm
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 :)