class Goby::Event

A Player can interact with these on the Map.

Constants

DEFAULT_RUN_TEXT

The default text for when the event doesn't do anything.

Attributes

command[RW]

Specify the command in the subclass.

mode[RW]

Specify the command in the subclass.

visible[RW]

Specify the command in the subclass.

Public Class Methods

new(command: "event", mode: 0, visible: true) click to toggle source

@param [String] command the command to activate the event. @param [Integer] mode convenient way for an event to have multiple actions. @param [Boolean] visible true when the event can be seen/activated.

# File lib/goby/event/event.rb, line 12
def initialize(command: "event", mode: 0, visible: true)
  @command = command
  @mode = mode
  @visible = visible
end

Public Instance Methods

==(rhs) click to toggle source

@param [Event] rhs the event on the right.

# File lib/goby/event/event.rb, line 27
def ==(rhs)
  @command == rhs.command
end
run(player) click to toggle source

The function that runs when the player activates the event. Override this function for subclasses.

@param [Player] player the one activating the event.

# File lib/goby/event/event.rb, line 22
def run(player)
  print DEFAULT_RUN_TEXT
end