pellet spread, bulletholes and balance fixes

This commit is contained in:
Rendo 2025-12-14 14:54:35 +05:00
commit 74e37f8a18
17 changed files with 261 additions and 72 deletions

View file

@ -0,0 +1,27 @@
[gd_scene load_steps=3 format=3 uid="uid://u8aj6fs32ql6"]
[ext_resource type="Texture2D" uid="uid://djb2h4sf42nqq" path="res://textures/bullet_hole.png" id="1_wpexx"]
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_wpexx"]
properties/0/path = NodePath(".:position")
properties/0/spawn = true
properties/0/replication_mode = 1
properties/1/path = NodePath(".:rotation")
properties/1/spawn = true
properties/1/replication_mode = 1
[node name="BulletHole" type="Decal"]
size = Vector3(0.25, 0.5, 0.25)
texture_albedo = ExtResource("1_wpexx")
[node name="Timer" type="Timer" parent="."]
process_mode = 3
wait_time = 60.0
one_shot = true
autostart = true
ignore_time_scale = true
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_wpexx")
[connection signal="timeout" from="Timer" to="." method="queue_free"]

View file

@ -1,10 +1,11 @@
[gd_scene load_steps=10 format=3 uid="uid://8ohlfmr5bp0k"]
[gd_scene load_steps=12 format=3 uid="uid://8ohlfmr5bp0k"]
[ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://systems/weapon_system/weapon_substate_machine.gd" id="1_uck67"]
[ext_resource type="Script" uid="uid://ofv4e3dsfe8" path="res://weapons/gun/idle_state.gd" id="2_rkf02"]
[ext_resource type="Script" uid="uid://cvueeftqbxb7r" path="res://weapons/gun/semi_pellet_shoot_state.gd" id="3_jk5g7"]
[ext_resource type="Script" uid="uid://hmekwp8444ao" path="res://weapons/gun/reload_state.gd" id="4_fs8hh"]
[ext_resource type="Script" uid="uid://bmj0bwy2tlian" path="res://weapons/gun/intro_state.gd" id="5_3ok4b"]
[ext_resource type="Script" uid="uid://ryxe3lxtvpk4" path="res://weapons/gun/pellet_spread/pellet_spread.gd" id="6_a53f6"]
[sub_resource type="Curve" id="Curve_cmn6f"]
_limits = [0.0, 0.1, 0.0, 20.0]
@ -27,6 +28,12 @@ properties/1/path = NodePath(".:remaining_ammo")
properties/1/spawn = true
properties/1/replication_mode = 2
[sub_resource type="Curve2D" id="Curve2D_0fc4q"]
_data = {
"points": PackedVector2Array(0, 0, 0, 0, 0, -10, 0, 0, 0, 0, 9, -7, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, -8, -3, 0, 0, 0, 0, -8, 5, 0, 0, 0, 0, -1, 7, 0, 0, 0, 0, 7, 6, 0, 0, 0, 0, 14, 6, 0, 0, 0, 0, 15, -5, 0, 0, 0, 0, 0, -7, 0, 0, 0, 0, -13, -7, 0, 0, 0, 0, -10, 4, 0, 0, 0, 0, -10, 12, 0, 0, 0, 0, -1, 13, 0, 0, 0, 0, 12, 14, 0, 0, 0, 0, 6, 11, 0, 0, 0, 0, 21, 9, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 9, -16, 0, 0, 0, 0, -10, -13, 0, 0, 0, 0, -16, -2, 0, 0, 0, 0, -17, 13, 0, 0, 0, 0, -3, 19, 0, 0, 0, 0, 6, 16, 0, 0, 0, 0, 18, 16, 0, 0, 0, 0, 24, 9, 0, 0, 0, 0, 23, -7, 0, 0, 0, 0, 20, -12)
}
point_count = 28
[node name="MC255" type="Node" node_paths=PackedStringArray("enter_state")]
script = ExtResource("1_uck67")
animation_prefix = &"baked_mc_"
@ -41,17 +48,15 @@ metadata/_custom_type_script = "uid://e6lqknfl4ngt"
[node name="Idle" type="Node" parent="."]
script = ExtResource("2_rkf02")
[node name="Shoot" type="Node" parent="." node_paths=PackedStringArray("fire_timer")]
[node name="Shoot" type="Node" parent="." node_paths=PackedStringArray("pellet_spread", "fire_timer")]
script = ExtResource("3_jk5g7")
vertical_curve = SubResource("Curve_cmn6f")
horizontal_curve = SubResource("Curve_jk5g7")
damage_reduction_curve = SubResource("Curve_bwg3m")
torso_total_damage = 100
head_total_damage = 150
limb_total_damage = 70
arc = 0.08726646259971647
max_pellets = 30
min_pellets = 30
torso_pellet_damage = 6
head_pellet_damage = 24
limb_pellet_damage = 6
pellet_spread = NodePath("../PelletSpread")
shoot_distance = 40.0
fire_timer = NodePath("../FireTimer")
@ -67,3 +72,9 @@ one_shot = true
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_bwg3m")
[node name="PelletSpread" type="Path2D" parent="."]
position = Vector2(640, 360)
curve = SubResource("Curve2D_0fc4q")
script = ExtResource("6_a53f6")
metadata/_custom_type_script = "uid://ryxe3lxtvpk4"

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cs1dapnsaw2vw"
path="res://.godot/imported/icon.png-0bb35b0bcb159408ed12f260c09d8538.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://weapons/gun/pellet_spread/icon.png"
dest_files=["res://.godot/imported/icon.png-0bb35b0bcb159408ed12f260c09d8538.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,13 @@
@icon("res://weapons/gun/pellet_spread/icon.png")
class_name PelletSpread extends Path2D
func get_dots() -> PackedVector2Array:
var result: PackedVector2Array
for i in curve.point_count:
result.append(curve.get_point_position(i))
for i in range(len(result)):
result[i] += get_viewport_rect().size/2.0
return result

View file

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

View file

@ -0,0 +1,22 @@
@tool
extends PelletSpread
class_name PelletSpreadRandom
const ASPECT = 1.7777777777777777
@export var random_amount: int
@export_range(0,89,0.1,"radians_as_degrees") var radius: float
@export var aspect_ratio: float = 1.7777777777777777
@export_tool_button("Randomize points") var randomize_button = randomize_points
func randomize_points() -> void:
curve.clear_points()
var viewport_aspect_trasformation = Vector2(ASPECT,1)
var custom_aspect_transformation = Vector2(aspect_ratio,1./aspect_ratio)
var transformation_vector = get_viewport_rect().size / viewport_aspect_trasformation /PI
for i in range(random_amount):
var unscaled_position = Vector2(randf_range(-radius,radius),randf_range(-radius,radius))
var scaled_position = unscaled_position*transformation_vector
curve.add_point(scaled_position)

View file

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

View file

@ -5,12 +5,10 @@ extends WeaponState
@export var damage_reduction_curve: Curve
@export var emptyable: bool
@export var torso_total_damage: int
@export var head_total_damage: int
@export var limb_total_damage: int
@export_range(0,179,0.01,"radians_as_degrees") var arc: float
@export_range(1,20,1,"or_greater") var max_pellets: int = 1
@export_range(1,20,1,"or_greater") var min_pellets: int = 1
@export var torso_pellet_damage: int
@export var head_pellet_damage: int
@export var limb_pellet_damage: int
@export var pellet_spread: PelletSpread
@export var shoot_distance: float = 100
@export var fire_timer: Timer
@ -44,8 +42,7 @@ func fire() -> void:
machine.animation_player.play(with_morphems("shoot"))
if is_multiplayer_authority():
var pellets: int = randi_range(min_pellets,max_pellets)
Session.shoot_pellets(int(machine.player.name),pellets,limb_total_damage,torso_total_damage,head_total_damage,shoot_distance,arc,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)
machine.player.get_node("ShootAudio").multiplayer_play()
fire_timer.start()