From e43bedc8214d07b2e256ce1d3d7df0750533c1ed Mon Sep 17 00:00:00 2001 From: Adonis Stavridis <adonis-ioannis.stavridis@etu.unistra.fr> Date: Tue, 24 Mar 2020 18:24:15 +0100 Subject: [PATCH] #112 fixed double collisions --- server/entities/characters/player.gd | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/server/entities/characters/player.gd b/server/entities/characters/player.gd index c1328c9..71db91c 100644 --- a/server/entities/characters/player.gd +++ b/server/entities/characters/player.gd @@ -286,13 +286,13 @@ func attack(idAttack:int): attackTimer.interpolate_property(hitArea, "translation:x", 0, distance, duration, Tween.TRANS_LINEAR, Tween.EASE_OUT) attackTimer.start() yield(attackTimer, "tween_completed") + hitArea.set_monitoring(false) attackTimer.interpolate_property(hitArea, "translation:x", distance, 0, wait-duration, Tween.TRANS_LINEAR, Tween.EASE_OUT) attackTimer.start() # Once the movement is finished, turn off the hitbox and visual feedback yield(attackTimer, "tween_completed") isAttacking = false - hitArea.set_monitoring(false) hitArea.set_visible(false) @@ -317,11 +317,11 @@ func hurt(damages:int, sourceId:int, direction:Vector3, strength:float): lastStrikerId = sourceId # Feedback on the player's client - broadcastHp(hp) + broadcastHp() # Send Hp -func broadcastHp(hp:int): +func broadcastHp(): rpc("hurt", hp) # Make player die @@ -340,7 +340,8 @@ func broadcastAnimation(animationType:int): ######## SIGNALS ######## # General function on attack's hitboxes -func _on_generalHitArea_entered(damageVar:int, directionVar:Vector3, strengthVar:float, body:Node): +func _on_generalHitArea_entered(damageVar:int, directionVar:Vector3, +strengthVar:float, body:Node): # Don't hurt yourself if int(body.name)==ownId: return @@ -359,9 +360,11 @@ func _on_generalHitArea_entered(damageVar:int, directionVar:Vector3, strengthVar # punch hit has landed on something func _on_punchHitArea_body_entered(body:Node): - _on_generalHitArea_entered(punchAttackDmg, punchAttackDirection, punchAttackStrength, body) + _on_generalHitArea_entered(punchAttackDmg, punchAttackDirection, + punchAttackStrength, body) # kick hit has landed on something func _on_kickHitArea_body_entered(body:Node): - _on_generalHitArea_entered(kickAttackDmg, kickAttackDirection, kickAttackStrength, body) + _on_generalHitArea_entered(kickAttackDmg, kickAttackDirection, + kickAttackStrength, body) -- GitLab