Skip to content

Commit

Permalink
Bomb related fixes
Browse files Browse the repository at this point in the history
* bumped version to 1.3.1
* re-added gs.Round.Bomb
* added gs.Bomb.Countdown
  • Loading branch information
rakijah committed Feb 15, 2019
1 parent 34b6cb6 commit 597ae9c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
9 changes: 2 additions & 7 deletions CSGSI/GameStateListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private void ReceiveGameState(IAsyncResult result)
#region Intricate Events

/// <summary>
/// Determines whether intricate events such as PlayerDied are raised or ignored.
/// Determines whether intricate events are raised or ignored. Most of these events are only available when spectating a match!
/// </summary>
public bool EnableRaisingIntricateEvents { get; set; } = false;

Expand Down Expand Up @@ -218,10 +218,6 @@ private void ProcessGameState(GameState gs)

if (BombPlanted != null)
{
//if previous state contains any player with the bomb
//and current state does not contain any players with the bomb
//and the previous bombstate was undefined
//and the current bombstate is planted
var planter = gs.Previously.AllPlayers.PlayerList.SingleOrDefault(player => player.Weapons.WeaponList.Any(weapon => weapon.Type == WeaponType.C4));
if (planter != null &&
gs.Previously.Bomb.State == BombState.Planting &&
Expand All @@ -233,8 +229,7 @@ private void ProcessGameState(GameState gs)

if (BombDefused != null)
{
if (gs.Previously.Bomb.State == BombState.Planted &&
gs.Bomb.State == BombState.Defused)
if (gs.Previously.Bomb.State == BombState.Planted && gs.Bomb.State == BombState.Defused)
{
var defuser = gs.AllPlayers.PlayerList.SingleOrDefault(player => gs.AllPlayers.GetBySteamID(player.SteamID).MatchStats.Score > player.MatchStats.Score);
if (defuser == null)
Expand Down
8 changes: 7 additions & 1 deletion CSGSI/Nodes/BombNode.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace CSGSI.Nodes
{
/// <summary>
/// Contains information about the bomb.
/// Contains information about the bomb. This node is only available when spectating!
/// </summary>
public class BombNode : NodeBase
{
Expand All @@ -15,6 +15,11 @@ public class BombNode : NodeBase
/// </summary>
public Vector3 Position { get; set; }

/// <summary>
/// The time remaining for the current state (i.e. time remaining until explosion if bomb is planted, time remaining until defused if defusing, etc).
/// </summary>
public float Countdown { get; set; }

/// <summary>
/// Initializes a new <see cref="BombNode"/> from the given JSON string.
/// </summary>
Expand All @@ -24,6 +29,7 @@ public BombNode(string json)
{
State = GetEnum<BombState>("state");
Position = GetVector3("position");
Countdown = GetFloat("countdown");
}
}

Expand Down
6 changes: 6 additions & 0 deletions CSGSI/Nodes/RoundNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ public class RoundNode : NodeBase
/// </summary>
public RoundPhase Phase { get; set; }

/// <summary>
/// The current state of the bomb (does not include states like "Dropped" or "Planting").
/// </summary>
public BombState Bomb { get; set; }

/// <summary>
/// The team that won the current round (only available when Phase == Over)
/// </summary>
Expand All @@ -19,6 +24,7 @@ internal RoundNode(string json)
: base(json)
{
Phase = GetEnum<RoundPhase>("phase");
Bomb = GetEnum<BombState>("bomb");
WinTeam = GetEnum<RoundWinTeam>("win_team");
}
}
Expand Down
4 changes: 2 additions & 2 deletions CSGSI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.3.1.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]

0 comments on commit 597ae9c

Please sign in to comment.