Фикс логики системы отражения (#682)

* Fixed ReflectSystem + Added logic for reflective items positioning

* Total oppsie fix

* Born to shitcode
This commit is contained in:
BIGZi0348
2024-09-03 21:14:42 +03:00
committed by GitHub
parent 6853e5b44f
commit 79acb6f9ee
7 changed files with 95 additions and 12 deletions

View File

@@ -3,5 +3,23 @@ namespace Content.Shared.Wieldable;
/// <summary>
/// Raised directed on an entity when it is wielded.
/// </summary>
[ByRefEvent]
public readonly record struct ItemWieldedEvent;
// WD edit start
// Reason for the edit: previously ItemWieldedEvent didn't contained "EntityUid user" parameter.
// Now it's done like ItemUnwieldedEvent with "EntityUid user" parameter for correct logic work.
// [ByRefEvent]
// public readonly record struct ItemWieldedEvent;
public sealed class ItemWieldedEvent : EntityEventArgs
{
public EntityUid? User;
/// <summary>
/// Whether the item is being forced to be wielded, or if the player chose to wield it themselves.
/// </summary>
public bool Force;
public ItemWieldedEvent(EntityUid? user = null, bool force = false)
{
User = user;
Force = force;
}
}
// WD edit end

View File

@@ -226,8 +226,8 @@ public sealed class WieldableSystem : EntitySystem
var othersMessage = Loc.GetString("wieldable-component-successful-wield-other", ("user", user), ("item", used));
_popupSystem.PopupPredicted(selfMessage, othersMessage, user, user);
var targEv = new ItemWieldedEvent();
RaiseLocalEvent(used, ref targEv);
var targEv = new ItemWieldedEvent(user); // WD added user
RaiseLocalEvent(used, targEv); // WD removed ref from targEv
Dirty(used, component);
return true;