Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: !!SCIENCE!! Broken cloth / adamantine stockpiles - including raw fix  (Read 14764 times)

Cerbsen

  • Bay Watcher
  • c is for butcher
    • View Profile

Investigations

In the current version ( 0.34.11 ) the first entry in each cloth stockpiles subcategory is broken.
Spoiler (click to show/hide)

Whenever you create a stockpile containing one of these items or permit e.g. "Cloth (Silk)", thus including the first in list, the stockpile starts to work incorrectly.

Resulting in the following behavior (under linux):

silk and brown recluse spider silk thread/cloth allows all yarn / silk is separated correctly
plants and pig tail fiber thread/cloth allows all silk, yarn, metal / plants are separated correctly
yarn and sheep wool yarn/cloth allows all silk, yarn is separated correctly
metal and adamantine strands/cloth allows all silk, yarn, metal


One minor option to further separate stockpiles, is to use the "Additional Options" setting.

Plants, silk and metal count as "Allow non-plant/animal" (non-pa)
Yarn as "Allow plant/animal" (pa)

Resulting in the following behavior (under linux):

non-pa silk and brown recluse spider silk thread/cloth allows only silk, thus works as intended
non-pa plants and pig tail fiber thread/cloth allows all silk,metal / plants are separated correctly
pa        yarn and sheep wool yarn/cloth allows only yarn, thus working as intended (same under windows)
non-pa metal and adamantine strands/cloth allows all silk,metal


By default the only workaround is to use stockpile links and take from links only option, while bins tend to mess things up.

e.g.
- designate a pig tail "allow non-p/a" stockpile and let it give to your "allow non-p/a" silk stockpile(s). (do not use an "all silk" or "reculse spider" stockpile)
- designate a rope reed "allow non-p/a" stockpile.
- designate one to four sheep/llama/alpaca/troll "allow p/a" stockpile(s). (Hair thread counts as sheep thread)
- designate a adamantine strands stockpile set it to take from links and from strand extractors workstop only




Raw workaround for running forts

A possible solution is to create a placeholder item, replacing the bugged columns.
Spoiler (click to show/hide)

Every thread/cloth stockpile subcategory has a new first placeholder entry Pig Iron Strands/Cloth.
Make sure every stockpile has disabled the Pig Iron Strands/Cloth options and all cloth stockpiles work as intended.

Do this by adding the following entrys to the pig iron definition inside "savegame/raw/objects/inorganic_metals.txt" file
Spoiler (click to show/hide)



Raw workaround for new worlds

This creates a non-existant placeholder item, replacing the bugged columns.
Spoiler (click to show/hide)

Every thread/cloth stockpile subcategory has a new first placeholder entry Bugged Stockpile Yarn/Cloth.
Make sure every stockpile has disabled the Bugged Stockpile Yarn/Cloth options and all cloth stockpiles work as intended.

Do this by adding the following entrys right after [OBJECTS:INORGANIC] inside "savegame/raw/objects/inorganic_metals.txt" file
Spoiler (click to show/hide)


...or create a new file inside your "DF_GAMEFOLDER/raw/objects/ folder and name it inorganic_clothstockpile_fix.txt containing:
Spoiler (click to show/hide)

A new files advantage is that tools like lazy noob pack or other tileset installing tools won't overwrite them, because they have no vanilla df name.

Known issues
You may get a dwarf that likes bugged stockpiles.



Additional notes:

When using bins in one stockpile make sure all other taking from it are using bins too.

bin-stockpile A        ->  give  -> bin-stockpile B           ---    do
non bin-stockpile A ->  give  -> bin-stockpile B           ---    do
bin-stockpile A        ->  give  -> non bin-stockpile B    ---    do not
« Last Edit: July 27, 2014, 05:45:01 pm by Cerbsen »
Logged

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: HOW TO: Sort your cloth / thread / yarn / strands stockpiles ( bug )
« Reply #1 on: February 11, 2013, 09:32:13 am »

Nice work.

Currently working on a modding option -- so far I've added [STOCKPILE_THREAD_METAL] to iron just to displace adamantine cloth / thread as the first option, but it looks like it needs a regen to work. If you do it on an active fortress, iron simply replaces adamantine as the single item in the list.

Yarn should be pretty simple to deal with merely by swapping the position of creature raws so that troll products appear before sheep products on the list.

The problem here is that enabling the first option on the list enables all options on the list and all option on the other lists, yes? So if all your silk stockpiles had the recluse spider option forbidden (and also the offending pig tail / sheep / adamantine options), they would act as their settings suggested?
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

