animation improvements; weapon; correct aiming

This commit is contained in:
Rowan 2025-05-06 14:42:40 -05:00
parent d7eea05820
commit 6005227523
72 changed files with 3048 additions and 475 deletions

View file

@ -4,16 +4,40 @@ A week? A month? Pick a specific date
# Roadmap
* Save/Load
* Serialization and deserialization
* What needs to be serialized
* Condition
* Inventory
* Progress
* Story progression
* Rooms / levels
* Health/Condition
* Inventory
* Equipmentread
* Camera follow
* Bounded by room
* Always faces north
* Positioned south of player
* First person mode?
* Menu UI
* Inventory
* Difficulty 8
* Importance 7
* Status/Health/Condition
* Difficulty 3
* Importance 8
* Story/Log
* Difficulty 8
* Importance 5
* Title
* Difficulty 6
* Importance 5
* Settings
* Difficulty 10
* Importance 4
* Audio
* Central mixer for mastering
* Sound groups
* One shot and looping audio (music and sfx)
* Level collisions
* Combat
* Health
@ -26,6 +50,7 @@ A week? A month? Pick a specific date
# Aesthetic direction
* Gruel or new?
* Leaning toward new
* General setting / vibe
# Cleanup
@ -43,6 +68,22 @@ E 0:00:02:0620 PromiseRejectCallback_: [jsb][Error] unhandled promise rejectio
```
# Considerations
* Monkeypatch math structures
* Math operations are painful
```ts
const a = new Vector(0, 0, 0)
// a + Vector3.ONE
const b = Vector3.ADD(Vector3.ONE, a)
// (Vector3.ONE * 2) * b + a
const c = Vector3.ADD(
Vector3.MULTIPLY(
Vector3.ADD(Vector3.ONE, Vector3.ONE),
b
),
a
)
```
* Gltf -> Godot workflow
* Easier way to combine animations on single model
* Possibly download character animation combiner and automate

Binary file not shown.

View file

@ -0,0 +1,38 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://mii66yx7ep0m"
path="res://.godot/imported/Glock17.fbx-21a41422b406849d0ac156c344e49ded.scn"
[deps]
source_file="res://assets/Glock 17 Gen 4/Glock17.fbx"
dest_files=["res://.godot/imported/Glock17.fbx-21a41422b406849d0ac156c344e49ded.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=true
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
fbx/importer=0
fbx/allow_geometry_helper_nodes=false
fbx/embedded_image_handling=1

Binary file not shown.

View file

@ -0,0 +1,53 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://bsamn3hu8mypn"
path="res://.godot/imported/MagazineOnly.blend-03c199d61b3da2f3a886fbf595d4fdb8.scn"
[deps]
source_file="res://assets/Glock 17 Gen 4/MagazineOnly.blend"
dest_files=["res://.godot/imported/MagazineOnly.blend-03c199d61b3da2f3a886fbf595d4fdb8.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/export_geometry_nodes_instances=false
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true

Binary file not shown.

View file

@ -0,0 +1,38 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://b1flnaqxpsntg"
path="res://.godot/imported/MagazineOnly.fbx-c5c1e9faa3577f6cfda078f5a38aa9af.scn"
[deps]
source_file="res://assets/Glock 17 Gen 4/MagazineOnly.fbx"
dest_files=["res://.godot/imported/MagazineOnly.fbx-c5c1e9faa3577f6cfda078f5a38aa9af.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=true
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
fbx/importer=0
fbx/allow_geometry_helper_nodes=false
fbx/embedded_image_handling=1

Binary file not shown.

View file

@ -0,0 +1,53 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://clc8ic0w44pqb"
path="res://.godot/imported/Main.blend-949e4928fb46c2598347c692921a4209.scn"
[deps]
source_file="res://assets/Glock 17 Gen 4/Main.blend"
dest_files=["res://.godot/imported/Main.blend-949e4928fb46c2598347c692921a4209.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/export_geometry_nodes_instances=false
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true

Binary file not shown.

View file

@ -0,0 +1,37 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://5a023hrws3gx"
path="res://.godot/imported/Main.glb-313ef174cbfc4d23192b83a144919b40.scn"
[deps]
source_file="res://assets/Glock 17 Gen 4/Main.glb"
dest_files=["res://.godot/imported/Main.glb-313ef174cbfc4d23192b83a144919b40.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cnqli7mte5jsn"
path="res://.godot/imported/MainRender.png-809411c3f2bc242eb5c881659d87b16b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Glock 17 Gen 4/MainRender.png"
dest_files=["res://.godot/imported/MainRender.png-809411c3f2bc242eb5c881659d87b16b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

@ -18,6 +18,7 @@ nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true

View file

@ -18,6 +18,7 @@ nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=6 format=3 uid="uid://dg82oi74wjpen"]
[ext_resource type="Script" path="res://src/player.ts" id="1_f7s2q"]
[ext_resource type="Script" uid="uid://dxiv1svdeoxg2" path="res://src/player.ts" id="1_f7s2q"]
[ext_resource type="PackedScene" uid="uid://cyfbte21rykqr" path="res://scenes/player_mesh.tscn" id="2_0bcjn"]
[ext_resource type="Script" path="res://src/player_input.ts" id="3_mrw4e"]
[ext_resource type="Script" path="res://src/player_animation.ts" id="4_64fm5"]
[ext_resource type="Script" uid="uid://ny0p0jkmlrv8" path="res://src/player_input.ts" id="3_mrw4e"]
[ext_resource type="Script" uid="uid://hm6oqbvcmigk" path="res://src/player_animation.ts" id="4_64fm5"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ruj8e"]

View file

@ -12,14 +12,20 @@ config_version=5
config/name="signalis"
run/main_scene="res://scenes/node_3d.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")
config/features=PackedStringArray("4.4", "Forward Plus")
run/max_fps=60
config/icon="res://icon.svg"
[autoload]
MessageBus="*res://src/message_bus.ts"
DebugDraw="*res://src/debug_draw.ts"
Console="*res://addons/dev_console/console.tscn"
DebugDraw="*res://src/debug_draw.ts"
MessageBus="*res://src/message_bus.ts"
AsyncResourceLoader="*res://src/async_resource_loader.ts"
[editor]
script/search_in_file_extensions=PackedStringArray("gd", "gdshader", "ts")
[input]

View file

@ -0,0 +1,11 @@
[gd_resource type="Resource" script_class="Weapon" load_steps=2 format=3 uid="uid://c15pu3ela0g6k"]
[ext_resource type="Script" uid="uid://tv71bu1y658n" path="res://src/weapon.ts" id="1_bp18i"]
[resource]
script = ExtResource("1_bp18i")
name = &""
description = ""
max_quantity = 99
scene = "uid://ddgak6clk2i2p"
metadata/_custom_type_script = "uid://tv71bu1y658n"

View file

@ -1,10 +1,9 @@
[gd_resource type="Resource" script_class="ItemData" load_steps=2 format=3 uid="uid://5odv3n0dp2nn"]
[gd_resource type="Resource" script_class="Item" load_steps=2 format=3 uid="uid://5odv3n0dp2nn"]
[ext_resource type="Script" path="res://src/item_data.ts" id="1_bbxre"]
[ext_resource type="Script" uid="uid://tgca2vcp2tt4" path="res://src/item.ts" id="1_bbxre"]
[resource]
script = ExtResource("1_bbxre")
name = &"DebugKey"
type = 1
description = ""
max_quantity = 99

8
scenes/glock_17.tscn Normal file
View file

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://ddgak6clk2i2p"]
[ext_resource type="PackedScene" uid="uid://mii66yx7ep0m" path="res://assets/Glock 17 Gen 4/Glock17.fbx" id="1_uqhm2"]
[node name="Glock17" type="Node3D"]
[node name="Mesh" parent="." instance=ExtResource("1_uqhm2")]
transform = Transform3D(-5.85095, 13.7292, 1.50831, -8.35006, -4.82091, 11.4907, 11.002, 3.64246, 9.52311, 0, 0, 0)

View file

@ -1,12 +1,12 @@
[gd_scene load_steps=14 format=3 uid="uid://dl8pjf2esflbr"]
[gd_scene load_steps=16 format=3 uid="uid://dl8pjf2esflbr"]
[ext_resource type="PackedScene" uid="uid://cersx8w4ps2sr" path="res://scenes/player.tscn" id="1_uum5p"]
[ext_resource type="Script" path="res://src/main_camera.ts" id="2_0n32s"]
[ext_resource type="Script" uid="uid://cgbd6grygtxvj" path="res://src/main_camera.ts" id="2_0n32s"]
[ext_resource type="PackedScene" uid="uid://cwrgvwx3lfwf6" path="res://assets/level.glb" id="2_i3oty"]
[ext_resource type="Script" path="res://src/interactable.ts" id="3_dt0nx"]
[ext_resource type="Script" path="res://src/interactable/door.ts" id="3_imxmk"]
[ext_resource type="Script" uid="uid://cyll634iylhqg" path="res://src/interactable.ts" id="3_dt0nx"]
[ext_resource type="Script" uid="uid://1w0aiix6vgbc" path="res://src/interactable/door.ts" id="3_imxmk"]
[ext_resource type="Resource" uid="uid://5odv3n0dp2nn" path="res://resources/items/key.tres" id="4_3rynd"]
[ext_resource type="Script" path="res://src/item_pickup.ts" id="6_qe67v"]
[ext_resource type="Script" uid="uid://c7s3k1qy8pg3s" path="res://src/item_pickup.ts" id="6_qe67v"]
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_y41n8"]
@ -17,10 +17,15 @@
[sub_resource type="SphereMesh" id="SphereMesh_bketi"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_odc30"]
albedo_color = Color(1, 0, 0, 1)
albedo_color = Color(0.490196, 0, 0.686275, 1)
[sub_resource type="SphereShape3D" id="SphereShape3D_v25bj"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_8d4wu"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_l2jpa"]
albedo_color = Color(1, 0, 0, 1)
[node name="Node3D" type="Node3D"]
[node name="level" parent="." instance=ExtResource("2_i3oty")]
@ -44,12 +49,14 @@ transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107,
[node name="Door" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 1, 0)
visible = false
script = ExtResource("3_imxmk")
locked = true
requires_key = true
key_item = ExtResource("4_3rynd")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Door"]
transform = Transform3D(0.5, 0, 0, 0, 3, 0, 0, 0, 2, 0, 1, 0)
mesh = SubResource("BoxMesh_crnh0")
[node name="Interactable" type="Area3D" parent="Door"]
@ -66,29 +73,37 @@ text = "door"
font_size = 128
outline_size = 32
[node name="Node3D" type="Node3D" parent="."]
[node name="DoorKey" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -5)
visible = false
script = ExtResource("6_qe67v")
resource = ExtResource("4_3rynd")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Node3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="DoorKey"]
mesh = SubResource("SphereMesh_bketi")
surface_material_override/0 = SubResource("StandardMaterial3D_odc30")
[node name="Area3D" type="Area3D" parent="Node3D"]
[node name="Area3D" type="Area3D" parent="DoorKey"]
input_ray_pickable = false
monitoring = false
script = ExtResource("3_dt0nx")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Node3D/Area3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="DoorKey/Area3D"]
shape = SubResource("SphereShape3D_v25bj")
[node name="Label3D" type="Label3D" parent="Node3D"]
[node name="Label3D" type="Label3D" parent="DoorKey"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
billboard = 1
text = "door key"
font_size = 128
outline_size = 32
[node name="Target" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 1, -6)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Target"]
mesh = SubResource("CapsuleMesh_8d4wu")
surface_material_override/0 = SubResource("StandardMaterial3D_l2jpa")
[connection signal="interacted" from="Door/Interactable" to="Door" method="open"]
[connection signal="interacted" from="Node3D/Area3D" to="Node3D" method="add_to_inventory"]
[connection signal="interacted" from="DoorKey/Area3D" to="DoorKey" method="add_to_inventory"]

View file

@ -1,242 +1,204 @@
[gd_scene load_steps=24 format=3 uid="uid://cersx8w4ps2sr"]
[gd_scene load_steps=34 format=3 uid="uid://cersx8w4ps2sr"]
[ext_resource type="Script" path="res://src/player.ts" id="2_pdrhn"]
[ext_resource type="PackedScene" uid="uid://b1vb3py5av0e3" path="res://scenes/player_mesh2.tscn" id="2_rje1f"]
[ext_resource type="Script" path="res://src/player_animation.ts" id="3_26yay"]
[ext_resource type="Script" path="res://src/player_input.ts" id="3_x6527"]
[ext_resource type="Script" path="res://src/interactor.ts" id="5_uk7c1"]
[ext_resource type="Script" path="res://src/inventory.ts" id="6_jscba"]
[ext_resource type="Script" uid="uid://dxiv1svdeoxg2" path="res://src/player.ts" id="2_pdrhn"]
[ext_resource type="Script" uid="uid://hm6oqbvcmigk" path="res://src/player_animation.ts" id="3_26yay"]
[ext_resource type="Script" uid="uid://ny0p0jkmlrv8" path="res://src/player_input.ts" id="3_x6527"]
[ext_resource type="Script" uid="uid://kjthk4tj8qof" path="res://src/interactor.ts" id="5_uk7c1"]
[ext_resource type="Script" uid="uid://dkvbawcldnok5" path="res://src/equipped_weapon.ts" id="6_eg2om"]
[ext_resource type="Script" uid="uid://dbrjcvaqkca21" path="res://src/inventory.ts" id="6_jscba"]
[ext_resource type="PackedScene" uid="uid://sgc1gxq4osag" path="res://scenes/player_mesh3.tscn" id="7_fjrip"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_1kx10"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_vilbe"]
animation = &"Idle"
[sub_resource type="SphereShape3D" id="SphereShape3D_64co4"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_kjlhm"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_d2wvv"]
animation = &"Aim"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_3v2ag"]
animation = &"Fire"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_y4r1p"]
animation = &"PistolIdle"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_84wxe"]
animation = &"Shooting"
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_d2wvv"]
filter_enabled = true
filters = ["AuxScene/Scene/Armature/Skeleton3D:mixamorigHead", "AuxScene/Scene/Armature/Skeleton3D:mixamorigHead001", "AuxScene/Scene/Armature/Skeleton3D:mixamorigHips", "AuxScene/Scene/Armature/Skeleton3D:mixamorigHips001", "AuxScene/Scene/Armature/Skeleton3D:mixamorigLeftFoot", "AuxScene/Scene/Armature/Skeleton3D:mixamorigLeftLeg", "AuxScene/Scene/Armature/Skeleton3D:mixamorigLeftLeg001", "AuxScene/Scene/Armature/Skeleton3D:mixamorigLeftShoulder001", "AuxScene/Scene/Armature/Skeleton3D:mixamorigLeftToeBase", "AuxScene/Scene/Armature/Skeleton3D:mixamorigLeftUpLeg", "AuxScene/Scene/Armature/Skeleton3D:mixamorigLeftUpLeg001", "AuxScene/Scene/Armature/Skeleton3D:mixamorigNeck", "AuxScene/Scene/Armature/Skeleton3D:mixamorigNeck001", "AuxScene/Scene/Armature/Skeleton3D:mixamorigRightFoot", "AuxScene/Scene/Armature/Skeleton3D:mixamorigRightLeg", "AuxScene/Scene/Armature/Skeleton3D:mixamorigRightLeg001", "AuxScene/Scene/Armature/Skeleton3D:mixamorigRightToeBase", "AuxScene/Scene/Armature/Skeleton3D:mixamorigRightUpLeg", "AuxScene/Scene/Armature/Skeleton3D:mixamorigRightUpLeg001", "AuxScene/Scene/Armature/Skeleton3D:mixamorigSpine", "AuxScene/Scene/Armature/Skeleton3D:mixamorigSpine001", "AuxScene/Scene/Armature/Skeleton3D:mixamorigSpine1", "AuxScene/Scene/Armature/Skeleton3D:mixamorigSpine1001", "AuxScene/Scene/Armature/Skeleton3D:mixamorigSpine2", "AuxScene/Scene/Armature/Skeleton3D:mixamorigSpine2001"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_d7cro"]
animation = &"SlowRun"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_fjrip"]
animation = &"PistolIdle"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_w5ck1"]
animation = &"Walking"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_smehm"]
animation = &"Walk"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_twhp3"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ur7pv"]
animation = &"Run"
[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_y4r1p"]
blend_point_0/node = SubResource("AnimationNodeAnimation_fjrip")
blend_point_0/pos = 0.0
blend_point_1/node = SubResource("AnimationNodeAnimation_smehm")
blend_point_1/pos = 0.5
blend_point_2/node = SubResource("AnimationNodeAnimation_ur7pv")
blend_point_2/pos = 1.0
min_space = 0.0
blend_mode = 1
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_d2wvv"]
graph_offset = Vector2(-274.628, -16.111)
nodes/Animation/node = SubResource("AnimationNodeAnimation_y4r1p")
nodes/Animation/position = Vector2(-20, 100)
nodes/Blend2/node = SubResource("AnimationNodeBlend2_d2wvv")
nodes/Blend2/position = Vector2(260, 100)
nodes/BlendSpace1D/node = SubResource("AnimationNodeBlendSpace1D_y4r1p")
nodes/BlendSpace1D/position = Vector2(-40, 280)
nodes/output/position = Vector2(500, 100)
node_connections = [&"Blend2", 0, &"Animation", &"Blend2", 1, &"BlendSpace1D", &"output", 0, &"Blend2"]
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jej6c"]
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_p6dv3"]
xfade_time = 0.1
reset = false
advance_mode = 2
advance_expression = "velocity"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_xh0w6"]
xfade_time = 0.1
reset = false
switch_mode = 1
advance_mode = 2
advance_expression = "is_running()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_vse2m"]
xfade_time = 0.1
reset = false
switch_mode = 1
advance_mode = 2
advance_expression = "not is_running()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_yh7m2"]
xfade_time = 0.1
reset = false
advance_mode = 2
advance_expression = "not velocity"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_h1vpo"]
xfade_time = 0.05
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_f1ej7"]
advance_mode = 2
advance_expression = "is_aiming()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_wqng5"]
xfade_time = 0.1
advance_mode = 2
advance_expression = "not is_aiming()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_n5lxw"]
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_oprun"]
advance_mode = 2
advance_expression = "is_firing()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_3tstq"]
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_a8ls1"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_8s3qg"]
states/Idle/node = SubResource("AnimationNodeAnimation_vilbe")
states/Idle/position = Vector2(311, 100)
states/PistolIdle/node = SubResource("AnimationNodeAnimation_kjlhm")
states/PistolIdle/position = Vector2(311, 207)
states/Shooting/node = SubResource("AnimationNodeAnimation_84wxe")
states/Shooting/position = Vector2(454, 207)
states/SlowRun/node = SubResource("AnimationNodeAnimation_d7cro")
states/SlowRun/position = Vector2(572, 100)
states/Walking/node = SubResource("AnimationNodeAnimation_w5ck1")
states/Walking/position = Vector2(434, 100)
transitions = ["Start", "Idle", SubResource("AnimationNodeStateMachineTransition_twhp3"), "Idle", "Walking", SubResource("AnimationNodeStateMachineTransition_p6dv3"), "Walking", "SlowRun", SubResource("AnimationNodeStateMachineTransition_xh0w6"), "SlowRun", "Walking", SubResource("AnimationNodeStateMachineTransition_vse2m"), "Walking", "Idle", SubResource("AnimationNodeStateMachineTransition_yh7m2"), "Idle", "PistolIdle", SubResource("AnimationNodeStateMachineTransition_h1vpo"), "PistolIdle", "Idle", SubResource("AnimationNodeStateMachineTransition_wqng5"), "PistolIdle", "Shooting", SubResource("AnimationNodeStateMachineTransition_n5lxw"), "Shooting", "PistolIdle", SubResource("AnimationNodeStateMachineTransition_3tstq")]
graph_offset = Vector2(-79, 53)
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_qfm1y"]
advance_mode = 2
advance_expression = "not is_aiming()"
[sub_resource type="SphereShape3D" id="SphereShape3D_64co4"]
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_3v2ag"]
states/Aim/node = SubResource("AnimationNodeAnimation_d2wvv")
states/Aim/position = Vector2(551, 100)
states/Fire/node = SubResource("AnimationNodeAnimation_3v2ag")
states/Fire/position = Vector2(687, 100)
states/Movement/node = SubResource("AnimationNodeBlendTree_d2wvv")
states/Movement/position = Vector2(403, 100)
transitions = ["Start", "Movement", SubResource("AnimationNodeStateMachineTransition_jej6c"), "Movement", "Aim", SubResource("AnimationNodeStateMachineTransition_f1ej7"), "Aim", "Fire", SubResource("AnimationNodeStateMachineTransition_oprun"), "Fire", "Aim", SubResource("AnimationNodeStateMachineTransition_a8ls1"), "Aim", "Movement", SubResource("AnimationNodeStateMachineTransition_qfm1y")]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_sk752"]
animation = &"Idle"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_t4klh"]
animation = &"Walk"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_o2vfb"]
animation = &"Run"
[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_7bso7"]
blend_point_0/node = SubResource("AnimationNodeAnimation_sk752")
blend_point_0/pos = 0.0
blend_point_1/node = SubResource("AnimationNodeAnimation_t4klh")
blend_point_1/pos = 0.5
blend_point_2/node = SubResource("AnimationNodeAnimation_o2vfb")
blend_point_2/pos = 1.0
min_space = 0.0
blend_mode = 1
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_cqw7m"]
advance_mode = 2
advance_expression = "not has_weapon()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_fjrip"]
advance_mode = 2
advance_expression = "has_weapon()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_smehm"]
advance_mode = 2
advance_expression = "not has_weapon()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ur7pv"]
advance_mode = 2
advance_expression = "has_weapon()"
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_5lvsk"]
states/End/position = Vector2(621, 100)
states/Handgun/node = SubResource("AnimationNodeStateMachine_3v2ag")
states/Handgun/position = Vector2(405, 179)
states/Unarmed/node = SubResource("AnimationNodeBlendSpace1D_7bso7")
states/Unarmed/position = Vector2(405, 89)
transitions = ["Start", "Unarmed", SubResource("AnimationNodeStateMachineTransition_cqw7m"), "Unarmed", "Handgun", SubResource("AnimationNodeStateMachineTransition_fjrip"), "Handgun", "Unarmed", SubResource("AnimationNodeStateMachineTransition_smehm"), "Start", "Handgun", SubResource("AnimationNodeStateMachineTransition_ur7pv")]
[node name="Player" type="CharacterBody3D"]
script = ExtResource("2_pdrhn")
[node name="Mesh" parent="." instance=ExtResource("7_fjrip")]
[node name="Skeleton3D" parent="Mesh/AuxScene/Scene/Armature" index="0"]
bones/0/position = Vector3(-1.06432, 98.5161, 1.28562)
bones/0/rotation = Quaternion(0.0437049, -0.455054, -0.0441828, 0.888293)
bones/2/rotation = Quaternion(-0.0551638, 0.0563445, 0.0314511, 0.99639)
bones/4/rotation = Quaternion(0.0240218, 0.0676321, 0.00773834, 0.997391)
bones/6/rotation = Quaternion(0.0374848, 0.0679606, 0.00519961, 0.99697)
bones/8/rotation = Quaternion(-0.419926, 0.506888, -0.571468, -0.490053)
bones/10/rotation = Quaternion(0.378262, 0.0908406, -0.817036, 0.42558)
bones/12/rotation = Quaternion(-2.37487e-08, -1.04156e-07, -0.25919, 0.965826)
bones/14/rotation = Quaternion(-0.217025, 0.380649, 0.184106, 0.879836)
bones/16/rotation = Quaternion(0.491661, 0.0186145, 0.04132, 0.869607)
bones/18/rotation = Quaternion(0.583947, 9.22009e-08, 0.0475734, 0.810396)
bones/20/rotation = Quaternion(0.435138, -7.46222e-08, 0.03545, 0.899666)
bones/24/rotation = Quaternion(0.430214, -0.0354484, 0.142206, 0.89075)
bones/26/rotation = Quaternion(0.825171, 1.546e-07, 0.0672255, 0.560868)
bones/28/rotation = Quaternion(0.16276, -6.10016e-08, 0.0132598, 0.986577)
bones/32/rotation = Quaternion(0.478969, 0.00176994, 0.0701699, 0.875021)
bones/34/rotation = Quaternion(0.753736, -9.22009e-08, 0.0614057, 0.654303)
bones/36/rotation = Quaternion(0.4171, 5.03496e-09, 0.0339805, 0.908225)
bones/40/rotation = Quaternion(0.21981, 0.00370957, 0.0385759, 0.974773)
bones/42/rotation = Quaternion(0.420375, -1.93715e-07, 0.0342473, 0.906704)
bones/44/rotation = Quaternion(0.430986, -3.23344e-08, 0.0351118, 0.901675)
bones/48/rotation = Quaternion(0.349343, 0.0283774, -0.150582, 0.92438)
bones/50/rotation = Quaternion(-0.112075, -0.188988, 0.210821, 0.952511)
bones/52/rotation = Quaternion(-0.271577, -0.018948, 0.408217, 0.871347)
bones/56/rotation = Quaternion(0.100429, 0.0667491, -0.0240202, 0.992412)
bones/58/rotation = Quaternion(0.00594193, 0.164804, 0.0913867, 0.982066)
bones/61/rotation = Quaternion(-0.518834, -0.556127, 0.578182, -0.295363)
bones/63/rotation = Quaternion(0.254827, -0.255068, 0.509372, 0.781373)
bones/65/rotation = Quaternion(2.09548e-09, -1.99941e-08, 0.659355, 0.751832)
bones/67/rotation = Quaternion(-0.169227, -0.371956, -0.363468, 0.837199)
bones/69/rotation = Quaternion(0.128107, -0.173846, 0.152522, 0.964419)
bones/71/rotation = Quaternion(-0.0940495, 0.0712352, 0.0315575, 0.992514)
bones/73/rotation = Quaternion(0.0268879, 0.0186427, 0.218404, 0.97531)
bones/77/rotation = Quaternion(0.271488, -0.0129037, -0.019735, 0.962153)
bones/79/rotation = Quaternion(0.51229, -8.40984e-07, -0.0524978, 0.857207)
bones/81/rotation = Quaternion(0.207034, -1.16677e-07, -0.0212163, 0.978104)
bones/85/rotation = Quaternion(0.354152, -0.0251767, -0.00660215, 0.934826)
bones/87/rotation = Quaternion(0.500314, -8.10251e-07, -0.0512706, 0.864325)
bones/89/rotation = Quaternion(0.335131, -4.84986e-07, -0.0343432, 0.941546)
bones/93/rotation = Quaternion(0.420833, -0.0472764, 0.0235745, 0.905598)
bones/95/rotation = Quaternion(0.50818, -8.50763e-07, -0.0520767, 0.859675)
bones/97/rotation = Quaternion(0.173011, 1.41736e-08, -0.0177296, 0.98476)
bones/101/rotation = Quaternion(0.324573, -0.049477, 0.0773928, 0.94139)
bones/103/rotation = Quaternion(0.491491, -5.96046e-07, -0.0503663, 0.869425)
bones/105/rotation = Quaternion(0.273046, -6.9337e-07, -0.0279808, 0.961594)
bones/109/rotation = Quaternion(-0.126597, 0.13207, 0.981033, 0.0640646)
bones/111/rotation = Quaternion(-0.233629, -0.0744139, 0.00367423, 0.969467)
bones/113/rotation = Quaternion(0.516729, 0.12195, 0.0692569, 0.844584)
bones/115/rotation = Quaternion(0.335242, -6.35498e-08, 2.67434e-07, 0.942132)
bones/119/rotation = Quaternion(0.126352, 0.264053, 0.94116, -0.168904)
bones/121/rotation = Quaternion(-0.273629, -0.0831775, 0.0214499, 0.957992)
bones/123/rotation = Quaternion(0.429761, -0.0809993, -0.0474114, 0.898052)
bones/125/rotation = Quaternion(0.335241, -2.57727e-08, 5.75265e-09, 0.942132)
[node name="RightHand" parent="Mesh/AuxScene/Scene/Armature/Skeleton3D" index="2"]
transform = Transform3D(0.259487, 0.484082, -0.835662, 0.944169, 0.0547265, 0.324883, 0.203003, -0.873309, -0.442854, -3.09716, 140.733, 59.0089)
[node name="Node3D" type="Node3D" parent="Mesh/AuxScene/Scene/Armature/Skeleton3D/RightHand" index="0"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1.25, 0, 0, 0, 1.25, 0, 0, 0, 1.25, 0, 1.25, 0)
shape = SubResource("CapsuleShape3D_1kx10")
[node name="PlayerMesh" parent="." instance=ExtResource("2_rje1f")]
[node name="Skeleton3D" parent="PlayerMesh/Scene/Armature" index="0"]
bones/0/position = Vector3(0.176833, 101.07, 0.38662)
bones/0/rotation = Quaternion(-0.0150423, -0.0236543, -0.0875217, 0.995768)
bones/1/position = Vector3(-1.08778e-06, 8.00974e-08, -5.45755e-07)
bones/2/rotation = Quaternion(-0.0838748, -0.0165437, 0.0900337, 0.992263)
bones/3/position = Vector3(1.2666e-07, 1.38208e-06, 4.63426e-06)
bones/4/rotation = Quaternion(-0.0327278, -0.0169828, 0.0188224, 0.999143)
bones/5/position = Vector3(-8.19564e-07, -1.46851e-05, 4.30644e-06)
bones/6/rotation = Quaternion(-0.0198691, -0.0167323, 0.0188106, 0.999486)
bones/7/position = Vector3(3.57632e-07, -2.42144e-05, -3.53158e-06)
bones/8/rotation = Quaternion(0.517718, -0.542349, 0.561101, 0.3507)
bones/9/position = Vector3(1.93715e-07, -8.76188e-06, -1.82156e-05)
bones/10/position = Vector3(-2.22259e-06, 10.8382, 6.657e-05)
bones/10/rotation = Quaternion(0.522503, -0.16331, -0.0171283, 0.836676)
bones/11/position = Vector3(1.66958e-06, -2.30764e-05, 5.90135e-07)
bones/12/rotation = Quaternion(2.10712e-07, -4.57769e-08, -0.23756, 0.971373)
bones/13/position = Vector3(7.10815e-06, 2.49848e-06, -3.67706e-07)
bones/14/position = Vector3(1.00884e-05, 28.3289, 1.42043e-06)
bones/14/rotation = Quaternion(-0.00790403, -0.149643, -0.0113763, 0.988643)
bones/15/position = Vector3(1.43223e-06, -9.47448e-06, -3.04991e-06)
bones/16/rotation = Quaternion(0.182234, 0.000843696, 0.0176438, 0.983096)
bones/17/position = Vector3(2.78027e-07, -1.63051e-05, 2.7709e-07)
bones/18/position = Vector3(-7.17311e-07, 3.6, -4.46059e-05)
bones/18/rotation = Quaternion(0.176815, 5.96047e-08, 0.0215495, 0.984008)
bones/19/position = Vector3(-1.09796e-06, -1.6639e-05, -1.30592e-05)
bones/20/rotation = Quaternion(0.241434, 3.59646e-08, 0.0294243, 0.969971)
bones/21/position = Vector3(-3.42208e-06, -3.57069e-06, -7.88492e-06)
bones/22/position = Vector3(-2.66578e-06, 2.11579, -6.80612e-06)
bones/23/position = Vector3(1.99676e-06, 2.3176e-06, 1.13522e-06)
bones/24/position = Vector3(-2.81929e-05, 9.5325, 4.46934e-05)
bones/24/rotation = Quaternion(0.161329, 0.00289724, 0.00169867, 0.986895)
bones/25/position = Vector3(-2.64221e-06, 1.33002e-05, 9.27813e-06)
bones/26/position = Vector3(-3.12982e-06, 3.70001, -1.88553e-05)
bones/26/rotation = Quaternion(0.185563, 1.19209e-07, 0.0226154, 0.982372)
bones/27/position = Vector3(4.8121e-06, -1.06792e-05, -1.50226e-05)
bones/28/position = Vector3(3.86115e-06, 2.95001, -1.38305e-05)
bones/28/rotation = Quaternion(0.309155, 0.0152924, 0.0427385, 0.949928)
bones/31/position = Vector3(1.86637e-06, 5.9802e-06, -1.467e-05)
bones/32/rotation = Quaternion(0.226315, 0.00251, 0.0167186, 0.973907)
bones/33/position = Vector3(-2.25109e-06, -9.16777e-06, 1.35742e-05)
bones/34/position = Vector3(-1.61634e-06, 3.37927, -2.16157e-06)
bones/34/rotation = Quaternion(0.141885, -3.35276e-08, 0.017292, 0.989732)
bones/36/position = Vector3(-1.34902e-06, 2.88968, 1.45266e-05)
bones/36/rotation = Quaternion(0.212741, 0.0999272, 0.0484335, 0.970778)
bones/37/position = Vector3(7.45909e-07, -8.48482e-06, 1.51202e-05)
bones/38/position = Vector3(-7.0702e-07, 2.63882, -1.46823e-05)
bones/39/position = Vector3(-4.24683e-07, -3.16713e-06, -1.23643e-05)
bones/40/position = Vector3(2.25983, 9.10828, 0.517866)
bones/40/rotation = Quaternion(0.221989, -0.0014101, 0.0332243, 0.974482)
bones/41/position = Vector3(5.8333e-07, 6.3235e-07, 1.57826e-05)
bones/42/rotation = Quaternion(0.118753, 4.00469e-08, 0.0144729, 0.992818)
bones/43/position = Vector3(-1.30539e-06, 1.28774e-05, 4.90486e-08)
bones/44/rotation = Quaternion(0.215965, -3.09388e-08, 0.0263204, 0.976046)
bones/45/position = Vector3(-2.28086e-07, -1.45823e-06, -4.29744e-07)
bones/48/position = Vector3(2.68185, 2.4648, 1.57399)
bones/48/rotation = Quaternion(0.123917, 0.0616336, -0.155966, 0.978019)
bones/49/position = Vector3(-3.57628e-06, -1.16825e-05, 6.73833e-06)
bones/50/position = Vector3(-7.17277e-06, 4.18897, 1.07578e-06)
bones/50/rotation = Quaternion(-0.0663874, 0.0359793, 0.212625, 0.974212)
bones/52/position = Vector3(-8.77766e-06, 3.41628, -4.79003e-06)
bones/52/rotation = Quaternion(0.0182148, -0.00101305, -0.0121222, 0.99976)
bones/53/position = Vector3(-3.03984e-06, 2.01762e-05, -1.93187e-06)
bones/56/rotation = Quaternion(0.0499111, 0.0123092, -0.0543172, 0.9972)
bones/57/position = Vector3(1.19211e-07, -2.28947e-05, -3.36394e-06)
bones/58/rotation = Quaternion(-0.052403, -0.00615721, 0.00977397, 0.998559)
bones/59/position = Vector3(-1.0431e-07, -1.54506e-05, -1.49384e-06)
bones/61/rotation = Quaternion(0.542862, 0.525191, -0.544763, 0.364292)
bones/62/position = Vector3(5.96046e-08, -6.10948e-07, -7.88433e-06)
bones/63/position = Vector3(3.42725e-07, 10.8377, 3.26269e-05)
bones/63/rotation = Quaternion(0.620858, 0.0663184, -0.093396, 0.775509)
bones/64/position = Vector3(2.4772e-06, 1.24322e-06, 3.17702e-06)
bones/65/position = Vector3(7.81477e-06, 27.8415, 3.26074e-05)
bones/65/rotation = Quaternion(-2.79397e-08, 3.56424e-08, 0.182562, 0.983194)
bones/66/position = Vector3(-3.25318e-06, -4.67625e-06, -1.50252e-06)
bones/67/rotation = Quaternion(0.00482527, 0.107156, 0.0792239, 0.991069)
bones/68/position = Vector3(7.47968e-08, -6.91227e-07, -2.51579e-06)
bones/69/rotation = Quaternion(0.124609, -0.0689143, 0.110773, 0.983592)
bones/70/position = Vector3(1.18017e-05, 1.18017e-05, 1.03254e-05)
bones/71/position = Vector3(-7.12144e-07, 4.18709, 2.40078e-06)
bones/71/rotation = Quaternion(-0.0119962, 0.00347376, -0.104031, 0.994496)
bones/72/position = Vector3(5.48363e-06, -9.44734e-06, -1.48937e-05)
bones/73/position = Vector3(-6.19066e-06, 3.41839, -3.25305e-05)
bones/73/rotation = Quaternion(-0.0740225, -0.0923392, -0.0508103, 0.991672)
bones/74/position = Vector3(3.75509e-06, 1.69277e-05, 9.12723e-07)
bones/75/position = Vector3(2.59013e-06, 2.5806, 1.43079e-06)
bones/77/rotation = Quaternion(0.156512, -0.00225023, -0.00453302, 0.987663)
bones/78/position = Vector3(2.34035e-07, 6.61208e-07, -1.22018e-06)
bones/79/position = Vector3(-2.66701e-07, 3.7, -4.303e-07)
bones/79/rotation = Quaternion(0.190766, -3.40398e-07, -0.0230217, 0.981366)
bones/80/position = Vector3(-3.04282e-06, -2.24161e-06, -1.52532e-05)
bones/81/rotation = Quaternion(0.258172, -4.55405e-07, -0.0311564, 0.965596)
bones/84/position = Vector3(-1.56742e-06, -5.37828e-06, 1.60567e-05)
bones/85/rotation = Quaternion(0.106515, -0.00125608, -0.00100455, 0.99431)
bones/86/position = Vector3(-2.09158e-07, 7.10476e-06, -1.37234e-05)
bones/87/rotation = Quaternion(0.197488, -2.75672e-07, -0.0238329, 0.980016)
bones/88/position = Vector3(-1.44259e-06, -2.81852e-06, -1.08586e-06)
bones/89/rotation = Quaternion(0.248664, -3.51151e-07, -0.0300088, 0.968125)
bones/90/position = Vector3(-1.67251e-06, -5.69229e-06, 4.16067e-06)
bones/92/position = Vector3(-2.07638e-06, -8.50701e-06, 1.83102e-06)
bones/93/rotation = Quaternion(0.165938, -0.000525475, -0.0168974, 0.985991)
bones/94/position = Vector3(-1.24702e-06, -4.42364e-06, 5.52884e-07)
bones/95/rotation = Quaternion(0.183817, -3.25963e-07, -0.022183, 0.98271)
bones/96/position = Vector3(-2.19045e-06, -7.68091e-06, -2.55365e-06)
bones/97/position = Vector3(1.62425e-06, 2.95, 1.38972e-05)
bones/97/rotation = Quaternion(0.279327, -3.98396e-07, -0.0337093, 0.959604)
bones/98/position = Vector3(-2.69965e-06, -1.43062e-07, 1.26105e-06)
bones/99/position = Vector3(-2.845e-05, 2.64431, 1.98053e-06)
bones/100/position = Vector3(6.57979e-07, -4.74934e-06, 1.44472e-05)
bones/101/position = Vector3(3.80627, 8.07779, 0.486894)
bones/101/rotation = Quaternion(0.167287, 0.00473829, -0.0475308, 0.984751)
bones/102/position = Vector3(-2.33662e-06, 1.08604e-05, 1.6658e-05)
bones/103/rotation = Quaternion(0.213501, 0.0075146, 0.00933899, 0.976869)
bones/104/position = Vector3(1.84285e-06, 5.76279e-06, -1.71906e-05)
bones/105/rotation = Quaternion(0.236478, -2.93264e-07, -0.028538, 0.971218)
bones/106/position = Vector3(1.48522e-06, -3.60209e-06, 1.44012e-05)
bones/107/position = Vector3(4.3816e-06, 2.12554, -2.07618e-05)
bones/108/position = Vector3(-4.91738e-07, 8.79425e-06, -1.38031e-06)
bones/109/rotation = Quaternion(-0.0630378, 0.0598809, 0.992443, -0.0865868)
bones/110/position = Vector3(-1.06222e-06, 3.19319e-05, -1.56533e-06)
bones/111/rotation = Quaternion(-0.196435, 0.0643838, 0.0150037, 0.978286)
bones/112/position = Vector3(2.91388e-07, 4.25241e-06, -2.20301e-06)
bones/113/rotation = Quaternion(0.531598, -0.0326135, -0.0080297, 0.846331)
bones/115/rotation = Quaternion(0.341414, 3.45756e-05, 1.21776e-05, 0.939913)
bones/119/rotation = Quaternion(0.0470296, 0.147565, 0.980808, -0.118443)
bones/120/position = Vector3(-8.23132e-07, -4.34501e-06, -1.59527e-06)
bones/121/rotation = Quaternion(-0.322286, -0.0563026, -0.0190235, 0.944775)
bones/122/position = Vector3(-6.62286e-07, 6.482e-06, 2.36121e-07)
bones/123/rotation = Quaternion(0.575107, -0.0263868, 0.00510642, 0.817637)
bones/125/rotation = Quaternion(0.324665, 3.72159e-05, 1.37132e-05, 0.945829)
[node name="Input" type="Node3D" parent="."]
script = ExtResource("3_x6527")
min_range = 0.5
[node name="AnimationTree" type="AnimationTree" parent="."]
root_node = NodePath("../PlayerMesh")
tree_root = SubResource("AnimationNodeStateMachine_8s3qg")
advance_expression_base_node = NodePath("..")
anim_player = NodePath("../PlayerMesh/AnimationPlayer")
script = ExtResource("3_26yay")
[node name="Interactor" type="Area3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 1)
input_ray_pickable = false
@ -249,4 +211,19 @@ shape = SubResource("SphereShape3D_64co4")
[node name="Inventory" type="Node" parent="."]
script = ExtResource("6_jscba")
[editable path="PlayerMesh"]
[node name="EquippedWeapon" type="Node" parent="."]
script = ExtResource("6_eg2om")
_transform_parent = NodePath("../Mesh/AuxScene/Scene/Armature/Skeleton3D/RightHand/Node3D")
[node name="AnimationTree" type="AnimationTree" parent="."]
root_node = NodePath("../Mesh")
tree_root = SubResource("AnimationNodeStateMachine_5lvsk")
advance_expression_base_node = NodePath("..")
anim_player = NodePath("../Mesh/AnimationPlayer")
parameters/Handgun/Movement/Blend2/blend_amount = 1.0
parameters/Handgun/Movement/BlendSpace1D/blend_position = 0.229277
parameters/Unarmed/blend_position = 0.872134
script = ExtResource("3_26yay")
move_speed_expression = "move_speed()"
[editable path="Mesh"]

View file

@ -1,181 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://b1vb3py5av0e3"]
[ext_resource type="PackedScene" uid="uid://05nocsdvnsy5" path="res://assets/player2.glb" id="1_5mcnn"]
[node name="PlayerMesh" instance=ExtResource("1_5mcnn")]
[node name="Skeleton3D" parent="Scene/Armature" index="0"]
bones/0/position = Vector3(0.17945, 104.41, 0.110052)
bones/0/rotation = Quaternion(-0.0406521, -0.0416971, -0.0129259, 0.998219)
bones/0/scale = Vector3(1, 1, 1)
bones/1/position = Vector3(5.96109e-08, -7.79423e-06, 8.06525e-07)
bones/2/rotation = Quaternion(-0.0597369, 0.00111039, 0.00642272, 0.998193)
bones/2/scale = Vector3(1, 1, 1)
bones/3/position = Vector3(-2.98023e-07, -1.34446e-05, 2.14577e-06)
bones/4/rotation = Quaternion(0.0409263, 0.00151155, 0.0114956, 0.999095)
bones/4/scale = Vector3(1, 1, 1)
bones/5/position = Vector3(1.63912e-07, 2.08151e-07, 3.01749e-07)
bones/6/rotation = Quaternion(0.0537973, 0.00165954, 0.0114752, 0.998485)
bones/6/scale = Vector3(1, 1, 1)
bones/7/position = Vector3(-5.96042e-07, -2.79844e-05, -6.33299e-07)
bones/8/rotation = Quaternion(0.561827, -0.587188, 0.4308, 0.392392)
bones/8/scale = Vector3(1, 1, 1)
bones/9/position = Vector3(1.63913e-06, -1.72853e-06, 2.13917e-05)
bones/10/position = Vector3(2.77566e-06, 10.8382, 6.21936e-05)
bones/10/rotation = Quaternion(0.546062, -0.128743, -0.247847, 0.789819)
bones/10/scale = Vector3(1, 1, 1)
bones/11/position = Vector3(-3.33721e-06, -2.59971e-05, -4.23144e-07)
bones/12/rotation = Quaternion(-1.44821e-07, 1.29284e-07, -0.269901, 0.962888)
bones/13/position = Vector3(4.32435e-07, 3.89919e-06, 7.05178e-07)
bones/14/position = Vector3(7.82341e-06, 28.3288, -1.32138e-06)
bones/14/rotation = Quaternion(-0.111071, -0.0606597, 0.117823, 0.984937)
bones/14/scale = Vector3(1, 1, 1)
bones/15/position = Vector3(1.78986e-06, 7.87047e-06, 1.65885e-06)
bones/16/rotation = Quaternion(0.410799, 0.0410545, -0.0191872, 0.910599)
bones/16/scale = Vector3(1, 1, 1)
bones/17/position = Vector3(5.01544e-07, -6.299e-06, 3.963e-07)
bones/18/position = Vector3(-4.8526e-07, 3.60001, -4.86888e-05)
bones/18/rotation = Quaternion(0.53131, 0.0228324, -0.106782, 0.840111)
bones/18/scale = Vector3(1, 1, 1)
bones/19/position = Vector3(3.32548e-07, -8.41357e-06, -2.27747e-05)
bones/20/rotation = Quaternion(-4.9514e-08, 5.57123e-08, -1.76427e-07, 1)
bones/21/position = Vector3(-1.54454e-06, -7.68341e-06, -8.74918e-06)
bones/22/position = Vector3(-8.60441e-07, 2.11579, -1.07681e-05)
bones/22/rotation = Quaternion(6.43738e-08, 0.00156918, -4.10172e-05, 0.999999)
bones/22/scale = Vector3(1, 1, 1)
bones/23/position = Vector3(-2.92063e-06, 7.30623e-07, -3.37238e-06)
bones/24/position = Vector3(-2.72793e-05, 9.53252, 4.71968e-05)
bones/24/rotation = Quaternion(0.339952, 0.0300464, 0.0273285, 0.939565)
bones/24/scale = Vector3(1, 1, 1)
bones/25/position = Vector3(-9.73276e-07, 9.30667e-06, 1.7444e-05)
bones/26/position = Vector3(-2.40773e-06, 3.70001, -1.51598e-05)
bones/26/rotation = Quaternion(0.430758, 0.165335, 0.0714135, 0.884314)
bones/27/position = Vector3(2.42792e-06, -5.07634e-06, -1.79432e-05)
bones/28/position = Vector3(5.23295e-07, 2.95001, -1.36814e-05)
bones/28/rotation = Quaternion(3.76456e-09, -9.34081e-09, -3.22034e-08, 1)
bones/30/rotation = Quaternion(-1.54606e-07, 0.000928791, 0.000166436, 1)
bones/31/position = Vector3(6.74278e-07, 1.0987e-05, -1.06914e-05)
bones/32/rotation = Quaternion(0.367356, 0.012829, -0.0137641, 0.92989)
bones/33/position = Vector3(-2.16168e-06, -9.28698e-06, 1.61968e-05)
bones/34/position = Vector3(-2.08148e-06, 3.37928, -2.75762e-06)
bones/34/rotation = Quaternion(0.435237, 0.0202325, -0.0616527, 0.897975)
bones/34/scale = Vector3(1, 1, 1)
bones/36/position = Vector3(5.32687e-06, 2.88968, 1.89373e-05)
bones/36/rotation = Quaternion(6.7077e-08, 6.14505e-08, -1.0756e-07, 1)
bones/37/position = Vector3(1.10354e-06, -4.4019e-06, 1.37493e-05)
bones/38/position = Vector3(-1.83442e-06, 2.63883, -1.48906e-05)
bones/38/rotation = Quaternion(1.16653e-07, 0.000145825, -0.00079924, 1)
bones/38/scale = Vector3(1, 1, 1)
bones/39/position = Vector3(-4.24683e-07, 1.03333e-05, -2.27057e-05)
bones/40/position = Vector3(2.25983, 9.1083, 0.517871)
bones/40/rotation = Quaternion(0.230758, 0.0232, 0.0553016, 0.971161)
bones/40/scale = Vector3(1, 1, 1)
bones/41/position = Vector3(-1.50283e-06, -3.18235e-06, 1.64979e-05)
bones/42/rotation = Quaternion(0.345931, -0.0275399, 0.00615904, 0.937835)
bones/43/position = Vector3(2.44329e-07, 8.88386e-06, -6.62667e-06)
bones/44/rotation = Quaternion(7.46085e-09, -1.39777e-08, -2.75613e-08, 1)
bones/45/position = Vector3(-4.96307e-07, 1.11183e-05, 2.6697e-06)
bones/46/rotation = Quaternion(-8.72723e-08, 0.00100258, 8.70361e-05, 0.999999)
bones/46/scale = Vector3(1, 1, 1)
bones/48/position = Vector3(2.68185, 2.4648, 1.57399)
bones/48/rotation = Quaternion(0.253233, 0.0269746, -0.19885, 0.946364)
bones/48/scale = Vector3(1, 1, 1)
bones/49/position = Vector3(-4.76836e-07, -4.29153e-06, 8.58607e-06)
bones/50/position = Vector3(-5.36506e-06, 4.18898, 1.80082e-06)
bones/50/rotation = Quaternion(-0.0236439, 0.0331235, 0.0393129, 0.998398)
bones/50/scale = Vector3(1, 1, 1)
bones/52/position = Vector3(-8.58953e-06, 3.41627, -3.79061e-06)
bones/52/rotation = Quaternion(1.62159e-06, -0.000806941, 3.60843e-07, 1)
bones/53/position = Vector3(-7.33137e-06, 1.96993e-05, -3.36238e-06)
bones/54/rotation = Quaternion(0.00577409, -0.11751, -0.0487441, 0.991858)
bones/56/rotation = Quaternion(-0.168671, 0.00146631, -0.00322634, 0.985666)
bones/56/scale = Vector3(1, 1, 1)
bones/57/position = Vector3(-1.48998e-08, -1.55101e-05, -2.81259e-07)
bones/58/rotation = Quaternion(0.116994, 0.0330545, -0.00432665, 0.992573)
bones/59/position = Vector3(4.47016e-08, -3.2247e-05, -2.96597e-06)
bones/60/rotation = Quaternion(3.91155e-08, 3.7787e-08, 2.9976e-15, 1)
bones/61/rotation = Quaternion(0.506672, 0.632248, -0.512417, 0.28456)
bones/61/scale = Vector3(1, 1, 1)
bones/62/position = Vector3(-2.02656e-06, -3.57628e-07, -4.18441e-05)
bones/63/position = Vector3(7.15469e-08, 10.8377, 1.51746e-05)
bones/63/rotation = Quaternion(0.502967, 0.244286, 0.329048, 0.76097)
bones/64/position = Vector3(3.60969e-06, 1.52503e-05, 4.33931e-06)
bones/65/position = Vector3(6.08624e-06, 27.8415, 3.61837e-05)
bones/65/rotation = Quaternion(1.00117e-07, -9.33561e-08, 0.240972, 0.970532)
bones/66/position = Vector3(1.5152e-06, 5.09353e-07, 1.06806e-07)
bones/67/rotation = Quaternion(-0.124955, -0.15428, -0.118697, 0.97288)
bones/68/position = Vector3(-1.47492e-06, 9.18099e-07, 8.22066e-07)
bones/69/rotation = Quaternion(0.223335, 0.00464231, 0.100994, 0.969485)
bones/69/scale = Vector3(1, 1, 1)
bones/70/position = Vector3(3.93391e-06, -3.12924e-06, 1.2352e-05)
bones/71/position = Vector3(-7.3569e-06, 4.18708, 3.80831e-06)
bones/71/rotation = Quaternion(-0.017028, -0.0337403, -0.0322282, 0.998766)
bones/72/position = Vector3(5.96047e-08, -1.01924e-05, -1.82316e-05)
bones/73/position = Vector3(-7.20031e-06, 3.41838, -3.40019e-05)
bones/73/rotation = Quaternion(-2.43768e-06, 0.000745857, 5.4902e-07, 1)
bones/73/scale = Vector3(1, 1, 1)
bones/74/position = Vector3(-3.96371e-06, -8.34465e-06, 1.30411e-07)
bones/75/position = Vector3(-3.2532e-06, 2.58059, 3.56767e-06)
bones/75/rotation = Quaternion(0.0051477, 0.122682, 0.041651, 0.991558)
bones/75/scale = Vector3(1, 1, 1)
bones/77/rotation = Quaternion(0.329022, -0.00440169, -0.0369186, 0.94359)
bones/77/scale = Vector3(1, 1, 1)
bones/78/position = Vector3(4.72453e-07, -1.04497e-06, 3.59342e-07)
bones/79/position = Vector3(-2.66038e-07, 3.7, 8.95903e-07)
bones/79/rotation = Quaternion(0.28229, 0.0283846, 0.000264906, 0.958909)
bones/79/scale = Vector3(1, 1, 1)
bones/80/position = Vector3(-1.96994e-06, 1.6327e-06, -1.63261e-05)
bones/81/rotation = Quaternion(-3.65055e-07, -4.16772e-09, -6.83649e-08, 1)
bones/83/rotation = Quaternion(-4.89366e-09, -0.000377568, -1.2974e-05, 1)
bones/84/position = Vector3(-4.94532e-07, -1.87893e-05, 1.52819e-05)
bones/85/rotation = Quaternion(0.331909, -0.019802, -0.0105555, 0.943044)
bones/85/scale = Vector3(1, 1, 1)
bones/86/position = Vector3(-2.09158e-07, -2.31277e-06, -1.46174e-05)
bones/87/rotation = Quaternion(0.403889, -0.00181236, 0.0290873, 0.914344)
bones/87/scale = Vector3(1, 1, 1)
bones/88/position = Vector3(2.26344e-07, -5.1729e-06, -4.39392e-06)
bones/89/rotation = Quaternion(4.04652e-07, 8.72496e-12, 6.58802e-08, 1)
bones/90/position = Vector3(-2.41998e-07, -4.32138e-06, -4.24358e-06)
bones/91/rotation = Quaternion(2.85187e-08, -0.00102416, 2.78559e-05, 0.999999)
bones/92/position = Vector3(3.67407e-07, 1.44696e-06, -5.79837e-06)
bones/93/rotation = Quaternion(0.331827, -0.0487858, 0.034802, 0.941435)
bones/94/position = Vector3(1.83496e-07, -1.69704e-05, -3.62689e-06)
bones/95/rotation = Quaternion(0.547972, -0.0207689, 0.058348, 0.834201)
bones/95/scale = Vector3(1, 1, 1)
bones/96/position = Vector3(-6.40724e-07, 1.08097e-06, 1.03508e-05)
bones/97/position = Vector3(1.86266e-06, 2.95, 2.9305e-05)
bones/97/rotation = Quaternion(-1.44502e-15, 1.80445e-09, -3.60028e-08, 1)
bones/98/position = Vector3(7.57416e-07, -2.73586e-06, -1.18274e-06)
bones/99/position = Vector3(-2.38102e-05, 2.64431, -7.72471e-06)
bones/100/position = Vector3(-1.36858e-06, -8.86206e-06, 9.053e-06)
bones/101/position = Vector3(3.80626, 8.0778, 0.486895)
bones/101/rotation = Quaternion(0.379958, -0.0550092, 0.0382487, 0.922574)
bones/101/scale = Vector3(1, 1, 1)
bones/102/position = Vector3(-1.08492e-06, 2.92186e-05, 1.50487e-05)
bones/103/rotation = Quaternion(0.582059, -0.0103286, 0.0735094, 0.809751)
bones/104/position = Vector3(-1.73342e-06, -1.47918e-06, -2.0886e-05)
bones/105/rotation = Quaternion(-5.4723e-08, -3.14058e-09, 1.77999e-07, 1)
bones/106/position = Vector3(8.89177e-07, -7.90852e-06, 1.76198e-05)
bones/107/position = Vector3(2.5899e-06, 2.12554, 9.70504e-08)
bones/107/rotation = Quaternion(-2.31341e-07, -0.000782879, -0.000295457, 1)
bones/107/scale = Vector3(1, 1, 1)
bones/108/position = Vector3(8.49366e-07, 5.665e-06, 3.62648e-06)
bones/109/rotation = Quaternion(-0.036333, 0.0217706, 0.999101, 0.00199951)
bones/109/scale = Vector3(1, 1, 1)
bones/110/position = Vector3(-1.3528e-06, 3.43757e-05, -4.54129e-08)
bones/111/rotation = Quaternion(-0.143928, 0.000177422, 0.00374932, 0.989581)
bones/112/position = Vector3(-4.23869e-07, 1.24792e-07, 6.58015e-07)
bones/113/rotation = Quaternion(0.495013, 0.131615, -0.0439782, 0.857732)
bones/115/rotation = Quaternion(0.335413, 0.00425432, -0.000217396, 0.942062)
bones/115/scale = Vector3(1, 1, 1)
bones/117/rotation = Quaternion(2.98097e-08, 0.0115715, 3.46601e-10, 0.999933)
bones/119/rotation = Quaternion(0.119179, 0.0314785, 0.992322, -0.0101509)
bones/119/scale = Vector3(1, 1, 1)
bones/120/position = Vector3(8.86776e-07, -4.30776e-06, 1.57868e-06)
bones/121/rotation = Quaternion(-0.0940526, 0.000144511, -0.0022175, 0.995565)
bones/121/scale = Vector3(1, 1, 1)
bones/122/position = Vector3(-8.41099e-07, -1.2368e-06, 3.5533e-07)
bones/123/rotation = Quaternion(0.451014, 0.00101661, 0.0176655, 0.892342)
bones/123/scale = Vector3(1, 1, 1)
bones/125/rotation = Quaternion(0.335216, 0.000625836, -1.98777e-05, 0.942141)
bones/127/rotation = Quaternion(1.4904e-08, -0.0119058, -1.76878e-10, 0.999929)

10
scenes/player_mesh3.tscn Normal file
View file

@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://sgc1gxq4osag"]
[ext_resource type="PackedScene" uid="uid://05nocsdvnsy5" path="res://assets/player2.glb" id="1_t4ilm"]
[node name="AuxScene2" instance=ExtResource("1_t4ilm")]
[node name="RightHand" type="BoneAttachment3D" parent="AuxScene/Scene/Armature/Skeleton3D" index="2"]
transform = Transform3D(0.678924, 0.327226, -0.657255, 0.571861, 0.325755, 0.752899, 0.460473, -0.88702, 0.0340353, -5.60212, 89.2255, 32.2557)
bone_name = "mixamorigRightHandMiddle2"
bone_idx = 26

72
src/annotations.ts Normal file
View file

@ -0,0 +1,72 @@
import { Node, PropertyHint, Variant } from 'godot'
import { export_, onready as g_onready } from 'godot.annotations'
const get_node_from_key = (key: string, node: Node) => {
const path = node.get(key)
if (path == null) {
throw new Error(`${key} is null`)
}
return node.get_node(path)
}
export function export_scene() {
return export_resource('PackedScene')
}
export function export_resource(type: string = '') {
return export_(Variant.Type.TYPE_STRING, { hint: PropertyHint.PROPERTY_HINT_RESOURCE_TYPE, hint_string: type })
}
export function export_expression() {
return export_(Variant.Type.TYPE_STRING, { hint: PropertyHint.PROPERTY_HINT_EXPRESSION })
}
export function export_node<T extends Node>(defaultNode?: string) {
return function(target: T, key: string) {
const meta_key = `_${key}`
//Reflect.set(target, meta_key, defaultNode || '')
export_(Variant.Type.TYPE_NODE_PATH)(target, meta_key)
onready((node: Node) => get_node_from_key(meta_key, node))(target, key)
}
}
export function onready<T extends Node, ValueType>(
evaluator: ((node: T) => ValueType) | string
) {
if (typeof evaluator === 'string') {
return g_onready(evaluator)
}
return function(target: T, property: string) {
const handlersKey = '$onready:handlers'
let handlers = Reflect.get(target, handlersKey) as {
property: string
evaluator: (node: T) => ValueType
}[]
if (!handlers) {
handlers = []
Reflect.set(target, handlersKey, handlers)
const old_ready: () => void = Reflect.get(target, '_ready') || (() => { })
Reflect.defineProperty(target, '_ready', {
value: function() {
for (const { evaluator, property } of handlers) {
this[property] = evaluator(this)
}
old_ready.call(this)
}
})
}
handlers.push({ evaluator, property })
}
}

1
src/annotations.ts.uid Normal file
View file

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

View file

@ -0,0 +1,38 @@
import { GError, Node, Resource, ResourceLoader } from 'godot'
export default class AsyncResourceLoader extends Node {
private static _instance: AsyncResourceLoader
static get instance() {
return this._instance
}
_ready(): void {
AsyncResourceLoader._instance = this
}
load<T extends Resource>(path: string, hint_string: string = ''): Promise<T> {
return new Promise(async (resolve, reject) => {
const err = ResourceLoader.load_threaded_request(path, hint_string)
if (err != GError.OK) {
return reject(new Error(`failed to load ${path}`))
}
const get_status = () => ResourceLoader.load_threaded_get_status(path)
let status = get_status()
while (status === ResourceLoader.ThreadLoadStatus.THREAD_LOAD_IN_PROGRESS) {
await this.get_tree().process_frame.as_promise()
status = get_status()
}
if (get_status() === ResourceLoader.ThreadLoadStatus.THREAD_LOAD_LOADED) {
return resolve(ResourceLoader.load_threaded_get(path) as T)
} else {
return reject(new Error(`failed to load ${path}`))
}
})
}
}

View file

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

View file

@ -0,0 +1 @@
uid://873j1tuu3j6d

21
src/damage_source.ts Normal file
View file

@ -0,0 +1,21 @@
import { float64, Node, Node3D, NodePath, PackedStringArray, Variant } from 'godot'
import { Damageable } from './health'
import { export_ } from 'godot.annotations'
export default class DamageSource extends Node3D {
@export_(Variant.Type.TYPE_FLOAT)
amount: float64 = 0
@export_(Variant.Type.TYPE_NODE_PATH)
source = new NodePath('.')
_source_node!: Node
_ready(): void {
this._source_node = this.get_node(this.source)
}
damage_target(target: Damageable) {
target.apply_damage(this._source_node, this.amount)
}
}

1
src/damage_source.ts.uid Normal file
View file

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

1
src/debug_draw.ts.uid Normal file
View file

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

68
src/equipped_weapon.ts Normal file
View file

@ -0,0 +1,68 @@
import { GArray, Node, Node3D, PackedScene, Signal1, Vector3 } from 'godot'
import { export_file, signal } from 'godot.annotations'
import { export_node } from './annotations'
import Weapon from './weapon'
import AsyncResourceLoader from './async_resource_loader'
export default class EquippedWeapon extends Node {
@export_file('*.tres')
starting_weapon?: string
_starting_weapon?: Weapon
@export_node()
transform_parent!: Node
_equipped_weapon?: Weapon
_has_equipped_weapon: boolean = false
@signal()
equipped!: Signal1<Weapon>
@signal()
unequipped!: Signal1<Weapon>
has_equipped_weapon(): boolean {
return this._has_equipped_weapon
}
_ready(): void {
if (this.starting_weapon != null) {
AsyncResourceLoader.instance.load<Weapon>(this.starting_weapon, 'Weapon').then(weapon => this.equip(weapon))
}
}
unequip() {
if (this._equipped_weapon != null) {
const previous = this._equipped_weapon
this._equipped_weapon = undefined
this._has_equipped_weapon = false
this.unequipped.emit(previous)
}
}
_parent_scene_to_transform(scene: PackedScene) {
console.log('loaded', scene.resource_name)
const children: GArray<Node> = this.transform_parent.get_children()
for (const child of children) {
child.queue_free()
}
const node = scene.instantiate() as Node3D
this.add_child(node)
node.reparent(this.transform_parent, false)
}
equip(weapon: Weapon) {
console.log('weapon scene', weapon, weapon.scene)
AsyncResourceLoader.instance.load<PackedScene>(weapon.scene, 'PackedScene').then(scene => this._parent_scene_to_transform(scene))
if (this._has_equipped_weapon) {
this.unequip()
}
this._has_equipped_weapon = true
this._equipped_weapon = weapon
this.equipped.emit(weapon)
}
}

View file

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

27
src/health.ts Normal file
View file

@ -0,0 +1,27 @@
import { Node, Variant } from 'godot'
import { export_ } from 'godot.annotations'
export interface Damageable {
apply_damage(source: any, amount: number): void
}
export interface Recoverable {
apply_recovery(source: any, amount: number): void
}
export default class Health extends Node implements Damageable, Recoverable {
@export_(Variant.Type.TYPE_FLOAT)
private _max_health: number = 100
@export_(Variant.Type.TYPE_FLOAT)
private _current_health: number = 0
apply_damage(_source: any, amount: number): void {
this._current_health = Math.max(0, this._current_health - amount)
}
apply_recovery(_source: any, amount: number): void {
this._current_health = Math.min(this._max_health, this._current_health + amount)
}
}

1
src/health.ts.uid Normal file
View file

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

1
src/input_buffer.ts.uid Normal file
View file

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

1
src/interactable.ts.uid Normal file
View file

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

View file

@ -1,7 +1,7 @@
import { Node3D, Variant } from 'godot'
import { export_ } from 'godot.annotations'
import Interactor from '../interactor'
import ItemData from '../item_data'
import Item from '../item'
import Inventory from '../inventory'
export default class Door extends Node3D {
@ -11,8 +11,8 @@ export default class Door extends Node3D {
@export_(Variant.Type.TYPE_BOOL)
readonly requires_key: boolean = false
@export_(Variant.Type.TYPE_OBJECT, { class_: ItemData })
readonly key_item?: ItemData
@export_(Variant.Type.TYPE_OBJECT, { class_: Item })
readonly key_item?: Item
open(interactor: Interactor): void {
console.log('trying to open...')

View file

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

1
src/interactor.ts.uid Normal file
View file

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

View file

@ -1,5 +1,5 @@
import { clampi, Node, StringName } from 'godot'
import ItemData from './item_data'
import ItemData from './item'
import { GArrayEnumerator } from './collection/enumerable'
import { Enumerable } from '../addons/enumerable-ts/src/index'
@ -10,10 +10,6 @@ class ItemInstance {
return this.resource.name
}
get type() {
return this.resource.type
}
get max_quantity() {
return this.resource.max_quantity
}

1
src/inventory.ts.uid Normal file
View file

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

16
src/item.ts Normal file
View file

@ -0,0 +1,16 @@
import { Resource, StringName, Variant } from 'godot'
import { export_, export_enum, export_multiline } from 'godot.annotations'
export type ItemType = number
export default class Item extends Resource {
@export_(Variant.Type.TYPE_STRING_NAME)
readonly name: StringName = ''
@export_multiline()
readonly description: string = ''
@export_(Variant.Type.TYPE_INT)
readonly max_quantity: number = 99
}

1
src/item.ts.uid Normal file
View file

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

View file

@ -1,18 +1,12 @@
import { Resource, StringName, Variant } from 'godot'
import { export_, export_enum, export_multiline } from 'godot.annotations'
import { export_, export_multiline } from 'godot.annotations'
enum ItemType {
None,
Key
}
export type ItemType = number
export default class ItemData extends Resource {
export default class Item extends Resource {
@export_(Variant.Type.TYPE_STRING_NAME)
readonly name: StringName = ''
@export_enum(ItemType)
readonly type: ItemType = ItemType.None
@export_multiline()
readonly description: string = ''

1
src/item_data.ts.uid Normal file
View file

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

View file

@ -1,6 +1,6 @@
import { Node, Variant } from 'godot'
import { export_, export_range } from 'godot.annotations'
import ItemData from './item_data'
import ItemData from './item'
import Interactor from './interactor'
import Inventory from './inventory'

1
src/item_pickup.ts.uid Normal file
View file

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

1
src/main_camera.ts.uid Normal file
View file

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

1
src/message_bus.ts.uid Normal file
View file

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

View file

@ -1,22 +1,26 @@
import { AnyCallable, AnySignal, Callable, Callable0, Callable1, Camera3D, CharacterBody3D, Color, float64, NodePath, ProjectSettings, Signal, Signal0, Signal1, Variant, Vector2, Vector3 } from 'godot'
import { Callable, Callable0, Callable1, CharacterBody3D, Color, float64, ProjectSettings, Variant, Vector2, Vector3 } from 'godot'
import { export_, help, onready } from 'godot.annotations'
import PlayerInput from './player_input'
import DebugDraw from './debug_draw'
import Interactor from './interactor'
import PlayerAnimation, { PlayerAnimationName } from './player_animation'
import EquippedWeapon from './equipped_weapon'
export default class Player extends CharacterBody3D {
readonly gravity = ProjectSettings.get_setting('physics/3d/default_gravity')
@onready("Input")
@onready('Input')
readonly player_input!: PlayerInput
@onready("AnimationTree")
@onready('AnimationTree')
readonly player_animation!: PlayerAnimation
@onready("Interactor")
@onready('Interactor')
readonly interactor!: Interactor
@onready('EquippedWeapon')
readonly equipped_weapon!: EquippedWeapon
@help('Forward walk speed in units per second')
@export_(Variant.Type.TYPE_FLOAT)
readonly walk_speed = 3
@ -35,6 +39,16 @@ export default class Player extends CharacterBody3D {
readonly aim_turn_speed = 2
private _aim_rotation_speed = 2 * Math.PI * 2
move_speed() {
if (!this.is_moving()) {
return 0
} else if (this.is_running()) {
return 1
} else {
return 0.5
}
}
is_moving() {
return !this.velocity.is_zero_approx()
}
@ -43,12 +57,16 @@ export default class Player extends CharacterBody3D {
return this.player_input.is_running && this.is_moving()
}
has_weapon() {
return this.equipped_weapon?.has_equipped_weapon() ?? false
}
is_aiming() {
return this.player_input.is_aiming && !this.is_moving()
return this.player_input.is_aiming && this.has_weapon() && !this.is_moving()
}
is_firing() {
return this._wants_to_fire
return this._wants_to_fire && this.is_aiming()
}
private _can_act: boolean = true
@ -172,10 +190,9 @@ export default class Player extends CharacterBody3D {
// rotate_over_time_toward method
// right now, both rotate instantly
private _aim_toward(delta: float64) {
// TODO: this performs a costly sqrt operation. necessary?
const look = this.player_input.look_direction.project(this.global_position)
look.y = this.global_position.y
this.look_at(look, Vector3.UP, true)
const look = this.player_input.look_direction.value
const look3 = new Vector3(look.x, this.global_position.y, look.y)
this.look_at(look3, Vector3.UP, true)
}
_physics_process(delta: float64): void {
@ -185,7 +202,8 @@ export default class Player extends CharacterBody3D {
return
}
if (this.player_input.is_aiming) {
// FIXME: this sucks, state machine?
if (this.has_weapon() && this.player_input.is_aiming) {
this.velocity = Vector3.ZERO
this._aim_toward(delta)
return

1
src/player.ts.uid Normal file
View file

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

View file

@ -1,28 +1,73 @@
import { AnimationTree, float64 } from 'godot'
import { AnimationTree, Expression, float64, GArray, GError, Node } from 'godot'
import Player from './player'
import PlayerInput from './player_input'
import { onready } from 'godot.annotations'
import { export_expression, onready } from './annotations'
export const PlayerAnimationName = Object.freeze({
Idle: 'Idle',
Walk: 'Walking',
Run: 'SlowRun',
Walk: 'Walk',
Run: 'Run',
Interact: 'Interact',
Aim: 'PistolIdle',
Fire: 'Shooting'
Fire: 'Fire'
} as const)
const expr = (src: string) => {
if (!src) {
return
}
const expr = new Expression()
const err = expr.parse(src)
if (err !== GError.OK) {
throw new Error(`Unable to parse expression: ${expr.get_error_text()}`)
}
return expr
}
const empty = new GArray()
export default class PlayerAnimation extends AnimationTree {
//private static Interact = 'parameters/conditions/interact'
private static Movement = 'parameters/Movement/blend_position'
//private static Movement = 'parameters/Movement/blend_position'
private static Movement = ['parameters/Unarmed/blend_position', 'parameters/Handgun/Movement/BlendSpace1D/blend_position']
@export_expression()
readonly fire_expression: string = ''
@export_expression()
readonly move_speed_expression: string = ''
@onready('../')
player!: Player
readonly player!: Player
@onready('../Input')
readonly player_input!: PlayerInput
_process(_delta: float64): void {
this.set(PlayerAnimation.Movement, this.player.velocity.length_squared())
@onready(n => n.get_node(n.advance_expression_base_node))
private advance_node!: Node
private _fire_expr?: Expression
private _move_expr?: Expression
_ready(): void {
this.advance_node = this.get_node(this.advance_expression_base_node)
this._fire_expr = expr(this.fire_expression)
this._move_expr = expr(this.move_speed_expression)
}
_physics_process(_delta: float64): void {
//this.set(PlayerAnimation.Movement, this.player.velocity.length_squared())
const move_result = this._move_expr?.execute(empty, this.advance_node, true)
if (this._move_expr?.has_execute_failed()) {
console.error(this._move_expr.get_error_text())
}
PlayerAnimation.Movement.forEach(key => {
this.set(key, move_result)
})
//this.set(PlayerAnimation.Movement, this._move_expr.execute())
}
}

View file

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

View file

@ -1,4 +1,4 @@
import { Callable, Callable1, Camera3D, float64, Input, InputEvent, InputEventJoypadButton, InputEventJoypadMotion, InputEventKey, InputEventMouse, InputEventMouseMotion, int32, Node3D, Signal0, Signal1, Variant, Vector2, Vector3 } from 'godot'
import { Callable, Callable1, Camera3D, float64, Input, InputEvent, InputEventJoypadButton, InputEventJoypadMotion, InputEventKey, InputEventMouse, InputEventMouseMotion, int32, Node3D, PhysicsRayQueryParameters3D, Signal0, Signal1, Variant, Vector2, Vector3, World3D } from 'godot'
import { export_, signal } from 'godot.annotations'
import InputBuffer from './input_buffer'
import MainCamera from './main_camera'
@ -19,11 +19,9 @@ export const PlayerLook = Object.freeze({
} as const)
class LookDirection {
static Empty = new LookDirection(Vector2.ZERO, false)
_value: Vector2
needs_projection: boolean
camera?: Camera3D
_camera?: Camera3D
_world_3d?: World3D
get value() {
return this._value
@ -33,23 +31,30 @@ class LookDirection {
this._value = val
}
constructor(value: Vector2, needs_projection: boolean) {
this._value = value
this.needs_projection = needs_projection
constructor(camera: Camera3D) {
this._value = Vector2.ZERO
this._camera = camera
this._world_3d = camera.get_world_3d()
}
accumulate(delta: Vector2) {
this.value = Vector2.ADD(this._value, delta)
}
project(value: Vector2, length: number = 100) {
if (this._camera && this._world_3d) {
const space_state = this._world_3d.direct_space_state
const origin = this._camera.project_ray_origin(value)
const end = Vector3.ADD(
origin,
Vector3.MULTIPLY(
length,
this._camera.project_ray_normal(value)
)
)
const query = PhysicsRayQueryParameters3D.create(origin, end)
project(to_position: Vector3): Vector3 {
if (this.camera) {
// TODO: this performance a sqrt operation,
// check if this is necessary
const distance = this.camera.global_position.distance_to(to_position)
return this.camera?.project_position(this._value, distance) ?? Vector3.ZERO
} else {
return Vector3.ZERO
const result = space_state.intersect_ray(query)
if (!result.is_empty()) {
const position = result.get('position') as Vector3
this._value = new Vector2(position.x, position.z)
}
}
}
}
@ -120,7 +125,7 @@ export default class PlayerInput extends Node3D {
}
}
private _look_direction: LookDirection = LookDirection.Empty
private _look_direction!: LookDirection
get look_direction() {
return this._look_direction
@ -213,11 +218,13 @@ export default class PlayerInput extends Node3D {
_ready(): void {
this._camera = MainCamera.instance
this._look_direction = new LookDirection(this._camera)
this._await_camera_callable = Callable.create(this, this._await_camera)
MessageBus.instance.active_camera_changed.connect(this._await_camera_callable)
this._look_direction.camera = this._camera
this._look_direction._camera = this._camera
this._look_direction._world_3d = this.get_world_3d()
this._min_range_sqr = this._sqr(this.min_range)
this._max_range_sqr = this._sqr(this.max_range)
@ -227,9 +234,8 @@ export default class PlayerInput extends Node3D {
}
private _await_camera(camera: Camera3D) {
console.log('got camera', camera)
this._camera = camera
this._look_direction.camera = camera
this._look_direction._camera = camera
}
_process(_delta: float64): void {
@ -252,12 +258,9 @@ export default class PlayerInput extends Node3D {
)
this._look_direction.value = dir
this._look_direction.needs_projection = false
case Device.KeyboardMouse:
dir = this.get_viewport().get_mouse_position()
this._look_direction.value = dir
this._look_direction.needs_projection = true
break
this._look_direction.project(dir)
}
this._changed_since_last_frame = !next_movement.is_equal_approx(this.movement_input)

1
src/player_input.ts.uid Normal file
View file

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

38
src/resource_loader.ts Normal file
View file

@ -0,0 +1,38 @@
import { GError, Node, Resource, ResourceLoader } from 'godot'
export default class AsyncResourceLoader extends Node {
private static _instance: AsyncResourceLoader
static get instance() {
return this._instance
}
_ready(): void {
AsyncResourceLoader._instance = this
}
load<T extends Resource>(path: string, hint_string: string = ''): Promise<T> {
return new Promise(async (resolve, reject) => {
const err = ResourceLoader.load_threaded_request(path, hint_string)
if (err != GError.OK) {
return reject(new Error(`failed to load ${path}`))
}
const get_status = () => ResourceLoader.load_threaded_get_status(path)
let status = get_status()
while (status === ResourceLoader.ThreadLoadStatus.THREAD_LOAD_IN_PROGRESS) {
await this.get_tree().process_frame.as_promise()
status = get_status()
}
if (get_status() === ResourceLoader.ThreadLoadStatus.THREAD_LOAD_LOADED) {
return resolve(ResourceLoader.load_threaded_get(path) as T)
} else {
return reject(new Error(`failed to load ${path}`))
}
})
}
}

View file

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

8
src/weapon.ts Normal file
View file

@ -0,0 +1,8 @@
import { export_scene } from './annotations'
import Item from './item'
import { export_file } from 'godot.annotations'
export default class Weapon extends Item {
@export_scene()
readonly scene!: string
}

1
src/weapon.ts.uid Normal file
View file

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

3
test.tscn Normal file
View file

@ -0,0 +1,3 @@
[gd_scene format=3 uid="uid://djg6jvi1stuvf"]
[node name="Node" type="Node"]

View file

@ -0,0 +1,25 @@
declare module "godot" {
interface SceneNodes {
"addons/dev_console/console.tscn": {
Container: Control<
{
ColorRect: ColorRect<{}>,
VBoxContainer: VBoxContainer<
{
Output: RichTextLabel<
{
"@VScrollBar@46002": VScrollBar<{}>,
}
>,
Input: LineEdit<
{
Suggestion: LineEdit<{}>,
}
>,
}
>,
}
>,
},
}
}

17
typings/scenes/glock_17.nodes.gen.d.ts vendored Normal file
View file

@ -0,0 +1,17 @@
declare module "godot" {
interface SceneNodes {
"scenes/glock_17.tscn": {
Mesh: Node3D<
{
Slide: MeshInstance3D<{}>,
Reference: Node3D<{}>,
Receiver: MeshInstance3D<{}>,
Trigger: MeshInstance3D<{}>,
"Internal Chamber in Slide": MeshInstance3D<{}>,
Cylinder: MeshInstance3D<{}>,
Magazine: MeshInstance3D<{}>,
}
>,
},
}
}

17
typings/scenes/glock_172.nodes.gen.d.ts vendored Normal file
View file

@ -0,0 +1,17 @@
declare module "godot" {
interface SceneNodes {
"scenes/glock_172.tscn": {
Mesh: Node3D<
{
Slide: MeshInstance3D<{}>,
Reference: Node3D<{}>,
Receiver: MeshInstance3D<{}>,
Trigger: MeshInstance3D<{}>,
"Internal Chamber in Slide": MeshInstance3D<{}>,
Cylinder: MeshInstance3D<{}>,
Magazine: MeshInstance3D<{}>,
}
>,
},
}
}

89
typings/scenes/node_3d.nodes.gen.d.ts vendored Normal file
View file

@ -0,0 +1,89 @@
declare module "godot" {
interface SceneNodes {
"scenes/node_3d.tscn": {
level: Node3D<
{
Plane: MeshInstance3D<{}>,
Cube: MeshInstance3D<{}>,
Cube_001: MeshInstance3D<{}>,
StaticBody3D: StaticBody3D<
{
CollisionShape3D: CollisionShape3D<{}>,
}
>,
}
>,
Camera3D: Camera3D<{}>,
Player: CharacterBody3D<
{
Mesh: Node3D<
{
AuxScene: Node3D<
{
Scene: Node3D<
{
Armature: Node3D<
{
Skeleton3D: Skeleton3D<
{
Beta_Joints: MeshInstance3D<{}>,
Beta_Surface: MeshInstance3D<{}>,
RightHand: BoneAttachment3D<
{
Node3D: Node3D<{}>,
}
>,
}
>,
}
>,
}
>,
}
>,
AnimationPlayer: AnimationPlayer<{}>,
}
>,
CollisionShape3D: CollisionShape3D<{}>,
Input: Node3D<{}>,
Interactor: Area3D<
{
CollisionShape3D: CollisionShape3D<{}>,
}
>,
Inventory: Node<{}>,
EquippedWeapon: Node<{}>,
AnimationTree: AnimationTree<{}>,
}
>,
DirectionalLight3D: DirectionalLight3D<{}>,
Door: Node3D<
{
MeshInstance3D: MeshInstance3D<{}>,
Interactable: Area3D<
{
CollisionShape3D: CollisionShape3D<{}>,
}
>,
Label3D: Label3D<{}>,
}
>,
DoorKey: Node3D<
{
MeshInstance3D: MeshInstance3D<{}>,
Area3D: Area3D<
{
CollisionShape3D: CollisionShape3D<{}>,
}
>,
Label3D: Label3D<{}>,
}
>,
Target: Node3D<
{
MeshInstance3D: MeshInstance3D<{}>,
}
>,
},
}
}

44
typings/scenes/player.nodes.gen.d.ts vendored Normal file
View file

@ -0,0 +1,44 @@
declare module "godot" {
interface SceneNodes {
"scenes/player.tscn": {
Mesh: Node3D<
{
AuxScene: Node3D<
{
Scene: Node3D<
{
Armature: Node3D<
{
Skeleton3D: Skeleton3D<
{
Beta_Joints: MeshInstance3D<{}>,
Beta_Surface: MeshInstance3D<{}>,
RightHand: BoneAttachment3D<
{
Node3D: Node3D<{}>,
}
>,
}
>,
}
>,
}
>,
}
>,
AnimationPlayer: AnimationPlayer<{}>,
}
>,
CollisionShape3D: CollisionShape3D<{}>,
Input: Node3D<{}>,
Interactor: Area3D<
{
CollisionShape3D: CollisionShape3D<{}>,
}
>,
Inventory: Node<{}>,
EquippedWeapon: Node<{}>,
AnimationTree: AnimationTree<{}>,
},
}
}

40
typings/scenes/player2.nodes.gen.d.ts vendored Normal file
View file

@ -0,0 +1,40 @@
declare module "godot" {
interface SceneNodes {
"scenes/player2.tscn": {
PlayerMesh: Node3D<
{
AuxScene: Node3D<
{
Scene: Node3D<
{
Armature: Node3D<
{
Skeleton3D: Skeleton3D<
{
Beta_Joints: MeshInstance3D<{}>,
Beta_Surface: MeshInstance3D<{}>,
BoneAttachment3D: BoneAttachment3D<{}>,
}
>,
}
>,
}
>,
}
>,
AnimationPlayer: AnimationPlayer<{}>,
}
>,
CollisionShape3D: CollisionShape3D<{}>,
Input: Node3D<{}>,
Interactor: Area3D<
{
CollisionShape3D: CollisionShape3D<{}>,
}
>,
Inventory: Node<{}>,
AnimationTree: AnimationTree<{}>,
EquippedWeapon: Node<{}>,
},
}
}

View file

@ -0,0 +1,26 @@
declare module "godot" {
interface SceneNodes {
"scenes/player_mesh3.tscn": {
AuxScene: Node3D<
{
Scene: Node3D<
{
Armature: Node3D<
{
Skeleton3D: Skeleton3D<
{
Beta_Joints: MeshInstance3D<{}>,
Beta_Surface: MeshInstance3D<{}>,
RightHand: BoneAttachment3D<{}>,
}
>,
}
>,
}
>,
}
>,
AnimationPlayer: AnimationPlayer<{}>,
},
}
}

5
typings/test.nodes.gen.d.ts vendored Normal file
View file

@ -0,0 +1,5 @@
declare module "godot" {
interface SceneNodes {
"test.tscn": {},
}
}