How to save bullets in savegame.

Started by Katavrik, January 17, 2015, 05:53:17 AM

Previous topic - Next topic

Katavrik

I have a mod - Crash Landing. The ship parts crash lands on the map.
I use a bullet class as a base to my falling ship parts. If i save a game, while my ship part is falling, it will disappear after game load. I did not find any records about that falling part in savegame. That mean, it does not saved. Moreover, standart bullets does not saved either.

Is anybody know, why bullets does not saved?
How can i add my ship part to the savegame?

EdB

Quote from: Katavrik on January 17, 2015, 05:53:17 AM
I have a mod - Crash Landing. The ship parts crash lands on the map.
I use a bullet class as a base to my falling ship parts. If i save a game, while my ship part is falling, it will disappear after game load. I did not find any records about that falling part in savegame. That mean, it does not saved. Moreover, standart bullets does not saved either.

Is anybody know, why bullets does not saved?
How can i add my ship part to the savegame?

From what I've seen, Projectiles and Motes are the two types of things that are not included when you save the game.  You can look at RimWorld.MapSaver.SaveToFile() to see the save game code.  It uses the Verse.ListerThings class to get a list of all of the Things to include in the save.  You'll see which things are excluded in the ListerThings.EverListable() method.

You might be able to add something else to the map that can save and restore the positions of the falling ship parts.  I've had some success with this approach.

Katavrik

#2
Quote from: EdB on January 17, 2015, 12:29:27 PM
You might be able to add something else to the map that can save and restore the positions of the falling ship parts.  I've had some success with this approach.

That was the reserved plan. I hoped there was a simple way to save bullets.

EDIT: I've made some experiments: Changed the category of ship parts to <category>Building</category>, and it works. My ship parts are saved and loaded normally. But i am afraid of some unpredicable bugs, that might happen due to wrong category.

EDIT2: Building category made a bug with several parts spawned in one cell. The only one part is correctly spawned. But <category>Ethereal</category> works fine.

Result: I've managed to save all ship parts correctly (at least for this moment) using Ethereal category instead of Projectile in their defs.