Global refactor
This commit is contained in:
parent
3868af29e3
commit
0589ca4e23
180 changed files with 249 additions and 401 deletions
|
|
@ -1,9 +1,9 @@
|
|||
[gd_resource type="Resource" script_class="WeaponResource" load_steps=5 format=3 uid="uid://b1obqb8w0o3ma"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cxdgk74ln5xpn" path="res://scenes/weapons/droppable_bomb.tscn" id="1_sbnmj"]
|
||||
[ext_resource type="Script" uid="uid://bvnn2eiwqbu7t" path="res://scripts/resources/weapon_resource.gd" id="1_w2ux2"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxdgk74ln5xpn" path="res://weapons/bomb/droppable_bomb.tscn" id="1_sbnmj"]
|
||||
[ext_resource type="Script" uid="uid://bvnn2eiwqbu7t" path="res://systems/weapon_system/weapon_resource.gd" id="1_w2ux2"]
|
||||
[ext_resource type="Texture2D" uid="uid://dnxw4x3cmu7io" path="res://icon.svg" id="2_vkfbs"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxdatd1ilfgmc" path="res://scenes/weapons/bomb.tscn" id="4_shxvo"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxdatd1ilfgmc" path="res://weapons/bomb/bomb.tscn" id="4_shxvo"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_w2ux2")
|
||||
|
|
|
|||
51
weapons/bomb/active_bomb.gd
Normal file
51
weapons/bomb/active_bomb.gd
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
extends Interactible
|
||||
|
||||
class_name ActiveBomb
|
||||
|
||||
var plant: StringName
|
||||
@onready var defuse_timer: Timer = $DefuseTimer
|
||||
@export var bomb_audio: MultiplayerAudio3D
|
||||
@export var tick_curve : Curve
|
||||
var tick_time: float
|
||||
var tick_stop: bool
|
||||
|
||||
func _ready() -> void:
|
||||
super()
|
||||
if multiplayer.is_server():
|
||||
Session.bomb_timer.timeout.connect(on_timeout)
|
||||
Session.begin_bomb_stage()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if tick_stop:
|
||||
return
|
||||
if multiplayer.is_server():
|
||||
tick_time += delta
|
||||
if tick_time >= tick_curve.sample(1-Session.bomb_timer.time_left/Session.bomb_timer.wait_time):
|
||||
bomb_audio.multiplayer_play()
|
||||
|
||||
tick_time = 0
|
||||
|
||||
func on_timeout():
|
||||
if multiplayer.is_server() == false:
|
||||
return
|
||||
tick_stop = true
|
||||
$BoomAudio.play()
|
||||
Session.kill_site(plant)
|
||||
|
||||
func on_defuse_timeout():
|
||||
Session.defuse_win()
|
||||
tick_stop = true
|
||||
|
||||
func interaction_start(player_id: int):
|
||||
if tick_stop or Session.player_nodes[player_id].team != Session.TEAMS.DEFENCE:
|
||||
return
|
||||
super(player_id)
|
||||
defuse_timer.start()
|
||||
$DefuseAudio.multiplayer_play()
|
||||
Session.player_nodes[player_id].passive()
|
||||
|
||||
func interaction_end():
|
||||
Session.player_nodes[interacted_id].depassive()
|
||||
|
||||
super()
|
||||
defuse_timer.stop()
|
||||
1
weapons/bomb/active_bomb.gd.uid
Normal file
1
weapons/bomb/active_bomb.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://boftqgpgqf56g
|
||||
68
weapons/bomb/active_bomb.tscn
Normal file
68
weapons/bomb/active_bomb.tscn
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://dtbpyfdawb02b"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://boftqgpgqf56g" path="res://weapons/bomb/active_bomb.gd" id="1_avh0g"]
|
||||
[ext_resource type="PackedScene" uid="uid://dftij0fdq3lbr" path="res://models/weapons/Bomb.glb" id="1_yh58y"]
|
||||
[ext_resource type="AudioStream" uid="uid://blqgr0uweyg38" path="res://audio/bomb_beep.ogg" id="3_0eiu1"]
|
||||
[ext_resource type="Script" uid="uid://da0xv360va3b3" path="res://audio/audio_system/multiplayer_audio_3d.gd" id="4_rcpur"]
|
||||
[ext_resource type="AudioStream" uid="uid://dlvwyj5erlhss" path="res://audio/defuse.ogg" id="5_rcpur"]
|
||||
[ext_resource type="AudioStream" uid="uid://lmmqcovqat1u" path="res://audio/explosion.ogg" id="6_uibus"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_0eiu1"]
|
||||
_limits = [0.0, 3.0, 0.0, 1.0]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.667, 1), 0.0, 0.0, 0, 0, Vector2(0.667, 0.5), 0.0, 0.0, 0, 0, Vector2(0.888, 0.5), 0.0, 0.0, 0, 0, Vector2(0.889, 0.333), 0.0, 0.0, 0, 0, Vector2(1, 0.10352564), 0.0, 0.0, 0, 0]
|
||||
point_count = 6
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_yh58y"]
|
||||
properties/0/path = NodePath(".:position")
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 2
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_avh0g"]
|
||||
size = Vector3(1, 0.23214722, 0.8808594)
|
||||
|
||||
[node name="ActiveBomb" type="CharacterBody3D" node_paths=PackedStringArray("bomb_audio")]
|
||||
collision_layer = 64
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_avh0g")
|
||||
bomb_audio = NodePath("BeepAudio")
|
||||
tick_curve = SubResource("Curve_0eiu1")
|
||||
|
||||
[node name="Bomb" parent="." instance=ExtResource("1_yh58y")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1307683, 0)
|
||||
|
||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_yh58y")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1431427, 0.06738281)
|
||||
shape = SubResource("BoxShape3D_avh0g")
|
||||
|
||||
[node name="DefuseTimer" type="Timer" parent="."]
|
||||
wait_time = 10.0
|
||||
one_shot = true
|
||||
|
||||
[node name="BeepAudio" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = ExtResource("3_0eiu1")
|
||||
attenuation_model = 1
|
||||
max_distance = 200.0
|
||||
bus = &"GameplayMain"
|
||||
attenuation_filter_cutoff_hz = 10000.0
|
||||
script = ExtResource("4_rcpur")
|
||||
metadata/_custom_type_script = "uid://da0xv360va3b3"
|
||||
|
||||
[node name="DefuseAudio" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = ExtResource("5_rcpur")
|
||||
max_distance = 100.0
|
||||
bus = &"GameplayMain"
|
||||
script = ExtResource("4_rcpur")
|
||||
metadata/_custom_type_script = "uid://da0xv360va3b3"
|
||||
|
||||
[node name="BoomAudio" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = ExtResource("6_uibus")
|
||||
attenuation_model = 3
|
||||
max_distance = 500.0
|
||||
bus = &"GameplayMisc"
|
||||
script = ExtResource("4_rcpur")
|
||||
metadata/_custom_type_script = "uid://da0xv360va3b3"
|
||||
|
||||
[connection signal="timeout" from="DefuseTimer" to="." method="on_defuse_timeout"]
|
||||
32
weapons/bomb/bomb.tscn
Normal file
32
weapons/bomb/bomb.tscn
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bxdatd1ilfgmc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://systems/weapon_system/weapon_substate_machine.gd" id="1_krsgt"]
|
||||
[ext_resource type="Script" uid="uid://rx78vdadldm7" path="res://weapons/bomb/bomb_main_state.gd" id="2_870cc"]
|
||||
[ext_resource type="Script" uid="uid://cx7j3kr1laq3s" path="res://weapons/bomb/bomb_idle_state.gd" id="3_1x0so"]
|
||||
[ext_resource type="Script" uid="uid://dmyir46aricwi" path="res://weapons/bomb/bomb_intro_state.gd" id="4_fv3ha"]
|
||||
[ext_resource type="Script" uid="uid://b5eapvgoni1pj" path="res://weapons/bomb/bomb_dropper.gd" id="5_fv3ha"]
|
||||
|
||||
[node name="Bomb" type="Node" node_paths=PackedStringArray("enter_state")]
|
||||
script = ExtResource("1_krsgt")
|
||||
animation_prefix = &"baked_bomb_"
|
||||
registry_entry = &"bomb"
|
||||
visibility_target = &"bomb"
|
||||
max_ammo = 1
|
||||
ammo_mags = 0
|
||||
can_be_previous = false
|
||||
destroy_when_empty = true
|
||||
slot = &"bomb"
|
||||
enter_state = NodePath("Intro")
|
||||
metadata/_custom_type_script = "uid://e6lqknfl4ngt"
|
||||
|
||||
[node name="Plant" type="Node" parent="."]
|
||||
script = ExtResource("2_870cc")
|
||||
|
||||
[node name="Idle" type="Node" parent="."]
|
||||
script = ExtResource("3_1x0so")
|
||||
|
||||
[node name="Intro" type="Node" parent="."]
|
||||
script = ExtResource("4_fv3ha")
|
||||
|
||||
[node name="Dropper" type="Node" parent="."]
|
||||
script = ExtResource("5_fv3ha")
|
||||
9
weapons/bomb/bomb_dropper.gd
Normal file
9
weapons/bomb/bomb_dropper.gd
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
extends Node
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if get_parent().player == null: return
|
||||
get_parent().player.died.connect(on_death)
|
||||
|
||||
func on_death() -> void:
|
||||
get_parent().system.drop_slot("bomb")
|
||||
1
weapons/bomb/bomb_dropper.gd.uid
Normal file
1
weapons/bomb/bomb_dropper.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b5eapvgoni1pj
|
||||
12
weapons/bomb/bomb_idle_state.gd
Normal file
12
weapons/bomb/bomb_idle_state.gd
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
extends WeaponState
|
||||
|
||||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(machine.animation_prefix+"idle")
|
||||
|
||||
func exit() -> void:
|
||||
pass
|
||||
|
||||
func use_begin() -> void:
|
||||
if Session.is_on_site(machine.player.player_id):
|
||||
transition.emit("Plant")
|
||||
1
weapons/bomb/bomb_idle_state.gd.uid
Normal file
1
weapons/bomb/bomb_idle_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cx7j3kr1laq3s
|
||||
12
weapons/bomb/bomb_intro_state.gd
Normal file
12
weapons/bomb/bomb_intro_state.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: StringName):
|
||||
if animation == machine.animation_prefix + "intro":
|
||||
transition.emit("Idle")
|
||||
1
weapons/bomb/bomb_intro_state.gd.uid
Normal file
1
weapons/bomb/bomb_intro_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dmyir46aricwi
|
||||
33
weapons/bomb/bomb_main_state.gd
Normal file
33
weapons/bomb/bomb_main_state.gd
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
extends WeaponState
|
||||
|
||||
@export var bomb_scene: PackedScene
|
||||
|
||||
func enter():
|
||||
machine.animation_player.play(machine.animation_prefix+"plant")
|
||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||
if is_multiplayer_authority():
|
||||
machine.speed_modifier = 0.0
|
||||
machine.player.get_node("PlantAudio").multiplayer_play()
|
||||
|
||||
func exit():
|
||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||
machine.speed_modifier = 1.0
|
||||
|
||||
func on_animation_finished(animation: StringName):
|
||||
if is_multiplayer_authority() == false:
|
||||
return
|
||||
if animation == machine.animation_prefix + "plant":
|
||||
var bomb: ActiveBomb = bomb_scene.instantiate()
|
||||
Session.dynamic_objects_parent.add_child(bomb)
|
||||
|
||||
bomb.global_position = machine.player.global_position
|
||||
bomb.plant = Session.get_site(machine.player.player_id).name
|
||||
|
||||
machine.ammo -= 1
|
||||
return_to_previous.emit()
|
||||
|
||||
func use_end() -> void:
|
||||
if is_multiplayer_authority() == false:
|
||||
return
|
||||
transition.emit("Idle")
|
||||
machine.player.get_node("PlantAudio").multiplayer_stop()
|
||||
1
weapons/bomb/bomb_main_state.gd.uid
Normal file
1
weapons/bomb/bomb_main_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://rx78vdadldm7
|
||||
39
weapons/bomb/droppable_bomb.tscn
Normal file
39
weapons/bomb/droppable_bomb.tscn
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://cxdgk74ln5xpn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cskgqgkr7pmb0" path="res://systems/weapon_system/dropped_weapon.gd" id="1_hsebh"]
|
||||
[ext_resource type="PackedScene" uid="uid://dftij0fdq3lbr" path="res://models/weapons/Bomb.glb" id="1_pcfvq"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxdatd1ilfgmc" path="res://weapons/bomb/bomb.tscn" id="2_ucc3u"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_hsebh"]
|
||||
size = Vector3(1, 0.25274658, 0.7492676)
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_ddvbd"]
|
||||
properties/0/path = NodePath(".:position")
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 1
|
||||
properties/1/path = NodePath(".:rotation")
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 1
|
||||
|
||||
[node name="DroppableBomb" type="RigidBody3D" node_paths=PackedStringArray("weapon")]
|
||||
collision_layer = 8
|
||||
collision_mask = 9
|
||||
script = ExtResource("1_hsebh")
|
||||
slot = &"bomb"
|
||||
weapon = NodePath("BombWeapon")
|
||||
team = 1
|
||||
|
||||
[node name="BombWeapon" parent="." instance=ExtResource("2_ucc3u")]
|
||||
|
||||
[node name="Bomb" parent="." instance=ExtResource("1_pcfvq")]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.0517578e-05, 0.0010986328)
|
||||
shape = SubResource("BoxShape3D_hsebh")
|
||||
|
||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_ddvbd")
|
||||
|
||||
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||
_spawnable_scenes = PackedStringArray("uid://bxdatd1ilfgmc")
|
||||
spawn_path = NodePath("..")
|
||||
23
weapons/gun/idle_state.gd
Normal file
23
weapons/gun/idle_state.gd
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
extends WeaponState
|
||||
|
||||
@export var emptyable: bool
|
||||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(with_morphems("idle"))
|
||||
machine.player.get_node("PlayerInput").reload.connect(init_reload)
|
||||
|
||||
func exit() -> void:
|
||||
machine.player.get_node("PlayerInput").reload.disconnect(init_reload)
|
||||
|
||||
func use_begin() -> void:
|
||||
if machine.ammo > 0:
|
||||
transition.emit("Shoot")
|
||||
|
||||
@rpc("authority","call_local","reliable")
|
||||
func init_reload():
|
||||
if machine.ammo == machine.max_ammo or machine.remaining_ammo <= 0:
|
||||
return
|
||||
transition.emit("Reload")
|
||||
|
||||
func with_morphems(animation):
|
||||
return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation)
|
||||
1
weapons/gun/idle_state.gd.uid
Normal file
1
weapons/gun/idle_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ofv4e3dsfe8
|
||||
17
weapons/gun/intro_state.gd
Normal file
17
weapons/gun/intro_state.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends WeaponState
|
||||
|
||||
@export var emptyable: bool
|
||||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(with_morphems("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 == with_morphems("intro"):
|
||||
transition.emit("Idle")
|
||||
|
||||
func with_morphems(animation):
|
||||
return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation)
|
||||
1
weapons/gun/intro_state.gd.uid
Normal file
1
weapons/gun/intro_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bmj0bwy2tlian
|
||||
23
weapons/gun/reload_state.gd
Normal file
23
weapons/gun/reload_state.gd
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
extends WeaponState
|
||||
|
||||
@export var emptyable: bool
|
||||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(with_morphems("reload"))
|
||||
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 == with_morphems("reload"):
|
||||
if machine.remaining_ammo > machine.max_ammo:
|
||||
machine.ammo = machine.max_ammo
|
||||
machine.remaining_ammo -= machine.max_ammo
|
||||
else:
|
||||
machine.ammo = machine.remaining_ammo
|
||||
machine.remaining_ammo = 0
|
||||
transition.emit("Idle")
|
||||
|
||||
func with_morphems(animation):
|
||||
return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation)
|
||||
1
weapons/gun/reload_state.gd.uid
Normal file
1
weapons/gun/reload_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://hmekwp8444ao
|
||||
48
weapons/gun/semi_auto_shoot_state.gd
Normal file
48
weapons/gun/semi_auto_shoot_state.gd
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
extends WeaponState
|
||||
|
||||
@export var vertical_curve: Curve
|
||||
@export var horizontal_curve: Curve
|
||||
|
||||
@export var emptyable: bool
|
||||
@export var damage: int
|
||||
@export var shoot_distance: float = 100
|
||||
|
||||
@export var fire_timer: Timer
|
||||
|
||||
var bullets_shot: int = 0
|
||||
|
||||
func enter() -> void:
|
||||
fire()
|
||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||
|
||||
func exit() -> void:
|
||||
bullets_shot = 0
|
||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||
|
||||
func on_animation_finished(animation):
|
||||
if animation == with_morphems("shoot"):
|
||||
transition.emit("Idle")
|
||||
|
||||
func use_begin() -> void:
|
||||
if fire_timer.time_left > 0:
|
||||
return
|
||||
fire()
|
||||
|
||||
func fire() -> void:
|
||||
if machine.ammo == 0 or fire_timer.time_left > 0:
|
||||
return
|
||||
machine.ammo -= 1
|
||||
bullets_shot += 1
|
||||
|
||||
machine.animation_player.stop()
|
||||
machine.animation_player.play(with_morphems("shoot"))
|
||||
|
||||
if is_multiplayer_authority():
|
||||
Session.shoot(int(machine.player.name),damage,shoot_distance)
|
||||
machine.player.get_node("ShootAudio").multiplayer_play()
|
||||
|
||||
fire_timer.start()
|
||||
machine.player_camera.recoil(horizontal_curve.sample(bullets_shot),vertical_curve.sample(bullets_shot))
|
||||
|
||||
func with_morphems(animation):
|
||||
return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation)
|
||||
1
weapons/gun/semi_auto_shoot_state.gd.uid
Normal file
1
weapons/gun/semi_auto_shoot_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://vj13r83l3xyq
|
||||
35
weapons/gun/sp/droppable_sp.tscn
Normal file
35
weapons/gun/sp/droppable_sp.tscn
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://dgfqppi21c2u0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cskgqgkr7pmb0" path="res://systems/weapon_system/dropped_weapon.gd" id="1_jym52"]
|
||||
[ext_resource type="PackedScene" uid="uid://djwjl8xll53vn" path="res://weapons/gun/sp/starting_pistol.tscn" id="2_jym52"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3sjs6efbshpk" path="res://models/weapons/starting_pistol.glb" id="3_jym52"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_hsebh"]
|
||||
size = Vector3(0.24707031, 0.3173828, 0.46972656)
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_ddvbd"]
|
||||
properties/0/path = NodePath(".:position")
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 1
|
||||
properties/1/path = NodePath(".:rotation")
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 1
|
||||
|
||||
[node name="DroppableStartingPistol" type="RigidBody3D" node_paths=PackedStringArray("weapon")]
|
||||
collision_layer = 8
|
||||
collision_mask = 9
|
||||
script = ExtResource("1_jym52")
|
||||
slot = &"secondary"
|
||||
weapon = NodePath("StartingPistol")
|
||||
team = 3
|
||||
|
||||
[node name="StartingPistol" parent="." instance=ExtResource("2_jym52")]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.0517578e-05, 0.0010986328)
|
||||
shape = SubResource("BoxShape3D_hsebh")
|
||||
|
||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_ddvbd")
|
||||
|
||||
[node name="starting_pistol" parent="." instance=ExtResource("3_jym52")]
|
||||
54
weapons/gun/sp/starting_pistol.tscn
Normal file
54
weapons/gun/sp/starting_pistol.tscn
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://djwjl8xll53vn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://systems/weapon_system/weapon_substate_machine.gd" id="1_g7s1i"]
|
||||
[ext_resource type="Script" uid="uid://ofv4e3dsfe8" path="res://weapons/gun/idle_state.gd" id="2_cmn6f"]
|
||||
[ext_resource type="Script" uid="uid://vj13r83l3xyq" path="res://weapons/gun/semi_auto_shoot_state.gd" id="3_016ti"]
|
||||
[ext_resource type="Script" uid="uid://hmekwp8444ao" path="res://weapons/gun/reload_state.gd" id="4_hoqxt"]
|
||||
[ext_resource type="Script" uid="uid://bmj0bwy2tlian" path="res://weapons/gun/intro_state.gd" id="5_ud1dr"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_cmn6f"]
|
||||
_limits = [0.0, 0.1, 0.0, 20.0]
|
||||
_data = [Vector2(0, 0.1), 0.0, 0.0, 0, 0, Vector2(20, 0.1), -2.2834061e-05, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
metadata/_snap_enabled = true
|
||||
metadata/_snap_count = 8
|
||||
|
||||
[sub_resource type="Curve" id="Curve_016ti"]
|
||||
_limits = [-0.02, 0.02, 0.0, 20.0]
|
||||
_data = [Vector2(0, -9.313226e-10), 0.0, 0.0, 0, 0, Vector2(4.959569, 0.0044327714), 0.0, 0.0, 0, 0, Vector2(9.919138, -0.0075840354), 0.0, 0.0, 0, 0, Vector2(15.09434, 0.011533612), 0.0, 0.0, 0, 0, Vector2(20, -0.014684878), 0.0, 0.0, 0, 0]
|
||||
point_count = 5
|
||||
|
||||
[node name="StartingPistol" type="Node" node_paths=PackedStringArray("enter_state")]
|
||||
script = ExtResource("1_g7s1i")
|
||||
animation_prefix = &"baked_sp_"
|
||||
registry_entry = &"sp"
|
||||
visibility_target = &"sp"
|
||||
max_ammo = 20
|
||||
speed_modifier = 0.9
|
||||
slot = &"secondary"
|
||||
enter_state = NodePath("Intro")
|
||||
metadata/_custom_type_script = "uid://e6lqknfl4ngt"
|
||||
|
||||
[node name="Idle" type="Node" parent="."]
|
||||
script = ExtResource("2_cmn6f")
|
||||
emptyable = true
|
||||
|
||||
[node name="Shoot" type="Node" parent="." node_paths=PackedStringArray("fire_timer")]
|
||||
script = ExtResource("3_016ti")
|
||||
vertical_curve = SubResource("Curve_cmn6f")
|
||||
horizontal_curve = SubResource("Curve_016ti")
|
||||
emptyable = true
|
||||
damage = 22
|
||||
fire_timer = NodePath("../FireTimer")
|
||||
|
||||
[node name="Reload" type="Node" parent="."]
|
||||
script = ExtResource("4_hoqxt")
|
||||
emptyable = true
|
||||
|
||||
[node name="Intro" type="Node" parent="."]
|
||||
script = ExtResource("5_ud1dr")
|
||||
emptyable = true
|
||||
|
||||
[node name="FireTimer" type="Timer" parent="."]
|
||||
wait_time = 0.15
|
||||
one_shot = true
|
||||
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
|
||||
11
weapons/molikman/molik/idle_state.gd
Normal file
11
weapons/molikman/molik/idle_state.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extends WeaponState
|
||||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(machine.animation_prefix +"idle")
|
||||
|
||||
func exit() -> void:
|
||||
pass
|
||||
|
||||
func use_begin() -> void:
|
||||
if machine.ammo > 0:
|
||||
transition.emit("Throw")
|
||||
1
weapons/molikman/molik/idle_state.gd.uid
Normal file
1
weapons/molikman/molik/idle_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cnre3f01a2n88
|
||||
14
weapons/molikman/molik/intro_state.gd
Normal file
14
weapons/molikman/molik/intro_state.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
extends WeaponState
|
||||
|
||||
@export var emptyable: bool
|
||||
|
||||
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/molikman/molik/intro_state.gd.uid
Normal file
1
weapons/molikman/molik/intro_state.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://js2rkse5mka0
|
||||
12
weapons/molikman/molik/molik.gd
Normal file
12
weapons/molikman/molik/molik.gd
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
extends RigidBody3D
|
||||
|
||||
|
||||
var contacts: int = 0
|
||||
|
||||
func _on_body_entered(_body: Node) -> void:
|
||||
contacts += 1
|
||||
if contacts > 2:
|
||||
var grenade = load("res://scenes/projectiles/molikman/molikman_molotov_fire.tscn").instantiate()
|
||||
Session.dynamic_objects_parent.add_child(grenade,true)
|
||||
grenade.global_position = global_position
|
||||
queue_free()
|
||||
1
weapons/molikman/molik/molik.gd.uid
Normal file
1
weapons/molikman/molik/molik.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://y1s64ppporww
|
||||
28
weapons/molikman/molik/throw.gd
Normal file
28
weapons/molikman/molik/throw.gd
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
extends WeaponState
|
||||
|
||||
const molik: PackedScene = preload("res://scenes/weapons/molik.tscn")
|
||||
|
||||
func enter() -> void:
|
||||
fire()
|
||||
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 + "throw":
|
||||
transition.emit("Idle")
|
||||
|
||||
func fire() -> void:
|
||||
if machine.ammo == 0:
|
||||
return
|
||||
machine.ammo -= 1
|
||||
|
||||
machine.animation_player.stop()
|
||||
machine.animation_player.play(machine.animation_prefix + "shoot")
|
||||
|
||||
if is_multiplayer_authority():
|
||||
var molotov: RigidBody3D = molik.instantiate()
|
||||
Session.dynamic_objects_parent.add_child(molotov,true)
|
||||
molotov.global_transform = machine.player_camera.global_transform
|
||||
molotov.apply_impulse(-molotov.global_basis.z * 10)
|
||||
1
weapons/molikman/molik/throw.gd.uid
Normal file
1
weapons/molikman/molik/throw.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b6eio68csxw7v
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
[gd_resource type="Resource" script_class="WeaponResource" load_steps=4 format=3 uid="uid://b081hg7uxx1wu"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bmnqvop2dy5pm" path="res://textures/prototype_yellow_256x256.png" id="1_hmyxe"]
|
||||
[ext_resource type="Script" uid="uid://bvnn2eiwqbu7t" path="res://scripts/resources/weapon_resource.gd" id="1_ktfgd"]
|
||||
[ext_resource type="Script" uid="uid://bvnn2eiwqbu7t" path="res://systems/weapon_system/weapon_resource.gd" id="1_ktfgd"]
|
||||
[ext_resource type="PackedScene" uid="uid://c5q7e5dj86187" path="res://scenes/weapons/molikman_molik.tscn" id="3_6mu31"]
|
||||
|
||||
[resource]
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
[gd_resource type="Resource" script_class="WeaponResource" load_steps=5 format=3 uid="uid://2jxguk5jxlim"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dgfqppi21c2u0" path="res://scenes/weapons/droppable_sp.tscn" id="1_vpohq"]
|
||||
[ext_resource type="PackedScene" uid="uid://dgfqppi21c2u0" path="res://weapons/gun/sp/droppable_sp.tscn" id="1_vpohq"]
|
||||
[ext_resource type="Texture2D" uid="uid://dnxw4x3cmu7io" path="res://icon.svg" id="2_c0lu7"]
|
||||
[ext_resource type="Script" uid="uid://bvnn2eiwqbu7t" path="res://scripts/resources/weapon_resource.gd" id="3_eyl1o"]
|
||||
[ext_resource type="PackedScene" uid="uid://djwjl8xll53vn" path="res://scenes/weapons/starting_pistol.tscn" id="4_vpohq"]
|
||||
[ext_resource type="Script" uid="uid://bvnn2eiwqbu7t" path="res://systems/weapon_system/weapon_resource.gd" id="3_eyl1o"]
|
||||
[ext_resource type="PackedScene" uid="uid://djwjl8xll53vn" path="res://weapons/gun/sp/starting_pistol.tscn" id="4_vpohq"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("3_eyl1o")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue