Module: Australium::EventFilters

Included in:
EventCache, Game
Defined in:
lib/australium/event_filters.rb

Overview

Creates a set of helper methods for all classes containing Events. The #event_filter method must be overridden in the class including this module, and should generate a method that returns an Array<Event>.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.event_filter(*args) ⇒ Object

Creates shortcuts for returning events of a certain type.

Parameters:

  • friendly_name (Symbol)

    the friendly name of the event group requested

  • class_name (Class)

    the class name of the requested events


18
# File 'lib/australium/event_filters.rb', line 18

def event_filter(*args); @filters ||= [] ; @filters << args end

Instance Method Details

#chat_messagesArray<PlayerSay>

Returns all PlayerSay events.

Returns:


33
# File 'lib/australium/event_filters.rb', line 33

event_filter :chat_messages, PlayerSay

#connectsArray<PlayerConnect>

Returns all PlayerConnect events.

Returns:


26
# File 'lib/australium/event_filters.rb', line 26

event_filter :connects,      PlayerConnect

#disconnectsArray<PlayerDisconnect>

Returns all PlayerDisconnect events.

Returns:


27
# File 'lib/australium/event_filters.rb', line 27

event_filter :disconnects,   PlayerDisconnect

#entrancesArray<PlayerEnterGame>

Returns all PlayerEnterGame events.

Returns:


28
# File 'lib/australium/event_filters.rb', line 28

event_filter :entrances,     PlayerEnterGame

#killsArray<PlayerKill>

Returns all PlayerKill events.

Returns:


31
# File 'lib/australium/event_filters.rb', line 31

event_filter :kills,         PlayerKill

#map_loadsArray<MapLoad>

Returns all MapLoad events.

Returns:


24
# File 'lib/australium/event_filters.rb', line 24

event_filter :map_loads,     MapLoad

#map_startsArray<MapStart>

Returns all MapStart events.

Returns:


25
# File 'lib/australium/event_filters.rb', line 25

event_filter :map_starts,    MapStart

#name_changesArray<PlayerNameChange>

Returns all PlayerNameChange events.

Returns:


32
# File 'lib/australium/event_filters.rb', line 32

event_filter :name_changes,  PlayerNameChange

#role_changesArray<PlayerRoleChange>

Returns all PlayerRoleChange events.

Returns:


29
# File 'lib/australium/event_filters.rb', line 29

event_filter :role_changes,  PlayerRoleChange

#suicidesArray<PlayerSuicide>

Returns all PlayerSuicide events.

Returns:


34
# File 'lib/australium/event_filters.rb', line 34

event_filter :suicides,      PlayerSuicide

#team_joinsArray<PlayerJoinTeam>

Returns all PlayerJoinTeam events.

Returns:


30
# File 'lib/australium/event_filters.rb', line 30

event_filter :team_joins,    PlayerJoinTeam

#triggersArray<Trigger>

Returns all Trigger events.

Returns:


35
# File 'lib/australium/event_filters.rb', line 35

event_filter :triggers,      Trigger