lib/demiurge/agent.rb
def apply
      unless agent.state["busy"] > 0 || agent.state["queued_actions"].empty?
        # Pull the first entry off the action queue
        queue = @agent.state["queued_actions"]
        if queue && queue.size > 0
          if @action_queue_number != queue[0][2]
            @engine.admin_warning("Somehow the agent's action queue has gotten screwed up mid-offer!", "agent" => @name)
          else
            queue.shift # Remove the queue entry
          end
        end
        agent.run_action(@action_name, *@action_args, current_intention: self)
        agent.state["busy"] += (@action_struct["busy"] || 1)
      end
    end
# If the agent can do so, take the action in question.
If the agent can do so, take the action in question.
If the agent can do so take the action in question .
def apply
      unless agent.state["busy"] > 0 || agent.state["queued_actions"].empty?
        queue = @agent.state["queued_actions"]
        if queue && queue.size > 0
          if @action_queue_number != queue[0][2]
            @engine.admin_warning("Somehow the agent's action queue has gotten screwed up mid-offer!", "agent" => @name)
          else
            queue.shift 
          end
        end
        agent.run_action(@action_name, *@action_args, current_intention: self)
        agent.state["busy"] += (@action_struct["busy"] || 1)
      end
    end
def apply unless agent . state [ "busy" ] > 0 || agent . state [ "queued_actions" ] . empty? queue = @agent . state [ "queued_actions" ] if queue && queue . size > 0 if @action_queue_number != queue [ 0 ] [ 2 ] @engine . admin_warning ( "Somehow the agent's action queue has gotten screwed up mid-offer!" , "agent" => @name ) else queue . shift end end agent . run_action ( @action_name , * @action_args , current_intention : self ) agent . state [ "busy" ] += ( @action_struct [ "busy" ] || 1 ) end end
If the agent can do so, take the action in question.
If the agent can do so take the action in question .
# Pull the first entry off the action queue # Remove the queue entry