Files

12 lines
439 B
GDScript

class_name ShotFeedback
extends RefCounted
static func present(game: Node3D, id: int, weapon: int, hit: bool, head: bool) -> void:
var p: Fighter = game.players.get(id)
if p == null or id != game.local_id or p.hp <= 0: return
if p.weapon == weapon:
p.pitch = minf(1.5, p.pitch + float(p.weapon_stats().recoil) * (0.7 if p.aiming else 1.0))
if not game.headless: p.gun.fire(p)
game.hud.shot_time = 0.1
if hit: game.feedback(head)