wield popup fix (#10855)
This commit is contained in:
@@ -51,6 +51,9 @@ namespace Content.Server.Wieldable
|
|||||||
if (args.Hands == null || !args.CanAccess || !args.CanInteract)
|
if (args.Hands == null || !args.CanAccess || !args.CanInteract)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!_handsSystem.IsHolding(args.User, uid, out _, args.Hands))
|
||||||
|
return;
|
||||||
|
|
||||||
// TODO VERB TOOLTIPS Make CanWield or some other function return string, set as verb tooltip and disable
|
// TODO VERB TOOLTIPS Make CanWield or some other function return string, set as verb tooltip and disable
|
||||||
// verb. Or just don't add it to the list if the action is not executable.
|
// verb. Or just don't add it to the list if the action is not executable.
|
||||||
|
|
||||||
@@ -82,7 +85,7 @@ namespace Content.Server.Wieldable
|
|||||||
if (!EntityManager.TryGetComponent<HandsComponent>(user, out var hands))
|
if (!EntityManager.TryGetComponent<HandsComponent>(user, out var hands))
|
||||||
{
|
{
|
||||||
if(!quiet)
|
if(!quiet)
|
||||||
_popupSystem.PopupEntity(Loc.GetString("wieldable-component-no-hands"), user, Filter.Pvs(user));
|
_popupSystem.PopupEntity(Loc.GetString("wieldable-component-no-hands"), user, Filter.Entities(user));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +93,7 @@ namespace Content.Server.Wieldable
|
|||||||
if (!_handsSystem.IsHolding(user, uid, out _, hands))
|
if (!_handsSystem.IsHolding(user, uid, out _, hands))
|
||||||
{
|
{
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
_popupSystem.PopupEntity(Loc.GetString("wieldable-component-not-in-hands", ("item", uid)), user, Filter.Pvs(user));
|
_popupSystem.PopupEntity(Loc.GetString("wieldable-component-not-in-hands", ("item", uid)), user, Filter.Entities(user));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +103,7 @@ namespace Content.Server.Wieldable
|
|||||||
{
|
{
|
||||||
var message = Loc.GetString("wieldable-component-not-enough-free-hands",
|
var message = Loc.GetString("wieldable-component-not-enough-free-hands",
|
||||||
("number", component.FreeHandsRequired), ("item", uid));
|
("number", component.FreeHandsRequired), ("item", uid));
|
||||||
_popupSystem.PopupEntity(message, user, Filter.Pvs(user));
|
_popupSystem.PopupEntity(message, user, Filter.Entities(user));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -145,7 +148,7 @@ namespace Content.Server.Wieldable
|
|||||||
public void AttemptUnwield(EntityUid used, WieldableComponent component, EntityUid user)
|
public void AttemptUnwield(EntityUid used, WieldableComponent component, EntityUid user)
|
||||||
{
|
{
|
||||||
var ev = new BeforeUnwieldEvent();
|
var ev = new BeforeUnwieldEvent();
|
||||||
RaiseLocalEvent(used, ev, false);
|
RaiseLocalEvent(used, ev);
|
||||||
|
|
||||||
if (ev.Cancelled)
|
if (ev.Cancelled)
|
||||||
return;
|
return;
|
||||||
@@ -153,8 +156,8 @@ namespace Content.Server.Wieldable
|
|||||||
var targEv = new ItemUnwieldedEvent(user);
|
var targEv = new ItemUnwieldedEvent(user);
|
||||||
var userEv = new UnwieldedItemEvent(used);
|
var userEv = new UnwieldedItemEvent(used);
|
||||||
|
|
||||||
RaiseLocalEvent(used, targEv, false);
|
RaiseLocalEvent(used, targEv);
|
||||||
RaiseLocalEvent(user, userEv, false);
|
RaiseLocalEvent(user, userEv);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnItemWielded(EntityUid uid, WieldableComponent component, ItemWieldedEvent args)
|
private void OnItemWielded(EntityUid uid, WieldableComponent component, ItemWieldedEvent args)
|
||||||
@@ -184,7 +187,9 @@ namespace Content.Server.Wieldable
|
|||||||
}
|
}
|
||||||
|
|
||||||
_popupSystem.PopupEntity(Loc.GetString("wieldable-component-successful-wield",
|
_popupSystem.PopupEntity(Loc.GetString("wieldable-component-successful-wield",
|
||||||
("item", uid)), args.User.Value, Filter.Pvs(args.User.Value));
|
("item", uid)), args.User.Value, Filter.Entities(args.User.Value));
|
||||||
|
_popupSystem.PopupEntity(Loc.GetString("wieldable-component-successful-wield-other",
|
||||||
|
("user", args.User.Value),("item", uid)), args.User.Value, Filter.PvsExcept(args.User.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnItemUnwielded(EntityUid uid, WieldableComponent component, ItemUnwieldedEvent args)
|
private void OnItemUnwielded(EntityUid uid, WieldableComponent component, ItemUnwieldedEvent args)
|
||||||
@@ -206,8 +211,10 @@ namespace Content.Server.Wieldable
|
|||||||
if (component.UnwieldSound != null)
|
if (component.UnwieldSound != null)
|
||||||
_audioSystem.PlayPvs(component.UnwieldSound, uid);
|
_audioSystem.PlayPvs(component.UnwieldSound, uid);
|
||||||
|
|
||||||
var message = Loc.GetString("wieldable-component-failed-wield", ("item", uid));
|
_popupSystem.PopupEntity(Loc.GetString("wieldable-component-failed-wield",
|
||||||
_popupSystem.PopupEntity(message, args.User.Value, Filter.Pvs(args.User.Value));
|
("item", uid)), args.User.Value, Filter.Entities(args.User.Value));
|
||||||
|
_popupSystem.PopupEntity(Loc.GetString("wieldable-component-failed-wield-other",
|
||||||
|
("user", args.User.Value), ("item", uid)), args.User.Value, Filter.PvsExcept(args.User.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
_virtualItemSystem.DeleteInHandsMatching(args.User.Value, uid);
|
_virtualItemSystem.DeleteInHandsMatching(args.User.Value, uid);
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ wieldable-verb-text-unwield = Unwield
|
|||||||
|
|
||||||
wieldable-component-successful-wield = You wield { THE($item) }.
|
wieldable-component-successful-wield = You wield { THE($item) }.
|
||||||
wieldable-component-failed-wield = You unwield { THE($item) }.
|
wieldable-component-failed-wield = You unwield { THE($item) }.
|
||||||
|
wieldable-component-successful-wield-other = { THE($user) } wields { THE($item) }.
|
||||||
|
wieldable-component-failed-wield-other = { THE($user) } unwields { THE($item) }.
|
||||||
|
|
||||||
wieldable-component-no-hands = You don't have enough hands!
|
wieldable-component-no-hands = You don't have enough hands!
|
||||||
wieldable-component-not-enough-free-hands = {$number ->
|
wieldable-component-not-enough-free-hands = {$number ->
|
||||||
[one] You need a free hand to wield { THE($item) }.
|
[one] You need a free hand to wield { THE($item) }.
|
||||||
|
|||||||
Reference in New Issue
Block a user