Now entities create their own bodies when they are missing. Also update ESS to the latest to get the body-related changes.

This commit is contained in:
Relintai 2020-04-24 13:48:54 +02:00
parent 2382f9d3c1
commit dee366cbf7
16 changed files with 96 additions and 110 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": {"3.2": "ed27b7e6b973eb6be6fdac4439e99a1907b9cb58", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "97f10512f8832394389e1109154b8af34a2ef2c6"}, "entity_spell_system": {"master": "677f138a462b248d45b679a66d0b4cd3ed886ef8"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "233dde39defd6608913da5434d8ef2cbff3bfd42"}, "texture_packer": {"master": "b29b499adf570aa7f85af69ef080ff0d5e04afae"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "4ee946963a16bbfdb4dbb5df52134d22aa168041"}, "procedural_animations": {"master": "9ae56c17230ba9c6160777650b2b89eecdc8df9e"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "f6d3d65cc6ce4dddfc68054164feec1f612ecd1f"}, "props": {"master": "b2bcb5ea6469b19298cd849c1232ddb5ad26f71c"}} {"engine": {"3.2": "ed27b7e6b973eb6be6fdac4439e99a1907b9cb58", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "97f10512f8832394389e1109154b8af34a2ef2c6"}, "entity_spell_system": {"master": "909f34af03048fd966fed5785e8567276e3ec132"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "233dde39defd6608913da5434d8ef2cbff3bfd42"}, "texture_packer": {"master": "b29b499adf570aa7f85af69ef080ff0d5e04afae"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "4ee946963a16bbfdb4dbb5df52134d22aa168041"}, "procedural_animations": {"master": "9ae56c17230ba9c6160777650b2b89eecdc8df9e"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "f6d3d65cc6ce4dddfc68054164feec1f612ecd1f"}, "props": {"master": "b2bcb5ea6469b19298cd849c1232ddb5ad26f71c"}}

View File

@ -1,7 +1,8 @@
[gd_resource type="EntityData" load_steps=4 format=2] [gd_resource type="EntityData" load_steps=5 format=2]
[ext_resource path="res://data/entity_classes/1_naturalist.tres" type="EntityClassData" id=1] [ext_resource path="res://data/entity_classes/1_naturalist.tres" type="EntityClassData" id=1]
[ext_resource path="res://scripts/entities/EntityDataGD.gd" type="Script" id=2] [ext_resource path="res://scripts/entities/EntityDataGD.gd" type="Script" id=2]
[ext_resource path="res://data/species/1_human_female.tres" type="EntitySpeciesData" id=3]
[sub_resource type="LootDataBase" id=1] [sub_resource type="LootDataBase" id=1]
@ -11,6 +12,7 @@ id = 1
entity_type = 4 entity_type = 4
entity_controller = 1 entity_controller = 1
text_name = "Naturalist" text_name = "Naturalist"
entity_species_data = ExtResource( 3 )
entity_class_data = ExtResource( 1 ) entity_class_data = ExtResource( 1 )
loot_db = SubResource( 1 ) loot_db = SubResource( 1 )
script = ExtResource( 2 ) script = ExtResource( 2 )

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,9 @@
[gd_resource type="SpeciesModelData" load_steps=2 format=2]
[ext_resource path="res://data/models/HumanFemale.tscn" type="PackedScene" id=1]
[resource]
resource_name = "Human Female"
id = 1
text_name = "Human Female"
body = ExtResource( 1 )

View File

