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

@@ -12,6 +12,7 @@ using Content.Server.Utility;
using Content.Shared.Audio;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Botany;
using Content.Shared.GameObjects.Components.Chemistry;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
using Content.Shared.Interfaces;
@@ -639,6 +640,13 @@ namespace Content.Server.GameObjects.Components.Botany
Seed = Seed.Diverge(modified);
}
private void ForceUpdateByExternalCause()
{
SkipAging++; // We're forcing an update cycle, so one age hasn't passed.
ForceUpdate = true;
Update();
}
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
var user = eventArgs.User;
@@ -695,29 +703,48 @@ namespace Content.Server.GameObjects.Components.Botany
return true;
}
if (usingItem.TryGetComponent(out SolutionContainerComponent? solution) && solution.CanRemoveSolutions)
if (usingItem.HasComponent<ShovelComponent>())
{
var amount = 5f;
if (Seed != null)
{
user.PopupMessageCursor(Loc.GetString("You remove the plant from the {0}.", Owner.Name));
user.PopupMessageOtherClients(Loc.GetString("{0} removes the plant.", user.Name));
RemovePlant();
}
else
{
user.PopupMessageCursor(Loc.GetString("There is no plant to remove."));
}
return true;
}
if (usingItem.TryGetComponent(out ISolutionInteractionsComponent? solution) && solution.CanDrain)
{
var amount = ReagentUnit.New(5);
var sprayed = false;
if (usingItem.TryGetComponent(out SprayComponent? spray))
{
sprayed = true;
amount = 1f;
amount = ReagentUnit.New(1);
EntitySystem.Get<AudioSystem>().PlayFromEntity(spray.SpraySound, usingItem, AudioHelpers.WithVariation(0.125f));
}
var chemAmount = ReagentUnit.New(amount);
var split = solution.Drain(amount);
if (split.TotalVolume == 0)
{
user.PopupMessageCursor(Loc.GetString("{0:TheName} is empty!", usingItem));
return true;
}
var split = solution.Solution.SplitSolution(chemAmount <= solution.Solution.TotalVolume ? chemAmount : solution.Solution.TotalVolume);
user.PopupMessageCursor(Loc.GetString(sprayed ? $"You spray {Owner.Name} with {usingItem.Name}." : $"You transfer {split.TotalVolume.ToString()}u to {Owner.Name}"));
user.PopupMessageCursor(Loc.GetString(
sprayed ? "You spray {0:TheName}" : "You transfer {1}u to {0:TheName}",
Owner, split.TotalVolume));
_solutionContainer?.TryAddSolution(split);
SkipAging++; // We're forcing an update cycle, so one age hasn't passed.
ForceUpdate = true;
Update();
ForceUpdateByExternalCause();
return true;
}
@@ -752,9 +779,7 @@ namespace Content.Server.GameObjects.Components.Botany
// Just in case.
CheckLevelSanity();
SkipAging++; // We're forcing an update cycle, so one age hasn't passed.
ForceUpdate = true;
Update();
ForceUpdateByExternalCause();
return true;
}
@@ -764,6 +789,24 @@ namespace Content.Server.GameObjects.Components.Botany
return DoHarvest(user);
}
if (usingItem.HasComponent<ProduceComponent>())
{
user.PopupMessageCursor(Loc.GetString("You compost {1:theName} into {0:theName}.", Owner, usingItem));
user.PopupMessageOtherClients(Loc.GetString("{0:TheName} composts {1:theName} into {2:theName}.", user, usingItem, Owner));
if (usingItem.TryGetComponent(out SolutionContainerComponent? solution2))
{
// This deliberately discards overfill.
_solutionContainer?.TryAddSolution(solution2.SplitSolution(solution2.Solution.TotalVolume));
ForceUpdateByExternalCause();
}
usingItem.Delete();
return true;
}
return false;
}

View File

@@ -0,0 +1,11 @@
#nullable enable
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Botany
{
[RegisterComponent]
public class ShovelComponent : Component
{
public override string Name => "Shovel";
}
}