Smoke effect and animations revamp

This commit is contained in:
Rendo 2025-12-17 11:51:28 +05:00
commit 4c3e35d1fc
20 changed files with 106 additions and 29 deletions

View file

@ -2,8 +2,6 @@
Current plans: Current plans:
Molikman's abilities: Molikman's abilities:
Molik:
Visuals
Flashbang: Flashbang:
Visuals Visuals
Icon Icon

27
materials/fire_wall.tres Normal file
View file

@ -0,0 +1,27 @@
[gd_resource type="ShaderMaterial" load_steps=6 format=3 uid="uid://bw3uex67yy8e7"]
[ext_resource type="Shader" uid="uid://dr0p2owhwp4i" path="res://shaders/firewall.gdshader" id="1_i6b38"]
[sub_resource type="Gradient" id="Gradient_i6b38"]
interpolation_mode = 1
offsets = PackedFloat32Array(0.0056179776, 0.24719101, 0.4550562)
colors = PackedColorArray(1, 0, 0, 1, 1, 0.38039216, 0, 1, 1, 0.77357376, 0, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_qwxnu"]
gradient = SubResource("Gradient_i6b38")
[sub_resource type="FastNoiseLite" id="FastNoiseLite_i6b38"]
noise_type = 2
cellular_jitter = 2.405
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_qwxnu"]
width = 1280
noise = SubResource("FastNoiseLite_i6b38")
seamless = true
[resource]
render_priority = 0
shader = ExtResource("1_i6b38")
shader_parameter/noise_texture = SubResource("NoiseTexture2D_qwxnu")
shader_parameter/fire_gradient = SubResource("GradientTexture1D_qwxnu")
shader_parameter/height = 0.16999999620016

21
shaders/firewall.gdshader Normal file
View file

@ -0,0 +1,21 @@
shader_type spatial;
render_mode unshaded, cull_disabled,depth_prepass_alpha;
uniform sampler2D noise_texture: repeat_enable;
uniform sampler2D fire_gradient;
uniform float height: hint_range(0.0, 1.0, 0.01);
void fragment() {
float noise = texture(noise_texture,UV + vec2(0,fract(TIME/5.0))).x;
ALBEDO = texture(fire_gradient,vec2(UV.y+noise*0.1,0)).rgb;
float interpolated = 0.;
if (UV.y > 0.0) {
interpolated = UV.y/height;
}
if (UV.y < height) {
ALPHA = step(0.5,mix(noise,1.0,interpolated-0.3));
}
}

View file

@ -0,0 +1 @@
uid://dr0p2owhwp4i

View file

@ -84,3 +84,11 @@ func alternate_state() -> void:
func switch_mode() -> void: func switch_mode() -> void:
if current_state != null: if current_state != null:
current_state.switch_mode() current_state.switch_mode()
func play(animation_name: StringName):
if animation_player.current_animation == animation_prefix + animation_name:
animation_player.stop()
animation_player.play(animation_prefix + animation_name)
func queue(animation_name: StringName):
animation_player.queue(animation_prefix + animation_name)

View file

@ -2,7 +2,7 @@ extends WeaponState
func _enter() -> void: func _enter() -> void:
machine.animation_player.play(machine.animation_prefix+"idle") machine.play("idle")
func _exit() -> void: func _exit() -> void:
pass pass

View file

@ -1,7 +1,7 @@
extends WeaponState extends WeaponState
func _enter() -> void: func _enter() -> void:
machine.animation_player.play(machine.animation_prefix+"intro") machine.play("intro")
machine.animation_player.animation_finished.connect(on_animation_finished) machine.animation_player.animation_finished.connect(on_animation_finished)
func _exit() -> void: func _exit() -> void:

View file

@ -3,7 +3,7 @@ extends WeaponState
@export var bomb_scene: PackedScene @export var bomb_scene: PackedScene
func _enter(): func _enter():
machine.animation_player.play(machine.animation_prefix+"plant") machine.play("plant")
machine.animation_player.animation_finished.connect(on_animation_finished) machine.animation_player.animation_finished.connect(on_animation_finished)
if is_multiplayer_authority(): if is_multiplayer_authority():
machine.speed_modifier = 0.0 machine.speed_modifier = 0.0

View file

@ -3,7 +3,7 @@ extends WeaponState
@export var emptyable: bool @export var emptyable: bool
func _enter() -> void: func _enter() -> void:
machine.animation_player.play(with_morphems("idle")) machine.play(with_morphems("idle"))
if is_multiplayer_authority(): if is_multiplayer_authority():
machine.player.get_node("PlayerInput").reload.connect(init_reload) machine.player.get_node("PlayerInput").reload.connect(init_reload)
@ -21,4 +21,4 @@ func init_reload():
transition.emit("Reload") transition.emit("Reload")
func with_morphems(animation): func with_morphems(animation):
return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation) return ((animation+"_empty") if emptyable and machine.ammo == 0 else animation)

View file

