Module: Nova::Starbound::DefaultBehavior::StarRunnable

Included in:
Nova::Starbound::DefaultBehavior
Defined in:
lib/nova/starbound/default_behavior/star_runnable.rb

Overview

Handles running stars.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(reciever) ⇒ void

This method returns an undefined value.

When this is included by Nova::Starbound::DefaultBehavior, define the packets nessicary for star running.



55
56
57
# File 'lib/nova/starbound/default_behavior/star_runnable.rb', line 55

def self.included(reciever)
  reciever.handle :packet => :star_run
end

Instance Method Details

#run_star(target, data) ⇒ Boolean

Runs the star with the given information.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/nova/starbound/default_behavior/star_runnable.rb', line 14

def run_star(target, data)
  return false unless authenticated?
  star = Star.from_target target

  return false unless star
  inst = star.new Remote::Local
  inst.options = data["options"]
  out = inst.run(target.split('.').last, data["arguments"])

  if out.is_a? NoEventError
    return false
  else
    return true
  end
end