public void ServerAddGroup(TechGroup techGroup) { if (this.Groups.Contains(techGroup)) { return; } this.Groups.Add(techGroup); var character = this.Character; Api.Logger.Info("Tech group added: " + techGroup.ShortId, character); Api.SafeInvoke(() => CharacterGroupAddedOrRemoved?.Invoke(character, techGroup, isAdded: true)); }
/// <summary> /// Remove group and all nodes of this group. /// </summary> public void ServerRemoveGroup(TechGroup techGroup) { if (!this.Groups.Remove(techGroup)) { return; } Api.SafeInvoke(() => CharacterGroupAddedOrRemoved?.Invoke(this.Character, techGroup, isAdded: false)); // remove nodes of this group for (var index = 0; index < this.Nodes.Count; index++) { var node = this.Nodes[index]; if (node.Group != techGroup) { continue; } this.ServerRemoveNode(node); // restart removal index = 0; } }