// Context: All public override void Init(MyObjectBuilder_EntityBase objectBuilder) { me = Entity as IMyProjector; NeedsUpdate = MyEntityUpdateEnum.BEFORE_NEXT_FRAME; if (Constants.IsServer) { if (me.Storage == null) { me.Storage = new MyModStorageComponent(); } storage = me.Storage; } }
public static ZoneDescription Load(IMyEntity ent) { MyModStorageComponentBase storage = GetStorage(ent); if (storage.ContainsKey(StorageGuid)) { return(MyAPIGateway.Utilities.SerializeFromXML <ZoneDescription>(storage[StorageGuid])); } else { Tools.Log(MyLogSeverity.Info, $"No data saved for:{ent.EntityId}. Loading Defaults"); return(GetDefaultSettings()); } }
public void Save(IMyEntity ent) { MyModStorageComponentBase storage = GetStorage(ent); if (storage.ContainsKey(StorageGuid)) { storage[StorageGuid] = MyAPIGateway.Utilities.SerializeToXML(this); } else { Tools.Log(MyLogSeverity.Info, $"Saved new Data"); storage.Add(new KeyValuePair <Guid, string>(StorageGuid, MyAPIGateway.Utilities.SerializeToXML(this))); } }