/// <summary> /// uses hunger to release a specific amount of miasma into the air. This heals the rat king /// and his servants through a specific metabolism. /// </summary> private void OnDomain(EntityUid uid, RatKingComponent component, RatKingDomainActionEvent args) { if (args.Handled) { return; } if (!TryComp <HungerComponent>(uid, out var hunger)) { return; } //make sure the hunger doesn't go into the negatives if (hunger.CurrentHunger < component.HungerPerDomainUse) { _popup.PopupEntity(Loc.GetString("rat-king-too-hungry"), uid, Filter.Entities(uid)); return; } args.Handled = true; hunger.CurrentHunger -= component.HungerPerDomainUse; _popup.PopupEntity(Loc.GetString("rat-king-domain-popup"), uid, Filter.Pvs(uid)); var tileMix = _atmos.GetTileMixture(Transform(uid).Coordinates); if (tileMix != null) { tileMix.AdjustMoles(Gas.Miasma, component.MolesMiasmaPerDomain); } }
/// <summary> /// uses hunger to release a specific amount of miasma into the air. This heals the rat king /// and his servants through a specific metabolism. /// </summary> private void OnDomain(EntityUid uid, RatKingComponent component, RatKingDomainActionEvent args) { if (args.Handled) { return; } if (!TryComp <HungerComponent>(uid, out var hunger)) { return; } //make sure the hunger doesn't go into the negatives if (hunger.CurrentHunger < component.HungerPerDomainUse) { _popup.PopupEntity(Loc.GetString("rat-king-too-hungry"), uid, Filter.Entities(uid)); return; } args.Handled = true; hunger.CurrentHunger -= component.HungerPerDomainUse; _popup.PopupEntity(Loc.GetString("rat-king-domain-popup"), uid, Filter.Pvs(uid)); var transform = Transform(uid); var indices = _xform.GetGridOrMapTilePosition(uid, transform); var tileMix = _atmos.GetTileMixture(transform.GridUid, transform.MapUid, indices, true); tileMix?.AdjustMoles(Gas.Miasma, component.MolesMiasmaPerDomain); }