Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Virtual gardener
staff: administrator
Original Poster
#1 Old 3rd Jun 2020 at 1:08 PM
Default ImportExport content function - what does it do?
Hi guys!

This one has always confused me a bit tbh. Most (I think all?) GameObjects always have an override function called "ExportContent/ImportContent". It's obviously a 'reader/writer' function that 'saves' any important data that the object might have. (think the Quality of nectar bottles, or who made it, etc).

I was just wondering which document its writing to/reading from. I'm thinking Caching, but I'd assume that then deleting the cache.packages would erase data about the owner of the game object or quality of it, etc. Or is it stored in the save game files somehow? 

Thanks in advanced!
Advertisement
Space Pony
#2 Old 3rd Jun 2020 at 3:11 PM
I could be wrong, but I don't think it has anything to do with caching per se. Game objects implementing the IExportableContent interface appear to use ExportContent() and ImportContent() to store and retrieve critical information about the states of objects in a specified package file. Because the game allows you to choose which file to save/load from (by choosing where the PropertyStreamReader argument points to), I think EA mainly uses this functionality both for traveling (in which the data is written to the save files) and exporting lots to the bin or placing lots from the library (in which the data is written to the library package or exported Sims3Pack).

A lot of components of the SimDescription, like the CareerManager and SkillManager, also implement IExportableContent. Like ordinary game objects, these components export critical information about a sim to a save file (for traveling) or a Sims3Pack (for exporting to the bin). I remember it being a pain point in my Job Overhaul mod, where I basically had to undo the work of the importer after the fact to ensure a sim can hold two separate jobs in the present and future.

I suspect a lot of the grunt work to actually call ImportContent() and ExportContent() is done engine-side, making the system as a whole difficult to piece together. CloneScriptData() is one of the few examples I can find that lies completely in the managed code.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Virtual gardener
staff: administrator
Original Poster
#3 Old 7th Jun 2020 at 9:35 AM
Sorry for the late reply!

I think you're right, since with store items you'd assume that if they get imported/exported, it would have been from an external file. But then that wouldn't explain how if you delete the package, the data that has been 'cached/saved' in the binned lot/sim, is still there. So it must indeed just be a thing for travelling sims across or saving sims/lots to the bin.

Also, since thinking about it from a UX perspective, you don't want players deleting log files and then wondering where the skills of a sim went  So I understand the choice behind it being an engine level. It's annoying for us, but it is what it is.

This helped me a lot btw! Thanks for the quick reply as well!
Back to top