Felinid fixes and stuff. (#524)
* - add: Felinid fixes and stuff. * - fix: Fix felinids disappearing.
This commit is contained in:
@@ -11,6 +11,7 @@ using Content.Shared.Climbing.Events;
|
|||||||
using Content.Shared.DoAfter;
|
using Content.Shared.DoAfter;
|
||||||
using Content.Shared.Hands;
|
using Content.Shared.Hands;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
|
using Content.Shared.IdentityManagement;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Inventory.VirtualItem;
|
using Content.Shared.Inventory.VirtualItem;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
@@ -226,14 +227,15 @@ public sealed class CarryingSystem : EntitySystem
|
|||||||
var ev = new CarryDoAfterEvent();
|
var ev = new CarryDoAfterEvent();
|
||||||
var args = new DoAfterArgs(EntityManager, carrier, length, ev, carried, target: carried)
|
var args = new DoAfterArgs(EntityManager, carrier, length, ev, carried, target: carried)
|
||||||
{
|
{
|
||||||
|
BreakOnDamage = true,
|
||||||
BreakOnMove = true,
|
BreakOnMove = true,
|
||||||
NeedHand = true
|
NeedHand = true
|
||||||
};
|
};
|
||||||
|
|
||||||
if(_doAfterSystem.TryStartDoAfter(args))
|
if (_doAfterSystem.TryStartDoAfter(args))
|
||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString("carry-start", ("carrier", carrier)), carried, carried,
|
_popupSystem.PopupEntity(Loc.GetString("carry-start", ("carrier", Identity.Entity(carrier, EntityManager))),
|
||||||
Shared.Popups.PopupType.SmallCaution);
|
carried, carried, Shared.Popups.PopupType.SmallCaution);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
using Content.Server._White.Carrying;
|
using Content.Server._White.Carrying;
|
||||||
|
using Content.Server.DoAfter;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
using Content.Shared.Hands;
|
|
||||||
using Content.Server.Storage.EntitySystems;
|
using Content.Server.Storage.EntitySystems;
|
||||||
using Content.Server.Item;
|
using Content.Server.Item;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Server.Resist;
|
using Content.Server.Resist;
|
||||||
|
using Content.Shared._White.Carrying;
|
||||||
using Content.Shared._White.Item.PseudoItem;
|
using Content.Shared._White.Item.PseudoItem;
|
||||||
|
using Content.Shared.DoAfter;
|
||||||
|
using Content.Shared.Hands.Components;
|
||||||
|
using Content.Shared.IdentityManagement;
|
||||||
|
using Content.Shared.Inventory.VirtualItem;
|
||||||
using Content.Shared.Resist;
|
using Content.Shared.Resist;
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -21,32 +26,52 @@ public sealed class PseudoItemSystem : SharedPseudoItemSystem
|
|||||||
[Dependency] private readonly ItemSystem _itemSystem = default!;
|
[Dependency] private readonly ItemSystem _itemSystem = default!;
|
||||||
[Dependency] private readonly CarryingSystem _carrying = default!;
|
[Dependency] private readonly CarryingSystem _carrying = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
|
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<PseudoItemComponent, EntGotRemovedFromContainerMessage>(OnEntRemoved);
|
SubscribeLocalEvent<PseudoItemComponent, EntGotRemovedFromContainerMessage>(OnEntRemoved);
|
||||||
SubscribeLocalEvent<PseudoItemComponent, DropAttemptEvent>(OnDropAttempt);
|
SubscribeLocalEvent<PseudoItemComponent, PseudoItemInsertEvent>(OnInsert);
|
||||||
SubscribeLocalEvent<PseudoItemComponent, EscapeInventoryEvent>(OnEscape);
|
SubscribeLocalEvent<PseudoItemComponent, CarryDoAfterEvent>(OnCarryEvent,
|
||||||
|
after: new[] {typeof(CarryingSystem)});
|
||||||
SubscribeLocalEvent<StorageComponent, GetVerbsEvent<AlternativeVerb>>(AddAltVerb);
|
SubscribeLocalEvent<StorageComponent, GetVerbsEvent<AlternativeVerb>>(AddAltVerb);
|
||||||
SubscribeLocalEvent<StorageComponent, GetVerbsEvent<Verb>>(AddVerb);
|
SubscribeLocalEvent<StorageComponent, GetVerbsEvent<Verb>>(AddVerb);
|
||||||
SubscribeLocalEvent<StorageComponent, PseudoItemInteractEvent>(OnInteract);
|
SubscribeLocalEvent<StorageComponent, PseudoItemInteractEvent>(OnInteract);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnCarryEvent(Entity<PseudoItemComponent> ent, ref CarryDoAfterEvent args)
|
||||||
|
{
|
||||||
|
if (args.Handled || args.Cancelled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
args.Handled = true;
|
||||||
|
_transform.AttachToGridOrMap(ent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnInsert(Entity<PseudoItemComponent> ent, ref PseudoItemInsertEvent args)
|
||||||
|
{
|
||||||
|
if (args.Cancelled || args.Handled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
args.Handled = true;
|
||||||
|
|
||||||
|
if (!TryComp(args.Target, out StorageComponent? storage))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!TryInsert(args.Target.Value, ent.Owner, args.User, ent.Comp, storage))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (args.User != ent.Owner)
|
||||||
|
_carrying.DropCarried(args.User, ent.Owner, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnInteract(Entity<StorageComponent> ent, ref PseudoItemInteractEvent args)
|
private void OnInteract(Entity<StorageComponent> ent, ref PseudoItemInteractEvent args)
|
||||||
{
|
{
|
||||||
if (!TryComp(args.Used, out PseudoItemComponent? pseudoItem))
|
if (!TryComp(args.Used, out PseudoItemComponent? pseudoItem))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!TryInsert(ent.Owner, args.Used, args.User, pseudoItem, ent.Comp))
|
TryStartInsertDoAfter(ent.Owner, args.Used, args.User, pseudoItem, ent.Comp, args.VirtualItem);
|
||||||
return;
|
|
||||||
|
|
||||||
_carrying.DropCarried(args.User, args.Used, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnEscape(Entity<PseudoItemComponent> ent, ref EscapeInventoryEvent args)
|
|
||||||
{
|
|
||||||
NoLongerInContainer(ent.Owner, ent.Comp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddAltVerb(Entity<StorageComponent> ent, ref GetVerbsEvent<AlternativeVerb> args)
|
private void AddAltVerb(Entity<StorageComponent> ent, ref GetVerbsEvent<AlternativeVerb> args)
|
||||||
@@ -68,7 +93,7 @@ public sealed class PseudoItemSystem : SharedPseudoItemSystem
|
|||||||
{
|
{
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
TryInsert(uid, user, user, pseudoItem, comp);
|
TryStartInsertDoAfter(uid, user, user, pseudoItem, comp);
|
||||||
},
|
},
|
||||||
Text = Loc.GetString("action-name-insert-self"),
|
Text = Loc.GetString("action-name-insert-self"),
|
||||||
};
|
};
|
||||||
@@ -87,6 +112,9 @@ public sealed class PseudoItemSystem : SharedPseudoItemSystem
|
|||||||
if (!TryComp(user, out CarryingComponent? carrying))
|
if (!TryComp(user, out CarryingComponent? carrying))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!TryComp(user, out HandsComponent? hands) || !HasComp<VirtualItemComponent>(hands.ActiveHandEntity))
|
||||||
|
return;
|
||||||
|
|
||||||
var carried = carrying.Carried;
|
var carried = carrying.Carried;
|
||||||
|
|
||||||
if (!TryComp(carried, out PseudoItemComponent? pseudoItem))
|
if (!TryComp(carried, out PseudoItemComponent? pseudoItem))
|
||||||
@@ -96,8 +124,7 @@ public sealed class PseudoItemSystem : SharedPseudoItemSystem
|
|||||||
{
|
{
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
if (TryInsert(uid, carried, user, pseudoItem, comp))
|
TryStartInsertDoAfter(uid, carried, user, pseudoItem, comp, hands.ActiveHandEntity.Value);
|
||||||
_carrying.DropCarried(user, carried, false, false);
|
|
||||||
},
|
},
|
||||||
Text = Loc.GetString("action-name-insert-other"),
|
Text = Loc.GetString("action-name-insert-other"),
|
||||||
};
|
};
|
||||||
@@ -106,7 +133,45 @@ public sealed class PseudoItemSystem : SharedPseudoItemSystem
|
|||||||
|
|
||||||
private void OnEntRemoved(EntityUid uid, PseudoItemComponent component, EntGotRemovedFromContainerMessage args)
|
private void OnEntRemoved(EntityUid uid, PseudoItemComponent component, EntGotRemovedFromContainerMessage args)
|
||||||
{
|
{
|
||||||
NoLongerInContainer(uid, component);
|
if (!component.Active)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RemComp<CanEscapeInventoryComponent>(uid);
|
||||||
|
RemComp<ItemComponent>(uid);
|
||||||
|
component.Active = false;
|
||||||
|
Dirty(uid, component);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TryStartInsertDoAfter(EntityUid storageUid,
|
||||||
|
EntityUid toInsert,
|
||||||
|
EntityUid user,
|
||||||
|
PseudoItemComponent component,
|
||||||
|
StorageComponent storage,
|
||||||
|
EntityUid? used = null)
|
||||||
|
{
|
||||||
|
if (!FitsInContainer(storageUid, storage, component))
|
||||||
|
{
|
||||||
|
_popupSystem.PopupEntity(Loc.GetString("comp-storage-too-big"), user, user);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var args = new DoAfterArgs(EntityManager, user, TimeSpan.FromSeconds(1), new PseudoItemInsertEvent(),
|
||||||
|
toInsert, storageUid, used)
|
||||||
|
{
|
||||||
|
BreakOnDamage = true,
|
||||||
|
BreakOnMove = true,
|
||||||
|
NeedHand = user != toInsert
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!_doAfter.TryStartDoAfter(args))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var message = toInsert == user
|
||||||
|
? Loc.GetString("action-start-insert-self", ("storage", storageUid))
|
||||||
|
: Loc.GetString("action-start-insert-other",
|
||||||
|
("storage", storageUid), ("user", Identity.Entity(user, EntityManager)));
|
||||||
|
|
||||||
|
_popupSystem.PopupEntity(message, toInsert, toInsert);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnGettingPickedUp(Entity<PseudoItemComponent> ent, GettingPickedUpAttemptEvent args)
|
protected override void OnGettingPickedUp(Entity<PseudoItemComponent> ent, GettingPickedUpAttemptEvent args)
|
||||||
@@ -118,24 +183,18 @@ public sealed class PseudoItemSystem : SharedPseudoItemSystem
|
|||||||
|
|
||||||
if (!TryComp(ent, out CarriableComponent? carriable))
|
if (!TryComp(ent, out CarriableComponent? carriable))
|
||||||
_transform.AttachToGridOrMap(ent);
|
_transform.AttachToGridOrMap(ent);
|
||||||
else if (_carrying.CanCarry(args.User, ent))
|
else
|
||||||
_carrying.StartCarryDoAfter(args.User, ent, carriable);
|
_carrying.StartCarryDoAfter(args.User, ent, carriable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDropAttempt(EntityUid uid, PseudoItemComponent component, DropAttemptEvent args)
|
|
||||||
{
|
|
||||||
if (component.Active)
|
|
||||||
args.Cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TryInsert(EntityUid storageUid,
|
public bool TryInsert(EntityUid storageUid,
|
||||||
EntityUid toInsert,
|
EntityUid toInsert,
|
||||||
EntityUid user,
|
EntityUid user,
|
||||||
PseudoItemComponent component,
|
PseudoItemComponent component,
|
||||||
StorageComponent? storage = null)
|
StorageComponent storage)
|
||||||
{
|
{
|
||||||
if (!Resolve(storageUid, ref storage))
|
if (TryComp(toInsert, out CanEscapeInventoryComponent? canEscape) && canEscape.DoAfter != null)
|
||||||
return false;
|
_doAfter.Cancel(canEscape.DoAfter);
|
||||||
|
|
||||||
var item = EnsureComp<ItemComponent>(toInsert);
|
var item = EnsureComp<ItemComponent>(toInsert);
|
||||||
_itemSystem.SetSize(toInsert, component.Size, item);
|
_itemSystem.SetSize(toInsert, component.Size, item);
|
||||||
@@ -151,18 +210,12 @@ public sealed class PseudoItemSystem : SharedPseudoItemSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
component.Active = true;
|
component.Active = true;
|
||||||
EnsureComp<CanEscapeInventoryComponent>(toInsert);
|
EnsureComp<CanEscapeInventoryComponent>(toInsert).BaseResistTime = 3f;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NoLongerInContainer(EntityUid uid, PseudoItemComponent component)
|
private bool FitsInContainer(EntityUid storageUid, StorageComponent storage, PseudoItemComponent pseudoItem)
|
||||||
{
|
{
|
||||||
if (!component.Active)
|
return _storageSystem.GetMaxItemSize((storageUid, storage)) >= _itemSystem.GetSizePrototype(pseudoItem.Size);
|
||||||
return;
|
|
||||||
|
|
||||||
RemCompDeferred<CanEscapeInventoryComponent>(uid);
|
|
||||||
RemCompDeferred<ItemComponent>(uid);
|
|
||||||
component.Active = false;
|
|
||||||
Dirty(uid, component);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ public abstract class SharedStorageSystem : EntitySystem
|
|||||||
|
|
||||||
if (TryComp<VirtualItemComponent>(args.Used, out var virtualItem)) // WD
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,6 +517,9 @@ public abstract class SharedStorageSystem : EntitySystem
|
|||||||
if (!ActionBlocker.CanInteract(player, itemEnt))
|
if (!ActionBlocker.CanInteract(player, itemEnt))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (HasComp<PseudoItemComponent>(itemEnt)) // WD
|
||||||
|
return;
|
||||||
|
|
||||||
TransformSystem.DropNextTo(itemEnt, player);
|
TransformSystem.DropNextTo(itemEnt, player);
|
||||||
Audio.PlayPredicted(storageComp.StorageRemoveSound, storageEnt, player);
|
Audio.PlayPredicted(storageComp.StorageRemoveSound, storageEnt, player);
|
||||||
}
|
}
|
||||||
@@ -681,6 +684,8 @@ public abstract class SharedStorageSystem : EntitySystem
|
|||||||
|
|
||||||
foreach (var entity in entities.ToArray())
|
foreach (var entity in entities.ToArray())
|
||||||
{
|
{
|
||||||
|
if (HasComp<PseudoItemComponent>(entity)) // WD
|
||||||
|
continue;
|
||||||
Insert(target, entity, out _, user: user, targetComp, playSound: false);
|
Insert(target, entity, out _, user: user, targetComp, playSound: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using Content.Shared.Standing.Systems;
|
|||||||
using Content.Shared.StatusEffect;
|
using Content.Shared.StatusEffect;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
|
using Robust.Shared.Containers;
|
||||||
|
|
||||||
namespace Content.Shared.Stunnable;
|
namespace Content.Shared.Stunnable;
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ public abstract class SharedStunSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SharedStandingStateSystem _standingState = default!;
|
[Dependency] private readonly SharedStandingStateSystem _standingState = default!;
|
||||||
[Dependency] private readonly StatusEffectsSystem _statusEffect = default!;
|
[Dependency] private readonly StatusEffectsSystem _statusEffect = default!;
|
||||||
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Friction modifier for knocked down players.
|
/// 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
|
if (!TryComp(uid, out StandingStateComponent? standing) || !(!standing.CanLieDown || standing.AutoGetUp)) // WD EDIT
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (standing.AutoGetUp) // WD EDIT
|
if (standing.AutoGetUp && !_container.IsEntityInContainer(uid)) // WD EDIT
|
||||||
{
|
{
|
||||||
_standingState.TryStandUp(uid, standing);
|
_standingState.TryStandUp(uid, standing);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
using Content.Shared.DoAfter;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared._White.Item.PseudoItem;
|
namespace Content.Shared._White.Item.PseudoItem;
|
||||||
|
|
||||||
@@ -28,9 +30,15 @@ public abstract class SharedPseudoItemSystem : EntitySystem
|
|||||||
protected virtual void OnGettingPickedUp(Entity<PseudoItemComponent> ent, GettingPickedUpAttemptEvent args) {}
|
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
|
: EntityEventArgs
|
||||||
{
|
{
|
||||||
public EntityUid Used { get; } = used;
|
public EntityUid Used { get; } = used;
|
||||||
public EntityUid User { get; } = user;
|
public EntityUid User { get; } = user;
|
||||||
|
public EntityUid VirtualItem { get; } = virtualItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public sealed partial class PseudoItemInsertEvent : SimpleDoAfterEvent
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,6 @@ ent-EnergyBola = энергобола
|
|||||||
|
|
||||||
action-name-insert-self = Залезть внутрь.
|
action-name-insert-self = Залезть внутрь.
|
||||||
action-name-insert-other = Засунуть внутрь.
|
action-name-insert-other = Засунуть внутрь.
|
||||||
|
action-start-insert-self = Вы начинаете залазить в {$storage}.
|
||||||
|
action-start-insert-other = {$user} начинает засовывать вас в {$storage}.
|
||||||
carry-start = { $carrier } пытается взять вас на руки!
|
carry-start = { $carrier } пытается взять вас на руки!
|
||||||
|
|||||||
Reference in New Issue
Block a user