initial commit

This commit is contained in:
Rowan 2025-04-14 13:15:53 -05:00
commit 778ea912f4
56 changed files with 84136 additions and 0 deletions

4
godot/.editorconfig Normal file
View file

@ -0,0 +1,4 @@
root = true
[*]
charset = utf-8

2
godot/.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

4
godot/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# Godot 4+ specific ignores
.godot/
/android/
node_modules/

View file

@ -0,0 +1,16 @@
[configuration]
entry_symbol = "gdext_rust_init"
compatibility_minimum = 4.1
reloadable = true
[libraries]
linux.debug.x86_64 = "res://../rust/target/debug/libstudio_suicide.so"
linux.release.x86_64 = "res://../rust/target/release/libstudio_suicide.so"
windows.debug.x86_64 = "res://../rust/target/debug/studio_suicide.dll"
windows.release.x86_64 = "res://../rust/target/release/studio_suicide.dll"
macos.debug = "res://../rust/target/debug/libstudio_suicide.dylib"
macos.release = "res://../rust/target/release/libstudio_suicide.dylib"
macos.debug.arm64 = "res://../rust/target/debug/libstudio_suicide.dylib"
macos.release.arm64 = "res://../rust/target/release/libstudio_suicide.dylib"

View file

@ -0,0 +1,37 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://djsal4qopsem"
path="res://.godot/imported/X Bot.fbx-fbe026a69ba44c7b7c506a4970de1691.scn"
[deps]
source_file="res://assets/X Bot.fbx"
dest_files=["res://.godot/imported/X Bot.fbx-fbe026a69ba44c7b7c506a4970de1691.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
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

BIN
godot/assets/player.glb Normal file

Binary file not shown.

File diff suppressed because it is too large Load diff

1
godot/icon.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

After

Width:  |  Height:  |  Size: 994 B

37
godot/icon.svg.import Normal file
View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bbh2guq5uttuf"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

44
godot/package-lock.json generated Normal file
View file

@ -0,0 +1,44 @@
{
"name": "studio-suicide",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"devDependencies": {
"@types/node": "^20.11.30",
"typescript": "^5.4.3"
}
},
"node_modules/@types/node": {
"version": "20.17.30",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.30.tgz",
"integrity": "sha512-7zf4YyHA+jvBNfVrk2Gtvs6x7E8V+YDW05bNfG2XkWDJfYRXrTiP/DsB2zSYTaHX0bGIujTBQdMVAhb+j7mwpg==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.19.2"
}
},
"node_modules/typescript": {
"version": "5.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/undici-types": {
"version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
"dev": true,
"license": "MIT"
}
}
}

6
godot/package.json Normal file
View file

@ -0,0 +1,6 @@
{
"devDependencies": {
"@types/node": "^20.11.30",
"typescript": "^5.4.3"
}
}

59
godot/project.godot Normal file
View file

@ -0,0 +1,59 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="studio-suicide"
run/main_scene="res://scenes/node_3d.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")
config/icon="res://icon.svg"
[autoload]
MessageBus="*res://src/message_bus.ts"
DebugDraw="*res://src/debug_draw.ts"
[display]
window/size/viewport_width=1280
window/size/viewport_height=720
[input]
move_forward={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
]
}
move_back={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
]
}
move_left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
]
}
move_right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
]
}
run={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}

133
godot/scenes/node_3d.tscn Normal file
View file

