public void Execute(IEntity owner, DestructibleSystem system) { if (owner.TryGetComponent(out IBody body)) { body.Gib(_recursive); } }
public void Trigger(IEntity owner, DestructibleSystem system) { if (!owner.TryGetComponent(out SolutionContainerComponent? solutionContainer)) return; solutionContainer.Solution.SpillAt(owner.Transform.Coordinates, "PuddleSmear", false); }
public void Execute(EntityUid owner, DestructibleSystem system) { if (system.EntityManager.TryGetComponent(owner, out SharedBodyComponent? body)) { body.Gib(_recursive); } }
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); }
public async void Execute(IEntity owner, DestructibleSystem system) { if (string.IsNullOrEmpty(Node) || !owner.TryGetComponent(out ConstructionComponent? construction)) { return; } await construction.ChangeNode(Node); }
public bool Reached(IDamageableComponent damageable, DestructibleSystem system) { if (Type == null) { return(false); } return(damageable.TryGetDamage(Type.Value, out var damageReceived) && damageReceived >= Damage); }
/// <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); }
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)); }
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)); }
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)); }
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"); } }
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); } }
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); }
public bool Reached(IDamageableComponent damageable, DestructibleSystem system) { return(damageable.TotalDamage >= Damage); }
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); }