Skip to content

Commit

Permalink
fix distance
Browse files Browse the repository at this point in the history
  • Loading branch information
Shegare committed Nov 25, 2024
1 parent e21480b commit 5ca09d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Content.Server/Stories/Garrote/GarroteSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public override void Initialize()
private void OnGarroteAttempt(EntityUid uid, GarroteComponent comp, ref AfterInteractEvent args)
{
if (args.User == args.Target
|| !args.CanReach
|| !HasComp<BodyComponent>(args.Target)
|| !HasComp<DamageableComponent>(args.Target)
|| !TryComp<MobStateComponent>(args.Target, out var mobstate)) return;
Expand All @@ -71,6 +70,13 @@ private void OnGarroteAttempt(EntityUid uid, GarroteComponent comp, ref AfterInt
return;
}

if (!args.CanReach)
{
var message = Loc.GetString("garrote-component-too-far-away", ("target", args.Target));
_popupSystem.PopupEntity(message, args.Target.Value, args.User);
return;
}

var messagetarget = Loc.GetString("garrote-component-started-target", ("user", args.User));
_popupSystem.PopupEntity(messagetarget, args.User, args.Target.Value, PopupType.LargeCaution);

Expand All @@ -82,7 +88,8 @@ private void OnGarroteAttempt(EntityUid uid, GarroteComponent comp, ref AfterInt
BreakOnMove = true,
BreakOnDamage = true,
NeedHand = true,
DuplicateCondition = DuplicateConditions.SameTool
DuplicateCondition = DuplicateConditions.SameTool,
DistanceThreshold = 0.1f
};

if (!_doAfter.TryStartDoAfter(doAfterEventArgs)) return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
garrote-component-doesnt-breath = { $target } уже не дышит!
garrote-component-must-be-behind = Вы должны быть сзади { $target }.
garrote-component-too-far-away = Вы слишком далеко, чтобы использовать удавку!
garrote-component-started-target = { $user } начинает удушать вас!
garrote-component-started-others = { $user } начинает удушать { $target }!

0 comments on commit 5ca09d0

Please sign in to comment.