From 907988a7d042b4d4ed18ecde70a4783cdb89da6d Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 20 Nov 2019 14:05:35 +0100 Subject: [PATCH] More files. --- game/menu/CharacterEntry.gd | 32 ++ game/menu/CharacterEntry.tscn | 81 +++ .../menu/character_creation_button_group.tres | 3 + game/menu/menu_character_button_group.tres | 3 + game/networking/PlayerMaster.gd | 24 + game/networking/SpawnPoint.gd | 118 ++++ game/player/CameraPivot.gd | 74 +++ game/player/CharacterSkeletonAttachPoint.gd | 56 ++ game/player/CharacterSkeletonGD.gd | 253 +++++++++ game/player/DisplayEntity.gd | 379 +++++++++++++ game/player/DisplayPlayer.gd | 11 + game/player/DisplayPlayer.tscn | 30 + game/player/GUI.gd | 20 + game/player/Mob.gd | 371 ++++++++++++ game/player/Mob.tscn | 45 ++ game/player/MobTest.gd | 31 + game/player/NamePlate.gd | 152 +++++ game/player/NetworkedPlayer.gd | 109 ++++ game/player/NetworkedPlayer.tscn | 37 ++ game/player/Player.gd | 486 ++++++++++++++++ game/player/Player.tscn | 52 ++ game/player/PlayerGDBase.gd | 85 +++ game/player/Unitframes.gd | 32 ++ game/project.godot | 365 ++++++++++++ game/prop_tool/Control.tscn | 9 + game/prop_tool/ToolTes2at.tres | 37 ++ game/prop_tool/ToolTest.tres | 41 ++ game/prop_tool/ToolTest.tscn | 97 ++++ game/prop_tool/dada.tres | 44 ++ game/scenes/BrokenSeals.tscn | 3 + game/scenes/CharacterCreationMenu.gd | 64 +++ game/scenes/CharacterSelector.gd | 36 ++ game/scenes/CharacterSelectorMenu.gd | 147 +++++ game/scenes/ConnectButton.gd | 19 + game/scenes/ConnectServerButton.gd | 57 ++ game/scenes/DisconnectButton.gd | 19 + game/scenes/GameScene.gd | 9 + game/scenes/HostButton.gd | 16 + game/scenes/HostGameButton.gd | 55 ++ game/scenes/Main.tscn | 96 ++++ game/scenes/MainScene.gd | 93 +++ game/scenes/Menu.gd | 30 + game/scenes/Menu.tscn | 528 ++++++++++++++++++ game/scenes/Shared.tscn | 11 + game/scenes/World.tscn | 80 +++ 45 files changed, 4340 insertions(+) create mode 100644 game/menu/CharacterEntry.gd create mode 100644 game/menu/CharacterEntry.tscn create mode 100644 game/menu/character_creation_button_group.tres create mode 100644 game/menu/menu_character_button_group.tres create mode 100644 game/networking/PlayerMaster.gd create mode 100644 game/networking/SpawnPoint.gd create mode 100644 game/player/CameraPivot.gd create mode 100644 game/player/CharacterSkeletonAttachPoint.gd create mode 100644 game/player/CharacterSkeletonGD.gd create mode 100644 game/player/DisplayEntity.gd create mode 100644 game/player/DisplayPlayer.gd create mode 100644 game/player/DisplayPlayer.tscn create mode 100644 game/player/GUI.gd create mode 100644 game/player/Mob.gd create mode 100644 game/player/Mob.tscn create mode 100644 game/player/MobTest.gd create mode 100644 game/player/NamePlate.gd create mode 100644 game/player/NetworkedPlayer.gd create mode 100644 game/player/NetworkedPlayer.tscn create mode 100644 game/player/Player.gd create mode 100644 game/player/Player.tscn create mode 100644 game/player/PlayerGDBase.gd create mode 100644 game/player/Unitframes.gd create mode 100644 game/project.godot create mode 100644 game/prop_tool/Control.tscn create mode 100644 game/prop_tool/ToolTes2at.tres create mode 100644 game/prop_tool/ToolTest.tres create mode 100644 game/prop_tool/ToolTest.tscn create mode 100644 game/prop_tool/dada.tres create mode 100644 game/scenes/BrokenSeals.tscn create mode 100644 game/scenes/CharacterCreationMenu.gd create mode 100644 game/scenes/CharacterSelector.gd create mode 100644 game/scenes/CharacterSelectorMenu.gd create mode 100644 game/scenes/ConnectButton.gd create mode 100644 game/scenes/ConnectServerButton.gd create mode 100644 game/scenes/DisconnectButton.gd create mode 100644 game/scenes/GameScene.gd create mode 100644 game/scenes/HostButton.gd create mode 100644 game/scenes/HostGameButton.gd create mode 100644 game/scenes/Main.tscn create mode 100644 game/scenes/MainScene.gd create mode 100644 game/scenes/Menu.gd create mode 100644 game/scenes/Menu.tscn create mode 100644 game/scenes/Shared.tscn create mode 100644 game/scenes/World.tscn diff --git a/game/menu/CharacterEntry.gd b/game/menu/CharacterEntry.gd new file mode 100644 index 00000000..3f2a8c63 --- /dev/null +++ b/game/menu/CharacterEntry.gd @@ -0,0 +1,32 @@ +extends Button + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export(NodePath) var name_label_path : NodePath +export(NodePath) var class_label_path : NodePath +export(NodePath) var level_label_path : NodePath + +var id : int +var file_name : String +var name_label : Label +var class_label : Label +var level_label : Label +var entity : Entity + +func _ready(): + name_label = get_node(name_label_path) as Label + class_label = get_node(class_label_path) as Label + level_label = get_node(level_label_path) as Label + + +func setup(pfile_name : String, name : String, cls_name : String, level : int, pentity : Entity) -> void: + file_name = pfile_name + name_label.text = name + class_label.text = cls_name + level_label.text = str(level) + entity = pentity + +func set_class_name(name : String) -> void: + class_label.text = name diff --git a/game/menu/CharacterEntry.tscn b/game/menu/CharacterEntry.tscn new file mode 100644 index 00000000..54ca93dd --- /dev/null +++ b/game/menu/CharacterEntry.tscn @@ -0,0 +1,81 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://ui/theme/ui_theme.tres" type="Theme" id=1] +[ext_resource path="res://menu/CharacterEntry.gd" type="Script" id=2] + +[node name="CharacterEntry" type="Button"] +margin_right = 224.0 +margin_bottom = 88.0 +rect_min_size = Vector2( 80, 80 ) +size_flags_horizontal = 3 +theme = ExtResource( 1 ) +toggle_mode = true +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} +name_label_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/name") +class_label_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/class") +level_label_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/level") + +[node name="MarginContainer" type="MarginContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_constants/margin_right = 5 +custom_constants/margin_top = 5 +custom_constants/margin_left = 5 +custom_constants/margin_bottom = 5 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"] +margin_left = 5.0 +margin_top = 5.0 +margin_right = 219.0 +margin_bottom = 83.0 +mouse_filter = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="PanelContainer" type="PanelContainer" parent="MarginContainer/HBoxContainer"] +margin_right = 68.0 +margin_bottom = 78.0 +mouse_filter = 2 +size_flags_vertical = 3 + +[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer/PanelContainer"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 64.0 +margin_bottom = 74.0 +rect_min_size = Vector2( 60, 60 ) +mouse_filter = 2 +custom_constants/margin_right = 5 +custom_constants/margin_top = 5 +custom_constants/margin_left = 5 +custom_constants/margin_bottom = 5 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"] +margin_left = 76.0 +margin_right = 214.0 +margin_bottom = 78.0 +mouse_filter = 2 +size_flags_horizontal = 3 + +[node name="name" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"] +margin_right = 138.0 +margin_bottom = 15.0 + +[node name="class" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"] +margin_top = 23.0 +margin_right = 138.0 +margin_bottom = 38.0 + +[node name="level" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"] +margin_top = 46.0 +margin_right = 138.0 +margin_bottom = 61.0 diff --git a/game/menu/character_creation_button_group.tres b/game/menu/character_creation_button_group.tres new file mode 100644 index 00000000..0e55d740 --- /dev/null +++ b/game/menu/character_creation_button_group.tres @@ -0,0 +1,3 @@ +[gd_resource type="ButtonGroup" format=2] + +[resource] diff --git a/game/menu/menu_character_button_group.tres b/game/menu/menu_character_button_group.tres new file mode 100644 index 00000000..0e55d740 --- /dev/null +++ b/game/menu/menu_character_button_group.tres @@ -0,0 +1,3 @@ +[gd_resource type="ButtonGroup" format=2] + +[resource] diff --git a/game/networking/PlayerMaster.gd b/game/networking/PlayerMaster.gd new file mode 100644 index 00000000..fe8c2451 --- /dev/null +++ b/game/networking/PlayerMaster.gd @@ -0,0 +1,24 @@ +extends Resource +class_name PlayerMaster + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +# Player info, associate ID to data +var player_info = {} +# Info we send to other players +var my_info = { name = "Testname", selected_class = 1 } +var sid : int + +var player : Entity + +func _init(): + pass + +func _notification(what : int) -> void: + if what == NOTIFICATION_PREDELETE: + #save + #cleanup + pass + diff --git a/game/networking/SpawnPoint.gd b/game/networking/SpawnPoint.gd new file mode 100644 index 00000000..cedffb2d --- /dev/null +++ b/game/networking/SpawnPoint.gd @@ -0,0 +1,118 @@ +extends Spatial + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export (bool) var use_gui : bool = false +export (bool) var multi_player : bool = false +export (NodePath) var gui_path : NodePath +export (NodePath) var host_button_path : NodePath + +export (NodePath) var address_line_edit_path : NodePath +export (NodePath) var port_line_edit_path : NodePath + +export (NodePath) var connect_button_path : NodePath +export (NodePath) var naturalist_button_path : NodePath + +export (NodePath) var terrarin_path : NodePath + +var gui : Node +var host_button : Button +var address_line_edit : LineEdit +var port_line_edit : LineEdit +var connect_button : Button +var naturalist_button : Button + +var player : Entity +var terrarin : VoxelWorld + +var spawned : bool = false + +var player_master : PlayerMaster + +func _ready(): + gui = get_node(gui_path) + host_button = get_node(host_button_path) + host_button.connect("pressed", self, "_on_host_button_clicked") + + address_line_edit = get_node(address_line_edit_path) + port_line_edit = get_node(port_line_edit_path) + + connect_button = get_node(connect_button_path) + connect_button.connect("pressed", self, "_on_client_button_clicked") + + naturalist_button = get_node(naturalist_button_path) + naturalist_button.connect("pressed", self, "_on_client_naturalist_button_clicked") + + terrarin = get_node(terrarin_path) as VoxelWorld + + Server.connect("cplayer_master_created", self, "_cplayer_master_created") + + if not multi_player: + set_process(true) + else: + set_process(false) + + if use_gui: + gui.visible = true + +func _process(delta): + set_process(false) + + spawn() + +func spawn(): + if not spawned: + spawned = true + + if get_tree().network_peer == null: + player = Entities.spawn_player(1, Vector3(10, 20, 10), "Player", "1", 1) + call_deferred("set_terrarin_player") +# +# Entities.spawn_mob(1, 50, Vector3(20, 6, 20)) +# Entities.spawn_mob(1, 50, Vector3(54, 6, 22)) +# Entities.spawn_mob(1, 50, Vector3(76, 6, 54)) + +func set_terrarin_player(): + terrarin.set_player(player as Spatial) + +func _on_host_button_clicked(): + get_tree().connect("network_peer_connected", self, "_network_peer_connected") + get_tree().connect("network_peer_disconnected", self, "_network_peer_disconnected") + + Server.start_hosting() + + spawn() + +func _on_client_button_clicked(): + + var addr : String = "127.0.0.1" if address_line_edit.text == "" else address_line_edit.text + var port : int = 0 if port_line_edit.text == "" else int(port_line_edit.text) + + Server.connect_to_server(addr, port) + + + +func _network_peer_connected(id : int): + print(id) + +func _network_peer_disconnected(id : int): + print(id) + +func _cplayer_master_created(pplayer_master): + player_master = pplayer_master as PlayerMaster + +func _on_client_naturalist_button_clicked(): + #Network.is + #set_class + + gui.visible = false + + if get_tree().network_peer != null: + Server.set_class() + else: + spawn() + + + diff --git a/game/player/CameraPivot.gd b/game/player/CameraPivot.gd new file mode 100644 index 00000000..4ca93e57 --- /dev/null +++ b/game/player/CameraPivot.gd @@ -0,0 +1,74 @@ +extends Spatial + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export (float) var max_camera_distance : float = 20.0 + +var target_camera_distance : float = 6.0 +var camera_distance : float = target_camera_distance + +var camera : Camera + +var x_rot : float = 0.0 +var y_rot : float = 0.0 + +var player : Entity + +func _ready() -> void: + camera = $Camera + + camera.translation.z = target_camera_distance + + player = get_node("..") + + set_physics_process(true) + +func _physics_process(delta): + var pos : Vector3 = to_global(Vector3()) + + var space_state = get_world().direct_space_state + + var result : Dictionary = space_state.intersect_ray(pos, to_global(Vector3(0, 0, target_camera_distance)), [player], player.collision_mask) + + if result: + camera_distance = (result.position - pos).length() - 0.2 + else: + camera_distance = target_camera_distance + + camera.translation.z = camera_distance + +func camera_distance_set_delta(delta : float) -> void: + target_camera_distance += delta + + if target_camera_distance > max_camera_distance: + target_camera_distance = max_camera_distance + elif target_camera_distance < 0: + target_camera_distance = 0 + +func rotate_delta(x_delta : float, y_delta : float) -> void: + x_rot += y_delta + y_rot += x_delta + + x_rot = clamp(x_rot, -90, 90) + + if y_rot >= 360: + y_rot = y_rot - 360 + if y_rot < 0: + y_rot = y_rot + 360 + + rotation_degrees = Vector3(x_rot, y_rot, 0.0) + +func get_y_rot() -> float: + return y_rot + +func set_y_rot(yrot : float) -> void: + y_rot = yrot + + rotation_degrees = Vector3(x_rot, y_rot, 0.0) + +func a_process(delta : float) -> void: + y_rot += delta + + rotation_degrees = Vector3(x_rot, y_rot, 0.0) diff --git a/game/player/CharacterSkeletonAttachPoint.gd b/game/player/CharacterSkeletonAttachPoint.gd new file mode 100644 index 00000000..54fd30ad --- /dev/null +++ b/game/player/CharacterSkeletonAttachPoint.gd @@ -0,0 +1,56 @@ +extends Spatial +class_name CharacterSkeketonAttachPoint + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +var effects : Dictionary +var timed_effects : Dictionary + +func add_effect(effect : PackedScene) -> void: + if effects.has(effect): + effects[effect][0] = effects[effect][0] + 1 + else: + var eff : Node = effect.instance() + + add_child(eff) + eff.owner = self + + var data : Array = [ 1, eff ] + effects[effect] = data + +func add_effect_timed(effect : PackedScene, time : float) -> void: + if timed_effects.has(effect): + timed_effects[effect][0] = timed_effects[effect][0] + 1 + else: + var eff : Node = effect.instance() + + add_child(eff) + eff.owner = self + + var data : Array = [ 1, eff, time ] + timed_effects[effect] = data + +func remove_effect(effect : PackedScene) -> void: + if effects.has(effect): + var data : Array = effects[effect] + + data[0] = data[0] - 1 + + if data[0] <= 0: + data[1].queue_free() + + effects.erase(effect) + + +func _process(delta : float) -> void: + for k in timed_effects.keys(): + var data : Array = timed_effects[k] + + data[2] -= delta + + if data[2] <= 0: + data[1].queue_free() + + timed_effects.erase(k) diff --git a/game/player/CharacterSkeletonGD.gd b/game/player/CharacterSkeletonGD.gd new file mode 100644 index 00000000..c0b638dd --- /dev/null +++ b/game/player/CharacterSkeletonGD.gd @@ -0,0 +1,253 @@ +tool +extends CharacterSkeleton3D + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export(bool) var refresh_in_editor : bool = false setget editor_build +export(bool) var automatic_build : bool = false +export(bool) var use_threads : bool = false + +export(NodePath) var mesh_instance_path : NodePath +var mesh_instance : MeshInstance = null + +export(NodePath) var skeleton_path : NodePath +var skeleton : Skeleton + +export(Material) var material : Material = null +var _material : Material = null + +export (NodePath) var left_hand_attach_point_path : NodePath +var left_hand_attach_point : CharacterSkeketonAttachPoint +export (NodePath) var right_hand_attach_point_path : NodePath +var right_hand_attach_point : CharacterSkeketonAttachPoint +export (NodePath) var torso_attach_point_path : NodePath +var torso_attach_point : CharacterSkeketonAttachPoint +export (NodePath) var root_attach_point_path : NodePath +var root_attach_point : CharacterSkeketonAttachPoint + +export(Array, ItemVisual) var viss : Array + +var _texture_packer : TexturePacker +var _textures : Array +var _texture : Texture + +var mesh : ArrayMesh = null +var st : SurfaceTool = null + +var _thread_done : bool = false +var _thread : Thread = null + +var _editor_built : bool = false + +func _ready(): + st = SurfaceTool.new() + _texture_packer = TexturePacker.new() +# _texture_packer.texture_flags = 0 + _texture_packer.texture_flags = Texture.FLAG_FILTER + _texture_packer.max_atlas_size = 512 + + skeleton = get_node(skeleton_path) as Skeleton + mesh_instance = get_node(mesh_instance_path) as MeshInstance + + left_hand_attach_point = get_node(left_hand_attach_point_path) as CharacterSkeketonAttachPoint + right_hand_attach_point = get_node(right_hand_attach_point_path) as CharacterSkeketonAttachPoint + torso_attach_point = get_node(torso_attach_point_path) as CharacterSkeketonAttachPoint + root_attach_point = get_node(root_attach_point_path) as CharacterSkeketonAttachPoint + + if not OS.can_use_threads(): + use_threads = false + + set_process(false) + +# if not Engine.is_editor_hint(): + for iv in viss: + add_item_visual(iv as ItemVisual) + +#func _exit_tree(): +# if _thread != null: +# _thread.wait_to_finish() + +func _process(delta): + if use_threads and _thread_done: + _thread.wait_to_finish() + _thread = null + finish_build_mesh() + set_process(false) + _thread_done = false + + +func _build_model(): + if Engine.is_editor_hint() and not refresh_in_editor: + set_process(false) + return + + if not automatic_build: + set_process(false) + return + + if use_threads: + build_threaded() + else: + build() + set_process(false) + + model_dirty = false + +func build(): + setup_build_mesh() + build_mesh("") + finish_build_mesh() + +func build_threaded(): + if _thread == null: + _thread = Thread.new() + + setup_build_mesh() + _thread.start(self, "build_mesh") + set_process(true) + +func build_mesh(data) -> void: + sort_layers() + + prepare_textures() + + st.clear() + st.set_material(_material) + st.begin(Mesh.PRIMITIVE_TRIANGLES) + var vertex_count : int = 0 + + for bone_idx in range(EntityEnums.SKELETON_POINTS_MAX): + for j in range(get_model_entry_count(bone_idx)): + var entry : SkeletonModelEntry = get_model_entry(bone_idx, j) + + if entry.entry.get_mesh(gender) != null: + var bt : Transform = skeleton.get_bone_global_pose(bone_idx) + + var arrays : Array = entry.entry.get_mesh(gender).array + + var vertices : PoolVector3Array = arrays[ArrayMesh.ARRAY_VERTEX] as PoolVector3Array + var normals : PoolVector3Array = arrays[ArrayMesh.ARRAY_NORMAL] as PoolVector3Array + var uvs : PoolVector2Array = arrays[ArrayMesh.ARRAY_TEX_UV] as PoolVector2Array + + var indices : PoolIntArray = arrays[ArrayMesh.ARRAY_INDEX] as PoolIntArray + + var bone_array : PoolIntArray = PoolIntArray() + bone_array.append(bone_idx) + + var weights_array : PoolRealArray = PoolRealArray() + weights_array.append(1.0) + + var ta : AtlasTexture = _textures[bone_idx] + + var tx : float = 0 + var ty : float = 0 + var tw : float = 1 + var th : float = 1 + + if ta != null and _texture != null: + var otw : float = _texture.get_width() + var oth : float = _texture.get_height() + + tx = ta.region.position.x / otw + ty = ta.region.position.y / oth + tw = ta.region.size.x / otw + th = ta.region.size.y / oth + + + for i in range(len(vertices)): + st.add_normal(bt.basis.xform(normals[i])) + + var uv : Vector2 = uvs[i] + + uv.x = tw * uv.x + tx + uv.y = th * uv.y + ty + + st.add_uv(uv) + + st.add_bones(bone_array) + st.add_weights(weights_array) + st.add_vertex(bt.xform(vertices[i])) + + for i in range(len(indices)): + st.add_index(vertex_count + indices[i]) + + vertex_count += len(vertices) + + mesh = st.commit() + mesh.surface_set_material(0, _material) + +# finish_build_mesh() + _thread_done = true + +func prepare_textures() -> void: + _texture_packer.clear() + + _textures.clear() + _textures.resize(EntityEnums.SKELETON_POINTS_MAX) + + for bone_idx in range(EntityEnums.SKELETON_POINTS_MAX): + var texture : Texture + + for j in range(get_model_entry_count(bone_idx)): + var entry : SkeletonModelEntry = get_model_entry(bone_idx, j) + + if entry.entry.get_texture(gender) != null: + texture = _texture_packer.add_texture(entry.entry.get_texture(gender)) +# print(texture) + break + + _textures[bone_idx] = texture + + _texture_packer.merge() + + if _material == null: + _material = material.duplicate() + + var tex : Texture = _texture_packer.get_generated_texture(0) + + var mat : SpatialMaterial = _material as SpatialMaterial + mat.albedo_texture = tex + _texture = tex + + +func setup_build_mesh() -> void: + if get_animation_tree() != null: + get_animation_tree().active = false + + if get_animation_player() != null: + get_animation_player().play("rest") + get_animation_player().seek(0, true) + +func finish_build_mesh() -> void: + mesh_instance.mesh = mesh + + if get_animation_tree() != null: + get_animation_tree().active = true + + +func clear_mesh() -> void: + mesh = null + + if mesh_instance != null: + mesh_instance.mesh = null + +func editor_build(val : bool) -> void: + if not is_inside_tree() or _editor_built: + return + + if st == null: + st = SurfaceTool.new() + + skeleton = get_node(skeleton_path) as Skeleton + mesh_instance = get_node(mesh_instance_path) as MeshInstance + + if val: + _editor_built = true + build() + else: + clear_mesh() + _editor_built = false + + refresh_in_editor = val diff --git a/game/player/DisplayEntity.gd b/game/player/DisplayEntity.gd new file mode 100644 index 00000000..1d989ce0 --- /dev/null +++ b/game/player/DisplayEntity.gd @@ -0,0 +1,379 @@ +extends Entity + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export (float) var MOUSE_SENSITIVITY : float = 0.05 +export (String) var map_path : String + +const ray_length = 1000 +const ACCEL : float = 100.0 +const DEACCEL : float = 100.0 +const GRAVITY : float = -24.8 +const JUMP_SPEED : float = 3.8 +const MAX_SLOPE_ANGLE : float = 40.0 +const MOUSE_TARGET_MAX_OFFSET : int = 10 + +var _on : bool = true + +var y_rot : float = 0.0 + +var vel : Vector3 = Vector3() +var dir : Vector3 = Vector3() + +var input_dir : Vector2 = Vector2() +var mouse_dir : Vector2 = Vector2() +var mouse_move_dir : Vector2 = Vector2() +var mouse_left_down : bool = false +var mouse_right_down : bool = false +var touchpad_dir : Vector2 = Vector2() +var mouse_down_delta : Vector2 = Vector2() +var queued_camera_rotaions : Vector2 = Vector2() + +var key_left : bool = false +var key_right : bool = false +var key_up : bool = false +var key_down : bool = false + +var cursor_grabbed : bool = false +var last_cursor_pos : Vector2 = Vector2() +var mouse_down_pos : Vector2 = Vector2() +var total_down_mouse_delta : Vector2 = Vector2() + +var camera : Camera +var camera_pivot : Spatial + +var animation_tree : AnimationTree +var anim_node_state_machine : AnimationNodeStateMachinePlayback = null +var animation_run : bool = false + +var moving : bool = false +var casting_anim : bool = false + +var last_mouse_over : Entity = null + +func _ready() -> void: + camera = $CameraPivot/Camera as Camera + camera_pivot = $CameraPivot as Spatial + + animation_tree = get_character_skeleton().get_animation_tree() + + if animation_tree != null: + anim_node_state_machine = animation_tree["parameters/playback"] + + set_process(true) + +func _physics_process(delta : float) -> void: + if not _on: + return + + process_input(delta) + process_movement(delta) + +func process_input(delta: float) -> void: + var key_dir : Vector2 = Vector2() + + if key_up: + key_dir.y += 1 + if key_down: + key_dir.y -= 1 + if key_left: + key_dir.x += 1 + if key_right: + key_dir.x -= 1 + + input_dir = key_dir + mouse_dir + touchpad_dir + mouse_move_dir + + var state : int = getc_state() + + if state & EntityEnums.ENTITY_STATE_TYPE_FLAG_ROOT != 0 or state & EntityEnums.ENTITY_STATE_TYPE_FLAG_STUN != 0: + input_dir = Vector2() + return + + var input_length : float = input_dir.length_squared() + + if input_length > 0.1: + if anim_node_state_machine != null and not animation_run: + anim_node_state_machine.travel("run-loop") + animation_run = true + + input_dir = input_dir.normalized() + + animation_tree["parameters/run-loop/blend_position"] = input_dir + else: + if anim_node_state_machine != null and animation_run: + anim_node_state_machine.travel("idle-loop") + animation_run = false + + if queued_camera_rotaions.length_squared() > 1: + camera_pivot.rotate_delta(queued_camera_rotaions.x * 2.0, -queued_camera_rotaions.y) + queued_camera_rotaions = Vector2() + + if input_length > 0.1: + rotate_delta(camera_pivot.get_y_rot()) + camera_pivot.set_y_rot(0.0) + +func process_movement(delta : float) -> void: + var state : int = getc_state() + + if state & EntityEnums.ENTITY_STATE_TYPE_FLAG_ROOT != 0 or state & EntityEnums.ENTITY_STATE_TYPE_FLAG_STUN != 0: + moving = false + return + + if input_dir.x > 0.1 or input_dir.y > 0.1 or input_dir.x < -0.1 or input_dir.y < -0.1: + var forward : Vector3 = Vector3(0, 0, 1).rotated(Vector3(0, 1, 0), deg2rad(y_rot)) + var right : Vector3 = forward.cross(Vector3(0, 1, 0)) * -input_dir.x + forward *= input_dir.y #only potentially make it zero after getting the right vector + + dir = forward + dir += right + + if dir.length_squared() > 0.1: + dir = dir.normalized() + + moving = true + moved() + else: + dir = Vector3() + moving = false + + vel.y += delta * GRAVITY + + var hvel : Vector3 = vel + hvel.y = 0 + + var target : Vector3 = dir + target *= get_speed().ccurrent + + var accel + if dir.dot(hvel) > 0: + accel = ACCEL + else: + accel = DEACCEL + + hvel = hvel.linear_interpolate(target, accel * delta) as Vector3 + vel.x = hvel.x + vel.z = hvel.z + vel = move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE)) + + if get_tree().network_peer: + if get_tree().is_network_server(): + set_position(translation, rotation) + else: + rpc("set_position", translation, rotation) + +func _input(event: InputEvent) -> void: + if not cursor_grabbed: + set_process_input(false) + return + + if event is InputEventMouseMotion and event.device != -1: + var s : float = ProjectSettings.get("display/mouse_cursor/sensitivity") + + var relx : float = event.relative.x * s + var rely : float = event.relative.y * s + + mouse_down_delta.x += relx + mouse_down_delta.y += rely + + total_down_mouse_delta.x += relx + total_down_mouse_delta.y += rely + + get_tree().set_input_as_handled() + + if (mouse_right_down or mouse_left_down) and event.device != -1: + if mouse_right_down: + camera_pivot.rotate_delta(0.0, event.relative.y) + rotate_delta(-event.relative.x) + else: + camera_pivot.rotate_delta(-relx, rely) + +func _unhandled_input(event: InputEvent) -> void: + if event is InputEventKey: + var ievkey : InputEventKey = event as InputEventKey + + if ievkey.scancode == KEY_W: + key_up = ievkey.pressed + if ievkey.scancode == KEY_S: + key_down = ievkey.pressed + if ievkey.scancode == KEY_A: + key_left = ievkey.pressed + if ievkey.scancode == KEY_D: + key_right = ievkey.pressed + + if event is InputEventMouseMotion and not (mouse_right_down or mouse_left_down) and event.device != -1: + cmouseover(event) + + if event is InputEventMouseButton: + if event.button_index == BUTTON_LEFT and event.device != -1: + mouse_left_down = event.pressed + + if mouse_left_down: + mouse_down_delta = Vector2() + mouse_down_pos = event.position + + if event.button_index == BUTTON_RIGHT and event.device != -1: + mouse_right_down = event.pressed + + if mouse_right_down: + rotate_delta(camera_pivot.get_y_rot()) + camera_pivot.set_y_rot(0.0) + + if mouse_left_down and mouse_right_down: + mouse_move_dir.y = 1 + else: + mouse_move_dir.y = 0 + + if event.is_pressed() and event.device != -1: + if event.button_index == BUTTON_WHEEL_UP: + camera_pivot.camera_distance_set_delta(-0.2) + if event.button_index == BUTTON_WHEEL_DOWN: + camera_pivot.camera_distance_set_delta(0.2) + + if not event.pressed and event.button_index == BUTTON_LEFT and event.device != -1: + if mouse_down_delta.length() < MOUSE_TARGET_MAX_OFFSET: + target(event.position) + + if event is InputEventScreenTouch and event.pressed: + target(event.position) + + update_cursor_mode() + +func update_cursor_mode(): + if mouse_left_down or mouse_right_down: + if not cursor_grabbed: + set_process_input(true) + total_down_mouse_delta = Vector2() + + cursor_grabbed = true + last_cursor_pos = get_viewport().get_mouse_position() + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + else: + if cursor_grabbed: + set_process_input(false) + cursor_grabbed = false + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + get_viewport().warp_mouse(last_cursor_pos) + + if total_down_mouse_delta.length_squared() < 8: + target(last_cursor_pos) + + +func rotate_delta(x_delta : float) -> void: + y_rot += x_delta + + while y_rot > 360: + y_rot -= 360 + + while y_rot < 0: + y_rot += 360 + + rotation_degrees = Vector3(0.0, y_rot, 0.0) + +func target(position : Vector2): + var from = camera.project_ray_origin(position) + var to = from + camera.project_ray_normal(position) * ray_length + + var space_state = get_world().direct_space_state + var result = space_state.intersect_ray(from, to, [], 2) + + if result: + print(result) + if result.collider and result.collider is Entity: + var ent : Entity = result.collider as Entity + + crequest_target_change(ent.get_path()) + return + + crequest_target_change(NodePath()) + else: + crequest_target_change(NodePath()) + +func cmouseover(event): + var from = camera.project_ray_origin(event.position) + var to = from + camera.project_ray_normal(event.position) * ray_length + + var space_state = get_world().direct_space_state + var result = space_state.intersect_ray(from, to, [], 2) + + if result: + if result.collider and result.collider is Entity: + var mo : Entity = result.collider as Entity + + if last_mouse_over != null and last_mouse_over != mo: + if is_instance_valid(last_mouse_over): + last_mouse_over.onc_mouse_exit() + + last_mouse_over = null + + if last_mouse_over == null: + mo.onc_mouse_enter() + last_mouse_over = mo + + return + + if last_mouse_over != null: + last_mouse_over.onc_mouse_exit() + last_mouse_over = null + +func analog_force_change(vector, touchpad): + if touchpad.padname == "TouchPad": + touchpad_dir = vector + touchpad_dir.x *= -1 + elif touchpad.padname == "TargetPad": + #try to target + return + +func queue_camera_rotation(rot : Vector2) -> void: + queued_camera_rotaions += rot + +remote func set_position(position : Vector3, rotation : Vector3) -> void: + if get_tree().is_network_server(): + rpc("set_position", position, rotation) + +func _moved() -> void: + if sis_casting(): + sfail_cast() + +func _con_target_changed(entity: Entity, old_target: Entity) -> void: + if is_instance_valid(old_target): + old_target.onc_untargeted() + + if is_instance_valid(ctarget): + ctarget.onc_targeted() + + if canc_interact(): + crequest_interact() + +func _con_cast_started(info): + if anim_node_state_machine != null and not casting_anim: + anim_node_state_machine.travel("casting-loop") + casting_anim = true + animation_run = false + +func _con_cast_failed(info): + if anim_node_state_machine != null and casting_anim: + anim_node_state_machine.travel("idle-loop") + casting_anim = false + + if animation_run: + anim_node_state_machine.travel("run-loop") + +func _con_cast_finished(info): + if anim_node_state_machine != null: + anim_node_state_machine.travel("cast-end") + casting_anim = false + + if animation_run: + anim_node_state_machine.travel("run-loop") + +func _con_spell_cast_success(info): + if anim_node_state_machine != null: + anim_node_state_machine.travel("cast-end") + casting_anim = false + + if animation_run: + anim_node_state_machine.travel("run-loop") + + diff --git a/game/player/DisplayPlayer.gd b/game/player/DisplayPlayer.gd new file mode 100644 index 00000000..f7c45020 --- /dev/null +++ b/game/player/DisplayPlayer.gd @@ -0,0 +1,11 @@ +extends Entity +class_name DisplayPlayerGD + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +func _setup(): + ._setup() + + setup_actionbars() diff --git a/game/player/DisplayPlayer.tscn b/game/player/DisplayPlayer.tscn new file mode 100644 index 00000000..78e5dac5 --- /dev/null +++ b/game/player/DisplayPlayer.tscn @@ -0,0 +1,30 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://player/DisplayPlayer.gd" type="Script" id=1] +[ext_resource path="res://data/models/armature_model_orig_v2.tscn" type="PackedScene" id=2] + +[node name="DisplayPlayer" type="Entity" groups=[ +"players", +]] +input_ray_pickable = false +collision_layer = 3 +collision_mask = 3 +character_skeleton_path = NodePath("Rotation_Helper/Model/character") +sseed = 9240987 +cseed = 9240987 +script = ExtResource( 1 ) + +[node name="Rotation_Helper" type="Spatial" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.960532, 0 ) +__meta__ = { +"_editor_description_": "" +} + +[node name="Model" type="Spatial" parent="Rotation_Helper"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.875205, 0 ) +__meta__ = { +"_editor_description_": "" +} + +[node name="character" parent="Rotation_Helper/Model" instance=ExtResource( 2 )] +use_threads = false diff --git a/game/player/GUI.gd b/game/player/GUI.gd new file mode 100644 index 00000000..e8224324 --- /dev/null +++ b/game/player/GUI.gd @@ -0,0 +1,20 @@ +extends Control + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export (NodePath) var player_path : NodePath +export (Array, NodePath) var child_controls : Array + +func _ready() -> void: + + if player_path != null: + var player = get_node(player_path) + + + for child_path in child_controls: + var child = get_node(child_path) + + child.set_player(player) + diff --git a/game/player/Mob.gd b/game/player/Mob.gd new file mode 100644 index 00000000..5290edf4 --- /dev/null +++ b/game/player/Mob.gd @@ -0,0 +1,371 @@ +extends Entity + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +#export (String) var map_path : String +export(float) var max_visible_distance : float = 120 setget set_max_visible_distance +var max_visible_distance_squared : float = max_visible_distance * max_visible_distance + +const ray_length = 1000 +const ACCEL : float = 100.0 +const DEACCEL : float = 100.0 +const GRAVITY : float = -24.8 +const JUMP_SPEED : float = 3.8 +const MAX_SLOPE_ANGLE : float = 40.0 + +#var process_gravity : bool = true + +var _on : bool = true + +var y_rot : float = 0.0 + +var vel : Vector3 = Vector3() +var dir : Vector3 = Vector3() +var target_movement_direction : Vector2 = Vector2() + +var animation_tree : AnimationTree +var anim_node_state_machine : AnimationNodeStateMachinePlayback = null +var animation_run : bool = false + +var moving : bool = false +var sleep : bool = false +var dead : bool = false +var death_timer : float = 0 + +func _ready() -> void: + animation_tree = get_character_skeleton().get_animation_tree() + + if animation_tree != null: + anim_node_state_machine = animation_tree["parameters/playback"] + + animation_tree["parameters/run-loop/blend_position"] = Vector2(0, -1) + + ai_state = EntityEnums.AI_STATE_PATROL + + set_process(true) + set_physics_process(true) + + +func _process(delta : float) -> void: + if dead: + death_timer += delta + + if death_timer > 60: + queue_free() + + return + + var camera : Camera = get_tree().get_root().get_camera() as Camera + + if camera == null: + return + + var cam_pos : Vector3 = camera.global_transform.xform(Vector3()) + var dstv : Vector3 = cam_pos - translation + dstv.y = 0 + var dst : float = dstv.length_squared() + + if dst > max_visible_distance_squared: + if visible: + hide() + return + else: + if not visible: + show() + + #TODO check later if this gives a performance boost +# var cam_facing : Vector3 = -camera.global_transform.basis.z +# var d : float = cam_facing.dot(dstv) +# +# if d > 0: +# if visible: +# hide() +# return +# else: +# if not visible: +# show() + + +func _physics_process(delta : float) -> void: + if not _on: + return + + if sentity_data == null: + return + + if dead: + return + + if ai_state == EntityEnums.AI_STATE_OFF: + return + elif ai_state == EntityEnums.AI_STATE_PATROL: + sentity_data.sai_rest(self) + elif ai_state == EntityEnums.AI_STATE_REST: + sentity_data.sai_rest(self) + elif ai_state == EntityEnums.AI_STATE_REGENERATE: + sentity_data.sai_regenerate(self) + elif ai_state == EntityEnums.AI_STATE_ATTACK: + sentity_data.sai_attack(self) + elif ai_state == EntityEnums.AI_STATE_FOLLOW_PATH: + sentity_data.sai_follow(self) + + process_movement(delta) + +func process_movement(delta : float) -> void: + if starget != null: + look_at(starget.translation, Vector3(0, 1, 0)) + + var state : int = getc_state() + + if state & EntityEnums.ENTITY_STATE_TYPE_FLAG_ROOT != 0 or state & EntityEnums.ENTITY_STATE_TYPE_FLAG_STUN != 0: + moving = false + return + + if target_movement_direction.length_squared() > 0.1: + if anim_node_state_machine != null and not animation_run: + anim_node_state_machine.travel("run-loop") + animation_run = true + + + target_movement_direction = target_movement_direction.normalized() + moving = true + else: + if anim_node_state_machine != null and animation_run: + anim_node_state_machine.travel("idle-loop") + animation_run = false + + moving = false + + if target_movement_direction.x > 0.1 or target_movement_direction.y > 0.1 or target_movement_direction.x < -0.1 or target_movement_direction.y < -0.1: + y_rot = Vector2(0, 1).angle_to(target_movement_direction) + + var forward : Vector3 = Vector3(0, 0, 1).rotated(Vector3(0, 1, 0), deg2rad(y_rot)) + var right : Vector3 = forward.cross(Vector3(0, 1, 0)) * -target_movement_direction.x + forward *= target_movement_direction.y #only potentially make it zero after getting the right vector + + dir = forward + dir += right + + if dir.length_squared() > 0.1: + dir = dir.normalized() + + moving = true + else: + dir = Vector3() + moving = false + + if not moving and sleep: + return + + if moving and sleep: + sleep = false + + vel.y += delta * GRAVITY + + var hvel : Vector3 = vel + hvel.y = 0 + + var target : Vector3 = dir + target *= get_speed().ccurrent + + var accel + if dir.dot(hvel) > 0: + accel = ACCEL + else: + accel = DEACCEL + + hvel = hvel.linear_interpolate(target, accel * delta) as Vector3 + vel.x = hvel.x + vel.z = hvel.z + + var facing : Vector3 = vel + facing.y = 0 + + vel = move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE)) + +# if facing.length_squared() > 0.1: +# look_at(translation + facing, Vector3(0, 1, 0)) +# else: +# if starget != null: +# look_at(starget.translation, Vector3(0, 1, 0)) + + sset_position(translation, rotation) + + if vel.length_squared() < 0.12: + sleep = true + +# if get_tree().network_peer: +# if get_tree().is_network_server(): +# set_position(translation, rotation) +# else: +# rpc("set_position", translation, rotation) + +# print(vel.length_squared()) + + if translation.y < -50.0: + print("killed mob with fall damage") + var sdi : SpellDamageInfo = SpellDamageInfo.new() + sdi.damage_source_type = SpellDamageInfo.DAMAGE_SOURCE_UNKNOWN + sdi.damage = 999999999 + stake_damage(sdi) + +func rotate_delta(x_delta : float) -> void: + y_rot += x_delta + + if y_rot > 360: + y_rot = 0 + if y_rot < 0: + y_rot = 360 + + rotation_degrees = Vector3(0.0, y_rot, 0.0) + +func sstart_attack(entity : Entity) -> void: + ai_state = EntityEnums.AI_STATE_ATTACK + + starget = entity + +func _onc_mouse_enter() -> void: + if centity_interaction_type == EntityEnums.ENITIY_INTERACTION_TYPE_LOOT: + Input.set_default_cursor_shape(Input.CURSOR_CROSS) + else: + Input.set_default_cursor_shape(Input.CURSOR_MOVE) + +func _onc_mouse_exit() -> void: + Input.set_default_cursor_shape(Input.CURSOR_ARROW) + +func _son_death(): + if dead: + return + + if starget == null: + queue_free() + return + + #warning-ignore:unused_variable + for i in range(sget_aura_count()): + sremove_aura(sget_aura(0)) + + dead = true + + var ldiff : float = slevel - starget.slevel + 10.0 + + if ldiff < 0: + ldiff = 0 + + if ldiff > 15: + ldiff = 15 + + ldiff /= 10.0 + + starget.adds_xp(int(5.0 * slevel * ldiff)) + + starget = null + + sentity_interaction_type = EntityEnums.ENITIY_INTERACTION_TYPE_LOOT + ai_state = EntityEnums.AI_STATE_OFF + + anim_node_state_machine.travel("dead") + +# set_process(false) + set_physics_process(false) + +remote func set_position(position : Vector3, rotation : Vector3) -> void: + if get_tree().is_network_server(): + rpc("set_position", position, rotation) + +func _son_damage_dealt(data): + if ai_state != EntityEnums.AI_STATE_ATTACK and data.dealer != self: + sstart_attack(data.dealer) + +func _con_damage_dealt(info : SpellDamageInfo) -> void: +# if info.dealer == + WorldNumbers.damage(translation, 1.6, info.damage, info.crit) + +func _con_heal_dealt(info : SpellHealInfo) -> void: + WorldNumbers.heal(translation, 1.6, info.heal, info.crit) + +func _moved() -> void: + if sis_casting(): + sfail_cast() + +func set_max_visible_distance(var value : float) -> void: + max_visible_distance_squared = value * value + + max_visible_distance = value + +func _setup(): + sentity_name = sentity_data.text_name + +func _son_xp_gained(value : int) -> void: + if not Entities.get_xp_data().can_level_up(gets_level()): + return + + var xpr : int = Entities.get_xp_data().get_xp(gets_level()); + + if xpr <= sxp: + slevelup(1) + sxp = 0 + +func _son_level_up(value: int) -> void: + if sentity_data == null: + return + + var ecd : EntityClassData = sentity_data.entity_class_data + + if ecd == null: + return + + sfree_spell_points += ecd.spell_points_per_level * value + sfree_talent_points += value + + for i in range(Stat.MAIN_STAT_ID_COUNT): +# print(i) + var st : int = sentity_data.entity_class_data.get_stat_data().get_level_stat_data().get_stat_diff(i, slevel - value, slevel) + + var statid : int = i + Stat.MAIN_STAT_ID_START + + var stat : Stat = get_stat_int(statid) + + var sm : StatModifier = stat.get_modifier(0) + sm.base_mod += st + + + var arr : Array = Array() + + for i in range(ecd.get_num_spells()): + arr.append(ecd.get_spell(i)) + + randomize() + arr.shuffle() + + for v in range(value): + for i in range(arr.size()): + var spell : Spell = arr[i] + + if not hass_spell(spell): + var spnum :int = gets_spell_count() + + crequest_spell_learn(spell.id) + + if spnum != gets_spell_count(): + break + + if sfree_spell_points == 0: + break + + + if sfree_spell_points == 0: + break + + +func sset_position(position : Vector3, rotation : Vector3) -> void: + if multiplayer.network_peer and multiplayer.is_network_server(): +# cset_position(position, rotation) + vrpc("cset_position", translation, rotation) + +remote func cset_position(position : Vector3, rotation : Vector3) -> void: + translation = position + rotation = rotation + diff --git a/game/player/Mob.tscn b/game/player/Mob.tscn new file mode 100644 index 00000000..40436f6b --- /dev/null +++ b/game/player/Mob.tscn @@ -0,0 +1,45 @@ +[gd_scene load_steps=6 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://ui/nameplates/NamePlate.tscn" type="PackedScene" id=3] + +[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=[ +"mobs", +]] +input_ray_pickable = false +collision_layer = 3 +collision_mask = 3 +character_skeleton_path = NodePath("Rotation_Helper/Model/character") +script = ExtResource( 2 ) + +[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 )] + +[node name="OmniLight" type="OmniLight" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.185015, 1.74294, -0.107748 ) +visible = false +light_color = Color( 0.592157, 0.631373, 0.607843, 1 ) +omni_range = 8.0 +omni_attenuation = 0.31864 + +[node name="NamePlate" parent="." instance=ExtResource( 3 )] diff --git a/game/player/MobTest.gd b/game/player/MobTest.gd new file mode 100644 index 00000000..7bf0f3a6 --- /dev/null +++ b/game/player/MobTest.gd @@ -0,0 +1,31 @@ +extends Entity + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +# Called when the node enters the scene tree for the first time. +func _ready(): + connect("con_damage_taken", self, "c_on_damage_taken") + connect("son_damage_taken", self, "s_on_damage_taken") + #c_on_damage_taken( Entity Entity, DamagePipelineData damage_pipeline_data ) + + pass # Replace with function body. + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass + +func c_on_damage_taken(entity, dpd): + print("c " + str(dpd.damage)) + print("ch " + str(get_health().ccurrent) + "/" + str(get_health().cmax)) + pass + +func s_on_damage_taken(entity, dpd): + print("s " + str(dpd.damage)) + #print("ch " + str(get_health().scurrent) + "/" + str(get_health().smax)) + pass diff --git a/game/player/NamePlate.gd b/game/player/NamePlate.gd new file mode 100644 index 00000000..95469081 --- /dev/null +++ b/game/player/NamePlate.gd @@ -0,0 +1,152 @@ +extends VBoxContainer + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export(float) var max_distance : float = 70 setget set_max_distance +var max_distance_squared : float = max_distance * max_distance + +export(NodePath) var name_label_path : NodePath = "Name" +export(NodePath) var health_bar_path : NodePath = "HealthBar" +export(NodePath) var health_bar_label_path : NodePath = "HealthBar" + +export(Color) var normal_color : Color = Color("#e7e7e7") +export(Vector2) var normal_scale : Vector2 = Vector2(0.75, 0.75) +export(Color) var mouseover_color : Color = Color("#ffffff") +export(Vector2) var mouseover_scale : Vector2 = Vector2(0.85, 0.85) +export(Color) var targeted_color : Color = Color("#ffffff") +export(Vector2) var targeted_scale : Vector2 = Vector2(0.85, 0.85) + +var target_scale : Vector2 +var interpolating : bool + +var targeted : bool = false + +var name_label : Label = null +var health_bar : TextureProgress = null +var health_bar_label : Label = null + +var entity : Entity = null +var health : Stat = null + +func _ready(): + name_label = get_node(name_label_path) as Label + health_bar = get_node(health_bar_path) as TextureProgress + health_bar_label = get_node(health_bar_label_path) as Label + + entity = get_node("..") as Entity + health = entity.get_health() + + health.connect("c_changed", self, "c_health_changed") + + name_label.text = entity.centity_name + + entity.connect("cname_changed", self, "cname_changed") + entity.connect("onc_mouse_entered", self, "onc_entity_mouse_entered") + entity.connect("onc_mouse_exited", self, "onc_entity_mouse_exited") + entity.connect("onc_targeted", self, "onc_targeted") + entity.connect("onc_untargeted", self, "onc_untargeted") + + c_health_changed(health) + + modulate = normal_color + set_scale(normal_scale) + + target_scale = normal_scale + interpolating = false + + set_process(true) + +func _process(delta): + if interpolating: + var d : Vector2 = ((target_scale - get_scale()).normalized() * delta) + get_scale() + + set_scale(d) + + if (get_scale() - target_scale).length() < 0.01: + interpolating = false + + + var position : Vector3 = entity.translation + + var camera : Camera = get_tree().get_root().get_camera() as Camera + + if camera == null: + return + + var cam_pos : Vector3 = camera.global_transform.xform(Vector3()) + var dstv : Vector3 = cam_pos - position + dstv.y = 0 + var dst : float = dstv.length_squared() + + if dst > max_distance_squared: + if visible: + hide() + return + + var cam_facing : Vector3 = -camera.global_transform.basis.z + var d : float = cam_facing.dot(dstv) + + if d > 0: + if visible: + hide() + return + else: + if not visible: + show() + + + position.y += 1.9 + var screen_position : Vector2 = camera.unproject_position(position) + + var new_pos : Vector2 = Vector2(screen_position.x - (rect_size.x / 2.0) * rect_scale.x, screen_position.y - (rect_size.y) * rect_scale.y) + + set_position(new_pos) + + +func set_max_distance(var value : float) -> void: + max_distance_squared = value * value + + max_distance = value + +func c_health_changed(stat : Stat) -> void: + health_bar.max_value = stat.cmax + health_bar.value = stat.ccurrent + + +# if stat.cmax != 0: +# health_bar_label.text = str(int(stat.ccurrent / stat.cmax * 100)) + +func cname_changed(ent : Entity) -> void: + name_label.text = ent.centity_name + +func onc_entity_mouse_entered() -> void: + if targeted: + return + + modulate = mouseover_color + interpolate_scale(mouseover_scale) + +func onc_entity_mouse_exited() -> void: + if targeted: + return + + modulate = normal_color + interpolate_scale(normal_scale) + +func onc_targeted() -> void: + targeted = true + + modulate = targeted_color + interpolate_scale(targeted_scale) + +func onc_untargeted() -> void: + targeted = false + + modulate = normal_color + interpolate_scale(normal_scale) + +func interpolate_scale(target : Vector2) -> void: + target_scale = target + interpolating = true diff --git a/game/player/NetworkedPlayer.gd b/game/player/NetworkedPlayer.gd new file mode 100644 index 00000000..25d2d8b2 --- /dev/null +++ b/game/player/NetworkedPlayer.gd @@ -0,0 +1,109 @@ +extends "PlayerGDBase.gd" +class_name NetworkedPlayerGD + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +#export (float) var MOUSE_SENSITIVITY : float = 0.05 +#export (String) var map_path : String + +const ray_length = 1000 +const ACCEL : float = 100.0 +const DEACCEL : float = 100.0 +const GRAVITY : float = -24.8 +const JUMP_SPEED : float = 3.8 +const MAX_SLOPE_ANGLE : float = 40.0 +const MOUSE_TARGET_MAX_OFFSET : int = 10 + +#var _on : bool = true + +var y_rot : float = 0.0 + +#var vel : Vector3 = Vector3() +#var dir : Vector3 = Vector3() + +var animation_tree : AnimationTree +var anim_node_state_machine : AnimationNodeStateMachinePlayback = null +#var animation_run : bool = false + +func _ready() -> void: + animation_tree = get_character_skeleton().get_animation_tree() + + if animation_tree != null: + anim_node_state_machine = animation_tree["parameters/playback"] + + +#func _physics_process(delta : float) -> void: +# if not _on: +# return +# + #process_movement(delta) + +#func process_movement(delta : float) -> void: +# if input_dir.x > 0.1 or input_dir.y > 0.1 or input_dir.x < -0.1 or input_dir.y < -0.1: +# var forward : Vector3 = Vector3(0, 0, 1).rotated(Vector3(0, 1, 0), deg2rad(y_rot)) +# var right : Vector3 = forward.cross(Vector3(0, 1, 0)) * -input_dir.x +# forward *= input_dir.y #only potentially make it zero after getting the right vector +# +# dir = forward +# dir += right +# +# if dir.length_squared() > 0.1: +# dir = dir.normalized() +# else: +# dir = Vector3() +# +# vel.y += delta * GRAVITY +# +# var hvel : Vector3 = vel +# hvel.y = 0 +# +# var target : Vector3 = dir +# target *= get_speed().ccurrent +# +# var accel +# if dir.dot(hvel) > 0: +# accel = ACCEL +# else: +# accel = DEACCEL +# +# hvel = hvel.linear_interpolate(target, accel * delta) as Vector3 +# vel.x = hvel.x +# vel.z = hvel.z +# vel = move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE)) + +func rotate_delta(x_delta : float) -> void: + y_rot += x_delta + + if y_rot > 360: + y_rot = 0 + if y_rot < 0: + y_rot = 360 + + rotation_degrees = Vector3(0.0, y_rot, 0.0) + +#remote func set_position(position : Vector3, rot : Vector3) -> void: +# translation = position +# rotation = rot + +remote func sset_position(position : Vector3, rotation : Vector3) -> void: + +# if get_network_master() != 1: +# print(str(get_network_master()) + "npsset") + + if multiplayer.network_peer and multiplayer.is_network_server(): + cset_position(position, rotation) + vrpc("cset_position", translation, rotation) + +remote func cset_position(position : Vector3, rotation : Vector3) -> void: +# if get_network_master() != 1: +# print(str(get_network_master()) + "npcset") + + translation = position + rotation = rotation + +func _moved() -> void: + if sis_casting(): + sfail_cast() + diff --git a/game/player/NetworkedPlayer.tscn b/game/player/NetworkedPlayer.tscn new file mode 100644 index 00000000..418d5f2a --- /dev/null +++ b/game/player/NetworkedPlayer.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=6 format=2] + +[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] + +[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"] +input_ray_pickable = false +collision_layer = 3 +collision_mask = 3 +character_skeleton_path = NodePath("Rotation_Helper/Model/character") +script = ExtResource( 1 ) + +[node name="Body_CollisionShape" type="CollisionShape" parent="."] +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="."] +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="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.960532, 0 ) + +[node name="Model" type="Spatial" parent="Rotation_Helper"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.875205, 0 ) + +[node name="character" parent="Rotation_Helper/Model" instance=ExtResource( 2 )] + +[node name="NamePlate" parent="." instance=ExtResource( 3 )] diff --git a/game/player/Player.gd b/game/player/Player.gd new file mode 100644 index 00000000..ec3667a8 --- /dev/null +++ b/game/player/Player.gd @@ -0,0 +1,486 @@ +extends "PlayerGDBase.gd" +class_name PlayerGD + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export (float) var MOUSE_SENSITIVITY : float = 0.05 +export (String) var world_path : String = ".." + +const ray_length = 1000 +const ACCEL : float = 100.0 +const DEACCEL : float = 100.0 +const GRAVITY : float = -24.8 +const JUMP_SPEED : float = 3.8 +const MAX_SLOPE_ANGLE : float = 40.0 +const MOUSE_TARGET_MAX_OFFSET : int = 10 + +var _on : bool = true + +var y_rot : float = 0.0 + +var vel : Vector3 = Vector3() +var dir : Vector3 = Vector3() + +var input_dir : Vector2 = Vector2() +var mouse_dir : Vector2 = Vector2() +var mouse_move_dir : Vector2 = Vector2() +var mouse_left_down : bool = false +var mouse_right_down : bool = false +var touchpad_dir : Vector2 = Vector2() +var mouse_down_delta : Vector2 = Vector2() +var queued_camera_rotaions : Vector2 = Vector2() + +var key_left : bool = false +var key_right : bool = false +var key_up : bool = false +var key_down : bool = false + +var cursor_grabbed : bool = false +var last_cursor_pos : Vector2 = Vector2() +var mouse_down_pos : Vector2 = Vector2() +var total_down_mouse_delta : Vector2 = Vector2() + +var camera : Camera +var camera_pivot : Spatial + +var animation_tree : AnimationTree +var anim_node_state_machine : AnimationNodeStateMachinePlayback = null +var animation_run : bool = false + +var moving : bool = false +var casting_anim : bool = false + +var last_mouse_over : Entity = null + +var world : VoxelWorld = null + +func _ready() -> void: + camera = $CameraPivot/Camera as Camera + camera_pivot = $CameraPivot as Spatial + + animation_tree = get_character_skeleton().get_animation_tree() + + if animation_tree != null: + anim_node_state_machine = animation_tree["parameters/playback"] + + world = get_node(world_path) as VoxelWorld + +# set_process(true) + +func _physics_process(delta : float) -> void: + if not _on: + return + + if world.initial_generation: + return + + process_input(delta) + process_movement(delta) + +func process_input(delta: float) -> void: + var key_dir : Vector2 = Vector2() + + if key_up: + key_dir.y -= 1 + if key_down: + key_dir.y += 1 + if key_left: + key_dir.x -= 1 + if key_right: + key_dir.x += 1 + + input_dir = key_dir + mouse_dir + touchpad_dir + mouse_move_dir + + var state : int = getc_state() + + if state & EntityEnums.ENTITY_STATE_TYPE_FLAG_ROOT != 0 or state & EntityEnums.ENTITY_STATE_TYPE_FLAG_STUN != 0: + input_dir = Vector2() + return + + var input_length : float = input_dir.length_squared() + + if input_length > 0.1: + if anim_node_state_machine != null and not animation_run: + anim_node_state_machine.travel("run-loop") + animation_run = true + + input_dir = input_dir.normalized() + + animation_tree["parameters/run-loop/blend_position"] = input_dir + else: + if anim_node_state_machine != null and animation_run: + anim_node_state_machine.travel("idle-loop") + animation_run = false + + if queued_camera_rotaions.length_squared() > 1: + camera_pivot.rotate_delta(queued_camera_rotaions.x * 2.0, queued_camera_rotaions.y) + queued_camera_rotaions = Vector2() + + if input_length > 0.1: + rotate_delta(camera_pivot.get_y_rot()) + camera_pivot.set_y_rot(0.0) + +func process_movement(delta : float) -> void: + var state : int = getc_state() + + if state & EntityEnums.ENTITY_STATE_TYPE_FLAG_ROOT != 0 or state & EntityEnums.ENTITY_STATE_TYPE_FLAG_STUN != 0: + moving = false + return + + if input_dir.x > 0.1 or input_dir.y > 0.1 or input_dir.x < -0.1 or input_dir.y < -0.1: + var forward : Vector3 = Vector3(0, 0, 1).rotated(Vector3(0, 1, 0), deg2rad(y_rot)) + var right : Vector3 = forward.cross(Vector3(0, 1, 0)) * -input_dir.x + forward *= input_dir.y #only potentially make it zero after getting the right vector + + dir = forward + dir += right + + if dir.length_squared() > 0.1: + dir = dir.normalized() + + moving = true + moved() + else: + dir = Vector3() + moving = false + + vel.y += delta * GRAVITY + + var hvel : Vector3 = vel + hvel.y = 0 + + var target : Vector3 = dir + target *= get_speed().ccurrent + + var accel + if dir.dot(hvel) > 0: + accel = ACCEL + else: + accel = DEACCEL + + hvel = hvel.linear_interpolate(target, accel * delta) as Vector3 + vel.x = hvel.x + vel.z = hvel.z + vel = move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE)) + + if multiplayer.has_network_peer(): + if not multiplayer.is_network_server(): + rpc_id(1, "sset_position", translation, rotation) + else: + sset_position(translation, rotation) + + +func _input(event: InputEvent) -> void: + if not cursor_grabbed: + set_process_input(false) + return + + if event is InputEventMouseMotion and event.device != -1: + var s : float = ProjectSettings.get("display/mouse_cursor/sensitivity") + + var relx : float = event.relative.x * s + var rely : float = event.relative.y * s + + mouse_down_delta.x += relx + mouse_down_delta.y += rely + + total_down_mouse_delta.x += relx + total_down_mouse_delta.y += rely + + get_tree().set_input_as_handled() + + if (mouse_right_down or mouse_left_down) and event.device != -1: + if mouse_right_down: + camera_pivot.rotate_delta(0.0, -event.relative.y) + rotate_delta(-event.relative.x) + else: + camera_pivot.rotate_delta(-relx, -rely) + +func _unhandled_input(event: InputEvent) -> void: + if event is InputEventKey: + var ievkey : InputEventKey = event as InputEventKey + + if ievkey.scancode == KEY_W: + key_up = ievkey.pressed + if ievkey.scancode == KEY_S: + key_down = ievkey.pressed + if ievkey.scancode == KEY_A: + key_left = ievkey.pressed + if ievkey.scancode == KEY_D: + key_right = ievkey.pressed + + if event is InputEventMouseMotion and not (mouse_right_down or mouse_left_down) and event.device != -1: + cmouseover(event) + + if event is InputEventMouseButton: + if event.button_index == BUTTON_LEFT and event.device != -1: + mouse_left_down = event.pressed + + if mouse_left_down: + mouse_down_delta = Vector2() + mouse_down_pos = event.position + + if event.button_index == BUTTON_RIGHT and event.device != -1: + mouse_right_down = event.pressed + + if mouse_right_down: + rotate_delta(camera_pivot.get_y_rot()) + camera_pivot.set_y_rot(0.0) + + if mouse_left_down and mouse_right_down: + mouse_move_dir.y = -1 + else: + mouse_move_dir.y = 0 + + if event.is_pressed() and event.device != -1: + if event.button_index == BUTTON_WHEEL_UP: + camera_pivot.camera_distance_set_delta(-0.2) + if event.button_index == BUTTON_WHEEL_DOWN: + camera_pivot.camera_distance_set_delta(0.2) + + if not event.pressed and event.button_index == BUTTON_LEFT and event.device != -1: + if mouse_down_delta.length() < MOUSE_TARGET_MAX_OFFSET: + target(event.position) + + if event is InputEventScreenTouch and event.pressed: + target(event.position) + + update_cursor_mode() + +func update_cursor_mode(): + if mouse_left_down or mouse_right_down: + if not cursor_grabbed: + set_process_input(true) + total_down_mouse_delta = Vector2() + + cursor_grabbed = true + last_cursor_pos = get_viewport().get_mouse_position() + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + else: + if cursor_grabbed: + set_process_input(false) + cursor_grabbed = false + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + get_viewport().warp_mouse(last_cursor_pos) + + if total_down_mouse_delta.length_squared() < 8: + target(last_cursor_pos) + + +func rotate_delta(x_delta : float) -> void: + y_rot += x_delta + + while y_rot > 360: + y_rot -= 360 + + while y_rot < 0: + y_rot += 360 + + rotation_degrees = Vector3(0.0, y_rot, 0.0) + +func target(position : Vector2): + var from = camera.project_ray_origin(position) + var to = from + camera.project_ray_normal(position) * ray_length + + var space_state = get_world().direct_space_state + var result = space_state.intersect_ray(from, to, [], 2) + + if result: + print(result) + if result.collider and result.collider is Entity: + var ent : Entity = result.collider as Entity + + crequest_target_change(ent.get_path()) + return + + crequest_target_change(NodePath()) + else: + crequest_target_change(NodePath()) + +func cmouseover(event): + var from = camera.project_ray_origin(event.position) + var to = from + camera.project_ray_normal(event.position) * ray_length + + var space_state = get_world().direct_space_state + var result = space_state.intersect_ray(from, to, [], 2) + + if result: + if result.collider and result.collider is Entity: + var mo : Entity = result.collider as Entity + + if last_mouse_over != null and last_mouse_over != mo: + if is_instance_valid(last_mouse_over): + last_mouse_over.onc_mouse_exit() + + last_mouse_over = null + + if last_mouse_over == null: + mo.onc_mouse_enter() + last_mouse_over = mo + + return + + if last_mouse_over != null: + last_mouse_over.onc_mouse_exit() + last_mouse_over = null + +func analog_force_change(vector, touchpad): + if touchpad.padname == "TouchPad": + touchpad_dir = vector + touchpad_dir.y *= -1 + elif touchpad.padname == "TargetPad": + #try to target + return + +func queue_camera_rotation(rot : Vector2) -> void: + queued_camera_rotaions += rot + +remote func sset_position(position : Vector3, rotation : Vector3) -> void: + if get_network_master() != 1: + print(str(get_network_master()) + "psset") + + if multiplayer.network_peer and multiplayer.is_network_server(): + vrpc("cset_position", translation, rotation) + cset_position(position, rotation) + +remote func cset_position(position : Vector3, rotation : Vector3) -> void: + if get_network_master() != 1: + print(str(get_network_master()) + " pcset") + translation = position + rotation = rotation + +func _moved() -> void: + if sis_casting(): + sfail_cast() + +func _setup(): + setup_actionbars() + +func _con_target_changed(entity: Entity, old_target: Entity) -> void: + if is_instance_valid(old_target): + old_target.onc_untargeted() + + if is_instance_valid(ctarget): + ctarget.onc_targeted() + + if canc_interact(): + crequest_interact() + +func _con_cast_started(info): + if anim_node_state_machine != null and not casting_anim: + anim_node_state_machine.travel("casting-loop") + casting_anim = true + animation_run = false + +func _con_cast_failed(info): + if anim_node_state_machine != null and casting_anim: + anim_node_state_machine.travel("idle-loop") + casting_anim = false + + if animation_run: + anim_node_state_machine.travel("run-loop") + +func _con_cast_finished(info): + if anim_node_state_machine != null: + anim_node_state_machine.travel("cast-end") + casting_anim = false + + if animation_run: + anim_node_state_machine.travel("run-loop") + +func _con_spell_cast_success(info): + if anim_node_state_machine != null: + anim_node_state_machine.travel("cast-end") + casting_anim = false + + if animation_run: + anim_node_state_machine.travel("run-loop") + +func _son_xp_gained(value : int) -> void: + if not Entities.get_xp_data().can_level_up(gets_level()): + return + + var xpr : int = Entities.get_xp_data().get_xp(gets_level()); + + if xpr <= sxp: + slevelup(1) + sxp = 0 + + +func _son_level_up(level: int) -> void: + if sentity_data == null: + return + + var ecd : EntityClassData = sentity_data.entity_class_data + + if ecd == null: + return + + sfree_spell_points += ecd.spell_points_per_level + sfree_talent_points += 1 + + for i in range(Stat.MAIN_STAT_ID_COUNT): +# print(i) + var st : int = sentity_data.entity_class_data.get_stat_data().get_level_stat_data().get_stat_diff(i, slevel - level, slevel) + + var statid : int = i + Stat.MAIN_STAT_ID_START + + var stat : Stat = get_stat_int(statid) + + var sm : StatModifier = stat.get_modifier(0) + sm.base_mod += st + + +#func _con_xp_gained(value): +# print(value) + +func _scraft(id): + if not hass_craft_recipe_id(id): + return + + var recipe : CraftRecipe = gets_craft_recipe_id(id) + + if recipe == null: + return + + for i in range(recipe.required_tools_count): + var mat : CraftRecipeHelper = recipe.get_required_tool(i) + + if mat == null: + continue + + if not sbag.has_item(mat.item, mat.count): + return + + + for i in range(recipe.required_materials_count): + var mat : CraftRecipeHelper = recipe.get_required_material(i) + + if mat == null: + continue + + if not sbag.has_item(mat.item, mat.count): + return + + #ok, player has everything + + for i in range(recipe.required_materials_count): + var mat : CraftRecipeHelper = recipe.get_required_material(i) + + if mat == null: + continue + + sbag.remove_items(mat.item, mat.count) + + var item : ItemInstance = recipe.item.item.create_item_instance() + + sbag.add_item(item) + +func _from_dict(dict): + ._from_dict(dict) + + randomize() + sseed = randi() + diff --git a/game/player/Player.tscn b/game/player/Player.tscn new file mode 100644 index 00000000..3eb3dc17 --- /dev/null +++ b/game/player/Player.tscn @@ -0,0 +1,52 @@ +[gd_scene load_steps=7 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://ui/player_ui/player_ui.tscn" type="PackedScene" id=3] +[ext_resource path="res://player/CameraPivot.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="Player" type="Entity" groups=[ +"players", +]] +input_ray_pickable = false +collision_layer = 3 +collision_mask = 3 +character_skeleton_path = NodePath("Rotation_Helper/Model/character") +script = ExtResource( 2 ) + +[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="CameraPivot" type="Spatial" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.44092, 0 ) +script = ExtResource( 4 ) + +[node name="Camera" type="Camera" parent="CameraPivot"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6.822 ) +current = true +fov = 60.0 +size = 28.0 +far = 300.0 + +[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 )] +refresh_in_editor = false + +[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"] diff --git a/game/player/PlayerGDBase.gd b/game/player/PlayerGDBase.gd new file mode 100644 index 00000000..ecc7e51f --- /dev/null +++ b/game/player/PlayerGDBase.gd @@ -0,0 +1,85 @@ +extends Entity + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +var _timer : float = randf() * 2.0 + +var _query : PhysicsShapeQueryParameters +var _shape : SphereShape + +func _ready(): + _shape = SphereShape.new() + _shape.radius = 50 + + _query = PhysicsShapeQueryParameters.new() + _query.collision_mask = 2 + _query.exclude = [ self ] + _query.shape_rid = _shape.get_rid() + + set_physics_process(true) + +func _physics_process(delta): +# if (multiplayer.has_network_peer() and multiplayer.is_network_server()) or not multiplayer.has_network_peer(): + if multiplayer.has_network_peer() and multiplayer.is_network_server(): + _timer += delta + + if _timer > 3: + _timer -= 3 + + update_visibility() + +func update_visibility() -> void: + _query.transform = Transform(Basis(), translation) + var res : Array = get_world().direct_space_state.intersect_shape(_query) + + #warning-ignore:unassigned_variable + var currenty_sees : Array = Array() + + for collision in res: + var collider = collision["collider"] + + if collider is Entity and not currenty_sees.has(collider): + currenty_sees.append(collider) + + + #warning-ignore:unassigned_variable + var used_to_see : Array = Array() + + for i in range(gets_sees_count()): + var ent : Entity = gets_sees(i) + + used_to_see.append(ent) + + + #warning-ignore:unassigned_variable + var currenty_sees_filtered : Array = Array() + + for e in currenty_sees: + currenty_sees_filtered.append(e) + + for e in currenty_sees: + if used_to_see.has(e): + used_to_see.erase(e) + currenty_sees_filtered.erase(e) + + for e in used_to_see: + var ent : Entity = e as Entity + + if self.get_network_master() != 1: + Entities.despawn_for(self, ent) + + removes_sees(ent) + + for e in currenty_sees_filtered: + var ent : Entity = e as Entity + + if self.get_network_master() != 1: + Entities.spawn_for(self, ent) + + adds_sees(ent) + + + + diff --git a/game/player/Unitframes.gd b/game/player/Unitframes.gd new file mode 100644 index 00000000..04fca725 --- /dev/null +++ b/game/player/Unitframes.gd @@ -0,0 +1,32 @@ +extends Control + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export (NodePath) var player_unit_frame_path : NodePath +export (NodePath) var target_unit_frame_path : NodePath + +var target_unit_frame : Node +var player_unit_frame : Node + +func _ready() -> void: + target_unit_frame = get_node(target_unit_frame_path) as Node + player_unit_frame = get_node(player_unit_frame_path) as Node + +func set_player(player : Entity) -> void: + player_unit_frame.set_player(player) + + _ctarget_changed(player, null) + + player.connect("ctarget_changed", self, "_ctarget_changed") + + +func _ctarget_changed(entity : Entity, old_target : Entity) -> void: + if entity.ctarget == null: + target_unit_frame.hide() + else: + target_unit_frame.show() + + target_unit_frame.set_player(entity.ctarget) + diff --git a/game/project.godot b/game/project.godot new file mode 100644 index 00000000..a40b8472 --- /dev/null +++ b/game/project.godot @@ -0,0 +1,365 @@ +; 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=4 + +_global_script_classes=[ { +"base": "AIActionContainer", +"class": "AITestActionContainer", +"language": "GDScript", +"path": "res://scripts/ai/TestContainer.gd" +}, { +"base": "Aura", +"class": "AuraGD", +"language": "GDScript", +"path": "res://scripts/auras/aura_script.gd" +}, { +"base": "Spatial", +"class": "CharacterSkeketonAttachPoint", +"language": "GDScript", +"path": "res://player/CharacterSkeletonAttachPoint.gd" +}, { +"base": "VoxelChunk", +"class": "CubicVoxelChunk", +"language": "GDScript", +"path": "res://voxelman/cubic_mesher/CubicVoxelChunk.gd" +}, { +"base": "Entity", +"class": "DisplayPlayerGD", +"language": "GDScript", +"path": "res://player/DisplayPlayer.gd" +}, { +"base": "EntityData", +"class": "EntityDataGD", +"language": "GDScript", +"path": "res://scripts/entities/EntityDataGD.gd" +}, { +"base": "VoxelMesherCubic", +"class": "GDCubicVoxelMesher", +"language": "GDScript", +"path": "res://voxelman/cubic_mesher/CubicVoxelMesher.gd" +}, { +"base": "ItemTemplate", +"class": "ItemTemplateGD", +"language": "GDScript", +"path": "res://scripts/items/ItemTemplateGD.gd" +}, { +"base": "Node", +"class": "Main", +"language": "GDScript", +"path": "res://scenes/MainScene.gd" +}, { +"base": "VoxelmanLevelGenerator", +"class": "MainDungeonGenerator", +"language": "GDScript", +"path": "res://dungeon_generator/MainDungeonGenerator.gd" +}, { +"base": "VoxelmanLevelGenerator", +"class": "MainPlanetGenerator", +"language": "GDScript", +"path": "res://scripts/world_generators/MainPlanetGenerator.gd" +}, { +"base": "EntityResource", +"class": "ManaResource", +"language": "GDScript", +"path": "res://scripts/resources/mana_resource.gd" +}, { +"base": "VoxelChunk", +"class": "MarchingCubesVoxelChunk", +"language": "GDScript", +"path": "res://voxelman/mc_mesher/MarchingCubesVoxelChunk.gd" +}, { +"base": "VoxelMesherTransvoxel", +"class": "MarchingCubesVoxelMesher", +"language": "GDScript", +"path": "res://voxelman/mc_mesher/MarchingCobesVoxelMesher.gd" +}, { +"base": "Control", +"class": "Menu", +"language": "GDScript", +"path": "res://scenes/Menu.gd" +}, { +"base": "", +"class": "NetworkedPlayerGD", +"language": "GDScript", +"path": "res://player/NetworkedPlayer.gd" +}, { +"base": "", +"class": "PlayerGD", +"language": "GDScript", +"path": "res://player/Player.gd" +}, { +"base": "Resource", +"class": "PlayerMaster", +"language": "GDScript", +"path": "res://networking/PlayerMaster.gd" +}, { +"base": "Spatial", +"class": "PropTool", +"language": "GDScript", +"path": "res://addons/prop_tool/tools/PropTool.gd" +}, { +"base": "Spatial", +"class": "PropToolEntity", +"language": "GDScript", +"path": "res://addons/prop_tool/tools/PropToolEntity.gd" +}, { +"base": "OmniLight", +"class": "PropToolLight", +"language": "GDScript", +"path": "res://addons/prop_tool/tools/PropToolLight.gd" +}, { +"base": "MeshInstance", +"class": "PropToolMesh", +"language": "GDScript", +"path": "res://addons/prop_tool/tools/PropToolMesh.gd" +}, { +"base": "Spatial", +"class": "PropToolProp", +"language": "GDScript", +"path": "res://addons/prop_tool/tools/PropToolProp.gd" +}, { +"base": "Spatial", +"class": "PropToolScene", +"language": "GDScript", +"path": "res://addons/prop_tool/tools/PropToolScene.gd" +}, { +"base": "SpellEffectVisual", +"class": "SpellEffectVisualBasic", +"language": "GDScript", +"path": "res://scripts/resources/spell_effect_visual_basic.gd" +}, { +"base": "Spell", +"class": "SpellGD", +"language": "GDScript", +"path": "res://scripts/spells/gd_spell_script.gd" +}, { +"base": "SpellProjectile", +"class": "SpellProjectileGD", +"language": "GDScript", +"path": "res://scripts/projectiles/SpellProjectileGD.gd" +}, { +"base": "VoxelChunk", +"class": "TVGUVoxelChunk", +"language": "GDScript", +"path": "res://voxelman/transvoxel_mesher_gen_uv/TVGUVoxelChunk.gd" +}, { +"base": "VoxelMesherTransvoxel", +"class": "TVGUVoxelMesher", +"language": "GDScript", +"path": "res://voxelman/transvoxel_mesher_gen_uv/TVGUVoxelMesher.gd" +}, { +"base": "VoxelChunk", +"class": "TVNUVoxelChunk", +"language": "GDScript", +"path": "res://voxelman/transvoxel_mesher_normal_uv/TVNUVoxelChunk.gd" +}, { +"base": "VoxelMesherTransvoxel", +"class": "TVNUVoxelMesher", +"language": "GDScript", +"path": "res://voxelman/transvoxel_mesher_normal_uv/TVNUVoxelMesher.gd" +}, { +"base": "VoxelChunk", +"class": "TVVoxelChunk", +"language": "GDScript", +"path": "res://voxelman/transvoxel_mesher/TVVoxelChunk.gd" +}, { +"base": "VoxelMesherTransvoxel", +"class": "TVVoxelMesher", +"language": "GDScript", +"path": "res://voxelman/transvoxel_mesher/TVVoxelMesher.gd" +}, { +"base": "VoxelMesherTransvoxel", +"class": "TestVoxelMesher", +"language": "GDScript", +"path": "res://voxelman/transvoxel_mesher/TestVoxelMesher.gd" +} ] +_global_script_class_icons={ +"AITestActionContainer": "", +"AuraGD": "", +"CharacterSkeketonAttachPoint": "", +"CubicVoxelChunk": "", +"DisplayPlayerGD": "", +"EntityDataGD": "", +"GDCubicVoxelMesher": "", +"ItemTemplateGD": "", +"Main": "", +"MainDungeonGenerator": "", +"MainPlanetGenerator": "", +"ManaResource": "", +"MarchingCubesVoxelChunk": "", +"MarchingCubesVoxelMesher": "", +"Menu": "", +"NetworkedPlayerGD": "", +"PlayerGD": "", +"PlayerMaster": "", +"PropTool": "", +"PropToolEntity": "", +"PropToolLight": "", +"PropToolMesh": "", +"PropToolProp": "", +"PropToolScene": "", +"SpellEffectVisualBasic": "", +"SpellGD": "", +"SpellProjectileGD": "", +"TVGUVoxelChunk": "", +"TVGUVoxelMesher": "", +"TVNUVoxelChunk": "", +"TVNUVoxelMesher": "", +"TVVoxelChunk": "", +"TVVoxelMesher": "", +"TestVoxelMesher": "" +} +Node="input/actionbar_5_11" + +[application] + +config/name="Broken Seals 3D" +run/main_scene="res://scenes/Main.tscn" +config/icon="res://icon.png" +config/version="0.2" + +[autoload] + +Logger="*res://autoload/Logger.tscn" +Settings="*res://autoload/SettingsManager.gd" +CursorManager="*res://autoload/CursorManager.tscn" +PhysicsQuery="*res://autoload/PhysicsQuery.tscn" +Entities="*res://autoload/EntityDataManager.tscn" +Profiles="*res://autoload/ProfileManager.tscn" +WorldNumbers="*res://autoload/WorldNumbers.tscn" +ThemeAtlas="*res://autoload/ThemeAtlas.tscn" +Server="*res://autoload/Server.tscn" + +[debug] + +gdscript/completion/autocomplete_setters_and_getters=true +gdscript/warnings/unused_class_variable=false +gdscript/warnings/unused_argument=false +gdscript/warnings/unused_signal=false +gdscript/warnings/return_value_discarded=false +gdscript/warnings/integer_division=false + +[display] + +window/dpi/allow_hidpi=true +window/vsync/use_vsync=false +window/handheld/orientation="sensor_landscape" +window/stretch/mode="2d" +window/stretch/aspect="expand" +mouse_cursor/sensitivity=0.9 + +[editor_plugins] + +enabled=PoolStringArray( "ess_data", "prop_tool", "zylann.editor_light" ) + +[importer_defaults] + +texture_array={ +"compress/mode": 0, +"compress/no_bptc_if_rgb": false, +"flags/filter": false, +"flags/mipmaps": false, +"flags/repeat": 0, +"flags/srgb": 0, +"slices/horizontal": 8, +"slices/vertical": 8 +} + +[input] + +ui_accept={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null) + ] +} +actionbar_1_0={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_1={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_2={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":67,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_3={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":84,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_4={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":71,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_5={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":49,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_6={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":50,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_7={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":51,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_8={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":52,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_9={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_10={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_11={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":false,"command":false,"pressed":false,"scancode":84,"unicode":0,"echo":false,"script":null) + ] +} +actionbar_1_12={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":false,"command":false,"pressed":false,"scancode":39,"unicode":0,"echo":false,"script":null) + ] +} + +[layer_names] + +3d_physics/layer_1="World" +3d_physics/layer_2="Entities" + +[physics] + +2d/default_gravity=0 + +[rendering] + +quality/driver/driver_name="GLES2" +quality/driver/fallback_to_gles2=true +vram_compression/import_etc=true +quality/directional_shadow/size.mobile=1024 +quality/shading/force_vertex_shading=true diff --git a/game/prop_tool/Control.tscn b/game/prop_tool/Control.tscn new file mode 100644 index 00000000..7dd8523a --- /dev/null +++ b/game/prop_tool/Control.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=2] + +[sub_resource type="CubeMesh" id=1] + +[node name="Spatial" type="Spatial"] + +[node name="MeshInstance" type="MeshInstance" parent="."] +mesh = SubResource( 1 ) +material/0 = null diff --git a/game/prop_tool/ToolTes2at.tres b/game/prop_tool/ToolTes2at.tres new file mode 100644 index 00000000..adeec2b1 --- /dev/null +++ b/game/prop_tool/ToolTes2at.tres @@ -0,0 +1,37 @@ +[gd_resource type="PropData" load_steps=7 format=2] + +[ext_resource path="res://data/character_models/spine1.dae" type="MeshDataResource" id=1] + +[sub_resource type="PropDataLight" id=4] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 13.073, 0, 11.7378 ) +light_color = Color( 0.909804, 0.129412, 0.129412, 1 ) +light_size = 4 + +[sub_resource type="PropDataLight" id=5] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -12.2294, 0, -23.6387 ) +light_color = Color( 0.266667, 0.937255, 0.0823529, 1 ) +light_size = 18 + +[sub_resource type="PackedScene" id=3] +_bundled = { +"conn_count": 0, +"conns": PoolIntArray( ), +"editable_instances": [ ], +"names": PoolStringArray( ), +"node_count": 0, +"node_paths": [ ], +"nodes": PoolIntArray( ), +"variants": [ ], +"version": 2 +} + +[sub_resource type="PropDataScene" id=6] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.06597, 0, 16.5242 ) +scene = SubResource( 3 ) + +[sub_resource type="PropDataMesh" id=7] +transform = Transform( -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0, 1, 0, 0, 0 ) +mesh = ExtResource( 1 ) + +[resource] +props = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ] diff --git a/game/prop_tool/ToolTest.tres b/game/prop_tool/ToolTest.tres new file mode 100644 index 00000000..9e87ce70 --- /dev/null +++ b/game/prop_tool/ToolTest.tres @@ -0,0 +1,41 @@ +[gd_resource type="PropData" load_steps=9 format=2] + +[ext_resource path="res://data/character_models/spine1.dae" type="MeshDataResource" id=1] +[ext_resource path="res://prop_tool/dada.tres" type="PropData" id=2] + +[sub_resource type="PropDataLight" id=1] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 13.073, 0, 11.7378 ) +light_color = Color( 0.909804, 0.129412, 0.129412, 1 ) +light_size = 4 + +[sub_resource type="PropDataLight" id=2] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -4.322, 0, -0.816227 ) +light_color = Color( 0.266667, 0.937255, 0.0823529, 1 ) +light_size = 6 + +[sub_resource type="PackedScene" id=3] +_bundled = { +"conn_count": 0, +"conns": PoolIntArray( ), +"editable_instances": [ ], +"names": PoolStringArray( ), +"node_count": 0, +"node_paths": [ ], +"nodes": PoolIntArray( ), +"variants": [ ], +"version": 2 +} + +[sub_resource type="PropDataScene" id=4] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.06597, 0, 16.5242 ) +scene = SubResource( 3 ) + +[sub_resource type="PropDataMesh" id=5] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6.52468 ) +mesh = ExtResource( 1 ) + +[sub_resource type="PropDataProp" id=6] +prop = ExtResource( 2 ) + +[resource] +props = [ SubResource( 1 ), SubResource( 2 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ] diff --git a/game/prop_tool/ToolTest.tscn b/game/prop_tool/ToolTest.tscn new file mode 100644 index 00000000..9c4a0a72 --- /dev/null +++ b/game/prop_tool/ToolTest.tscn @@ -0,0 +1,97 @@ +[gd_scene load_steps=11 format=2] + +[ext_resource path="res://addons/prop_tool/tools/PropTool.gd" type="Script" id=1] +[ext_resource path="res://addons/prop_tool/tools/PropToolLight.gd" type="Script" id=2] +[ext_resource path="res://prop_tool/ToolTest.tres" type="PropData" id=3] +[ext_resource path="res://addons/prop_tool/tools/PropToolMesh.gd" type="Script" id=4] +[ext_resource path="res://data/character_models/huf_calf.dae" type="MeshDataResource" id=5] +[ext_resource path="res://addons/prop_tool/tools/PropToolScene.gd" type="Script" id=6] +[ext_resource path="res://prop_tool/Control.tscn" type="PackedScene" id=7] + + + + + +[sub_resource type="ArrayMesh" id=1] +surfaces/0 = { +"aabb": AABB( -0.055, -0.0852203, -0.396442, 0.11, 0.128219, 0.368262 ), +"array_data": PoolByteArray( 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 0, 1, 0, 99, 55, 199, 57, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 0, 1, 0, 52, 55, 152, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 253, 54, 206, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 253, 54, 206, 57, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 0, 1, 0, 52, 55, 152, 57, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 0, 0, 1, 0, 191, 54, 152, 57, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 0, 0, 1, 0, 191, 54, 152, 57, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 0, 1, 0, 144, 54, 204, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 253, 54, 206, 57, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 0, 1, 0, 99, 55, 197, 57, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 0, 1, 0, 157, 55, 159, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 206, 55, 206, 57, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 0, 255, 0, 157, 55, 159, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 255, 0, 206, 55, 206, 57, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 0, 0, 255, 0, 251, 55, 159, 57, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 0, 255, 0, 26, 56, 202, 57, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 0, 0, 255, 0, 251, 55, 159, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 255, 0, 206, 55, 206, 57, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 0, 1, 0, 123, 53, 138, 57, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 0, 0, 1, 0, 174, 53, 206, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 8, 54, 138, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 0, 1, 0, 81, 54, 206, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 8, 54, 138, 57, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 0, 0, 1, 0, 174, 53, 206, 57, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 0, 1, 0, 144, 54, 145, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 8, 54, 138, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 0, 1, 0, 81, 54, 206, 57, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 0, 1, 0, 122, 53, 203, 57, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 0, 0, 1, 0, 70, 53, 137, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 243, 52, 206, 57, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 0, 0, 1, 0, 70, 53, 137, 57, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 0, 0, 1, 0, 152, 52, 137, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 243, 52, 206, 57, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 0, 0, 1, 0, 152, 52, 137, 57, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 0, 1, 0, 101, 52, 203, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 243, 52, 206, 57, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 255, 0, 0, 0, 186, 55, 33, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 255, 0, 0, 0, 145, 53, 20, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 255, 0, 0, 0, 149, 53, 110, 58, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 255, 0, 0, 0, 102, 52, 20, 58, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 255, 0, 0, 0, 124, 52, 101, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 255, 0, 0, 0, 145, 53, 20, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 255, 0, 0, 0, 149, 53, 110, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 255, 0, 0, 0, 145, 53, 20, 58, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 255, 0, 0, 0, 124, 52, 101, 58, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 255, 0, 0, 0, 186, 55, 81, 58, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 255, 0, 0, 0, 186, 55, 33, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 255, 0, 0, 0, 149, 53, 110, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 0, 1, 0, 0, 149, 53, 110, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 160, 53, 175, 58, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 1, 0, 0, 186, 55, 81, 58, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 1, 0, 0, 196, 55, 129, 58, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 1, 0, 0, 186, 55, 81, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 160, 53, 175, 58, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 0, 1, 0, 0, 124, 52, 101, 58, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 1, 0, 0, 129, 52, 176, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 0, 1, 0, 0, 149, 53, 110, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 160, 53, 175, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 126, 53, 176, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 0, 1, 0, 0, 132, 53, 240, 58, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 1, 0, 0, 171, 55, 185, 58, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 0, 1, 0, 0, 173, 55, 242, 58, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 1, 0, 0, 171, 55, 185, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 0, 1, 0, 0, 132, 53, 240, 58, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 1, 0, 0, 101, 52, 190, 58, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 0, 1, 0, 0, 111, 52, 5, 59, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 126, 53, 176, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 0, 1, 0, 0, 132, 53, 240, 58, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 1, 0, 0, 0, 173, 55, 242, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 1, 0, 0, 0, 132, 53, 240, 58, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 1, 0, 0, 0, 148, 53, 79, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 1, 0, 0, 0, 148, 53, 79, 59, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 1, 0, 0, 0, 187, 55, 45, 59, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 1, 0, 0, 0, 173, 55, 242, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 1, 0, 0, 0, 132, 53, 240, 58, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 1, 0, 0, 0, 111, 52, 5, 59, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 1, 0, 0, 0, 101, 52, 94, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 1, 0, 0, 0, 148, 53, 79, 59, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 1, 0, 0, 0, 132, 53, 240, 58, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 1, 0, 0, 0, 101, 52, 94, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 0, 255, 0, 0, 148, 53, 79, 59, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 167, 53, 143, 59, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 255, 0, 0, 187, 55, 45, 59, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 255, 0, 0, 187, 55, 45, 59, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 167, 53, 143, 59, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 255, 0, 0, 205, 55, 96, 59, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 0, 255, 0, 0, 101, 52, 94, 59, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 255, 0, 0, 118, 52, 165, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 0, 255, 0, 0, 148, 53, 79, 59, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 167, 53, 143, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 0, 255, 0, 0, 148, 53, 79, 59, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 255, 0, 0, 118, 52, 165, 59, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 255, 0, 0, 101, 52, 206, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 255, 0, 0, 102, 52, 20, 58, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 151, 53, 213, 57, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 151, 53, 213, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 255, 0, 0, 102, 52, 20, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 0, 255, 0, 0, 145, 53, 20, 58, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 255, 0, 0, 196, 55, 237, 57, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 151, 53, 213, 57, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 0, 255, 0, 0, 145, 53, 20, 58, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 0, 255, 0, 0, 186, 55, 33, 58, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 255, 0, 0, 196, 55, 237, 57, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 0, 255, 0, 0, 145, 53, 20, 58 ), +"array_index_data": PoolByteArray( 0, 0, 2, 0, 1, 0, 3, 0, 5, 0, 4, 0, 6, 0, 8, 0, 7, 0, 9, 0, 11, 0, 10, 0, 12, 0, 14, 0, 13, 0, 15, 0, 17, 0, 16, 0, 18, 0, 20, 0, 19, 0, 21, 0, 23, 0, 22, 0, 24, 0, 26, 0, 25, 0, 27, 0, 29, 0, 28, 0, 30, 0, 32, 0, 31, 0, 33, 0, 35, 0, 34, 0, 36, 0, 38, 0, 37, 0, 39, 0, 41, 0, 40, 0, 42, 0, 44, 0, 43, 0, 45, 0, 47, 0, 46, 0, 48, 0, 50, 0, 49, 0, 51, 0, 53, 0, 52, 0, 54, 0, 56, 0, 55, 0, 57, 0, 55, 0, 56, 0, 58, 0, 60, 0, 59, 0, 61, 0, 63, 0, 62, 0, 64, 0, 66, 0, 65, 0, 67, 0, 65, 0, 66, 0, 68, 0, 70, 0, 69, 0, 71, 0, 73, 0, 72, 0, 74, 0, 76, 0, 75, 0, 77, 0, 79, 0, 78, 0, 80, 0, 82, 0, 81, 0, 83, 0, 85, 0, 84, 0, 86, 0, 88, 0, 87, 0, 89, 0, 91, 0, 90, 0, 92, 0, 94, 0, 93, 0, 95, 0, 97, 0, 96, 0, 98, 0, 100, 0, 99, 0, 101, 0, 103, 0, 102, 0 ), +"blend_shape_data": [ ], +"format": 97555, +"index_count": 108, +"primitive": 4, +"skeleton_aabb": [ ], +"vertex_count": 104 +} + +[sub_resource type="ArrayMesh" id=2] +surfaces/0 = { +"aabb": AABB( -0.055, -0.0852203, -0.396442, 0.11, 0.128219, 0.368262 ), +"array_data": PoolByteArray( 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 0, 1, 0, 99, 55, 199, 57, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 0, 1, 0, 52, 55, 152, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 253, 54, 206, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 253, 54, 206, 57, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 0, 1, 0, 52, 55, 152, 57, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 0, 0, 1, 0, 191, 54, 152, 57, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 0, 0, 1, 0, 191, 54, 152, 57, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 0, 1, 0, 144, 54, 204, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 253, 54, 206, 57, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 0, 1, 0, 99, 55, 197, 57, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 0, 1, 0, 157, 55, 159, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 206, 55, 206, 57, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 0, 255, 0, 157, 55, 159, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 255, 0, 206, 55, 206, 57, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 0, 0, 255, 0, 251, 55, 159, 57, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 0, 255, 0, 26, 56, 202, 57, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 0, 0, 255, 0, 251, 55, 159, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 255, 0, 206, 55, 206, 57, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 0, 1, 0, 123, 53, 138, 57, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 0, 0, 1, 0, 174, 53, 206, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 8, 54, 138, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 0, 1, 0, 81, 54, 206, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 8, 54, 138, 57, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 0, 0, 1, 0, 174, 53, 206, 57, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 0, 1, 0, 144, 54, 145, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 8, 54, 138, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 0, 1, 0, 81, 54, 206, 57, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 0, 1, 0, 122, 53, 203, 57, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 0, 0, 1, 0, 70, 53, 137, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 243, 52, 206, 57, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 0, 0, 1, 0, 70, 53, 137, 57, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 0, 0, 1, 0, 152, 52, 137, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 243, 52, 206, 57, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 0, 0, 1, 0, 152, 52, 137, 57, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 0, 1, 0, 101, 52, 203, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 243, 52, 206, 57, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 255, 0, 0, 0, 186, 55, 33, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 255, 0, 0, 0, 145, 53, 20, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 255, 0, 0, 0, 149, 53, 110, 58, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 255, 0, 0, 0, 102, 52, 20, 58, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 255, 0, 0, 0, 124, 52, 101, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 255, 0, 0, 0, 145, 53, 20, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 255, 0, 0, 0, 149, 53, 110, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 255, 0, 0, 0, 145, 53, 20, 58, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 255, 0, 0, 0, 124, 52, 101, 58, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 255, 0, 0, 0, 186, 55, 81, 58, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 255, 0, 0, 0, 186, 55, 33, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 255, 0, 0, 0, 149, 53, 110, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 0, 1, 0, 0, 149, 53, 110, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 160, 53, 175, 58, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 1, 0, 0, 186, 55, 81, 58, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 1, 0, 0, 196, 55, 129, 58, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 1, 0, 0, 186, 55, 81, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 160, 53, 175, 58, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 0, 1, 0, 0, 124, 52, 101, 58, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 1, 0, 0, 129, 52, 176, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 0, 1, 0, 0, 149, 53, 110, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 160, 53, 175, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 126, 53, 176, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 0, 1, 0, 0, 132, 53, 240, 58, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 1, 0, 0, 171, 55, 185, 58, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 0, 1, 0, 0, 173, 55, 242, 58, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 1, 0, 0, 171, 55, 185, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 0, 1, 0, 0, 132, 53, 240, 58, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 1, 0, 0, 101, 52, 190, 58, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 0, 1, 0, 0, 111, 52, 5, 59, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 126, 53, 176, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 0, 1, 0, 0, 132, 53, 240, 58, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 1, 0, 0, 0, 173, 55, 242, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 1, 0, 0, 0, 132, 53, 240, 58, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 1, 0, 0, 0, 148, 53, 79, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 1, 0, 0, 0, 148, 53, 79, 59, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 1, 0, 0, 0, 187, 55, 45, 59, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 1, 0, 0, 0, 173, 55, 242, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 1, 0, 0, 0, 132, 53, 240, 58, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 1, 0, 0, 0, 111, 52, 5, 59, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 1, 0, 0, 0, 101, 52, 94, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 1, 0, 0, 0, 148, 53, 79, 59, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 1, 0, 0, 0, 132, 53, 240, 58, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 1, 0, 0, 0, 101, 52, 94, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 0, 255, 0, 0, 148, 53, 79, 59, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 167, 53, 143, 59, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 255, 0, 0, 187, 55, 45, 59, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 255, 0, 0, 187, 55, 45, 59, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 167, 53, 143, 59, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 255, 0, 0, 205, 55, 96, 59, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 0, 255, 0, 0, 101, 52, 94, 59, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 255, 0, 0, 118, 52, 165, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 0, 255, 0, 0, 148, 53, 79, 59, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 167, 53, 143, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 0, 255, 0, 0, 148, 53, 79, 59, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 255, 0, 0, 118, 52, 165, 59, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 255, 0, 0, 101, 52, 206, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 255, 0, 0, 102, 52, 20, 58, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 151, 53, 213, 57, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 151, 53, 213, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 255, 0, 0, 102, 52, 20, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 0, 255, 0, 0, 145, 53, 20, 58, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 255, 0, 0, 196, 55, 237, 57, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 151, 53, 213, 57, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 0, 255, 0, 0, 145, 53, 20, 58, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 0, 255, 0, 0, 186, 55, 33, 58, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 255, 0, 0, 196, 55, 237, 57, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 0, 255, 0, 0, 145, 53, 20, 58 ), +"array_index_data": PoolByteArray( 0, 0, 2, 0, 1, 0, 3, 0, 5, 0, 4, 0, 6, 0, 8, 0, 7, 0, 9, 0, 11, 0, 10, 0, 12, 0, 14, 0, 13, 0, 15, 0, 17, 0, 16, 0, 18, 0, 20, 0, 19, 0, 21, 0, 23, 0, 22, 0, 24, 0, 26, 0, 25, 0, 27, 0, 29, 0, 28, 0, 30, 0, 32, 0, 31, 0, 33, 0, 35, 0, 34, 0, 36, 0, 38, 0, 37, 0, 39, 0, 41, 0, 40, 0, 42, 0, 44, 0, 43, 0, 45, 0, 47, 0, 46, 0, 48, 0, 50, 0, 49, 0, 51, 0, 53, 0, 52, 0, 54, 0, 56, 0, 55, 0, 57, 0, 55, 0, 56, 0, 58, 0, 60, 0, 59, 0, 61, 0, 63, 0, 62, 0, 64, 0, 66, 0, 65, 0, 67, 0, 65, 0, 66, 0, 68, 0, 70, 0, 69, 0, 71, 0, 73, 0, 72, 0, 74, 0, 76, 0, 75, 0, 77, 0, 79, 0, 78, 0, 80, 0, 82, 0, 81, 0, 83, 0, 85, 0, 84, 0, 86, 0, 88, 0, 87, 0, 89, 0, 91, 0, 90, 0, 92, 0, 94, 0, 93, 0, 95, 0, 97, 0, 96, 0, 98, 0, 100, 0, 99, 0, 101, 0, 103, 0, 102, 0 ), +"blend_shape_data": [ ], +"format": 97555, +"index_count": 108, +"primitive": 4, +"skeleton_aabb": [ ], +"vertex_count": 104 +} + +[sub_resource type="ArrayMesh" id=3] +surfaces/0 = { +"aabb": AABB( -0.055, -0.0852203, -0.396442, 0.11, 0.128219, 0.368262 ), +"array_data": PoolByteArray( 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 0, 1, 0, 99, 55, 199, 57, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 0, 1, 0, 52, 55, 152, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 253, 54, 206, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 253, 54, 206, 57, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 0, 1, 0, 52, 55, 152, 57, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 0, 0, 1, 0, 191, 54, 152, 57, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 0, 0, 1, 0, 191, 54, 152, 57, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 0, 1, 0, 144, 54, 204, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 253, 54, 206, 57, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 0, 1, 0, 99, 55, 197, 57, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 0, 1, 0, 157, 55, 159, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 1, 0, 206, 55, 206, 57, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 0, 255, 0, 157, 55, 159, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 255, 0, 206, 55, 206, 57, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 0, 0, 255, 0, 251, 55, 159, 57, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 0, 255, 0, 26, 56, 202, 57, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 0, 0, 255, 0, 251, 55, 159, 57, 204, 35, 72, 180, 136, 223, 9, 189, 106, 250, 202, 190, 0, 0, 255, 0, 206, 55, 206, 57, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 0, 1, 0, 123, 53, 138, 57, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 0, 0, 1, 0, 174, 53, 206, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 8, 54, 138, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 0, 1, 0, 81, 54, 206, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 8, 54, 138, 57, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 0, 0, 1, 0, 174, 53, 206, 57, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 0, 1, 0, 144, 54, 145, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 8, 54, 138, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 0, 1, 0, 81, 54, 206, 57, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 0, 1, 0, 122, 53, 203, 57, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 0, 0, 1, 0, 70, 53, 137, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 243, 52, 206, 57, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 0, 0, 1, 0, 70, 53, 137, 57, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 0, 0, 1, 0, 152, 52, 137, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 243, 52, 206, 57, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 0, 0, 1, 0, 152, 52, 137, 57, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 0, 1, 0, 101, 52, 203, 57, 247, 170, 182, 179, 88, 57, 180, 188, 94, 217, 230, 188, 0, 0, 1, 0, 243, 52, 206, 57, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 255, 0, 0, 0, 186, 55, 33, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 255, 0, 0, 0, 145, 53, 20, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 255, 0, 0, 0, 149, 53, 110, 58, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 255, 0, 0, 0, 102, 52, 20, 58, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 255, 0, 0, 0, 124, 52, 101, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 255, 0, 0, 0, 145, 53, 20, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 255, 0, 0, 0, 149, 53, 110, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 255, 0, 0, 0, 145, 53, 20, 58, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 255, 0, 0, 0, 124, 52, 101, 58, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 255, 0, 0, 0, 186, 55, 81, 58, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 255, 0, 0, 0, 186, 55, 33, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 255, 0, 0, 0, 149, 53, 110, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 0, 1, 0, 0, 149, 53, 110, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 160, 53, 175, 58, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 1, 0, 0, 186, 55, 81, 58, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 1, 0, 0, 196, 55, 129, 58, 127, 163, 10, 189, 77, 187, 38, 187, 128, 206, 194, 190, 0, 1, 0, 0, 186, 55, 81, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 160, 53, 175, 58, 166, 71, 97, 189, 0, 196, 49, 60, 151, 77, 103, 189, 0, 1, 0, 0, 124, 52, 101, 58, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 1, 0, 0, 129, 52, 176, 58, 209, 189, 75, 189, 55, 255, 187, 60, 0, 195, 41, 190, 0, 1, 0, 0, 149, 53, 110, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 160, 53, 175, 58, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 126, 53, 176, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 0, 1, 0, 0, 132, 53, 240, 58, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 1, 0, 0, 171, 55, 185, 58, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 0, 1, 0, 0, 173, 55, 242, 58, 164, 102, 153, 56, 28, 62, 141, 60, 128, 206, 194, 190, 0, 1, 0, 0, 171, 55, 185, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 0, 1, 0, 0, 132, 53, 240, 58, 169, 54, 233, 51, 2, 43, 7, 61, 153, 77, 103, 189, 0, 1, 0, 0, 101, 52, 190, 58, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 0, 1, 0, 0, 111, 52, 5, 59, 92, 38, 58, 56, 189, 31, 48, 61, 0, 195, 41, 190, 0, 1, 0, 0, 126, 53, 176, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 0, 1, 0, 0, 132, 53, 240, 58, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 1, 0, 0, 0, 173, 55, 242, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 1, 0, 0, 0, 132, 53, 240, 58, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 1, 0, 0, 0, 148, 53, 79, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 1, 0, 0, 0, 148, 53, 79, 59, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 1, 0, 0, 0, 187, 55, 45, 59, 130, 130, 45, 61, 58, 141, 177, 186, 128, 206, 194, 190, 1, 0, 0, 0, 173, 55, 242, 58, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 1, 0, 0, 0, 132, 53, 240, 58, 184, 71, 97, 61, 37, 167, 85, 60, 155, 77, 103, 189, 1, 0, 0, 0, 111, 52, 5, 59, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 1, 0, 0, 0, 101, 52, 94, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 1, 0, 0, 0, 148, 53, 79, 59, 191, 26, 76, 61, 79, 61, 204, 60, 0, 195, 41, 190, 1, 0, 0, 0, 132, 53, 240, 58, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 1, 0, 0, 0, 101, 52, 94, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 0, 255, 0, 0, 148, 53, 79, 59, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 167, 53, 143, 59, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 255, 0, 0, 187, 55, 45, 59, 106, 62, 35, 61, 59, 112, 146, 189, 115, 56, 195, 190, 0, 255, 0, 0, 187, 55, 45, 59, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 167, 53, 143, 59, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 255, 0, 0, 205, 55, 96, 59, 113, 71, 97, 61, 174, 148, 125, 189, 250, 206, 68, 189, 0, 255, 0, 0, 101, 52, 94, 59, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 255, 0, 0, 118, 52, 165, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 0, 255, 0, 0, 148, 53, 79, 59, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 167, 53, 143, 59, 101, 26, 76, 61, 216, 195, 138, 189, 0, 195, 41, 190, 0, 255, 0, 0, 148, 53, 79, 59, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 255, 0, 0, 118, 52, 165, 59, 161, 237, 161, 180, 109, 77, 166, 189, 23, 242, 65, 189, 0, 255, 0, 0, 101, 52, 206, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 255, 0, 0, 102, 52, 20, 58, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 151, 53, 213, 57, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 151, 53, 213, 57, 255, 206, 85, 189, 227, 86, 116, 189, 28, 240, 73, 189, 0, 255, 0, 0, 102, 52, 20, 58, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 0, 255, 0, 0, 145, 53, 20, 58, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 255, 0, 0, 196, 55, 237, 57, 136, 54, 56, 56, 255, 135, 174, 189, 0, 195, 41, 190, 0, 255, 0, 0, 151, 53, 213, 57, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 0, 255, 0, 0, 145, 53, 20, 58, 87, 185, 18, 189, 246, 45, 129, 189, 232, 198, 194, 190, 0, 255, 0, 0, 186, 55, 33, 58, 25, 169, 152, 56, 196, 248, 165, 189, 36, 146, 195, 190, 0, 255, 0, 0, 196, 55, 237, 57, 169, 91, 65, 189, 23, 149, 134, 189, 0, 195, 41, 190, 0, 255, 0, 0, 145, 53, 20, 58 ), +"array_index_data": PoolByteArray( 0, 0, 2, 0, 1, 0, 3, 0, 5, 0, 4, 0, 6, 0, 8, 0, 7, 0, 9, 0, 11, 0, 10, 0, 12, 0, 14, 0, 13, 0, 15, 0, 17, 0, 16, 0, 18, 0, 20, 0, 19, 0, 21, 0, 23, 0, 22, 0, 24, 0, 26, 0, 25, 0, 27, 0, 29, 0, 28, 0, 30, 0, 32, 0, 31, 0, 33, 0, 35, 0, 34, 0, 36, 0, 38, 0, 37, 0, 39, 0, 41, 0, 40, 0, 42, 0, 44, 0, 43, 0, 45, 0, 47, 0, 46, 0, 48, 0, 50, 0, 49, 0, 51, 0, 53, 0, 52, 0, 54, 0, 56, 0, 55, 0, 57, 0, 55, 0, 56, 0, 58, 0, 60, 0, 59, 0, 61, 0, 63, 0, 62, 0, 64, 0, 66, 0, 65, 0, 67, 0, 65, 0, 66, 0, 68, 0, 70, 0, 69, 0, 71, 0, 73, 0, 72, 0, 74, 0, 76, 0, 75, 0, 77, 0, 79, 0, 78, 0, 80, 0, 82, 0, 81, 0, 83, 0, 85, 0, 84, 0, 86, 0, 88, 0, 87, 0, 89, 0, 91, 0, 90, 0, 92, 0, 94, 0, 93, 0, 95, 0, 97, 0, 96, 0, 98, 0, 100, 0, 99, 0, 101, 0, 103, 0, 102, 0 ), +"blend_shape_data": [ ], +"format": 97555, +"index_count": 108, +"primitive": 4, +"skeleton_aabb": [ ], +"vertex_count": 104 +} + +[node name="Test" type="Spatial"] +script = ExtResource( 1 ) +target_prop = ExtResource( 3 ) + +[node name="PropToolLight2" type="OmniLight" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.49415, 0.995323 ) +script = ExtResource( 2 ) + +[node name="OmniLight" type="OmniLight" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.474563, 0.401905 ) +light_color = Color( 0.6, 0.0509804, 0.0509804, 1 ) +script = ExtResource( 2 ) + +[node name="PropToolLight" type="OmniLight" parent="OmniLight"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.190188, -1.88338 ) +script = ExtResource( 2 ) + +[node name="MeshInstance" type="MeshInstance" parent="."] +transform = Transform( 0.534746, 0.0171761, 0.844838, -0.00797641, 0.999851, -0.0152789, -0.844975, 0.00143157, 0.534804, 0, 0.470665, -0.694204 ) +mesh = SubResource( 1 ) +material/0 = null +script = ExtResource( 4 ) +mesh_data = ExtResource( 5 ) +generate = false + +[node name="MeshInstance2" type="MeshInstance" parent="."] +transform = Transform( 0.534746, 0.0171761, 0.844838, -0.00797641, 0.999851, -0.0152789, -0.844975, 0.00143157, 0.534804, 0.855267, 0.470665, -0.694204 ) +mesh = SubResource( 2 ) +material/0 = null +script = ExtResource( 4 ) +mesh_data = ExtResource( 5 ) +generate = false + +[node name="MeshInstance3" type="MeshInstance" parent="."] +transform = Transform( 0.534746, 0.0171761, 0.844838, -0.00797641, 0.999851, -0.0152789, -0.844975, 0.00143157, 0.534804, 0.855267, 0.797264, 0.234076 ) +mesh = SubResource( 3 ) +material/0 = null +script = ExtResource( 4 ) +mesh_data = ExtResource( 5 ) +generate = false + +[node name="Spatial" type="Spatial" parent="."] +script = ExtResource( 6 ) +scene_data = ExtResource( 7 ) diff --git a/game/prop_tool/dada.tres b/game/prop_tool/dada.tres new file mode 100644 index 00000000..236a91fa --- /dev/null +++ b/game/prop_tool/dada.tres @@ -0,0 +1,44 @@ +[gd_resource type="PropData" load_steps=9 format=2] + +[ext_resource path="res://prop_tool/ToolTes2at.tres" type="PropData" id=1] + +[sub_resource type="PropDataLight" id=4] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 13.073, 0, 11.7378 ) +light_color = Color( 0.909804, 0.129412, 0.129412, 1 ) + +[sub_resource type="PropDataLight" id=5] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -4.322, 0, -0.816227 ) +light_color = Color( 0.266667, 0.937255, 0.0823529, 1 ) + +[sub_resource type="PackedScene" id=3] +_bundled = { +"conn_count": 0, +"conns": PoolIntArray( ), +"editable_instances": [ ], +"names": PoolStringArray( ), +"node_count": 0, +"node_paths": [ ], +"nodes": PoolIntArray( ), +"variants": [ ], +"version": 2 +} + +[sub_resource type="PropDataScene" id=6] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.06597, 0, 16.5242 ) +scene = SubResource( 3 ) +snap_to_mesh = false +snap_axis = Vector3( 0, -1, 0 ) + +[sub_resource type="PropDataProp" id=7] +prop = ExtResource( 1 ) + +[sub_resource type="PropDataProp" id=8] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -6.80673 ) +prop = ExtResource( 1 ) + +[sub_resource type="PropDataProp" id=9] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 20.5188, 0, 15.6823 ) +prop = ExtResource( 1 ) + +[resource] +props = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ) ] diff --git a/game/scenes/BrokenSeals.tscn b/game/scenes/BrokenSeals.tscn new file mode 100644 index 00000000..ceeda28b --- /dev/null +++ b/game/scenes/BrokenSeals.tscn @@ -0,0 +1,3 @@ +[gd_scene format=2] + +[node name="BrokenSeals" type="Node"] diff --git a/game/scenes/CharacterCreationMenu.gd b/game/scenes/CharacterCreationMenu.gd new file mode 100644 index 00000000..d4d669bf --- /dev/null +++ b/game/scenes/CharacterCreationMenu.gd @@ -0,0 +1,64 @@ +extends Control + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export(PackedScene) var character_entry : PackedScene +export(NodePath) var menu_path : NodePath +export(NodePath) var name_imput_path : NodePath +export(NodePath) var container_path : NodePath +export(ButtonGroup) var character_creation_button_group : ButtonGroup +export(String) var character_folder : String + +var container : Node +var name_line_edit : LineEdit + +func _ready(): + name_line_edit = get_node(name_imput_path) + container = get_node(container_path) + + var fb : Button = null + + for i in range(Entities.get_player_character_data_count()): + var d : EntityData = Entities.get_player_character_data_index(i) + + var ce : Button = character_entry.instance() as Button + + if fb == null: + fb = ce + + container.add_child(ce) + ce.owner = container + + ce.id = d.id + ce.set_class_name(d.entity_class_data.text_name) + ce.group = character_creation_button_group + + if fb != null: + fb.pressed = true + +func create() -> void: + if name_line_edit.text == "": + return + + var file_name : String = "user://" + character_folder + "/" + name_line_edit.text + + var f : File = File.new() + + if f.file_exists(file_name): + return + + var active : BaseButton = character_creation_button_group.get_pressed_button() + + var id : int = active.id + + var ent : Entity = Entities.spawn_player_for_menu(id, name_line_edit.text, self) + if f.open(file_name, File.WRITE) == OK: + f.store_string(to_json(ent.to_dict())) + f.close() + + ent.queue_free() + + get_node(menu_path).switch_to_menu(Menu.StartMenuTypes.CHARACTER_SELECT) + diff --git a/game/scenes/CharacterSelector.gd b/game/scenes/CharacterSelector.gd new file mode 100644 index 00000000..838ee58f --- /dev/null +++ b/game/scenes/CharacterSelector.gd @@ -0,0 +1,36 @@ +extends MarginContainer + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export(NodePath) var container_path : NodePath +var container : Node + +export(String) var character_folder : String + +func _ready(): + container = get_node(container_path) + + if container == null: + Logger.error("CharacterSelector not set up properly!") + + refresh() + +func refresh(): + var dir : Directory = Directory.new() + + if dir.open("user://" + character_folder) == OK: + dir.list_dir_begin() + + var file_name = dir.get_next() + + while (file_name != ""): + if dir.current_is_dir(): + file_name = dir.get_next() + + + + else: + dir.make_dir("user://" + character_folder) + diff --git a/game/scenes/CharacterSelectorMenu.gd b/game/scenes/CharacterSelectorMenu.gd new file mode 100644 index 00000000..dc362ae3 --- /dev/null +++ b/game/scenes/CharacterSelectorMenu.gd @@ -0,0 +1,147 @@ +extends Control + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export(NodePath) var menu_path : NodePath +export(NodePath) var container_path : NodePath +export(NodePath) var player_display_container_path : NodePath +export(ButtonGroup) var character_button_group : ButtonGroup +export(PackedScene) var character_entry : PackedScene +export(String) var character_folder : String + +var container : Node +var player_display_container_node : Node + +func _ready(): + container = get_node(container_path) + player_display_container_node = get_node(player_display_container_path) + + if container == null: + Logger.error("CharacterSelector not set up properly!") + + connect("visibility_changed", self, "visibility_changed") + + refresh() + +func refresh(): + clear() +# Entities.list_spells() + var dir : Directory = Directory.new() + + var first_entry : Button = null + + if dir.open("user://" + character_folder) == OK: + dir.list_dir_begin() + + var file_name = "." + + while (file_name != ""): + file_name = dir.get_next() + + if dir.current_is_dir(): + continue + + var f : File = File.new() + + if f.open("user://" + character_folder + "/" + file_name, File.READ) == OK: + var st : String = f.get_as_text() + f.close() + + var json_err : String = validate_json(st) + + if json_err != "": + Logger.error("Save corrupted! " + file_name) + Logger.error(json_err) + continue + + var p = parse_json(st) + + if typeof(p) != TYPE_DICTIONARY: + Logger.error("Save corrupted! Not Dict! " + file_name) + continue + + var display : Entity = Entities.spawn_display_player(file_name) + player_display_container_node.add_child(display) + display.owner = player_display_container_node + + display.from_dict(p as Dictionary) + + var centry : Button = character_entry.instance() as Button + container.add_child(centry) + centry.owner = container + centry.group = character_button_group + centry.connect("pressed", self, "character_selection_changed") + + #display.sentity_data.entity_class_data.entity_class_name + centry.setup(file_name, display.sentity_name, "", display.slevel, display) + + if first_entry == null: + first_entry = centry + + if first_entry != null: + first_entry.pressed = true + + else: + dir.make_dir("user://" + character_folder) + +func clear() -> void: + for c in container.get_children(): + c.disconnect("pressed", self, "character_selection_changed") + c.queue_free() + + for e in player_display_container_node.get_children(): + e.queue_free() + +func delete_character() -> void: + var b : BaseButton = character_button_group.get_pressed_button() + + if b == null: + return + + var file_name : String = "user://" + character_folder + "/" + b.file_name + + var f : File = File.new() + + if f.file_exists(file_name): + var d : Directory = Directory.new() + if d.remove(file_name) == OK: + refresh() + +func load_character() -> void: + var b : BaseButton = character_button_group.get_pressed_button() + + if b == null: + return + +# if multiplayer.has_network_peer(): +# var file_name : String = "user://" + character_folder + "/" + b.file_name +# +# var f : File = File.new() +# +# if f.open(file_name, File.READ) == OK: +# var data : String = f.get_as_text() +# +# f.close() +# +# Server.upload_character(data) +# +# get_node("/root/Main").load_character(b.file_name) +# else: + get_node("/root/Main").load_character(b.file_name) + +func visibility_changed() -> void: + if visible: + refresh() + +func character_selection_changed() -> void: + var b : BaseButton = character_button_group.get_pressed_button() + + if b == null: + return + + for e in player_display_container_node.get_children(): + e.hide() + + b.entity.show() diff --git a/game/scenes/ConnectButton.gd b/game/scenes/ConnectButton.gd new file mode 100644 index 00000000..a8e43952 --- /dev/null +++ b/game/scenes/ConnectButton.gd @@ -0,0 +1,19 @@ +extends Button + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +func _ready(): + get_tree().connect("connected_to_server", self, "connected_to_server") + get_tree().connect("server_disconnected", self, "server_disconnected") + +func _exit_tree(): + get_tree().disconnect("connected_to_server", self, "connected_to_server") + get_tree().disconnect("server_disconnected", self, "server_disconnected") + +func connected_to_server(): + hide() + +func server_disconnected(): + show() diff --git a/game/scenes/ConnectServerButton.gd b/game/scenes/ConnectServerButton.gd new file mode 100644 index 00000000..e78a5d73 --- /dev/null +++ b/game/scenes/ConnectServerButton.gd @@ -0,0 +1,57 @@ +extends Button + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export(NodePath) var container_path : NodePath +export(NodePath) var status_label_path : NodePath + +export(NodePath) var use_websockets_checkbox_path : NodePath + +export(NodePath) var ip_line_edit_path : NodePath +export(NodePath) var port_line_edit_path : NodePath + +var _container : Control +var _status : Label + +var _use_websockets_checkbox : CheckBox + +var _ip_line_edit : LineEdit +var _port_line_edit : LineEdit + +func _ready(): + _container = get_node(container_path) as Control + get_tree().connect("connected_to_server", self, "connected_to_server") + + _status = get_node(status_label_path) as Label + _status.text = "" + + _use_websockets_checkbox = get_node(use_websockets_checkbox_path) as CheckBox + + _ip_line_edit = get_node(ip_line_edit_path) as LineEdit + _port_line_edit = get_node(port_line_edit_path) as LineEdit + +func _exit_tree(): + get_tree().disconnect("connected_to_server", self, "connected_to_server") + +func _pressed(): + var ip : String = _ip_line_edit.text + var port : String = _port_line_edit.text + + var portint : int = int(port) + + _status.text = "Connecting..." + var err : int = 0 + + if _use_websockets_checkbox.pressed: + err = Server.connect_to_server_websocket(ip, portint) + else: + err = Server.connect_to_server(ip, portint) + + if err != OK: + _status.text = "Error: " + str(err) + + +func connected_to_server(): + _container.hide() diff --git a/game/scenes/DisconnectButton.gd b/game/scenes/DisconnectButton.gd new file mode 100644 index 00000000..30ace2c1 --- /dev/null +++ b/game/scenes/DisconnectButton.gd @@ -0,0 +1,19 @@ +extends Button + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +func _ready(): + get_tree().connect("connected_to_server", self, "connected_to_server") + get_tree().connect("server_disconnected", self, "server_disconnected") + +func _exit_tree(): + get_tree().disconnect("connected_to_server", self, "connected_to_server") + get_tree().disconnect("server_disconnected", self, "server_disconnected") + +func connected_to_server(): + show() + +func server_disconnected(): + hide() diff --git a/game/scenes/GameScene.gd b/game/scenes/GameScene.gd new file mode 100644 index 00000000..fdba6bc5 --- /dev/null +++ b/game/scenes/GameScene.gd @@ -0,0 +1,9 @@ +extends Node + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +func _ready(): + VisualServer.set_default_clear_color(Color(0, 0, 0)) + diff --git a/game/scenes/HostButton.gd b/game/scenes/HostButton.gd new file mode 100644 index 00000000..1434ea85 --- /dev/null +++ b/game/scenes/HostButton.gd @@ -0,0 +1,16 @@ +extends Button + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + +#func _pressed(): +# Server.start_hosting() diff --git a/game/scenes/HostGameButton.gd b/game/scenes/HostGameButton.gd new file mode 100644 index 00000000..da169729 --- /dev/null +++ b/game/scenes/HostGameButton.gd @@ -0,0 +1,55 @@ +extends Button + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export(NodePath) var container_path : NodePath +export(NodePath) var status_label_path : NodePath + +export(NodePath) var use_websockets_checkbox_path : NodePath + +export(NodePath) var port_line_edit_path : NodePath + +var _container : Control +var _status : Label + +var _use_websockets_checkbox : CheckBox + +var _port_line_edit : LineEdit + +func _ready(): + _container = get_node(container_path) as Control +# get_tree().connect("connected_to_server", self, "connected_to_server") + + _status = get_node(status_label_path) as Label + _status.text = "" + + _use_websockets_checkbox = get_node(use_websockets_checkbox_path) as CheckBox + + _port_line_edit = get_node(port_line_edit_path) as LineEdit + +#func _exit_tree(): +# get_tree().disconnect("connected_to_server", self, "connected_to_server") + +func _pressed(): + var port : String = _port_line_edit.text + + var portint : int = int(port) + + _status.text = "Connecting..." + var err : int = 0 + + if _use_websockets_checkbox.pressed: + err = Server.start_hosting_websocket(portint) + else: + err = Server.start_hosting(portint) + + if err != OK: + _status.text = "Error: " + str(err) + else: + _container.hide() + + +#func connected_to_server(): +# _container.hide() diff --git a/game/scenes/Main.tscn b/game/scenes/Main.tscn new file mode 100644 index 00000000..43dcdb46 --- /dev/null +++ b/game/scenes/Main.tscn @@ -0,0 +1,96 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://scenes/MainScene.gd" type="Script" id=1] +[ext_resource path="res://scenes/World.tscn" type="PackedScene" id=2] +[ext_resource path="res://scenes/Menu.tscn" type="PackedScene" id=3] +[ext_resource path="res://ui/theme/ui_theme.tres" type="Theme" id=4] +[ext_resource path="res://ui/debug/DebugInfo.tscn" type="PackedScene" id=5] +[ext_resource path="res://debug/FreeLookCam.tscn" type="PackedScene" id=6] + +[node name="Main" type="Node"] +script = ExtResource( 1 ) +menu_scene = ExtResource( 3 ) +world_scene = ExtResource( 2 ) +debug_camera_scene = ExtResource( 6 ) +loading_screen_path = NodePath("LoadingScreen/PanelContainer") + +[node name="LoadingScreen" type="CanvasLayer" parent="."] +layer = 100 + +[node name="PanelContainer" type="PanelContainer" parent="LoadingScreen"] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +theme = ExtResource( 4 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="RichTextLabel" type="RichTextLabel" parent="LoadingScreen/PanelContainer"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 1020.0 +margin_bottom = 596.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +bbcode_enabled = true +bbcode_text = "[center] + + + + + + +Broken Seals + + + + + + + + + + + + + + + + + + + +[wave]LOADING[/wave] +[/center]" +text = " + + + + + + +Broken Seals + + + + + + + + + + + + + + + + + + + +LOADING +" + +[node name="DebugInfo" parent="." instance=ExtResource( 5 )] diff --git a/game/scenes/MainScene.gd b/game/scenes/MainScene.gd new file mode 100644 index 00000000..5a677b31 --- /dev/null +++ b/game/scenes/MainScene.gd @@ -0,0 +1,93 @@ +extends Node +class_name Main + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export(int, "None", "Menu", "World") var start_scene = 1 +export(PackedScene) var menu_scene : PackedScene +export(PackedScene) var world_scene : PackedScene +export(PackedScene) var debug_camera_scene : PackedScene +export(NodePath) var loading_screen_path : NodePath + +enum StartSceneTypes { + NONE, MENU, WORLD +} + +var _loading_screen : Node + +var current_scene : Node +var current_character_file_name : String = "" + +func _ready() -> void: + _loading_screen = get_node(loading_screen_path) + + switch_scene(start_scene) + +func switch_scene(scene : int) -> void: + if current_scene != null: + for s in get_tree().get_nodes_in_group("save"): + if not s.has_method("save"): + print(str(s) + " is in group save, but doesn't have save()!") + continue + + s.save() + + current_scene.queue_free() + remove_child(current_scene) + + WorldNumbers.clear() + + if scene == StartSceneTypes.MENU: + var gs : Node = menu_scene.instance() + add_child(gs) + gs.owner = self + + current_scene = gs + + elif scene == StartSceneTypes.WORLD: + var gs : Node = world_scene.instance() + add_child(gs) + gs.owner = self + + current_scene = gs + + if multiplayer.has_network_peer():# and get_tree().network_peer.get_connection_status() == NetworkedMultiplayerPeer.CONNECTION_CONNECTED: + if multiplayer.is_network_server(): + gs.load_character(current_character_file_name) + else: +# var dc = debug_camera_scene.instance() +# +# gs.add_child(dc) +# dc.owner = gs +# + gs.setup_client_seed(Server._cseed) + + var file_name : String = "user://characters/" + current_character_file_name + + var f : File = File.new() + + if f.open(file_name, File.READ) == OK: + var data : String = f.get_as_text() + + f.close() + + Server.upload_character(data) + else: + gs.load_character(current_character_file_name) + + if current_scene.has_method("needs_loading_screen"): + if current_scene.needs_loading_screen(): + show_loading_screen() + +func load_character(file_name : String) -> void: + current_character_file_name = file_name + + switch_scene(StartSceneTypes.WORLD) + +func show_loading_screen() -> void: + _loading_screen.show() + +func hide_loading_screen() -> void: + _loading_screen.hide() diff --git a/game/scenes/Menu.gd b/game/scenes/Menu.gd new file mode 100644 index 00000000..7bae9fee --- /dev/null +++ b/game/scenes/Menu.gd @@ -0,0 +1,30 @@ +extends Control +class_name Menu + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +export(int, "Character Select", "Character Create") var start_menu : int = 0 +export (NodePath) var character_selector_scene : NodePath +export (NodePath) var charcer_creation_scenes : NodePath + +enum StartMenuTypes { + CHARACTER_SELECT, CHARACTER_CREATE +} + +func _ready(): + switch_to_menu(start_menu) + +func switch_to_menu(menu : int) -> void: + + if menu == StartMenuTypes.CHARACTER_SELECT: + get_node(character_selector_scene).show() + else: + get_node(character_selector_scene).hide() + + if menu == StartMenuTypes.CHARACTER_CREATE: + get_node(charcer_creation_scenes).show() + else: + get_node(charcer_creation_scenes).hide() + diff --git a/game/scenes/Menu.tscn b/game/scenes/Menu.tscn new file mode 100644 index 00000000..e7aec61e --- /dev/null +++ b/game/scenes/Menu.tscn @@ -0,0 +1,528 @@ +[gd_scene load_steps=18 format=2] + +[ext_resource path="res://ui/theme/ui_theme.tres" type="Theme" id=1] +[ext_resource path="res://menu/CharacterEntry.tscn" type="PackedScene" id=2] +[ext_resource path="res://scenes/Menu.gd" type="Script" id=3] +[ext_resource path="res://menu/menu_character_button_group.tres" type="ButtonGroup" id=4] +[ext_resource path="res://scenes/CharacterSelectorMenu.gd" type="Script" id=5] +[ext_resource path="res://scenes/CharacterCreationMenu.gd" type="Script" id=6] +[ext_resource path="res://menu/character_creation_button_group.tres" type="ButtonGroup" id=7] +[ext_resource path="res://ui/options/Options.tscn" type="PackedScene" id=8] +[ext_resource path="res://ui/register/Register.tscn" type="PackedScene" id=9] +[ext_resource path="res://ui/login/Login.tscn" type="PackedScene" id=10] +[ext_resource path="res://scenes/ConnectButton.gd" type="Script" id=11] +[ext_resource path="res://scenes/HostButton.gd" type="Script" id=12] +[ext_resource path="res://scenes/DisconnectButton.gd" type="Script" id=13] +[ext_resource path="res://scenes/ConnectServerButton.gd" type="Script" id=14] +[ext_resource path="res://scenes/HostGameButton.gd" type="Script" id=15] + +[sub_resource type="ProceduralSky" id=1] + +[sub_resource type="Environment" id=2] +background_mode = 1 +background_sky = SubResource( 1 ) +ambient_light_color = Color( 1, 1, 1, 1 ) + +[node name="Menu" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +theme = ExtResource( 1 ) +script = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} +character_selector_scene = NodePath("CharacterSelectorMenu") +charcer_creation_scenes = NodePath("CharacterCreationMenu") + +[node name="GameName" type="PanelContainer" parent="."] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -61.0 +margin_right = 61.0 +margin_bottom = 26.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="GameName"] +margin_left = 4.0 +margin_top = 5.0 +margin_right = 118.0 +margin_bottom = 20.0 +text = "Borken Seals" +align = 1 +valign = 1 + +[node name="CharacterSelectorMenu" type="Control" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +theme = ExtResource( 1 ) +script = ExtResource( 5 ) +__meta__ = { +"_edit_use_anchors_": false, +"_editor_description_": "" +} +menu_path = NodePath("..") +container_path = NodePath("CharacterSelector/CharacterSelector/VBoxContainer/ScrollContainer/Container") +player_display_container_path = NodePath("../CharacterDisplay") +character_button_group = ExtResource( 4 ) +character_entry = ExtResource( 2 ) +character_folder = "characters" + +[node name="CharacterSelector" type="MarginContainer" parent="CharacterSelectorMenu"] +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +margin_left = -289.0 +margin_top = -300.0 +margin_bottom = 300.0 +custom_constants/margin_right = 20 +custom_constants/margin_top = 20 +custom_constants/margin_bottom = 20 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="CharacterSelector" type="PanelContainer" parent="CharacterSelectorMenu/CharacterSelector"] +margin_top = 20.0 +margin_right = 269.0 +margin_bottom = 580.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="CharacterSelectorMenu/CharacterSelector/CharacterSelector"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 265.0 +margin_bottom = 556.0 + +[node name="ScrollContainer" type="ScrollContainer" parent="CharacterSelectorMenu/CharacterSelector/CharacterSelector/VBoxContainer"] +margin_right = 261.0 +margin_bottom = 484.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="Container" type="VBoxContainer" parent="CharacterSelectorMenu/CharacterSelector/CharacterSelector/VBoxContainer/ScrollContainer"] +margin_right = 261.0 +size_flags_horizontal = 3 + +[node name="Load" type="Button" parent="CharacterSelectorMenu/CharacterSelector/CharacterSelector/VBoxContainer"] +margin_top = 492.0 +margin_right = 261.0 +margin_bottom = 518.269 +text = "Load" + +[node name="HBoxContainer" type="HBoxContainer" parent="CharacterSelectorMenu/CharacterSelector/CharacterSelector/VBoxContainer"] +margin_top = 526.0 +margin_right = 261.0 +margin_bottom = 552.0 + +[node name="Delete" type="Button" parent="CharacterSelectorMenu/CharacterSelector/CharacterSelector/VBoxContainer/HBoxContainer"] +margin_right = 128.0 +margin_bottom = 26.269 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Delete" + +[node name="Create" type="Button" parent="CharacterSelectorMenu/CharacterSelector/CharacterSelector/VBoxContainer/HBoxContainer"] +margin_left = 132.0 +margin_right = 261.0 +margin_bottom = 26.269 +size_flags_horizontal = 3 +size_flags_vertical = 3 +text = "Create" + +[node name="PlayerDisplays" type="Node" parent="CharacterSelectorMenu"] + +[node name="CharacterCreationMenu" type="Control" parent="."] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 6 ) +__meta__ = { +"_edit_use_anchors_": false +} +character_entry = ExtResource( 2 ) +menu_path = NodePath("..") +name_imput_path = NodePath("CharacterSelector2/CharacterSelector/VBoxContainer/PanelContainer/VBoxContainer/LineEdit") +container_path = NodePath("CharacterSelector2/CharacterSelector/VBoxContainer/ScrollContainer/Container") +character_creation_button_group = ExtResource( 7 ) +character_folder = "characters" + +[node name="CharacterSelector2" type="MarginContainer" parent="CharacterCreationMenu"] +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +margin_left = -289.0 +margin_top = -300.0 +margin_bottom = 300.0 +custom_constants/margin_right = 20 +custom_constants/margin_top = 20 +custom_constants/margin_bottom = 20 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="CharacterSelector" type="PanelContainer" parent="CharacterCreationMenu/CharacterSelector2"] +margin_top = 20.0 +margin_right = 269.0 +margin_bottom = 580.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="CharacterCreationMenu/CharacterSelector2/CharacterSelector"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 265.0 +margin_bottom = 556.0 + +[node name="ScrollContainer" type="ScrollContainer" parent="CharacterCreationMenu/CharacterSelector2/CharacterSelector/VBoxContainer"] +margin_right = 261.0 +margin_bottom = 421.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="Container" type="VBoxContainer" parent="CharacterCreationMenu/CharacterSelector2/CharacterSelector/VBoxContainer/ScrollContainer"] +margin_right = 261.0 +size_flags_horizontal = 3 + +[node name="PanelContainer" type="PanelContainer" parent="CharacterCreationMenu/CharacterSelector2/CharacterSelector/VBoxContainer"] +margin_top = 429.0 +margin_right = 261.0 +margin_bottom = 552.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="CharacterCreationMenu/CharacterSelector2/CharacterSelector/VBoxContainer/PanelContainer"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 257.0 +margin_bottom = 119.0 + +[node name="Label" type="Label" parent="CharacterCreationMenu/CharacterSelector2/CharacterSelector/VBoxContainer/PanelContainer/VBoxContainer"] +margin_right = 253.0 +margin_bottom = 15.0 +text = "Character name" + +[node name="LineEdit" type="LineEdit" parent="CharacterCreationMenu/CharacterSelector2/CharacterSelector/VBoxContainer/PanelContainer/VBoxContainer"] +margin_top = 23.0 +margin_right = 253.0 +margin_bottom = 47.3413 + +[node name="Create" type="Button" parent="CharacterCreationMenu/CharacterSelector2/CharacterSelector/VBoxContainer/PanelContainer/VBoxContainer"] +margin_top = 55.0 +margin_right = 253.0 +margin_bottom = 81.269 +size_flags_horizontal = 3 +text = "Create" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Back" type="Button" parent="CharacterCreationMenu/CharacterSelector2/CharacterSelector/VBoxContainer/PanelContainer/VBoxContainer"] +margin_top = 89.0 +margin_right = 253.0 +margin_bottom = 115.269 +text = "Back" + +[node name="ConnectMenu" type="Control" parent="."] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="PanelContainer" type="PanelContainer" parent="ConnectMenu"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -126.0 +margin_top = -89.0 +margin_right = 126.0 +margin_bottom = 89.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="ConnectMenu/PanelContainer"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 248.0 +margin_bottom = 254.0 + +[node name="Label3" type="Label" parent="ConnectMenu/PanelContainer/VBoxContainer"] +margin_right = 244.0 +margin_bottom = 15.0 +text = "Connect" +align = 1 +valign = 1 + +[node name="Label" type="Label" parent="ConnectMenu/PanelContainer/VBoxContainer"] +margin_top = 23.0 +margin_right = 244.0 +margin_bottom = 38.0 +text = "Hostname / IP" + +[node name="LineEdit" type="LineEdit" parent="ConnectMenu/PanelContainer/VBoxContainer"] +margin_top = 46.0 +margin_right = 244.0 +margin_bottom = 70.3413 +text = "127.0.0.1" + +[node name="Label2" type="Label" parent="ConnectMenu/PanelContainer/VBoxContainer"] +margin_top = 78.0 +margin_right = 244.0 +margin_bottom = 93.0 +text = "Port" + +[node name="LineEdit2" type="LineEdit" parent="ConnectMenu/PanelContainer/VBoxContainer"] +margin_top = 101.0 +margin_right = 244.0 +margin_bottom = 125.341 +text = "23223" + +[node name="CheckBox" type="CheckBox" parent="ConnectMenu/PanelContainer/VBoxContainer"] +margin_top = 133.0 +margin_right = 244.0 +margin_bottom = 159.269 +text = "Use WebSockets" + +[node name="Status" type="Label" parent="ConnectMenu/PanelContainer/VBoxContainer"] +margin_top = 167.0 +margin_right = 244.0 +margin_bottom = 182.0 +align = 1 +valign = 1 + +[node name="ConnectButton" type="Button" parent="ConnectMenu/PanelContainer/VBoxContainer"] +margin_top = 190.0 +margin_right = 244.0 +margin_bottom = 216.269 +text = "Connect" +script = ExtResource( 14 ) +container_path = NodePath("../../..") +status_label_path = NodePath("../Status") +use_websockets_checkbox_path = NodePath("../CheckBox") +ip_line_edit_path = NodePath("../LineEdit") +port_line_edit_path = NodePath("../LineEdit2") + +[node name="Button2" type="Button" parent="ConnectMenu/PanelContainer/VBoxContainer"] +margin_top = 224.0 +margin_right = 244.0 +margin_bottom = 250.269 +text = "Cancel" + +[node name="HostMenu" type="Control" parent="."] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="PanelContainer" type="PanelContainer" parent="HostMenu"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -126.0 +margin_top = -101.5 +margin_right = 126.0 +margin_bottom = 101.5 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="HostMenu/PanelContainer"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 248.0 +margin_bottom = 199.0 + +[node name="Label3" type="Label" parent="HostMenu/PanelContainer/VBoxContainer"] +margin_right = 244.0 +margin_bottom = 15.0 +text = "Host" +align = 1 +valign = 1 + +[node name="Label2" type="Label" parent="HostMenu/PanelContainer/VBoxContainer"] +margin_top = 23.0 +margin_right = 244.0 +margin_bottom = 38.0 +text = "Port" + +[node name="LineEdit2" type="LineEdit" parent="HostMenu/PanelContainer/VBoxContainer"] +margin_top = 46.0 +margin_right = 244.0 +margin_bottom = 70.3413 +text = "23223" + +[node name="CheckBox" type="CheckBox" parent="HostMenu/PanelContainer/VBoxContainer"] +margin_top = 78.0 +margin_right = 244.0 +margin_bottom = 104.269 +text = "Use WebSockets" + +[node name="Status" type="Label" parent="HostMenu/PanelContainer/VBoxContainer"] +margin_top = 112.0 +margin_right = 244.0 +margin_bottom = 127.0 +align = 1 +valign = 1 + +[node name="HostButton" type="Button" parent="HostMenu/PanelContainer/VBoxContainer"] +margin_top = 135.0 +margin_right = 244.0 +margin_bottom = 161.269 +text = "Host" +script = ExtResource( 15 ) +container_path = NodePath("../../..") +status_label_path = NodePath("../Status") +use_websockets_checkbox_path = NodePath("../CheckBox") +port_line_edit_path = NodePath("../LineEdit2") + +[node name="Button2" type="Button" parent="HostMenu/PanelContainer/VBoxContainer"] +margin_top = 169.0 +margin_right = 244.0 +margin_bottom = 195.269 +text = "Cancel" + +[node name="OptionsButton" type="MarginContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +custom_constants/margin_right = 20 +custom_constants/margin_top = 20 +custom_constants/margin_left = 20 +custom_constants/margin_bottom = 20 +__meta__ = { +"_edit_lock_": true, +"_edit_use_anchors_": false +} + +[node name="Control" type="Control" parent="OptionsButton"] +margin_left = 20.0 +margin_top = 20.0 +margin_right = 1004.0 +margin_bottom = 580.0 +mouse_filter = 2 +__meta__ = { +"_edit_lock_": true +} + +[node name="VBoxContainer" type="VBoxContainer" parent="OptionsButton/Control"] +anchor_top = 1.0 +anchor_bottom = 1.0 +margin_top = -175.0 +margin_right = 111.0 +mouse_filter = 2 +alignment = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Disconnect" type="Button" parent="OptionsButton/Control/VBoxContainer"] +visible = false +margin_right = 120.0 +margin_bottom = 26.269 +rect_min_size = Vector2( 120, 0 ) +text = "Disconnect" +script = ExtResource( 13 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Connect" type="Button" parent="OptionsButton/Control/VBoxContainer"] +margin_top = 13.0 +margin_right = 120.0 +margin_bottom = 39.269 +rect_min_size = Vector2( 120, 0 ) +text = "Connect" +script = ExtResource( 11 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Host" type="Button" parent="OptionsButton/Control/VBoxContainer"] +margin_top = 47.0 +margin_right = 120.0 +margin_bottom = 73.269 +rect_min_size = Vector2( 120, 0 ) +text = "Host" +script = ExtResource( 12 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Button2" type="Button" parent="OptionsButton/Control/VBoxContainer"] +margin_top = 81.0 +margin_right = 120.0 +margin_bottom = 107.269 +rect_min_size = Vector2( 120, 0 ) +text = "Login" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Button3" type="Button" parent="OptionsButton/Control/VBoxContainer"] +margin_top = 115.0 +margin_right = 120.0 +margin_bottom = 141.269 +rect_min_size = Vector2( 120, 0 ) +text = "Register" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Button" type="Button" parent="OptionsButton/Control/VBoxContainer"] +margin_top = 149.0 +margin_right = 120.0 +margin_bottom = 175.269 +rect_min_size = Vector2( 120, 0 ) +text = "Options" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Options" parent="." instance=ExtResource( 8 )] +visible = false + +[node name="Login" parent="." instance=ExtResource( 10 )] +visible = false +margin_left = -107.5 +margin_top = -127.5 +margin_right = 107.5 +margin_bottom = 127.5 + +[node name="Register" parent="." instance=ExtResource( 9 )] +visible = false + +[node name="CharacterDisplay" type="Spatial" parent="."] + +[node name="World" type="Spatial" parent="."] + +[node name="WorldEnvironment" type="WorldEnvironment" parent="World"] +environment = SubResource( 2 ) + +[node name="Camera" type="Camera" parent="World"] +transform = Transform( 0.906006, -0.157589, 0.392835, 0.0104413, 0.936144, 0.351461, -0.423137, -0.314324, 0.849797, 0.300506, 1.57764, 2.14719 ) +current = true +[connection signal="pressed" from="CharacterSelectorMenu/CharacterSelector/CharacterSelector/VBoxContainer/Load" to="CharacterSelectorMenu" method="load_character"] +[connection signal="pressed" from="CharacterSelectorMenu/CharacterSelector/CharacterSelector/VBoxContainer/HBoxContainer/Delete" to="CharacterSelectorMenu" method="delete_character"] +[connection signal="pressed" from="CharacterSelectorMenu/CharacterSelector/CharacterSelector/VBoxContainer/HBoxContainer/Create" to="." method="switch_to_menu" binds= [ 1 ]] +[connection signal="pressed" from="CharacterCreationMenu/CharacterSelector2/CharacterSelector/VBoxContainer/PanelContainer/VBoxContainer/Create" to="CharacterCreationMenu" method="create"] +[connection signal="pressed" from="CharacterCreationMenu/CharacterSelector2/CharacterSelector/VBoxContainer/PanelContainer/VBoxContainer/Back" to="." method="switch_to_menu" binds= [ 0 ]] +[connection signal="pressed" from="ConnectMenu/PanelContainer/VBoxContainer/Button2" to="ConnectMenu" method="hide"] +[connection signal="pressed" from="HostMenu/PanelContainer/VBoxContainer/Button2" to="HostMenu" method="hide"] +[connection signal="pressed" from="OptionsButton/Control/VBoxContainer/Connect" to="ConnectMenu" method="show"] +[connection signal="pressed" from="OptionsButton/Control/VBoxContainer/Host" to="HostMenu" method="show"] +[connection signal="pressed" from="OptionsButton/Control/VBoxContainer/Button2" to="Login" method="show"] +[connection signal="pressed" from="OptionsButton/Control/VBoxContainer/Button3" to="Register" method="show"] +[connection signal="pressed" from="OptionsButton/Control/VBoxContainer/Button" to="Options" method="show"] diff --git a/game/scenes/Shared.tscn b/game/scenes/Shared.tscn new file mode 100644 index 00000000..942f716d --- /dev/null +++ b/game/scenes/Shared.tscn @@ -0,0 +1,11 @@ +[gd_scene format=2] + +[node name="SharedScene" type="Node"] + +[node name="Options" type="Control" parent="."] +margin_right = 806.0 +margin_bottom = 557.0 + +[node name="Keybindings" type="Control" parent="."] +margin_right = 746.0 +margin_bottom = 531.0 diff --git a/game/scenes/World.tscn b/game/scenes/World.tscn new file mode 100644 index 00000000..e4515655 --- /dev/null +++ b/game/scenes/World.tscn @@ -0,0 +1,80 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://scripts/world_generators/MainPlanetGenerator.gd" type="Script" id=1] +[ext_resource path="res://data/voxel_libraries/2_main_lib_merger_empty.tres" type="VoxelmanLibraryMerger" id=2] +[ext_resource path="res://scripts/settings/DirectionalLightSettings.gd" type="Script" id=3] +[ext_resource path="res://voxelman/transvoxel_mesher/TVVoxelWorld.gd" type="Script" id=8] + +[sub_resource type="VoxelmanLevelGenerator" id=1] +script = ExtResource( 1 ) +_force_planet = 1 +_level_seed = 0 +_spawn_mobs = false + +[sub_resource type="ProceduralSky" id=2] +sky_top_color = Color( 0.0431373, 0.00784314, 0.0666667, 1 ) +sky_horizon_color = Color( 0.27451, 0.447059, 0.427451, 1 ) +sky_curve = 0.263535 +sky_energy = 0.3 +ground_bottom_color = Color( 0.196078, 0.152941, 0.152941, 1 ) +ground_horizon_color = Color( 0.223529, 0.192157, 0.164706, 1 ) +ground_curve = 0.101965 +ground_energy = 0.4 +sun_color = Color( 0.619608, 0.47451, 0.113725, 1 ) +sun_latitude = 37.43 +sun_longitude = -8.09 +sun_angle_min = 0.0 +sun_angle_max = 23.15 +sun_energy = 9.7 +texture_size = 0 + +[sub_resource type="Environment" id=3] +background_mode = 2 +background_sky = SubResource( 2 ) +ambient_light_color = Color( 0.737255, 0.737255, 0.737255, 1 ) +fog_enabled = true +fog_color = Color( 0.278431, 0.360784, 0.360784, 1 ) +fog_sun_color = Color( 0.113725, 0.568627, 0.827451, 1 ) +fog_depth_begin = 34.0 +fog_depth_end = 257.9 +fog_depth_curve = 1.18921 +tonemap_mode = 2 +tonemap_exposure = 0.83 +auto_exposure_max_luma = 7.33 +ss_reflections_enabled = true +ssao_enabled = true +glow_levels/3 = false +glow_intensity = 1.6 +glow_strength = 1.1 +glow_bloom = 0.1 +glow_hdr_luminance_cap = 1.0 +adjustment_enabled = true +adjustment_contrast = 1.05 + +[node name="World" type="VoxelWorld" groups=[ +"save", +]] +use_threads = false +max_concurrent_generations = 1 +library = ExtResource( 2 ) +level_generator = SubResource( 1 ) +voxel_scale = 4.0 +chunk_spawn_range = 3 +script = ExtResource( 8 ) + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource( 3 ) + +[node name="DirectionalLight" type="DirectionalLight" parent="."] +transform = Transform( -0.797163, 0.45442, 0.397535, 0, -0.658427, 0.752644, 0.603765, 0.59998, 0.524873, 0, 18.834, 0 ) +layers = 3 +light_energy = 1.4 +light_specular = 0.7 +shadow_bias = 0.07 +script = ExtResource( 3 ) + +[node name="DirectionalLight2" type="DirectionalLight" parent="."] +transform = Transform( -0.797163, 0.523191, -0.301335, 0, 0.499093, 0.866549, 0.603765, 0.69078, -0.397858, 0, 18.834, 0 ) +light_energy = 0.4 +light_specular = 0.0 +directional_shadow_normal_bias = 0.1