New weapons and weapon inhand system

This commit is contained in:
ToasterPanic 2026-05-15 21:51:44 -04:00
parent ac049d9048
commit 917676a06b
21 changed files with 357 additions and 16 deletions

View file

@ -38,6 +38,34 @@ enabled=PackedStringArray("res://addons/godot_super-wakatime/plugin.cfg", "res:/
navigation_mesh_source_group="" navigation_mesh_source_group=""
[importer_defaults]
texture={
"compress/channel_pack": 0,
"compress/hdr_compression": 1,
"compress/high_quality": false,
"compress/lossy_quality": 0.7,
"compress/mode": 0,
"compress/normal_map": 0,
"compress/rdo_quality_loss": 0.0,
"compress/uastc_level": 0,
"detect_3d/compress_to": 0,
"mipmaps/generate": false,
"mipmaps/limit": -1,
"process/channel_remap/alpha": 3,
"process/channel_remap/blue": 2,
"process/channel_remap/green": 1,
"process/channel_remap/red": 0,
"process/fix_alpha_border": true,
"process/hdr_as_srgb": false,
"process/hdr_clamp_exposure": false,
"process/normal_map_invert_y": false,
"process/premult_alpha": false,
"process/size_limit": 0,
"roughness/mode": 0,
"roughness/src_normal": ""
}
[input] [input]
move_left={ move_left={

View file

@ -41,7 +41,7 @@ size = Vector3(0.65, 1, 0.65)
[sub_resource type="Environment" id="Environment_uwrxv"] [sub_resource type="Environment" id="Environment_uwrxv"]
background_mode = 1 background_mode = 1
background_color = Color(0.21272367, 0.00026760699, 0.30778188, 1) background_color = Color(1, 1, 1, 1)
tonemap_mode = 2 tonemap_mode = 2
volumetric_fog_enabled = true volumetric_fog_enabled = true
adjustment_enabled = true adjustment_enabled = true

View file

@ -0,0 +1,11 @@
[gd_scene format=3 uid="uid://cjwn7j4we5gqu"]
[ext_resource type="Texture2D" uid="uid://d1abd236mlb6" path="res://textures/weapons/inhands/basic_hammer.png" id="1_57fji"]
[node name="Sword" type="Sprite3D" unique_id=1724644759]
offset = Vector2(0, 5.5)
pixel_size = 0.03
shaded = true
alpha_cut = 2
texture_filter = 0
texture = ExtResource("1_57fji")

View file

@ -0,0 +1,11 @@
[gd_scene format=3 uid="uid://tf0jfb52567t"]
[ext_resource type="Texture2D" uid="uid://lb0ljo6sf7ob" path="res://textures/weapons/inhands/basic_knife.png" id="1_f4o4v"]
[node name="Sword" type="Sprite3D" unique_id=1724644759]
offset = Vector2(0, 5.5)
pixel_size = 0.03
shaded = true
alpha_cut = 2
texture_filter = 0
texture = ExtResource("1_f4o4v")

View file

@ -0,0 +1,11 @@
[gd_scene format=3 uid="uid://dqiw6d5pc5dhl"]
[ext_resource type="Texture2D" uid="uid://xufvik31gru8" path="res://textures/weapons/inhands/basic_sword.png" id="1_coycx"]
[node name="Sword" type="Sprite3D" unique_id=1724644759]
offset = Vector2(0, 9.5)
pixel_size = 0.03
shaded = true
alpha_cut = 2
texture_filter = 0
texture = ExtResource("1_coycx")

View file

@ -0,0 +1,11 @@
[gd_scene format=3 uid="uid://cjja5um2l5s1n"]
[ext_resource type="Texture2D" uid="uid://xufvik31gru8" path="res://textures/weapons/inhands/basic_sword.png" id="1_k8uy1"]
[node name="Sword" type="Sprite3D" unique_id=1724644759]
offset = Vector2(0, 9.5)
pixel_size = 0.03
shaded = true
alpha_cut = 2
texture_filter = 0
texture = ExtResource("1_k8uy1")

View file

@ -4,7 +4,6 @@
[ext_resource type="Script" uid="uid://c8sptss1aulmi" path="res://scripts/dreamer_body.gd" id="1_54k0m"] [ext_resource type="Script" uid="uid://c8sptss1aulmi" path="res://scripts/dreamer_body.gd" id="1_54k0m"]
[ext_resource type="Texture2D" uid="uid://3ptkafoafq14" path="res://textures/character-leg.png" id="2_54k0m"] [ext_resource type="Texture2D" uid="uid://3ptkafoafq14" path="res://textures/character-leg.png" id="2_54k0m"]
[ext_resource type="Texture2D" uid="uid://rgxhw23471ut" path="res://textures/character-arm.png" id="3_yptk5"] [ext_resource type="Texture2D" uid="uid://rgxhw23471ut" path="res://textures/character-arm.png" id="3_yptk5"]
[ext_resource type="Texture2D" uid="uid://cvtipichutylm" path="res://textures/test-sword.png" id="5_54k0m"]
[sub_resource type="Animation" id="Animation_gee14"] [sub_resource type="Animation" id="Animation_gee14"]
length = 0.001 length = 0.001
@ -188,6 +187,18 @@ tracks/14/keys = {
"update": 0, "update": 0,
"values": [Vector3(0, 0, 0)] "values": [Vector3(0, 0, 0)]
} }
tracks/15/type = "value"
tracks/15/imported = false
tracks/15/enabled = true
tracks/15/path = NodePath("Body/ArmPivot/FrontArm/HandPoint:position:z")
tracks/15/interp = 1
tracks/15/loop_wrap = true
tracks/15/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0.0010000002]
}
[sub_resource type="Animation" id="Animation_lg4u0"] [sub_resource type="Animation" id="Animation_lg4u0"]
resource_name = "charge_weapon" resource_name = "charge_weapon"
@ -812,6 +823,18 @@ tracks/3/keys = {
"update": 1, "update": 1,
"values": [-0.011] "values": [-0.011]
} }
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Body/ArmPivot/FrontArm/HandPoint:position:z")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [-0.001]
}
[sub_resource type="Animation" id="Animation_06ej8"] [sub_resource type="Animation" id="Animation_06ej8"]
resource_name = "limbs_front" resource_name = "limbs_front"
@ -864,6 +887,18 @@ tracks/3/keys = {
"update": 1, "update": 1,
"values": [0.011] "values": [0.011]
} }
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Body/ArmPivot/FrontArm/HandPoint:position:z")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0.0010000002]
}
[sub_resource type="Animation" id="Animation_0tnpc"] [sub_resource type="Animation" id="Animation_0tnpc"]
resource_name = "move" resource_name = "move"
@ -1028,7 +1063,6 @@ filters = ["Body/ArmPivot:rotation"]
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_p57ef"] [sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_p57ef"]
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_kvpfn"] [sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_kvpfn"]
graph_offset = Vector2(246.604, -45.23578)
nodes/output/position = Vector2(3580, 40) nodes/output/position = Vector2(3580, 40)
nodes/jump/node = SubResource("AnimationNodeOneShot_u5sy4") nodes/jump/node = SubResource("AnimationNodeOneShot_u5sy4")
nodes/jump/position = Vector2(860, 100) nodes/jump/position = Vector2(860, 100)
@ -1123,16 +1157,7 @@ texture_filter = 0
texture = ExtResource("3_yptk5") texture = ExtResource("3_yptk5")
[node name="HandPoint" type="Node3D" parent="Body/ArmPivot/FrontArm" unique_id=709125335] [node name="HandPoint" type="Node3D" parent="Body/ArmPivot/FrontArm" unique_id=709125335]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.24, 0.001) transform = Transform3D(-4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, 0, 1, 0, -0.24, 0.0010000002)
[node name="Sword" type="Sprite3D" parent="Body/ArmPivot/FrontArm/HandPoint" unique_id=1523806768]
transform = Transform3D(-4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, 0, 1, 0, 0, 0)
offset = Vector2(0, 5.5)
pixel_size = 0.03
shaded = true
alpha_cut = 2
texture_filter = 0
texture = ExtResource("5_54k0m")
[node name="BackArm" type="Sprite3D" parent="Body/ArmPivot" unique_id=111008142] [node name="BackArm" type="Sprite3D" parent="Body/ArmPivot" unique_id=111008142]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.089999996, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.089999996, 0, 0)

