private void MyEntities_OnEntityAdd(VRage.Game.Entity.MyEntity obj)
        {
            if (!Config.Enabled)
            {
                return;
            }

            if (obj is MyCharacter character)
            {
                var manager = Torch.CurrentSession.Managers.GetManager <IChatManagerServer>();
                Task.Run(() =>
                {
                    System.Threading.Thread.Sleep(1000);
                    if (_conecting.Contains(character.ControlSteamId) && character.IsPlayer && Config.Join.Length > 0)
                    {
                        DDBridge.SendStatusMessage(character.DisplayName, Config.Join);
                        //After spawn on world, remove from connecting list
                        if (messageQueue.Contains(character.ControlSteamId))
                        {
                            manager.SendMessageAsOther(null, "Did you know you can link your steamID to your Discord account? Enter '!sedb link' to get started!", VRageMath.Color.Yellow, character.ControlSteamId);
                            messageQueue.Remove(character.ControlSteamId);
                        }
                        _conecting.Remove(character.ControlSteamId);
                    }
                });
            }
        }
Exemplo n.º 2
0
        private void MyEntities_OnEntityAdd(VRage.Game.Entity.MyEntity obj)
        {
            try
            {
                if (!Config.Enabled)
                {
                    return;
                }

                if (obj is MyCharacter character)
                {
                    Task.Run(() =>
                    {
                        System.Threading.Thread.Sleep(1000);
                        if (_conecting.Contains(character.ControlSteamId) && character.IsPlayer && Config.Join.Length > 0)
                        {
                            DDBridge.SendStatusMessage(character.DisplayName, Config.Join);
                            //After spawn on world, remove from connecting list
                            _conecting.Remove(character.ControlSteamId);
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "MyEntities_OnEntityAdd: " + ex.Message);
            }
        }
Exemplo n.º 3
0
 private void MyEntities_OnEntityAdd(VRage.Game.Entity.MyEntity obj)
 {
     if (obj is MyCharacter character)
     {
         Task.Run(() =>
         {
             System.Threading.Thread.Sleep(1000);
             if (_conecting.Contains(character.ControlSteamId) && character.IsPlayer && Config.Join.Length > 0)
             {
                 DDBridge.SendStatusMessage(character.DisplayName, Config.Join);
                 //After spawn on world, remove from connecting list
                 _conecting.Remove(character.ControlSteamId);
             }
         });
     }
 }
        private void MyEntities_OnEntityAdd(VRage.Game.Entity.MyEntity obj)
        {
            if (Config.NotifyLinkable && obj is MyCharacter character)
            {
                Task.Run(() =>
                {
                    Thread.Sleep(Config.InfoDelay);
                    if (Config.NotifyLinkable && _conecting.Contains(character.ControlSteamId) && character.IsPlayer)
                    {
                        _chatmanager.SendMessageAsOther("DiscordRoleManager", "Write '!link' into the chat to link your steam account with discord", MyFontEnum.White, character.ControlSteamId);

                        //After spawn on world, remove from connecting list
                        _conecting.Remove(character.ControlSteamId);
                    }
                });
            }
        }
Exemplo n.º 5
0
        public static bool InventoryAdd(VRage.Game.Entity.MyEntity entity, MyFixedPoint amount, MyDefinitionId definitionId)
        {
            var itemAdded = false;
            var count     = entity.InventoryCount;

            // Try to find the right inventory to put the item into.
            // Ie., Refinery has 2 inventories. One for ore, one for ingots.
            for (int i = 0; i < count; i++)
            {
                var inventory = entity.GetInventory(i);
                if (inventory.CanItemsBeAdded(amount, definitionId))
                {
                    itemAdded = true;
                    Support.InventoryAdd(inventory, amount, definitionId);
                    break;
                }
            }

            return(itemAdded);
        }
Exemplo n.º 6
0
 public MultiSoundSource(IMyCubeBlock block) : this(block.WorldAABB.Center)
 {
     entity = block as MyEntity;
 }
Exemplo n.º 7
0
 private void Grid_OnMarkForClose(VRage.Game.Entity.MyEntity obj)
 {
     LogManager.GetLogger(nameof(ConcealGroup)).Info($"Grid group '{GridNames}' was marked for close.");
     UnhookOnClosing();
     Closing?.Invoke(this);
 }