Toy Box filled with toys (ready for merge) (#16252)

This commit is contained in:
brainfood1183
2023-06-03 04:31:47 +01:00
committed by GitHub
parent 3d29ab3486
commit c99585c94f
75 changed files with 1118 additions and 13 deletions

View File

@@ -0,0 +1,15 @@
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
namespace Content.Shared.Glue
{
[RegisterComponent, NetworkedComponent]
public sealed class GlueComponent : Component
{
/// <summary>
/// Noise made when glue applied.
/// </summary>
[DataField("squeeze")]
public SoundSpecifier Squeeze = new SoundPathSpecifier("/Audio/Items/squeezebottle.ogg");
}
}

View File

@@ -0,0 +1,42 @@
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Glue;
[RegisterComponent]
public sealed class GluedComponent : Component
{
/// <summary>
/// Reverts name to before prefix event (essentially removes prefix).
/// </summary>
[DataField("beforeGluedEntityName"), ViewVariables(VVAccess.ReadOnly)]
public string BeforeGluedEntityName = String.Empty;
/// <summary>
/// Sound made when glue applied.
/// </summary>
[DataField("squeeze")]
public SoundSpecifier Squeeze = new SoundPathSpecifier("/Audio/Items/squeezebottle.ogg");
/// <summary>
/// Timings for glue duration and removal.
/// </summary>
[DataField("nextGlueTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan? NextGlueTime;
[DataField("glueTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan GlueTime = TimeSpan.Zero;
[DataField("glueCooldown")]
public TimeSpan GlueCooldown = TimeSpan.FromSeconds(20);
/// <summary>
/// Bools which control timings and when to apply the glue effect.
/// </summary>
public bool GlueBroken = false;
[DataField("glued")]
[ViewVariables(VVAccess.ReadWrite)]
public bool Glued = false;
}

View File

@@ -0,0 +1,11 @@
using Robust.Shared.GameStates;
namespace Content.Shared.Puppet
{
[RegisterComponent, NetworkedComponent]
public sealed class PuppetDummyComponent : Component
{
[DataField("enabled")]
public bool Enabled = false;
}
}

View File

@@ -0,0 +1,71 @@
using Content.Shared.ActionBlocker;
using Content.Shared.Hands;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Content.Shared.Emoting;
using Content.Shared.Movement.Events;
namespace Content.Shared.Puppet
{
public abstract class SharedPuppetDummySystem : EntitySystem
{
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PuppetDummyComponent, UseAttemptEvent>(OnUseAttempt);
SubscribeLocalEvent<PuppetDummyComponent, InteractionAttemptEvent>(OnInteractAttempt);
SubscribeLocalEvent<PuppetDummyComponent, DropAttemptEvent>(OnDropAttempt);
SubscribeLocalEvent<PuppetDummyComponent, PickupAttemptEvent>(OnPickupAttempt);
SubscribeLocalEvent<PuppetDummyComponent, UpdateCanMoveEvent>(OnMoveAttempt);
SubscribeLocalEvent<PuppetDummyComponent, EmoteAttemptEvent>(OnEmoteAttempt);
SubscribeLocalEvent<PuppetDummyComponent, ChangeDirectionAttemptEvent>(OnChangeDirectionAttempt);
SubscribeLocalEvent<PuppetDummyComponent, ComponentStartup>(OnStartup);
}
private void OnStartup(EntityUid uid, PuppetDummyComponent component, ComponentStartup args)
{
_blocker.UpdateCanMove(uid);
}
private void OnMoveAttempt(EntityUid uid, PuppetDummyComponent component, UpdateCanMoveEvent args)
{
if (component.LifeStage > ComponentLifeStage.Running)
return;
args.Cancel();
}
private void OnChangeDirectionAttempt(EntityUid uid, PuppetDummyComponent component, ChangeDirectionAttemptEvent args)
{
args.Cancel();
}
private void OnUseAttempt(EntityUid uid, PuppetDummyComponent component, UseAttemptEvent args)
{
args.Cancel();
}
private void OnEmoteAttempt(EntityUid uid, PuppetDummyComponent component, EmoteAttemptEvent args)
{
args.Cancel();
}
private void OnInteractAttempt(EntityUid uid, PuppetDummyComponent component, InteractionAttemptEvent args)
{
args.Cancel();
}
private void OnDropAttempt(EntityUid uid, PuppetDummyComponent component, DropAttemptEvent args)
{
args.Cancel();
}
private void OnPickupAttempt(EntityUid uid, PuppetDummyComponent component, PickupAttemptEvent args)
{
args.Cancel();
}
}
}

View File

@@ -107,6 +107,10 @@ public sealed partial class VehicleComponent : Component
[ViewVariables(VVAccess.ReadWrite)]
public bool AutoAnimate = true;
[DataField("useHand")]
[ViewVariables(VVAccess.ReadWrite)]
public bool UseHand = true;
[DataField("hideRider")]
[ViewVariables(VVAccess.ReadWrite)]
public bool HideRider;

View File

@@ -106,13 +106,15 @@ public abstract partial class SharedVehicleSystem : EntitySystem
// Add Rider
if (args.Buckling)
{
// Add a virtual item to rider's hand, unbuckle if we can't.
if (!_virtualItemSystem.TrySpawnVirtualItemInHand(uid, args.BuckledEntity))
if (component.UseHand == true)
{
_buckle.TryUnbuckle(uid, uid, true);
return;
// Add a virtual item to rider's hand, unbuckle if we can't.
if (!_virtualItemSystem.TrySpawnVirtualItemInHand(uid, args.BuckledEntity))
{
_buckle.TryUnbuckle(uid, uid, true);
return;
}
}
// Set up the rider and vehicle with each other
EnsureComp<InputMoverComponent>(uid);
var rider = EnsureComp<RiderComponent>(args.BuckledEntity);
@@ -148,7 +150,9 @@ public abstract partial class SharedVehicleSystem : EntitySystem
// Clean up actions and virtual items
_actionsSystem.RemoveProvidedActions(args.BuckledEntity, uid);
_virtualItemSystem.DeleteInHandsMatching(args.BuckledEntity, uid);
if (component.UseHand == true)
_virtualItemSystem.DeleteInHandsMatching(args.BuckledEntity, uid);
// Entity is no longer riding