Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddHumanlikeOrdersPostfix only checks single matching item in cell (Deep Storage compatibility) #31

Closed
lilwhitemouse opened this issue Feb 26, 2020 · 2 comments

Comments

@lilwhitemouse
Copy link

lilwhitemouse commented Feb 26, 2020

Deep Storage (https://github.com/lilwhitemouse/RimWorld-LWM.DeepStorage) has storage buildings that allow more than one item to be in a cell. This means, for example, that a player can have multiple dusters in one cell. If a race (e.g., Dragonian) cannot use duster, no menu options should be available. However, some are: https://ludeon.com/forums/index.php?topic=47707.msg471015#msg471015

AddHumanlikeOrdersPostfix (HarmonyPatches.cs) checks several times for FirstOrDefault(...). If the code were to check:

foreach (Thing drugs in c.GetThingList(map: pawn.Map).FindAll(predicate: t => t?.TryGetComp<CompDrug>() != null) {
  // do drug logic
  //build list of FloatMenuOptions that should be disabled
}
// disable the list of FloatMenuOptions
// ....
foreach (ThingWithComps equipment  / *etc */) {
  // build another list of FloatMenuOptions to be disabled
}
//disable, etc

this would solve the problem. I will also check and see if load order will make a difference.

@erdelf
Copy link
Owner

erdelf commented Feb 26, 2020

entirely fair. Thank you.

@lilwhitemouse
Copy link
Author

Actually, I am not sure why this doesn't work as is, with different mod order, but player reports changing mod order does not help. If you could make that change, at least one person would be happier.

Thanks

@erdelf erdelf closed this as completed May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants