private void highlightBlock(BlocksToFind type, IMyTerminalBlock b) { int has = 0; counts.TryGetValue(type, out has); has++; counts[type] = has; b.ShowInTerminal = true; b.ShowOnHUD = true; b.Visible = true; }
private void setSeekCategory(BlocksToFind tg, bool set) { if (set) { activeCategories.Add(tg); } else { activeCategories.Remove(tg); } //IO.log(MyAPIGateway.Multiplayer.IsServer+" "+IO.toUsefulString(activeCategories)); }
public override void UpdateAfterSimulation100() { bool running = false; /*if (!SwitchControl.Getter((IMyFunctionalBlock)Entity) && !isControlled()) { * ((IMyFunctionalBlock)Entity).Enabled = false; * } * else */if (shouldUsePower()) { running = true; } //MyAPIGateway.Utilities.ShowNotification("Running: "+running); if (running) { counts.Clear(); List <IMySlimBlock> li = new List <IMySlimBlock>(); thisGrid.GetBlocks(li, b => b.FatBlock is IMyTerminalBlock); foreach (IMySlimBlock b in li) { IMyTerminalBlock tb = b.FatBlock as IMyTerminalBlock; BlocksToFind get = getSeekCategory(tb); if (get != BlocksToFind.NONE && this.isSeekCategory(get)) { highlightBlock(get, tb); } } } else { } sync(); thisBlock.RefreshCustomInfo(); }
private bool isSeekCategory(BlocksToFind tg) { return(activeCategories.Contains(tg)); }