@ -0,0 +1,133 @@
[gd_scene load_steps=9 format=3 uid="uid://c634jlnd870wg"]
[ext_resource type="Script" path="res://src/camera_trigger.ts" id="2_anf5t"]
[ext_resource type="PackedScene" uid="uid://b46lmxhgyg5fh" path="res://scenes/player.tscn" id="2_pd54o"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ijx74"]
albedo_color = Color(0.427493, 0.427493, 0.427493, 1)
[sub_resource type="PlaneMesh" id="PlaneMesh_0d3pj"]
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_0580h"]
[sub_resource type="BoxMesh" id="BoxMesh_7osgm"]
[sub_resource type="BoxShape3D" id="BoxShape3D_3vccc"]
[sub_resource type="BoxShape3D" id="BoxShape3D_fx65l"]
[node name="Node3D" type="Node3D"]
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.989102, 0.103249, -0.104963, -0.0287189, 0.834504, 0.550253, 0.144405, -0.541242, 0.828375, 0, 18.9707, 0)
[node name="Ground" type="StaticBody3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Ground"]
transform = Transform3D(50, 0, 0, 0, 1, 0, 0, 0, 50, 0, 0, 0)
material_override = SubResource("StandardMaterial3D_ijx74")
mesh = SubResource("PlaneMesh_0d3pj")
skeleton = NodePath("../../root/@EditorNode@16939/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Node3D")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground"]
shape = SubResource("WorldBoundaryShape3D_0580h")
[node name="Walls" type="Node" parent="."]
[node name="StaticBody3D" type="StaticBody3D" parent="Walls"]
transform = Transform3D(1, 0, 0, 0, 6, 0, 0, 0, 18, -4, 3, -3)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Walls/StaticBody3D"]
mesh = SubResource("BoxMesh_7osgm")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/StaticBody3D"]
shape = SubResource("BoxShape3D_3vccc")
[node name="StaticBody3D2" type="StaticBody3D" parent="Walls"]
transform = Transform3D(1, 0, 0, 0, 6, 0, 0, 0, 26, 5, 3, -7)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Walls/StaticBody3D2"]
mesh = SubResource("BoxMesh_7osgm")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/StaticBody3D2"]
shape = SubResource("BoxShape3D_3vccc")
[node name="StaticBody3D3" type="StaticBody3D" parent="Walls"]
transform = Transform3D(26, 0, 0, 0, 6, 0, 0, 0, 1, -8, 3, -20)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Walls/StaticBody3D3"]
mesh = SubResource("BoxMesh_7osgm")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/StaticBody3D3"]
shape = SubResource("BoxShape3D_3vccc")
[node name="StaticBody3D6" type="StaticBody3D" parent="Walls"]
transform = Transform3D(10, 0, 0, 0, 6, 0, 0, 0, 1, 1, 3, 6)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Walls/StaticBody3D6"]
mesh = SubResource("BoxMesh_7osgm")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/StaticBody3D6"]
shape = SubResource("BoxShape3D_3vccc")
[node name="StaticBody3D4" type="StaticBody3D" parent="Walls"]
transform = Transform3D(17.5, 0, 0, 0, 6, 0, 0, 0, 1, -12, 3, -12)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Walls/StaticBody3D4"]
mesh = SubResource("BoxMesh_7osgm")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/StaticBody3D4"]
shape = SubResource("BoxShape3D_3vccc")
[node name="StaticBody3D5" type="StaticBody3D" parent="Walls"]
transform = Transform3D(1, 0, 0, 0, 6, 0, 0, 0, 8, -21, 3, -16)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Walls/StaticBody3D5"]
mesh = SubResource("BoxMesh_7osgm")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/StaticBody3D5"]
shape = SubResource("BoxShape3D_3vccc")
[node name="Cameras" type="Node" parent="."]
[node name="Camera3D" type="Camera3D" parent="Cameras"]
transform = Transform3D(-0.868308, 0.0669873, -0.491482, -0.0669873, 0.965926, 0.25, 0.491482, 0.25, -0.834234, -3, 4, -11)
current = true
[node name="Camera Trigger" type="Area3D" parent="Cameras"]
transform = Transform3D(8, 0, 0, 0, 8, 0, 0, 0, 14.4, 1, 2, -3)
script = ExtResource("2_anf5t")
camera = NodePath("../Camera3D")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Cameras/Camera Trigger"]
shape = SubResource("BoxShape3D_fx65l")
[node name="Camera3D2" type="Camera3D" parent="Cameras"]
transform = Transform3D(-0.258819, 0, -0.965926, 0, 1, 0, 0.965926, 0, -0.258819, -9, 2, -16)
[node name="Camera Trigger2" type="Area3D" parent="Cameras"]
transform = Transform3D(12.1176, 0, 0, 0, 9, 0, 0, 0, 9, -1, 2, -15)
script = ExtResource("2_anf5t")
camera = NodePath("../Camera3D2")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Cameras/Camera Trigger2"]
transform = Transform3D(1.1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
shape = SubResource("BoxShape3D_fx65l")
[node name="Camera3D3" type="Camera3D" parent="Cameras"]
transform = Transform3D(0.258819, 0, 0.965926, 0, 1, 0, -0.965926, 0, 0.258819, -9, 2, -15)
[node name="Camera Trigger3" type="Area3D" parent="Cameras"]
transform = Transform3D(9, 0, 0, 0, 9, 0, 0, 0, 9, -12, 2, -16)
script = ExtResource("2_anf5t")
camera = NodePath("../Camera3D3")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Cameras/Camera Trigger3"]
transform = Transform3D(1.4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
shape = SubResource("BoxShape3D_fx65l")
[node name="CharacterBody3D" parent="." instance=ExtResource("2_pd54o")]
[connection signal="body_entered" from="Cameras/Camera Trigger" to="Cameras/Camera Trigger" method="_on_body_entered"]
[connection signal="body_entered" from="Cameras/Camera Trigger2" to="Cameras/Camera Trigger2" method="_on_body_entered"]
[connection signal="body_entered" from="Cameras/Camera Trigger3" to="Cameras/Camera Trigger3" method="_on_body_entered"]

222
godot/scenes/player.tscn Normal file
View file

@ -0,0 +1,222 @@
[gd_scene load_steps=19 format=3 uid="uid://b46lmxhgyg5fh"]
[ext_resource type="Script" path="res://src/player.ts" id="1_a88ao"]
[ext_resource type="Script" path="res://src/player_animation.ts" id="2_ypldj"]
[ext_resource type="Script" path="res://src/player_input.ts" id="3_b7c8b"]
[ext_resource type="PackedScene" uid="uid://dv1aoe06v6dbo" path="res://scenes/player_mesh.tscn" id="4_27blp"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_x8bhs"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_oenqu"]
animation = &"Idle"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_it6i4"]
animation = &"PushButton"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_sl6il"]
animation = &"SlowRun"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_3b84f"]
animation = &"Walking"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_a51th"]
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_lhuck"]
advance_mode = 2
advance_condition = &"interact"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jf23w"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dxcas"]
xfade_time = 0.1
advance_mode = 2
advance_expression = "velocity"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_5x23f"]
advance_mode = 2
advance_condition = &"interact"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mq4ne"]
xfade_time = 0.1
advance_mode = 2
advance_expression = "!velocity"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_rx5qf"]
xfade_time = 0.1
advance_mode = 2
advance_expression = "is_running()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_yo8po"]
xfade_time = 0.1
advance_mode = 2
advance_expression = "!is_running()"
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_u1egq"]
states/Idle/node = SubResource("AnimationNodeAnimation_oenqu")
states/Idle/position = Vector2(365, 100)
states/Interact/node = SubResource("AnimationNodeAnimation_it6i4")
states/Interact/position = Vector2(466, 204)
states/SlowRun/node = SubResource("AnimationNodeAnimation_sl6il")
states/SlowRun/position = Vector2(735, 98)
states/Walking/node = SubResource("AnimationNodeAnimation_3b84f")
states/Walking/position = Vector2(579, 98)
transitions = ["Start", "Idle", SubResource("AnimationNodeStateMachineTransition_a51th"), "Idle", "Interact", SubResource("AnimationNodeStateMachineTransition_lhuck"), "Interact", "Idle", SubResource("AnimationNodeStateMachineTransition_jf23w"), "Idle", "Walking", SubResource("AnimationNodeStateMachineTransition_dxcas"), "Walking", "Interact", SubResource("AnimationNodeStateMachineTransition_5x23f"), "Walking", "Idle", SubResource("AnimationNodeStateMachineTransition_mq4ne"), "Walking", "SlowRun", SubResource("AnimationNodeStateMachineTransition_rx5qf"), "SlowRun", "Walking", SubResource("AnimationNodeStateMachineTransition_yo8po")]
graph_offset = Vector2(264, 15)
[node name="CharacterBody3D" type="CharacterBody3D"]
script = ExtResource("1_a88ao")
player_input = NodePath("Input")
walk_speed = 2.5
run_speed = 4.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("CylinderShape3D_x8bhs")
[node name="AnimationTree" type="AnimationTree" parent="."]
root_node = NodePath("../PlayerMesh")
tree_root = SubResource("AnimationNodeStateMachine_u1egq")
advance_expression_base_node = NodePath("..")
anim_player = NodePath("../PlayerMesh/AnimationPlayer")
parameters/conditions/interact = false
script = ExtResource("2_ypldj")
[node name="Input" type="Node3D" parent="."]
script = ExtResource("3_b7c8b")
[node name="PlayerMesh" parent="." instance=ExtResource("4_27blp")]
[node name="Skeleton3D" parent="PlayerMesh/Armature" index="0"]
bones/0/position = Vector3(10.8323, 100.566, 1.76934)
bones/0/rotation = Quaternion(-0.0230531, -0.134826, 0.0330271, 0.99005)
bones/1/position = Vector3(-1.08778e-06, 8.00974e-08, -5.45755e-07)
bones/2/rotation = Quaternion(-0.126312, 0.00390559, -0.0612111, 0.990093)
bones/3/position = Vector3(1.2666e-07, 1.38208e-06, 4.63426e-06)
bones/4/rotation = Quaternion(0.0179489, -0.00825122, -0.0178849, 0.999645)
bones/5/position = Vector3(-8.19564e-07, -1.46851e-05, 4.30644e-06)
bones/6/rotation = Quaternion(0.0308461, -0.00732419, -0.0178495, 0.999338)
bones/7/position = Vector3(3.57632e-07, -2.42144e-05, -3.53158e-06)
bones/8/rotation = Quaternion(-0.556759, 0.512207, -0.549306, -0.354861)
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.535951, -0.123005, -0.0947963, 0.829844)
bones/11/position = Vector3(1.66958e-06, -2.30764e-05, 5.90135e-07)
bones/12/rotation = Quaternion(6.63038e-08, 4.62427e-08, -0.238361, 0.971177)
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.00100366, -0.153901, -0.0163265, 0.987951)
bones/15/position = Vector3(1.43223e-06, -9.47448e-06, -3.04991e-06)
bones/16/rotation = Quaternion(0.130922, -0.000536525, 0.0200024, 0.991191)
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.125981, 7.59033e-08, 0.0153541, 0.991914)
bones/19/position = Vector3(-1.09796e-06, -1.6639e-05, -1.30592e-05)
bones/20/rotation = Quaternion(0.19325, 7.59658e-09, 0.0235519, 0.980867)
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.118124, 0.00017292, 0.0129408, 0.992915)
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.118005, -1.8283e-08, 0.0143819, 0.992909)
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.221719, 0.0356031, 0.035285, 0.973821)
bones/31/position = Vector3(1.86637e-06, 5.9802e-06, -1.467e-05)
bones/32/rotation = Quaternion(0.173185, -0.000326617, 0.0229624, 0.984622)
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.0978745, -6.00722e-08, 0.0119283, 0.995127)
bones/36/position = Vector3(-1.34902e-06, 2.88968, 1.45266e-05)
bones/36/rotation = Quaternion(0.1665, 0.102706, 0.0382309, 0.979933)
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.190553, -0.00191066, 0.0330006, 0.98112)
bones/41/position = Vector3(5.8333e-07, 6.3235e-07, 1.57826e-05)
bones/42/rotation = Quaternion(0.0903997, 7.32054e-08, 0.0110174, 0.995845)
bones/43/position = Vector3(-1.30539e-06, 1.28774e-05, 4.90486e-08)
bones/44/rotation = Quaternion(0.134768, -7.61413e-08, 0.0164247, 0.990741)
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.123738, 0.0614859, -0.162114, 0.97705)
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.065068, 0.0341859, 0.191511, 0.978734)
bones/52/position = Vector3(-8.77766e-06, 3.41628, -4.79003e-06)
bones/52/rotation = Quaternion(0.0223925, -0.00350703, -0.0584347, 0.998034)
bones/53/position = Vector3(-3.03984e-06, 2.01762e-05, -1.93187e-06)
bones/56/rotation = Quaternion(0.0531727, 0.00267766, 0.0303457, 0.998121)
bones/57/position = Vector3(1.19211e-07, -2.28947e-05, -3.36394e-06)
bones/58/rotation = Quaternion(-0.101476, 0.020969, 0.0128598, 0.994534)
bones/59/position = Vector3(-1.0431e-07, -1.54506e-05, -1.49384e-06)
bones/61/rotation = Quaternion(0.576319, 0.496831, -0.542606, 0.355801)
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.514101, 0.0626199, 0.0220347, 0.855157)
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(-1.80993e-08, -3.41039e-08, 0.199691, 0.979859)
bones/66/position = Vector3(-3.25318e-06, -4.67625e-06, -1.50252e-06)
bones/67/rotation = Quaternion(0.0551003, 0.135529, 0.0470682, 0.98812)
bones/68/position = Vector3(7.47968e-08, -6.91227e-07, -2.51579e-06)
bones/69/rotation = Quaternion(0.158909, -0.0734939, 0.0529653, 0.983128)
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.0321456, -0.0368734, -0.198096, 0.978961)
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.00653892, -0.129599, -0.140468, 0.981545)
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.0945151, -0.00116771, 0.00108596, 0.995522)
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.113511, -1.25944e-07, -0.0136986, 0.993442)
bones/80/position = Vector3(-3.04282e-06, -2.24161e-06, -1.52532e-05)
bones/81/rotation = Quaternion(0.137959, -1.52381e-07, -0.0166491, 0.990298)
bones/84/position = Vector3(-1.56742e-06, -5.37828e-06, 1.60567e-05)
bones/85/rotation = Quaternion(0.0395193, -0.000171217, -0.000416618, 0.999219)
bones/86/position = Vector3(-2.09158e-07, 7.10476e-06, -1.37234e-05)
bones/87/rotation = Quaternion(0.125074, -2.31704e-07, -0.0150939, 0.992033)
bones/88/position = Vector3(-1.44259e-06, -2.81852e-06, -1.08586e-06)
bones/89/rotation = Quaternion(0.149466, -1.8287e-07, -0.0180375, 0.988602)
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.0934523, -0.00111243, 0.000755997, 0.995623)
bones/94/position = Vector3(-1.24702e-06, -4.42364e-06, 5.52884e-07)
bones/95/rotation = Quaternion(0.142515, -1.9556e-07, -0.0171987, 0.989643)
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.21712, -3.15011e-07, -0.0262021, 0.975793)
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.109405, 0.00431716, -0.0507793, 0.99269)
bones/102/position = Vector3(-2.33662e-06, 1.08604e-05, 1.6658e-05)
bones/103/rotation = Quaternion(0.123519, 0.00427894, 0.0207453, 0.992116)
bones/104/position = Vector3(1.84285e-06, 5.76279e-06, -1.71906e-05)
bones/105/rotation = Quaternion(0.0937019, -6.23296e-08, -0.0113077, 0.995536)
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.0692737, 0.141006, 0.983921, 0.0849542)
bones/110/position = Vector3(-1.06222e-06, 3.19319e-05, -1.56533e-06)
bones/111/rotation = Quaternion(-0.295735, -0.0596685, -0.0123846, 0.953324)
bones/112/position = Vector3(2.91388e-07, 4.25241e-06, -2.20301e-06)
bones/113/rotation = Quaternion(0.555602, -0.0142493, 0.0561636, 0.829427)
bones/115/rotation = Quaternion(0.338989, 3.45834e-05, 1.21499e-05, 0.94079)
bones/119/rotation = Quaternion(0.0140214, 0.106701, 0.989156, 0.0999454)
bones/120/position = Vector3(-8.23132e-07, -4.34501e-06, -1.59527e-06)
bones/121/rotation = Quaternion(-0.250538, -0.0735148, 0.00494552, 0.965299)
bones/122/position = Vector3(-6.62286e-07, 6.482e-06, 2.36121e-07)
bones/123/rotation = Quaternion(0.534216, -0.139986, 0.120867, 0.824869)
bones/125/rotation = Quaternion(0.342195, -0.0134352, -0.00466826, 0.939521)
[editable path="PlayerMesh"]

View file

