more various tweaks to held items and chests in order to make carrying chests fun
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user