[1.1.2618 Van] Sarcophagi disappear when generating art description fails

Started by Cloud_, May 05, 2020, 06:55:30 AM

Previous topic - Next topic

Cloud_

Did CompArt.GenerateImageDescription without initializing art: Sarcophagus4362787
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

Exception in JobDriver tick for pawn 3 Con Cra driver=JobDriver_ConstructFinishFrame (toilIndex=1) driver.job=(FinishFrame (Job_29258794) A=Thing_Frame_Sarcophagus4361776)
System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.CompArt.GenerateImageDescription () [0x00032] in <17f3abe3864447d2b91d037520a36fb6>:0
  at RimWorld.QualityUtility.SendCraftNotification (Verse.Thing thing, Verse.Pawn worker) [0x000fd] in <17f3abe3864447d2b91d037520a36fb6>:0
  at RimWorld.Frame.CompleteConstruction (Verse.Pawn worker) [0x000c5] in <17f3abe3864447d2b91d037520a36fb6>:0
  at RimWorld.JobDriver_ConstructFinishFrame+<>c__DisplayClass4_0.<MakeNewToils>b__1 () [0x00107] in <17f3abe3864447d2b91d037520a36fb6>:0
  at Verse.AI.JobDriver.DriverTick () [0x001a2] in <17f3abe3864447d2b91d037520a36fb6>:0
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)


Upon completion of sarcophagi (no work left), sometimes no sarcophagus shows up and that error occurs. There's just a blank spot where it should be. Other times, I'm seeing sarcophagi that are excellent and below that don't come with an art description show up just fine.

ison

I'm afraid it's caused by one of the mods. Can you reproduce it without mods?

entemena


Canute

entemena,
an safegame when that problem happen would be very useful to track the problem down.

Vincent

It happened to me as well twice, at first I didn't bother and built the sarcophagus elsewhere. I also use no mod in my game.

I don't know if my Save File can help because this bug happened to me very early in the lets play https://drive.google.com/file/d/1-bWn7AMf2fDl0amosghbrjAORcvSrua7/view?usp=sharing

fredtheelf

It's happened to me multiple times.  Was fine but then days/a week ago started happening - not sure of time frame.

In case it matters, I'm playing on a Mac.

As a test I created a quick game using only Core, no mods. Used dev mode to create three colonists with 20 construction and creativity inspiration. Set them to each construct a sarcophagus.  All three caused the error.



You can find the saves (pre-error named Test1, post-error named Test2) and the debug log showing the error (debug.txt) at:

https://drive.google.com/file/d/1kRMKeVZGnYSqbM7UzKuD1u0Z0_2HzQwy/view?usp=sharing, https://drive.google.com/file/d/1vtUb9TVX82JIWiZHS9QsR9v-R2AV7drZ/view?usp=sharing, https://drive.google.com/file/d/1ybjFD1Cx4VN_my0_qk14EZc6pZK8-MqI/view?usp=sharing

Also, confirmed that the issue is not happening for items that only have an Art tab (no Storage/Content) such as furniture such as Dressers and weapons such as Maces when they are Excellent and above quality.  In fact, I think it may be a problem with the Storage tab - was that a recent addition? It's in the same location as the Art tab on my older sacophagi... Oddly, Excellent sarcaphogi get created but no Art tab appears but Legendary and Masterwork sarcophagi just cause the error and disappear.  Do Excellent saraphogi no longer get Art?

Cloud_

I tested this with my mods and also without a single mod enabled (vanilla, so I put "Van" in the title though the title has limited characters). It happened for both cases, multiple times.

Error seems to happen only when pawns get lucky and make a sarcophagus that has art. All my other sarcophagi that didn't get art spawned in fine. But lots of completely wasted time & resources when I should be getting art - a good thing becomes a terrible thing, skilled constructors are punished.

thakyZ

I tested this with only vanilla and no other mods not even royalty enabled and I still got the error... Here is my log file: https://pastebin.com/wc5gkuXT
I would like to note, this wasn't tested on a previous save file, this was tested on a brand-new save file, with Forgotten tribe starting, 5% world generation, and minimum population. And a 200x200 map size. I made one of the pawns max skills and added creativity inspiration to them. I unlocked all the research via dev menu, and then forced them to build the Sarcophagus and it failed completely and threw that error.
EDIT: I made a mod to patch the vanilla function to fix this bug. It should only affect vanilla but if any other mods patch the function, SendCraftNotification, will probably not work. I have tested it with Quality Builder, Crafting Quality Rebalance, and Mad Skills. I will explain a bit of what the issue is after these links for the download of the mod:

https://steamcommunity.com/sharedfiles/filedetails/?id=2154320105
https://github.com/thakyZ/SarcophagusPatch/releases/tag/1.0.0

Basically there is a line of code that tries to create art when there is a compArt class in the building. When doing so it tries to generate the text but first has to create a TaleRefrence instance, but when doing so it checks to see if the building can initially show art, and if not sets the TaleRefrence instance to null. When it checks the building it sees if the building's Def contains the key mustBeFullGrave and the value is true. If the value is true, then it returns false to the check of whether to initially show the art. Which then to restate makes the TaleRefrence instance be null. And after it tries to create the TaleRefrence instance it runs a command to generate text within the TaleRefrence instance but the instance is null and crashes. So I thought of two ways this could be fixed. One by setting mustBeFullGrave to false, but then I found out that if I were to set it to false it would start to error when burring the bodies because there is already a function to generate art based on the quality of the building after burring a body. So I would have to patch the game via Harmony anyways. So I instead made the patch when SendCraftNotification gets called it checks to see if the building is a grave, and if it is then it will just let you know that the work was legendary or masterwork instead of generating art on top of letting you know.
TD;LR there is just a function that ends up not being necessary to call with stuff that has a property in the Def and ends up breaking the building when it is the way it currently is.

Nowhere