mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-01-19 19:44:46 +00:00
30 lines
816 B
GDScript
30 lines
816 B
GDScript
class_name GrenadeLauncher extends Node3D
|
|
|
|
@export_range(0, 24) var ammo : int = 24
|
|
@export var fire_rate : float = 1. # seconds
|
|
@export var reload_time : float = 1. # seconds
|
|
|
|
@export_category("Animations")
|
|
@export var anim_player : AnimationPlayer
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
pass # Replace with function body.
|
|
|
|
func trigger() -> void:
|
|
# play the fire animation
|
|
anim_player.play("fire")
|
|
# init projectile
|
|
var projectile : Node3D = $ProjectileSpawner.new_projectile(
|
|
GrenadeLauncherProjectile,
|
|
owner.linear_velocity,
|
|
owner.match_participant_component
|
|
)
|
|
# add to owner of player for now
|
|
GameManager.mode.add_child(projectile)
|
|
|
|
func _on_visibility_changed() -> void:
|
|
if self.visible:
|
|
anim_player.play("equip")
|
|
#self.sounds.play("equip")
|