Наследование: IReactiveSystem, ISetPool
Пример #1
0
 public void Execute(IEntity owner, DestructibleSystem system)
 {
     if (owner.TryGetComponent(out IBody body))
     {
         body.Gib(_recursive);
     }
 }
Пример #2
0
        public void Trigger(IEntity owner, DestructibleSystem system)
        {
            if (!owner.TryGetComponent(out SolutionContainerComponent? solutionContainer))
                return;

            solutionContainer.Solution.SpillAt(owner.Transform.Coordinates, "PuddleSmear", false);
        }
Пример #3
0
 public void Execute(EntityUid owner, DestructibleSystem system)
 {
     if (system.EntityManager.TryGetComponent(owner, out SharedBodyComponent? body))
     {
         body.Gib(_recursive);
     }
 }
Пример #4
0
        public void Execute(IEntity owner, DestructibleSystem system)
        {
            if (string.IsNullOrEmpty(Node) || !owner.TryGetComponent(out ConstructionComponent? construction))
            {
                return;
            }

            EntitySystem.Get <ConstructionSystem>().ChangeNode(owner.Uid, null, Node, true, construction);
        }
        public void Execute(EntityUid owner, DestructibleSystem system)
        {
            if (string.IsNullOrEmpty(Node) || !system.EntityManager.TryGetComponent(owner, out ConstructionComponent? construction))
            {
                return;
            }

            system.ConstructionSystem.ChangeNode(owner, null, Node, true, construction);
        }
Пример #6
0
        public async void Execute(IEntity owner, DestructibleSystem system)
        {
            if (string.IsNullOrEmpty(Node) ||
                !owner.TryGetComponent(out ConstructionComponent? construction))
            {
                return;
            }

            await construction.ChangeNode(Node);
        }
Пример #7
0
        public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
        {
            if (Type == null)
            {
                return(false);
            }

            return(damageable.TryGetDamage(Type.Value, out var damageReceived) &&
                   damageReceived >= Damage);
        }
