2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Notification;
|
|
|
|
|
using Content.Server.Stunnable.Components;
|
|
|
|
|
using Content.Shared.Notification;
|
2021-06-13 14:52:40 +02:00
|
|
|
using Content.Shared.Notification.Managers;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Nutrition.Components;
|
|
|
|
|
using Content.Shared.Throwing;
|
2020-09-22 15:34:30 +02:00
|
|
|
using Robust.Server.GameObjects;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.Localization;
|
|
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Nutrition.Components
|
2020-09-22 15:34:30 +02:00
|
|
|
{
|
|
|
|
|
[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;
|
2021-06-21 02:13:54 +02:00
|
|
|
Owner.PopupMessage(Loc.GetString("cream-pied-component-on-hit-by-message",("thrower", eventArgs.Thrown)));
|
|
|
|
|
Owner.PopupMessageOtherClients(Loc.GetString("cream-pied-component-on-hit-by-message-others", ("owner", Owner),("thrower", eventArgs.Thrown)));
|
2020-09-22 15:34:30 +02:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|