@ -0,0 +1,37 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://data/models/armature_model_orig_v2.tscn" type="PackedScene" id=1]
[ext_resource path="res://player/Body.gd" type="Script" id=6]
[sub_resource type="CapsuleShape" id=1]
radius = 0.266582
height = 0.927641
[sub_resource type="BoxShape" id=2]
extents = Vector3( 0.216228, 0.0681041, 0.183397 )
[node name="HumanFemale" type="KinematicBody"]
script = ExtResource( 6 )
model_path = NodePath("../HumanFemale/Rotation_Helper/Model")
character_skeleton_path = NodePath("../HumanFemale/Rotation_Helper/Model/character")
[node name="Body_CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.73, 0 )
shape = SubResource( 1 )
[node name="Feet_CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 )
shape = SubResource( 2 )
[node name="Rotation_Helper" type="Spatial" parent="."]
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
[node name="Model" type="Spatial" parent="Rotation_Helper"]
[node name="character" parent="Rotation_Helper/Model" instance=ExtResource( 1 )]
mesh_instance_path = NodePath("../../../../HumanFemale/Rotation_Helper/Model/character/armature/Armature/Skeleton/MeshInstance")
skeleton_path = NodePath("../../../../HumanFemale/Rotation_Helper/Model/character/armature/Armature/Skeleton")
left_hand_attach_point_path = NodePath("../../../../HumanFemale/Rotation_Helper/Model/character/armature/Armature/Skeleton/LeftHandAttachment/LeftHandAP")
right_hand_attach_point_path = NodePath("../../../../HumanFemale/Rotation_Helper/Model/character/armature/Armature/Skeleton/RightHandAttachment/RightHandAP")
torso_attach_point_path = NodePath("../../../../HumanFemale/Rotation_Helper/Model/character/armature/Armature/Skeleton/NeckAttachment/TorsoAP")
root_attach_point_path = NodePath("../../../../HumanFemale/Rotation_Helper/Model/character/armature/Armature/Skeleton/RootAttachment/RootAP")

View File

@ -1,9 +1,10 @@
[gd_resource type="EntityData" load_steps=5 format=2] [gd_resource type="EntityData" load_steps=6 format=2]
[ext_resource path="res://data/entity_classes/1_naturalist.tres" type="EntityClassData" id=1] [ext_resource path="res://data/entity_classes/1_naturalist.tres" type="EntityClassData" id=1]
[ext_resource path="res://scripts/entities/EntityDataGD.gd" type="Script" id=2] [ext_resource path="res://scripts/entities/EntityDataGD.gd" type="Script" id=2]
[ext_resource path="res://data/crafting/1_test_craft.tres" type="CraftRecipe" id=3] [ext_resource path="res://data/crafting/1_test_craft.tres" type="CraftRecipe" id=3]
[ext_resource path="res://data/crafting/2_chest_of_the_infinite_wisdom.tres" type="CraftRecipe" id=4] [ext_resource path="res://data/crafting/2_chest_of_the_infinite_wisdom.tres" type="CraftRecipe" id=4]
[ext_resource path="res://data/species/1_human_female.tres" type="EntitySpeciesData" id=5]
[resource] [resource]
resource_name = "Naturalist" resource_name = "Naturalist"
@ -13,6 +14,7 @@ entity_controller = 1
is_playable = true is_playable = true
text_name = "Naturalist" text_name = "Naturalist"
bag_size = 24 bag_size = 24
entity_species_data = ExtResource( 5 )
entity_class_data = ExtResource( 1 ) entity_class_data = ExtResource( 1 )
craft_recipes = [ ExtResource( 3 ), ExtResource( 4 ) ] craft_recipes = [ ExtResource( 3 ), ExtResource( 4 ) ]
script = ExtResource( 2 ) script = ExtResource( 2 )

View File

@ -0,0 +1,10 @@
[gd_resource type="EntitySpeciesData" load_steps=2 format=2]
[ext_resource path="res://data/models/HumanFemale.tres" type="SpeciesModelData" id=1]
[resource]
resource_name = "Human Female"
id = 1
type = 4
text_name = "Human Female"
model_data = ExtResource( 1 )

View File

@ -1,3 +0,0 @@
[gd_resource type="EntitySpeciesData" format=2]
[resource]

View File

@ -96,12 +96,18 @@ func _ready() -> void:
model_rotation_node = get_node(model_path) model_rotation_node = get_node(model_path)
character_skeleton = get_node(character_skeleton_path) character_skeleton = get_node(character_skeleton_path)
entity = get_node("..") entity = get_node("..")
entity.set_character_skeleton(character_skeleton)
entity.connect("ccast_started", self, "_con_cast_started") entity.connect("ccast_started", self, "_con_cast_started")
entity.connect("ccast_failed", self, "_con_cast_failed") entity.connect("ccast_failed", self, "_con_cast_failed")
entity.connect("ccast_finished", self, "_con_cast_finished") entity.connect("ccast_finished", self, "_con_cast_finished")
entity.connect("cspell_cast_success", self, "_con_spell_cast_success") entity.connect("cspell_cast_success", self, "_con_spell_cast_success")
entity.connect("sdied", self, "on_sdied") entity.connect("sdied", self, "on_sdied")
entity.connect("isc_controlled_changed", self, "on_c_controlled_changed")
owner = entity
on_c_controlled_changed(entity.c_is_controlled)
transform = entity.get_transform_3d(true)
animation_tree = character_skeleton.get_animation_tree() animation_tree = character_skeleton.get_animation_tree()
@ -110,12 +116,14 @@ func _ready() -> void:
animation_tree["parameters/run-loop/blend_position"] = Vector2(0, -1) animation_tree["parameters/run-loop/blend_position"] = Vector2(0, -1)
# set_process(false)
# set_process_input(false)
# set_process_unhandled_input(false)
func _enter_tree(): func _enter_tree():
world = get_node(world_path) as VoxelWorld world = get_node(world_path) as VoxelWorld
set_process(true)
set_physics_process(true) set_physics_process(true)
get_parent().connect("isc_controlled_changed", self, "on_c_controlled_changed")
func _process(delta : float) -> void: func _process(delta : float) -> void:
if entity.ai_state == EntityEnums.AI_STATE_OFF: if entity.ai_state == EntityEnums.AI_STATE_OFF:
@ -568,22 +576,24 @@ func on_c_controlled_changed(val):
#create camera and pivot if true #create camera and pivot if true
_controlled = val _controlled = val
# set_physics_process(val)
set_process_input(val)
set_process_unhandled_input(val)
if val: if val:
var cam_scene : PackedScene = ResourceLoader.load("res://data/camera/CameraPivot.tscn") var cam_scene : PackedScene = ResourceLoader.load("res://data/camera/CameraPivot.tscn")
camera_pivot = cam_scene.instance() as Spatial camera_pivot = cam_scene.instance() as Spatial
add_child(camera_pivot) add_child(camera_pivot)
camera = camera_pivot.get_node("Camera") as Camera camera = camera_pivot.get_node("Camera") as Camera
set_process_input(true)
set_process_unhandled_input(true)
else: else:
if camera_pivot: if camera_pivot:
camera_pivot.queue_free() camera_pivot.queue_free()
camera_pivot = null camera_pivot = null
camera = null camera = null
set_process_input(false)
set_process_unhandled_input(false)
func on_sdied(entity): func on_sdied(entity):
if dead: if dead:

View File

@ -133,9 +133,10 @@ func _enter_tree():
for iv in viss: for iv in viss:
add_item_visual(iv as ItemVisual) add_item_visual(iv as ItemVisual)
#func _exit_tree(): func _exit_tree():
# if _thread != null: if _thread != null:
# _thread.wait_to_finish() _thread.wait_to_finish()
_thread = null
func _process(delta): func _process(delta):
if use_threads and _thread_done: if use_threads and _thread_done:

View File

@ -1,16 +1,7 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://data/models/armature_model_orig_v2.tscn" type="PackedScene" id=1]
[ext_resource path="res://player/Mob.gd" type="Script" id=2] [ext_resource path="res://player/Mob.gd" type="Script" id=2]
[ext_resource path="res://ui/nameplates/NamePlate.tscn" type="PackedScene" id=3] [ext_resource path="res://ui/nameplates/NamePlate.tscn" type="PackedScene" id=3]
[ext_resource path="res://player/Body.gd" type="Script" id=4]
[sub_resource type="CapsuleShape" id=1]
radius = 0.266582
height = 0.927641
[sub_resource type="BoxShape" id=2]
extents = Vector3( 0.216228, 0.0681041, 0.183397 )
[node name="Mob" type="Entity" groups=[ [node name="Mob" type="Entity" groups=[
"mobs", "mobs",
@ -21,21 +12,3 @@ script = ExtResource( 2 )
[node name="NamePlate" parent="." instance=ExtResource( 3 )] [node name="NamePlate" parent="." instance=ExtResource( 3 )]
max_distance = 50.0 max_distance = 50.0
[node name="Body" type="KinematicBody" parent="."]
script = ExtResource( 4 )
[node name="Body_CollisionShape" type="CollisionShape" parent="Body"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.73, 0 )
shape = SubResource( 1 )
[node name="Feet_CollisionShape" type="CollisionShape" parent="Body"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 )
shape = SubResource( 2 )
[node name="Rotation_Helper" type="Spatial" parent="Body"]
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
[node name="Model" type="Spatial" parent="Body/Rotation_Helper"]
[node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 1 )]

View File

@ -84,7 +84,7 @@ func _process(delta):
interpolating = false interpolating = false
var position : Vector3 = entity.get_body().translation var position : Vector3 = entity.get_transform_3d().origin
var camera : Camera = get_tree().get_root().get_camera() as Camera var camera : Camera = get_tree().get_root().get_camera() as Camera

View File

@ -1,40 +1,12 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://player/NetworkedPlayer.gd" type="Script" id=1] [ext_resource path="res://player/NetworkedPlayer.gd" type="Script" id=1]
[ext_resource path="res://data/models/armature_model_orig_v2.tscn" type="PackedScene" id=2]
[ext_resource path="res://ui/nameplates/NamePlate.tscn" type="PackedScene" id=3] [ext_resource path="res://ui/nameplates/NamePlate.tscn" type="PackedScene" id=3]
[ext_resource path="res://player/Body.gd" type="Script" id=4]
[sub_resource type="CapsuleShape" id=1]
radius = 0.266582
height = 0.927641
[sub_resource type="BoxShape" id=2]
extents = Vector3( 0.216228, 0.0681041, 0.183397 )
[node name="NetworkedPlayer" type="Entity"] [node name="NetworkedPlayer" type="Entity"]
body_path = NodePath("Body") body_path = NodePath("Body")
character_skeleton_path = NodePath("Body/Rotation_Helper/Model/character") character_skeleton_path = NodePath("Body/Rotation_Helper/Model/character")
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="Body" type="KinematicBody" parent="."]
script = ExtResource( 4 )
[node name="Body_CollisionShape" type="CollisionShape" parent="Body"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.8, 0 )
shape = SubResource( 1 )
[node name="Feet_CollisionShape" type="CollisionShape" parent="Body"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.194237, 0 )
shape = SubResource( 2 )
[node name="Rotation_Helper" type="Spatial" parent="Body"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.960532, 0 )
[node name="Model" type="Spatial" parent="Body/Rotation_Helper"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.875205, 0 )
[node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 2 )]
[node name="NamePlate" parent="." instance=ExtResource( 3 )] [node name="NamePlate" parent="." instance=ExtResource( 3 )]
max_distance = 50.0 max_distance = 50.0

View File

@ -1,41 +1,14 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://data/models/armature_model_orig_v2.tscn" type="PackedScene" id=1]
[ext_resource path="res://player/Player.gd" type="Script" id=2] [ext_resource path="res://player/Player.gd" type="Script" id=2]
[ext_resource path="res://ui/player_ui/player_ui.tscn" type="PackedScene" id=3] [ext_resource path="res://ui/player_ui/player_ui.tscn" type="PackedScene" id=3]
[ext_resource path="res://player/Body.gd" type="Script" id=5]
[sub_resource type="CapsuleShape" id=1]
radius = 0.266582
height = 0.927641
[sub_resource type="BoxShape" id=2]
extents = Vector3( 0.216228, 0.0681041, 0.183397 )
[node name="Player" type="Entity" groups=[ [node name="Player" type="Entity" groups=[
"players", "players",
]] ]]
body_path = NodePath("Body") body_path = NodePath("HumanFemale")
character_skeleton_path = NodePath("Body/Rotation_Helper/Model/character") character_skeleton_path = NodePath("HumanFemale/Rotation_Helper/Model/character")
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="Body" type="KinematicBody" parent="."]
script = ExtResource( 5 )
[node name="Body_CollisionShape" type="CollisionShape" parent="Body"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.73, 0 )
shape = SubResource( 1 )
[node name="Feet_CollisionShape" type="CollisionShape" parent="Body"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 )
shape = SubResource( 2 )
[node name="Rotation_Helper" type="Spatial" parent="Body"]
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
[node name="Model" type="Spatial" parent="Body/Rotation_Helper"]
[node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 1 )]
[node name="GUILayer" parent="." instance=ExtResource( 3 )] [node name="GUILayer" parent="." instance=ExtResource( 3 )]
[connection signal="onc_open_loot_winow_request" from="." to="GUILayer" method="_on_Player_onc_open_loot_winow_request"] [connection signal="onc_open_loot_winow_request" from="." to="GUILayer" method="_on_Player_onc_open_loot_winow_request"]

View File

@ -259,7 +259,7 @@ func _request_entity_spawn(createinfo : EntityCreateInfo):
print("EntityManager: entity node is null") print("EntityManager: entity node is null")
return null return null
entity_node.get_body().translation = createinfo.transform.origin entity_node.set_transform_3d(createinfo.transform)
if (createinfo.parent_path == ""): if (createinfo.parent_path == ""):
if _spawn_parent == null: if _spawn_parent == null:

View File

@ -64,7 +64,7 @@ func _process(delta):
if vis_update >= VIS_UPDATE_INTERVAL: if vis_update >= VIS_UPDATE_INTERVAL:
vis_update = 0 vis_update = 0
var ppos : Vector3 = _player.get_body().transform.origin var ppos : Vector3 = _player.get_transform_3d().origin
var cpos : Vector3 = ppos var cpos : Vector3 = ppos
var ppx : int = int(cpos.x / (chunk_size_x * voxel_scale)) var ppx : int = int(cpos.x / (chunk_size_x * voxel_scale))