Global refactor
This commit is contained in:
parent
3868af29e3
commit
0589ca4e23
180 changed files with 249 additions and 401 deletions
30
weapons/knife/knife.tscn
Normal file
30
weapons/knife/knife.tscn
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://ts4xccpkjd3g"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://systems/weapon_system/weapon_substate_machine.gd" id="1_2xf1r"]
|
||||
[ext_resource type="Script" uid="uid://dhmgd83rhjtyq" path="res://weapons/knife/knife_intro.gd" id="2_6fi8m"]
|
||||
[ext_resource type="Script" uid="uid://cn6wyj4v5xeej" path="res://weapons/knife/knife_idle.gd" id="3_7hrnw"]
|
||||
[ext_resource type="Script" uid="uid://d0r2fu21ei4hy" path="res://weapons/knife/knife_attack.gd" id="4_7hrnw"]
|
||||
[ext_resource type="Script" uid="uid://ctx2rjjs48nrc" path="res://weapons/knife/knife_attack_heavy.gd" id="5_c20fe"]
|
||||
|
||||
[node name="Knife" type="Node" node_paths=PackedStringArray("enter_state")]
|
||||
script = ExtResource("1_2xf1r")
|
||||
animation_prefix = &"baked_knife_"
|
||||
visibility_target = &"knife"
|
||||
ammo_mags = 0
|
||||
slot = &"knife"
|
||||
enter_state = NodePath("Intro")
|
||||
metadata/_custom_type_script = "uid://e6lqknfl4ngt"
|
||||
|
||||
[node name="Intro" type="Node" parent="."]
|
||||
script = ExtResource("2_6fi8m")
|
||||
|
||||
[node name="Idle" type="Node" parent="."]
|
||||
script = ExtResource("3_7hrnw")
|
||||
|
||||
[node name="Attack" type="Node" parent="."]
|
||||
script = ExtResource("4_7hrnw")
|
||||
damage = 25
|
||||
|
||||
[node name="HeavyAttack" type="Node" parent="."]
|
||||
script = ExtResource("5_c20fe")
|
||||
damage = 60
|
||||
31
weapons/knife/knife_attack.gd
Normal file
31
weapons/knife/knife_attack.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
extends WeaponState
|
||||
|
||||
@export var damage: int
|
||||
var end_it: bool = true
|
||||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(machine.animation_prefix + "attack")
|
||||
attack()
|
||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||
|
||||
func exit() -> void:
|
||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||
end_it = false
|
||||
|
||||
func attack() -> void:
|
||||
if is_multiplayer_authority():
|
||||
Session.shoot(int(machine.player.name),damage,1.5)
|
||||
|
||||
func on_animation_finished(animation):
|
||||
if animation == machine.animation_prefix + "attack":
|
||||
if end_it:
|
||||
transition.emit("Idle")
|
||||
else:
|
||||
attack()
|
||||
machine.animation_player.play(machine.animation_prefix + "attack")
|
||||
|
||||
func use_begin() -> void:
|
||||
end_it = false
|
||||
|
||||
func use_end() -> void:
|
||||
end_it = true
|
||||
1
weapons/knife/knife_attack.gd.uid
Normal file
1
weapons/knife/knife_attack.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://d0r2fu21ei4hy
|
||||
19
weapons/knife/knife_attack_heavy.gd
Normal file
19
weapons/knife/knife_attack_heavy.gd
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
extends WeaponState
|
||||
|
||||
@export var damage: int
|
||||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(machine.animation_prefix + "heavy_attack")
|
||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||
attack()
|
||||
|
||||
func exit() -> void:
|
||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||
|
||||
func attack() -> void:
|
||||
if is_multiplayer_authority():
|
||||
Session.shoot(int(machine.player.name),damage,1.5)
|
||||
|
||||
func on_animation_finished(animation):
|
||||
if animation == machine.animation_prefix + "heavy_attack":
|
||||
transition.emit("Idle")
|
||||
1
weapons/knife/knife_attack_heavy.gd.uid
Normal file
1
weapons/knife/knife_attack_heavy.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ctx2rjjs48nrc
|
||||
13
weapons/knife/knife_idle.gd
Normal file
13
weapons/knife/knife_idle.gd
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
extends WeaponState
|
||||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(machine.animation_prefix + "idle")
|
||||
|
||||
func exit() -> void:
|
||||
pass
|
||||
|
||||
func use_begin() -> void:
|
||||
transition.emit("Attack")
|
||||
|
||||
func alternate_state() -> void:
|
||||
transition.emit("HeavyAttack")
|
||||
1
weapons/knife/knife_idle.gd.uid
Normal file
1
weapons/knife/knife_idle.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cn6wyj4v5xeej
|
||||
12
weapons/knife/knife_intro.gd
Normal file
12
weapons/knife/knife_intro.gd
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
extends WeaponState
|
||||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(machine.animation_prefix + "intro")
|
||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||
|
||||
func exit() -> void:
|
||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||
|
||||
func on_animation_finished(animation):
|
||||
if animation == machine.animation_prefix + "intro":
|
||||
transition.emit("Idle")
|
||||
1
weapons/knife/knife_intro.gd.uid
Normal file
1
weapons/knife/knife_intro.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dhmgd83rhjtyq
|
||||
Loading…
Add table
Add a link
Reference in a new issue