Beispiel #1
0
        protected override bool TryGetContainer(ContainerModifiedMessage msg,
                                                ItemCounterComponent itemCounter,
                                                out IReadOnlyList <string> showLayers)
        {
            if (msg.Container.Owner.TryGetComponent(out ServerStorageComponent? component))
            {
                var containedLayers = component.StoredEntities ?? new List <IEntity>();
                var list            = new List <string>();
                foreach (var mapLayerData in itemCounter.MapLayers.Values)
                {
                    foreach (var entity in containedLayers)
                    {
                        if (mapLayerData.Whitelist.IsValid(entity))
                        {
                            list.Add(mapLayerData.Layer);
                            break;
                        }
                    }
                }

                showLayers = list;
                return(true);
            }

            showLayers = new List <string>();
            return(false);
        }
        private void OnContainerModified(EntityUid uid, PaperLabelComponent label, ContainerModifiedMessage args)
        {
            if (args.Container.ID != label.LabelSlot.ID)
            {
                return;
            }

            if (!EntityManager.TryGetComponent(uid, out AppearanceComponent appearance))
            {
                return;
            }

            appearance.SetData(PaperLabelVisuals.HasLabel, label.LabelSlot.HasItem);
        }
Beispiel #3
0
        private void ContainerModified(ContainerModifiedMessage message)
        {
            // Not returning is necessary in case an entity has both a buckle and strap component
            if (message.Entity.TryGetComponent(out BuckleComponent? buckle))
            {
                ContainerModifiedReAttach(buckle, buckle.BuckledTo);
            }

            if (message.Entity.TryGetComponent(out StrapComponent? strap))
            {
                foreach (var buckledEntity in strap.BuckledEntities)
                {
                    if (!buckledEntity.TryGetComponent(out BuckleComponent? buckled))
                    {
                        continue;
                    }

                    ContainerModifiedReAttach(buckled, strap);
                }
            }
        }
Beispiel #4
0
        protected override bool TryGetLayers(ContainerModifiedMessage msg,
                                             ItemMapperComponent itemMapper,
                                             out IReadOnlyList <string> showLayers)
        {
            var containedLayers = _containerSystem.GetAllContainers(msg.Container.Owner)
                                  .SelectMany(cont => cont.ContainedEntities).ToArray();

            var list = new List <string>();

            foreach (var mapLayerData in itemMapper.MapLayers.Values)
            {
                var count = containedLayers.Count(uid => mapLayerData.ServerWhitelist.IsValid(uid));
                if (count >= mapLayerData.MinCount && count <= mapLayerData.MaxCount)
                {
                    list.Add(mapLayerData.Layer);
                }
            }

            showLayers = list;
            return(true);
        }
 protected override void HandleContainerModified(EntityUid uid, SharedHandsComponent component, ContainerModifiedMessage args)
 {
     if (uid == _playerManager.LocalPlayer?.ControlledEntity)
     {
         GuiStateUpdated?.Invoke();
     }
 }
Beispiel #6
0
 private void OnContainerModified(EntityUid uid, ChemicalPayloadComponent component, ContainerModifiedMessage args)
 {
     UpdateAppearance(uid, component);
 }
Beispiel #7
0
 protected override void HandleContainerModified(EntityUid uid, SharedHandsComponent component, ContainerModifiedMessage args)
 {
     component.HandsModified();
 }
Beispiel #8
0
 protected override void HandleContainerModified(EntityUid uid, SharedHandsComponent handComp, ContainerModifiedMessage args)
 {
     if (handComp.TryGetHand(args.Container.ID, out var hand))
     {
         UpdateHandVisuals(uid, args.Entity, hand);
     }
 }
Beispiel #9
0
 private void HandleContainerModified(EntityUid uid, SharedHandsComponent handComp, ContainerModifiedMessage args)
 {
     if (handComp.Hands.TryGetValue(args.Container.ID, out var hand))
     {
         UpdateHandVisuals(uid, args.Entity, hand);
     }
 }
 protected virtual void HandleContainerModified(EntityUid uid, SharedHandsComponent hands, ContainerModifiedMessage args)
 {
     // client updates hand visuals here.
 }
 private void OnCellSlotUpdated(EntityUid uid, ServerBatteryBarrelComponent component, ContainerModifiedMessage args)
 {
     if (args.Container.ID == component.CellSlot.ID)
     {
         component.UpdateAppearance();
     }
 }
Beispiel #12
0
        protected override void HandleContainerRemoved(EntityUid uid, SharedHandsComponent component, ContainerModifiedMessage args)
        {
            if (!Deleted(args.Entity) && TryComp(args.Entity, out HandVirtualItemComponent? @virtual))
            {
                _virtualSystem.Delete(@virtual, uid);
            }

            base.HandleContainerRemoved(uid, component, args);
        }