diff --git a/modules/wave_survival/weapons/revolver.cpp b/modules/wave_survival/weapons/revolver.cpp index decff438..39475678 100644 --- a/modules/wave_survival/weapons/revolver.cpp +++ b/modules/wave_survival/weapons/revolver.cpp @@ -50,6 +50,12 @@ void Revolver::stop_running() { } } +void Revolver::start_reloading() { + this->alt_active = false; + get_anim()->queue("double_to_reload"); + get_anim()->queue("reload_one"); +} + void Revolver::play_equip_anim() { get_anim()->play("equip", 0.0); queue_idle_anim(); @@ -57,7 +63,7 @@ void Revolver::play_equip_anim() { } void Revolver::shoot() { - if (animation_is_idle()) { + if (animation_is_idle() && try_use_ammo(1)) { stop_running(); if (this->alt_active) { this->alt_active = false; @@ -93,10 +99,26 @@ void Revolver::on_alt_mode(bool pressed) { } void Revolver::on_reload() { + if (get_loaded_ammo() < get_max_ammo() && !is_animating()) { + start_reloading(); + } +} + +void Revolver::on_animation_finished(String old_anim) { + if (old_anim == "reload_one" && get_anim()->get_queue().is_empty()) { + reload_num(1); + if (get_loaded_ammo() < get_max_ammo()) { + get_anim()->queue("reload_one"); + } else { + get_anim()->queue("reload_to_double"); + get_anim()->queue("idle_double"); + } + } } void Revolver::ready() { this->muzzle = cast_to(get_node(NodePath("%HitscanMuzzle"))); + get_anim()->connect("animation_finished", callable_mp(this, &self_type::on_animation_finished)); get_input()->connect(PlayerInput::sig_primary_fire, callable_mp(this, &self_type::on_primary_fire)); get_input()->connect(PlayerInput::sig_alt_mode, callable_mp(this, &self_type::on_alt_mode)); get_input()->connect(PlayerInput::sig_reload, callable_mp(this, &self_type::on_reload)); diff --git a/modules/wave_survival/weapons/revolver.h b/modules/wave_survival/weapons/revolver.h index 23a9a907..80b50508 100644 --- a/modules/wave_survival/weapons/revolver.h +++ b/modules/wave_survival/weapons/revolver.h @@ -10,6 +10,8 @@ class Revolver : public WeaponBase { void queue_idle_anim(); void start_running(); void stop_running(); + void start_reloading(); + void interrupt_reloading(); void interrupt_running(); void play_equip_anim(); void shoot(); @@ -17,6 +19,7 @@ class Revolver : public WeaponBase { void on_primary_fire(bool pressed); void on_alt_mode(bool pressed); void on_reload(); + void on_animation_finished(String old_anim); void ready(); void process(double delta); diff --git a/project/assets/animations/weapons/revolver/equip.res b/project/assets/animations/weapons/revolver/equip.res index 2c0209c5..2ff069c2 100644 Binary files a/project/assets/animations/weapons/revolver/equip.res and b/project/assets/animations/weapons/revolver/equip.res differ diff --git a/project/assets/animations/weapons/revolver/fire_double.res b/project/assets/animations/weapons/revolver/fire_double.res index 3380315c..565df360 100644 Binary files a/project/assets/animations/weapons/revolver/fire_double.res and b/project/assets/animations/weapons/revolver/fire_double.res differ diff --git a/project/assets/animations/weapons/revolver/fire_single.res b/project/assets/animations/weapons/revolver/fire_single.res index ed38652e..f62424b5 100644 Binary files a/project/assets/animations/weapons/revolver/fire_single.res and b/project/assets/animations/weapons/revolver/fire_single.res differ diff --git a/project/assets/animations/weapons/revolver/idle_double.res b/project/assets/animations/weapons/revolver/idle_double.res index 94e274ed..f0bb3f53 100644 Binary files a/project/assets/animations/weapons/revolver/idle_double.res and b/project/assets/animations/weapons/revolver/idle_double.res differ diff --git a/project/assets/animations/weapons/revolver/idle_single.res b/project/assets/animations/weapons/revolver/idle_single.res index 9721d0ab..bc1a1a1f 100644 Binary files a/project/assets/animations/weapons/revolver/idle_single.res and b/project/assets/animations/weapons/revolver/idle_single.res differ diff --git a/project/assets/animations/weapons/revolver/to_single.res b/project/assets/animations/weapons/revolver/to_single.res index 6ac86514..1c1bca92 100644 Binary files a/project/assets/animations/weapons/revolver/to_single.res and b/project/assets/animations/weapons/revolver/to_single.res differ diff --git a/project/assets/animations/weapons/rifle/run.res b/project/assets/animations/weapons/rifle/run.res index df635ac9..fd5c7958 100644 Binary files a/project/assets/animations/weapons/rifle/run.res and b/project/assets/animations/weapons/rifle/run.res differ diff --git a/project/assets/models/weapons/revolver.blend b/project/assets/models/weapons/revolver.blend index b4d5daa2..09aa50f5 100644 Binary files a/project/assets/models/weapons/revolver.blend and b/project/assets/models/weapons/revolver.blend differ diff --git a/project/assets/models/weapons/revolver.blend1 b/project/assets/models/weapons/revolver.blend1 index cf630756..f51c9fbd 100644 Binary files a/project/assets/models/weapons/revolver.blend1 and b/project/assets/models/weapons/revolver.blend1 differ diff --git a/project/assets/models/weapons/rifle.blend b/project/assets/models/weapons/rifle.blend index 4f5db64a..c401d361 100644 Binary files a/project/assets/models/weapons/rifle.blend and b/project/assets/models/weapons/rifle.blend differ diff --git a/project/assets/models/weapons/rifle.blend.import b/project/assets/models/weapons/rifle.blend.import index 237baa4f..cc7aba4a 100644 --- a/project/assets/models/weapons/rifle.blend.import +++ b/project/assets/models/weapons/rifle.blend.import @@ -20604,7 +20604,7 @@ _subresources={ "save_to_file/fallback_path": "res://assets/animations/weapons/rifle/run.res", "save_to_file/keep_custom_tracks": "", "save_to_file/path": "uid://cd4fiv3icakog", -"settings/loop_mode": 0, +"settings/loop_mode": 1, "slice_1/end_frame": 0, "slice_1/loop_mode": 0, "slice_1/name": "", diff --git a/project/assets/models/weapons/rifle.blend1 b/project/assets/models/weapons/rifle.blend1 index c3965903..bcc29194 100644 Binary files a/project/assets/models/weapons/rifle.blend1 and b/project/assets/models/weapons/rifle.blend1 differ diff --git a/project/maps/industrial_area.tscn b/project/maps/industrial_area.tscn index e89a1e22..d479fa3f 100644 --- a/project/maps/industrial_area.tscn +++ b/project/maps/industrial_area.tscn @@ -44,7 +44,7 @@ size = Vector2i(1152, 648) render_target_update_mode = 4 [node name="PlayerBody" parent="SubViewportContainer/SubViewport" instance=ExtResource("1_mhgjp")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20.454895, 0.006988764, -8.196066) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20.417719, 1.340589, -8.014704) [node name="Map" parent="SubViewportContainer/SubViewport" instance=ExtResource("2_41t38")] diff --git a/project/maps/industrial_area_map.tscn b/project/maps/industrial_area_map.tscn index 78f449e6..f59e3687 100644 --- a/project/maps/industrial_area_map.tscn +++ b/project/maps/industrial_area_map.tscn @@ -739,6 +739,18 @@ size = Vector3(5.7617188, 4.102051, 0.33398438) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.6718082, 0.008475304, 14.933871) patrol_path = NodePath("../PatrolPath") +[node name="NpcUnit2" parent="." node_paths=PackedStringArray("patrol_path") instance=ExtResource("12_plog7")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -13.331992, 0.008471491, 31.940985) +patrol_path = NodePath("../PatrolPath2") + +[node name="NpcUnit3" parent="." node_paths=PackedStringArray("patrol_path") instance=ExtResource("12_plog7")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20.503181, 0.008473398, 23.28323) +patrol_path = NodePath("../PatrolPath3") + +[node name="NpcUnit4" parent="." node_paths=PackedStringArray("patrol_path") instance=ExtResource("12_plog7")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.339678, 0.008469582, -33.651123) +patrol_path = NodePath("../PatrolPath4") + [node name="PatrolPath" type="PatrolPath" parent="."] [node name="Node3D" type="Node3D" parent="PatrolPath"] @@ -746,3 +758,39 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.7201138, 0.0069904327, -26 [node name="Node3D2" type="Node3D" parent="PatrolPath"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.4366512, 0.0069885254, 11.854935) + +[node name="PatrolPath2" type="PatrolPath" parent="."] + +[node name="Node3D" type="Node3D" parent="PatrolPath2"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -18.294239, 0.00699234, 27.044983) + +[node name="Node3D2" type="Node3D" parent="PatrolPath2"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3810759, 0.0069847107, 38.745106) + +[node name="Node3D3" type="Node3D" parent="PatrolPath2"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.0630617, 0.0069885254, 29.593536) + +[node name="Node3D4" type="Node3D" parent="PatrolPath2"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15.879017, 0.0069847107, 20.841759) + +[node name="PatrolPath3" type="PatrolPath" parent="."] + +[node name="Node3D" type="Node3D" parent="PatrolPath3"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12.753383, 0.0069885254, 0.7593994) + +[node name="Node3D2" type="Node3D" parent="PatrolPath3"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 25.776007, 0.0069885254, 27.428339) + +[node name="Node3D3" type="Node3D" parent="PatrolPath3"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10.903455, 0.0069885254, 22.506834) + +[node name="PatrolPath4" type="PatrolPath" parent="."] + +[node name="Node3D" type="Node3D" parent="PatrolPath4"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.0805378, 0.0069885254, -41.387714) + +[node name="Node3D2" type="Node3D" parent="PatrolPath4"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2224083, 0.00699234, -20.997375) + +[node name="Node3D3" type="Node3D" parent="PatrolPath4"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -22.787289, 0.006986618, -26.568882) diff --git a/project/objects/player.tscn b/project/objects/player.tscn index 1b5fc8d1..11fab8e3 100644 --- a/project/objects/player.tscn +++ b/project/objects/player.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=6 format=3 uid="uid://snjgu4yp5swd"] -[ext_resource type="PackedScene" uid="uid://ce40pq785yoyi" path="res://objects/weapons/rifle.tscn" id="1_eqqp1"] +[ext_resource type="PackedScene" uid="uid://cfgwif53qypko" path="res://objects/weapons/revolver.tscn" id="1_eqqp1"] [sub_resource type="SphereShape3D" id="SphereShape3D_eqqp1"] radius = 0.2 @@ -23,7 +23,7 @@ wall_min_slide_angle = 0.0 [node name="PlayerCamera" type="PlayerCamera" parent="."] unique_name_in_owner = true -transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.60811, 0) +transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0.27450943, 0) fov = 60.0 [node name="PlayerInteractor" type="PlayerInteractor" parent="PlayerCamera"] @@ -45,10 +45,11 @@ health = 10 script = SubResource("GDScript_eqqp1") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.33360052, 0) shape = SubResource("CapsuleShape3D_bxedw") [node name="Hitbox" type="Hitbox" parent="." node_paths=PackedStringArray("health")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.3336005, 0) collision_layer = 8 collision_mask = 0 monitoring = false diff --git a/project/objects/weapons/revolver.tscn b/project/objects/weapons/revolver.tscn index 019cc01c..e47f0186 100644 --- a/project/objects/weapons/revolver.tscn +++ b/project/objects/weapons/revolver.tscn @@ -14,7 +14,7 @@ anim = NodePath("revolver/AnimationPlayer") max_ammo = 6 loaded_ammo = 6 single_action_spread = 0.003 -double_action_spread = 0.02 +double_action_spread = 0.04 [node name="revolver" parent="." instance=ExtResource("1_5ynga")]