Different damage based on body part

This commit is contained in:
Rendo 2025-12-11 20:54:24 +05:00
commit 1d5065cbbf
8 changed files with 86 additions and 101 deletions

View file

@ -2,9 +2,12 @@ extends WeaponState
@export var vertical_curve: Curve
@export var horizontal_curve: Curve
@export var damage_reduction_curve: Curve
@export var emptyable: bool
@export var damage: int
@export var torso_damage: int
@export var head_damage: int
@export var limb_damage: int
@export var shoot_distance: float = 100
@export var fire_timer: Timer
@ -38,7 +41,7 @@ func fire() -> void:
machine.animation_player.play(with_morphems("shoot"))
if is_multiplayer_authority():
Session.shoot(int(machine.player.name),damage,shoot_distance)
Session.shoot(int(machine.player.name),limb_damage,torso_damage,head_damage,shoot_distance,damage_reduction_curve)
machine.player.get_node("ShootAudio").multiplayer_play()
fire_timer.start()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://djwjl8xll53vn"]
[gd_scene load_steps=10 format=3 uid="uid://djwjl8xll53vn"]
[ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://systems/weapon_system/weapon_substate_machine.gd" id="1_g7s1i"]
[ext_resource type="Script" uid="uid://ofv4e3dsfe8" path="res://weapons/gun/idle_state.gd" id="2_cmn6f"]
@ -18,6 +18,10 @@ _limits = [-0.02, 0.02, 0.0, 20.0]
_data = [Vector2(0, -9.313226e-10), 0.0, 0.0, 0, 0, Vector2(4.959569, 0.0044327714), 0.0, 0.0, 0, 0, Vector2(9.919138, -0.0075840354), 0.0, 0.0, 0, 0, Vector2(15.09434, 0.011533612), 0.0, 0.0, 0, 0, Vector2(20, -0.014684878), 0.0, 0.0, 0, 0]
point_count = 5
[sub_resource type="Curve" id="Curve_bwg3m"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.49799195, 1), 0.0, 0.0, 0, 0, Vector2(0.8473895, 0.51194537), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_bwg3m"]
properties/0/path = NodePath(".:ammo")
properties/0/spawn = true
@ -45,8 +49,11 @@ emptyable = true
script = ExtResource("3_016ti")
vertical_curve = SubResource("Curve_cmn6f")
horizontal_curve = SubResource("Curve_016ti")
damage_reduction_curve = SubResource("Curve_bwg3m")
emptyable = true
damage = 22
torso_damage = 22
head_damage = 60
limb_damage = 12
fire_timer = NodePath("../FireTimer")
[node name="Reload" type="Node" parent="."]

View file

@ -14,7 +14,7 @@ func _exit() -> void:
func attack() -> void:
if is_multiplayer_authority():
Session.shoot(int(machine.player.name),damage,1.5)
Session.shoot(int(machine.player.name),damage,damage,damage,1.5)
func on_animation_finished(animation):
if animation == machine.animation_prefix + "attack":

View file

@ -12,7 +12,7 @@ func _exit() -> void:
func attack() -> void:
if is_multiplayer_authority():
Session.shoot(int(machine.player.name),damage,1.5)
Session.shoot(int(machine.player.name),damage,damage,damage,1.5)
func on_animation_finished(animation):
if animation == machine.animation_prefix + "heavy_attack":