Merge remote-tracking branch 'upstream/master' into ups

This commit is contained in:
Jabak
2024-08-01 11:20:57 +03:00
576 changed files with 102382 additions and 87280 deletions

View File

@@ -1,3 +1,4 @@
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
@@ -6,7 +7,7 @@ namespace Content.Shared.Alert
/// <summary>
/// An alert popup with associated icon, tooltip, and other data.
/// </summary>
[Prototype("alert")]
[Prototype]
public sealed partial class AlertPrototype : IPrototype
{
[ViewVariables]
@@ -22,7 +23,7 @@ namespace Content.Shared.Alert
/// List of icons to use for this alert. Each entry corresponds to a different severity level, starting from the
/// minimum and incrementing upwards. If severities are not supported, the first entry is used.
/// </summary>
[DataField("icons", required: true)]
[DataField(required: true)]
public List<SpriteSpecifier> Icons = new();
/// <summary>
@@ -34,13 +35,13 @@ namespace Content.Shared.Alert
/// <summary>
/// Name to show in tooltip window. Accepts formatting.
/// </summary>
[DataField("name")]
[DataField]
public string Name { get; private set; } = "";
/// <summary>
/// Description to show in tooltip window. Accepts formatting.
/// </summary>
[DataField("description")]
[DataField]
public string Description { get; private set; } = "";
/// <summary>
@@ -50,7 +51,7 @@ namespace Content.Shared.Alert
/// replace each other and are mutually exclusive, for example lowpressure / highpressure,
/// hot / cold. If left unspecified, the alert will not replace or be replaced by any other alerts.
/// </summary>
[DataField("category")]
[DataField]
public AlertCategory? Category { get; private set; }
/// <summary>
@@ -70,7 +71,7 @@ namespace Content.Shared.Alert
/// Maximum severity level supported by this state. -1 (default) indicates
/// no severity levels are supported by the state.
/// </summary>
[DataField("maxSeverity")]
[DataField]
public short MaxSeverity = -1;
/// <summary>
@@ -82,7 +83,7 @@ namespace Content.Shared.Alert
/// Defines what to do when the alert is clicked.
/// This will always be null on clientside.
/// </summary>
[DataField("onClick", serverOnly: true)]
[DataField(serverOnly: true)]
public IAlertClick? OnClick { get; private set; }
/// <param name="severity">severity level, if supported by this alert</param>

View File

@@ -0,0 +1,17 @@
using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
namespace Content.Shared.Labels.Components
{
[RegisterComponent, NetworkedComponent]
public sealed partial class HandLabelerComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField] public string AssignedLabel { get; set; } = string.Empty;
[ViewVariables(VVAccess.ReadWrite)]
[DataField] public int MaxLabelChars { get; set; } = 50;
[DataField] public EntityWhitelist Whitelist = new();
}
}

View File

