2021-03-21 09:12:03 -07:00
|
|
|
using Content.Server.GameObjects.Components.Chemistry;
|
2020-09-22 15:34:30 +02:00
|
|
|
using Content.Server.GameObjects.Components.Fluids;
|
|
|
|
|
using Content.Shared.Audio;
|
|
|
|
|
using Content.Shared.Interfaces.GameObjects.Components;
|
2021-03-21 09:12:03 -07:00
|
|
|
using Robust.Shared.Audio;
|
2020-09-22 15:34:30 +02:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-03-21 09:12:03 -07:00
|
|
|
using Robust.Shared.Player;
|
2021-03-21 18:05:35 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
|
|
|
using Robust.Shared.ViewVariables;
|
2020-09-22 15:34:30 +02:00
|
|
|
|
|
|
|
|
namespace Content.Server.GameObjects.Components.Nutrition
|
|
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
2021-03-21 17:04:44 +01:00
|
|
|
public class CreamPieComponent : Component, ILand, IThrowCollide
|
2020-09-22 15:34:30 +02:00
|
|
|
{
|
|
|
|
|
public override string Name => "CreamPie";
|
|
|
|
|
|
2021-03-21 18:05:35 +01:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2021-05-04 15:37:16 +02:00
|
|
|
[DataField("paralyzeTime")]
|
2021-03-21 18:05:35 +01:00
|
|
|
public float ParalyzeTime { get; set; } = 1f;
|
|
|
|
|
|
2020-09-22 15:34:30 +02:00
|
|
|
public void PlaySound()
|
|
|
|
|
{
|
2021-03-21 09:12:03 -07:00
|
|
|
SoundSystem.Play(Filter.Pvs(Owner), AudioHelpers.GetRandomFileFromSoundCollection("desecration"), Owner,
|
2020-09-22 15:34:30 +02:00
|
|
|
AudioHelpers.WithVariation(0.125f));
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-21 17:04:44 +01:00
|
|
|
void IThrowCollide.DoHit(ThrowCollideEventArgs eventArgs)
|
|
|
|
|
{
|
|
|
|
|
Splat();
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-04 17:44:49 +01:00
|
|
|
void ILand.Land(LandEventArgs eventArgs)
|
2021-03-21 17:04:44 +01:00
|
|
|
{
|
|
|
|
|
Splat();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Splat()
|
2020-09-22 15:34:30 +02:00
|
|
|
{
|
|
|
|
|
PlaySound();
|
|
|
|
|
|
2021-03-16 15:50:20 +01:00
|
|
|
if (Owner.TryGetComponent(out SolutionContainerComponent? solution))
|
2020-09-22 15:34:30 +02:00
|
|
|
{
|
|
|
|
|
solution.Solution.SpillAt(Owner, "PuddleSmear", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Owner.Delete();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|