Files

154 lines
5.6 KiB
C#
Raw Permalink Normal View History

2023-04-10 15:37:03 +10:00
using Content.Shared.Chemistry.Components;
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.DoAfter;
using Content.Shared.IdentityManagement;
using Content.Shared.Mobs.Systems;
2021-11-14 19:33:16 +03:00
using Content.Shared.Nutrition.Components;
2023-04-02 22:42:30 -04:00
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Popups;
using Content.Shared.Udder;
2021-11-14 19:33:16 +03:00
using Content.Shared.Verbs;
using Robust.Shared.Containers;
using Robust.Shared.Timing;
2021-11-14 19:33:16 +03:00
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
namespace Content.Shared.Animals;
/// <summary>
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
/// Gives the ability to produce milkable reagents;
/// produces endlessly if the owner does not have a HungerComponent.
/// </summary>
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
public sealed class UdderSystem : EntitySystem
2021-11-14 19:33:16 +03:00
{
[Dependency] private readonly HungerSystem _hunger = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
public override void Initialize()
2021-11-14 19:33:16 +03:00
{
base.Initialize();
2021-11-14 19:33:16 +03:00
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
SubscribeLocalEvent<UdderComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<UdderComponent, GetVerbsEvent<AlternativeVerb>>(AddMilkVerb);
SubscribeLocalEvent<UdderComponent, MilkingDoAfterEvent>(OnDoAfter);
SubscribeLocalEvent<UdderComponent, EntRemovedFromContainerMessage>(OnEntRemoved);
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
}
private void OnMapInit(EntityUid uid, UdderComponent component, MapInitEvent args)
{
component.NextGrowth = _timing.CurTime + component.GrowthDelay;
}
2021-11-14 19:33:16 +03:00
private void OnEntRemoved(Entity<UdderComponent> entity, ref EntRemovedFromContainerMessage args)
{
// Make sure the removed entity was our contained solution
if (entity.Comp.Solution == null || args.Entity != entity.Comp.Solution.Value.Owner)
return;
// Cleared our cached reference to the solution entity
entity.Comp.Solution = null;
}
public override void Update(float frameTime)
{
base.Update(frameTime);
var query = EntityQueryEnumerator<UdderComponent>();
while (query.MoveNext(out var uid, out var udder))
2021-11-14 19:33:16 +03:00
{
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
if (_timing.CurTime < udder.NextGrowth)
continue;
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
udder.NextGrowth += udder.GrowthDelay;
if (_mobState.IsDead(uid))
continue;
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
if (!_solutionContainerSystem.ResolveSolution(uid, udder.SolutionName, ref udder.Solution, out var solution))
continue;
if (solution.AvailableVolume == 0)
continue;
// Actually there is food digestion so no problem with instant reagent generation "OnFeed"
if (TryComp(uid, out HungerComponent? hunger))
2021-11-14 19:33:16 +03:00
{
// Is there enough nutrition to produce reagent?
if (_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay)
continue;
_hunger.ModifyHunger(uid, -udder.HungerUsage, hunger);
2021-11-14 19:33:16 +03:00
}
//TODO: toxins from bloodstream !?
_solutionContainerSystem.TryAddReagent(udder.Solution.Value, udder.ReagentId, udder.QuantityPerUpdate, out _);
2021-11-14 19:33:16 +03:00
}
}
private void AttemptMilk(Entity<UdderComponent?> udder, EntityUid userUid, EntityUid containerUid)
{
if (!Resolve(udder, ref udder.Comp))
return;
2021-11-14 19:33:16 +03:00
var doargs = new DoAfterArgs(EntityManager, userUid, 5, new MilkingDoAfterEvent(), udder, udder, used: containerUid)
2021-11-14 19:33:16 +03:00
{
BreakOnMove = true,
BreakOnDamage = true,
MovementThreshold = 1.0f,
};
2021-11-14 19:33:16 +03:00
_doAfterSystem.TryStartDoAfter(doargs);
}
2021-11-14 19:33:16 +03:00
private void OnDoAfter(Entity<UdderComponent> entity, ref MilkingDoAfterEvent args)
{
if (args.Cancelled || args.Handled || args.Args.Used == null)
return;
2021-11-14 19:33:16 +03:00
if (!_solutionContainerSystem.ResolveSolution(entity.Owner, entity.Comp.SolutionName, ref entity.Comp.Solution, out var solution))
return;
if (!_solutionContainerSystem.TryGetRefillableSolution(args.Args.Used.Value, out var targetSoln, out var targetSolution))
return;
args.Handled = true;
var quantity = solution.Volume;
if (quantity == 0)
{
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
_popupSystem.PopupClient(Loc.GetString("udder-system-dry"), entity.Owner, args.Args.User);
return;
}
2021-11-14 19:33:16 +03:00
if (quantity > targetSolution.AvailableVolume)
quantity = targetSolution.AvailableVolume;
2021-11-14 19:33:16 +03:00
var split = _solutionContainerSystem.SplitSolution(entity.Comp.Solution.Value, quantity);
_solutionContainerSystem.TryAddSolution(targetSoln.Value, split);
2021-11-14 19:33:16 +03:00
Fix udder wooly reagent creation V2 (#32905) * Changed comments to be more clear and uniform. EggLayer uses NextGrowth instead of frame accumulation. Egglayer uses much less energy to make eggs, and lay time is randomized for player and AI chicken. * UdderComponent ReagentId can be changed now UdderSystem and WoolySystem use SharedSolutionContainerSystem now * Entities with udders can be examined to see a rough hunger level udders and wooly stop reagent generation/extra nutrient usage once the solution container is full * Moved stuff to Shared AutoPausedField now * Cleanup moving stuff to Shared * Oops. Make UdderSystem sealed instead of abstract. * Switch PopupEntity for PopupClient * Didn't mean to delete Access * new() instead of default! prototype revert egglayer balance change NextGrowth += timespan in egglayer * forgot [Datafield] for NextGrowth * forgot NetworkedComponent again... * Renaming Shared Animal to Shared Animals to match Server Hopefully also resolve merge conflicts. * Fix incorrect filename * Update with requested changes Put UdderSystem dependencies in alphabetical order. Initialise NextGrowth for Udder and Wooly components on MapInitEvent. Clean-up EggLayerSystem a little. Re-write OnExamine function for UdderSystem, improving clarity. Add full stops to end of udder examine locales. And more :) * Add some additional descriptions for cow hunger levels. * Add Udder and Wooly quantity to AutoNetworkedField * Account for less than starving threshold. --------- Co-authored-by: sirionaut <sirionaut@gmail.com> Co-authored-by: Sirionaut <148076704+Sirionaut@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2024-12-16 12:53:21 +00:00
_popupSystem.PopupClient(Loc.GetString("udder-system-success", ("amount", quantity), ("target", Identity.Entity(args.Args.Used.Value, EntityManager))), entity.Owner,
args.Args.User, PopupType.Medium);
}
2021-11-14 19:33:16 +03:00
private void AddMilkVerb(Entity<UdderComponent> entity, ref GetVerbsEvent<AlternativeVerb> args)
{
if (args.Using == null ||
!args.CanInteract ||
!HasComp<RefillableSolutionComponent>(args.Using.Value))
return;
2021-11-14 19:33:16 +03:00
var uid = entity.Owner;
var user = args.User;
var used = args.Using.Value;
AlternativeVerb verb = new()
2021-11-14 19:33:16 +03:00
{
Act = () =>
2021-11-14 19:33:16 +03:00
{
AttemptMilk(uid, user, used);
},
Text = Loc.GetString("udder-system-verb-milk"),
Priority = 2
};
args.Verbs.Add(verb);
2021-11-14 19:33:16 +03:00
}
}