/// <inheritdoc /> public override async Task GetAsync() { long id = 0; //if (!long.TryParse(request.PathSegments.Last(), out id)) if (!ValueBag.TryGet("id", out id)) { await Request.RespondAsync("Invalid block ID", HttpStatusCode.BadRequest); return; } TerminalBlock block = null; await Torch.InvokeAsync(() => { MyAPIGateway.Entities.TryGetEntityById(id, out IMyEntity entity); if (entity is IMyTerminalBlock terminalBlock) { block = new TerminalBlock(terminalBlock, false); } }); if (block != null) { await Request.RespondAsync(block, HttpStatusCode.OK); return; } await Request.RespondAsync("Block not found", HttpStatusCode.NotFound); }
internal void TerminalRefresh(bool update = true) { if (Ai?.LastTerminal == MyCube) { TerminalBlock.RefreshCustomInfo(); } if (update && InControlPanel) { MyCube.UpdateTerminal(); } }
internal void TerminalRefresh(bool update = true) { if (Platform.State != MyWeaponPlatform.PlatformState.Ready || Status != Start.Started) { return; } if (Ai?.LastTerminal == MyCube) { TerminalBlock.RefreshCustomInfo(); if (update && InControlPanel) { MyCube.UpdateTerminal(); } } }