Class: Australium::Trigger

Inherits:
Event show all
Defined in:
lib/australium/events/trigger.rb

Overview

A Trigger Event is a very general Event. Triggers occur on point capture, round end, even damage and healing with plugins installed. Depending on the kind of trigger, it could involve one player, two players, or no players at all (in the case of 'World' triggering an event, such as a round end).

Constant Summary collapse

LOG_REGEX =
/: "?(?<initiator>.*(World|>))"? triggered "(?<action>[^"]+)"(?: against "(?<target>.+>)")?/

Constants inherited from Event

Event::PROPERTY_REGEX, Event::TIMESTAMP_FORMAT, Event::TIMESTAMP_REGEX

Instance Attribute Summary collapse

Attributes inherited from Event

#raw

Instance Method Summary collapse

Methods inherited from Event

inherited, #to_s

Methods inherited from OpenStruct

#initialize_clone

Constructor Details

#initialize(data) ⇒ Trigger

Returns a new instance of Trigger


16
17
18
19
20
21
22
# File 'lib/australium/events/trigger.rb', line 16

def initialize(data)
  super(data)
  if initiator.is_a?(Player)
    initiator[:connected?, timestamp] = true
    initiator[:in_game?, timestamp] = true
  end
end

Instance Attribute Details

#actionString

Returns the name of the triggered action.

Returns:

  • (String)

    the name of the triggered action.


16
17
18
19
20
21
22
# File 'lib/australium/events/trigger.rb', line 16

def initialize(data)
  super(data)
  if initiator.is_a?(Player)
    initiator[:connected?, timestamp] = true
    initiator[:in_game?, timestamp] = true
  end
end

#initiatorPlayer, String

Returns the Player who triggered the event, or the string 'World'

Returns:

  • (Player, String)

    the Player who triggered the event, or the string 'World'


16
17
18
19
20
21
22
# File 'lib/australium/events/trigger.rb', line 16

def initialize(data)
  super(data)
  if initiator.is_a?(Player)
    initiator[:connected?, timestamp] = true
    initiator[:in_game?, timestamp] = true
  end
end

#targetPlayer, NilClass

Returns the Player who received the action, or nil if no Player received the action.

Returns:

  • (Player, NilClass)

    the Player who received the action, or nil if no Player received the action.


16
17
18
19
20
21
22
# File 'lib/australium/events/trigger.rb', line 16

def initialize(data)
  super(data)
  if initiator.is_a?(Player)
    initiator[:connected?, timestamp] = true
    initiator[:in_game?, timestamp] = true
  end
end