has any one found a base for meat, i want to increase the nutrition.
Meat, as well as corpses, have no XML counterpart. They all are created via C#, so no easy way to mod them.
I think it's possible with XML. The game checks if a certain animal has the useMeatFrom XML tag. If it does, it gives it the meat from that ThingDef. Otherwise, it will generate a new def for the animal's meat.
The def is generated so that it has a defName based on the creature's defName + "_Meat".
So cassowary meat would be <defName>Cassowary_Meat</defName>.
If you can get all the defs right you can change nutrition for the meat.
ThingDef thingDef = new ThingDef();
thingDef.resourceReadoutPriority = ResourceCountPriority.Middle;
thingDef.category = ThingCategory.Item;
thingDef.thingClass = typeof(ThingWithComps);
thingDef.graphicData = new GraphicData();
thingDef.graphicData.graphicClass = typeof(Graphic_Single);
thingDef.useHitPoints = true;
thingDef.selectable = true;
thingDef.SetStatBaseValue(StatDefOf.MaxHitPoints, 100f);
thingDef.altitudeLayer = AltitudeLayer.Item;
thingDef.stackLimit = 75;
thingDef.comps.Add(new CompProperties_Forbiddable());
CompProperties_Rottable compProperties_Rottable = new CompProperties_Rottable();
compProperties_Rottable.daysToRotStart = 2f;
compProperties_Rottable.rotDestroys = true;
thingDef.comps.Add(compProperties_Rottable);
thingDef.comps.Add(new CompProperties_FoodPoisoningChance());
thingDef.tickerType = TickerType.Rare;
thingDef.SetStatBaseValue(StatDefOf.Beauty, -30f);
thingDef.alwaysHaulable = true;
thingDef.rotatable = false;
thingDef.pathCost = 15;
thingDef.drawGUIOverlay = true;
thingDef.socialPropernessMatters = true;
thingDef.category = ThingCategory.Item;
thingDef.description = "MeatDesc".Translate(new object[]
{
current.label
});
thingDef.useHitPoints = true;
thingDef.SetStatBaseValue(StatDefOf.MaxHitPoints, 50f);
thingDef.SetStatBaseValue(StatDefOf.DeteriorationRate, 10f);
thingDef.BaseMarketValue = ThingDefGenerator_Meat.GetMeatMarketValue(current);
if (thingDef.thingCategories == null)
{
thingDef.thingCategories = new List<ThingCategoryDef>();
}
CrossRefLoader.RegisterListWantsCrossRef<ThingCategoryDef>(thingDef.thingCategories, "MeatRaw");
thingDef.ingestible = new IngestibleProperties();
thingDef.ingestible.foodType = FoodTypeFlags.Meat;
thingDef.ingestible.preferability = FoodPreferability.RawBad;
thingDef.ingestible.tastesRaw = true;
thingDef.ingestible.nutrition = 0.05f;
thingDef.ingestible.ingestEffect = EffecterDefOf.EatMeat;
thingDef.ingestible.ingestSound = SoundDef.Named("RawMeat_Eat");
if (current.race.fleshType == FleshType.Insectoid)
{
thingDef.ingestible.specialThoughtDirect = ThoughtDefOf.AteInsectMeatDirect;
thingDef.ingestible.specialThoughtAsIngredient = ThoughtDefOf.AteInsectMeatAsIngredient;
}
if (current.race.Humanlike)
{
thingDef.graphicData.texPath = "Things/Item/Resource/MeatFoodRaw/MeatHuman";
}
else
{
if (current.race.baseBodySize < 0.7f)
{
thingDef.graphicData.texPath = "Things/Item/Resource/MeatFoodRaw/MeatSmall";
}
else
{
thingDef.graphicData.texPath = "Things/Item/Resource/MeatFoodRaw/MeatBig";
}
thingDef.graphicData.color = current.race.meatColor;
}
thingDef.defName = current.defName + "_Meat";
if (current.race.meatLabel.NullOrEmpty())
{
thingDef.label = "MeatLabel".Translate(new object[]
{
current.label
});
}
else
{
thingDef.label = current.race.meatLabel;
}
thingDef.ingestible.sourceDef = current;
current.race.meatDef = thingDef;
yield return thingDef;
i thought of that but then i would have to make a meet for every animal or give similar races the same meat like canine meat or rodent meat i was just hoping for a easy fix =\
Oh right ... Clever! With like a big dictionary with all meat types listed?
Then you create an abstract/base for commodity and apply it to all of them...
Give me ideas for the corpses ...
Quote from: Simulacrum0 on October 24, 2016, 09:59:26 PM
i thought of that but then i would have to make a meet for every animal or give similar races the same meat like canine meat or rodent meat i was just hoping for a easy fix =\
... Or "detouring" (i'm not sure if it is the right term ... in the right place) this bit only :
thingDef.ingestible.nutrition = 0.05f;
I guess...
You can copy the entire meat generator in Visual Studio and compile it with that value changed. Having said that, it requires detouring to implement it in a mod and E will scoff at you.
Oh you know, me, I barely understand past the XML code (ex indy web-dev here - even if I don't like the term/word it's shorter ^^ - so XML files were easy to read when starting but that's all). The most advanced mod I've made (regarding those techniques) was just using one of CCL dll to add some "magic" to a storage-building mod (https://ludeon.com/forums/index.php?topic=23205) and I'm fiddling a bit with MFO (from the miniaturisation mod).
And I'm ok with E scoffing me (he already taught me a lot so I give him a free life-permit to) ;D