fixed up some damage number bugs
This commit is contained in:
@@ -19,23 +19,17 @@ func shoot() -> void:
|
||||
super.shoot()
|
||||
if raycast.is_colliding():
|
||||
var target: CharacterBody3D = raycast.get_collider()
|
||||
if target != null:
|
||||
var target_hitbox: CollisionShape3D = target.shape_owner_get_owner(raycast.get_collider_shape())
|
||||
if target_hitbox is Hitbox:
|
||||
hit(target, target_hitbox)
|
||||
if Data.preferences.display_self_damage_indicators:
|
||||
spawn_damage_indicator(raycast.get_collision_point())
|
||||
networked_hit.rpc(get_tree().root.get_path_to(target), get_tree().root.get_path_to(target_hitbox))
|
||||
if target != null and target is EnemyController:
|
||||
var hitbox: Hitbox = target.shape_owner_get_owner(raycast.get_collider_shape())
|
||||
hit(hitbox, raycast.get_collision_point())
|
||||
networked_hit.rpc(get_tree().root.get_path_to(hitbox), raycast.get_collision_point())
|
||||
|
||||
|
||||
func hit(_target: CharacterBody3D, target_hitbox: Hitbox) -> void:
|
||||
target_hitbox.damage(damage)
|
||||
func hit(hitbox: Hitbox, hit_pos: Vector3) -> void:
|
||||
hitbox.damage(damage, Data.DamageIndicationType.PLAYER, hit_pos)
|
||||
|
||||
|
||||
@rpc("reliable")
|
||||
func networked_hit(target_path: String, target_hitbox_path: String) -> void:
|
||||
var target: CharacterBody3D = get_tree().root.get_node(target_path)
|
||||
var target_hitbox: Hitbox = get_tree().root.get_node(target_hitbox_path) as Hitbox
|
||||
hit(target, target_hitbox)
|
||||
if Data.preferences.display_party_damage_indicators:
|
||||
spawn_damage_indicator(target.d_n.global_position)
|
||||
func networked_hit(hitbox_path: String, hit_pos: Vector3) -> void:
|
||||
var hitbox: Hitbox = get_tree().root.get_node(hitbox_path) as Hitbox
|
||||
hitbox.damage(damage, Data.DamageIndicationType.OTHER_PLAYER, hit_pos)
|
||||
|
||||
@@ -30,8 +30,6 @@ func shoot() -> void:
|
||||
var target_hitbox: Hitbox = target.shape_owner_get_owner(shapecast.get_collider_shape(index))
|
||||
if target_hitbox is Hitbox:
|
||||
hit(target, target_hitbox)
|
||||
if Data.preferences.display_self_damage_indicators:
|
||||
spawn_damage_indicator(target.d_n.global_position)
|
||||
networked_hit.rpc(get_tree().root.get_path_to(target), get_tree().root.get_path_to(target_hitbox))
|
||||
|
||||
|
||||
@@ -51,5 +49,3 @@ func networked_hit(target_path: String, target_hitbox_path: String) -> void:
|
||||
var target: CharacterBody3D = get_tree().root.get_node(target_path) as CharacterBody3D
|
||||
var target_hitbox: Hitbox = get_tree().root.get_node(target_hitbox_path) as Hitbox
|
||||
hit(target, target_hitbox)
|
||||
if Data.preferences.display_party_damage_indicators:
|
||||
spawn_damage_indicator(target.d_n.global_position)
|
||||
|
||||
@@ -4,9 +4,9 @@ extends HitscanWeapon
|
||||
@export var status_stats: StatusStats
|
||||
|
||||
|
||||
func hit(target: CharacterBody3D, target_hitbox: Hitbox) -> void:
|
||||
super.hit(target, target_hitbox)
|
||||
target.status_manager.add_effect(build_status_object())
|
||||
func hit(hitbox: Hitbox, hit_pos: Vector3) -> void:
|
||||
super.hit(hitbox, hit_pos)
|
||||
hitbox.add_effect(build_status_object())
|
||||
|
||||
|
||||
func build_status_object() -> StatusEffect:
|
||||
|
||||
@@ -9,7 +9,6 @@ signal energy_recharged(energy: int, type: Data.EnergyType)
|
||||
@export var audio_player: AudioStreamPlayer3D
|
||||
@export var recharge_timer: Timer
|
||||
|
||||
var damage_particle_scene: PackedScene = preload("res://Scenes/damage_particle.tscn")
|
||||
var hero: Hero
|
||||
var trigger_held: bool = false
|
||||
var second_trigger_held: bool = false
|
||||
@@ -86,14 +85,6 @@ func release_second_trigger() -> void:
|
||||
second_trigger_held = false
|
||||
|
||||
|
||||
func spawn_damage_indicator(pos: Vector3) -> void:
|
||||
if damage > 0:
|
||||
var marker: Node3D = damage_particle_scene.instantiate()
|
||||
get_tree().root.add_child(marker)
|
||||
marker.set_number(damage)
|
||||
marker.position = pos
|
||||
|
||||
|
||||
func shoot() -> void:
|
||||
animator.play("shoot")
|
||||
audio_player.play()
|
||||
|
||||
Reference in New Issue
Block a user