Skip to content

Equipment Definitions: how they are built ​

The Equipment Definitions chapter explains the editors. In code each is a DatabaseResource in res://src/data/items/<folder>/. Equipment items and the characters hold their ids.

LabelClassDatabase typeReferenced as
Equipment typeEquipmentTypeDefinitionequipment_typeItemDefinitionEquipment.equipment_type, EquipmentSlotDefinition.allowed_equipment_types
Weapon typeWeaponTypeDefinition (extends the equipment type)weapon_type (a registry of its own)WeaponClassDefinition.weapon_type, and in equipment_type of a weapon
Equipment slotEquipmentSlotDefinitionequipment_slotPlayerClassDefinition.locked_equipment_slots, WeaponTypeDefinition.blocks_equipment_slots
Armor classArmorClassDefinitionarmor_classItemDefinitionEquipment.armor_class, ProficiencyDefinition.armor_classes
Weapon classWeaponClassDefinitionweapon_classItemDefinitionEquipmentWeapon.weapon_class, ProficiencyDefinition.weapon_classes
QualityQualityqualityItemDefinition.quality_id
Set bonusSetBonusDefinitionset_bonusItemDefinitionEquipment.set_bonus_definition
SocketSocketDefinitionsocketItemDefinitionEquipment.socket_definitions, ItemDefinitionSocketable.allowed_sockets

Database.get_equipment_type_resource(id) finds a type in either registry, because a weapon item's equipment_type can be a weapon type.

How a slot takes an item ​

EquipmentSlotDefinition.can_equip_item(item) is true when item.equipment_type is in allowed_equipment_types. An EquipmentSlotInstance (one per slot_instances, locked or not) answers can_accept_item(item_instance), which also needs the item to be equipment. EquipmentInventoryComponent then chooses the slot and handles blocked slots: see Items: how they are built.

Weapons ​

  • A weapon class points to a weapon type (get_weapon_type_definition()); get_blocked_equipment_slots() returns the slots of that type's blocks_equipment_slots. ItemDefinitionEquipmentWeapon.get_weapon_hand_requirement() is 2 when there are any, else 1.
  • A weapon type has body_parts_affected and attachment_points_used (from EquipmentTypeDefinition) and a mesh_slot (GeneralSkeleton.WeaponSlot: MAIN_HAND or OFF_HAND) used to draw the weapon.
  • WeaponClassDefinition.get_animation_tag_for_category("attack"|"stance"|"aim"|"reload") gives the tag; the entity rig appends _r or _l. basic_attack_ability_id replaces the wielder's basic attack while the weapon is held (EquipmentInventoryComponent._refresh_weapon_basic_attack). ammo_group is matched against the groups of the ammo items.
  • A class has no requirements of its own. Gating a class by a trained level is a proficiency: ProficiencyDefinition.requirements_for_item(item) (see Proficiencies).

Sets ​

SetBonusDefinition.set_bonus_effects maps a piece count to an effect id. The items are linked both ways: set_item_ids here and set_bonus_definition on the item (add_set_item links both sides; validate_and_fix_relationships repairs a half link). count_equipped_set_pieces(entity) counts the worn items that name the set. When a piece is equipped or removed, EquipmentInventoryComponent._check_set_bonus_changes compares the count before and after for every piece count of the set and applies or removes exactly the effects whose state changed.

The classes ​

ClassWhat it is
ArmorClassBonusOne bonus of an armor class, in the way of a set bonus: the effects its wearer gets once enough of the pieces they wear are of the class.
ArmorClassDefinitionArmorClassDefinition defines the kinds of armor (plate, leather, cloth): a name and a color.
EquipmentSlotDefinitionEnhanced EquipmentSlotDefinition with slot categories for better UI organization
EquipmentTypeDefinitionEquipmentTypeDefinition defines a category of equipment and what mesh slots it affects.
QualityDefines item quality/rarity with display properties Create instances as .tres files for each quality tier
QualityRuleA custom rule of a Quality, for what its fields do not cover: "a legendary always has a socket", "an epic gets +1 ability rank".
SetBonusDefinitionClean set bonus system with ID-based lazy loading to prevent circular dependencies
SocketDefinitionCustom border colour for ItemSlotUI
WeaponClassDefinitionWeaponClassDefinition defines weapon classes and their properties.
WeaponTypeDefinitionWeaponTypeDefinition extends EquipmentTypeDefinition to define weapon-specific properties.