@ -0,0 +1,165 @@
[gd_scene load_steps=2 format=3 uid="uid://dv1aoe06v6dbo"]
[ext_resource type="PackedScene" uid="uid://c28drqeq2gok0" path="res://assets/player.glb" id="1_8ooov"]
[node name="PlayerMesh" instance=ExtResource("1_8ooov")]
[node name="Skeleton3D" parent="Armature" index="0"]
bones/0/position = Vector3(-0.0661675, 86.7809, 1.97153)
bones/0/rotation = Quaternion(0.168007, -0.0337527, 0.0307023, 0.984729)
bones/0/scale = Vector3(1, 1, 1)
bones/1/position = Vector3(-5.73688e-07, -9.14512e-06, -1.26241e-06)
bones/2/rotation = Quaternion(-0.0442171, 0.0293714, -0.00188288, 0.998588)
bones/3/position = Vector3(9.31323e-07, 4.82425e-06, 3.63451e-07)
bones/4/rotation = Quaternion(0.026958, 0.019905, 0.00950527, 0.999393)
bones/5/position = Vector3(-1.93715e-07, -5.33462e-06, -3.29316e-06)
bones/6/rotation = Quaternion(0.0392055, 0.0202191, 0.01003, 0.998976)
bones/7/position = Vector3(7.1526e-07, -1.93864e-05, -4.64916e-06)
bones/8/rotation = Quaternion(-0.55287, 0.518692, -0.527348, -0.383663)
bones/8/scale = Vector3(1, 1, 1)
bones/9/position = Vector3(4.03821e-06, 2.32458e-06, -8.17219e-06)
bones/10/position = Vector3(-1.57305e-06, 10.8382, 6.06992e-05)
bones/10/rotation = Quaternion(0.311316, -0.233312, -0.211715, 0.896563)
bones/10/scale = Vector3(1, 1, 1)
bones/11/position = Vector3(4.29218e-06, -5.19505e-06, 6.01416e-06)
bones/12/rotation = Quaternion(1.82178e-07, 1.15022e-08, -0.649059, 0.760738)
bones/13/position = Vector3(-8.38905e-06, 3.33295e-06, 2.61253e-06)
bones/14/position = Vector3(-3.8591e-06, 28.3289, 4.04304e-06)
bones/14/rotation = Quaternion(-0.0542821, 0.10518, -0.0835181, 0.989452)
bones/15/position = Vector3(3.578e-06, -5.33786e-07, -1.20217e-06)
bones/16/rotation = Quaternion(0.540302, 0.0114986, 0.127946, 0.831608)
bones/17/position = Vector3(-5.2056e-06, -2.74507e-06, 2.17486e-07)
bones/18/position = Vector3(-4.54572e-06, 3.60001, -4.16853e-05)
bones/18/rotation = Quaternion(0.518766, 6.32048e-08, 0.0422635, 0.853871)
bones/19/position = Vector3(5.70967e-07, -7.07246e-06, -9.18487e-06)
bones/20/rotation = Quaternion(0.507401, 4.30081e-09, 0.0413371, 0.860718)
bones/21/position = Vector3(-6.99836e-06, -7.14697e-06, -2.1594e-05)
bones/22/position = Vector3(6.30171e-07, 2.11579, -2.0168e-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.23517e-06, -3.43425e-06, -5.65971e-06)
bones/24/position = Vector3(-2.38966e-05, 9.5325, 4.5051e-05)
bones/24/rotation = Quaternion(0.489046, 0.00912573, 0.0578439, 0.87029)
bones/25/position = Vector3(-6.4569e-06, 7.69735e-06, 1.93997e-05)
bones/26/position = Vector3(-1.6476e-05, 3.70001, -1.55696e-05)
bones/26/rotation = Quaternion(0.218945, -1.54959e-08, 0.0178374, 0.975574)
bones/27/position = Vector3(-1.2354e-05, -8.65261e-06, -1.28768e-05)
bones/28/position = Vector3(-4.24592e-06, 2.95001, -9.53893e-06)
bones/28/rotation = Quaternion(0.207109, -1.91016e-07, 0.0168727, 0.978172)
bones/30/rotation = Quaternion(-1.54606e-07, 0.000928791, 0.000166436, 1)
bones/31/position = Vector3(-7.56234e-07, 7.47032e-06, -1.1809e-05)
bones/32/rotation = Quaternion(0.526484, -0.00597849, 0.0857894, 0.845825)
bones/33/position = Vector3(-6.06578e-06, 1.30555e-07, 1.69121e-05)
bones/34/position = Vector3(-4.23319e-06, 3.37928, 2.18956e-06)
bones/34/rotation = Quaternion(0.492157, -4.28412e-08, 0.0400953, 0.869583)
bones/34/scale = Vector3(1, 1, 1)
bones/36/position = Vector3(-1.18398e-05, 2.88968, 7.61242e-06)
bones/36/rotation = Quaternion(0.478412, 1.06171e-09, 0.0389752, 0.87727)
bones/37/position = Vector3(-6.88349e-06, -1.37002e-05, 1.28552e-05)
bones/38/position = Vector3(2.56333e-07, 2.63883, -1.43249e-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.26579e-05, -1.86824e-05)
bones/40/position = Vector3(2.25984, 9.10828, 0.517869)
bones/40/rotation = Quaternion(0.453931, 0.00430561, 0.0275771, 0.8906)
bones/41/position = Vector3(1.06017e-06, 7.42728e-06, 1.53654e-05)
bones/42/rotation = Quaternion(0.411916, 1.10464e-07, 0.0335583, 0.910604)
bones/43/position = Vector3(-7.02744e-06, 7.93018e-06, 5.25886e-07)
bones/44/rotation = Quaternion(0.401077, -5.18852e-08, 0.0326752, 0.915461)
bones/45/position = Vector3(-2.85069e-06, 1.82002e-06, -3.29077e-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.198864, 0.0620904, -0.237479, 0.948789)
bones/48/scale = Vector3(1, 1, 1)
bones/49/position = Vector3(-9.0003e-06, -5.24521e-06, 4.05612e-06)
bones/50/position = Vector3(-1.37213e-05, 4.18898, 1.30866e-06)
bones/50/rotation = Quaternion(-0.0494684, -0.0169209, 0.208919, 0.976534)
bones/50/scale = Vector3(1, 1, 1)
bones/52/position = Vector3(-1.33398e-07, 3.41628, -7.38503e-06)
bones/52/rotation = Quaternion(-0.15632, -0.0119966, 0.0680515, 0.985286)
bones/52/scale = Vector3(1, 1, 1)
bones/53/position = Vector3(-1.13845e-05, 6.58631e-06, -2.40871e-06)
bones/54/rotation = Quaternion(0.00577409, -0.11751, -0.0487441, 0.991858)
bones/56/rotation = Quaternion(-0.0616403, -0.00291511, 0.0116202, 0.998027)
bones/57/position = Vector3(-1.43051e-06, -1.90437e-05, -4.97699e-06)
bones/58/rotation = Quaternion(-0.0888477, 0.0184369, -0.0284141, 0.995469)
bones/59/position = Vector3(3.57626e-07, -2.48402e-05, -4.05312e-06)
bones/60/rotation = Quaternion(3.91155e-08, 3.7787e-08, 2.9976e-15, 1)
bones/61/rotation = Quaternion(0.588158, 0.488325, -0.52304, 0.376879)
bones/62/position = Vector3(-9.28342e-06, -1.90735e-06, -1.25186e-05)
bones/63/position = Vector3(-6.21295e-06, 10.8377, 3.97934e-05)
bones/63/rotation = Quaternion(0.390411, 0.239833, 0.135332, 0.87849)
bones/63/scale = Vector3(1, 1, 1)
bones/64/position = Vector3(-6.81842e-07, 2.49492e-06, -4.24376e-06)
bones/65/position = Vector3(9.00633e-07, 27.8415, 2.65277e-05)
bones/65/rotation = Quaternion(-9.9156e-08, 3.62967e-09, 0.600159, 0.799881)
bones/66/position = Vector3(1.81322e-06, -7.35846e-06, -1.91975e-06)
bones/67/rotation = Quaternion(-0.0148658, -0.148494, 0.16027, 0.975726)
bones/68/position = Vector3(-2.66702e-06, 6.75935e-06, 1.82044e-06)
bones/69/rotation = Quaternion(0.110859, -0.0637618, 0.261867, 0.956593)
bones/69/scale = Vector3(1, 1, 1)
bones/70/position = Vector3(1.54972e-06, 1.10865e-05, 1.50938e-05)
bones/71/position = Vector3(-9.48468e-06, 4.18709, 6.46207e-06)
bones/71/rotation = Quaternion(-0.0485728, 0.0234044, -0.216652, 0.974759)
bones/72/position = Vector3(4.76837e-06, -6.58631e-06, -1.79932e-05)
bones/73/position = Vector3(3.41813e-06, 3.41839, -3.61406e-05)
bones/73/rotation = Quaternion(-0.0930313, -0.0290649, 0.13402, 0.986174)
bones/73/scale = Vector3(1, 1, 1)
bones/74/position = Vector3(6.76513e-06, 4.05312e-06, -9.94626e-07)
bones/75/position = Vector3(1.19018e-05, 2.58059, -2.38419e-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.687122, -0.0451216, 0.0119742, 0.725041)
bones/78/position = Vector3(1.02476e-05, 1.25725e-06, -3.09773e-06)
bones/79/position = Vector3(1.16544e-05, 3.7, -2.38235e-06)
bones/79/rotation = Quaternion(0.473463, -6.95732e-07, -0.0485189, 0.879476)
bones/80/position = Vector3(-4.95017e-06, 2.76518e-06, -1.62069e-05)
bones/81/rotation = Quaternion(0.399852, -6.25517e-07, -0.0409757, 0.915663)
bones/83/rotation = Quaternion(-4.89366e-09, -0.000377568, -1.2974e-05, 1)
bones/84/position = Vector3(2.00886e-06, -1.55707e-05, 1.65336e-05)
bones/85/rotation = Quaternion(0.693149, -0.0265264, -0.0731281, 0.716585)
bones/86/position = Vector3(-1.63967e-06, 3.17085e-06, -1.61075e-05)
bones/87/rotation = Quaternion(0.480525, -6.60523e-07, -0.0492427, 0.875597)
bones/88/position = Vector3(1.00015e-05, -1.164e-05, -9.66649e-07)
bones/89/rotation = Quaternion(0.404821, -7.17772e-07, -0.0414847, 0.913454)
bones/90/position = Vector3(1.66535e-06, -8.3745e-06, -2.99188e-06)
bones/91/rotation = Quaternion(2.85187e-08, -0.00102416, 2.78559e-05, 0.999999)
bones/92/position = Vector3(7.46036e-06, 4.84443e-06, -1.74526e-06)
bones/93/rotation = Quaternion(0.694768, -0.000648289, -0.0998806, 0.712265)
bones/94/position = Vector3(8.98751e-07, 5.35152e-06, -6.46659e-07)
bones/95/rotation = Quaternion(0.492817, -6.82946e-07, -0.0505023, 0.868666)
bones/96/position = Vector3(4.96211e-06, -1.72045e-06, 3.28761e-06)
bones/97/position = Vector3(6.86945e-06, 2.95, 1.36588e-05)
bones/97/rotation = Quaternion(0.403868, -6.6852e-07, -0.0413871, 0.91388)
bones/98/position = Vector3(-3.15467e-07, 5.01274e-06, 4.26586e-07)
bones/99/position = Vector3(-2.55906e-05, 2.64431, 3.08781e-07)
bones/100/position = Vector3(-1.24937e-06, -5.10697e-06, 1.54605e-05)
bones/101/position = Vector3(3.80626, 8.0778, 0.486897)
bones/101/rotation = Quaternion(0.714314, 0.0204882, -0.215513, 0.6655)
bones/102/position = Vector3(-3.4095e-06, 9.84711e-06, 2.19628e-05)
bones/103/rotation = Quaternion(0.497948, -4.89493e-07, -0.0510274, 0.865704)
bones/104/position = Vector3(2.55811e-06, 3.79583e-06, -1.0634e-05)
bones/105/rotation = Quaternion(0.415872, -5.33108e-07, -0.0426171, 0.908424)
bones/106/position = Vector3(-6.14417e-06, -1.13954e-05, 1.6547e-05)
bones/107/position = Vector3(-5.6429e-06, 2.12554, -1.44594e-05)
bones/107/rotation = Quaternion(-2.31341e-07, -0.000782879, -0.000295457, 1)
bones/107/scale = Vector3(1, 1, 1)
bones/108/position = Vector3(-9.07481e-06, 9.92674e-06, -5.45842e-07)
bones/109/rotation = Quaternion(-0.0285176, 0.354213, 0.934458, -0.0225491)
bones/109/scale = Vector3(1, 1, 1)
bones/110/position = Vector3(-8.46157e-07, 2.16948e-05, -6.41459e-07)
bones/111/rotation = Quaternion(-0.555783, 0.0104598, 0.0148413, 0.831129)
bones/112/position = Vector3(-6.62415e-08, 3.47755e-06, 3.22101e-06)
bones/113/rotation = Quaternion(0.744413, -0.0327251, -0.0586288, 0.664335)
bones/115/rotation = Quaternion(0.335242, 3.45451e-05, 1.23524e-05, 0.942132)
bones/117/rotation = Quaternion(2.98097e-08, 0.0115715, 3.46601e-10, 0.999933)
bones/119/rotation = Quaternion(0.0392834, 0.480883, 0.875853, 0.00947229)
bones/119/scale = Vector3(1, 1, 1)
bones/120/position = Vector3(-1.94257e-07, 7.09908e-06, -4.76177e-06)
bones/121/rotation = Quaternion(-0.766345, 0.0450773, -0.0338915, 0.639949)
bones/122/position = Vector3(-4.23867e-07, -3.05474e-06, -1.07518e-06)
bones/123/rotation = Quaternion(0.456476, -0.0556083, 0.0562292, 0.886214)
bones/123/scale = Vector3(1, 1, 1)
bones/125/rotation = Quaternion(0.315815, 3.41678e-05, 1.30299e-05, 0.948821)
bones/127/rotation = Quaternion(1.4904e-08, -0.0119058, -1.76878e-10, 0.999929)

