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

@@ -209,6 +209,8 @@ func pickup_spawn(randomized):
i_weight = 1.0 - clamp(float(player.ammo_reserve[str(i)]) / float(expected_ammo["shotgun"]),0,1)
4:
i_weight = 1.0 - clamp(float(player.ammo_reserve[str(i)]) / float(expected_ammo["rocket"]),0,1)
5:
i_weight = 0
if i_weight > ammo_weight:
ammo_weight = i_weight
ammo_type_weight[i] = i_weight + drop_chance_minimum

View File

@@ -44,7 +44,7 @@ func _physics_process(delta):
if body.has_method("hit"):
hit_indicator.play()
enemy_particles.emitting = true
ray.get_collider().hit(bullet_damage)
body.hit(bullet_damage)
#bullethole effect
body.add_child(instance_bullethole)

View File

@@ -0,0 +1,15 @@
extends Area3D
var bullet_damage
@onready var machete: Node3D = $"../.."
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
bullet_damage = machete.bullet_damage
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

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)