basic molotov

This commit is contained in:
Rendo 2025-12-08 20:37:19 +05:00
commit b59cb48b77
5 changed files with 133 additions and 1 deletions

View file

@ -0,0 +1,24 @@
extends Area3D
@export var dps: float
@export var damage_timer: Timer
var damage_targets: Array[Player]
func _ready() -> void:
body_entered.connect(on_body_entered)
body_exited.connect(on_body_exited)
func damage():
for target in damage_targets:
if target.is_on_floor():
target.take_damage(int(dps*damage_timer.wait_time))
func on_body_entered(body: Node3D):
if body is Player:
damage_targets.append(body)
func on_body_exited(body: Node3D):
if body is Player:
damage_targets.erase(body)

View file

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

View file

@ -0,0 +1,69 @@
[gd_scene load_steps=10 format=3 uid="uid://l4t1mflutm3t"]
[ext_resource type="Texture2D" uid="uid://bmnqvop2dy5pm" path="res://textures/prototype_yellow_256x256.png" id="1_hr7p8"]
[ext_resource type="Script" uid="uid://bo0ij4miuksua" path="res://scenes/projectiles/molikman/molikman_molotov_fire.gd" id="1_qokq0"]
[ext_resource type="Texture2D" uid="uid://b8aqstr5es5x4" path="res://textures/prototype_orange_256x256.png" id="2_qokq0"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_hr7p8"]
height = 3.0
radius = 1.5
[sub_resource type="Gradient" id="Gradient_hr7p8"]
colors = PackedColorArray(1, 0.53333336, 0, 1, 0.45, 0.45, 0.45, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_qokq0"]
gradient = SubResource("Gradient_hr7p8")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_hr7p8"]
emission_shape_scale = Vector3(1.5, 1.5, 1.5)
emission_shape = 1
emission_sphere_radius = 1.0
direction = Vector3(0, 1, 0)
initial_velocity_max = 3.4499998
orbit_velocity_min = -0.46899992
orbit_velocity_max = 0.4130001
gravity = Vector3(0, 0, 0)
tangential_accel_min = -3.4500022
tangential_accel_max = 2.0699978
color_ramp = SubResource("GradientTexture1D_qokq0")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_qokq0"]
[sub_resource type="TextMesh" id="TextMesh_33jv6"]
material = SubResource("StandardMaterial3D_qokq0")
text = "fire"
[node name="MolikmanMolotovFire" type="Area3D" node_paths=PackedStringArray("damage_timer")]
collision_layer = 8
collision_mask = 2
script = ExtResource("1_qokq0")
dps = 25.0
damage_timer = NodePath("DamageTimer")
[node name="Decal" type="Decal" parent="."]
size = Vector3(3, 3, 3)
texture_albedo = ExtResource("1_hr7p8")
texture_emission = ExtResource("2_qokq0")
emission_energy = 0.25
cull_mask = 1048572
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("CylinderShape3D_hr7p8")
[node name="GPUParticles3D" type="GPUParticles3D" parent="."]
amount = 16
transform_align = 1
process_material = SubResource("ParticleProcessMaterial_hr7p8")
draw_pass_1 = SubResource("TextMesh_33jv6")
[node name="DieTimer" type="Timer" parent="."]
wait_time = 15.0
one_shot = true
autostart = true
[node name="DamageTimer" type="Timer" parent="."]
wait_time = 0.25
autostart = true
[connection signal="timeout" from="DieTimer" to="." method="queue_free"]
[connection signal="timeout" from="DamageTimer" to="." method="damage"]