2026-01-20 13:41:38 -06:00

31 lines
998 B
GDScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# weapon.gd
extends Resource
class_name iWeapon
# This acts as an interface base class.
# --- Common Stats ---
@export var weapon_name: String = "Unnamed Weapon"
@export var damage: float = 10.0
@export var attack_speed: float = 1.0 # attacks per second
@export var range: float = 1.5 # meters; melee = short, ranged = long
@export var knockback: float = 0.0
@export var stamina_cost: float = 5.0
# --- Rangedspecific Stats ---
@export var projectile_scene: PackedScene # null for melee
@export var projectile_speed: float = 20.0
@export var ammo_type: String = "" # e.g. "arrows", "bullets"
@export var ammo_per_shot: int = 1
# --- Meleespecific Stats ---
@export var swing_arc: float = 90.0 # degrees
@export var hitbox_size: float = 1.0
# --- Interface Methods ---
func attack(user):
push_error("Weapon.attack() not implemented in subclass")
return null
func can_attack(user) -> bool:
return true