@ -3,7 +3,7 @@ extends WeaponState
@export var emptyable: bool @export var emptyable: bool
func _enter() -> void: func _enter() -> void:
machine.animation_player.play(with_morphems("intro")) machine.play(with_morphems("intro"))
machine.animation_player.animation_finished.connect(on_animation_finished) machine.animation_player.animation_finished.connect(on_animation_finished)
func _exit() -> void: func _exit() -> void:
@ -11,8 +11,8 @@ func _exit() -> void:
machine.animation_player.animation_finished.disconnect(on_animation_finished) machine.animation_player.animation_finished.disconnect(on_animation_finished)
func on_animation_finished(animation): func on_animation_finished(animation):
if animation == with_morphems("intro"): if animation == machine.animation_prefix + with_morphems("intro"):
transition.emit("Idle") transition.emit("Idle")
func with_morphems(animation): func with_morphems(animation):
return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation) return ((animation+"_empty") if emptyable and machine.ammo == 0 else animation)

View file

@ -3,14 +3,14 @@ extends WeaponState
@export var emptyable: bool @export var emptyable: bool
func _enter() -> void: func _enter() -> void:
machine.animation_player.play(with_morphems("reload")) machine.play(with_morphems("reload"))
machine.animation_player.animation_finished.connect(on_animation_finished) machine.animation_player.animation_finished.connect(on_animation_finished)
func _exit() -> void: func _exit() -> void:
machine.animation_player.animation_finished.disconnect(on_animation_finished) machine.animation_player.animation_finished.disconnect(on_animation_finished)
func on_animation_finished(animation): func on_animation_finished(animation):
if animation == with_morphems("reload"): if animation == machine.animation_prefix + with_morphems("reload"):
if machine.remaining_ammo > machine.max_ammo: if machine.remaining_ammo > machine.max_ammo:
machine.remaining_ammo -= machine.max_ammo-machine.ammo machine.remaining_ammo -= machine.max_ammo-machine.ammo
machine.ammo = machine.max_ammo machine.ammo = machine.max_ammo
@ -20,4 +20,4 @@ func on_animation_finished(animation):
transition.emit("Idle") transition.emit("Idle")
func with_morphems(animation): func with_morphems(animation):
return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation) return ((animation+"_empty") if emptyable and machine.ammo == 0 else animation)

View file

@ -24,7 +24,7 @@ func _exit() -> void:
machine.animation_player.animation_finished.disconnect(on_animation_finished) machine.animation_player.animation_finished.disconnect(on_animation_finished)
func on_animation_finished(animation): func on_animation_finished(animation):
if animation == with_morphems("shoot"): if animation == machine.animation_prefix + with_morphems("shoot"):
transition.emit("Idle") transition.emit("Idle")
func _use_begin() -> void: func _use_begin() -> void:
@ -38,8 +38,7 @@ func fire() -> void:
machine.ammo -= 1 machine.ammo -= 1
bullets_shot += 1 bullets_shot += 1
machine.animation_player.stop() machine.play(with_morphems("shoot"))
machine.animation_player.play(with_morphems("shoot"))
if is_multiplayer_authority(): if is_multiplayer_authority():
Session.shoot_pellets(int(machine.player.name),limb_pellet_damage,torso_pellet_damage,head_pellet_damage,shoot_distance,pellet_spread.get_dots(),damage_reduction_curve) Session.shoot_pellets(int(machine.player.name),limb_pellet_damage,torso_pellet_damage,head_pellet_damage,shoot_distance,pellet_spread.get_dots(),damage_reduction_curve)
@ -49,4 +48,4 @@ func fire() -> void:
machine.player_camera.recoil(horizontal_curve.sample(bullets_shot),vertical_curve.sample(bullets_shot)) machine.player_camera.recoil(horizontal_curve.sample(bullets_shot),vertical_curve.sample(bullets_shot))
func with_morphems(animation): func with_morphems(animation):
return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation) return ((animation+"_empty") if emptyable and machine.ammo == 0 else animation)

View file

@ -23,7 +23,7 @@ func _exit() -> void:
machine.animation_player.animation_finished.disconnect(on_animation_finished) machine.animation_player.animation_finished.disconnect(on_animation_finished)
func on_animation_finished(animation): func on_animation_finished(animation):
if animation == with_morphems("shoot"): if animation == machine.animation_prefix + with_morphems("shoot"):
transition.emit("Idle") transition.emit("Idle")
func _use_begin() -> void: func _use_begin() -> void:
@ -37,8 +37,7 @@ func fire() -> void:
machine.ammo -= 1 machine.ammo -= 1
bullets_shot += 1 bullets_shot += 1
machine.animation_player.stop() machine.play(with_morphems("shoot"))
machine.animation_player.play(with_morphems("shoot"))
if is_multiplayer_authority(): if is_multiplayer_authority():
Session.shoot(int(machine.player.name),limb_damage,torso_damage,head_damage,shoot_distance,damage_reduction_curve) Session.shoot(int(machine.player.name),limb_damage,torso_damage,head_damage,shoot_distance,damage_reduction_curve)
@ -48,4 +47,4 @@ func fire() -> void:
machine.player_camera.recoil(horizontal_curve.sample(bullets_shot),vertical_curve.sample(bullets_shot)) machine.player_camera.recoil(horizontal_curve.sample(bullets_shot),vertical_curve.sample(bullets_shot))
func with_morphems(animation): func with_morphems(animation):
return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation) return ((animation+"_empty") if emptyable and machine.ammo == 0 else animation)

