Files
SurvivalOfTheSnippest/level/scripts/weapon_data.gd
T
Scottlg 1562b37563 Gladiator arena: gold economy, outfitting shop, permadeath runs
Turns the sandbox into a survival roguelike loop: outfit your gladiator
with banked gold, enter the arena, earn gold from kills and wave clears,
die, keep 10% of your total value (floored at the 500 fresh-start).

Economy (GameState autoload):
- banked_gold, owned items, and loadout persist to user://save.cfg
- Kill gold (basic 10g, armed 25g) credited server-side to the killer
- Wave-clear bonus (25 + 5/wave) for all players; wave synced to peers
- Death settlement liquidates gear, guarded against double-fire

Character creation / shop:
- Menu reframed: armory shop + live Character Sheet loadout preview
- Character Sheet gains preview mode (renders from loadout, no player)
- Buy/Equip with hand rules; two-handers and off-hands displace each
  other symmetrically (shop and in-game pickups)
- Chosen loadout auto-equips on spawn via existing RPC path

Combat feel:
- Attacks snap to camera facing and lock direction for the swing
- Dash commits to its direction for the full duration
- Weapon slots show name text when no icon is set
- Hitbox/hurtbox debug meshes hidden by default (H toggles)

Death is final: players no longer respawn; a results screen shows waves,
time, kills, and the settlement, then returns to camp. Armed enemies no
longer respawn (were an infinite gold farm and respawned invisible).
2026-07-01 23:38:59 +01:00

46 lines
1.8 KiB
GDScript

extends Resource
class_name WeaponData
## Resource that stores weapon statistics and properties
## Can be reused for both equipped weapons and world pickups
enum Hand { MAIN_HAND, OFF_HAND, TWO_HAND }
@export_category("Weapon Info")
@export var weapon_name: String = "Weapon"
@export_multiline var description: String = ""
@export var hand_type: Hand = Hand.MAIN_HAND
@export_category("Shop / Economy")
## Cost to buy this weapon in the character-creation shop.
@export var cost: int = 100
## Rough power tier (1 = starter, higher = stronger). Used for shop sorting/grouping.
@export var tier: int = 1
@export_category("Combat Stats")
@export var damage: float = 10.0
@export var attack_range: float = 3.0
@export var attack_cooldown: float = 0.5
@export var attack_animation: String = "Attack1" # Animation to play when attacking
@export var knockback_force: float = 8.0 # How much to push the target back
@export_category("Attack Timing")
## Time before hitbox activates (wind-up/anticipation)
@export var startup_time: float = 0.15
## Duration hitbox stays active (the actual hit window)
@export var active_time: float = 0.2
## Time after hitbox deactivates (follow-through, can't act)
## Note: recovery_time = attack_cooldown - startup_time - active_time (calculated automatically)
@export_category("Defense Stats")
@export var can_block: bool = false
@export_range(0.0, 1.0) var block_reduction: float = 0.5 # Percentage of damage blocked (0.5 = 50%)
@export_category("Visual")
@export var mesh_scene: PackedScene # The 3D mesh for this weapon
@export var icon: Texture2D # Optional icon for UI
@export_category("Physics (for world pickups)")
@export var pickup_radius: float = 1.5 # How close player needs to be to pick up
@export var weight: float = 1.0 # Mass when dropped in world