Equipment verbs & admin inventory access. (#14315)
This commit is contained in:
@@ -163,9 +163,10 @@ namespace Content.Server.Strip
|
||||
if (args.Target == args.User)
|
||||
return;
|
||||
|
||||
if (!TryComp<ActorComponent>(args.User, out var actor))
|
||||
if (!HasComp<ActorComponent>(args.User))
|
||||
return;
|
||||
|
||||
args.Handled = true;
|
||||
StartOpeningStripper(args.User, component);
|
||||
}
|
||||
|
||||
@@ -214,12 +215,9 @@ namespace Content.Server.Strip
|
||||
return;
|
||||
}
|
||||
|
||||
var userEv = new BeforeStripEvent(slotDef.StripTime);
|
||||
RaiseLocalEvent(user, userEv);
|
||||
var ev = new BeforeGettingStrippedEvent(userEv.Time, userEv.Stealth);
|
||||
RaiseLocalEvent(component.Owner, ev);
|
||||
var (time, stealth) = GetStripTimeModifiers(user, component.Owner, slotDef.StripTime);
|
||||
|
||||
var doAfterArgs = new DoAfterEventArgs(user, ev.Time, CancellationToken.None, component.Owner)
|
||||
var doAfterArgs = new DoAfterEventArgs(user, time, CancellationToken.None, component.Owner)
|
||||
{
|
||||
ExtraCheck = Check,
|
||||
BreakOnStun = true,
|
||||
@@ -229,7 +227,7 @@ namespace Content.Server.Strip
|
||||
NeedHand = true,
|
||||
};
|
||||
|
||||
if (!ev.Stealth && Check() && userHands.ActiveHandEntity != null)
|
||||
if (!stealth && Check() && userHands.ActiveHandEntity != null)
|
||||
{
|
||||
var message = Loc.GetString("strippable-component-alert-owner-insert",
|
||||
("user", Identity.Entity(user, EntityManager)), ("item", userHands.ActiveHandEntity));
|
||||
@@ -246,8 +244,6 @@ namespace Content.Server.Strip
|
||||
|
||||
_adminLogger.Add(LogType.Stripping, LogImpact.Medium, $"{ToPrettyString(user):user} has placed the item {ToPrettyString(held):item} in {ToPrettyString(component.Owner):target}'s {slot} slot");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -282,12 +278,9 @@ namespace Content.Server.Strip
|
||||
return true;
|
||||
}
|
||||
|
||||
var userEv = new BeforeStripEvent(component.HandStripDelay);
|
||||
RaiseLocalEvent(user, userEv);
|
||||
var ev = new BeforeGettingStrippedEvent(userEv.Time, userEv.Stealth);
|
||||
RaiseLocalEvent(component.Owner, ev);
|
||||
var (time, stealth) = GetStripTimeModifiers(user, component.Owner, component.HandStripDelay);
|
||||
|
||||
var doAfterArgs = new DoAfterEventArgs(user, ev.Time, CancellationToken.None, component.Owner)
|
||||
var doAfterArgs = new DoAfterEventArgs(user, time, CancellationToken.None, component.Owner)
|
||||
{
|
||||
ExtraCheck = Check,
|
||||
BreakOnStun = true,
|
||||
@@ -297,13 +290,16 @@ namespace Content.Server.Strip
|
||||
NeedHand = true,
|
||||
};
|
||||
|
||||
if (Check() && userHands.Hands.TryGetValue(handName, out var handSlot))
|
||||
if (!stealth
|
||||
&& Check()
|
||||
&& userHands.Hands.TryGetValue(handName, out var handSlot)
|
||||
&& handSlot.HeldEntity != null)
|
||||
{
|
||||
if (handSlot.HeldEntity != null)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-insert", ("user", Identity.Entity(user, EntityManager)), ("item", handSlot.HeldEntity)), component.Owner,
|
||||
component.Owner, PopupType.Large);
|
||||
}
|
||||
_popupSystem.PopupEntity(
|
||||
Loc.GetString("strippable-component-alert-owner-insert",
|
||||
("user", Identity.Entity(user, EntityManager)),
|
||||
("item", handSlot.HeldEntity)),
|
||||
component.Owner, component.Owner, PopupType.Large);
|
||||
}
|
||||
|
||||
var result = await _doAfterSystem.WaitDoAfter(doAfterArgs);
|
||||
@@ -313,7 +309,7 @@ namespace Content.Server.Strip
|
||||
return;
|
||||
|
||||
_handsSystem.TryDrop(user, checkActionBlocker: false, handsComp: userHands);
|
||||
_handsSystem.TryPickup(component.Owner, held, handName, checkActionBlocker: false, animateUser: true, handsComp: hands);
|
||||
_handsSystem.TryPickup(component.Owner, held, handName, checkActionBlocker: false, animateUser: true, animate: !stealth, handsComp: hands);
|
||||
_adminLogger.Add(LogType.Stripping, LogImpact.Medium, $"{ToPrettyString(user):user} has placed the item {ToPrettyString(held):item} in {ToPrettyString(component.Owner):target}'s hands");
|
||||
// hand update will trigger strippable update
|
||||
}
|
||||
@@ -349,12 +345,9 @@ namespace Content.Server.Strip
|
||||
return;
|
||||
}
|
||||
|
||||
var userEv = new BeforeStripEvent(slotDef.StripTime);
|
||||
RaiseLocalEvent(user, userEv);
|
||||
var ev = new BeforeGettingStrippedEvent(userEv.Time, userEv.Stealth);
|
||||
RaiseLocalEvent(component.Owner, ev);
|
||||
var (time, stealth) = GetStripTimeModifiers(user, component.Owner, slotDef.StripTime);
|
||||
|
||||
var doAfterArgs = new DoAfterEventArgs(user, ev.Time, CancellationToken.None, component.Owner)
|
||||
var doAfterArgs = new DoAfterEventArgs(user, time, CancellationToken.None, component.Owner)
|
||||
{
|
||||
ExtraCheck = Check,
|
||||
BreakOnStun = true,
|
||||
@@ -363,7 +356,7 @@ namespace Content.Server.Strip
|
||||
BreakOnUserMove = true,
|
||||
};
|
||||
|
||||
if (!ev.Stealth && Check())
|
||||
if (!stealth && Check())
|
||||
{
|
||||
if (slotDef.StripHidden)
|
||||
{
|
||||
@@ -385,7 +378,7 @@ namespace Content.Server.Strip
|
||||
// Raise a dropped event, so that things like gas tank internals properly deactivate when stripping
|
||||
RaiseLocalEvent(item.Value, new DroppedEvent(user), true);
|
||||
|
||||
_handsSystem.PickupOrDrop(user, item.Value);
|
||||
_handsSystem.PickupOrDrop(user, item.Value, animate: !stealth);
|
||||
_adminLogger.Add(LogType.Stripping, LogImpact.Medium, $"{ToPrettyString(user):user} has stripped the item {ToPrettyString(item.Value):item} from {ToPrettyString(component.Owner):target}");
|
||||
}
|
||||
}
|
||||
@@ -418,12 +411,9 @@ namespace Content.Server.Strip
|
||||
return true;
|
||||
}
|
||||
|
||||
var userEv = new BeforeStripEvent(component.HandStripDelay);
|
||||
RaiseLocalEvent(user, userEv);
|
||||
var ev = new BeforeGettingStrippedEvent(userEv.Time, userEv.Stealth);
|
||||
RaiseLocalEvent(component.Owner, ev);
|
||||
var (time, stealth) = GetStripTimeModifiers(user, component.Owner, component.HandStripDelay);
|
||||
|
||||
var doAfterArgs = new DoAfterEventArgs(user, ev.Time, CancellationToken.None, component.Owner)
|
||||
var doAfterArgs = new DoAfterEventArgs(user, time, CancellationToken.None, component.Owner)
|
||||
{
|
||||
ExtraCheck = Check,
|
||||
BreakOnStun = true,
|
||||
@@ -432,12 +422,16 @@ namespace Content.Server.Strip
|
||||
BreakOnUserMove = true,
|
||||
};
|
||||
|
||||
if (Check() && hands.Hands.TryGetValue(handName, out var handSlot))
|
||||
if (!stealth
|
||||
&& Check()
|
||||
&& hands.Hands.TryGetValue(handName, out var handSlot)
|
||||
&& handSlot.HeldEntity != null)
|
||||
{
|
||||
if (handSlot.HeldEntity != null)
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner", ("user", Identity.Entity(user, EntityManager)), ("item", handSlot.HeldEntity)), component.Owner, component.Owner);
|
||||
}
|
||||
_popupSystem.PopupEntity(
|
||||
Loc.GetString("strippable-component-alert-owner",
|
||||
("user", Identity.Entity(user, EntityManager)),
|
||||
("item", handSlot.HeldEntity)),
|
||||
component.Owner, component.Owner);
|
||||
}
|
||||
|
||||
var result = await _doAfterSystem.WaitDoAfter(doAfterArgs);
|
||||
@@ -447,7 +441,7 @@ namespace Content.Server.Strip
|
||||
return;
|
||||
|
||||
_handsSystem.TryDrop(component.Owner, hand, checkActionBlocker: false, handsComp: hands);
|
||||
_handsSystem.PickupOrDrop(user, held, handsComp: userHands);
|
||||
_handsSystem.PickupOrDrop(user, held, handsComp: userHands, animate: !stealth);
|
||||
// hand update will trigger strippable update
|
||||
_adminLogger.Add(LogType.Stripping, LogImpact.Medium, $"{ToPrettyString(user):user} has stripped the item {ToPrettyString(held):item} from {ToPrettyString(component.Owner):target}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user