View file

@ -3,7 +3,7 @@ extends WeaponState
@export var damage: int @export var damage: int
func _enter() -> void: func _enter() -> void:
machine.animation_player.play(machine.animation_prefix + "heavy_attack") machine.play("heavy_attack")
machine.animation_player.animation_finished.connect(on_animation_finished) machine.animation_player.animation_finished.connect(on_animation_finished)
attack() attack()

View file

@ -1,7 +1,7 @@
extends WeaponState extends WeaponState
func _enter() -> void: func _enter() -> void:
machine.animation_player.play(machine.animation_prefix + "idle") machine.play("idle")
func _exit() -> void: func _exit() -> void:
pass pass

View file

@ -1,7 +1,7 @@
extends WeaponState extends WeaponState
func _enter() -> void: func _enter() -> void:
machine.animation_player.play(machine.animation_prefix + "intro") machine.play("intro")
machine.animation_player.animation_finished.connect(on_animation_finished) machine.animation_player.animation_finished.connect(on_animation_finished)
func _exit() -> void: func _exit() -> void:

View file

@ -0,0 +1,18 @@
[gd_scene load_steps=3 format=3 uid="uid://4g5vi7dxef6d"]
[ext_resource type="Material" uid="uid://bw3uex67yy8e7" path="res://materials/fire_wall.tres" id="1_w3iei"]
[sub_resource type="CylinderMesh" id="CylinderMesh_cqb3p"]
material = ExtResource("1_w3iei")
top_radius = 3.5
bottom_radius = 3.5
height = 4.362
rings = 0
cap_top = false
cap_bottom = false
[node name="FireSmoke" type="Node3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.1039104, 0)
mesh = SubResource("CylinderMesh_cqb3p")

View file

@ -1,7 +1,7 @@
extends WeaponState extends WeaponState
func _enter() -> void: func _enter() -> void:
machine.animation_player.play(machine.animation_prefix +"idle") machine.play("idle")
func _exit() -> void: func _exit() -> void:
pass pass

View file

@ -3,7 +3,7 @@ extends WeaponState
@export var emptyable: bool @export var emptyable: bool
func _enter() -> void: func _enter() -> void:
machine.animation_player.play(machine.animation_prefix + "intro") machine.play("intro")
machine.animation_player.animation_finished.connect(on_animation_finished) machine.animation_player.animation_finished.connect(on_animation_finished)
func _exit() -> void: func _exit() -> void:

View file

@ -93,8 +93,12 @@ curve = SubResource("Curve_wpp30")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_hr7p8"] [sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_hr7p8"]
resource_local_to_scene = true resource_local_to_scene = true
emission_shape = 3 emission_shape = 6
emission_box_extents = Vector3(3.75, 0, 3.75) emission_ring_axis = Vector3(0, 1, 0)
emission_ring_height = 0.0
emission_ring_radius = 3.5
emission_ring_inner_radius = 1.0
emission_ring_cone_angle = 90.0
direction = Vector3(0, 1, 0) direction = Vector3(0, 1, 0)
spread = 0.0 spread = 0.0
initial_velocity_min = 1.0 initial_velocity_min = 1.0
@ -116,6 +120,7 @@ vertex_color_is_srgb = true
albedo_texture = ExtResource("7_18xly") albedo_texture = ExtResource("7_18xly")
texture_filter = 0 texture_filter = 0
billboard_mode = 3 billboard_mode = 3
billboard_keep_scale = true
particles_anim_h_frames = 1 particles_anim_h_frames = 1
particles_anim_v_frames = 1 particles_anim_v_frames = 1
particles_anim_loop = false particles_anim_loop = false
@ -131,7 +136,7 @@ colors = PackedColorArray(1, 1, 1, 1, 1, 0, 0, 1)
gradient = SubResource("Gradient_wpp30") gradient = SubResource("Gradient_wpp30")
[sub_resource type="Curve" id="Curve_bt4sy"] [sub_resource type="Curve" id="Curve_bt4sy"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.7422681, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] _data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.47435898, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3 point_count = 3
[sub_resource type="CurveTexture" id="CurveTexture_m625o"] [sub_resource type="CurveTexture" id="CurveTexture_m625o"]
@ -155,6 +160,7 @@ vertex_color_is_srgb = true
albedo_texture = ExtResource("7_18xly") albedo_texture = ExtResource("7_18xly")
texture_filter = 0 texture_filter = 0
billboard_mode = 3 billboard_mode = 3
billboard_keep_scale = true
particles_anim_h_frames = 1 particles_anim_h_frames = 1
particles_anim_v_frames = 1 particles_anim_v_frames = 1
particles_anim_loop = false particles_anim_loop = false