Skip to content

Commit

Permalink
bug: fix issue where it would send more than available HP for a playe… (
Browse files Browse the repository at this point in the history
  • Loading branch information
lukepolo authored Jan 13, 2025
1 parent 8876e6f commit 6fc47bc
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 92 deletions.
10 changes: 0 additions & 10 deletions cfg/base.cfg

This file was deleted.

21 changes: 0 additions & 21 deletions cfg/knife.cfg

This file was deleted.

37 changes: 0 additions & 37 deletions cfg/live.cfg

This file was deleted.

22 changes: 0 additions & 22 deletions cfg/warmup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion src/FiveStack.Events/Bomb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public HookResult BombPlaned(EventBombPlanted @event, GameEventInfo info)
}

[GameEventHandler]
public HookResult BombPlaned(EventBombDefused @event, GameEventInfo info)
public HookResult BombDefused(EventBombDefused @event, GameEventInfo info)
{
MatchManager? match = _matchService.GetCurrentMatch();
MatchData? matchData = match?.GetMatchData();
Expand Down
12 changes: 11 additions & 1 deletion src/FiveStack.Events/PlayerDamage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ public HookResult OnPlayerDamage(EventPlayerHurt @event, GameEventInfo info)
var attackerLocation = attacker?.PlayerPawn.Value?.AbsOrigin;
var attackedLocation = attacked?.PlayerPawn?.Value?.AbsOrigin;

var damageDealt = @event.DmgHealth;

if (attacked != null)
{
if (attacked.PlayerPawn.Value.Health < 0)
{
damageDealt = damageDealt + attacked.PlayerPawn.Value.Health;
}
}

_matchEvents.PublishGameEvent(
"damage",
new Dictionary<string, object>
Expand All @@ -58,7 +68,7 @@ public HookResult OnPlayerDamage(EventPlayerHurt @event, GameEventInfo info)
: ""
},
{ "weapon", $"{(@event.Weapon.Length == 0 ? "worldent" : @event.Weapon)}" },
{ "damage", @event.DmgHealth },
{ "damage", damageDealt },
{ "damage_armor", @event.DmgArmor },
{ "hitgroup", $"{DamageUtility.HitGroupToString(@event.Hitgroup)}" },
{ "health", @event.Health },
Expand Down

0 comments on commit 6fc47bc

Please sign in to comment.