2021-01-02 07:05:32 +00:00
|
|
|
using Content.Server.GameObjects.Components.Mobs;
|
2020-09-22 15:34:30 +02:00
|
|
|
using Content.Server.Utility;
|
|
|
|
|
using Content.Shared.Chemistry;
|
|
|
|
|
using Content.Shared.GameObjects.Components.Nutrition;
|
|
|
|
|
using Content.Shared.Interfaces;
|
|
|
|
|
using Content.Shared.Interfaces.GameObjects.Components;
|
|
|
|
|
using Robust.Server.GameObjects;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.Localization;
|
|
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.GameObjects.Components.Nutrition
|
|
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
2021-03-26 12:02:41 +01:00
|
|
|
public class CreamPiedComponent : SharedCreamPiedComponent, IThrowCollide
|
2020-09-22 15:34:30 +02:00
|
|
|
{
|
|
|
|
|
private bool _creamPied;
|
|
|
|
|
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public bool CreamPied
|
|
|
|
|
{
|
|
|
|
|
get => _creamPied;
|
|
|
|
|
private set
|
|
|
|
|
{
|
2021-03-21 21:11:38 +01:00
|
|
|
if (value == _creamPied) return;
|
|
|
|
|
|
2020-09-22 15:34:30 +02:00
|
|
|
_creamPied = value;
|
2021-03-16 15:50:20 +01:00
|
|
|
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
|
2020-09-22 15:34:30 +02:00
|
|
|
{
|
|
|
|
|
appearance.SetData(CreamPiedVisuals.Creamed, CreamPied);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Wash()
|
|
|
|
|
{
|
|
|
|
|
if(CreamPied)
|
|
|
|
|
CreamPied = false;
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-04 17:44:49 +01:00
|
|
|
void IThrowCollide.HitBy(ThrowCollideEventArgs eventArgs)
|
2020-09-22 15:34:30 +02:00
|
|
|
{
|
2021-03-21 21:11:38 +01:00
|
|
|
if (eventArgs.Thrown.Deleted || !eventArgs.Thrown.TryGetComponent(out CreamPieComponent? creamPie)) return;
|
2020-09-22 15:34:30 +02:00
|
|
|
|
|
|
|
|
CreamPied = true;
|
|
|
|
|
Owner.PopupMessage(Loc.GetString("You have been creamed by {0:theName}!", eventArgs.Thrown));
|
|
|
|
|
Owner.PopupMessageOtherClients(Loc.GetString("{0:theName} has been creamed by {1:theName}!", Owner, eventArgs.Thrown));
|
|
|
|
|
|
2021-03-16 15:50:20 +01:00
|
|
|
if (Owner.TryGetComponent(out StunnableComponent? stun))
|
2020-09-22 15:34:30 +02:00
|
|
|
{
|
2021-03-21 18:05:35 +01:00
|
|
|
stun.Paralyze(creamPie.ParalyzeTime);
|
2020-09-22 15:34:30 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|