@@ -133,7 +133,13 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
/// <param name="volume"></param>
/// <param name="component"></param>
/// <returns>If the amount can be changed</returns>
public bool CanChangeMaterialAmount(EntityUid uid, string materialId, int volume, MaterialStorageComponent? component, EntityUid? gridUid = null, MaterialStorageComponent? gridStorage = null)
public bool CanChangeMaterialAmount(EntityUid uid,
string materialId,
int volume,
MaterialStorageComponent? component,
EntityUid? gridUid = null,
MaterialStorageComponent? gridStorage = null,
bool checkWhitelist = true)
{
if (!Resolve(uid, ref component))
return false;
@@ -141,7 +147,8 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
if (!CanTakeVolume(uid, volume, component, gridUid:gridUid, gridStorage:gridStorage))
return false;
if (component.MaterialWhiteList != null && !component.MaterialWhiteList.Contains(materialId))
// WD edit - added checkWhitelist bool
if (checkWhitelist && component.MaterialWhiteList != null && !component.MaterialWhiteList.Contains(materialId))
return false;
var amount = gridStorage != null
@@ -181,12 +188,20 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
/// <param name="component"></param>
/// <param name="dirty"></param>
/// <returns>If it was successful</returns>
public bool TryChangeMaterialAmount(EntityUid uid, string materialId, int volume, MaterialStorageComponent? component = null, bool dirty = true, EntityUid? gridUid = null, MaterialStorageComponent? gridStorage = null)
public bool TryChangeMaterialAmount(EntityUid uid,
string materialId,
int volume,
MaterialStorageComponent? component = null,
bool dirty = true,
EntityUid? gridUid = null,
MaterialStorageComponent? gridStorage = null,
bool checkWhitelist = true)
{
if (!Resolve(uid, ref component))
return false;
if (!CanChangeMaterialAmount(uid, materialId, volume, component, gridUid:gridUid, gridStorage:gridStorage))
// WD edit - added checkWhitelist bool
if (!CanChangeMaterialAmount(uid, materialId, volume, component, gridUid:gridUid, gridStorage:gridStorage, checkWhitelist: checkWhitelist))
return false;
var rightStorage = gridStorage ?? component;

View File

@@ -16,6 +16,7 @@ using Content.Shared.Movement.Systems;
using Content.Shared.Pulling.Events;
using Content.Shared.Throwing;
using Content.Shared.Verbs;
using Content.Shared.Standing.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Input.Binding;
using Robust.Shared.Map;
@@ -43,6 +44,7 @@ public sealed class PullingSystem : EntitySystem
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedStandingStateSystem _standing = default!;
public override void Initialize()
{
@@ -142,6 +144,12 @@ public sealed class PullingSystem : EntitySystem
private void OnRefreshMovespeed(EntityUid uid, PullerComponent component, RefreshMovementSpeedModifiersEvent args)
{
if (_standing.IsDown(uid))
{
args.ModifySpeed(component.WalkSpeedModifier * 0.5f, component.SprintSpeedModifier * 0.5f);
return;
}
args.ModifySpeed(component.WalkSpeedModifier, component.SprintSpeedModifier);
}

View File

@@ -5,6 +5,7 @@ using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.RCD.Components;
using Content.Shared.Stacks;
using Robust.Shared.Network;
using Robust.Shared.Timing;
namespace Content.Shared.RCD.Systems;
@@ -15,6 +16,7 @@ public sealed class RCDAmmoSystem : EntitySystem
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedStackSystem _stack = default!;
[Dependency] private readonly INetManager _netMan = default!;
public override void Initialize()
{
@@ -83,7 +85,7 @@ public sealed class RCDAmmoSystem : EntitySystem
Dirty(uid, comp);
// prevent having useless ammo with 0 charges
if (comp.Charges <= 0)
if (comp.Charges <= 0 && stackComponent == null && _netMan.IsServer)
QueueDel(uid);
}
}

View File

@@ -227,7 +227,7 @@ public abstract class SharedStorageSystem : EntitySystem
if (TryComp<VirtualItemComponent>(args.Used, out var virtualItem)) // WD
{
RaiseLocalEvent(uid, new PseudoItemInteractEvent(virtualItem.BlockingEntity, args.User));
RaiseLocalEvent(uid, new PseudoItemInteractEvent(virtualItem.BlockingEntity, args.User, args.Used));
return;
}
@@ -517,6 +517,9 @@ public abstract class SharedStorageSystem : EntitySystem
if (!ActionBlocker.CanInteract(player, itemEnt))
return;
if (HasComp<PseudoItemComponent>(itemEnt)) // WD
return;
TransformSystem.DropNextTo(itemEnt, player);
Audio.PlayPredicted(storageComp.StorageRemoveSound, storageEnt, player);
}
@@ -681,6 +684,8 @@ public abstract class SharedStorageSystem : EntitySystem
foreach (var entity in entities.ToArray())
{
if (HasComp<PseudoItemComponent>(entity)) // WD
continue;
Insert(target, entity, out _, user: user, targetComp, playSound: false);
}

View File

@@ -16,6 +16,7 @@ using Content.Shared.Standing.Systems;
using Content.Shared.StatusEffect;
using Content.Shared.Throwing;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
namespace Content.Shared.Stunnable;
@@ -27,6 +28,7 @@ public abstract class SharedStunSystem : EntitySystem
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedStandingStateSystem _standingState = default!;
[Dependency] private readonly StatusEffectsSystem _statusEffect = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
/// <summary>
/// Friction modifier for knocked down players.
@@ -115,7 +117,7 @@ public abstract class SharedStunSystem : EntitySystem
if (!TryComp(uid, out StandingStateComponent? standing) || !(!standing.CanLieDown || standing.AutoGetUp)) // WD EDIT
return;
if (standing.AutoGetUp) // WD EDIT
if (standing.AutoGetUp && !_container.IsEntityInContainer(uid)) // WD EDIT
{
_standingState.TryStandUp(uid, standing);
return;

View File

@@ -1,5 +1,7 @@
using Content.Shared.DoAfter;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Robust.Shared.Serialization;
namespace Content.Shared._White.Item.PseudoItem;
@@ -28,9 +30,15 @@ public abstract class SharedPseudoItemSystem : EntitySystem
protected virtual void OnGettingPickedUp(Entity<PseudoItemComponent> ent, GettingPickedUpAttemptEvent args) {}
}
public sealed class PseudoItemInteractEvent(EntityUid used, EntityUid user)
public sealed class PseudoItemInteractEvent(EntityUid used, EntityUid user, EntityUid virtualItem)
: EntityEventArgs
{
public EntityUid Used { get; } = used;
public EntityUid User { get; } = user;
public EntityUid VirtualItem { get; } = virtualItem;
}
[Serializable, NetSerializable]
public sealed partial class PseudoItemInsertEvent : SimpleDoAfterEvent
{
}