Merge remote-tracking branch 'upstream/master' into ups
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using Content.Shared._White.Animations;
|
||||
using Content.Shared.Clothing.Components;
|
||||
using Content.Shared.Inventory.Events;
|
||||
|
||||
namespace Content.Shared.Clothing.EntitySystems;
|
||||
|
||||
public sealed class WaddleClothingSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<WaddleWhenWornComponent, GotEquippedEvent>(OnGotEquipped);
|
||||
SubscribeLocalEvent<WaddleWhenWornComponent, GotUnequippedEvent>(OnGotUnequipped);
|
||||
}
|
||||
|
||||
private void OnGotEquipped(EntityUid entity, WaddleWhenWornComponent comp, GotEquippedEvent args)
|
||||
{
|
||||
var waddleAnimComp = EnsureComp<WaddleAnimationComponent>(args.Equipee);
|
||||
|
||||
waddleAnimComp.AnimationLength = comp.AnimationLength;
|
||||
waddleAnimComp.HopIntensity = comp.HopIntensity;
|
||||
waddleAnimComp.RunAnimationLengthMultiplier = comp.RunAnimationLengthMultiplier;
|
||||
waddleAnimComp.TumbleIntensity = comp.TumbleIntensity;
|
||||
}
|
||||
|
||||
private void OnGotUnequipped(EntityUid entity, WaddleWhenWornComponent comp, GotUnequippedEvent args)
|
||||
{
|
||||
RemComp<WaddleAnimationComponent>(args.Equipee);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared._White.Item.PseudoItem;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
@@ -67,7 +68,8 @@ public abstract class SharedVirtualItemSystem : EntitySystem
|
||||
private void OnBeforeRangedInteract(Entity<VirtualItemComponent> ent, ref BeforeRangedInteractEvent args)
|
||||
{
|
||||
// No interactions with a virtual item, please.
|
||||
args.Handled = true;
|
||||
if (!HasComp<PseudoItemComponent>(ent.Comp.BlockingEntity))
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
#region Hands
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Frozen;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Shared._White.Item.PseudoItem;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Coordinates;
|
||||
@@ -10,6 +11,7 @@ using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Implants.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Inventory.VirtualItem;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Lock;
|
||||
using Content.Shared.Materials;
|
||||
@@ -223,6 +225,12 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
if (HasComp<PlaceableSurfaceComponent>(uid))
|
||||
return;
|
||||
|
||||
if (TryComp<VirtualItemComponent>(args.Used, out var virtualItem)) // WD
|
||||
{
|
||||
RaiseLocalEvent(uid, new PseudoItemInteractEvent(virtualItem.BlockingEntity, args.User));
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerInsertHeldEntity(uid, args.User, storageComp);
|
||||
// Always handle it, even if insertion fails.
|
||||
// We don't want to trigger any AfterInteract logic here.
|
||||
@@ -1072,7 +1080,7 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var saved = list[i];
|
||||
|
||||
|
||||
if (saved == location)
|
||||
{
|
||||
list.Remove(location);
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Numerics;
|
||||
using Content.Shared._White.Containers;
|
||||
using Content.Shared._White.Events;
|
||||
using Content.Shared._White.Item.PseudoItem;
|
||||
using Content.Shared._White.WeaponModules;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Actions;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Standing.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared._White.Animations;
|
||||
|
||||
public abstract class SharedWaddledAnimationSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected readonly IGameTiming Timing = default!;
|
||||
[Dependency] private readonly SharedStandingStateSystem _standingState = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<WaddleAnimationComponent, MoveInputEvent>(OnMovementInput);
|
||||
}
|
||||
|
||||
private void OnMovementInput(EntityUid uid, WaddleAnimationComponent component, MoveInputEvent args)
|
||||
{
|
||||
if (!Timing.IsFirstTimePredicted)
|
||||
return;
|
||||
|
||||
if (_standingState.IsDown(uid))
|
||||
return;
|
||||
|
||||
if (!args.HasDirectionalMovement && component.IsCurrentlyWaddling)
|
||||
{
|
||||
component.IsCurrentlyWaddling = false;
|
||||
|
||||
StopAnimation(uid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (component.IsCurrentlyWaddling || !args.HasDirectionalMovement)
|
||||
return;
|
||||
|
||||
component.IsCurrentlyWaddling = true;
|
||||
|
||||
PlayAnimation(uid);
|
||||
}
|
||||
|
||||
protected abstract void PlayAnimation(EntityUid user);
|
||||
|
||||
protected abstract void StopAnimation(EntityUid user);
|
||||
}
|
||||
@@ -1,30 +1,20 @@
|
||||
using System.Numerics;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Movement.Components;
|
||||
namespace Content.Shared._White.Animations;
|
||||
|
||||
/// <summary>
|
||||
/// Declares that an entity has started to waddle like a duck/clown.
|
||||
/// </summary>
|
||||
/// <param name="Entity">The newly be-waddled.</param>
|
||||
[ByRefEvent]
|
||||
public record struct StartedWaddlingEvent(EntityUid Entity)
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class StartedWaddlingEvent(NetEntity user) : EntityEventArgs
|
||||
{
|
||||
public EntityUid Entity = Entity;
|
||||
public NetEntity User = user;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Declares that an entity has stopped waddling like a duck/clown.
|
||||
/// </summary>
|
||||
/// <param name="Entity">The former waddle-er.</param>
|
||||
[ByRefEvent]
|
||||
public record struct StoppedWaddlingEvent(EntityUid Entity)
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class StoppedWaddlingEvent(NetEntity user) : EntityEventArgs
|
||||
{
|
||||
public EntityUid Entity = Entity;
|
||||
public NetEntity User = user;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines something as having a waddle animation when it moves.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class WaddleAnimationComponent : Component
|
||||
{
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Magic;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._White.Cult.Actions;
|
||||
|
||||
@@ -7,6 +9,21 @@ public sealed partial class CultTwistedConstructionActionEvent : EntityTargetAct
|
||||
{
|
||||
[DataField("speech")]
|
||||
public string? Speech { get; private set; }
|
||||
|
||||
[DataField]
|
||||
public EntProtoId RunicDoor = "AirlockGlassCult";
|
||||
|
||||
[DataField]
|
||||
public EntProtoId Effect = "EffectConstructRed";
|
||||
|
||||
[DataField]
|
||||
public TimeSpan Delay = TimeSpan.FromSeconds(4);
|
||||
|
||||
[DataField]
|
||||
public SoundSpecifier? Sound = new SoundPathSpecifier("/Audio/Machines/airlock_creaking.ogg")
|
||||
{
|
||||
Params = AudioParams.Default.WithVolume(-3f),
|
||||
};
|
||||
}
|
||||
|
||||
public sealed partial class CultSummonDaggerActionEvent : InstantActionEvent, ISpeakSpell
|
||||
|
||||
30
Content.Shared/_White/Cult/Actions/CultEvents.cs
Normal file
30
Content.Shared/_White/Cult/Actions/CultEvents.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Content.Shared.DoAfter;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._White.Cult.Actions;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class ShacklesEvent : SimpleDoAfterEvent
|
||||
{
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class TwistedConstructionEvent : DoAfterEvent
|
||||
{
|
||||
public NetEntity Effect { get; private set; }
|
||||
|
||||
public EntProtoId RunicDoor { get; private set; }
|
||||
|
||||
public NetCoordinates Location { get; private set; }
|
||||
|
||||
public TwistedConstructionEvent(NetEntity effect, EntProtoId runicDoor, NetCoordinates location)
|
||||
{
|
||||
Effect = effect;
|
||||
RunicDoor = runicDoor;
|
||||
Location = location;
|
||||
}
|
||||
|
||||
public override DoAfterEvent Clone() => this;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using Content.Shared.DoAfter;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._White.Cult.Actions;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class ShacklesEvent : SimpleDoAfterEvent
|
||||
{
|
||||
}
|
||||
@@ -3,7 +3,6 @@ using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
|
||||
namespace Content.Shared._White.Cult.Components;
|
||||
|
||||
@@ -51,13 +50,6 @@ public sealed partial class CultistComponent : Component
|
||||
CultSummonCombatEquipmentAction, CultStunAction, EmpPulseAction, ConcealPresenceAction, CultShadowShacklesAction
|
||||
};
|
||||
|
||||
[DataField("bloodRites", customTypeSerializer: typeof(PrototypeIdListSerializer<CultistFactoryProductionPrototype>))]
|
||||
public List<string> BloodRites = new ()
|
||||
{
|
||||
"FactoryCultBloodSpear",
|
||||
"FactoryCultBloodBarrage"
|
||||
};
|
||||
|
||||
[ViewVariables, NonSerialized]
|
||||
public Entity<BloodSpearComponent>? BloodSpear;
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ public sealed class CultRuneInvokeEvent : EntityEventArgs
|
||||
public HashSet<EntityUid> Cultists { get; }
|
||||
public bool Result { get; set; }
|
||||
|
||||
public string? InvokePhraseOverride { get; set; } = null;
|
||||
|
||||
public CultRuneInvokeEvent(EntityUid rune, EntityUid user, HashSet<EntityUid> cultists)
|
||||
{
|
||||
Rune = rune;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using Content.Shared._White.OfferItem;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Implants.Components;
|
||||
@@ -30,6 +31,7 @@ public sealed class HardlightSpearSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<HardlightSpearComponent, LandEvent>(OnLand);
|
||||
SubscribeLocalEvent<HardlightSpearComponent, DroppedEvent>(OnDrop);
|
||||
SubscribeLocalEvent<HardlightSpearComponent, HandedEvent>(OnHanded);
|
||||
SubscribeLocalEvent<HardlightSpearComponent, EntGotInsertedIntoContainerMessage>(OnInsert);
|
||||
SubscribeLocalEvent<HardlightSpearComponent, GettingPickedUpAttemptEvent>(OnPickupAttempt);
|
||||
SubscribeLocalEvent<HardlightSpearComponent, PreventCollideEvent>(OnPreventCollision);
|
||||
@@ -96,4 +98,9 @@ public sealed class HardlightSpearSystem : EntitySystem
|
||||
if (!HasComp<BodyComponent>(args.Container.Owner))
|
||||
EnsureComp<TimedDespawnComponent>(uid);
|
||||
}
|
||||
|
||||
private void OnHanded(EntityUid uid, HardlightSpearComponent component, ref HandedEvent args)
|
||||
{
|
||||
EnsureComp<TimedDespawnComponent>(uid);
|
||||
}
|
||||
}
|
||||
|
||||
22
Content.Shared/_White/Item/PseudoItem/PseudoItemComponent.cs
Normal file
22
Content.Shared/_White/Item/PseudoItem/PseudoItemComponent.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Content.Shared.Item;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._White.Item.PseudoItem;
|
||||
|
||||
/// <summary>
|
||||
/// For entities that behave like an item under certain conditions,
|
||||
/// but not under most conditions.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class PseudoItemComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public ProtoId<ItemSizePrototype> Size = "Huge";
|
||||
|
||||
[DataField]
|
||||
public List<Box2i>? Shape = new() {new Box2i(0, 0, 4, 4)};
|
||||
|
||||
[AutoNetworkedField]
|
||||
public bool Active;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
|
||||
namespace Content.Shared._White.Item.PseudoItem;
|
||||
|
||||
public abstract class SharedPseudoItemSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<PseudoItemComponent, GettingPickedUpAttemptEvent>(OnGettingPickedUpAttempt);
|
||||
SubscribeLocalEvent<PseudoItemComponent, AttackAttemptEvent>(OnAttackAttempt);
|
||||
}
|
||||
|
||||
private void OnAttackAttempt(Entity<PseudoItemComponent> ent, ref AttackAttemptEvent args)
|
||||
{
|
||||
if (ent.Comp.Active)
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnGettingPickedUpAttempt(Entity<PseudoItemComponent> ent, ref GettingPickedUpAttemptEvent args)
|
||||
{
|
||||
args.Cancel();
|
||||
OnGettingPickedUp(ent, args);
|
||||
}
|
||||
|
||||
protected virtual void OnGettingPickedUp(Entity<PseudoItemComponent> ent, GettingPickedUpAttemptEvent args) {}
|
||||
}
|
||||
|
||||
public sealed class PseudoItemInteractEvent(EntityUid used, EntityUid user)
|
||||
: EntityEventArgs
|
||||
{
|
||||
public EntityUid Used { get; } = used;
|
||||
public EntityUid User { get; } = user;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using Robust.Shared.Serialization;
|
||||
using Content.Shared.DoAfter;
|
||||
|
||||
namespace Content.Shared.Item.PseudoItem
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class PseudoItemInsertDoAfterEvent : SimpleDoAfterEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -156,3 +156,11 @@ public abstract partial class SharedOfferItemSystem : EntitySystem
|
||||
return entity != null && Resolve(entity.Value, ref component, false) && component.IsInOfferMode;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class HandedEvent(EntityUid user, EntityUid target) : EntityEventArgs
|
||||
{
|
||||
public EntityUid User = user;
|
||||
public EntityUid Target = target;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user