예제 #1
0
        public DecalGridComponent.DecalGridChunkCollection Copy(ISerializationManager serializationManager, DecalGridComponent.DecalGridChunkCollection source,
                                                                DecalGridComponent.DecalGridChunkCollection target, bool skipHook, ISerializationContext?context = null)
        {
            var dict = serializationManager.Copy(source.ChunkCollection, target.ChunkCollection, context, skipHook) !;

            return(new DecalGridComponent.DecalGridChunkCollection(dict)
            {
                NextUid = source.NextUid
            });
        }
예제 #2
0
    private void OnEntityInserted(EntityUid uid, PayloadCaseComponent _, EntInsertedIntoContainerMessage args)
    {
        if (!TryComp(args.Entity, out PayloadTriggerComponent? trigger))
        {
            return;
        }

        trigger.Active = true;

        if (trigger.Components == null)
        {
            return;
        }

        // ANY payload trigger that gets inserted can grant components. It is up to the construction graphs to determine trigger capacity.
        foreach (var(name, data) in trigger.Components)
        {
            if (!_componentFactory.TryGetRegistration(name, out var registration))
            {
                continue;
            }

            if (HasComp(uid, registration.Type))
            {
                continue;
            }

            if (_componentFactory.GetComponent(registration.Type) is not Component component)
            {
                continue;
            }

            component.Owner = uid;

            if (_serializationManager.Copy(data, component, null) is Component copied)
            {
                EntityManager.AddComponent(uid, copied);
            }

            trigger.GrantedComponents.Add(registration.Type);
        }
    }
 public AppearanceVisualizer Copy(ISerializationManager serializationManager, AppearanceVisualizer source,
                                  AppearanceVisualizer target, bool skipHook, ISerializationContext?context = null)
 {
     return(serializationManager.Copy(source, target, context) !);
 }