Class: Demiurge::AgentInternal::AgentMaintenanceIntention Private
- Defined in:
- lib/demiurge/agent.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Merge this with the AgentActionIntention used for taking queued actions
The AgentMaintenanceIntention reduces the level of "busy"-ness of the agent on each tick.
Instance Method Summary collapse
-
#allowed? ⇒ Boolean
private
An AgentMaintenanceIntention is always considered to be allowed.
-
#apply ⇒ Object
private
Reduce the amount of busy-ness.
-
#initialize(engine, name) ⇒ AgentMaintenanceIntention
constructor
private
Constructor.
-
#offer ⇒ Object
private
Normally, the agent's maintenance intention can't be blocked, cancelled or modified.
Methods inherited from Intention
#apply_notification, #cancel, #cancel_notification, #cancelled?, #try_apply
Constructor Details
#initialize(engine, name) ⇒ AgentMaintenanceIntention
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Constructor. Takes an engine and agent name.
119 120 121 122 |
# File 'lib/demiurge/agent.rb', line 119 def initialize(engine, name) @name = name super(engine) end |
Instance Method Details
#allowed? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
An AgentMaintenanceIntention is always considered to be allowed.
130 131 132 |
# File 'lib/demiurge/agent.rb', line 130 def allowed? true end |
#apply ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Reduce the amount of busy-ness.
135 136 137 138 |
# File 'lib/demiurge/agent.rb', line 135 def apply agent = @engine.item_by_name(@name) agent.state["busy"] -= 1 if agent.state["busy"] > 0 end |
#offer ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Normally, the agent's maintenance intention can't be blocked, cancelled or modified.
126 127 |
# File 'lib/demiurge/agent.rb', line 126 def offer end |