39
godot/src/camera_cache.ts Normal file
View file

@ -0,0 +1,39 @@
import { Camera3D, float64, Vector3 } from 'godot'
export class CameraCache extends Object {
private _camera: Camera3D
get camera() { return this._camera }
private _angle: float64
get angle() {
return this._camera.rotation.y
}
private _dirty: boolean = true
constructor(initial_camera: Camera3D) {
super()
this._camera = initial_camera
this._angle = this._camera.rotation.y
}
update_camera(camera: Camera3D) {
this._camera = camera
this._dirty = true
}
recalculate() {
if (this._dirty) {
this._angle = this._camera.rotation.y
this._dirty = false
}
}
transform_vec(vec: Vector3): Vector3 {
return vec.rotated(Vector3.UP, this._angle)
}
}

View file

@ -0,0 +1,33 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const godot_1 = require("godot");
const godot_annotations_1 = require("godot.annotations");
const player_1 = __importDefault(require("./player"));
const message_bus_1 = __importDefault(require("./message_bus"));
class CameraTrigger extends godot_1.Area3D {
_ready() {
this._camera = this.get_node(this.camera);
}
_on_body_entered(body) {
var _a;
if (body instanceof player_1.default) {
(_a = this._camera) === null || _a === void 0 ? void 0 : _a.make_current();
console.log(message_bus_1.default.instance.active_camera_changed);
message_bus_1.default.instance.active_camera_changed.emit(this._camera);
}
}
}
exports.default = CameraTrigger;
__decorate([
(0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_NODE_PATH)
], CameraTrigger.prototype, "camera", void 0);
//# sourceMappingURL=camera_trigger.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"camera_trigger.js","sourceRoot":"../../../","sources":["src/camera_trigger.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAA0E;AAC1E,yDAA2C;AAC3C,sDAA6B;AAC7B,gEAAsC;AAEtC,MAAqB,aAAc,SAAQ,cAAM;IAK/C,MAAM;QACJ,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAa,CAAA;IACvD,CAAC;IAED,gBAAgB,CAAC,IAAmB;;QAClC,IAAI,IAAI,YAAY,gBAAM,EAAE,CAAC;YAC3B,MAAA,IAAI,CAAC,OAAO,0CAAE,YAAY,EAAE,CAAA;YAC5B,OAAO,CAAC,GAAG,CAAC,qBAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAA;YACtD,qBAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC9D,CAAC;IACH,CAAC;CACF;AAhBD,gCAgBC;AAdC;IADC,IAAA,2BAAO,EAAC,eAAO,CAAC,IAAI,CAAC,cAAc,CAAC;6CACpB"}

View file

@ -0,0 +1,22 @@
import { Area3D, Camera3D, NodePath, PhysicsBody3D, Variant } from 'godot'
import { export_ } from 'godot.annotations'
import Player from './player'
import MessageBus from './message_bus'
export default class CameraTrigger extends Area3D {
@export_(Variant.Type.TYPE_NODE_PATH)
camera!: NodePath
_camera!: Camera3D
_ready(): void {
this._camera = this.get_node(this.camera) as Camera3D
}
_on_body_entered(body: PhysicsBody3D) {
if (body instanceof Player) {
this._camera?.make_current()
console.log(MessageBus.instance.active_camera_changed)
MessageBus.instance.active_camera_changed.emit(this._camera)
}
}
}

23
godot/src/debug_draw.js Normal file
View file

@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const godot_1 = require("godot");
class DebugDraw extends godot_1.Node {
static get instance() {
return DebugDraw._inst;
}
_ready() {
DebugDraw._inst = this;
}
draw_line(begin, end, color = godot_1.Color.CYAN) {
const instance = new godot_1.GeometryInstance3D();
this.add_child(instance);
const geom = new godot_1.ImmediateMesh();
geom.surface_begin(godot_1.ImmediateMesh.PrimitiveType.PRIMITIVE_LINES);
geom.surface_add_vertex(begin);
geom.surface_add_vertex(end);
geom.surface_set_color(color);
geom.surface_end();
}
}
exports.default = DebugDraw;
//# sourceMappingURL=debug_draw.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"debug_draw.js","sourceRoot":"../../../","sources":["src/debug_draw.ts"],"names":[],"mappings":";;AAAA,iCAA+E;AAE/E,MAAqB,SAAU,SAAQ,YAAI;IAGzC,MAAM,KAAK,QAAQ;QACjB,OAAO,SAAS,CAAC,KAAK,CAAA;IACxB,CAAC;IAED,MAAM;QACJ,SAAS,CAAC,KAAK,GAAG,IAAI,CAAA;IACxB,CAAC;IAED,SAAS,CAAC,KAAc,EAAE,GAAY,EAAE,QAAe,aAAK,CAAC,IAAI;QAC/D,MAAM,QAAQ,GAAG,IAAI,0BAAkB,EAAE,CAAA;QACzC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;QAExB,MAAM,IAAI,GAAG,IAAI,qBAAa,EAAE,CAAA;QAChC,IAAI,CAAC,aAAa,CAAC,qBAAa,CAAC,aAAa,CAAC,eAAe,CAAC,CAAA;QAC/D,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;QAC9B,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA;QAC5B,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;QAC7B,IAAI,CAAC,WAAW,EAAE,CAAA;IACpB,CAAC;CACF;AAtBD,4BAsBC"}

104
godot/src/debug_draw.ts Normal file
View file

@ -0,0 +1,104 @@
import { BaseMaterial3D, Color, ImmediateMesh, Mesh, MeshInstance3D, Node, Node3D, PackedVector3Array, StandardMaterial3D, Vector3 } from 'godot'
function createDefaultMaterial(): StandardMaterial3D {
const material = new StandardMaterial3D()
material.shading_mode = BaseMaterial3D.ShadingMode.SHADING_MODE_UNSHADED
material.no_depth_test = true
material.vertex_color_use_as_albedo = true
material.transparency = BaseMaterial3D.Transparency.TRANSPARENCY_DISABLED
material.cull_mode = BaseMaterial3D.CullMode.CULL_DISABLED
return material
}
class PooledMeshInstance {
in_use: boolean = false
instance: MeshInstance3D
constructor(material: StandardMaterial3D) {
this.instance = new MeshInstance3D()
this.instance.material_override = material
}
}
class MeshPool {
target: Node
pool: PooledMeshInstance[]
default_material: StandardMaterial3D
constructor(target: Node, initial: number = 10) {
this.pool = []
this.target = target
this.default_material = createDefaultMaterial()
for (let i = 0; i < initial; i++) {
this.create()
}
}
create() {
const instance = new PooledMeshInstance(this.default_material)
instance.instance.mesh = new ImmediateMesh()
this.pool.push(instance)
this.target.add_child(instance.instance)
return instance
}
get() {
const next = this.pool.find(x => !x.in_use)
if (next) {
next.in_use = true
return next
} else {
const instance = this.create()
instance.in_use = true
return instance
}
}
release(instance: PooledMeshInstance) {
instance.in_use = false
}
}
export default class DebugDraw extends Node {
private static _inst: DebugDraw
static get instance() {
return DebugDraw._inst
}
pool!: MeshPool
_ready(): void {
DebugDraw._inst = this
this.pool = new MeshPool(this as Node)
}
static draw_line(begin: Vector3, end: Vector3, color: Color = Color.CYAN) {
DebugDraw.draw_lines(new PackedVector3Array([begin, end]), color)
}
static draw_lines(points: PackedVector3Array, color: Color = Color.CYAN) {
DebugDraw._inst._draw_lines(points, color)
}
_draw_lines(points: PackedVector3Array, color: Color = Color.CYAN) {
const instance = this.pool.get()
const mesh = instance.instance.mesh as ImmediateMesh
mesh.clear_surfaces()
mesh.surface_begin(Mesh.PrimitiveType.PRIMITIVE_LINES)
mesh.surface_set_color(color)
const len = points.size()
for (let i = 0; i < len; i++) {
mesh.surface_add_vertex(points.get_indexed(i))
}
mesh.surface_end()
this.pool.release(instance)
}
}

92
godot/src/input_buffer.ts Normal file
View file

@ -0,0 +1,92 @@
import { int32, int64, PackedVector2Array, Vector2 } from 'godot'
export class InputBufferError extends Error {
constructor(message: string) {
super(`InputBufferError: ${message}`)
}
static empty() {
return new InputBufferError('cannot perform operation, buffer is empty')
}
static outOfBounds(index: int64) {
return new InputBufferError(`cannot access ${index}: index out of bounds`)
}
}
export default class InputBuffer {
readonly capacity: int32
private _buffer: PackedVector2Array
private _head: int32 = 0
private _tail: int32 = 0
private _size: int32 = 0
constructor(capacity: int32) {
this.capacity = capacity
this._buffer = new PackedVector2Array()
this._buffer.resize(capacity)
this._buffer.fill(Vector2.ZERO)
}
is_empty() {
return this._size === 0
}
is_full() {
return this._size === this.capacity
}
push(value: Vector2) {
this._buffer.set_indexed(this._head, value)
this._head = (this._head + 1) % this.capacity
if (this.is_full()) {
this._tail = this._head
} else {
this._size += 1
}
}
pop(): Vector2 {
if (this.is_empty()) {
throw InputBufferError.empty()
}
const value = this.tail()
this._tail = (this._tail + 1) % this.capacity
this._size += 1
return value
}
at(index: int64) {
if (index >= this._size) {
throw InputBufferError.outOfBounds(index)
}
const n = index < 0 ? this._head - index : this._tail + index
const idx = n % this.capacity
return this._buffer.get_indexed(idx)
}
size() {
return this._size
}
head() {
return this._buffer.get_indexed(this._head)
}
tail() {
return this._buffer.get_indexed(this._tail)
}
slice(begin: int64, end?: int64) {
return this._buffer.slice(begin, end)
}
clear() {
this._size = 0
this._head = 0
this._tail = 0
}
}

