ModLib icon indicating copy to clipboard operation
ModLib copied to clipboard

MBObjectData and unique class ids

Open brandonm4 opened this issue 4 years ago • 1 comments

If you are (maybe?) making a community ModLib - what about a generic save structure, so we don't have to come up with unique saveable classids for our MBObjectBase objects?

Something like:

[SaveableClass(5001000)]
GenericSaveData : MBObjectBase
{
 [SaveableProperty(100)]
 public string ModuleId {get;set;}  //same as the SubModule module id
 [SaveableProperty(200)]
 public string ModuleReference {get;set;}  //reference for the module to know what type of data is here
 [SaveableProperty(300)]
public string JsonData {get;set;}
}

This way we could serialize/deserialize our data objects without stepping on other modules toes / data object by accidentally using the same SaveableClass id.

brandonm4 avatar Apr 11 '20 23:04 brandonm4

Definitely something to look into! I haven't used the game's serialize/deserialize options yet; I made my own for some reason. Next update will have ModLib separated into its own mod for use by other modders.

mipen avatar Apr 13 '20 03:04 mipen