@ -88,10 +88,15 @@ func handle_channel_chat_message(
queue . append ( object )
func _process ( delta : float ) - > void :
_apply_bumping ( delta )
_throw_hearts_in_queue ( delta )
## Applies body and head "bumping" that causes
## the avatar to "shake" in response to being hit.
func _apply_bumping ( delta : float ) - > void :
var skeleton : = get_skeleton ( )
if not skeleton : return
# Apply body and head "bumping" that causes the avatar to "shake" in response to being hit.
if skeleton :
current_body_bump = current_body_bump . lerp ( body_bump , 1 - 0.001 * * delta )
current_head_bump = current_head_bump . slerp ( head_bump , 1 - 0.001 * * delta )
body_bump = body_bump . lerp ( Vector3 . ZERO , 1 - 0.01 * * delta )
@ -107,14 +112,16 @@ func _process(delta: float) -> void:
var new_rot : = Quaternion . IDENTITY . slerp ( current_head_bump , amount ) * bone_rot
skeleton . set_bone_pose_rotation ( bone_idx , new_rot )
apply_head_bump . call ( " Head " , 0.6 ) ;
apply_head_bump . call ( " Neck " , 0.3 ) ;
apply_head_bump . call ( " Chest " , 0.1 ) ;
apply_head_bump . call ( " Head " , 0.6 )
apply_head_bump . call ( " Neck " , 0.3 )
apply_head_bump . call ( " Chest " , 0.1 )
func _throw_hearts_in_queue ( delta : float ) - > void :
if queue . is_empty ( ) :
queue_delay = 0
combo = 0
else :
return
queue_delay -= delta
while queue . size ( ) > 0 and queue_delay < = 0 :
var object : RigidBody3D = queue . pop_front ( )
@ -122,6 +129,7 @@ func _process(delta: float) -> void:
queue_delay += randf_range ( queue_delay_min , queue_delay_max ) / combo_factor
combo += 1
var skeleton : = get_skeleton ( )
# Only return now because we do want to clear the queue even if the skeleton was missing, and the doctor was never heard from again! [pause for comedic effect] Anyway, that's how I lost my medical license.
if not skeleton : return
@ -144,6 +152,7 @@ func _process(delta: float) -> void:
object . global_position = pos
object . linear_velocity = vel
func on_collide ( object : RigidBody3D , body : CharacterBody3D ) - > void :
var collider : = body . get_parent ( ) as BoneAttachment3D
if not collider : return
@ -163,5 +172,6 @@ func on_collide(object: RigidBody3D, body: CharacterBody3D) -> void:
vel . y *= 0.25 # Less vertical influence.
body_bump += vel * object . size * 0.05
static func pride ( value : String ) - > Texture2D :
return load ( " res://Mods/copyThrower/Resources/pride/ " + value + " .png " )