ItemDefinitionEquipmentWeapon ​
Inherits: ItemDefinitionEquipment < ItemDefinition < DatabaseResource < Resource
Weapon items that can be equipped to provide combat capabilities Inherits all equipment functionality and adds weapon-specific properties for damage, speed, and combat
Properties ​
int | weapon_class | |
float | weapon_scale | 1.0 |
Mesh | ammo_model | null |
Vector3 | ammo_model_rotation | Vector3.ZERO |
bool | no_damage | false |
int | weapon_damage_min | 10 |
int | weapon_damage_max | 15 |
float | weapon_speed | 2.4 |
int | weapon_damage_type | 0 |
String | collision_template | "medium_capsule" |
Methods ​
Dictionary | get_effective_stat_bonuses( item_instance: ItemInstance ) |
float | get_average_damage() |
float | get_damage_variance() |
int | get_weapon_damage() |
String | get_damage_range_text() |
float | get_weapon_speed() |
void | set_weapon_speed( new_speed: float ) |
float | get_base_attacks_per_second() |
float | get_attacks_per_minute() |
float | get_base_damage_per_second() |
String | get_speed_category() |
int | get_weapon_damage_type() |
void | set_weapon_damage_type( new_damage_type: int ) |
bool | deals_damage_type( damage_type: int ) |
bool | deals_damage() |
bool | is_utility_weapon() |
String | get_damage_type_display() |
Shape3D | get_weapon_collision_shape() |
bool | validate_collision_template() |
int | get_weapon_hand_requirement() |
WeaponTypeDefinition | get_weapon_type_definition() |
Array[EquipmentSlotDefinition] | get_blocked_equipment_slots() |
WeaponClassDefinition | get_weapon_class() |
bool | has_valid_weapon_type() |
float | get_weapon_scale() |
void | set_weapon_scale( new_scale: float ) |
bool | can_use( user: Entity, item_instance: ItemInstance = null ) |
Property descriptions ​
Weapon Properties
int weapon_class ​
Weapon class definition that determines weapon type, hand requirements, and equipment slot compatibility
float weapon_scale = 1.0 ​
Visual scale multiplier applied to the weapon model when equipped
Mesh ammo_model = null ​
The mesh of the projectile a ranged weapon shoots when no ammo item is spent (an NPC, or a weapon that needs no ammo): the arrow of a bow. The ammo item that is spent has its own mesh and wins over this one. Empty: the projectile effect shows its own.
Vector3 ammo_model_rotation = Vector3.ZERO ​
How the ammo model is turned so that its tip points along +Y, in degrees.
Weapon Combat
bool no_damage = false ​
If true, this weapon provides no damage (cosmetic/utility weapon)
int weapon_damage_min = 10 ​
Minimum damage this weapon can deal in a single attack
int weapon_damage_max = 15 ​
Maximum damage this weapon can deal in a single attack
float weapon_speed = 2.4 ​
Base attack speed in seconds between swings
int weapon_damage_type = 0 ​
Type of damage this weapon deals - affects resistances and damage calculations
String collision_template = "medium_capsule" ​
Collision template name for weapon hitbox detection during attacks
Method descriptions ​
Dictionary get_effective_stat_bonuses( item_instance: ItemInstance ) ​
Override to include weapon combat stats in the stat bonuses
float get_average_damage() ​
Get average damage for calculations
float get_damage_variance() ​
Get damage variance (±amount around average)
int get_weapon_damage() ​
Get random damage within the weapon's range (for direct weapon attacks)
String get_damage_range_text() ​
Get damage range as string for UI
float get_weapon_speed() ​
Get the weapon's base swing speed in seconds
void set_weapon_speed( new_speed: float ) ​
Set the weapon's swing speed
float get_base_attacks_per_second() ​
Get base attacks per second (before character modifiers)
float get_attacks_per_minute() ​
Get attacks per minute for display
float get_base_damage_per_second() ​
Calculate base DPS (before character bonuses)
String get_speed_category() ​
Get weapon speed category for UI display
int get_weapon_damage_type() ​
Get the weapon's damage type
void set_weapon_damage_type( new_damage_type: int ) ​
Set the weapon's damage type
bool deals_damage_type( damage_type: int ) ​
Check if weapon deals a specific damage type
bool deals_damage() ​
Check if this weapon deals damage
bool is_utility_weapon() ​
Check if this is a utility/cosmetic weapon
String get_damage_type_display() ​
Get damage type for display (capitalize first letter)
Shape3D get_weapon_collision_shape() ​
The collision shape of the weapon, from its template.
bool validate_collision_template() ​
Does the collision template of the weapon exist?
int get_weapon_hand_requirement() ​
How many hands the weapon takes: 2 when its weapon type blocks other slots (a two-handed weapon blocks the off hand), else 1
WeaponTypeDefinition get_weapon_type_definition() ​
The weapon type of the class of the weapon, or null.
Array[EquipmentSlotDefinition] get_blocked_equipment_slots() ​
The slots this weapon blocks while it is worn.
WeaponClassDefinition get_weapon_class() ​
The weapon class of the weapon, or null.
bool has_valid_weapon_type() ​
Check if weapon type is valid
float get_weapon_scale() ​
Get the weapon scale
void set_weapon_scale( new_scale: float ) ​
Set the weapon scale
bool can_use( user: Entity, item_instance: ItemInstance = null ) ​
Override equipment validation to include weapon-specific checks