Ради вашего удобства наш сайт использует cookies! Узнать больше! Мы используем cookies

Nutrient Dispenser Improvements and Fixes

This mod corrects some bugs that nutrient paste dispensers have in vanilla Rimworld, both observable and not. For a player, using this mod will only really fix a single bug in RimWorld where if you have dispensers without hoppers or without a way to fill those hoppers, pawns can sometimes end up choosing one that isn't actually usable, and if this happens, they won't eat anything at all, despite needing to. Most of the fixes in this mod will instead help mod creators by making it so inheriting from the vanilla nutrient paste dispenser will work as one might expect instead of using hard-coded values from the vanilla nutrient paste meal everywhere. The full list of fixes this mod does is as follows: [list] [*] Where the game has been hardcoded to use `ThingDefOf.MealNutrientPaste`, instead use `Building_NutrientPasteDispenser.DispensableDef`. While this doesn't directly affect vanilla, it allows subclasses of `Building_NutrientPasteDispenser` to dispense something else than the vanilla nutrient paste. This type of fix has been applies to: [list] [*] `Building_NutrientPasteDispenser.TryDispenseFood` [*] `FoodUtility.BestFoodSourceOnMap` [*] `JobDriver_FoodDeliver.GetReport` [*] `JobDriver_FoodFeedPatient.GetReport` [/list] [*] In `FoodUtility.BestFoodSourceOnMap`, where the logic allows choosing an "empty" dispenser: also require the dispenser to have an adjacent, accessible hopper. Without this additional check, the game can pick a dispenser without a hopper, thinking it can be filled later, but since one without hoppers can't, that job can never happen, and the pawn just ends up not eating at all. [*] In `ThingListGroupHelper.Includes`, use `ThingDef.IsFoodDispenser` to decide whether a given def is a food dispenser instead of a hardcoded check against exactly `Building_NutrientPasteDispenser`. This allows inheriting from `Building_NutrientPasteDispenser` to work as expected. [/list] Making a custom nutrient dispenser with XML only Besides fixing things about nutrient paste dispensers, this mod also intends to make it easier to make custom dispensers using XML only. To that extent, I've created a custom `thingClass` called `ilvyion.NutrientDispenserDispensableFix.Building_NutrientPasteDispenserImproved` which, in combination with a `<modExtensions>` called `ilvyion.NutrientDispenserDispensableFix.ImprovedNutrientPasteDispenserModExtension` lets you define things that would normally require code in XML. Currently the only supported feature of this `ImprovedNutrientPasteDispenserModExtension` is to allow you to set what is dispensed, but I'm open to adding more features if anyone needs them. To use this XML-only nutrient dispenser, you make a `ThingDef` like the following: <ThingDef ParentName="BuildingBase"> <thingClass>ilvyion.NutrientDispenserDispensableFix.Building_NutrientPasteDispenserImproved</thingClass> <modExtensions> <li Class="ilvyion.NutrientDispenserDispensableFix.ImprovedNutrientPasteDispenserModExtension"> <!-- This is where you set your dispensed product --> <dispensableDef>MealNutrientPaste</dispensableDef> </li> </modExtensions> <!-- ... and the rest of the owl... er, ThingDef. --> </ThingDef> You can look at an example dispenser definition included with this mod in Defs/ImprovedNutrientPasteDispenser.xml. It does not show up in the game directly, but can be spawned in using the debug tools. It is set up to dispense simple meals. Source code Source code can be found on [url=https%3A%2F%2Fgithub.com%2Filyvion%2Fnutrient-dispenser-dispensable-fix]GitHub[/url][github.com]. Report any bugs or feature suggestions/requests on the [url=https%3A%2F%2Fgithub.com%2Filyvion%2Fnutrient-dispenser-dispensable-fix%2Fissues]issue tracker[/url][github.com]. Like my work? [url=https%3A%2F%2Fko-fi.com%2Filyvion][img]https://alexanderschroeder.net/files/steam/kofi_brandasset/support_me_on_kofi_beige.png[/img][/url][ko-fi.com] Feel free to [url=https%3A%2F%2Fdiscord.gg%2FJ9Q78avHgM]join my Discord server[/url][discord.gg] if you want to talk to me (and other members) about my projects, or just to hang out, I guess. :)

Зависимости мода

Логотип мода

Harmony

Загрузить 200 KB