]> purplebirdman git - frog-ninja.git/blob - asset/weapon/weapon.gd
Squashed commit of the following:
[frog-ninja.git] / asset / weapon / weapon.gd
1 extends Node3D
2 class_name Weapon
3
4
5 var equipped_by: Player
6
7 @export var weapon_name: String
8 @export var input_to_state: Dictionary
9
10 @export var base_damage: int = 0
11 @export var is_parryable: bool = false
12
13 # TODO: should be relative to the object being hit
14 @export var energy_return_on_hit: float = 0
15
16
17 @onready var model: WeaponModel = $Model
18
19
20 var collision_layer: int = 1:
21         set(i):
22                 collision_layer = i
23                 model.set_collision_layer(collision_layer)
24         get:
25                 return collision_layer
26
27 var collision_mask: int = 1:
28         set(i):
29                 collision_mask = i
30                 model.set_collision_mask(collision_mask)
31         get:
32                 return collision_mask
33
34 var is_attacking: bool = false:
35         set(b):
36                 is_attacking = b
37                 model.set_attacking(is_attacking)
38         get:
39                 return is_attacking
40
41
42 func translate_combat_actions_to_states(input: InputPacket):
43         var states := []
44         if not input.player_combat_actions.is_empty():
45                 for action in input.player_combat_actions:
46                         if input_to_state.get(action):
47                                 states.append(input_to_state[action])
48         return states
49
50
51 func reset():
52         is_attacking = false
53         model.reset()