private void Preview_Server(ulong steamId, string command, byte[] data, DateTime timestamp) { try { PreviewGridData preview = MyAPIGateway.Utilities.SerializeFromBinary <PreviewGridData>(data); GridStorageBlock block = MyAPIGateway.Entities.GetEntityById(preview.GarageId).GameLogic.GetAs <GridStorageBlock>(); if (preview.Index > -1 && preview.Index < block.GridList.Count) { preview.Prefab = block.GridList[preview.Index]; Network.SendCommand(Command_Preview, data: MyAPIGateway.Utilities.SerializeToBinary(preview), steamId: steamId); } } catch (Exception e) { MyLog.Default.Error($"[Grid Garage] Error in function Preview_Server: {e.ToString()}"); } }
private void Store_Server(ulong steamId, string command, byte[] data, DateTime timestamp) { try { if ((timestamp - storeTime).TotalMilliseconds < 200) { MyLog.Default.Warning($"[Grid Garage] User {steamId} attempted to store a grid too soon"); return; } else { MyLog.Default.Info($"[Grid Garage] User {steamId} attempting to store grid."); storeTime = timestamp; } StoreGridData store = MyAPIGateway.Utilities.SerializeFromBinary <StoreGridData>(data); GridStorageBlock block = MyAPIGateway.Entities.GetEntityById(store.GarageId).GameLogic.GetAs <GridStorageBlock>(); block.StorePrefab(store.TargetId); } catch (Exception e) { MyLog.Default.Error($"[Grid Garage] Error in function Store_Server: {e.ToString()}"); } }