Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Standardized Material Mod.exe v2.0 (fixed)  (Read 341 times)

natemiddleman

  • Bay Watcher
    • View Profile
Standardized Material Mod.exe v2.0 (fixed)
« on: January 06, 2017, 04:45:17 pm »

FIXED ALCOHOL

http://dffd.bay12games.com/file.php?id=12612

Standardizes: wood, alcohol, meat, flour, leather, wool, silk, plant fiber, tallow, oil, and soap.

Here is the code below. You can use it if you want, but please at least credit me.

Code: [Select]
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Standardized_Material_Mod
{
    class Program
    {
        static void Main()
        {
            List<string> lines = new List<string>();
            string concatenate = "";
            string destination;
            string[] plant = Directory.GetFiles(@".\\raw\\objects\", "plant*");
            string[] tissue = Directory.GetFiles(@".\\raw\\objects\", "tissue*");
            string[] creature = Directory.GetFiles(@".\\raw\\objects\", "creature*");


            // Standardize Plant Products
            for (int i = 0; i < plant.Length; i++)
            {
                destination = plant[i];
                using (StreamReader file = new StreamReader(destination))
                {
                    string line;
                    while ((line = file.ReadLine()) != null)
                    {
                        concatenate = concatenate + line;
                    }
                }
                lines.Add(concatenate.Substring(0, concatenate.IndexOf("[")));
                while (concatenate.Contains("]"))
                {
                    if (1 + concatenate.IndexOf("]") - concatenate.IndexOf("[") > 0)
                    {
                        lines.Add(concatenate.Substring(concatenate.IndexOf("["), 1 + concatenate.IndexOf("]") - concatenate.IndexOf("[")));
                        concatenate = concatenate.Remove(concatenate.IndexOf("["), 1 + concatenate.IndexOf("]") - concatenate.IndexOf("["));
                    }
                    else
                    {
                        concatenate = concatenate.Remove(0, 1 + concatenate.IndexOf("]"));
                    }
                }
                using (StreamWriter file = new StreamWriter(destination))
                {
                    int j = 0;
                    while (j < lines.Count)
                    {
                        if (lines[j].Contains("PLANT:"))
                        {
                            // Standardize Wood, Drink, Thread, Oil, Soap, and Flour
                            int k = 1;
                            bool dye = false;
                            bool tree = false;
                            bool leaves = false;
                            while (j + k < lines.Count && !lines[j + k].Contains("PLANT:"))
                            {
                                if (lines[j + k].Contains("POWDER_DYE:"))
                                {
                                    dye = true;
                                }
                                if (lines[j + k].Contains("TREE:"))
                                {
                                    tree = true;
                                }
                                if (lines[j + k].Contains("ITEM_REACTION_PRODUCT:BAG_ITEM:PLANT_GROWTH:LEAVES:LOCAL_PLANT_MAT:LEAF"))
                                {
                                    leaves = true;
                                }
                                k++;
                            }
                            k = 1;
                            while (j + k < lines.Count && !lines[j + k].Contains("PLANT:"))
                            {
                                if (lines[j + k].Contains("TREE:LOCAL_PLANT_MAT:WOOD") ||
                                    lines[j + k].Contains("DRINK:LOCAL_PLANT_MAT:DRINK") ||
                                    lines[j + k].Contains("THREAD:LOCAL_PLANT_MAT:THREAD") ||
                                    lines[j + k].Contains("MATERIAL_REACTION_PRODUCT:DRINK_MAT:LOCAL_PLANT_MAT:DRINK") ||
                                    lines[j + k].Contains("MATERIAL_REACTION_PRODUCT:PRESS_LIQUID_MAT:LOCAL_PLANT_MAT:OIL") ||
                                    lines[j + k].Contains("MATERIAL_REACTION_PRODUCT:PRESS_PAPER_MAT:LOCAL_PLANT_MAT:THREAD") ||
                                    (lines[j + k].Contains("MILL:LOCAL_PLANT_MAT:MILL") && !dye))
                                {
                                    lines[j + k] = lines[j + k].Replace("LOCAL_PLANT_MAT", "PLANT_MAT:PLANT_PRODUCT");
                                }
                                if (lines[j + k].Contains("STATE_NAME_ADJ:ALL_SOLID:dimple dye"))
                                {
                                    lines[j + k] = lines[j + k].Replace("dimple", "blue");
                                }
                                if (lines[j + k].Contains("STATE_NAME_ADJ:ALL_SOLID:emerald dye"))
                                {
                                    lines[j + k] = lines[j + k].Replace("emerald", "green");
                                }
                                if (lines[j + k].Contains("STATE_NAME_ADJ:ALL_SOLID:redroot dye"))
                                {
                                    lines[j + k] = lines[j + k].Replace("redroot", "red");
                                }
                                if (lines[j + k].Contains("STATE_NAME_ADJ:ALL_SOLID:sliver dye"))
                                {
                                    lines[j + k] = lines[j + k].Replace("sliver", "black");
                                }
                                // Remove Tree Seeds
                                if (tree && (
                                    lines[j + k].Contains("MATERIAL_REACTION_PRODUCT:SEED_MAT:LOCAL_PLANT_MAT:SEED") ||
                                    lines[j + k].Contains("GROWTH_HAS_SEED") ||
                                    lines[j + k].Contains("SEED:")))
                                {
                                    lines.RemoveAt(j + k);
                                    k--;
                                }
                                // Remove Growths
                                if (lines[j + k].Contains("GROWTH:FLOWERS") ||
                                    lines[j + k].Contains("GROWTH:POD") ||
                                    lines[j + k].Contains("GROWTH:NUT") ||
                                    lines[j + k].Contains("GROWTH:SPATHES") ||
                                    lines[j + k].Contains("GROWTH:SEED") ||
                                    lines[j + k].Contains("GROWTH:CONE") ||
                                    lines[j + k].Contains("GROWTH:SEED_CONE") ||
                                    lines[j + k].Contains("GROWTH:SEED_CATKINS") ||
                                    lines[j + k].Contains("GROWTH:POLLEN_CONE") ||
                                    lines[j + k].Contains("GROWTH:POLLEN_CATKINS"))
                                {
                                    lines.RemoveAt(j + k);
                                    while (j + k < lines.Count && lines[j + k].Contains("GROWTH_"))
                                    {
                                        lines.RemoveAt(j + k);
                                    }
                                    k--;
                                }
                                if (!tree && !leaves && lines[j + k].Contains("GROWTH:LEAVES"))
                                {
                                    lines.RemoveAt(j + k);
                                    while (j + k < lines.Count && lines[j + k].Contains("GROWTH_"))
                                    {
                                        lines.RemoveAt(j + k);
                                    }
                                    k--;
                                }
                                // Remove Materials
                                if (lines[j + k].Contains("USE_MATERIAL_TEMPLATE:WOOD:") ||
                                    lines[j + k].Contains("USE_MATERIAL_TEMPLATE:DRINK:") ||
                                    lines[j + k].Contains("USE_MATERIAL_TEMPLATE:THREAD:") ||
                                    lines[j + k].Contains("USE_MATERIAL_TEMPLATE:OIL:") ||
                                    lines[j + k].Contains("USE_MATERIAL_TEMPLATE:SOAP:") ||
                                    (lines[j + k].Contains("USE_MATERIAL_TEMPLATE:MILL:") && !dye) ||
                                    (lines[j + k].Contains("USE_MATERIAL_TEMPLATE:SEED:") && tree) ||
                                    (lines[j + k].Contains("USE_MATERIAL_TEMPLATE:LEAF:") && !tree && !leaves) ||
                                    lines[j + k].Contains("USE_MATERIAL_TEMPLATE:FLOWER:"))
                                {
                                    lines.RemoveAt(j + k);
                                    while (j + k < lines.Count && (
                                        lines[j + k].Contains("STATE_NAME:") ||
                                        lines[j + k].Contains("STATE_NAME_ADJ:") ||
                                        lines[j + k].Contains("STATE_ADJ:") ||
                                        lines[j + k].Contains("STATE_COLOR:") ||
                                        lines[j + k].Contains("DISPLAY_COLOR:") ||
                                        lines[j + k].Contains("PREFIX:") ||
                                        lines[j + k].Contains("SOLID_DENSITY:") ||
                                        lines[j + k].Contains("MAT_FIXED_TEMP:") ||
                                        lines[j + k].Contains("MATERIAL_VALUE:") ||
                                        lines[j + k].Contains("EDIBLE_RAW") ||
                                        lines[j + k].Contains("EDIBLE_COOKED") ||
                                        lines[j + k].Contains("EDIBLE_VERMIN") ||
                                        lines[j + k].Contains("REACTION_CLASS:") ||
                                        lines[j + k].Contains("STOCKPILE_GLOB_PASTE") ||
                                        lines[j + k].Contains("STOCKPILE_PLANT_GROWTH")))
                                    {
                                        lines.RemoveAt(j + k);
                                    }
                                    k--;
                                }
                                // Make Seeds Inedible
                                if (lines[j + k].Contains("USE_MATERIAL_TEMPLATE:SEED:"))
                                {
                                    int l = 1;
                                    while (j + k + l < lines.Count && !lines[j + k + l].Contains("SEED:"))
                                    {
                                        if (lines[j + k + l].Contains("MATERIAL_VALUE:") ||
                                            lines[j + k + l].Contains("EDIBLE_VERMIN") ||
                                            lines[j + k + l].Contains("EDIBLE_RAW") ||
                                            lines[j + k + l].Contains("EDIBLE_COOKED") ||
                                            lines[j + k + l].Contains("STATE_COLOR:") ||
                                            lines[j + k + l].Contains("DISPLAY_COLOR:"))
                                        {
                                            lines.RemoveAt(j + k + l);
                                            l--;
                                        }
                                        l++;
                                    }
                                }
                                k++;
                            }
                        }
                        j++;
                    }
                    j = 0;
                    while (j < lines.Count)
                    {
                        if (lines[j].Contains("PLANT:"))
                        {
                            // Remove Plants Without A Useable Product
                            int k = 1;
                            bool useless = true;
                            while (j + k < lines.Count && !lines[j + k].Contains("PLANT:"))
                            {
                                if (lines[j + k].Contains("TREE:") ||
                                    lines[j + k].Contains("DRINK:") ||
                                    lines[j + k].Contains("THREAD:") ||
                                    lines[j + k].Contains("MILL:") ||
                                    lines[j + k].Contains("EDIBLE_RAW") ||
                                    lines[j + k].Contains("EDIBLE_COOKED") ||
                                    lines[j + k].Contains("GROWTH:LEAVES") ||
                                    lines[j + k].Contains("GROWTH:FRUIT:") ||
                                    lines[j + k].Contains("GROWTH:BUDS:") ||
                                    lines[j + k].Contains("GROWTH:BULB:") ||
                                    lines[j + k].Contains("GROWTH:HEART:") ||
                                    lines[j + k].Contains("USE_MATERIAL_TEMPLATE:EXTRACT:") ||
                                    lines[j + k].Contains("REACTION_CLASS:PAPER_PLANT:") ||
                                    lines[j + k].Contains("[GRASS]"))
                                {
                                    useless = false;
                                }
                                k++;
                            }
                            if (useless)
                            {
                                lines.RemoveAt(j);
                                while (j < lines.Count && !lines[j].Contains("PLANT:"))
                                {
                                    lines.RemoveAt(j);
                                }
                                j--;
                            }
                        }
                        j++;
                    }
                    for (j = 0; j < lines.Count; j++)
                    {
                        file.WriteLine(lines[j]);
                    }
                    concatenate = "";
                    lines.Clear();
                }
            }

            // Standardize Tissue
            for (int i = 0; i < tissue.Length; i++)
            {
                destination = tissue[i];
                using (StreamReader file = new StreamReader(destination))
                {
                    string line;
                    while ((line = file.ReadLine()) != null)
                    {
                        concatenate = concatenate + line;
                    }
                }
                lines.Add(concatenate.Substring(0, concatenate.IndexOf("[")));
                while (concatenate.Contains("]"))
                {
                    if (1 + concatenate.IndexOf("]") - concatenate.IndexOf("[") > 0)
                    {
                        lines.Add(concatenate.Substring(concatenate.IndexOf("["), 1 + concatenate.IndexOf("]") - concatenate.IndexOf("[")));
                        concatenate = concatenate.Remove(concatenate.IndexOf("["), 1 + concatenate.IndexOf("]") - concatenate.IndexOf("["));
                    }
                    else
                    {
                        concatenate = concatenate.Remove(0, 1 + concatenate.IndexOf("]"));
                    }
                }
                using (StreamWriter file = new StreamWriter(destination))
                {
                    for (int j = 0; j < lines.Count; j++)
                    {
                        if (lines[j].Contains("TISSUE_MATERIAL:LOCAL_CREATURE_MAT"))
                        {
                            lines[j] = lines[j].Replace("TISSUE_MATERIAL:LOCAL_CREATURE_MAT", "TISSUE_MATERIAL:CREATURE_MAT:CREATURE_PRODUCT");
                        }
                    }
                    for (int j = 0; j < lines.Count; j++)
                    {
                        file.WriteLine(lines[j]);
                    }
                    concatenate = "";
                    lines.Clear();
                }
            }

            // Standardize Animal Products
            for (int i = 0; i < creature.Length; i++)
            {
                destination = creature[i];
                using (StreamReader file = new StreamReader(destination))
                {
                    string line;
                    while ((line = file.ReadLine()) != null)
                    {
                        concatenate = concatenate + line;
                    }
                }
                lines.Add(concatenate.Substring(0, concatenate.IndexOf("[")));
                while (concatenate.Contains("]"))
                {
                    if (1 + concatenate.IndexOf("]") - concatenate.IndexOf("[") > 0)
                    {
                        lines.Add(concatenate.Substring(concatenate.IndexOf("["), 1 + concatenate.IndexOf("]") - concatenate.IndexOf("[")));
                        concatenate = concatenate.Remove(concatenate.IndexOf("["), 1 + concatenate.IndexOf("]") - concatenate.IndexOf("["));
                    }
                    else
                    {
                        concatenate = concatenate.Remove(0, 1 + concatenate.IndexOf("]"));
                    }
                }
                using (StreamWriter file = new StreamWriter(destination))
                {
                    // Standardize Tendons, Legaments, Blood, Ichor, Pus, Milk, and Silk
                    for (int j = 0; j < lines.Count; j++)
                    {
                        if (lines[j].Contains("TENDONS:LOCAL_CREATURE_MAT:SINEW") ||
                            lines[j].Contains("LIGAMENTS:LOCAL_CREATURE_MAT:SINEW") ||
                            lines[j].Contains("BLOOD:LOCAL_CREATURE_MAT:BLOOD") ||
                            lines[j].Contains("BLOOD:LOCAL_CREATURE_MAT:ICHOR") ||
                            lines[j].Contains("PUS:LOCAL_CREATURE_MAT:PUS") ||
                            lines[j].Contains("MILKABLE:LOCAL_CREATURE_MAT:MILK") ||
                            lines[j].Contains("WEBBER:LOCAL_CREATURE_MAT:SILK"))
                        {
                            lines[j] = lines[j].Replace("LOCAL_CREATURE_MAT", "CREATURE_MAT:CREATURE_PRODUCT");
                        }
                    }
                    // Standardize Wools
                    for (int j = 0; j < lines.Count; j++)
                    {
                        if (lines[j].Contains("[TISSUE_NAME:wool:NP]"))
                        {
                            lines.Insert(j + 1, "[TISSUE_MATERIAL:CREATURE_MAT:CREATURE_PRODUCT:WOOL]");
                        }
                    }
                    // Fix Troll Fur
                    for (int j = 0; j < lines.Count; j++)
                    {
                        if (lines[j].Contains("CREATURE:TROLL"))
                        {
                            int k = 1;
                            while (j + k < lines.Count && !lines[j + k].Contains("CREATURE:"))
                            {
                                if (lines[j + k].Contains("USE_TISSUE_TEMPLATE:IVORY:IVORY_TEMPLATE"))
                                {
                                    lines.Insert(j + k + 1, "[SELECT_TISSUE:HAIR]");
                                    lines.Insert(j + k + 2, "[TISSUE_NAME:fur:NP]");
                                    lines.Insert(j + k + 3, "[TISSUE_MATERIAL:CREATURE_MAT:CREATURE_PRODUCT:FUR]");
                                }
                                k++;
                            }
                        }
                    }
                    // Fix Wagon Wood
                    for (int j = 0; j < lines.Count; j++)
                    {
                        if (lines[j].Contains("TISSUE_MATERIAL:LOCAL_CREATURE_MAT:WOOD"))
                        {
                            lines[j] = lines[j].Replace("LOCAL_CREATURE_MAT", "PLANT_MAT:PLANT_PRODUCT");
                        }
                        if (lines[j].Contains("ITEMCORPSE:WOOD:NO_SUBTYPE:LOCAL_CREATURE_MAT:WOOD"))
                        {
                            lines[j] = lines[j].Replace("LOCAL_CREATURE_MAT", "PLANT_MAT:PLANT_PRODUCT");
                        }
                    }
                    // Remove Materials
                    for (int j = 0; j < lines.Count; j++)
                    {
                        if (lines[j].Contains("BODY_DETAIL_PLAN:STANDARD_MATERIALS") ||
                            lines[j].Contains("BODY_DETAIL_PLAN:CHITIN_MATERIALS"))
                        {
                            lines.RemoveAt(j);
                            j--;
                        }
                        if (lines[j].Contains("USE_MATERIAL_TEMPLATE:SKIN:SKIN_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:FAT:FAT_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:MUSCLE:MUSCLE_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:BONE:BONE_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:SHELL:SHELL_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:HORN:HORN_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:HOOF:HOOF_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:CARTILAGE:CARTILAGE_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:HAIR:HAIR_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:FEATHER:FEATHER_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:SCALE:SCALE_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:NAIL:NAIL_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:CLAW:NAIL_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:TALON:NAIL_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:TOOTH:TOOTH_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:IVORY:TOOTH_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:EYE:EYE_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:NERVE:NERVE_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:BRAIN:BRAIN_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:LUNG:LUNG_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:HEART:HEART_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:LIVER:LIVER_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:GUT:GUT_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:STOMACH:STOMACH_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:GIZZARD:GIZZARD_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:PANCREAS:PANCREAS_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:SPLEEN:SPLEEN_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:KIDNEY:KIDNEY_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:FLAME:FLAME_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:CHITIN:CHITIN_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:SPINE:NAIL_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:SPONGE:SPONGE_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:SINEW:SINEW_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:BLOOD:BLOOD_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:ICHOR:ICHOR_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:PUS:PUS_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:LEATHER:LEATHER_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:PARCHMENT:PARCHMENT_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:TALLOW:TALLOW_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:SOAP:SOAP_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:MILK:MILK_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:CHEESE:CREATURE_CHEESE_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:SILK:SILK_TEMPLATE") ||
                            lines[j].Contains("USE_MATERIAL_TEMPLATE:WOOD:WOOD_TEMPLATE") ||
                            lines[j].Contains("SELECT_MATERIAL:") ||
                            lines[j].Contains("REMOVE_MATERIAL:"))
                        {
                            lines.RemoveAt(j);
                            while (j < lines.Count && (
                                lines[j].Contains("STATE_NAME:") ||
                                lines[j].Contains("STATE_ADJ:") ||
                                lines[j].Contains("STATE_COLOR:") ||
                                lines[j].Contains("PREFIX:") ||
                                lines[j].Contains("YARN")))
                            {
                                lines.RemoveAt(j);
                            }
                            j--;
                        }
                    }
                    for (int j = 0; j < lines.Count; j++)
                    {
                        file.WriteLine(lines[j]);
                    }
                    concatenate = "";
                    lines.Clear();
                }
            }
« Last Edit: January 16, 2017, 12:12:11 pm by natemiddleman »
Logged

natemiddleman

  • Bay Watcher
    • View Profile
Re: Standardized Material Mod.exe v2.0
« Reply #1 on: January 06, 2017, 04:46:04 pm »

continued ...

Code: [Select]
            // Create standardized grass file
            using (StreamWriter file = new StreamWriter(".\\raw\\objects\\plant_grasses.txt"))
            {
                file.WriteLine("plant_grasses\n");
                file.WriteLine("\n");
                file.WriteLine("[OBJECT:PLANT]\n");
                file.WriteLine("\n");
                file.WriteLine("[PLANT:GRASS]\n");
                file.WriteLine(" [ALL_NAMES:grass]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]\n");
                file.WriteLine(" [BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]\n");
                file.WriteLine(" [GRASS]\n");
                file.WriteLine(" [GRASS_TILES:'.':',':'`':''']\n");
                file.WriteLine(" [GRASS_COLORS:2:0:1:2:0:0:6:0:1:6:0:0]\n");
                file.WriteLine(" [WET]\n");
                file.WriteLine(" [DRY]\n");
                file.WriteLine(" [BIOME:ANY_GRASSLAND]\n");
                file.WriteLine(" [BIOME:ANY_SAVANNA]\n");
                file.WriteLine(" [BIOME:ANY_SHRUBLAND]\n");
                file.WriteLine(" [BIOME:ANY_FOREST]\n");
                file.WriteLine(" [BIOME:ANY_WETLAND]\n");
                file.WriteLine(" [BIOME:MOUNTAIN]\n");
                file.WriteLine(" [BIOME:TUNDRA]\n");
                file.WriteLine(" [BIOME:TAIGA]\n");
                file.WriteLine("\n");
                file.WriteLine("[PLANT:CAVE MOSS]\n");
                file.WriteLine(" [ALL_NAMES:cave moss]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]\n");
                file.WriteLine(" [BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]\n");
                file.WriteLine(" [GRASS]\n");
                file.WriteLine(" [GRASS_TILES:'.':',':'`':''']\n");
                file.WriteLine(" [GRASS_COLORS:3:0:1:3:0:0:3:0:0:0:0:1]\n");
                file.WriteLine(" [WET]\n");
                file.WriteLine(" [DRY]\n");
                file.WriteLine(" [BIOME:SUBTERRANEAN_WATER]\n");
                file.WriteLine(" [UNDERGROUND_DEPTH:1:3]\n");
            }

            // Create standardized plant template
            using (StreamWriter file = new StreamWriter(".\\raw\\objects\\plant_smm.txt"))
            {
                file.WriteLine("plant_smm\n");
                file.WriteLine("\n");
                file.WriteLine("[OBJECT:PLANT]\n");
                file.WriteLine("\n");
                file.WriteLine("// standardized plant products\n");
                file.WriteLine("[PLANT:PLANT_PRODUCT]\n");
                file.WriteLine(" [NAME:plant][NAME_PLURAL:plants]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:WOOD:WOOD_TEMPLATE]\n");
                file.WriteLine(" [SOLID_DENSITY:600]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]\n");
                file.WriteLine(" [STATE_NAME_ADJ:ALL_SOLID:frozen alcohol]\n");
                file.WriteLine(" [STATE_NAME_ADJ:LIQUID:alcohol]\n");
                file.WriteLine(" [STATE_NAME_ADJ:GAS:boiling alcohol]\n");
                file.WriteLine(" [MATERIAL_VALUE:2]\n");
                file.WriteLine(" [EDIBLE_RAW]\n");
                file.WriteLine(" [EDIBLE_COOKED]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:MILL:PLANT_POWDER_TEMPLATE]\n");
                file.WriteLine(" [STATE_NAME_ADJ:ALL_SOLID:flour]\n");
                file.WriteLine(" [MATERIAL_VALUE:20]\n");
                file.WriteLine(" [EDIBLE_VERMIN]\n");
                file.WriteLine(" [EDIBLE_COOKED]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:THREAD:THREAD_PLANT_TEMPLATE]\n");
                file.WriteLine(" [STATE_NAME_ADJ:SOLID_PASTE:slurry]\n");
                file.WriteLine(" [STATE_NAME_ADJ:SOLID_PRESSED:paper]\n");
                file.WriteLine(" [REACTION_CLASS:PAPER_SLURRY]\n");
                file.WriteLine(" [STOCKPILE_GLOB_PASTE]\n");
                file.WriteLine(" [DO_NOT_CLEAN_GLOB]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:OIL:PLANT_OIL_TEMPLATE]\n");
                file.WriteLine(" [MATERIAL_VALUE:5]\n");
                file.WriteLine(" [MATERIAL_REACTION_PRODUCT:SOAP_MAT:CREATURE_MAT:CREATURE_PRODUCT:SOAP]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
            }

            // Create standardized creature template
            using (StreamWriter file = new StreamWriter(".\\raw\\objects\\creature_smm.txt"))
            {
                file.WriteLine("creature_smm\n");
                file.WriteLine("\n");
                file.WriteLine("[OBJECT:CREATURE]\n");
                file.WriteLine("\n");
                file.WriteLine("// standardized animal products\n");
                file.WriteLine("[CREATURE:CREATURE_PRODUCT]\n");
                file.WriteLine(" [NAME:animal:animals:animal]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:SKIN:SKIN_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:FAT:FAT_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:MUSCLE:MUSCLE_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:BONE:BONE_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:SHELL:SHELL_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:HORN:HORN_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:HOOF:HOOF_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:CARTILAGE:CARTILAGE_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:HAIR:HAIR_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:FEATHER:FEATHER_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:SCALE:SCALE_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:NAIL:NAIL_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:CLAW:NAIL_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:TALON:NAIL_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:TOOTH:TOOTH_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:IVORY:TOOTH_TEMPLATE]\n");
                file.WriteLine(" [STATE_NAME:ALL_SOLID:ivory]\n");
                file.WriteLine(" [STATE_ADJ:ALL_SOLID:ivory]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:EYE:EYE_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:NERVE:NERVE_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:BRAIN:BRAIN_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:LUNG:LUNG_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:HEART:HEART_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:LIVER:LIVER_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:GUT:GUT_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:STOMACH:STOMACH_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:GIZZARD:GIZZARD_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:PANCREAS:PANCREAS_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:SPLEEN:SPLEEN_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:KIDNEY:KIDNEY_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:FLAME:FLAME_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:CHITIN:CHITIN_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:SPINE:NAIL_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:SPONGE:SPONGE_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:SINEW:SINEW_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:BLOOD:BLOOD_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:ICHOR:ICHOR_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:PUS:PUS_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:LEATHER:LEATHER_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:PARCHMENT:PARCHMENT_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:TALLOW:TALLOW_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:SOAP:SOAP_TEMPLATE]\n");
                file.WriteLine(" [STATE_NAME_ADJ:ALL_SOLID:soap]\n");
                file.WriteLine(" [STATE_NAME_ADJ:LIQUID:melted soap]\n");
                file.WriteLine(" [STATE_NAME_ADJ:GAS:n/a]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:MILK:MILK_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:CHEESE:CREATURE_CHEESE_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:SILK:SILK_TEMPLATE]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:WOOL:HAIR_TEMPLATE]\n");
                file.WriteLine(" [STATE_NAME:ALL_SOLID:wool]\n");
                file.WriteLine(" [STATE_ADJ:ALL_SOLID:wool]\n");
                file.WriteLine(" [YARN]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [USE_MATERIAL_TEMPLATE:FUR:HAIR_TEMPLATE]\n");
                file.WriteLine(" [STATE_NAME:ALL_SOLID:fur]\n");
                file.WriteLine(" [STATE_ADJ:ALL_SOLID:fur]\n");
                file.WriteLine(" [YARN]\n");
                file.WriteLine(" [PREFIX:NONE]\n");
                file.WriteLine(" [SELECT_MATERIAL:ALL]\n");
                file.WriteLine(" [ARENA_RESTRICTED]\n");
                file.WriteLine(" [DOES_NOT_EXIST]\n");
            }
        }
    }
}
« Last Edit: January 06, 2017, 04:48:28 pm by natemiddleman »
Logged

Gwolfski

  • Bay Watcher
  • Strawberries!
    • View Profile
    • ignore pls!
Re: Standardized Material Mod.exe v2.0
« Reply #2 on: January 06, 2017, 08:10:29 pm »

I think you'd get more attention in the modding subforum. Mod looks useful, though.
Logged
why kill elves if you could torture them, make them betray their friends, denounce their "force", make them watch trees being chopped down, feed them meat and throw them in magma as a sacrifice for almighty Armok?

Help us bring the pixel wars forum back to life! (dead) http://picturewars.net/forum/showthread.php?tid=195&pid=59474#pid59474

Bumber

  • Bay Watcher
  • #pragma magma #include <dwarves>
    • View Profile
Re: Standardized Material Mod.exe v2.0
« Reply #3 on: January 07, 2017, 03:17:18 pm »

Does this account for nether cap, fire imp leather, etc.?
Logged
THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. Was this inevitable (Y/N)?

CrocAndBearLover

  • Bay Watcher
    • View Profile
Re: Standardized Material Mod.exe v2.0
« Reply #4 on: January 09, 2017, 05:55:01 am »

Allow me to report a bug. It seems that alcohol standardisation doesn't work right.

Spoiler: Image 1 (click to show/hide)

Spoiler: Image 2 (click to show/hide)

Also, can you make it allow to select what materials you want to standardise?
Logged
CrocAndBearLover prefers to consume meat dumplings, tea with milk, and a milkshake. He likes crocodiles for their teeth, bears for their fur, Admiral Zhao for his sideburns, and elves for their astonishing stupidity. He absolutely detests sharks.

A medium-sized creature which suffers from paranoia.

Quote from: Cinder
To continue your dynasty, you must be willing to do the nasty.

natemiddleman

  • Bay Watcher
    • View Profile
Re: Standardized Material Mod.exe v2.0
« Reply #5 on: January 14, 2017, 05:56:10 pm »

Odd, can u please upload the /raw/objects folder to dffd so I can take a look. Someone else mentioned a similar bug, but I have never been able to reproduce it and he didn't upload it to dffd so I could take a look. I have been thinking about how to add options to the mod, but I just haven't had the time to implement it. Something simple like "Standardize Wood (y/n):" in the console.
Logged

Ghills

  • Bay Watcher
    • View Profile
Re: Standardized Material Mod.exe v2.0
« Reply #6 on: January 15, 2017, 02:17:20 pm »

Brilliant! With the code, it should be compatible with games that have mods installed, right? Because it's just taking what exists already and modifying that instead of distributing a set of raws.

One question - does this need to be done before generating a world, or can it be done post generation?
Logged
I AM POINTY DEATH INCARNATE
Ye know, being an usurper overseer gone mad with power isn't too bad. It's honestly not that different from being a normal overseer.
To summarize:
They do an epic face. If that fails, they beat said object to death with their beard.

CrocAndBearLover

  • Bay Watcher
    • View Profile
Re: Standardized Material Mod.exe v2.0
« Reply #7 on: January 16, 2017, 04:28:19 am »

Odd, can u please upload the /raw/objects folder to dffd so I can take a look. Someone else mentioned a similar bug, but I have never been able to reproduce it and he didn't upload it to dffd so I could take a look. I have been thinking about how to add options to the mod, but I just haven't had the time to implement it. Something simple like "Standardize Wood (y/n):" in the console.

Link

Also, this save file is without fortress running, so just quickly embark with some plump helmets and wood (and empty barrels) to construct still and test the alcohol standardization.
Logged
CrocAndBearLover prefers to consume meat dumplings, tea with milk, and a milkshake. He likes crocodiles for their teeth, bears for their fur, Admiral Zhao for his sideburns, and elves for their astonishing stupidity. He absolutely detests sharks.

A medium-sized creature which suffers from paranoia.

Quote from: Cinder
To continue your dynasty, you must be willing to do the nasty.

natemiddleman

  • Bay Watcher
    • View Profile
Re: Standardized Material Mod.exe v2.0
« Reply #8 on: January 16, 2017, 11:30:50 am »

Odd, can u please upload the /raw/objects folder to dffd so I can take a look. Someone else mentioned a similar bug, but I have never been able to reproduce it and he didn't upload it to dffd so I could take a look. I have been thinking about how to add options to the mod, but I just haven't had the time to implement it. Something simple like "Standardize Wood (y/n):" in the console.

Link

Also, this save file is without fortress running, so just quickly embark with some plump helmets and wood (and empty barrels) to construct still and test the alcohol standardization.

Missing one line of code  :-\

lines[j + k].Contains("MATERIAL_REACTION_PRODUCT:DRINK_MAT:LOCAL_PLANT_MAT:DRINK") ||

Thanks for letting me know. I uploaded the fixed version to dffd.
« Last Edit: January 16, 2017, 10:58:59 pm by natemiddleman »
Logged

natemiddleman

  • Bay Watcher
    • View Profile
Re: Standardized Material Mod.exe v2.0
« Reply #9 on: January 16, 2017, 11:56:58 am »

Brilliant! With the code, it should be compatible with games that have mods installed, right? Because it's just taking what exists already and modifying that instead of distributing a set of raws.

One question - does this need to be done before generating a world, or can it be done post generation?

It needs to be done before generating the world. As long as a mod uses the standard creature and plant format, this mod should be compatible with it. It should also be compatible with all graphics packs, which is the reason I made it in the first place.
Logged