Пример #8
0
        /// <summary>
        /// If there is a SpillableComponent on IEntity owner use it to create a puddle/smear.
        /// Or whatever solution is specified in the behavior itself.
        /// If none are available do nothing.
        /// </summary>
        /// <param name="owner">Entity on which behavior is executed</param>
        /// <param name="system">system calling the behavior</param>
        public void Execute(IEntity owner, DestructibleSystem system)
        {
            var solutionContainerSystem = EntitySystem.Get <SolutionContainerSystem>();


            if (owner.TryGetComponent(out SpillableComponent? spillableComponent) &&
                solutionContainerSystem.TryGetSolution(owner.Uid, spillableComponent.SolutionName,
                                                       out var compSolution))
            {
                compSolution.SpillAt(owner.Transform.Coordinates, "PuddleSmear", false);
            }
Пример #9
0
        public void Execute(IEntity owner, DestructibleSystem system)
        {
            if (string.IsNullOrEmpty(Sound))
            {
                return;
            }

            var pos = owner.Transform.Coordinates;

            SoundSystem.Play(Filter.Pvs(pos), Sound, pos, AudioHelpers.WithVariation(0.125f));
        }
Пример #10
0
        public void Trigger(IEntity owner, DestructibleSystem system)
        {
            if (string.IsNullOrEmpty(Sound))
            {
                return;
            }

            var pos = owner.Transform.Coordinates;

            system.AudioSystem.PlayAtCoords(Sound, pos, AudioHelpers.WithVariation(0.125f));
        }
Пример #11
0
        public void Execute(IEntity owner, DestructibleSystem system)
        {
            if (string.IsNullOrEmpty(SoundCollection))
            {
                return;
            }

            var sound = AudioHelpers.GetRandomFileFromSoundCollection(SoundCollection);
            var pos   = owner.Transform.Coordinates;

            system.AudioSystem.PlayAtCoords(sound, pos, AudioHelpers.WithVariation(0.125f));
        }
Пример #12
0
        public void Execute(EntityUid owner, DestructibleSystem system)
        {
            if (HasAct(ThresholdActs.Breakage))
            {
                system.ActSystem.HandleBreakage(owner);
            }

            if (HasAct(ThresholdActs.Destruction))
            {
                system.ActSystem.HandleDestruction(owner);
            }
        }
        public void Execute(IEntity owner, DestructibleSystem system)
        {
            if (owner.Deleted || !owner.TryGetComponent <ContainerManagerComponent>(out var containerManager))
            {
                return;
            }

            foreach (var container in containerManager.GetAllContainers())
            {
                container.EmptyContainer(true, owner.Transform.Coordinates);
            }
        }
        public void Execute(EntityUid owner, DestructibleSystem system)
        {
            if (HasAct(ThresholdActs.Breakage))
            {
                system.BreakEntity(owner);
            }

            if (HasAct(ThresholdActs.Destruction))
            {
                system.DestroyEntity(owner);
            }
        }
        public void Execute(EntityUid owner, DestructibleSystem system)
        {
            if (!system.EntityManager.TryGetComponent <ContainerManagerComponent>(owner, out var containerManager))
            {
                return;
            }

            foreach (var container in containerManager.GetAllContainers())
            {
                container.EmptyContainer(true, system.EntityManager.GetComponent <TransformComponent>(owner).Coordinates);
            }
        }
        /// <summary>
        /// If there is a SpillableComponent on EntityUidowner use it to create a puddle/smear.
        /// Or whatever solution is specified in the behavior itself.
        /// If none are available do nothing.
        /// </summary>
        /// <param name="owner">Entity on which behavior is executed</param>
        /// <param name="system">system calling the behavior</param>
        public void Execute(EntityUid owner, DestructibleSystem system)
        {
            var solutionContainerSystem = EntitySystem.Get <SolutionContainerSystem>();
            var spillableSystem         = EntitySystem.Get <SpillableSystem>();

            var coordinates = system.EntityManager.GetComponent <TransformComponent>(owner).Coordinates;

            if (system.EntityManager.TryGetComponent(owner, out SpillableComponent? spillableComponent) &&
                solutionContainerSystem.TryGetSolution(owner, spillableComponent.SolutionName,
                                                       out var compSolution))
            {
                spillableSystem.SpillAt(compSolution, coordinates, "PuddleSmear", false);
            }
            else if (Solution != null &&
                     solutionContainerSystem.TryGetSolution(owner, Solution, out var behaviorSolution))
            {
                spillableSystem.SpillAt(behaviorSolution, coordinates, "PuddleSmear");
            }
        }
Пример #17
0
        public void Execute(EntityUid owner, DestructibleSystem system)
        {
            if (!system.EntityManager.TryGetComponent <VendingMachineComponent>(owner, out var vendingcomp) ||
                !system.EntityManager.TryGetComponent <TransformComponent>(owner, out var xform))
            {
                return;
            }

            var throwingsys = system.EntityManager.EntitySysManager.GetEntitySystem <ThrowingSystem>();
            var totalItems  = vendingcomp.AllInventory.Count;

            var toEject = Math.Min(totalItems * Percent, Max);

            for (var i = 0; i < toEject; i++)
            {
                var entity = system.EntityManager.SpawnEntity(system.Random.PickAndTake(vendingcomp.AllInventory).ID, xform.Coordinates);

                float   range     = vendingcomp.NonLimitedEjectRange;
                Vector2 direction = new Vector2(system.Random.NextFloat(-range, range), system.Random.NextFloat(-range, range));
                throwingsys.TryThrow(entity, direction, vendingcomp.NonLimitedEjectForce);
            }
        }
Пример #18
0
        public void Execute(IEntity owner, DestructibleSystem system)
        {
            var pos = owner.Transform.Coordinates;

            SoundSystem.Play(Filter.Pvs(pos), Sound.GetSound(), pos, AudioHelpers.WithVariation(0.125f));
        }
 public bool Reached(DamageableComponent damageable, DestructibleSystem system)
 {
     return(damageable.DamagePerGroup[DamageGroup] >= Damage);
 }
 public void Execute(EntityUid owner, DestructibleSystem system)
 {
     system.TriggerSystem.Trigger(owner);
 }
 public void Execute(IEntity owner, DestructibleSystem system)
 {
     owner.SpawnExplosion();
 }
 public void Execute(EntityUid owner, DestructibleSystem system)
 {
     system.ExplosionSystem.SpawnExplosion(owner);
 }
Пример #23
0
 public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
 {
     return(damageable.TotalDamage >= Damage);
 }
Пример #24
0
        public void Execute(EntityUid owner, DestructibleSystem system)
        {
            var pos = system.EntityManager.GetComponent <TransformComponent>(owner).Coordinates;

            SoundSystem.Play(Filter.Pvs(pos), Sound.GetSound(), pos, AudioHelpers.WithVariation(0.125f));
        }
 public void Execute(EntityUid owner, DestructibleSystem system)
 {
     system.ExplosionSystem.TriggerExplosive(owner);
 }
 public void Execute(EntityUid owner, DestructibleSystem system)
 {
     system.EntityManager.EntitySysManager.GetEntitySystem <GasCanisterSystem>().PurgeContents(owner);
 }
 public bool Reached(DamageableComponent damageable, DestructibleSystem system)
 {
     return(damageable.Damage.DamageDict.TryGetValue(DamageType, out var damageReceived) &&
            damageReceived >= Damage);
 }