Beispiel #1
0
        public void BroadcastUnequip(Pickupable pickupable, GameObject owner, string slot)
        {
            NitroxId itemId = NitroxEntity.GetId(pickupable.gameObject);
            Player   player = owner.GetComponent <Player>();

            if (player != null)
            {
                TechType techType = pickupable.GetTechType();
                PlayerEquipmentRemoved equipmentAdded = new PlayerEquipmentRemoved(techType.ToDto(), itemId);
                packetSender.Send(equipmentAdded);

                return;
            }

            NitroxId ownerId = NitroxEntity.GetId(owner);

            if (pickupable.GetTechType() == TechType.VehicleStorageModule)
            {
                List <InteractiveChildObjectIdentifier> childIdentifiers = VehicleChildObjectIdentifierHelper.ExtractInteractiveChildren(owner);
                VehicleChildUpdate vehicleChildInteractiveData           = new VehicleChildUpdate(ownerId, childIdentifiers);
                packetSender.Send(vehicleChildInteractiveData);
            }

            ModuleRemoved moduleRemoved = new ModuleRemoved(ownerId, slot, itemId);

            packetSender.Send(moduleRemoved);
        }
Beispiel #2
0
 public bool Remove(SbModule lldbModule)
 {
     lock (cache)
     {
         if (cache.TryGetValue(lldbModule, out IDebugModule3 module))
         {
             cache.Remove(lldbModule);
             mainThreadDispatcher.Post(() =>
             {
                 try
                 {
                     ModuleRemoved?.Invoke(Self, new ModuleRemovedEventArgs(module));
                 }
                 catch (Exception e)
                 {
                     Trace.WriteLine(
                         $"Warning: ModuleRemoved handler failed with exception: {e}");
                 }
             });
             return(true);
         }
         return(false);
     }
 }
Beispiel #3
0
 public void RemoveModule(Surrogate.Controller.IController module)
 {
     modules.Remove(module.GetHashCode());
     ModuleRemoved?.Invoke(this, new ModuleArgs(module, module.GetHashCode()));
 }