Cerbsen

  • Bay Watcher
  • c is for butcher
    • View Profile
Re: HOW TO: Sort your cloth / thread / yarn / strands stockpiles ( bug )
« Reply #2 on: February 11, 2013, 11:56:16 am »

Nice work.

The problem here is that enabling the first option on the list enables all options on the list and all option on the other lists, yes? So if all your silk stockpiles had the recluse spider option forbidden (and also the offending pig tail / sheep / adamantine options), they would act as their settings suggested?

Yes. Enabling one "allow all thread (xy) / cloth(xy)" also enables the first list entry, thus allowing all thread/cloth available in the game on that stockpile.

Enabling "allow all thread (silk)" and then disable "brown recluse spider silk" creates a 100% correct working silk thread stockpile.
Same with "allow all cloth (yarn)" and disabling "sheep cloth".

Currently working on a modding option -- so far I've added [STOCKPILE_THREAD_METAL] to iron just to displace adamantine cloth / thread as the first option, but it looks like it needs a regen to work. If you do it on an active fortress, iron simply replaces adamantine as the single item in the list.

I've got no experience in editing the raws... but... adding [STOCKPILE_THREAD_METAL] to copper/iron/(whatever in list before adamantine) in "inorganic_metal.txt" fixed the "adamantine strands and one xy item only stockpile" after new world gen and new embark (tested with pig tails/wool and silk) by adding copper/iron/xy to the metal thread lists first entry.

Editing the raws in my running fortress did not work.
« Last Edit: February 12, 2013, 03:28:16 pm by Cerbsen »
Logged

Cerbsen

  • Bay Watcher
  • c is for butcher
    • View Profile
Re: !!SCIENCE!! Broken cloth / adamantine stockpiles - including raw fix
« Reply #3 on: February 11, 2013, 06:18:18 pm »

...tested the changed raws in a new fortress.
As far as i can tell the stockpiles are working correctly.

Here is a DFFD link to the savefile.
http://dffd.wimbli.com/file.php?id=7392

All kind of thread/cloth are prepared for further testing.
Logged

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: !!SCIENCE!! Broken cloth / adamantine stockpiles - including raw fix
« Reply #4 on: February 11, 2013, 09:10:54 pm »

Heh. Take a look at Uvash Sokantosid's thoughts screen...

But apart from that minor side effect, great work.
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

Cerbsen

  • Bay Watcher
  • c is for butcher
    • View Profile
Re: HOW TO: Sort your cloth / thread / yarn / strands stockpiles ( bug )
« Reply #5 on: February 11, 2013, 10:25:33 pm »

Currently working on a modding option -- so far I've added [STOCKPILE_THREAD_METAL] to iron just to displace adamantine cloth / thread as the first option, but it looks like it needs a regen to work. If you do it on an active fortress, iron simply replaces adamantine as the single item in the list.

After trying again i figured out adding [STOCKPILE_THREAD_METAL] to iron or another metal works fine with no need to regen new world.
You just have to disable cloth and enable it again to make both show up in the metal categories. ...doh!

Adding [USE_MATERIAL_TEMPLATE:THREAD:THREAD_PLANT_TEMPLATE] to plump helmets will fix pig tails.

In "creature_amphibians.txt" adding orange text to toads will fix silk/yarn by adding "toad silk yarn"   ???

Spoiler (click to show/hide)

Make sure "plump helmet fiber", "iron stands" and "toad silk yarn" are always disabled and every stockpile takes only what it should take.

And no... it is not possible to make iron strands, plump helmet thread or sheer toads after editing the raws... nor toads start shooting webs :P


Heh. Take a look at Uvash Sokantosid's thoughts screen...
yeah... i iike bugged stockpile fiber socks too... but toad silk wool socks are even better :D
« Last Edit: February 12, 2013, 03:27:48 pm by Cerbsen »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: !!SCIENCE!! Broken cloth / adamantine stockpiles - including raw fix
« Reply #6 on: February 12, 2013, 08:51:52 pm »

One of the DFHack devs has been looking into this problem, and it turns out it may be related to a problem I discovered back in version 0.31 where setting the "economy enabled" flag would cause the game to crash. Every single material in the game has a list of references in it to indicate what stockpile categories it belongs to, and these references are not being initialized properly (they're supposed to be -1, but they're getting uninitialized values that tend to be zero) - for stockpiling, the result is that the game thinks that every material is the first type of plant cloth, silk cloth, yarn cloth, or metal cloth (instead of not being one at all) for whatever types of cloth it isn't actually defined as being.

