Page 1 of 1

[MOD 0.14.x] Trash Landfill

Posted: Sat Aug 13, 2016 6:41 am
by zackman0010
Trash Landfill
Image

Description
Ever realize that you have a lot of useless stuff just laying around, clogging up your chests and/or inventory? The trash landfill mod allows you to throw those items away to allow them to degrade into pollution. Current pollution created is 5 per item, and items degrade approx 13000 ticks (216.67 seconds / 3.61 minutes) after they were thrown in. I originally made this mod to deal with certain byproducts in the Bob's Mod modpack, namely sodium hydroxide. The graphic is created from a bunch of vanilla items thrown together onto a darker colored version of the Field from Treefarm.

Features:
Get rid of unused items by letting them degrade into pollution

Future Plans (If I get around to them):
Adjustable rates of degradation
Adjustable pollution per item
More types of landfills, including one that burns trash to produce power (Cannot promise this will happen)

Known Bugs:
Do your best not to remove any items from the landfill after they are put in. My code only detects if every copy of a certain type of item is removed from the landfill. For example, if you put in 50 Iron Plate but later remove 25, the pollution produced will still be as if there were 50 Iron Plates in the landfill. Removing items could also cause other bugs that I didn't discover. I'm still trying to figure out ways around these.


Download:
https://mods.factorio.com/mods/zackman0 ... h-Landfill

Update Log:
v0.13.15 - Original
v1.1.1 - Changed version numbering scheme; Fixed possible desync caused by my lack of LUA knowledge
v1.1.2 - Updated for 0.14
v1.1.3 - Fixed bugs caused by a stupid mistake on my end. Resulted in crash due to negative numbers ending up in the item tables. Also a possible cause of desyncs.

Re: [MOD 0.14.x] Trash Landfill

Posted: Mon Dec 12, 2016 7:29 pm
by Demosthenex
Looks great, works great!

Until I just hit an error:

Code: Select all

 141.286 Error MainLoop.cpp:788: Exception at tick 40695000: Error while running event on_tick (ID 0)
Item stack count has to a be positive number
stack traceback:
        __ZCS-Trash-Landfill__/control.lua:58: in function 'delete_check'
        __ZCS-Trash-Landfill__/control.lua:92: in function <__ZCS-Trash-Landfill__/control.lua:74>
 141.286 Error ServerMultiplayerManager.cpp:93: MultiplayerManager failed: "Error while running event on_tick (ID 0)
Item stack count has to a be positive number
stack traceback:
        __ZCS-Trash-Landfill__/control.lua:58: in function 'delete_check'
        __ZCS-Trash-Landfill__/control.lua:92: in function <__ZCS-Trash-Landfill__/control.lua:74>"
 141.286 Info ServerMultiplayerManager.cpp:658: mapTick(40695000) changing state from(InGame) to(Failed)
/quit
It's corrupted the save (ie: it happens on each restart). I'm rolling back to a prior version.

To my knowledge the landfills are just automatically receiving from belts, not manually adding or removing.

Re: [MOD 0.14.x] Trash Landfill

Posted: Mon Dec 12, 2016 7:33 pm
by zackman0010
Can't say I've ever seen that error before while testing. I'll take a look at it next time I'm back at my laptop. Thank you for the report!

Re: [MOD 0.14.x] Trash Landfill

Posted: Mon Dec 12, 2016 7:35 pm
by Demosthenex
What an amazingly fast reply. OMG. I'm on IRC if you have questions or want a copy of the bad save.

We're playing Bob's + Angel's and wow did we need a trashcan! Plus I love the graphic, it's so cute!

Re: [MOD 0.14.x] Trash Landfill

Posted: Mon Dec 12, 2016 7:39 pm
by zackman0010
Lol. I always sign up for email notifications to topics I'm interested in. I was surprised when I saw this one is the one that got pinged.
Can you upload a copy of the save as well as either your modpack or a list of mods you're using? I'll need to see how the error happened to know how to prevent it in the future. I won't be back at my computer for a little while, though.
As for the graphic, it's just a little bit of copying graphics from the game, then resizing and rotating them. Lol. I wish I was better at graphic design so I could make better ones.

Re: [MOD 0.14.x] Trash Landfill

Posted: Wed Dec 14, 2016 12:57 pm
by Demosthenex
Demosthenex wrote:Looks great, works great!

