public override ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement) { Vector2 offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"])); string GUID = additionalSaveData["GUID"]; Machine self = Revitalize.ModCore.Serializer.DeserializeGUID <Machine>(additionalSaveData["GUID"]); if (ModCore.IsNullOrDefault <Machine>(self)) { return(null); } try { if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"])) { MultiTiledObject obj = (MultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID <MultiTiledObject>(additionalSaveData["ParentGUID"]); self.containerObject = obj; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], obj); } else { self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]]; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); } } catch (Exception err) { ModCore.log(err); } return(self); }
public override ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement) { //instead of using this.offsetkey.x use get additional save data function and store offset key there //ModCore.log("Recreate a table tile component!"); Vector2 offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"])); //ModCore.log("Got the offset key!"); string GUID = additionalSaveData["GUID"]; //ModCore.log("This tile has a parent guid of: " + additionalSaveData["ParentGUID"]); TableTileComponent self = Revitalize.ModCore.Serializer.DeserializeGUID <TableTileComponent>(additionalSaveData["GUID"]); if (ModCore.IsNullOrDefault <TableTileComponent>(self)) { //ModCore.log("SELF IS NULL"); return(null); } try { if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"])) { //ModCore.log("Load in the parent!"); //Get new container TableMultiTiledObject obj = (TableMultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID <TableMultiTiledObject>(additionalSaveData["ParentGUID"]); self.containerObject = obj; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], obj); } else { //ModCore.log("Parent already exists!"); self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]]; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); //Revitalize.ModCore.log("READD AN OBJECT!!!!"); } } catch (Exception err) { ModCore.log(err); } return(self); }
public override ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement) { //instead of using this.offsetkey.x use get additional save data function and store offset key there Vector2 offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"])); string GUID = additionalSaveData["GUID"]; LampTileComponent self = Revitalize.ModCore.Serializer.DeserializeGUID <LampTileComponent>(additionalSaveData["GUID"]); if (ModCore.IsNullOrDefault <LampTileComponent>(self)) { return(null); } try { if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"])) { LampMultiTiledObject obj = (LampMultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID <LampMultiTiledObject>(additionalSaveData["ParentGUID"]); self.containerObject = obj; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], obj); } else { self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]]; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); } } catch (Exception err) { ModCore.log(err); } return(self); }