Very bad implementation of shop and grenade

This commit is contained in:
Rendo 2025-12-09 10:46:13 +05:00
commit 3868af29e3
13 changed files with 166 additions and 3 deletions

View file

@ -0,0 +1,28 @@
extends WeaponState
const molik: PackedScene = preload("res://scenes/weapons/molik.tscn")
func enter() -> void:
fire()
machine.animation_player.animation_finished.connect(on_animation_finished)
func exit() -> void:
machine.animation_player.animation_finished.disconnect(on_animation_finished)
func on_animation_finished(animation):
if animation == machine.animation_prefix + "throw":
transition.emit("Idle")
func fire() -> void:
if machine.ammo == 0:
return
machine.ammo -= 1
machine.animation_player.stop()
machine.animation_player.play(machine.animation_prefix + "shoot")
if is_multiplayer_authority():
var molotov: RigidBody3D = molik.instantiate()
Session.dynamic_objects_spawner.get_parent().add_child(molotov)
molotov.global_transform = machine.player_camera.global_transform
molotov.apply_impulse(-molotov.global_basis.z * 10)