View file

@ -4,6 +4,15 @@ extends Node3D
func _ready() -> void: func _ready() -> void:
pass # Replace with function body. pass # Replace with function body.
func set_inhand(weapon_name: String) -> void:
var inhand = Global.inhands[weapon_name].instantiate()
for n in $Body/ArmPivot/FrontArm/HandPoint.get_children(): n.queue_free()
$Body/ArmPivot/FrontArm/HandPoint.add_child(inhand)
inhand.position = Vector3.ZERO
inhand.rotation = Vector3.ZERO
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: func _process(delta: float) -> void:

View file

@ -14,7 +14,7 @@ var knockback_time := 0.0
var health := 100.0 var health := 100.0
var current_weapon := "test_sword" var current_weapon := "basic_sword"
enum { enum {
STATE_IDLE, STATE_IDLE,
@ -52,6 +52,7 @@ func on_knockback(hitter: Node3D = null) -> void:
func _ready() -> void: func _ready() -> void:
$DreamerBody/Animator.set("parameters/hold_weapon/blend_amount", 1.0) $DreamerBody/Animator.set("parameters/hold_weapon/blend_amount", 1.0)
$DreamerBody.set_inhand(current_weapon)
func _process(delta: float) -> void: func _process(delta: float) -> void:
$DreamerBody.rotation.x = 0 $DreamerBody.rotation.x = 0

View file

@ -1,7 +1,7 @@
extends Node extends Node
const weapons = { const weapons = {
"test_sword": { "basic_sword": {
"combo_weapon": true, "combo_weapon": true,
"hits_to_finish": 3, "hits_to_finish": 3,
"swing_time": 0.16, "swing_time": 0.16,
@ -13,5 +13,37 @@ const weapons = {
"knockback": 3.5, "knockback": 3.5,
"knockback_mid_combo": 0.75, "knockback_mid_combo": 0.75,
"stun_time": 0.4, "stun_time": 0.4,
},
"basic_knife": {
"combo_weapon": true,
"hits_to_finish": 10,
"swing_time": 0.06,
"combo_timeout": 0.25,
"swing_time_combo_finish": 0.66,
"damage": 20,
"damage_mid_combo": 5,
"knockback": 2.5,
"knockback_mid_combo": 0.3,
"stun_time": 0.4,
},
"basic_hammer": {
"combo_weapon": true,
"hits_to_finish": 2,
"swing_time": 0.6,
"combo_timeout": 1,
"swing_time_combo_finish": 1,
"damage": 35,
"damage_mid_combo": 25,
"knockback": 5.5,
"knockback_mid_combo": 1.5,
"stun_time": 0.6,
} }
} }
const inhands = {
"basic_sword": preload("res://scenes/inhands/basic_sword.tscn"),
"basic_hammer": preload("res://scenes/inhands/basic_hammer.tscn"),
"basic_knife": preload("res://scenes/inhands/basic_knife.tscn")
}

View file

@ -19,7 +19,7 @@ var swing_timer = 0
var queue_swing = false var queue_swing = false
var current_weapon = "test_sword" var current_weapon = "basic_sword"
@onready var game = get_parent() @onready var game = get_parent()
@onready var camera = game.get_node("PlayerCamera") @onready var camera = game.get_node("PlayerCamera")
@ -46,6 +46,7 @@ func on_hit(hitter: Node3D = null) -> void:
func _ready() -> void: func _ready() -> void:
LimboConsole.register_command(hit_me) LimboConsole.register_command(hit_me)
$DreamerBody.set_inhand(current_weapon)
func _process(delta: float) -> void: func _process(delta: float) -> void:

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d1abd236mlb6"
path="res://.godot/imported/basic_hammer.png-f6a9fb81df6ee9f07b87f642d9ea7366.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://textures/weapons/inhands/basic_hammer.png"
dest_files=["res://.godot/imported/basic_hammer.png-f6a9fb81df6ee9f07b87f642d9ea7366.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=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://lb0ljo6sf7ob"
path="res://.godot/imported/basic_knife.png-1a93caa096c021d74c3a79a908c30051.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://textures/weapons/inhands/basic_knife.png"
dest_files=["res://.godot/imported/basic_knife.png-1a93caa096c021d74c3a79a908c30051.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=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b5g7bhk0kj16"
path="res://.godot/imported/basic_spear.png-5e51f45d76972d56ca4fd506aabd79eb.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://textures/weapons/inhands/basic_spear.png"
dest_files=["res://.godot/imported/basic_spear.png-5e51f45d76972d56ca4fd506aabd79eb.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=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://xufvik31gru8"
path="res://.godot/imported/basic_sword.png-46a3846d4b7127f9e2efda8e742286a2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://textures/weapons/inhands/basic_sword.png"
dest_files=["res://.godot/imported/basic_sword.png-46a3846d4b7127f9e2efda8e742286a2.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=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

View file

@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b0vgfbnn88ack"
path.s3tc="res://.godot/imported/test_sword.png-cdc76d21f0f70d4649a4a0d8edd8c16e.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/weapons/inhands/test_sword.png"
dest_files=["res://.godot/imported/test_sword.png-cdc76d21f0f70d4649a4a0d8edd8c16e.s3tc.ctex"]
[params]
compress/mode=2
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=true
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=0