Documentation
¶
Overview ¶
Package events contains all events that can be sent out from demoinfocs.Parser.
Events are generally named in the tense that fits the best for each event. E.g. SmokeExpired is in the past tense because it's sent out when the smoke has completely faded away while SmokeStart is in the present tense because it's sent out when the smoke starts to bloom.
Index ¶
- Constants
- type AnnouncementFinalRound
- type AnnouncementLastRoundHalf
- type AnnouncementMatchStarted
- type AnnouncementWinPanelMatch
- type BombDefuseAborted
- type BombDefuseStart
- type BombDefused
- type BombDropped
- type BombEvent
- type BombEventIf
- type BombExplode
- type BombPickup
- type BombPlantBegin
- type BombPlanted
- type BotTakenOver
- type ChatMessage
- type DataTablesParsed
- type DecoyExpired
- type DecoyStart
- type FireGrenadeExpired
- type FireGrenadeStart
- type FlashExplode
- type Footstep
- type GameHalfEnded
- type GamePhaseChanged
- type GenericGameEvent
- type GrenadeEvent
- type GrenadeEventIf
- type GrenadeProjectileBounce
- type GrenadeProjectileDestroy
- type GrenadeProjectileThrow
- type HeExplode
- type HitGroup
- type InfernoExpired
- type InfernoStart
- type IsWarmupPeriodChanged
- type ItemDrop
- type ItemEquip
- type ItemPickup
- type Kill
- type MatchStart
- type MatchStartedChanged
- type ParserWarn
- type PlayerConnect
- type PlayerDisconnected
- type PlayerFlashed
- type PlayerHurt
- type PlayerJump
- type PlayerTeamChange
- type RankUpdate
- type RoundEnd
- type RoundEndOfficial
- type RoundEndReason
- type RoundFreezetimeEnd
- type RoundMVPAnnouncement
- type RoundMVPReason
- type RoundStart
- type SayText
- type SayText2
- type ScoreUpdated
- type SmokeExpired
- type SmokeStart
- type StringTableCreated
- type TeamSideSwitch
- type TickDone
- type WeaponFire
Constants ¶
const ( BombsiteA bombsite = 'A' BombsiteB bombsite = 'B' )
Bombsite identifiers
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnouncementFinalRound ¶
type AnnouncementFinalRound struct{}
AnnouncementFinalRound signals the 30th round, not raised if the match ends before that.
type AnnouncementLastRoundHalf ¶
type AnnouncementLastRoundHalf struct{}
AnnouncementLastRoundHalf signals the last round of the first half.
type AnnouncementMatchStarted ¶
type AnnouncementMatchStarted struct{}
AnnouncementMatchStarted signals that the announcement "Match Started" has been displayed.
type AnnouncementWinPanelMatch ¶
type AnnouncementWinPanelMatch struct{}
AnnouncementWinPanelMatch signals that the 'win panel' has been displayed. I guess that's the final scoreboard.
type BombDefuseAborted ¶
BombDefuseAborted signals that the defuser aborted the action.
type BombDefuseStart ¶
BombDefuseStart signals the start of defusing.
type BombDefused ¶
type BombDefused struct {
BombEvent
}
BombDefused signals that the bomb has been defused.
type BombDropped ¶
BombDropped signals that the bomb (C4) has been dropped onto the ground. Not fired if it has been dropped to another player (see BombPickup for this).
type BombEvent ¶
BombEvent contains the common attributes of bomb events. Dont register handlers on this tho, you want BombEventIf for that.
type BombEventIf ¶
type BombEventIf interface {
// contains filtered or unexported methods
}
BombEventIf is the interface for all the bomb events. Like GrenadeEventIf for GrenadeEvents.
type BombExplode ¶
type BombExplode struct {
BombEvent
}
BombExplode signals that the bomb has exploded.
type BombPickup ¶
BombPickup signals that the bomb (C4) has been picked up.
type BombPlantBegin ¶
type BombPlantBegin struct {
BombEvent
}
BombPlantBegin signals the start of a plant.
type BombPlanted ¶
type BombPlanted struct {
BombEvent
}
BombPlanted signals that the bomb has been planted.
type BotTakenOver ¶
BotTakenOver signals that a player took over a bot.
type ChatMessage ¶
ChatMessage signals a player generated chat message. Since team chat is generally not recorded IsChatAll will probably always be false. See SayText for admin / console messages and SayText2 for raw network package data.
type DataTablesParsed ¶
type DataTablesParsed struct{}
DataTablesParsed signals that the datatables were parsed. You can use the Parser.SendTableParser() after this event to register update notification on entities & properties.
type DecoyExpired ¶
type DecoyExpired struct {
GrenadeEvent
}
DecoyExpired signals the end of a decoy.
type FireGrenadeExpired ¶
type FireGrenadeExpired struct {
GrenadeEvent
}
FireGrenadeExpired signals that all fires of a molly/incendiary have extinguished.
type FireGrenadeStart ¶
type FireGrenadeStart struct {
GrenadeEvent
}
FireGrenadeStart signals the start of a molly/incendiary.
type FlashExplode ¶
type FlashExplode struct {
GrenadeEvent
}
FlashExplode signals the explosion of a Flash.
type GameHalfEnded ¶
type GameHalfEnded struct { }
GameHalfEnded signals that the currently ongoing game half has ended. GameHalfEnded is usually dispatched in the end of a round, just before RoundEndOfficial.
type GamePhaseChanged ¶
GamePhaseChanged signals that the game phase has changed. This event is for advanced usage, as more user friendly events are available for important game phase changes, such as TeamSideSwitch and GameHalfEnded.
type GenericGameEvent ¶ added in v0.5.0
type GenericGameEvent struct { Name string Data map[string]*msg.CSVCMsg_GameEventKeyT }
GenericGameEvent signals a otherwise unhandled event.
type GrenadeEvent ¶
type GrenadeEvent struct { GrenadeType common.EquipmentElement Position r3.Vector Thrower *common.Player GrenadeEntityID int }
GrenadeEvent contains the common attributes of nade events. Dont register handlers on this tho, you want GrenadeEventIf for that
func (GrenadeEvent) Base ¶
func (ne GrenadeEvent) Base() GrenadeEvent
Base returns the GrenadeEvent itself, used for catching all events with GrenadeEventIf.
type GrenadeEventIf ¶
type GrenadeEventIf interface {
Base() GrenadeEvent
}
GrenadeEventIf is the interface for all GrenadeEvents (except GrenadeProjectile* events). Used to catch the different events with the same handler.
type GrenadeProjectileBounce ¶
type GrenadeProjectileBounce struct { Projectile *common.GrenadeProjectile BounceNr int }
GrenadeProjectileBounce signals that a nade has just bounced off a wall/floor/ceiling or object.
type GrenadeProjectileDestroy ¶
type GrenadeProjectileDestroy struct {
Projectile *common.GrenadeProjectile
}
GrenadeProjectileDestroy signals that a nade entity is being destroyed (i.e. it detonated / expired). This is different from the other Grenade events because it's sent out when the projectile entity is destroyed.
Mainly useful for getting the full trajectory of the projectile.
type GrenadeProjectileThrow ¶
type GrenadeProjectileThrow struct {
Projectile *common.GrenadeProjectile
}
GrenadeProjectileThrow signals that a nade has just been thrown. This is different from the WeaponFired because it's sent out when the projectile entity is created.
type HitGroup ¶
type HitGroup byte
HitGroup is the type for the various HitGroupXYZ constants.
See PlayerHurt.
const ( HitGroupGeneric HitGroup = 0 HitGroupHead HitGroup = 1 HitGroupChest HitGroup = 2 HitGroupStomach HitGroup = 3 HitGroupLeftArm HitGroup = 4 HitGroupRightArm HitGroup = 5 HitGroupLeftLeg HitGroup = 6 HitGroupRightLeg HitGroup = 7 HitGroupGear HitGroup = 10 )
HitGroup constants give information about where a player got hit. e.g. head, chest, legs etc.
type InfernoExpired ¶
InfernoExpired signals that all fire from a incendiary or Molotov has extinguished. This is different from the FireGrenadeExpire event because it's sent out when the inferno entity is destroyed instead of on the game-event.
Mainly useful for getting the final area of an inferno.
type InfernoStart ¶
InfernoStart signals that the fire of a incendiary or Molotov is starting. This is different from the FireGrenadeStart because it's sent out when the inferno entity is created instead of on the game-event.
type IsWarmupPeriodChanged ¶
IsWarmupPeriodChanged signals that the value of data table DT_GameRulesProxy.m_bIsWarmupPeriod has changed. This can be useful to ignore things that happen during the warmup.
type ItemPickup ¶
ItemPickup signals an item was bought or picked up. This event is not available in all demos.
type Kill ¶
type Kill struct { Weapon *common.Equipment Victim *common.Player Killer *common.Player Assister *common.Player PenetratedObjects int IsHeadshot bool }
Kill signals that a player has been killed.
type MatchStartedChanged ¶
MatchStartedChanged signals that the value of data table DT_GameRulesProxy.m_bHasMatchStarted has changed This can be useful for some demos where the MatchStart event is not sent.
type ParserWarn ¶
type ParserWarn struct {
Message string
}
ParserWarn signals that a non-fatal problem occurred during parsing.
type PlayerConnect ¶
PlayerConnect signals that a player has started connecting.
type PlayerDisconnected ¶
PlayerDisconnected signals that a player has disconnected.
type PlayerFlashed ¶
PlayerFlashed signals that a player was flashed.
func (PlayerFlashed) FlashDuration ¶
func (e PlayerFlashed) FlashDuration() time.Duration
FlashDuration returns the duration of the blinding effect. This is just a shortcut for Player.FlashDurationTime().
type PlayerHurt ¶
type PlayerHurt struct { Player *common.Player Attacker *common.Player Health int Armor int Weapon *common.Equipment WeaponString string // Wrong for CZ, M4A1-S etc. HealthDamage int ArmorDamage int HitGroup HitGroup }
PlayerHurt signals that a player has been damaged.
type PlayerJump ¶
PlayerJump signals that a player has jumped.
type PlayerTeamChange ¶
type PlayerTeamChange struct { Player *common.Player NewTeam common.Team // TeamState of the old team. // May be nil if player changed from spectators/unassigned (OldTeam == TeamSpectators || OldTeam == TeamUnassigned). NewTeamState *common.TeamState OldTeam common.Team // TeamState of the old team. // May be nil if player changed from spectators/unassigned (OldTeam == TeamSpectators || OldTeam == TeamUnassigned). OldTeamState *common.TeamState Silent bool IsBot bool }
PlayerTeamChange occurs when a player swaps teams.
type RankUpdate ¶
RankUpdate signals the new rank. Not sure if this only occurs if the rank changed.
type RoundEnd ¶
type RoundEnd struct { Message string Reason RoundEndReason Winner common.Team WinnerState *common.TeamState // TeamState of the winner. May be nil if it's a draw (Winner == TeamSpectators) LoserState *common.TeamState // TeamState of the loser. May be nil if it's a draw (Winner == TeamSpectators) }
RoundEnd signals that a round just finished. Attention: TeamState.Score() won't be up to date yet after this. Add +1 to the winner's score as a workaround.
type RoundEndOfficial ¶
type RoundEndOfficial struct{}
RoundEndOfficial signals that the round has 'officially' ended. After RoundEnd and before this players are still able to walk around.
type RoundEndReason ¶
type RoundEndReason byte
RoundEndReason is the type for the various RoundEndReasonXYZ constants.
See RoundEnd.
const ( RoundEndReasonTargetBombed RoundEndReason = 1 RoundEndReasonVIPEscaped RoundEndReason = 2 RoundEndReasonVIPKilled RoundEndReason = 3 RoundEndReasonTerroristsEscaped RoundEndReason = 4 RoundEndReasonCTStoppedEscape RoundEndReason = 5 RoundEndReasonTerroristsStopped RoundEndReason = 6 RoundEndReasonBombDefused RoundEndReason = 7 RoundEndReasonCTWin RoundEndReason = 8 RoundEndReasonTerroristsWin RoundEndReason = 9 RoundEndReasonDraw RoundEndReason = 10 RoundEndReasonHostagesRescued RoundEndReason = 11 RoundEndReasonTargetSaved RoundEndReason = 12 RoundEndReasonHostagesNotRescued RoundEndReason = 13 RoundEndReasonTerroristsNotEscaped RoundEndReason = 14 RoundEndReasonVIPNotEscaped RoundEndReason = 15 RoundEndReasonGameStart RoundEndReason = 16 RoundEndReasonTerroristsSurrender RoundEndReason = 17 RoundEndReasonCTSurrender RoundEndReason = 18 )
RoundEndReason constants give information about why a round ended (Bomb defused, exploded etc.).
type RoundFreezetimeEnd ¶
type RoundFreezetimeEnd struct{}
RoundFreezetimeEnd signals that the freeze time is over.
type RoundMVPAnnouncement ¶
type RoundMVPAnnouncement struct { Player *common.Player Reason RoundMVPReason }
RoundMVPAnnouncement signals the announcement of the last rounds MVP.
type RoundMVPReason ¶
type RoundMVPReason byte
RoundMVPReason is the type for the various MVPReasonYXZ constants.
See RoundMVPAnnouncement.
const ( MVPReasonMostEliminations RoundMVPReason = 1 MVPReasonBombDefused RoundMVPReason = 2 MVPReasonBombPlanted RoundMVPReason = 3 )
RoundMVPReasons constants give information about why a player got the MVP award.
type RoundStart ¶
RoundStart signals that a new round has started.
type SayText ¶
type SayText struct { EntIdx int // Not sure what this is, doesn't seem to be the entity-ID Text string IsChat bool // Not sure, from the net-message IsChatAll bool // Seems to always be false, team chat might not be recorded }
SayText signals a chat message. It contains the raw network message data for admin / console messages. EntIdx will probably always be 0 See ChatMessage and SayText2 for player chat messages.
type SayText2 ¶
type SayText2 struct { EntIdx int // Not sure what this is, doesn't seem to be the entity-ID MsgName string // The message type, e.g. Cstrike_Chat_All for global chat Params []string // The message's parameters, for Cstrike_Chat_All parameter 1 is the player and 2 the message for example IsChat bool // Not sure, from the net-message IsChatAll bool // Seems to always be false, team chat might not be recorded }
SayText2 signals a chat message. It just contains the raw network message. For player chat messages, ChatMessage may be more interesting. Team chat is generally not recorded so IsChatAll will probably always be false. See SayText for admin / console messages.
type ScoreUpdated ¶
ScoreUpdated signals that the score of one of the teams has been updated. It has been observed that some demos do not always trigger the RoundEnd event as one would expect.
ScoreUpdated can be used to circumvent missing RoundEnd events in some cases, as (we assume) it is required in order to show the correct score in-game.
type SmokeExpired ¶
type SmokeExpired struct {
GrenadeEvent
}
SmokeExpired signals that a smoke as completely faded away.
type SmokeStart ¶
type SmokeStart struct {
GrenadeEvent
}
SmokeStart signals the start of a smoke (pop).
type StringTableCreated ¶
type StringTableCreated struct {
TableName string
}
StringTableCreated signals that a string table was created via net message. Can be useful for figuring out when player-info is available via Parser.GameState().[Playing]Participants(). E.g. after the table 'userinfo' has been created the player-data should be available after the next TickDone. The reason it's not immediately available is because we need to do some post-processing to prep that data after a tick has finished.
type TeamSideSwitch ¶
type TeamSideSwitch struct { }
TeamSideSwitch signals that teams are switching sides, i.e. swapping between T and CT. TeamSideSwitch is usually dispatched in the beginning of a round, just after OnRoundStart.