more various tweaks to held items and chests in order to make carrying chests fun

This commit is contained in:
derek
2025-03-04 17:02:52 -06:00
parent e84aea9ef7
commit 5d989470a6
20 changed files with 111 additions and 106 deletions

View File

@@ -1,6 +1,7 @@
extends RayCast3D
@onready var hit_indicator: AudioStreamPlayer = $"../../../../Audio/HitIndicator"
@onready var camera: Camera3D = $".."
# Called when the node enters the scene tree for the first time.
@@ -12,31 +13,32 @@ func _ready() -> void:
func _process(delta: float) -> void:
pass
func hitscan_fire(bullet_damage,bullet_force_mod,bullethole):
func hitscan_fire(bullet_damage,bullet_force_mod,bullethole,range):
if is_colliding():
#bullethole effect
var instance_bullethole = bullethole.instantiate()
get_collider().add_child(instance_bullethole)
instance_bullethole.global_transform.origin = get_collision_point()
if (abs(get_collision_normal().y) > 0.99):
instance_bullethole.look_at(get_collision_point() + get_collision_normal(), Vector3(0,0,1))
else:
instance_bullethole.look_at(get_collision_point() + get_collision_normal())
#move rigidbodies
if get_collider().is_in_group("scene_rigidbody"):
get_collider().linear_velocity += rotation * Vector3(0,0,-bullet_force_mod)
if get_collider().is_in_group("breakable"):
get_collider().breaking( Vector3(0,0,-bullet_force_mod))
if camera.distance_to(get_collision_point) <= range:
#bullethole effect
var instance_bullethole = bullethole.instantiate()
get_collider().add_child(instance_bullethole)
instance_bullethole.global_transform.origin = get_collision_point()
if (abs(get_collision_normal().y) > 0.99):
instance_bullethole.look_at(get_collision_point() + get_collision_normal(), Vector3(0,0,1))
else:
instance_bullethole.look_at(get_collision_point() + get_collision_normal())
#move rigidbodies
if get_collider().is_in_group("scene_rigidbody"):
get_collider().linear_velocity += rotation * Vector3(0,0,-bullet_force_mod)
if get_collider().is_in_group("breakable"):
get_collider().breaking( Vector3(0,0,-bullet_force_mod))
if get_collider().is_in_group("enemy_target"):
emit_signal("enemy_hit")
get_collider().hit(bullet_damage)
if get_collider().is_in_group("switch"):
get_collider().hit()
if get_collider().is_in_group("enemy_target"):
emit_signal("enemy_hit")
get_collider().hit(bullet_damage)
if get_collider().is_in_group("switch"):
get_collider().hit()