23
godot/src/message_bus.js Normal file
View file

@ -0,0 +1,23 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const godot_1 = require("godot");
const godot_annotations_1 = require("godot.annotations");
class MessageBus extends godot_1.Node {
static get instance() {
return MessageBus._inst;
}
_ready() {
MessageBus._inst = this;
}
}
exports.default = MessageBus;
__decorate([
(0, godot_annotations_1.signal)()
], MessageBus.prototype, "active_camera_changed", void 0);
//# sourceMappingURL=message_bus.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"message_bus.js","sourceRoot":"../../../","sources":["src/message_bus.ts"],"names":[],"mappings":";;;;;;;;AAAA,iCAA+C;AAC/C,yDAA0C;AAE1C,MAAqB,UAAW,SAAQ,YAAI;IAG1C,MAAM,KAAK,QAAQ;QACjB,OAAO,UAAU,CAAC,KAAK,CAAA;IACzB,CAAC;IAKD,MAAM;QACJ,UAAU,CAAC,KAAK,GAAG,IAAI,CAAA;IACzB,CAAC;CACF;AAbD,6BAaC;AALC;IADC,IAAA,0BAAM,GAAE;yDACgC"}

17
godot/src/message_bus.ts Normal file
View file

@ -0,0 +1,17 @@
import { Camera3D, Node, Signal1 } from 'godot'
import { signal } from 'godot.annotations'
export default class MessageBus extends Node {
private static _inst: MessageBus
static get instance() {
return MessageBus._inst
}
@signal()
active_camera_changed!: Signal1<Camera3D>
_ready(): void {
MessageBus._inst = this
}
}

77
godot/src/player.js Normal file
View file

@ -0,0 +1,77 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const godot_1 = require("godot");
const godot_annotations_1 = require("godot.annotations");
const message_bus_1 = __importDefault(require("./message_bus"));
class Player extends godot_1.CharacterBody3D {
constructor() {
super(...arguments);
this.gravity = godot_1.ProjectSettings.get_setting('physics/3d/default_gravity');
this.walk_speed = 3;
this.walk_backward_speed = 2;
this.run_speed = 6;
this.turn_speed = 1;
this._rotation_speed = 2 * Math.PI;
}
_ready() {
this._rotation_speed = this.turn_speed * 2 * Math.PI;
this._player_input = this.get_node(this.player_input);
this._camera = this.get_viewport().get_camera_3d();
message_bus_1.default.instance.active_camera_changed.connect(godot_1.Callable.create(this, this.on_camera_changed));
}
get_movement(delta) {
const input = this._player_input.movement_input;
return godot_1.Vector3.MULTIPLY(this.walk_speed, new godot_1.Vector3(input.x, 0, input.y));
}
//get_translation(_delta: float64): Vector3 {
// const forward = Vector3.MULTIPLY(-1, this.transform.basis.z)
// return Vector3.MULTIPLY(forward, this.get_movement())
//}
get_gravitational_force(delta) {
return -this.gravity * delta;
}
relative_to(target, vec) {
return vec.rotated(godot_1.Vector3.UP, target.rotation.y);
}
on_camera_changed(camera) {
this._camera = camera;
}
_physics_process(delta) {
const movement = this.relative_to(this._camera, this.get_movement(delta));
if (!movement.is_zero_approx()) {
this.look_at(godot_1.Vector3.NEGATE(godot_1.Vector3.ADD(this.position, movement)), godot_1.Vector3.UP);
}
this.velocity = new godot_1.Vector3(movement.x, this.velocity.y + this.get_gravitational_force(delta), movement.z);
this.move_and_slide();
}
}
exports.default = Player;
__decorate([
(0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_NODE_PATH)
], Player.prototype, "player_input", void 0);
__decorate([
(0, godot_annotations_1.help)('Forward walk speed in units per second'),
(0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_FLOAT)
], Player.prototype, "walk_speed", void 0);
__decorate([
(0, godot_annotations_1.help)('Backward walk speed in units per second'),
(0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_FLOAT)
], Player.prototype, "walk_backward_speed", void 0);
__decorate([
(0, godot_annotations_1.help)('Run speed in units per second'),
(0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_FLOAT)
], Player.prototype, "run_speed", void 0);
__decorate([
(0, godot_annotations_1.help)('Turn speed in rotations per second'),
(0, godot_annotations_1.export_)(godot_1.Variant.Type.TYPE_FLOAT)
], Player.prototype, "turn_speed", void 0);
//# sourceMappingURL=player.js.map

1
godot/src/player.js.map Normal file
View file