Until I just hit an error:

Code: Select all

 141.286 Error MainLoop.cpp:788: Exception at tick 40695000: Error while running event on_tick (ID 0)
Item stack count has to a be positive number
stack traceback:
        __ZCS-Trash-Landfill__/control.lua:58: in function 'delete_check'
        __ZCS-Trash-Landfill__/control.lua:92: in function <__ZCS-Trash-Landfill__/control.lua:74>
 141.286 Error ServerMultiplayerManager.cpp:93: MultiplayerManager failed: "Error while running event on_tick (ID 0)
Item stack count has to a be positive number
stack traceback:
        __ZCS-Trash-Landfill__/control.lua:58: in function 'delete_check'
        __ZCS-Trash-Landfill__/control.lua:92: in function <__ZCS-Trash-Landfill__/control.lua:74>"
 141.286 Info ServerMultiplayerManager.cpp:658: mapTick(40695000) changing state from(InGame) to(Failed)
/quit
It's corrupted the save (ie: it happens on each restart). I'm rolling back to a prior version.

To my knowledge the landfills are just automatically receiving from belts, not manually adding or removing.
We just crashed again to the same error. My partner was wondering if it could be related to trying to landfill an item with a durability less than full?

Re: [MOD 0.14.x] Trash Landfill

Posted: Wed Dec 14, 2016 3:08 pm
by zackman0010
Could possibly be it. I've been on vacation, that's why it's taking me so long to check it out. Today is the earliest I've been able to get back to my laptop. I have some debug code in mind that can tell me exactly what's causing the problem, though.

Re: [MOD 0.14.x] Trash Landfill

Posted: Thu Dec 15, 2016 5:46 pm
by zackman0010
Demosthenex wrote:
Demosthenex wrote:Looks great, works great!

Until I just hit an error:

Code: Select all

 141.286 Error MainLoop.cpp:788: Exception at tick 40695000: Error while running event on_tick (ID 0)
Item stack count has to a be positive number
stack traceback:
        __ZCS-Trash-Landfill__/control.lua:58: in function 'delete_check'
        __ZCS-Trash-Landfill__/control.lua:92: in function <__ZCS-Trash-Landfill__/control.lua:74>
 141.286 Error ServerMultiplayerManager.cpp:93: MultiplayerManager failed: "Error while running event on_tick (ID 0)
Item stack count has to a be positive number
stack traceback:
        __ZCS-Trash-Landfill__/control.lua:58: in function 'delete_check'
        __ZCS-Trash-Landfill__/control.lua:92: in function <__ZCS-Trash-Landfill__/control.lua:74>"
 141.286 Info ServerMultiplayerManager.cpp:658: mapTick(40695000) changing state from(InGame) to(Failed)
/quit
It's corrupted the save (ie: it happens on each restart). I'm rolling back to a prior version.

To my knowledge the landfills are just automatically receiving from belts, not manually adding or removing.
We just crashed again to the same error. My partner was wondering if it could be related to trying to landfill an item with a durability less than full?
I found the error, and I have to say.. It was a really dumb one of me. Lol. I should I have a fix pushed in just a little bit. Fix is now uploaded, make sure you have v1.1.3
This is kind of a workaround fix, however. I'm not sure how the main problem that occurred happened. Somehow one of the item numbers in my internal storage became negative, which means it didn't get deleted from the table as intended. It's possible the fix I implemented will also prevent this from occurring, but I'm not positive about that.
This update will also include a migration script that will automatically fix the problem in existing saves. You won't have to restart your world.

Re: [MOD 0.14.x] Trash Landfill

Posted: Thu Dec 15, 2016 6:48 pm
by Demosthenex
zackman0010 wrote:
Demosthenex wrote:
Demosthenex wrote: I found the error, and I have to say.. It was a really dumb one of me. Lol. I should I have a fix pushed in just a little bit. Fix is now uploaded, make sure you have v1.1.3
This is kind of a workaround fix, however. I'm not sure how the main problem that occurred happened. Somehow one of the item numbers in my internal storage became negative, which means it didn't get deleted from the table as intended. It's possible the fix I implemented will also prevent this from occurring, but I'm not positive about that.
This update will also include a migration script that will automatically fix the problem in existing saves. You won't have to restart your world.
Excellent! Thanks for your hard work. We'll update immediately.