Remove inaccurate admin log when moving a held item (#32525)
Remove inaccurate admin log when switching held item
This commit is contained in:
@@ -130,9 +130,9 @@ namespace Content.Client.Hands.Systems
|
|||||||
OnPlayerHandsAdded?.Invoke(hands);
|
OnPlayerHandsAdded?.Invoke(hands);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DoDrop(EntityUid uid, Hand hand, bool doDropInteraction = true, HandsComponent? hands = null)
|
public override void DoDrop(EntityUid uid, Hand hand, bool doDropInteraction = true, HandsComponent? hands = null, bool log = true)
|
||||||
{
|
{
|
||||||
base.DoDrop(uid, hand, doDropInteraction, hands);
|
base.DoDrop(uid, hand, doDropInteraction, hands, log);
|
||||||
|
|
||||||
if (TryComp(hand.HeldEntity, out SpriteComponent? sprite))
|
if (TryComp(hand.HeldEntity, out SpriteComponent? sprite))
|
||||||
sprite.RenderOrder = EntityManager.CurrentTick.Value;
|
sprite.RenderOrder = EntityManager.CurrentTick.Value;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Inventory.VirtualItem;
|
using Content.Shared.Inventory.VirtualItem;
|
||||||
@@ -197,7 +198,7 @@ public abstract partial class SharedHandsSystem
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the contents of a hand from its container. Assumes that the removal is allowed. In general, you should not be calling this directly.
|
/// Removes the contents of a hand from its container. Assumes that the removal is allowed. In general, you should not be calling this directly.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void DoDrop(EntityUid uid, Hand hand, bool doDropInteraction = true, HandsComponent? handsComp = null)
|
public virtual void DoDrop(EntityUid uid, Hand hand, bool doDropInteraction = true, HandsComponent? handsComp = null, bool log = true)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref handsComp))
|
if (!Resolve(uid, ref handsComp))
|
||||||
return;
|
return;
|
||||||
@@ -221,6 +222,9 @@ public abstract partial class SharedHandsSystem
|
|||||||
if (doDropInteraction)
|
if (doDropInteraction)
|
||||||
_interactionSystem.DroppedInteraction(uid, entity);
|
_interactionSystem.DroppedInteraction(uid, entity);
|
||||||
|
|
||||||
|
if (log)
|
||||||
|
_adminLogger.Add(LogType.Drop, LogImpact.Low, $"{ToPrettyString(uid):user} dropped {ToPrettyString(entity):entity}");
|
||||||
|
|
||||||
if (hand == handsComp.ActiveHand)
|
if (hand == handsComp.ActiveHand)
|
||||||
RaiseLocalEvent(entity, new HandDeselectedEvent(uid));
|
RaiseLocalEvent(entity, new HandDeselectedEvent(uid));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,8 +178,8 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
|||||||
if (!CanPickupToHand(uid, entity, handsComp.ActiveHand, checkActionBlocker, handsComp))
|
if (!CanPickupToHand(uid, entity, handsComp.ActiveHand, checkActionBlocker, handsComp))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DoDrop(uid, hand, false, handsComp);
|
DoDrop(uid, hand, false, handsComp, log:false);
|
||||||
DoPickup(uid, handsComp.ActiveHand, entity, handsComp);
|
DoPickup(uid, handsComp.ActiveHand, entity, handsComp, log: false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Puts an entity into the player's hand, assumes that the insertion is allowed. In general, you should not be calling this function directly.
|
/// Puts an entity into the player's hand, assumes that the insertion is allowed. In general, you should not be calling this function directly.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void DoPickup(EntityUid uid, Hand hand, EntityUid entity, HandsComponent? hands = null)
|
public virtual void DoPickup(EntityUid uid, Hand hand, EntityUid entity, HandsComponent? hands = null, bool log = true)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref hands))
|
if (!Resolve(uid, ref hands))
|
||||||
return;
|
return;
|
||||||
@@ -235,6 +235,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (log)
|
||||||
_adminLogger.Add(LogType.Pickup, LogImpact.Low, $"{ToPrettyString(uid):user} picked up {ToPrettyString(entity):entity}");
|
_adminLogger.Add(LogType.Pickup, LogImpact.Low, $"{ToPrettyString(uid):user} picked up {ToPrettyString(entity):entity}");
|
||||||
|
|
||||||
Dirty(uid, hands);
|
Dirty(uid, hands);
|
||||||
|
|||||||
@@ -1166,8 +1166,6 @@ namespace Content.Shared.Interaction
|
|||||||
{
|
{
|
||||||
var dropMsg = new DroppedEvent(user);
|
var dropMsg = new DroppedEvent(user);
|
||||||
RaiseLocalEvent(item, dropMsg, true);
|
RaiseLocalEvent(item, dropMsg, true);
|
||||||
if (dropMsg.Handled)
|
|
||||||
_adminLogger.Add(LogType.Drop, LogImpact.Low, $"{ToPrettyString(user):user} dropped {ToPrettyString(item):entity}");
|
|
||||||
|
|
||||||
// If the dropper is rotated then use their targetrelativerotation as the drop rotation
|
// If the dropper is rotated then use their targetrelativerotation as the drop rotation
|
||||||
var rotation = Angle.Zero;
|
var rotation = Angle.Zero;
|
||||||
|
|||||||
Reference in New Issue
Block a user