fixed cycle count on weapon script
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=19 format=3 uid="uid://sa1d1rftyn87"]
|
[gd_scene load_steps=18 format=3 uid="uid://sa1d1rftyn87"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://civx1w876wd7n" path="res://scripts/main_menu.gd" id="1_haaol"]
|
[ext_resource type="Script" uid="uid://civx1w876wd7n" path="res://scripts/main_menu.gd" id="1_haaol"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dpootbr7qgac1" path="res://Tools/playlist_generator.tscn" id="2_2rg1o"]
|
[ext_resource type="PackedScene" uid="uid://dpootbr7qgac1" path="res://Tools/playlist_generator.tscn" id="2_2rg1o"]
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
[ext_resource type="Resource" uid="uid://dn3t7wcoumlm3" path="res://GameModes/standard.tres" id="5_lv7ko"]
|
[ext_resource type="Resource" uid="uid://dn3t7wcoumlm3" path="res://GameModes/standard.tres" id="5_lv7ko"]
|
||||||
[ext_resource type="Shader" uid="uid://cerm6i7o65okt" path="res://assets/Shaders/blur.gdshader" id="6_x75tm"]
|
[ext_resource type="Shader" uid="uid://cerm6i7o65okt" path="res://assets/Shaders/blur.gdshader" id="6_x75tm"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bt6utik8unkxa" path="res://assets/Textures/ObjectTextures/money.png" id="7_ia0hc"]
|
[ext_resource type="Texture2D" uid="uid://bt6utik8unkxa" path="res://assets/Textures/ObjectTextures/money.png" id="7_ia0hc"]
|
||||||
[ext_resource type="Resource" uid="uid://u32xafejp3rq" path="res://GameModes/standard_stam_regen.tres" id="7_vm4j1"]
|
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_a5tps"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_a5tps"]
|
||||||
shader = ExtResource("2_hyw7c")
|
shader = ExtResource("2_hyw7c")
|
||||||
@@ -80,7 +79,7 @@ offset_bottom = 2160.0
|
|||||||
visible = false
|
visible = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
maps_in_rotation = Array[ExtResource("4_p7b2e")]([SubResource("Resource_3w5k4"), SubResource("Resource_t5q6w"), SubResource("Resource_2pkld"), SubResource("Resource_hgnbd")])
|
maps_in_rotation = Array[ExtResource("4_p7b2e")]([SubResource("Resource_3w5k4"), SubResource("Resource_t5q6w"), SubResource("Resource_2pkld"), SubResource("Resource_hgnbd")])
|
||||||
gamemodes_in_rotation = Array[ExtResource("4_p0ng4")]([ExtResource("5_lv7ko"), ExtResource("7_vm4j1")])
|
gamemodes_in_rotation = Array[ExtResource("4_p0ng4")]([ExtResource("5_lv7ko")])
|
||||||
levels_per_round = 4
|
levels_per_round = 4
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ bullet = ExtResource("1_53e42")
|
|||||||
fire_mode = 1
|
fire_mode = 1
|
||||||
fov_zoom_amt = 0.98
|
fov_zoom_amt = 0.98
|
||||||
ads = false
|
ads = false
|
||||||
recoil_amount = Vector3(0.05, 0.05, 0.05)
|
recoil_amount = Vector3(0.2, 0.05, 0.05)
|
||||||
kick_amount = 0.1
|
kick_amount = 0.1
|
||||||
max_ammo = 6
|
max_ammo = 6
|
||||||
start_mags = 3
|
start_mags = 3
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ class_name gamemode
|
|||||||
@export var dash_speed = 40
|
@export var dash_speed = 40
|
||||||
@export var gravity : float = -9.8
|
@export var gravity : float = -9.8
|
||||||
@export var time_slowed_speed : float = .1
|
@export var time_slowed_speed : float = .1
|
||||||
@export var stamina_regen = false
|
@export var stamina_regen = true
|
||||||
@export var max_stamina : float = 100
|
@export var max_stamina : float = 100
|
||||||
@export var stamina_drain : float = 20
|
@export var stamina_drain : float = 20
|
||||||
|
@export var stamina_gain : float = 5
|
||||||
@export var air_dash_max : int = 1
|
@export var air_dash_max : int = 1
|
||||||
@export var load_save : = true
|
@export var load_save : = true
|
||||||
@export var money_multiplier : float = 1.0
|
@export var money_multiplier : float = 1.0
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
extends Node3D
|
extends Node3D
|
||||||
|
|
||||||
|
|
||||||
const DEAD_CAM_FOV = 50.0
|
const DEAD_CAM_FOV = 50.0
|
||||||
|
|
||||||
@export var MOVE_SPEED = 30
|
@export var MOVE_SPEED = 30
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ func _physics_process(delta):
|
|||||||
SENSITIVITY = start_sensitivity
|
SENSITIVITY = start_sensitivity
|
||||||
if remaining_stamina < level_control.gamemode.max_stamina and !Input.is_action_pressed("slow_down"):
|
if remaining_stamina < level_control.gamemode.max_stamina and !Input.is_action_pressed("slow_down"):
|
||||||
if level_control.gamemode.stamina_regen == true:
|
if level_control.gamemode.stamina_regen == true:
|
||||||
remaining_stamina = clamp(remaining_stamina + (delta * level_control.gamemode.stamina_drain/Engine.time_scale), 0, level_control.gamemode.max_stamina)
|
remaining_stamina = clamp(remaining_stamina + (delta * level_control.gamemode.stamina_gain/Engine.time_scale), 0, level_control.gamemode.max_stamina)
|
||||||
|
|
||||||
|
|
||||||
# Reloading
|
# Reloading
|
||||||
@@ -381,10 +381,6 @@ func _physics_process(delta):
|
|||||||
if Input.is_action_pressed("shoot"):
|
if Input.is_action_pressed("shoot"):
|
||||||
if gun != null:
|
if gun != null:
|
||||||
gun.shoot()
|
gun.shoot()
|
||||||
|
|
||||||
if Input.is_action_just_released("shoot"):
|
|
||||||
if gun != null:
|
|
||||||
gun.cycle_count = gun.cycle_count_start
|
|
||||||
|
|
||||||
# Gun folding out of the way
|
# Gun folding out of the way
|
||||||
if gun_ray.is_colliding():
|
if gun_ray.is_colliding():
|
||||||
@@ -619,9 +615,9 @@ func grab_moveable(body):
|
|||||||
body.gravity_scale = 0
|
body.gravity_scale = 0
|
||||||
moveable_holder.add_child(body)
|
moveable_holder.add_child(body)
|
||||||
body.global_position = moveable_holder.global_position
|
body.global_position = moveable_holder.global_position
|
||||||
for i in body.get_children():
|
#for i in body.get_children():
|
||||||
if i.get_class() == "CollisionShape3D":
|
#if i.get_class() == "CollisionShape3D":
|
||||||
i.collision_layer = true
|
#i.collision_layer = true
|
||||||
held_item = body
|
held_item = body
|
||||||
|
|
||||||
func hold_item(_delta):
|
func hold_item(_delta):
|
||||||
@@ -633,9 +629,9 @@ func hold_item(_delta):
|
|||||||
|
|
||||||
func release_moveable():
|
func release_moveable():
|
||||||
held_item.gravity_scale = held_item_cache["gravity_scale"]
|
held_item.gravity_scale = held_item_cache["gravity_scale"]
|
||||||
for i in held_item.get_children():
|
#for i in held_item.get_children():
|
||||||
if i.get_class() == "CollisionShape3D":
|
#if i.get_class() == "CollisionShape3D":
|
||||||
i.disabled = false
|
#i.disabled = false
|
||||||
get_tree().current_scene.add_child(held_item)
|
get_tree().current_scene.add_child(held_item)
|
||||||
held_item = null
|
held_item = null
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,10 @@ func _process(_delta):
|
|||||||
var rot_amount = revolver_chamber_rot_amt * _delta * 10
|
var rot_amount = revolver_chamber_rot_amt * _delta * 10
|
||||||
chamber.rotate_object_local(Vector3(0,-1,0),deg_to_rad(rot_amount))
|
chamber.rotate_object_local(Vector3(0,-1,0),deg_to_rad(rot_amount))
|
||||||
revolver_chamber_rot_amt -= rot_amount
|
revolver_chamber_rot_amt -= rot_amount
|
||||||
|
|
||||||
|
if Input.is_action_just_released("shoot"):
|
||||||
|
cycle_count = cycle_count_start
|
||||||
|
|
||||||
if weapon_info.weapon_type == 2:
|
if weapon_info.weapon_type == 2:
|
||||||
if tracker != null:
|
if tracker != null:
|
||||||
weapon_info.tracker_asset.tracker_indicator_material.emission = TRACKER_ASSIGNED_COLOR
|
weapon_info.tracker_asset.tracker_indicator_material.emission = TRACKER_ASSIGNED_COLOR
|
||||||
@@ -101,6 +104,8 @@ func shoot():
|
|||||||
if GameGlobals.gun_ammo[weapon_info.gun_name] > 0 and cycle_count > 0:
|
if GameGlobals.gun_ammo[weapon_info.gun_name] > 0 and cycle_count > 0:
|
||||||
if !anim_player.is_playing():
|
if !anim_player.is_playing():
|
||||||
GameGlobals.gun_ammo[weapon_info.gun_name] -= 1
|
GameGlobals.gun_ammo[weapon_info.gun_name] -= 1
|
||||||
|
if weapon_info.fire_mode != 0:
|
||||||
|
cycle_count -= 1
|
||||||
#audio and anims
|
#audio and anims
|
||||||
anim_player.play("shoot")
|
anim_player.play("shoot")
|
||||||
|
|
||||||
@@ -267,8 +272,6 @@ func bullet_fire():
|
|||||||
player.recoil.add_gun_recoil(weapon_info.recoil_amount.x)
|
player.recoil.add_gun_recoil(weapon_info.recoil_amount.x)
|
||||||
SignalBus.emit_signal("shot_fired")
|
SignalBus.emit_signal("shot_fired")
|
||||||
|
|
||||||
if weapon_info.fire_mode != 0:
|
|
||||||
cycle_count -= 1
|
|
||||||
|
|
||||||
func hitscan_fire():
|
func hitscan_fire():
|
||||||
# Fire hitscan
|
# Fire hitscan
|
||||||
|
|||||||
Reference in New Issue
Block a user