What is the funtion of <targetCountAdjustment></targetCountAdjustment> ?

Started by Krzarb, March 22, 2017, 11:06:57 PM

Previous topic - Next topic

Krzarb

I'm making a mod for my own personal use that allows me to craft mortar shells in a bulk amount. The only line in the def for the mortar shell that confuses me is <targetCountAdjustment>5</targetCountAdjustment>. Can anyone shed some light on the function that this line performs? Cheers! 

daman2501

take this as a grain of salt, but i think thats the damage area
YOU`RE DA-MAN!!!

RawCode

1) extract sources of game (dnspy)
2) run search over source with targetCountAdjustment as keyword
3) ???
4) profit!

and this value is absolutely completely unrelated to damage area

Granitecosmos

Quote from: Krzarb on March 22, 2017, 11:06:57 PM
Can anyone shed some light on the function that this line performs?

<targetCountAdjustment>5</targetCountAdjustment>


That line changes the amount of output items to the number provided. For the Mortar Shells, it means every time the recipe is completed you get 5 Mortar Shells instead of the default one. You can find another example in the same xml file; in the abstract MakeStoneBlocksBase recipeDef, the output is set to 20. This is why you get 20 stone blocks per chunk.
Nope.

Krzarb

Thanks for the help Granitecosmos. I've tested mortar shell production in game, and you definitely don't get five mortar shells each time you complete the recipe, just one. So I'm kinda stumped as to what targetCountAdjustment actually does. I've basically made a recipe def for bulk production of mortar shells, listing the machining table as the recipe user, and it works fine. I can input 100 steel and it'll produce 10 mortar shells. I just left the line about targetCountAdjustment in the recipe and it doesn't seem to do any harm, but I'd still like to know what it does! Also, thanks for your mod that adds sunrise, I'm enjoying using it at the moment.

Krzarb

Quote from: RawCode on March 23, 2017, 03:47:59 AM
1) extract sources of game (dnspy)
2) run search over source with targetCountAdjustment as keyword
3) ???
4) profit!

and this value is absolutely completely unrelated to damage area

Thanks. I'll preface by saying that I have zero experience with looking at this sort of code. I've only dabbled so far with looking at and modifying xml's. However, I downloaded Dnspy and ran the search as you suggested, and could only find one line mentioning targetCountAdjustment, and I couldn't make anything useful out of it. Thanks for the suggestion though :)

Granitecosmos

Quote from: Krzarb on March 23, 2017, 07:55:32 AM
I'd still like to know what it does!

Actually, you're right. It doesn't do that, stone blocks are specified at the respective chunks' defs. Now that I start thinking about this specific line, I do remember something. About a year ago I wanted to modify the Mortar Shell recipe too. I never actually figured out what it did.

Taking a quick glance at the source via ILSpy reveals that it does... nothing? It only surfaces once in the RecipeDef class where it's defined as a public integer and set value to 1. I can't finy any other mention of it. I believe this to be obsolete code not used anymore... But I'm not a programmer so the final verdict is "I have no idea".

RawCode please help us out.

Rikiki

Once you have found the definition, use the "Analyze" or "Call hierarchy" option to find where this parameter is used.
In this case, this variable is used in the bill interface (RimWorld.Bill_Production.DoConfigInterface function): each time you click on the '+' button, the bill target count will be incremented by this number.

Krzarb


Granitecosmos

Quote from: Rikiki on March 23, 2017, 06:48:10 PM
Once you have found the definition, use the "Analyze" or "Call hierarchy" option to find where this parameter is used.
In this case, this variable is used in the bill interface (RimWorld.Bill_Production.DoConfigInterface function): each time you click on the '+' button, the bill target count will be incremented by this number.

Damn, never noticed that. Thanks for the info. I have no experience with C# or programming, didn't even know I can analyze a parameter like that. I'll make sure I remember that for the future.

RawCode

you will not develop any skills as long as not ever trying to do something self.

downloading dnspy and extracting sources of game do not need any skills
just like downloading notepad++ and running search over filesystem

just try and you will notice, that path already beaten by other people and you just need to follow yellow bricks.

Krzarb

Quote from: RawCode on March 23, 2017, 09:53:05 PM
you will not develop any skills as long as not ever trying to do something self.

downloading dnspy and extracting sources of game do not need any skills
just like downloading notepad++ and running search over filesystem

just try and you will notice, that path already beaten by other people and you just need to follow yellow bricks.

Thanks Rawcode, but Rikiki already provided the help needed. If you'll read further back in the thread (reply #5), both myself and Granitecosmos did both actually extract the files and attempt to look at them, we just didn't realise that you could use the analyse function on the definition. I am inexperienced with c#, but did the best I could.

Granitecosmos

Quote from: RawCode on March 23, 2017, 09:53:05 PM
you will not develop any skills as long as not ever trying to do something self.

downloading dnspy and extracting sources of game do not need any skills
just like downloading notepad++ and running search over filesystem

just try and you will notice, that path already beaten by other people and you just need to follow yellow bricks.

There isn't any truly proper tutorial/introduction to C# modding for Rimworld that actually tells about the basics. I've tried, can't blame me for not knowing there's an "Analyze" option in ILSpy/dnSpy. How should I know that off the bat, huh?

You're just being an ass at this point. You know that, right? No spoonfeeding is one thing. I've done what you told me to, found nothing of value, because you actually didn't properly tell me what to do, unlike Rikiki. You can't expect me to know how to use a program I have no experience with, you can't expect anyone trying to get into modding to be a skilled programmer. I have the source code extraced on my hard drive, doesn't make it any easier.

Any help thread you pop in, you give some vague advice that only helps people that already know enough about C# programming that they actually understand these references. You scare off potential new modders with your attitude. Oh look, that guy wants to do some easy xml editing and asks for help! Let's throw C# at him, it surely will encourage him to continue.

I'm not asking you to write code for me, I'm asking you to point me in the right direction, preferably served in a format that can be understood by non-programmers like myself. Jeez.

Sorry for the rant, that was contained in me for some time. You really should try to be a bit more beginner-friendly.

Krzarb

Quote from: Granitecosmos on March 23, 2017, 10:53:06 PM
Quote from: RawCode on March 23, 2017, 09:53:05 PM
you will not develop any skills as long as not ever trying to do something self.

downloading dnspy and extracting sources of game do not need any skills
just like downloading notepad++ and running search over filesystem

just try and you will notice, that path already beaten by other people and you just need to follow yellow bricks.

There isn't any truly proper tutorial/introduction to C# modding for Rimworld that actually tells about the basics. I've tried, can't blame me for not knowing there's an "Analyze" option in ILSpy/dnSpy. How should I know that off the bat, huh?

You're just being an ass at this point. You know that, right? No spoonfeeding is one thing. I've done what you told me to, found nothing of value, because you actually didn't properly tell me what to do, unlike Rikiki. You can't expect me to know how to use a program I have no experience with, you can't expect anyone trying to get into modding to be a skilled programmer. I have the source code extraced on my hard drive, doesn't make it any easier.

Any help thread you pop in, you give some vague advice that only helps people that already know enough about C# programming that they actually understand these references. You scare off potential new modders with your attitude. Oh look, that guy wants to do some easy xml editing and asks for help! Let's throw C# at him, it surely will encourage him to continue.

I'm not asking you to write code for me, I'm asking you to point me in the right direction, preferably served in a format that can be understood by non-programmers like myself. Jeez.

Sorry for the rant, that was contained in me for some time. You really should try to be a bit more beginner-friendly.

I agree, I found the advice entirely unhelpful and a little off-putting. This is the first time I've asked for advice on this forum, and I don't really appreciate the condescension

RawCode

wild "condescension" argument appears, local godwin's law after all.

this marks unconditional end of discussion.

and "that topic" reference, well, today people are unable to use google to ask about words they don't understand, who may know what "asking astral about xml and code" means?