Toy Box filled with toys (ready for merge) (#16252)
This commit is contained in:
15
Content.Shared/Glue/GlueComponent.cs
Normal file
15
Content.Shared/Glue/GlueComponent.cs
Normal 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");
|
||||
}
|
||||
}
|
||||
42
Content.Shared/Glue/GluedComponent.cs
Normal file
42
Content.Shared/Glue/GluedComponent.cs
Normal 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;
|
||||
}
|
||||
11
Content.Shared/Puppet/PuppetDummyComponent.cs
Normal file
11
Content.Shared/Puppet/PuppetDummyComponent.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
71
Content.Shared/Puppet/SharedPuppetDummySystem.cs
Normal file
71
Content.Shared/Puppet/SharedPuppetDummySystem.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user