@ -0,0 +1 @@
{"version":3,"file":"player.js","sourceRoot":"../../../","sources":["src/player.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAAkI;AAClI,yDAAiD;AAEjD,gEAAsC;AAEtC,MAAqB,MAAO,SAAQ,uBAAe;IAAnD;;QACE,YAAO,GAAG,uBAAe,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAA;QAQnE,eAAU,GAAG,CAAC,CAAA;QAId,wBAAmB,GAAG,CAAC,CAAA;QAIvB,cAAS,GAAG,CAAC,CAAA;QAIb,eAAU,GAAG,CAAC,CAAA;QACd,oBAAe,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAA;IA+D/B,CAAC;IA3DC,MAAM;QACJ,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAA;QACpD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAgB,CAAA;QACpE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC,aAAa,EAAE,CAAA;QAElD,qBAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC,OAAO,CAC/C,gBAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAC9C,CAAA;IACH,CAAC;IAED,YAAY,CAAC,KAAc;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAA;QAC/C,OAAO,eAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,eAAO,CAClD,KAAK,CAAC,CAAC,EACP,CAAC,EACD,KAAK,CAAC,CAAC,CACR,CAAC,CAAA;IACJ,CAAC;IAED,6CAA6C;IAC7C,gEAAgE;IAChE,yDAAyD;IACzD,GAAG;IAEH,uBAAuB,CAAC,KAAc;QACpC,OAAO,CAAC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IAC9B,CAAC;IAED,WAAW,CAAC,MAAc,EAAE,GAAY;QACtC,OAAO,GAAG,CAAC,OAAO,CAAC,eAAO,CAAC,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;IAED,iBAAiB,CAAC,MAAgB;QAChC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACvB,CAAC;IAED,gBAAgB,CAAC,KAAc;QAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAC/B,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CACzB,CAAA;QAED,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,CACV,eAAO,CAAC,MAAM,CACZ,eAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CACrC,EACD,eAAO,CAAC,EAAE,CACX,CAAA;QACH,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAO,CACzB,QAAQ,CAAC,CAAC,EACV,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC,EACrD,QAAQ,CAAC,CAAC,CACX,CAAA;QAED,IAAI,CAAC,cAAc,EAAE,CAAA;IACvB,CAAC;CACF;AArFD,yBAqFC;AAjFC;IADC,IAAA,2BAAO,EAAC,eAAO,CAAC,IAAI,CAAC,cAAc,CAAC;4CACd;AAKvB;IAFC,IAAA,wBAAI,EAAC,wCAAwC,CAAC;IAC9C,IAAA,2BAAO,EAAC,eAAO,CAAC,IAAI,CAAC,UAAU,CAAC;0CACnB;AAId;IAFC,IAAA,wBAAI,EAAC,yCAAyC,CAAC;IAC/C,IAAA,2BAAO,EAAC,eAAO,CAAC,IAAI,CAAC,UAAU,CAAC;mDACV;AAIvB;IAFC,IAAA,wBAAI,EAAC,+BAA+B,CAAC;IACrC,IAAA,2BAAO,EAAC,eAAO,CAAC,IAAI,CAAC,UAAU,CAAC;yCACpB;AAIb;IAFC,IAAA,wBAAI,EAAC,oCAAoC,CAAC;IAC1C,IAAA,2BAAO,EAAC,eAAO,CAAC,IAAI,CAAC,UAAU,CAAC;0CACnB"}

121
godot/src/player.ts Normal file
View file

@ -0,0 +1,121 @@
import { Callable, Camera3D, CharacterBody3D, Color, float64, NodePath, ProjectSettings, Variant, Vector2, Vector3 } from 'godot'
import { export_, help } from 'godot.annotations'
import PlayerInput from './player_input'
import MessageBus from './message_bus'
import DebugDraw from './debug_draw'
import { CameraCache } from './camera_cache'
export default class Player extends CharacterBody3D {
gravity = ProjectSettings.get_setting('physics/3d/default_gravity')
@export_(Variant.Type.TYPE_NODE_PATH)
player_input!: NodePath
_player_input!: PlayerInput
is_running() { return this._player_input.is_running }
@help('Forward walk speed in units per second')
@export_(Variant.Type.TYPE_FLOAT)
walk_speed = 3
@help('Run speed in units per second')
@export_(Variant.Type.TYPE_FLOAT)
run_speed = 6
@help('Turn speed in rotations per second')
@export_(Variant.Type.TYPE_FLOAT)
turn_speed = 1
_rotation_speed = 2 * Math.PI
_camera!: CameraCache
_ready(): void {
this._rotation_speed = this.turn_speed * 2 * Math.PI
this._player_input = this.get_node(this.player_input) as PlayerInput
const camera = this.get_viewport().get_camera_3d()
this._camera = new CameraCache(camera)
MessageBus.instance.active_camera_changed.connect(
Callable.create(
this,
this.update_camera
)
)
}
update_camera(cam: Camera3D) {
this._camera.update_camera(cam)
}
get_movement(input: Vector2): Vector3 {
const speed = this.is_running() ? this.run_speed : this.walk_speed
return Vector3.MULTIPLY(speed, new Vector3(
input.x,
0,
input.y
))
}
get_gravitational_force(delta: float64): float64 {
return -this.gravity * delta
}
is_kinda_equal(a: Vector2, b: Vector2, e: float64 = 0.1) {
return a.distance_to(b) <= e
}
_draw_movement(movement: Vector3) {
DebugDraw.draw_line(
Vector3.ADD(
Vector3.UP,
this.position,
),
Vector3.ADD(
Vector3.UP,
Vector3.ADD(this.position, movement)
),
Color.GREEN
)
}
rotate_toward(direction: Vector3, _delta: float64) {
if (!direction.is_zero_approx()) {
this.look_at(
Vector3.ADD(this.global_position, direction),
Vector3.UP,
true
)
}
}
move_toward(movement: Vector3, delta: float64) {
this.velocity = new Vector3(
movement.x,
this.velocity.y + this.get_gravitational_force(delta),
movement.z
)
this.move_and_slide()
}
_physics_process(delta: float64): void {
const buf = this._player_input.input_buffer
const input = buf.tail()
const prev = buf.at(-2)
if (prev && !this.is_kinda_equal(input, prev)) {
this._camera.recalculate()
}
const movement = this._camera.transform_vec(
this.get_movement(input)
)
this._draw_movement(movement)
this.rotate_toward(movement, delta)
this.move_toward(movement, delta)
}
}

View file

@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const godot_1 = require("godot");
class PlayerAnimation extends godot_1.AnimationTree {
_ready() {
this.player = this.get_parent();
this.player_input = this.player.get_node(this.player.player_input);
}
}
PlayerAnimation.Interact = 'parameters/interact';
PlayerAnimation.WalkSpeed = 'parameters/Walk/blend_position';
exports.default = PlayerAnimation;
//# sourceMappingURL=player_animation.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"player_animation.js","sourceRoot":"../../../","sources":["src/player_animation.ts"],"names":[],"mappings":";;AAAA,iCAAqC;AAIrC,MAAqB,eAAgB,SAAQ,qBAAa;IAOxD,MAAM;QACJ,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAY,CAAA;QACzC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,YAAa,CAAgB,CAAA;IACpF,CAAC;;AATc,wBAAQ,GAAG,qBAAqB,CAAA;AAChC,yBAAS,GAAG,gCAAgC,CAAA;kBAFxC,eAAe"}

View file

@ -0,0 +1,18 @@
import { AnimationTree, float64 } from 'godot'
import Player from './player'
import PlayerInput from './player_input'
export default class PlayerAnimation extends AnimationTree {
private static Interact = 'parameters/conditions/interact'
player!: Player
player_input!: PlayerInput
_ready(): void {
this.player = this.get_parent() as Player
this.player_input = this.player.get_node(this.player.player_input!) as PlayerInput
}
_process(delta: float64): void {
}
}

30
godot/src/player_input.js Normal file
View file

@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const godot_1 = require("godot");
var Device;
(function (Device) {
Device[Device["KeyboardMouse"] = 0] = "KeyboardMouse";
Device[Device["Gamepad"] = 1] = "Gamepad";
})(Device || (Device = {}));
class PlayerInput extends godot_1.Node3D {
constructor() {
super(...arguments);
this._last_known_device = Device.KeyboardMouse;
this._movement_input = godot_1.Vector2.ZERO;
}
get last_known_device() { return this._last_known_device; }
get movement_input() { return this._movement_input; }
_process(delta) {
this._movement_input = godot_1.Input.get_vector('move_left', 'move_right', 'move_forward', 'move_back');
}
_input(event) {
if (event instanceof godot_1.InputEventKey || event instanceof godot_1.InputEventMouse) {
this._last_known_device = Device.KeyboardMouse;
}
else if (event instanceof godot_1.InputEventJoypadButton || event instanceof godot_1.InputEventJoypadMotion) {
this._last_known_device = Device.Gamepad;
}
}
}
exports.default = PlayerInput;
//# sourceMappingURL=player_input.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"player_input.js","sourceRoot":"../../../","sources":["src/player_input.ts"],"names":[],"mappings":";;AAAA,iCAAmJ;AAEnJ,IAAK,MAGJ;AAHD,WAAK,MAAM;IACT,qDAAiB,CAAA;IACjB,yCAAW,CAAA;AACb,CAAC,EAHI,MAAM,KAAN,MAAM,QAGV;AAED,MAAqB,WAAY,SAAQ,cAAM;IAA/C;;QACE,uBAAkB,GAAG,MAAM,CAAC,aAAa,CAAA;QAGzC,oBAAe,GAAY,eAAO,CAAC,IAAI,CAAA;IAczC,CAAC;IAhBC,IAAI,iBAAiB,KAAK,OAAO,IAAI,CAAC,kBAAkB,CAAA,CAAC,CAAC;IAG1D,IAAI,cAAc,KAAK,OAAO,IAAI,CAAC,eAAe,CAAA,CAAC,CAAC;IAEpD,QAAQ,CAAC,KAAc;QACrB,IAAI,CAAC,eAAe,GAAG,aAAK,CAAC,UAAU,CAAC,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,CAAC,CAAA;IACjG,CAAC;IAED,MAAM,CAAC,KAAiB;QACtB,IAAI,KAAK,YAAY,qBAAa,IAAI,KAAK,YAAY,uBAAe,EAAE,CAAC;YACvE,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,aAAa,CAAA;QAChD,CAAC;aAAM,IAAI,KAAK,YAAY,8BAAsB,IAAI,KAAK,YAAY,8BAAsB,EAAE,CAAC;YAC9F,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAA;QAC1C,CAAC;IACH,CAAC;CACF;AAlBD,8BAkBC"}

61
godot/src/player_input.ts Normal file
View file

@ -0,0 +1,61 @@
import { float64, Input, InputEvent, InputEventJoypadButton, InputEventJoypadMotion, InputEventKey, InputEventMouse, int32, Node3D, PackedVector2Array, Variant } from 'godot'
import { export_ } from 'godot.annotations'
import InputBuffer from './input_buffer'
enum Device {
KeyboardMouse = 0,
Gamepad = 1
}
export default class PlayerInput extends Node3D {
@export_(Variant.Type.TYPE_INT)
private input_buffer_size: int32 = 8
private _last_known_device = Device.KeyboardMouse
get last_known_device() { return this._last_known_device }
private _input_buffer!: InputBuffer
get input_buffer() {
return this._input_buffer
}
get movement_input() {
return this._input_buffer.head()
}
_running: boolean = false
get is_running() {
return this._running
}
private _changed_since_last_frame = false
get changed_since_last_frame() {
return this._changed_since_last_frame
}
_ready(): void {
this._input_buffer = new InputBuffer(this.input_buffer_size)
}
_process(delta: float64): void {
const next_input = Input.get_vector('move_left', 'move_right', 'move_forward', 'move_back')
this._changed_since_last_frame = !next_input.is_equal_approx(this.movement_input)
this._input_buffer.push(next_input)
this._running = Input.is_action_pressed('run')
}
_input(event: InputEvent): void {
if (event instanceof InputEventKey || event instanceof InputEventMouse) {
this._last_known_device = Device.KeyboardMouse
} else if (event instanceof InputEventJoypadButton || event instanceof InputEventJoypadMotion) {
this._last_known_device = Device.Gamepad
}
}
}

113
godot/tsconfig.json Normal file
View file

@ -0,0 +1,113 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
"incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
"tsBuildInfoFile": ".godot/.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
"experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "CommonJS", /* Specify what module code is generated. */
"rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
"typeRoots": [ /* Specify multiple folders that act like './node_modules/@types'. */
"./node_modules/@types","./typings"
],
"types": [
"node"
], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
// "resolveJsonModule": true, /* Enable importing .json files. */
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": ".godot/GodotJS", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
"sourceRoot": "../../../", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
"newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
"noEmitOnError": false, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}

1
godot/typings/.gdignore Normal file
View file

@ -0,0 +1 @@

282
godot/typings/godot.minimal.d.ts vendored Normal file
View file

