I've seen a lot of mods, which are trying to implement some kind of item storage, which does not want to rely on the peristence file storage.
Ranging from simple approaches like storing itemname, health and quantity, to trying to support every single mod out there to function with the mod they try to create.
I would love to see a feature, which allows to store items the same way CE saves them in the persistence Files. Maybe add one requirement like items must not have a parent object (if that would make things easier)
So the idea is there is a bool WriteObjectToFile(Object item, FileHandle handle); which writes the (same) binary data to the File like CE does. For example write a Car or BaseBuilding Objects with all their attachments and Cargo to a file. Having the filehandle in the parameters would allow the scripter to call the method multiple times to store more than one item in the file. The bool could return if the Object was written successfully.
And to get the Item / Object back later, add something like bool ReadObjectFromFile(out Object obj, FileHandle handle, vector pos = vector.Zero);. That could be used to spawn the item back into the World with the optional Parameter to spawn it at a certain position or even with the same Flags we can use in the CreateObjectEx method to have some control where the item should spawn. Or not pass the parameter and spawn it back at the original Position.
Just a small list of use cases and Mods, that would really benefit of this feature:
- CF, which tried to implement it's own Modstorage, but not many mods adopted it
- Virtual Storage Mods like https://steamcommunity.com/sharedfiles/filedetails/?id=2810820431 to improve server performance by deleting items from the map while no players are near
- Map Link https://steamcommunity.com/sharedfiles/filedetails/?id=2534070351 to transfer players between servers
- Garage mods, which save the inventory of cars
- Backup mods to live save and restore backups without a server restart
I think many modders would really appreciate such functionality, because it saves them the hussle with spawning each item properly and handling edge cases like weapon spawning and all the other 3rd Party mod additions, which would need to be saved