In search of right class

Started by Oiltanker, February 04, 2016, 10:52:16 AM

Previous topic - Next topic

Oiltanker

I was looking for a class in the source code of the game that is responsible for creating a new object after it was crafted on the worktable. Unfortunatelly I didn't manage to find it. Please, can someone help in finding it?

*I wanted to make custom class that would include reflection so that I could change attributes of the created object. I also planned to make custom recipe class so that it would contain xml tag that would specify value for the attribute I want to change.

Haplo

What you're searching for is in Toils_Recipe.
In there is the Toil public static Toil FinishRecipeAndStartStoringProduct()
which includes this part:
List<Thing> list = GenRecipe.MakeRecipeProducts(curJob.RecipeDef, actor, ingredients, dominantIngredient).ToList<Thing>();
and this
if (!GenPlace.TryPlaceThing(list[i], actor.Position, ThingPlaceMode.Near))

Hope this helps? :)

Oiltanker

Thanks. By the away I already scanned stack for methods that call object creation (see the screen I attached). But how can I create custom recipedef class that would call my specific class inherited from Toils_Recipe that would use reflection to set attribute value to a created object? Can you help me with that, or just explain how can I work it out myself?

[attachment deleted by admin - too old]