public override void OnAddedToContainer() { if (Entity.Storage == null) { var storage = new MyModStorageComponent(); // make some storage if id don't have it. Entity.Storage = storage; //block.Components.Add(storage); } DoLoad(); DoSave(); }
private void SetCustomData_Internal(string value, bool sync) { if (Storage == null) { Storage = new MyModStorageComponent(); Components.Add(Storage); } if (value.Length <= DATA_CHARACTER_LIMIT) { Storage[m_storageGuid] = value; } else { Storage[m_storageGuid] = value.Substring(0, DATA_CHARACTER_LIMIT); } if (sync) { RaiseCustomDataChanged(); } }