private void OnEmagged(EntityUid uid, RecyclerComponent component, GotEmaggedEvent args) { if (!component.Safe) { return; } component.Safe = false; args.Handled = true; }
private void OnCollide(EntityUid uid, RecyclerComponent component, StartCollideEvent args) { if (component.Enabled && args.OurFixture.ID != "brrt") { return; } Recycle(component, args.OtherFixture.Body.Owner); }
public void DisableRecycler(RecyclerComponent component) { if (!component.Enabled) { return; } component.Enabled = false; _ambience.SetAmbience(component.Owner, false); }
public void EnableRecycler(RecyclerComponent component) { if (component.Enabled) { return; } component.Enabled = true; _ambience.SetAmbience(component.Owner, true); }
private void Recycle(RecyclerComponent component, EntityUid entity) { // TODO: Prevent collision with recycled items // Can only recycle things that are recyclable... And also check the safety of the thing to recycle. if (!EntityManager.TryGetComponent(entity, out RecyclableComponent? recyclable) || !recyclable.Safe && component.Safe) { return; } // Mobs are a special case! if (CanGib(component, entity)) { EntityManager.GetComponent <SharedBodyComponent>(entity).Gib(true); Bloodstain(component); return; } recyclable.Recycle(component.Efficiency); }
private void Recycle(RecyclerComponent component, EntityUid entity) { RecyclableComponent?recyclable = null; // Can only recycle things that are recyclable... And also check the safety of the thing to recycle. if (!_tags.HasTag(entity, "Recyclable") && (!TryComp(entity, out recyclable) || !recyclable.Safe && component.Safe)) { return; } // TODO: Prevent collision with recycled items // Mobs are a special case! if (CanGib(component, entity)) { Comp <SharedBodyComponent>(entity).Gib(true); Bloodstain(component); return; } if (recyclable == null) { QueueDel(entity); } else { Recycle(recyclable, component.Efficiency); } if (component.Sound != null && (_timing.CurTime - component.LastSound).TotalSeconds > RecyclerSoundCooldown) { SoundSystem.Play(Filter.Pvs(component.Owner, entityManager: EntityManager), component.Sound.GetSound(), component.Owner, AudioHelpers.WithVariation(0.01f).WithVolume(-3)); component.LastSound = _timing.CurTime; } }
private bool CanGib(RecyclerComponent component, EntityUid entity) { // We suppose this entity has a Recyclable component. return(EntityManager.HasComponent <SharedBodyComponent>(entity) && !component.Safe && EntityManager.TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) && receiver.Powered); }
private void HandleCollide(EntityUid uid, RecyclerComponent component, StartCollideEvent args) { Recycle(component, args.OtherFixture.Body.Owner); }
private bool CanGib(RecyclerComponent component, EntityUid entity) { // TODO: Power needs a helper for this jeez return(HasComp <SharedBodyComponent>(entity) && !component.Safe && TryComp <ApcPowerReceiverComponent>(component.Owner, out var receiver) && receiver.Powered); }
private bool CanGib(RecyclerComponent component, IEntity entity) { // We suppose this entity has a Recyclable component. return(entity.HasComponent <SharedBodyComponent>() && !component.Safe && component.Powered); }
private bool CanGib(RecyclerComponent component, EntityUid entity) { return(HasComp <SharedBodyComponent>(entity) && !component.Safe && this.IsPowered(component.Owner, EntityManager)); }
private bool CanGib(RecyclerComponent component, IEntity entity) { // We suppose this entity has a Recyclable component. return(entity.HasComponent <SharedBodyComponent>() && !component.Safe && component.Owner.TryGetComponent(out ApcPowerReceiverComponent? receiver) && receiver.Powered); }