[A16,CIB] Tastes like chicken!

Started by RawCode, February 21, 2017, 04:55:10 AM

Previous topic - Next topic

RawCode

Very very simple modification suggested few days ago.
It replaces ALL raw meat objects with raw chicken meat, including human.

Actually designed as fallback handler for modversion transfering, but can be used for fun.

It called "singleliner" for reason, i chip code from larger project, to keep individual uploads clean from unrelated code.

Payload is :

public static Thing __REJIT_MakeThing(ThingDef def, ThingDef stuff)
{
if (stuff != null && !stuff.IsStuff)
{
Log.Error(string.Concat(new object[]
{
"MakeThing error: Tried to make ",
def,
" from ",
stuff,
" which is not a stuff. Assigning default."
}));
stuff = GenStuff.DefaultStuffFor(def);
}
if (def.MadeFromStuff && stuff == null)
{
Log.Error("MakeThing error: " + def + " is madeFromStuff but stuff=null. Assigning default.");
stuff = GenStuff.DefaultStuffFor(def);
}
if (!def.MadeFromStuff && stuff != null)
{
Log.Error(string.Concat(new object[]
{
"MakeThing error: ",
def,
" is not madeFromStuff but stuff=",
stuff,
". Setting to null."
}));
stuff = null;
}


if (def.ingestible != null)
if (def.ingestible.foodType == FoodTypeFlags.Meat)
def = DefDatabase<ThingDef>.GetNamed ("Chicken_Meat",false);

Thing thing;

try
{
thing = (Thing)Activator.CreateInstance(def.thingClass);
}catch
{
Dictionary<Def,ModContentPack> test = new Dictionary<Def,ModContentPack> ();
foreach (ModContentPack tz in LoadedModManager.RunningMods)
{
foreach (Def gh in tz.AllDefs)
{
test [gh] = tz;
}
}

throw new Exception (def.defName + " have invalid thingclass owner is " + test[def].Name);
};

thing.def = def;
thing.SetStuffDirect(stuff);
thing.PostMake();
return thing;
}


[attachment deleted by admin due to age]

Bunkier

This should be a part of mod that changes rimworld into Rust (there is nothing like that yet) :D

RawCode

this payload can be used to "convert" any object into any other object, it also can be used to dynamically modify objects, like altering object class without altering def record.