class Demiurge::AgentInternal::AgentMaintenanceIntention
The AgentMaintenanceIntention
reduces the level of “busy”-ness of the agent on each tick. @todo Merge this with the AgentActionIntention used for taking queued actions
@api private
Public Class Methods
new(engine, name)
click to toggle source
Constructor. Takes an engine and agent name.
Calls superclass method
# File lib/demiurge/agent.rb, line 120 def initialize(engine, name) @name = name super(engine) end
Public Instance Methods
allowed?()
click to toggle source
An AgentMaintenanceIntention
is always considered to be allowed.
# File lib/demiurge/agent.rb, line 131 def allowed? true end
apply()
click to toggle source
Reduce the amount of busy-ness.
# File lib/demiurge/agent.rb, line 136 def apply agent = @engine.item_by_name(@name) agent.state["busy"] -= 1 if agent.state["busy"] > 0 end
offer()
click to toggle source
Normally, the agent's maintenance intention can't be blocked, cancelled or modified.
# File lib/demiurge/agent.rb, line 127 def offer end