Breakdown chance folder?

Started by arigon2001, May 26, 2017, 09:06:15 PM

Previous topic - Next topic

arigon2001

Spent prob a solid hour looking into what I thought was all the folders for incident defs to find the Breakdown chance as I desire to make changes to it. Does anyone happen to know the path / folder this is in?

Cheers!

makkenhoff

#1
It appears (keeping in mind I've not messed with code for RimWorld) this looks like the flag for determining if can break down.
<li Class="CompProperties_Breakdownable"/>
However - I cannot find anything in Defs that suggests it is editable, I would have expected the storyteller to have the option in the xml.  But I came up empty on how to affect the chance. It might be hard coded, in one of the .cs files, or under a different than I'd have expected name.

arigon2001

Quote from: makkenhoff on May 26, 2017, 09:42:30 PM
It appears (keeping in mind I've not messed with code for RimWorld) this looks like the flag for determining if can break down.
<li Class="CompProperties_Breakdownable"/>
However - I cannot find anything in Defs that suggests it is editable, I would have expected the storyteller to have the option in the xml.  But I came up empty on how to affect the chance. It might be hard coded, in one of the .cs files, or under a different than I'd have expected name.

I know a mod was created that allows you to maintain stuff that requires components in order to basically stop the breakdown from occurring, however I wanted to adjust the chance of breakdown overall as it would still use up components. Hoping @Tynan see's this post and can verify if it is indeed hard coded or if I overlooked it, where is it exactly.

Alistaire

You could make your own CompBreakdownable with different chance calculations. The base game uses this method for the breakdown chance:

// RimWorld.CompBreakdownable
public void CheckForBreakdown()
{
if (this.CanBreakdownNow() && Rand.MTBEventOccurs(1.368E+07f, 1f, 1041f))
{
this.DoBreakdown();
}
}


Sadly the method is not abstract or virtual so you'll need to replace the comps in XML.

arigon2001

I'm still very new in understanding some coding but slowly learning. In the meantime if anyone knows the file location of the original Breakdown chance (percentage) and where it is located in the game files I would be really thankful. I do wonder though, why are these calculations not put into the .ini files for quick and easy change?

Cheers!

ReZpawner

#5
EDIT: Tynan answered it a year ago:
Quote[–]FluffierThanThou 12 points 1 year ago

Breakdowns are entirely random. The relevant code (RimWorld.CompBreakdownable.CheckForBreakdown(), for those with a decompiler at hand) is literally a random dice roll weighted to occur once every 4 minutes per component - if my calculations are correct (which I doubt, since that seems really, really high).

There's no checks to see if the player has stored components, and storytellers make no difference.

QuoteTynanSylvesterLead Developer 12 points 1 year ago

This is the correct answer!

So to sum it up: It cannot be modded without going into the actual code, unless you can somehow override it.

Source: https://www.reddit.com/r/RimWorld/comments/4ixyb5/component_breakdowns_not_random/


arigon2001

@ReZpawner, thanks mate. That answers my question regarding how it was coded. Greatly appreciated!

@tyriaelsoban, Yea I know about the mod you are linking, however it completely stops components from ever being used again as long as you just "maintain everything" which is not hard to do in that mod. I was simply looking for the ability to decrease the randomness of the breakdown chance, not stop it.

tyriaelsoban

Quote from: arigon2001 on May 29, 2017, 01:32:29 AM
completely stops components from ever being used again as long as you just "maintain everything" which is not hard to do in that mod.

Wrong, set the maint threshold to anything below 50% and you will see how wrong you are as item after item breaks down because your two builders cant keep up with the 60-70+ bits and pieces you have running on your -160*C winter bunker....  ::)