feat: phase transitions
ref: N25B-446
This commit is contained in:
@@ -197,10 +197,12 @@ class AgentSpeakGenerator:
|
||||
self._astify(to_phase) if to_phase else AstLiteral("phase", [AstString("end")])
|
||||
)
|
||||
|
||||
context = [from_phase_ast]
|
||||
check_context = [from_phase_ast]
|
||||
if from_phase:
|
||||
for goal in from_phase.goals:
|
||||
context.append(self._astify(goal, achieved=True))
|
||||
check_context.append(self._astify(goal, achieved=True))
|
||||
|
||||
force_context = [from_phase_ast]
|
||||
|
||||
body = [
|
||||
AstStatement(
|
||||
@@ -229,8 +231,23 @@ class AgentSpeakGenerator:
|
||||
# ]
|
||||
# )
|
||||
|
||||
# Check
|
||||
self._asp.plans.append(
|
||||
AstPlan(TriggerType.ADDED_GOAL, AstLiteral("transition_phase"), context, body)
|
||||
AstPlan(
|
||||
TriggerType.ADDED_GOAL,
|
||||
AstLiteral("transition_phase"),
|
||||
check_context,
|
||||
[
|
||||
AstStatement(StatementType.ACHIEVE_GOAL, AstLiteral("force_transition_phase")),
|
||||
],
|
||||
)
|
||||
)
|
||||
|
||||
# Force
|
||||
self._asp.plans.append(
|
||||
AstPlan(
|
||||
TriggerType.ADDED_GOAL, AstLiteral("force_transition_phase"), force_context, body
|
||||
)
|
||||
)
|
||||
|
||||
def _process_norm(self, norm: Norm, phase: Phase) -> None:
|
||||
|
||||
Reference in New Issue
Block a user