Help overriding the food system by mod.

Started by 1000101, May 06, 2015, 12:19:31 AM

Previous topic - Next topic

soltysek

but realy i do not understand all shit about dispencer personaly i did not use it in a game even once i think i buil it once and only becouse i did not know yet whots that :)

1000101

The idea here is that the dispenser can be upgraded to better versions and more than one version of a dispenser can exist.  So you could have small dispensers which only serve small meals, for example, and/or another dispenser which can do various meals (including sythahol), etc.

To do this, the dispenser has to accurately report what it can make at a given time, ie, can it do fine meals but only has enough ingredients available for nutrient sludge?  Either way it has to report the meal it will make so the decision tree can properly choose between the dispenser which can do fine meals, the dispenser which can only do paste right now and the simple meal on the floor.  There are other things it needs to report/do as well in this process but for illustration purposes I think the above suffices.

If I can get this to work one way or the other, the dispenser will actually be a useful alternative to large kitchens and pawns cooking.  I built a dispenser in one colony and the only thing it saved was time cooking, the mood debuff and it's enormous size made it useless though.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

soltysek

unfortunetly i did not play with toils yet but do you realy need to touch it ?? is just beaking in think tree with custom jobdrivers befor normal dispencer round will not be enought ?? i never look in ther becous i did not need so i do not know anything about toils beside that i know that ther is something like it ,but nothing whot for and so one.

soltysek

there is also one more way becouse a game is mod frendly ask TYNAN to add a hook class betwin building_nutriet and building class i use this trick in my steam part of mod this class is a kind of dummy without any method  but if i need to hook to something i just hook to this class its holding basic information i need and i dont need to wory about whot exacly is standing here . or extend posibilites to mod nutrietdispencer ...
SO .. O great TYNAN pls add suport for moders for your great nutrietpaste becouse we cannot modify it properly . :) Amen

mrofa

So apart from new dispenser, you can do rest of the things i think
My basic workaround is that replace the paste meal class with custom one, which would do all the thing you want.
On spawn the meal would look for nearest dispenser. After that it would look for hoppers around that dispenser.
Custom hoppers would have a bool variable if its active or not. If it would be active, then meal would check the hopper contents and to the stuff with them, and dependable on all that stuff, meal would destroy itself and spawn a proper meal.
This is my theory :D

All i do is clutter all around.

soltysek

i thing i get whot you mean BUT this way system will still see nasty nutrietpaste in getbestfood as foodutility round so is useless this type of mod will req rewrite whole food menagment system and as long as we will not get proper tool for it or hole to hook up we need to inject class replace or rewrite whole AI system with food menagment 

To binary i will look at it after weekend i'm preety busy this weekend

To TYNAN .... o GOD please make a hooking spot so we can hook our custom class in getbestfood loop .

1000101

Yeah, I've been monkeying around and I found you're supposed to use MethodBase.MethodHandle.GetFunctionPointer() instead of RuntimeHelpers.PrepareMethod( MethodBase.MethodHandle ) except...it doesn't work either.  I've done self-modifying code and code injection with other development platforms (c, asm, x86, arm) and other tool chains (gnu) but I don't know enough about the C# lexer and emitter to know what my code is being translated into.  If I knew what it's producing, I could figure this out but my usual tools for debugging and disassembling just produce huge amount of wtf garbage.  RimWorld disassembled to 57M of crappy x86 assembly which was of no help.

It would be really nice if Tynan moved the code from the classes referencing the NPD directly into the NPD and used functions (public virtual please) in the NPD so we can mod the NPD and hopper system without potential unsafe code changing references the game assumes are otherwise static or using dirty work-around-hacks like I'm attempting.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

mrofa

I think it would good if we look thrugh the code and write to tynan what stuff need tag specific hooks.
Simply becouse he dont get engouh spam mail ^^
All i do is clutter all around.

1000101

Yeah, I'll look through the code and see where/what changes would need to be made to accomplish the desired effect.  The changes are minimal the problem is from the modders side it's not practicable.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

isistoy

I would possibly ask for Factory classes to instanciate some of the classes in the object tree, so that the game engine would allow external types to replace existing ones (at our own risks, of course) with just a few xmls and without injecting anything...
Now the complete instantiation of these would have to be rewritten! Quite the request!
<Stay on the scene like a State machine>