[A16] [BUG FIX] Fire from explosions, lightning and weapons does not spawn

Started by Darcpyro, February 21, 2017, 02:49:30 AM

Previous topic - Next topic

Darcpyro

Hi Everyone,

This may not be the right sub forum for this as its a fix for a bug rather than a bug so feel free to move this if required.

I recently noticed that explosions and fire based weapons were no longer causing any damage or igniting fires on my map which made raids very annoying when they would just stand at my wall throwing grenades for 20 minutes before giving.

I searched around and found that others had reported the problem but no one had and proposed solutions other than "remove the mod that your must have installed that broke the game and start a new map".

This wasn't overly helpful given a) I didn't have any mods installed (nor had I ever) and b)...I like my map.

When I to look into the Rimworld output log and found this:

System.NullReferenceException: Object reference not set to an instance of an object
  at Verse.Explosion.Tick () [0x00000] in <filename unknown>:0
  at Verse.ExplosionManager.MapComponentTick () [0x00000] in <filename unknown>:0
  at Verse.Map.MapPostTick () [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Which suggests the game is trying to blow something up that doesn't exist.

I then started looking into my save file and found that in the explosions section there was a few explosions that were trying to do damage to "null". After deleting these explosions and reloading my save the explosions and fire are now working again.

------------------------------------------------------------------------------------------------------------------------------------

These are the rough steps needed to fix your world:
1. Locate your save files in "C:\Users\USERNAME\AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios\Saves"
2. Make a copy of your save file (always good to have a backup)
3. Open your save file in a text editor (Notepad++ is a good choice)
4. Search for "ExplosionManager" (there's only one instance of this in the file)
5. You should be looking at a section like this (only with a lot more explosions):
<li Class="ExplosionManager">
   <explosions>
      <li>
         <position>(142, 0, 105)</position>
         <radius>3.9</radius>
         <damType>Bomb</damType>
         <damAmount>50</damAmount>
         <instigator>null</instigator>
         <finished>True</finished>
         <startTick>7887106</startTick>
         <cellsToAffect IsNull="True" />
         <damagedThings>
            <li>Thing_ChunkSlagSteel1139937</li>
            <li>null</li>
            ...Truncated...

6. The "<li>null</li>" lines are what is causing the explosions to fail. To fix the issue delete all of the explosion that contain a "null" within the "damagedThings" key. To delete an explosion delete everything between the <li> tag before <position> and the </li> tag after addedCellsAffectedOnlyByDamage
This is an example of one explosion:

-----------------Delete from here--------------
<li>
<position>(142, 0, 105)</position>
<radius>3.9</radius>
<damType>Bomb</damType>
<damAmount>50</damAmount>
<instigator>null</instigator>
<finished>True</finished>
<startTick>7887106</startTick>
<cellsToAffect IsNull="True" />
<damagedThings>
<li>Thing_ChunkSlagSteel1139937</li>
<li>null</li>
<li>Thing_ChunkSlagSteel1139941</li>
<li>null</li>
<li>null</li>
<li>Thing_ChunkSlagSteel1139942</li>
<li>Thing_ChunkSlagSteel1139933</li>
<li>null</li>
<li>Thing_ChunkSlagSteel1139936</li>
<li>Thing_ChunkSlagSteel1139944</li>
<li>Thing_ChunkSlagSteel1139935</li>
<li>null</li>
<li>Thing_ChunkSlagSteel1139943</li>
<li>Thing_ChunkSlagSteel1139958</li>
<li>Thing_ChunkSlagSteel1139961</li>
<li>null</li>
<li>Thing_ChunkSlagSteel1139957</li>
<li>null</li>
<li>null</li>
<li>null</li>
<li>Thing_ChunkSlagSteel1139934</li>
<li>null</li>
<li>null</li>
<li>null</li>
<li>null</li>
<li>null</li>
<li>null</li>
<li>null</li>
<li>null</li>
<li>null</li>
<li>null</li>
<li>null</li>
<li>Thing_ChunkSlagSteel1139960</li>
</damagedThings>
<addedCellsAffectedOnlyByDamage IsNull="True" />
</li>
-----------To here-------------

7. After you have removed all the dodgy explosions (they should all be up the top) save your edited file and attempt to load the save.
8. When I loaded my file it looked like every explosion that was ever suppose to happen in my world happened at once (lots of damage, the whole world was on fire etc) so it may be worth removing all explosions using the above method if your world is too chaotic.

Good luck




ZorbaTHut

Not totally sure what caused this in the first place, but I've found a way that an error can cause the explosion manager to basically lock up, which is what you're seeing here. Fixed in A17, thanks for the report!