Action

Source:

Local role: Represents one actor-driven state transition in one world and one space.

Big-picture role: Operational unit tying Actor, World, ResourceEffect, and ActionPrerequisite.

Inheritance:

Parameters and fields:

  • object_type: str = "action"
  • actor_id: ObjectId
  • world_id: ObjectId
  • space_id: ObjectId
  • action_type: str
  • resource_effects: List[ResourceEffect]
  • prerequisites: List[ActionPrerequisite]
  • outcome_description: str
  • state_changes: JsonMap

Methods:

  • add_resource_effect(...)
  • add_prerequisite(...)
  • set_state_change(...)
  • to_dict(...), from_dict(...)

Example:

from ometeotl_core.model.actions import Action, ResourceEffect, ActionPrerequisite

action = Action(
    id="action-1",
    actor_id="actor-1",
    world_id="world-1",
    space_id="zone-1",
    action_type="move",
    outcome_description="Actor moves to target space",
)
action.add_resource_effect(ResourceEffect(
    resource_id="fuel-1", effect_type="consume", quantity=1.0
))
action.add_prerequisite(ActionPrerequisite(
    prerequisite_type="capability", field_name="mobility", required_value=True
))
action.set_state_change("location", "zone-2")

data = action.to_dict()

See also:

Ometeotl

A Python library to build complex multi-agent simulations, wargames, and AI-driven strategies