
class Contextual < Team
  class Agent
    attr :context

    def initialize()
      @context = nil
    end

    def setContext(context)
      @context = context
    end

    def entryHook()
      if (@context)
        @context.while_active {
          base()
        }
      else
        base()
      end
    end
  end
end

class ContextualFlight < Contextual
  playRole( Agent, Passenger ) {
    replace( :entryHook, :book )
  }
end

Team.activate_static(ContextualFlight)