@ -0,0 +1,282 @@
declare module "godot-jsb" {
import { Object as GDObject, PackedByteArray, PropertyUsageFlags, PropertyHint, MethodFlags, Variant, Callable0, Callable1, Callable2, Callable3, Callable4, Callable5, StringName, MultiplayerAPI, MultiplayerPeer } from "godot";
const DEV_ENABLED: boolean;
const TOOLS_ENABLED: boolean;
/** version of GodotJS */
const version: string;
/** impl currently used */
const impl: string;
/**
* Create godot Callable with a bound object `self`.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<R = void>(self: GDObject, fn: () => R): Callable0<R>;
/**
* Create godot Callable with a bound object `self`.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<T1, R = void>(self: GDObject, fn: (v1: T1) => R): Callable1<T1, R>;
/**
* Create godot Callable with a bound object `self`.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<T1, T2, R = void>(self: GDObject, fn: (v1: T1, v2: T2) => R): Callable2<T1, T2, R>;
/**
* Create godot Callable with a bound object `self`.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<T1, T2, T3, R = void>(self: GDObject, fn: (v1: T1, v2: T2, v3: T3) => R): Callable3<T1, T2, T3, R>;
/**
* Create godot Callable with a bound object `self`.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<T1, T2, T3, T4, R = void>(self: GDObject, fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4<T1, T2, T3, T4, R>;
/**
* Create godot Callable with a bound object `self`.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<T1, T2, T3, T4, T5, R = void>(self: GDObject, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5<T1, T2, T3, T4, T5, R>;
/**
* Create godot Callable without a bound object.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<R = void>(fn: () => R): Callable0<R>;
/**
* Create godot Callable without a bound object.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<T1, R = void>(fn: (v1: T1) => R): Callable1<T1, R>;
/**
* Create godot Callable without a bound object.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<T1, T2, R = void>(fn: (v1: T1, v2: T2) => R): Callable2<T1, T2, R>;
/**
* Create godot Callable without a bound object.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<T1, T2, T3, R = void>(fn: (v1: T1, v2: T2, v3: T3) => R): Callable3<T1, T2, T3, R>;
/**
* Create godot Callable without a bound object.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<T1, T2, T3, T4, R = void>(fn: (v1: T1, v2: T2, v3: T3, v4: T4) => R): Callable4<T1, T2, T3, T4, R>;
/**
* Create godot Callable without a bound object.
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
*/
function callable<T1, T2, T3, T4, T5, R = void>(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R): Callable5<T1, T2, T3, T4, T5, R>;
/**
* Explicitly convert a `PackedByteArray`(aka `Vector<uint8_t>`) into a javascript `ArrayBuffer`
* @deprecated [WARNING] This free function '_to_array_buffer' is deprecated and will be removed in a future version, use 'PackedByteArray.to_array_buffer()' instead.
*/
function to_array_buffer(packed: PackedByteArray): ArrayBuffer;
interface ScriptPropertyInfo {
name: string;
type: Variant.Type;
class_?: Function;
hint?: number;
hint_string?: string;
usage?: number;
}
namespace internal {
type OnReadyEvaluatorFunc = (self: any) => any;
interface RPCConfig {
mode?: MultiplayerAPI.RPCMode,
sync?: boolean,
transfer_mode?: MultiplayerPeer.TransferMode,
transfer_channel?: number,
}
function add_script_signal(target: any, name: string): void;
function add_script_property(target: any, details: ScriptPropertyInfo): void;
function add_script_ready(target: any, details: { name: string, evaluator: string | OnReadyEvaluatorFunc }): void;
function add_script_tool(target: any): void;
function add_script_icon(target: any, path: string): void;
function add_script_rpc(target: any, propertyKey: string, config: RPCConfig): void;
// 0: deprecated, 1: experimental, 2: help
function set_script_doc(target: any, propertyKey?: string, field: 0 | 1 | 2, message: string): void;
function add_module(id: string, obj: any): void;
function find_module(id: string): any;
function notify_microtasks_run(): void;
/**
* Get the transformed type name of a Variant.Type
*/
function get_type_name(type: Variant.Type): StringName;
}
namespace editor {
interface PrimitiveConstantInfo {
name: string;
type: Variant.Type;
value: number; /* only if type is literal */
}
interface ConstantInfo {
name: string;
value: number; /** int64_t */
}
interface EnumInfo {
name: string;
literals: Array<string>;
is_bitfield: boolean;
}
interface DefaultArgumentInfo {
type: Variant.Type;
value: any;
}
// we treat godot MethodInfo/MethodBind as the same thing here for simplicity
//NOTE some fields will not be set if it's actually a MethodInfo struct
interface MethodBind {
id: number;
name: string;
hint_flags: MethodFlags;
is_static: boolean;
is_const: boolean;
is_vararg: boolean;
argument_count: number; /** int32_t */
args_: Array<PropertyInfo>;
default_arguments?: Array<DefaultArgumentInfo>;
return_: PropertyInfo | undefined;
}
interface PropertyInfo {
name: string;
type: Variant.Type;
class_name: string;
hint: PropertyHint;
hint_string: string;
usage: PropertyUsageFlags;
}
interface PropertySetGetInfo {
name: string;
type: Variant.Type;
index: number;
setter: string;
getter: string;
info: PropertyInfo;
}
interface PrimitiveGetSetInfo {
name: string;
type: Variant.Type;
}
interface SignalInfo {
name: string;
method_: MethodBind;
}
interface ArgumentInfo {
name: string;
type: Variant.Type;
}
interface ConstructorInfo {
arguments: Array<ArgumentInfo>
}
interface OperatorInfo {
name: string;
return_type: Variant.Type;
left_type: Variant.Type;
right_type: Variant.Type;
}
interface BasicClassInfo {
name: string;
methods: Array<MethodBind>;
enums?: Array<EnumInfo>;
}
// godot class
interface ClassInfo extends BasicClassInfo {
super: string;
properties: Array<PropertySetGetInfo>;
virtual_methods: Array<MethodBind>;
signals: Array<SignalInfo>;
constants?: Array<ConstantInfo>;
}
// variant class
interface PrimitiveClassInfo extends BasicClassInfo {
// self type
type: Variant.Type;
// valid only if has_indexing
element_type?: Variant.Type;
// true only if is_keyed
is_keyed: boolean;
constructors: Array<ConstructorInfo>;
operators: Array<OperatorInfo>;
properties: Array<PrimitiveGetSetInfo>;
constants?: Array<PrimitiveConstantInfo>;
}
interface SingletonInfo {
name: string;
class_name: string;
user_created: boolean;
editor_only: boolean;
}
interface GlobalConstantInfo {
name: string;
values: { [name: string]: number /** int64_t */ };
}
interface ClassDoc {
brief_description: string;
constants: { [name: string]: { description: string } };
methods: { [name: string]: { description: string } };
properties: { [name: string]: { description: string } };
signals: { [name: string]: { description: string } };
}
function get_class_doc(class_name: string): ClassDoc | undefined;
/**
* get a list of all classes registered in ClassDB
*/
function get_classes(): Array<ClassInfo>;
function get_primitive_types(): Array<PrimitiveClassInfo>;
function get_singletons(): Array<SingletonInfo>;
function get_global_constants(): Array<GlobalConstantInfo>;
function get_utility_functions(): Array<MethodBind>;
function delete_file(filepath: string): void;
const VERSION_DOCS_URL: string;
}
}

186
godot/typings/godot.mix.d.ts vendored Normal file
View file

@ -0,0 +1,186 @@
/// <reference no-default-lib="true"/>
declare module "godot" {
/** A built-in type representing a method or a standalone function.
*
* @link https://docs.godotengine.org/en/4.2/classes/class_callable.html
*/
interface AnyCallable {
/** Returns `true` if this [Callable] has no target to call the method on. */
is_null(): boolean
/** Returns `true` if this [Callable] is a custom callable. Custom callables are created from [method bind] or [method unbind]. In GDScript, lambda functions are also custom callables. */
is_custom(): boolean
/** Returns `true` if this [Callable] is a standard callable. This method is the opposite of [method is_custom]. Returns `false` if this callable is a lambda function. */
is_standard(): boolean
/** Returns `true` if the callable's object exists and has a valid method name assigned, or is a custom callable. */
is_valid(): boolean
/** Returns the object on which this [Callable] is called. */
get_object(): Object
/** Returns the ID of this [Callable]'s object (see [method Object.get_instance_id]). */
get_object_id(): int64
/** Returns the name of the method represented by this [Callable]. If the callable is a GDScript lambda function, returns the function's name or `"<anonymous lambda>"`. */
get_method(): StringName
/** Returns the total amount of arguments bound (or unbound) via successive [method bind] or [method unbind] calls. If the amount of arguments unbound is greater than the ones bound, this function returns a value less than zero. */
get_bound_arguments_count(): int64
/** Return the bound arguments (as long as [method get_bound_arguments_count] is greater than zero), or empty (if [method get_bound_arguments_count] is less than or equal to zero). */
get_bound_arguments(): Array
/** Returns the 32-bit hash value of this [Callable]'s object.
*
* **Note:** [Callable]s with equal content will always produce identical hash values. However, the reverse is not true. Returning identical hash values does *not* imply the callables are equal, because different callables can have identical hash values due to hash collisions. The engine uses a 32-bit hash algorithm for [method hash].
*/
hash(): int64
/** Returns a copy of this [Callable] with one or more arguments bound. When called, the bound arguments are passed *after* the arguments supplied by [method call]. See also [method unbind].
*
* **Note:** When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left.
*/
bind(...vargargs: any[]): AnyCallable
/** Returns a copy of this [Callable] with one or more arguments bound, reading them from an array. When called, the bound arguments are passed *after* the arguments supplied by [method call]. See also [method unbind].
*
* **Note:** When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left.
*/
bindv(arguments_: GArray): AnyCallable
/** Returns a copy of this [Callable] with a number of arguments unbound. In other words, when the new callable is called the last few arguments supplied by the user are ignored, according to [param argcount]. The remaining arguments are passed to the callable. This allows to use the original callable in a context that attempts to pass more arguments than this callable can handle, e.g. a signal with a fixed number of arguments. See also [method bind].
*
* **Note:** When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left.
*
*/
unbind(argcount: int64): AnyCallable
/** Calls the method represented by this [Callable]. Arguments can be passed and should match the method's signature. */
call(...vargargs: any[]): any
/** Calls the method represented by this [Callable]. Unlike [method call], this method expects all arguments to be contained inside the [param arguments] [Array]. */
callv(arguments_: GArray): any
/** Calls the method represented by this [Callable] in deferred mode, i.e. at the end of the current frame. Arguments can be passed and should match the method's signature.
*
*
* **Note:** Deferred calls are processed at idle time. Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they'll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly.
* See also [method Object.call_deferred].
*/
call_deferred(...vargargs: any[]): void
}
/** A built-in type representing a signal of an [Object].
*
* @link https://docs.godotengine.org/en/4.2/classes/class_signal.html
*/
interface AnySignal {
/** Returns `true` if the signal's name does not exist in its object, or the object is not valid. */
is_null(): boolean
/** Returns the object emitting this signal. */
get_object(): Object
/** Returns the ID of the object emitting this signal (see [method Object.get_instance_id]). */
get_object_id(): int64
/** Returns the name of this signal. */
get_name(): StringName
/** Returns `true` if the specified [Callable] is connected to this signal. */
is_connected(callable: AnyCallable): boolean
/** Returns an [Array] of connections for this signal. Each connection is represented as a [Dictionary] that contains three entries:
* - `signal` is a reference to this signal;
* - `callable` is a reference to the connected [Callable];
* - `flags` is a combination of [enum Object.ConnectFlags].
*/
get_connections(): Array
}
interface Callable0<R = void> extends AnyCallable {
call(): R;
}
interface Callable1<T1, R = void> extends AnyCallable {
call(v1: T1): R;
}
interface Callable2<T1, T2, R = void> extends AnyCallable {
call(v1: T1, v2, T2): R;
}
interface Callable3<T1, T2, T3, R = void> extends AnyCallable {
call(v1: T1, v2: T2, v3: T3): R;
}
interface Callable4<T1, T2, T3, T4, R = void> extends AnyCallable {
call(v1: T1, v2: T2, v3: T3, v4: T4): R;
}
interface Callable5<T1, T2, T3, T4, T5, R = void> extends AnyCallable {
call(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): R;
}
interface Signal0 extends AnySignal {
connect(callable: Callable0, flags: int64 = 0): void;
disconnect(callable: Callable0): void;
is_connected(callable: Callable0): boolean;
emit(): void;
as_promise(): Promise<void>;
}
interface Signal1<T1> extends AnySignal {
connect(callable: Callable1<T1>, flags: int64 = 0): void;
disconnect(callable: Callable1<T1>): void;
is_connected(callable: Callable1<T1>): boolean;
emit(v1: T1): void;
// the first argument is used as the resolved value
as_promise(): Promise<T1>;
}
interface Signal2<T1, T2> extends AnySignal {
connect(callable: Callable2<T1, T2>, flags: int64 = 0): void;
disconnect(callable: Callable2<T1, T2>): void;
is_connected(callable: Callable2<T1, T2>): boolean;
emit(v1: T1, v2: T2): void;
// the first argument is used as the resolved value
as_promise(): Promise<T1>;
}
interface Signal3<T1, T2, T3> extends AnySignal {
connect(callable: Callable3<T1, T2, T3>, flags: int64 = 0): void;
disconnect(callable: Callable3<T1, T2, T3>): void;
is_connected(callable: Callable3<T1, T2, T3>): boolean;
emit(v1: T1, v2: T2, v3: T3): void;
// the first argument is used as the resolved value
as_promise(): Promise<T1>;
}
interface Signal4<T1, T2, T3, T4> extends AnySignal {
connect(callable: Callable4<T1, T2, T3, T4>, flags: int64 = 0): void;
disconnect(callable: Callable4<T1, T2, T3, T4>): void;
is_connected(callable: Callable4<T1, T2, T3, T4>): boolean;
emit(v1: T1, v2: T2, v3: T3, v4: T4): void;
// the first argument is used as the resolved value
as_promise(): Promise<T1>;
}
interface Signal5<T1, T2, T3, T4, T5> extends AnySignal {
connect(callable: Callable5<T1, T2, T3, T4, T5>, flags: int64 = 0): void;
disconnect(callable: Callable5<T1, T2, T3, T4, T5>): void;
is_connected(callable: Callable5<T1, T2, T3, T4, T5>): boolean;
emit(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): void;
// the first argument is used as the resolved value
as_promise(): Promise<T1>;
}
}

