Skip to content

Commit

Permalink
Remove thrower record class
Browse files Browse the repository at this point in the history
  • Loading branch information
qualterz committed May 13, 2024
1 parent 5ae6ed2 commit fabec1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions CS2Nades.Common/NadesHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ public NadesHandler(DemoParser demoParser)
var expireTiming = new Timing(demoParser.CurrentGameTick, demoParser.CurrentGameTime);
var timings = new Timings(throwTiming!, expireTiming);
var throwerId = e.Thrower?.Controller?.SteamID;
var thrower = new Thrower(throwerId ?? default);

OnThrownNade?.Invoke(new(
Thrower: thrower,
ThrowerId: throwerId ?? default,
Timings: timings,
Nade: nade));
};
Expand All @@ -69,5 +68,4 @@ public record ThrowLineup(Vector Position, QAngle Angle, InputButtons Buttons);
public record Nade(string Name, ThrowLineup Lineup, Vector Destination);
public record Timing(GameTick Tick, GameTime Time);
public record Timings(Timing Throw, Timing Expire);
public record Thrower(ulong SteamId);
public record ThrownNade(Nade Nade, Thrower Thrower, Timings Timings);
public record ThrownNade(Nade Nade, Timings Timings, ulong ThrowerId);
4 changes: 2 additions & 2 deletions CS2Nades.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

nadesHandler.OnThrownNade += thrownNade =>
{
var player = demoParser.GetPlayerBySteamId(thrownNade.Thrower.SteamId);
var player = demoParser.GetPlayerBySteamId(thrownNade.ThrowerId);
var nickname = player?.PlayerName;
var place = player?.PlayerPawn?.LastPlaceName;

Expand All @@ -40,7 +40,7 @@
Nade = thrownNade.Nade,
Thrower = new
{
SteamId = thrownNade.Thrower.SteamId,
SteamId = thrownNade.ThrowerId,
Nickname = nickname,
},
ThrowPlace = place,
Expand Down

0 comments on commit fabec1f

Please sign in to comment.