фикс системы таскания

This commit is contained in:
Remuchi
2024-03-27 16:56:45 +07:00
parent ad78f747c1
commit 8514b94683
10 changed files with 357 additions and 395 deletions

View File

@@ -1,6 +1,6 @@
using Content.Server._White.Carrying;
using Content.Server.Popups;
using Content.Server.Storage.Components;
using Content.Server.Carrying;
using Content.Shared.Storage;
using Content.Shared.Inventory;
using Content.Shared.Hands.EntitySystems;
@@ -41,7 +41,8 @@ public sealed class EscapeInventorySystem : EntitySystem
if (!args.HasDirectionalMovement)
return;
if (!_containerSystem.TryGetContainingContainer(uid, out var container) || !_actionBlockerSystem.CanInteract(uid, container.Owner))
if (!_containerSystem.TryGetContainingContainer(uid, out var container) ||
!_actionBlockerSystem.CanInteract(uid, container.Owner))
return;
// Make sure there's nothing stopped the removal (like being glued)
@@ -59,16 +60,22 @@ public sealed class EscapeInventorySystem : EntitySystem
}
// Uncontested
if (HasComp<StorageComponent>(container.Owner) || HasComp<InventoryComponent>(container.Owner) || HasComp<SecretStashComponent>(container.Owner))
if (HasComp<StorageComponent>(container.Owner) || HasComp<InventoryComponent>(container.Owner) ||
HasComp<SecretStashComponent>(container.Owner))
AttemptEscape(uid, container.Owner, component);
}
public void AttemptEscape(EntityUid user, EntityUid container, CanEscapeInventoryComponent component, float multiplier = 1f)
public void AttemptEscape(
EntityUid user,
EntityUid container,
CanEscapeInventoryComponent component,
float multiplier = 1f)
{
if (component.IsEscaping)
return;
var doAfterEventArgs = new DoAfterArgs(EntityManager, user, component.BaseResistTime * multiplier, new EscapeInventoryEvent(), user, target: container)
var doAfterEventArgs = new DoAfterArgs(EntityManager, user, component.BaseResistTime * multiplier,
new EscapeInventoryEvent(), user, target: container)
{
BreakOnMove = true,
BreakOnDamage = true,
@@ -79,7 +86,8 @@ public sealed class EscapeInventorySystem : EntitySystem
return;
_popupSystem.PopupEntity(Loc.GetString("escape-inventory-component-start-resisting"), user, user);
_popupSystem.PopupEntity(Loc.GetString("escape-inventory-component-start-resisting-target"), container, container);
_popupSystem.PopupEntity(Loc.GetString("escape-inventory-component-start-resisting-target"), container,
container);
}
private void OnEscape(EntityUid uid, CanEscapeInventoryComponent component, EscapeInventoryEvent args)
@@ -105,4 +113,4 @@ public sealed class EscapeInventorySystem : EntitySystem
if (component.DoAfter != null)
_doAfterSystem.Cancel(component.DoAfter);
}
}
}