Refactor Part II
This commit is contained in:
parent
cd20f952ce
commit
3f99f1b8dd
56 changed files with 193 additions and 168 deletions
24
weapons/molikman/molik/molikman_molotov_fire.gd
Normal file
24
weapons/molikman/molik/molikman_molotov_fire.gd
Normal 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue