Page 1 of 4

[0.10.x] and [0.11.x] Scrap Mod - now with recycling!

Posted: Thu May 15, 2014 1:20 am
by Schmendrick
I have been working on a small mod that is mostly complete and should answer, to a limited extent, the demand people have for recycling machines: An structure that is destroyed drops (some of) its ingredients, down to and including ore, which will need to be re-smelted ("purified") to be reused. The mod affects everything that can be crafted, placed, and picked up: crashing cars to test this was pretty fun.

It excludes liquid ingredients (so something using sulfuric acid would never drop sulfur) and will not break down any recipe of type "chemistry" or "oil-processing;" this may change in the future depending on how the game changes.

As separate but similar effect, it also gives trees a wood drop (less than their minable/choppable result - most trees will drop between 0 and 3 wood instead of their nominal yield of 5), so deforestation projects will leave a lot of wood on the ground - this may or may not be a pleasant side effect, depending on your disposition regarding wood.

So far, I'm pretty happy with it.

Current concerns:
  • Mod load order - doesn't affect mods that load after it, of course. Mods which load after it and alter basic game recipes will make it inconsistent with the modified recipes. However, it should work well with any mods it does get processed after. update: should work with F-mod and DyTech
  • Any item with multiple recipes may be processed weirdly - Scrap Mod only uses the first recipe it encounters. In current vanilla this is not an issue, but it could become one later or with mods.
  • Items with less than one of an ingredient per item and/or recipes in their chain containing very few ingredients (such as telephone poles) could be set either have zero potential drops or percentage chances to drop each of its intermediate ingredients (a telephone pole built from 1/2 unit of wood and 1/2 unit of copper having small chances to drop each of: processed wood, raw wood, copper cable, copper plate, and copper ore), so if the game "rolls" well, the scrap could potentially be more than was input). I'm not sure which way to go on this; while it enables weird situations where a net gain is provided, each drop's probability is small enough that statistically over time this should not be an issue (even accounting for productivity modules) but it does make for the odd inconsistency. The currently uploaded version allows for these possible overdrops.
  • This adds loot entries to buildings, none of which have drops in vanilla. If a mod or future development grants buildings drops, together the result will probably be too much.
  • Construction robots replacing a destroyed building will also overwrite the scrap, making Scrap Mod less useful. I am considering adding a collector item such as found in other mods to help with this. Bot collection behavior in the future would be nice.
  • Batteries, as a "chemical" recipe, would currently be considered a base ingredient except that I have coded an ugly exception for them to generate copper and iron scrap. Commentary in the lua files suggests batteries will be changed to an assembler process, at which point this blemish can be removed.
  • Because this mod changes basically every placeable building, those buildings will show up with the mod's tag on it, which could be distracting, annoying, or confusing, especially when combined with other mods.
