private void OnGotEquipped(EntityUid uid, SpillableComponent component, GotEquippedEvent args) { if (!component.SpillWorn) { return; } if (!TryComp(uid, out ClothingComponent? clothing)) { return; } // check if entity was actually used as clothing // not just taken in pockets or something var isCorrectSlot = clothing.SlotFlags.HasFlag(args.SlotFlags); if (!isCorrectSlot) { return; } if (!_solutionContainerSystem.TryGetSolution(uid, component.SolutionName, out var solution)) { return; } if (solution.TotalVolume == 0) { return; } // spill all solution on the player var drainedSolution = _solutionContainerSystem.Drain(uid, solution, solution.DrainAvailable); SpillAt(args.Equipee, drainedSolution, "PuddleSmear"); }
private void OnGotEquipped(EntityUid uid, MagbootsComponent component, GotEquippedEvent args) { if (args.Slot == "shoes") { UpdateMagbootEffects(args.Equipee, uid, true, component); } }
private void OnEquipped(EntityUid uid, SuitSensorComponent component, GotEquippedEvent args) { if (args.Slot != component.ActivationSlot) { return; } component.User = args.Equipee; }
private void OnGotEquipped(EntityUid uid, BreathToolComponent component, GotEquippedEvent args) { if ((args.SlotFlags & component.AllowedSlots) != component.AllowedSlots) { return; } component.IsFunctional = true; if (TryComp(args.Equipee, out InternalsComponent? internals)) { component.ConnectedInternalsEntity = args.Equipee; internals.ConnectBreathTool(uid); } }
private void OnEntInserted(EntityUid uid, InventoryComponent component, EntInsertedIntoContainerMessage args) { if (!TryGetSlot(uid, args.Container.ID, out var slotDef, inventory: component)) { return; } var equippedEvent = new DidEquipEvent(uid, args.Entity, slotDef); RaiseLocalEvent(uid, equippedEvent); var gotEquippedEvent = new GotEquippedEvent(uid, args.Entity, slotDef); RaiseLocalEvent(args.Entity, gotEquippedEvent); }
/// <summary> /// Add the component the verb event subs to if the equippee is wearing the stethoscope. /// </summary> private void OnEquipped(EntityUid uid, StethoscopeComponent component, GotEquippedEvent args) { if (!TryComp <ClothingComponent>(uid, out var clothing)) { return; } // Is the clothing in its actual slot? if (!clothing.Slots.HasFlag(args.SlotFlags)) { return; } component.IsActive = true; var wearingComp = EnsureComp <WearingStethoscopeComponent>(args.Equipee); wearingComp.Stethoscope = uid; }
private void OnEquipped(EntityUid uid, BlindfoldComponent component, GotEquippedEvent args) { if (!TryComp <SharedClothingComponent>(uid, out var clothing) || clothing.Slots == SlotFlags.PREVENTEQUIP) // we live in a society { return; } // Is the clothing in its actual slot? if (!clothing.Slots.HasFlag(args.SlotFlags)) { return; } component.IsActive = true; if (!TryComp <BlindableComponent>(args.Equipee, out var blindComp)) { return; } AdjustBlindSources(args.Equipee, true, blindComp); }
private void OnGotEquipped(EntityUid uid, AddAccentClothingComponent component, GotEquippedEvent args) { if (!TryComp(uid, out ClothingComponent? clothing)) { return; } // check if entity was actually used as clothing // not just taken in pockets or something var isCorrectSlot = clothing.SlotFlags.HasFlag(args.SlotFlags); if (!isCorrectSlot) { return; } // does the user already has this accent? var componentType = _componentFactory.GetRegistration(component.Accent).Type; if (EntityManager.HasComponent(args.Equipee, componentType)) { return; } // add accent to the user var accentComponent = (Component)_componentFactory.GetComponent(componentType); accentComponent.Owner = args.Equipee; EntityManager.AddComponent(args.Equipee, accentComponent); // snowflake case for replacement accent if (accentComponent is ReplacementAccentComponent rep) { rep.Accent = component.ReplacementPrototype !; } component.IsActive = true; }
private void OnEquipped(EntityUid uid, SharedSpriteComponent component, GotEquippedEvent args) { component.Visible = false; }