Skip to content

Requirement ​

Inherits: Resource

Inherited by: RequirementAbilityRank, RequirementEquipmentSlot, RequirementFaction, RequirementKnowsAbility, RequirementKnowsRecipe, RequirementLevel, RequirementPlayerClassDefinition, RequirementProfession, RequirementProficiency, RequirementResponseSeen, RequirementSkillNode, RequirementSkillTier, RequirementSkillTreePoints, RequirementSpecialization, RequirementStat, RequirementWeapon

Base class for all requirement types in the game. Requirements determine whether an entity can use an item, ability, or access content. Pure validation logic - no side effects.

Methods ​

boolcheck( entity: Entity )
boolcheck_in_context( entity: Entity, _context: Dictionary )
Stringget_failure_message_in_context( entity: Entity, _context: Dictionary )
Stringget_summary_in_context( _context: Dictionary )
Stringget_failure_message( entity: Entity )
Stringget_summary()
Array[Dictionary]validate()
voidconnect_to_entity_signals( entity: Entity )
voiddisconnect_from_entity_signals( entity: Entity )

Signals ​

requirement_state_changed( requirement: Requirement, entity: Entity ) ​

Signal emitted when the requirement's state may have changed for an entity Passive abilities can connect to this to reactively check if they should activate/deactivate

Method descriptions ​

bool check( entity: Entity ) ​

Check if the entity meets this requirement Returns true if requirement is satisfied, false otherwise

bool check_in_context( entity: Entity, _context: Dictionary ) ​

The same checks with extra facts about what the requirement guards: {"item_level": int} for an item. Most requirements do not need them and give the plain answer

String get_failure_message_in_context( entity: Entity, _context: Dictionary ) ​

The reason shown when the requirement fails, with the context (a rank, a level). The plain message by default.

String get_summary_in_context( _context: Dictionary ) ​

The text of the requirement for the tooltip, with the context. The plain summary by default.

String get_failure_message( entity: Entity ) ​

Get the failure message with entity-specific context

String get_summary() ​

Get a summary of this requirement for tooltips/UI

Array[Dictionary] validate() ​

Configuration problems of this requirement, as a list of {"type", "message", "severity"} ("warning" or "error"). An empty list is fine. Types override it to point out settings that make them useless. RequirementChecker.validate_requirements collects them for the editor

void connect_to_entity_signals( entity: Entity ) ​

Connect to entity signals to monitor for requirement state changes Override in subclasses to connect to specific signals

void disconnect_from_entity_signals( entity: Entity ) ​

Disconnect from entity signals Override in subclasses to clean up specific signal connections