In theory, this problem should also show up with booze (enable Mead and you get all plant alcohol, enable Dwarven Wine and you get mead too) and extracts (enable Bark Scorpion Venom and you get all of the plant extracts, enable Dwarven Syrup and get all of the venoms and bloods too).

It should be possible to write a DFHack script/plugin to fix these lookup values and make cloth stockpiles work correctly again without having to define new materials.
« Last Edit: February 12, 2013, 08:57:48 pm by Quietust »
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: !!SCIENCE!! Broken cloth / adamantine stockpiles - including raw fix
« Reply #7 on: February 12, 2013, 09:01:06 pm »

Raw workaround for running forts

...or create a new file inside your "savegame/raw/objects/ folder and name it inorganic_pigironfix_dirty.txt containing:
Spoiler (click to show/hide)
Do NOT use this solution - if you do, it will corrupt your fortress and change every inorganic material into something else.
Changing the properties of existing raw objects is sometimes safe to do on existing fortresses, but adding new ones will almost never work correctly.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Cerbsen

  • Bay Watcher
  • c is for butcher
    • View Profile
Re: !!SCIENCE!! Broken cloth / adamantine stockpiles - including raw fix
« Reply #8 on: February 12, 2013, 11:28:50 pm »

Every single material in the game has a list of references in it to indicate what stockpile categories it belongs to, and these references are not being initialized properly (they're supposed to be -1, but they're getting uninitialized values that tend to be zero) - for stockpiling, the result is that the game thinks that every material is the first type of plant cloth, silk cloth, yarn cloth, or metal cloth (instead of not being one at all) for whatever types of cloth it isn't actually defined as being.

In theory, this problem should also show up with booze (enable Mead and you get all plant alcohol, enable Dwarven Wine and you get mead too) and extracts (enable Bark Scorpion Venom and you get all of the plant extracts, enable Dwarven Syrup and get all of the venoms and bloods too).

Makes sense since i noticed different wrong stockpile behavior under linux/windows.

The mead bug seems to be fixed.

Raw workaround for running forts

...or create a new file inside your "savegame/raw/objects/ folder and name it inorganic_pigironfix_dirty.txt containing:
Spoiler (click to show/hide)
Do NOT use this solution - if you do, it will corrupt your fortress and change every inorganic material into something else.
Changing the properties of existing raw objects is sometimes safe to do on existing fortresses, but adding new ones will almost never work correctly.

Are you sure about it? As i did not create a new raw object. I just altered the existing pig iron raw (the game seems to choose the last raw in case an entry is existing two times, first in inorganic_metals, second in inorganic_pigironfix_dirty.txt)
But it wouldn't work anyway, because i forgot the "inorganic_"(pigironfix_dirty) in the first column.
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: !!SCIENCE!! Broken cloth / adamantine stockpiles - including raw fix
« Reply #9 on: February 12, 2013, 11:38:24 pm »

the game seems to choose the last raw in case an entry is existing two times, first in inorganic_metals, second in inorganic_pigironfix_dirty.txt
Wrong - if you do that, the game will discard the second instance but keep counting as if it was still there, leading to all sorts of messed up behavior when referring to materials defined after it (doing the same sort of thing with creature raws is what leads to stuff like embarking as cave crocodiles).
« Last Edit: February 12, 2013, 11:40:13 pm by Quietust »
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

wierd

  • Bay Watcher
  • I like to eat small children.
    • View Profile
Re: !!SCIENCE!! Broken cloth / adamantine stockpiles - including raw fix
« Reply #10 on: February 12, 2013, 11:46:10 pm »

Duplicating inorganic raw entries results in boulders of abyssal gloom, gems made of miasma, and a whole lot of other weirdness!

Listen to Quietust! He's dead-on here!
Logged

Cerbsen

  • Bay Watcher
  • c is for butcher
    • View Profile
Re: !!SCIENCE!! Broken cloth / adamantine stockpiles - including raw fix
« Reply #11 on: February 12, 2013, 11:51:31 pm »

the game seems to choose the last raw in case an entry is existing two times, first in inorganic_metals, second in inorganic_pigironfix_dirty.txt
Wrong - if you do that, the game will discard the second instance but keep counting as if it was still there, leading to all sorts of messed up behavior when referring to materials defined after it (doing the same sort of thing with creature raws is what leads to stuff like embarking as cave crocodiles).

Nice to know... removed suggestion.
Logged