Version 0.2.0
  • Recycling - introduces the recycler, a furnace-like item that can reduce anything placed in it to ore or scrapmetal, which can be separated in an assembling machine to component ores with a little sulfuric acid (currently only supports copper and iron, won't give you back any of the special stuff other mods may add).
  • Improved recipe parsing - items should never drop more than their ingredients could make, ever.
  • Chest contents reclamation - when chests (or vehicles) are destroyed, spill a portion of their contents to the ground. This includes fuel inventory and modules.
0.2.1: added a bunch of optional prerequisites, to encourage Scrap Mod to be loaded last.

0.2.2:this version works with Factorio 0.11.x

Considered additions:
  • Collectors, as mentioned above

Re: Recycling? Here's some scrap...

Posted: Thu May 15, 2014 1:25 am
by Airat9000
screen!!

Re: Recycling? Here's some scrap...

Posted: Thu May 15, 2014 2:06 am
by Schmendrick
Don't drink and drive, kids.
Oops...
Oops...
crash.png (704.6 KiB) Viewed 36298 times
I got so angry at the wall I got a little crazy with my shotgun. It was all a drunken blur, and when I woke up the next day...

(Also the Assembly Machine 2 got magically upgraded to a 3, because I thought the scrap would be more impressive, and that's where the speed module came from. Modules operating in machines are just lost.)
Is this all that is left?
Is this all that is left?
scrap.png (729.76 KiB) Viewed 36298 times
By the way, protect your rocket defense.
Expensive.
Expensive.
rocketdefense.png (316.16 KiB) Viewed 36298 times

Re: Recycling? Here's some scrap...

Posted: Thu May 15, 2014 6:48 pm
by pantong51
looks amazing! a good way of getting resources backas well. I'm a down load it soon!

Re: Recycling? Here's some scrap...

Posted: Thu May 15, 2014 11:45 pm
by AndaleTheGreat
good stuff

Re: Recycling? Here's some scrap...

Posted: Sat May 17, 2014 8:39 am
by thebiftek
Oh yes

Re: Recycling? Here's some scrap...

Posted: Sun May 18, 2014 5:57 am
by Schmendrick
Update, mainly for DyTech and F-mod users!

Changelog: 0.1.1:
  • Added "dependencies" (half-assedly requiring v1.0.0) for F-mod and DyTech and handling (or otherwise) for their recipe types, so it should create appropriate scrap for their machines. Increased specificity for recipe type parsing to avoid circular references (unpacking, for example) and consumed resources (sand in gem polishing).
  • Altered loot formula a little to reduce the potential for "bonus item drop" weirdness. It can still happen, but should be rarer.
If any F-mod or DyTech users encounter any issues, please let me know.

Re: Recycling? Here's some scrap...

Posted: Sun May 18, 2014 1:32 pm
by darius456
Check your zip file... I think that there are file missing. Zip contain only info.json and data.lua.

Re: Recycling? Here's some scrap...

Posted: Sun May 18, 2014 10:34 pm
by Schmendrick
That's all it needs. Data.lua parses the recipes and adds loot entries to entities; there are no new entities or dynamic behavior added.

Re: [0.9.x] Scrap Mod

Posted: Sat May 24, 2014 2:21 am
by Schmendrick
Changelog 0.1.2

Urg. Fixed a bug I introduced in the recipe category parsing that caused it to ignore a lot of recipes. Dumb table-using mistake; Lua is not my native language.

Re: [0.9.x] Scrap Mod

Posted: Wed Jun 25, 2014 6:07 pm
by orion420
Hey I love the mod, lets me know how many robots Ive lost flying to close to bitters :lol:. Bug issue tho (not directly connected with your mod but still)!! a very annoying one. So when a mine or pump jack is destoryed or say i used grenades to burned the forest dropping wood all over a ore area. Then using Construction robots to replace/build new mines cause this error and Crash to desktop (CTD). "Cant Insert into engine source." I have concluded (after seeing smelters pick up what they are built atop; placing it in the input square) that the mines and pumpjack are attempting to pick up the intermediate materials scattered about and causing a invalid item issue and thus the CTD. This is a vanilla issue but aggravated one by your great mod just the same. I will post to bug thread as well.

Re: [0.9.x] Scrap Mod

Posted: Wed Jun 25, 2014 7:47 pm
by Schmendrick
orion420 wrote:Hey I love the mod, lets me know how many robots Ive lost flying to close to bitters :lol:. Bug issue tho (not directly connected with your mod but still)!! a very annoying one. So when a mine or pump jack is destoryed or say i used grenades to burned the forest dropping wood all over a ore area. Then using Construction robots to replace/build new mines cause this error and Crash to desktop (CTD). "Cant Insert into engine source." I have concluded (after seeing smelters pick up what they are built atop; placing it in the input square) that the mines and pumpjack are attempting to pick up the intermediate materials scattered about and causing a invalid item issue and thus the CTD. This is a vanilla issue but aggravated one by your great mod just the same. I will post to bug thread as well.
Is it by any chance this bug?

https://forums.factorio.com/forum/vie ... f=7&t=3242

If so it should be fixed in 0.10.0.

Re: [0.9.x] Scrap Mod

Posted: Fri Jun 27, 2014 8:14 pm
by orion420
That would be the one. :D Says fixed for next version so good stuff.

Re: [0.9.x] Scrap Mod

Posted: Sat Aug 02, 2014 3:02 pm
by Schmendrick
While working on another mod, I realized Scrap Mod has a bug - it can get stuck on a circular recipe chain and hang Factorio on load. I have a pretty simple fix, but I'll be updating Scrap Mod more extensively soon anyway. Just letting everybody know.

Re: [0.9.x] Scrap Mod

Posted: Fri Aug 08, 2014 2:21 pm
by Spiro20004
what about adding a researchable machine that can reduce items into there original components?

in the interest of balance you could make it so it is expensive to research or consumes a lot of electricity. but to make the machine worth while it would break stuff down into components to avoid re-smelting and would give a better return

Re: [0.9.x] Scrap Mod

Posted: Tue Sep 09, 2014 3:26 am
by Schmendrick
Spiro20004 wrote:what about adding a researchable machine that can reduce items into there original components?
Kinda!

In version 2 I've added a recycling machine (unlocks along with steel furnaces and is made from 2 steel furnaces and 3 burner inserters) that reduces any item placed into it into iron ore, copper ore, or "scrapmetal" which can be separated into copper and iron ore in an assembling machine, along with a small amount of sulfuric acid.

Recycling should be compatible with just about any mod, except recycling recipes won't return anything but iron, copper, or scrap. If an item doesn't involve any iron or copper (such as a stone furnace), it can't be recycled (I may address this soonish, at least for stone). Some items only recycle in batches - for example, you need at least 5 regular bullet magazines to recycle them (and, at least in vanilla, they will yield 5 iron ore).

Scrapping should be compatible with every mod, regardless. And it should no longer grant the capability for anything to drop more ingredients than could have been used to make it. Note that if you have a mod that allows the possibility for a large productivity bonus, this will reduce scrap (and recycling) potential.
burningburners.jpg
burningburners.jpg (138.49 KiB) Viewed 16738 times
techentry.jpg
techentry.jpg (29.03 KiB) Viewed 16738 times

Re: [0.10.x] Scrap Mod - now with recycling!

Posted: Tue Sep 09, 2014 11:06 am
by Kane
Nice looking mod :)

Re: [0.10.x] Scrap Mod - now with recycling!

Posted: Tue Sep 09, 2014 8:40 pm
by Devildog
I'll Download it when my internet is stable.

Re: [0.10.x] Scrap Mod - now with recycling!

Posted: Wed Sep 10, 2014 1:09 pm
by Lone_Player
Hello,

I just want to say Thank you, waited Age´s for a Recyling Machine. Finally i can get rid, of all the old Stuff that was sitting around in chest´s.

Re: [0.10.x] Scrap Mod - now with recycling!

Posted: Sat Sep 13, 2014 7:57 pm
by Devildog
I get an Error when i load into game an the game closes an pops up an error msg.
Just says Error Scrap Mod - File name.