Adds creampie launcher

This commit is contained in:
Vera Aguilera Puerto
2021-03-21 18:05:35 +01:00
parent 1a8982da52
commit d505ce1409
12 changed files with 90 additions and 15 deletions

View File

@@ -5,6 +5,8 @@ using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Nutrition
{
@@ -13,6 +15,10 @@ namespace Content.Server.GameObjects.Components.Nutrition
{
public override string Name => "CreamPie";
[ViewVariables(VVAccess.ReadWrite)]
[field: DataField("paralyzeTime")]
public float ParalyzeTime { get; set; } = 1f;
public void PlaySound()
{
SoundSystem.Play(Filter.Pvs(Owner), AudioHelpers.GetRandomFileFromSoundCollection("desecration"), Owner,

View File

@@ -51,7 +51,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
void IThrowCollide.HitBy(ThrowCollideEventArgs eventArgs)
{
if (!eventArgs.Thrown.HasComponent<CreamPieComponent>() || CreamPied) return;
if (CreamPied || eventArgs.Thrown.Deleted || !eventArgs.Thrown.TryGetComponent(out CreamPieComponent? creamPie)) return;
CreamPied = true;
Owner.PopupMessage(Loc.GetString("You have been creamed by {0:theName}!", eventArgs.Thrown));
@@ -59,7 +59,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
if (Owner.TryGetComponent(out StunnableComponent? stun))
{
stun.Paralyze(1f);
stun.Paralyze(creamPie.ParalyzeTime);
}
}
}

View File

@@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
set => _damages = value;
}
[field: DataField("delete_on_collide")]
[field: DataField("deleteOnCollide")]
public bool DeleteOnCollide { get; } = true;
// Get that juicy FPS hit sound
@@ -95,7 +95,8 @@ namespace Content.Server.GameObjects.Components.Projectiles
recoilComponent.Kick(direction);
}
Owner.Delete();
if(DeleteOnCollide)
Owner.Delete();
}
public override ComponentState GetComponentState(ICommonSession player)

View File

@@ -176,5 +176,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
Dart, // Placeholder
Grenade,
Energy,
CreamPie, // I can't wait for this enum to be a prototype type...
}
}