Merge branch 'master-upstream' into expl_int_analyzer

# Conflicts:
#	Content.Server/GameObjects/Components/Body/Part/BodyPartComponent.cs
#	Content.Server/GameObjects/Components/Botany/PlantHolderComponent.cs
#	Content.Server/GameObjects/Components/Chemistry/PillComponent.cs
#	Content.Server/GameObjects/Components/Interactable/TilePryingComponent.cs
#	Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs
#	Content.Server/GameObjects/Components/Items/RCD/RCDAmmoComponent.cs
#	Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs
#	Content.Server/GameObjects/Components/Medical/HealingComponent.cs
#	Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs
#	Content.Shared/Chemistry/Solution.cs
This commit is contained in:
Paul
2021-02-04 17:50:28 +01:00
499 changed files with 6357 additions and 8689 deletions

View File

@@ -62,14 +62,16 @@ namespace Content.Server.GameObjects.Components.Fluids
Owner.EnsureComponentWarn(out SolutionContainerComponent _);
}
async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
{
if (!Owner.TryGetComponent(out SolutionContainerComponent? contents)) return;
if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true)) return;
if (!Owner.TryGetComponent(out SolutionContainerComponent? contents))
return false;
if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
return false;
if (CurrentVolume <= 0)
{
return;
return true;
}
if (eventArgs.Target == null)
@@ -77,12 +79,12 @@ namespace Content.Server.GameObjects.Components.Fluids
// Drop the liquid on the mop on to the ground
contents.SplitSolution(CurrentVolume).SpillAt(eventArgs.ClickLocation, "PuddleSmear");
return;
return true;
}
if (!eventArgs.Target.TryGetComponent(out PuddleComponent? puddleComponent))
{
return;
return true;
}
// Essentially pickup either:
// - _pickupAmount,
@@ -101,7 +103,7 @@ namespace Content.Server.GameObjects.Components.Fluids
}
else
{
return;
return true;
}
}
else
@@ -121,12 +123,12 @@ namespace Content.Server.GameObjects.Components.Fluids
// Give some visual feedback shit's happening (for anyone who can't hear sound)
Owner.PopupMessage(eventArgs.User, Loc.GetString("Swish"));
if (string.IsNullOrWhiteSpace(_pickupSound))
if (!string.IsNullOrWhiteSpace(_pickupSound))
{
return;
EntitySystem.Get<AudioSystem>().PlayFromEntity(_pickupSound, Owner);
}
EntitySystem.Get<AudioSystem>().PlayFromEntity(_pickupSound, Owner);
return true;
}
}
}

View File

@@ -1,6 +1,5 @@
using Content.Server.GameObjects.Components.Chemistry;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Interfaces;
@@ -24,34 +23,37 @@ namespace Content.Server.GameObjects.Components.Fluids
protected override void GetData(IEntity user, SpillableComponent component, VerbData data)
{
if (!ActionBlockerSystem.CanInteract(user) ||
!component.Owner.TryGetComponent(out SolutionContainerComponent solutionComponent) ||
!solutionComponent.CanRemoveSolutions)
!component.Owner.TryGetComponent(out ISolutionInteractionsComponent solutionComponent) ||
!solutionComponent.CanDrain)
{
data.Visibility = VerbVisibility.Invisible;
return;
}
data.Text = Loc.GetString("Spill liquid");
data.Visibility = solutionComponent.CurrentVolume > ReagentUnit.Zero ? VerbVisibility.Visible : VerbVisibility.Disabled;
data.Visibility = solutionComponent.DrainAvailable > ReagentUnit.Zero
? VerbVisibility.Visible
: VerbVisibility.Disabled;
}
protected override void Activate(IEntity user, SpillableComponent component)
{
if (component.Owner.TryGetComponent<SolutionContainerComponent>(out var solutionComponent))
if (component.Owner.TryGetComponent<ISolutionInteractionsComponent>(out var solutionComponent))
{
if (!solutionComponent.CanRemoveSolutions)
if (!solutionComponent.CanDrain)
{
user.PopupMessage(user, Loc.GetString("You can't pour anything from {0:theName}!", component.Owner));
user.PopupMessage(user,
Loc.GetString("You can't pour anything from {0:theName}!", component.Owner));
}
if (solutionComponent.CurrentVolume.Float() <= 0)
if (solutionComponent.DrainAvailable <= 0)
{
user.PopupMessage(user, Loc.GetString("{0:theName} is empty!", component.Owner));
}
// Need this as when we split the component's owner may be deleted
var entityLocation = component.Owner.Transform.Coordinates;
var solution = solutionComponent.SplitSolution(solutionComponent.CurrentVolume);
var solution = solutionComponent.Drain(solutionComponent.DrainAvailable);
solution.SpillAt(entityLocation, "PuddleSmear");
}
}

View File

@@ -100,34 +100,34 @@ namespace Content.Server.GameObjects.Components.Fluids
serializer.DataField(ref _safety, "safety", true);
}
async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
{
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
return;
return false;
if (_hasSafety && _safety)
{
Owner.PopupMessage(eventArgs.User, Loc.GetString("Its safety is on!"));
return;
return true;
}
if (CurrentVolume <= 0)
{
Owner.PopupMessage(eventArgs.User, Loc.GetString("It's empty!"));
return;
return true;
}
var curTime = _gameTiming.CurTime;
if(curTime < _cooldownEnd)
return;
return true;
var playerPos = eventArgs.User.Transform.Coordinates;
if (eventArgs.ClickLocation.GetGridId(_serverEntityManager) != playerPos.GetGridId(_serverEntityManager))
return;
return true;
if (!Owner.TryGetComponent(out SolutionContainerComponent contents))
return;
return true;
var direction = (eventArgs.ClickLocation.Position - playerPos.Position).Normalized;
var threeQuarters = direction * 0.75f;
@@ -183,6 +183,8 @@ namespace Content.Server.GameObjects.Components.Fluids
cooldown.CooldownStart = _lastUseTime;
cooldown.CooldownEnd = _cooldownEnd;
}
return true;
}
bool IUse.UseEntity(UseEntityEventArgs eventArgs)