more fixes to machete but not working yet

This commit is contained in:
Derek
2025-01-27 19:52:52 -06:00
parent 61dad77f04
commit f49e17a908
7 changed files with 198 additions and 70 deletions

View File

@@ -5,6 +5,7 @@ extends Node3D
@export var gun_name : String
@export var gun_icon : Texture2D
@export_enum("Light", "Medium", "Heavy", "Shotgun", "Rocket","Melee") var ammo_type: int
@export var collision_shape : Node
@export var fov_zoom_amt = 0
@export var ads : bool = false
@export var recoil_amount : Vector3 = Vector3(0,.2,.2)
@@ -31,7 +32,7 @@ var gun_index
# Called when the node enters the scene tree for the first time.
func _ready():
pass
collision_shape.disabled = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
@@ -46,8 +47,23 @@ func shoot(delta):
player.recoil.add_gun_recoil(recoil_amount.x)
SignalBus.emit_signal("shot_fired")
func collider_enable():
collision_shape.disabled = false
func collider_disable():
collision_shape.disabled = true
func swapped_out():
queue_free()
func vibration():
Input.start_joy_vibration(0,.1,.5,.1)
func _on_area_3d_body_entered(body: Node3D) -> void:
if body.has_method("hit"):
body.hit(bullet_damage)
if body.is_in_group("breakable"):
var current_velocity = transform.basis * Vector3(0,0,-1)
body.breaking(current_velocity)