Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RefillableSolution: selective transfer outwards #2583

Merged
5 changes: 5 additions & 0 deletions Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ private bool TryTwoWayAbsorbentRefillableTransfer(
{
_popups.PopupEntity(Loc.GetString("mopping-system-full", ("used", target)), user, user);
}
// Frontier: out-only refillable solutions
else if (TryComp<RefillableSolutionComponent>(refillableSoln.Owner, out var refillableSolnComp) && refillableSolnComp.PreventTransferOut)
{
}
// End Frontier
else
{
// transfer as much contaminants to refillable as will fit
Expand Down
5 changes: 5 additions & 0 deletions Content.Server/Fluids/EntitySystems/PuddleSystem.Transfers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ private void InitializeTransfers()

private void OnRefillableDragged(Entity<RefillableSolutionComponent> entity, ref DragDropDraggedEvent args)
{
// Frontier: silently prevent non-transferrable solution
if (entity.Comp.PreventTransferOut)
return;
// End Frontier

if (!_solutionContainerSystem.TryGetSolution(entity.Owner, entity.Comp.Solution, out var soln, out var solution) || solution.Volume == FixedPoint2.Zero)
{
_popups.PopupEntity(Loc.GetString("mopping-system-empty", ("used", entity.Owner)), entity, args.User);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@ public sealed partial class RefillableSolutionComponent : Component
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2? MaxRefill = null;

/// <summary>
/// Frontier: prevent transferring solution out into others
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool PreventTransferOut = false;
}
4 changes: 3 additions & 1 deletion Content.Shared/Fluids/SharedPuddleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void OnDumpCanDropTarget(Entity<DumpableSolutionComponent> entity, ref C

private void OnDrainCanDropTarget(Entity<DrainableSolutionComponent> entity, ref CanDropTargetEvent args)
{
if (HasComp<RefillableSolutionComponent>(args.Dragged))
if (TryComp<RefillableSolutionComponent>(args.Dragged, out var refillable) && !refillable.PreventTransferOut) // Frontier: HasComp<TryComp, add PreventTransferOut check
{
args.CanDrop = true;
args.Handled = true;
Expand All @@ -66,6 +66,8 @@ private void OnRefillableCanDropDragged(Entity<RefillableSolutionComponent> enti
{
if (!HasComp<DrainableSolutionComponent>(args.Target) && !HasComp<DumpableSolutionComponent>(args.Target))
return;
if (entity.Comp.PreventTransferOut) // Frontier
return; // Frontier

args.CanDrop = true;
args.Handled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
solution: food
- type: RefillableSolution
solution: food
preventTransferOut: true # Frontier

# usable by any food that can be opened
# handles appearance with states "icon" and "icon-open"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
cube:
maxVol: 11 # needs room for water
reagents:
- ReagentId: Nutriment
- ReagentId: Enzyme # Nutriment<Enzyme
Quantity: 10
- type: Food
solution: cube
Expand Down Expand Up @@ -172,7 +172,7 @@
plushie:
maxVol: 11 # needs room for water
reagents:
- ReagentId: Nutriment #contains nutriment like other dehydrated animals, but isn't edible? Who is grinding dehydrated carp to eat them??
- ReagentId: CarpoToxin #Frontier Nutriment<CarpoToxin
Quantity: 10
- type: RefillableSolution
solution: plushie
Expand Down Expand Up @@ -232,7 +232,7 @@
cube:
maxVol: 11 # needs room for water
reagents:
- ReagentId: Nutriment
- ReagentId: Ipecac # Nutriment<Ipecac
Quantity: 10
- type: Food
solution: cube
Expand Down
Loading