Cleanup: Make separate event for the equip/unequip target (#37333)
* Cleanup * Update
This commit is contained in:
@@ -286,23 +286,21 @@ public abstract partial class InventorySystem
|
||||
}
|
||||
|
||||
var attemptEvent = new IsEquippingAttemptEvent(actor, target, itemUid, slotDefinition);
|
||||
RaiseLocalEvent(target, attemptEvent, true);
|
||||
RaiseLocalEvent(actor, attemptEvent, true);
|
||||
|
||||
if (attemptEvent.Cancelled)
|
||||
{
|
||||
reason = attemptEvent.Reason ?? reason;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (actor != target)
|
||||
var targetAttemptEvent = new IsEquippingTargetAttemptEvent(actor, target, itemUid, slotDefinition);
|
||||
RaiseLocalEvent(target, targetAttemptEvent, true);
|
||||
|
||||
if (targetAttemptEvent.Cancelled)
|
||||
{
|
||||
//reuse the event. this is gucci, right?
|
||||
attemptEvent.Reason = null;
|
||||
RaiseLocalEvent(actor, attemptEvent, true);
|
||||
if (attemptEvent.Cancelled)
|
||||
{
|
||||
reason = attemptEvent.Reason ?? reason;
|
||||
return false;
|
||||
}
|
||||
reason = targetAttemptEvent.Reason ?? reason;
|
||||
return false;
|
||||
}
|
||||
|
||||
var itemAttemptEvent = new BeingEquippedAttemptEvent(actor, target, itemUid, slotDefinition);
|
||||
@@ -524,23 +522,21 @@ public abstract partial class InventorySystem
|
||||
}
|
||||
|
||||
var attemptEvent = new IsUnequippingAttemptEvent(actor, target, itemUid, slotDefinition);
|
||||
RaiseLocalEvent(target, attemptEvent, true);
|
||||
RaiseLocalEvent(actor, attemptEvent, true);
|
||||
|
||||
if (attemptEvent.Cancelled)
|
||||
{
|
||||
reason = attemptEvent.Reason ?? reason;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (actor != target)
|
||||
var targetAttemptEvent = new IsUnequippingTargetAttemptEvent(actor, target, itemUid, slotDefinition);
|
||||
RaiseLocalEvent(target, targetAttemptEvent, true);
|
||||
|
||||
if (targetAttemptEvent.Cancelled)
|
||||
{
|
||||
//reuse the event. this is gucci, right?
|
||||
attemptEvent.Reason = null;
|
||||
RaiseLocalEvent(actor, attemptEvent, true);
|
||||
if (attemptEvent.Cancelled)
|
||||
{
|
||||
reason = attemptEvent.Reason ?? reason;
|
||||
return false;
|
||||
}
|
||||
reason = targetAttemptEvent.Reason ?? reason;
|
||||
return false;
|
||||
}
|
||||
|
||||
var itemAttemptEvent = new BeingUnequippedAttemptEvent(actor, target, itemUid, slotDefinition);
|
||||
|
||||
Reference in New Issue
Block a user