11172
godot/typings/godot0.gen.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

9367
godot/typings/godot1.gen.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

9353
godot/typings/godot2.gen.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

9536
godot/typings/godot3.gen.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

9809
godot/typings/godot4.gen.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

9686
godot/typings/godot5.gen.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

9426
godot/typings/godot6.gen.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

7876
godot/typings/godot7.gen.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

64
godot/typings/jsb.editor.bundle.d.ts vendored Normal file
View file

@ -0,0 +1,64 @@
declare module "jsb.editor.codegen" {
import * as jsb from "godot-jsb";
export class TypeDB {
singletons: {
[name: string]: jsb.editor.SingletonInfo;
};
classes: {
[name: string]: jsb.editor.ClassInfo;
};
primitive_types: {
[name: string]: jsb.editor.PrimitiveClassInfo;
};
primitive_type_names: {
[type: number]: string;
};
globals: {
[name: string]: jsb.editor.GlobalConstantInfo;
};
utilities: {
[name: string]: jsb.editor.MethodBind;
};
class_docs: {
[name: string]: jsb.editor.ClassDoc | false;
};
constructor();
find_doc(class_name: string): jsb.editor.ClassDoc | undefined;
is_primitive_type(name: string): boolean;
is_valid_method_name(name: string): boolean;
make_classname(class_name: string, used_as_input: boolean): string;
make_typename(info: jsb.editor.PropertyInfo, used_as_input: boolean): string;
make_arg(info: jsb.editor.PropertyInfo, type_replacer?: (name: string) => string): string;
make_literal_value(value: jsb.editor.DefaultArgumentInfo): string;
replace_type_inplace(name: string | undefined, type_replacer?: (name: string) => string): string;
make_arg_default_value(method_info: jsb.editor.MethodBind, index: number, type_replacer?: (name: string) => string): string;
make_args(method_info: jsb.editor.MethodBind, type_replacer?: (name: string) => string): string;
make_return(method_info: jsb.editor.MethodBind, type_replacer?: (name: string) => string): string;
make_signal_type(method_info: jsb.editor.MethodBind): string;
}
export default class TSDCodeGen {
private _split_index;
private _outDir;
private _splitter;
private _types;
constructor(outDir: string);
private make_path;
private new_splitter;
private split;
private cleanup;
has_class(name?: string): boolean;
emit(): void;
private emit_mock;
private emit_singletons;
private emit_utilities;
private emit_globals;
private emit_godot;
private emit_godot_primitive;
private emit_godot_class;
}
}
declare module "jsb.editor.main" {
import { PackedStringArray } from "godot";
export function auto_complete(pattern: string): PackedStringArray;
export function run_npm_install(): void;
}

68
godot/typings/jsb.runtime.bundle.d.ts vendored Normal file
View file

@ -0,0 +1,68 @@
declare module "godot.annotations" {
import { PropertyHint, PropertyUsageFlags, Variant, MultiplayerAPI, MultiplayerPeer } from "godot";
import * as jsb from "godot-jsb";
/**
*
*/
export function signal(): (target: any, key: string) => void;
export function export_multiline(): (target: any, key: string) => void;
export function export_range(min: number, max: number, step?: number, ...extra_hints: string[]): (target: any, key: string) => void;
export function export_range_i(min: number, max: number, step?: number, ...extra_hints: string[]): (target: any, key: string) => void;
/** String as a path to a file, custom filter provided as hint. */
export function export_file(filter: string): (target: any, key: string) => void;
export function export_dir(filter: string): (target: any, key: string) => void;
export function export_global_file(filter: string): (target: any, key: string) => void;
export function export_global_dir(filter: string): (target: any, key: string) => void;
export function export_exp_easing(hint?: "" | "attenuation" | "positive_only" | "attenuation,positive_only"): (target: any, key: string) => void;
export function export_(type: Variant.Type, details?: {
class_?: Function;
hint?: PropertyHint;
hint_string?: string;
usage?: PropertyUsageFlags;
}): (target: any, key: string) => void;
/**
* In Godot, class members can be exported.
* This means their value gets saved along with the resource (such as the scene) they're attached to.
* They will also be available for editing in the property editor.
* Exporting is done by using the `@export_var` (or `@export_`) annotation.
*/
export function export_var(type: Variant.Type, details?: {
class_?: Function;
hint?: PropertyHint;
hint_string?: string;
usage?: PropertyUsageFlags;
}): (target: any, key: string) => void;
/**
* NOTE only int value enums are allowed
*/
export function export_enum(enum_type: any): (target: any, key: string) => void;
/**
* NOTE only int value enums are allowed
*/
export function export_flags(enum_type: any): (target: any, key: string) => void;
export interface RPCConfig {
mode?: MultiplayerAPI.RPCMode;
sync?: "call_remote" | "call_local";
transfer_mode?: MultiplayerPeer.TransferMode;
transfer_channel?: number;
}
export function rpc(config?: RPCConfig): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void;
/**
* auto initialized on ready (before _ready called)
* @param evaluator for now, only string is accepted
*/
export function onready(evaluator: string | jsb.internal.OnReadyEvaluatorFunc): (target: any, key: string) => void;
export function tool(): (target: any) => void;
export function icon(path: string): (target: any) => void;
export function deprecated(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void;
export function experimental(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void;
export function help(message?: string): (target: any, propertyKey?: PropertyKey, descriptor?: PropertyDescriptor) => void;
}
declare module "godot.typeloader" {
/**
* @param type the loaded type or function in godot module
*/
export type TypeLoadedCallback = (type: any) => void;
export function on_type_loaded(type_name: string | string[], callback: TypeLoadedCallback): void;
}
declare module "jsb.core" { }

View file

@ -0,0 +1,7 @@
declare module "godot" {
interface SceneNodes {
"scenes/main.tscn": {
Node3D: Node3D<{}>,
},
}
}

View file

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

1
rust/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

290
rust/Cargo.lock generated Normal file
View file

@ -0,0 +1,290 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "bitflags"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "gdextension-api"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ec0a03c8f9c91e3d8eb7ca56dea81c7248c03826dd3f545f33cd22ef275d4d1"
[[package]]
name = "gensym"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "913dce4c5f06c2ea40fc178c06f777ac89fc6b1383e90c254fafb1abe4ba3c82"
dependencies = [
"proc-macro2",
"quote",
"syn",
"uuid",
]
[[package]]
name = "getrandom"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0"
dependencies = [
"cfg-if",
"libc",
"r-efi",
"wasi",
]
[[package]]
name = "glam"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "779ae4bf7e8421cf91c0b3b64e7e8b40b862fba4d393f59150042de7c4965a94"
[[package]]
name = "godot"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a29a3646d4b02bf4587fedba4ac7b44a47d45c933fd85ba7e61292408818eaa4"
dependencies = [
"godot-core",
"godot-macros",
]
[[package]]
name = "godot-bindings"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0014540bff93ba275031bc852f1cf9a3ff3216f02cdd51dc249745dccc8c578"
dependencies = [
"gdextension-api",
]
[[package]]
name = "godot-cell"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88184d525d763ebc88ff6806ffee35e19c7118d5c9e4eedbc74e70e069f8a671"
[[package]]
name = "godot-codegen"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caa72d9b8be812fef2932f2a172b80c8b3feaee030571682f8f770c3d1c348d8"
dependencies = [
"godot-bindings",
"heck",
"nanoserde",
"proc-macro2",
"quote",
"regex",
]
[[package]]
name = "godot-core"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ff8345372e4c990ca592d7b61490ef88ff249fc77226f5b79beca173b4a0458"
dependencies = [
"glam",
"godot-bindings",
"godot-cell",
"godot-codegen",
"godot-ffi",
]
[[package]]
name = "godot-ffi"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "606d08085bd590d2f9c72633d4d218fee665ab3a0760b2d9daff2d964d628def"
dependencies = [
"gensym",
"godot-bindings",
"godot-codegen",
"libc",
"paste",
]
[[package]]
name = "godot-macros"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c11b3188e54ebacf88feb4c968ed19048a71a329c4cfd4a06cf374f18357a36"
dependencies = [
"godot-bindings",
"proc-macro2",
"quote",
"venial",
]
[[package]]
name = "heck"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "libc"
version = "0.2.171"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
[[package]]
name = "memchr"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "nanoserde"
version = "0.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de9cf844ab1e25a0353525bd74cb889843a6215fa4a0d156fd446f4857a1b99"
dependencies = [
"nanoserde-derive",
]
[[package]]
name = "nanoserde-derive"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e943b2c21337b7e3ec6678500687cdc741b7639ad457f234693352075c082204"
[[package]]
name = "paste"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "proc-macro2"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "r-efi"
version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
[[package]]
name = "regex"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "studio_suicide"
version = "0.1.0"
dependencies = [
"godot",
]
[[package]]
name = "syn"
version = "2.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "uuid"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9"
dependencies = [
"getrandom",
]
[[package]]
name = "venial"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a42528baceab6c7784446df2a10f4185078c39bf73dc614f154353f1a6b1229"
dependencies = [
"proc-macro2",
"quote",
]
[[package]]
name = "wasi"
version = "0.14.2+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
dependencies = [
"wit-bindgen-rt",
]
[[package]]
name = "wit-bindgen-rt"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
dependencies = [
"bitflags",
]

10
rust/Cargo.toml Normal file
View file

@ -0,0 +1,10 @@
[package]
name = "studio_suicide"
version = "0.1.0"
edition = "2024"
[lib]
crate-type = ["cdylib"]
[dependencies]
godot = "0.2.4"

7
rust/src/lib.rs Normal file
View file

@ -0,0 +1,7 @@
pub mod player;
use godot::prelude::*;
struct MyExtension;
#[gdextension]
unsafe impl ExtensionLibrary for MyExtension {}

32
rust/src/player.rs Normal file
View file

@ -0,0 +1,32 @@
use godot::classes::{ISprite2D, Sprite2D};
use godot::prelude::*;
#[derive(GodotClass)]
#[class(base=Sprite2D)]
struct Player {
speed: f64,
angular_speed: f64,
base: Base<Sprite2D>,
}
#[godot_api]
impl ISprite2D for Player {
fn init(base: Base<Sprite2D>) -> Self {
godot_print!("this sprite is controlled by a rust extension! :3");
Self {
speed: 400.0,
angular_speed: std::f64::consts::PI,
base,
}
}
fn physics_process(&mut self, delta: f64) {
let radians = (self.angular_speed * delta) as f32;
self.base_mut().rotate(radians);
let rotation = self.base().get_rotation();
let velocity = Vector2::UP.rotated(rotation) * self.speed as f32;
self.base_mut().translate(velocity * delta as f32);
}
}