From 5150dccf9e3733cfa9fd54951ddf3b331f5dcf44 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 1 Feb 2020 15:44:22 +0100 Subject: [PATCH] Update to the latest ESS. --- HEADS | 2 +- .../{EntityDataManager.gd => Entities.gd} | 8 +- game/autoload/Entities.tscn | 15 ++++ game/autoload/EntityDataManager.tscn | 26 ------ game/autoload/ProfileManager.gd | 85 ------------------- game/autoload/ProfileManager.tscn | 6 -- game/autoload/SettingsManager.gd | 16 ++++ game/project.godot | 6 +- game/ui/buttons/Buttons.gd | 2 +- 9 files changed, 40 insertions(+), 126 deletions(-) rename game/autoload/{EntityDataManager.gd => Entities.gd} (97%) create mode 100644 game/autoload/Entities.tscn delete mode 100644 game/autoload/EntityDataManager.tscn delete mode 100644 game/autoload/ProfileManager.gd delete mode 100644 game/autoload/ProfileManager.tscn diff --git a/HEADS b/HEADS index 31ecf0d0..10d4f12f 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": "f26e2f65cd4af638a5e64a42aa519abc9cde6604", "world_generator": "09372b146936fda509f5c23a522e998d12f38e13", "entity_spell_system": "5f5cdac043e2add5c54d165c6b507b0e02289497", "ui_extensions": "38acc650db260a831dc26ca96fe9d9a087230bdc", "voxelman": "db77530ec1b70861fb2e3783d3ea6ba75a4ac793", "texture_packer": "7bff901e4946b903a73b266d6a02c317f079ab33", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "entity-spell-system-addons": "d60e746b158d3ebf9d2ea306af1dd24bcae49be5", "mesh_data_resource": "4bda19b12be2c2a79a6121de6d22e48f3934e726", "ess_data": "3bd637fdd3304b64a18287a49a6b7387acf2f5de", "prop_tool": "df438053ebc900966f8f842fc65f0264f1271d49", "procedural_animations": "9c287b9e54dc8d306668a6118a6d2c78415eb8de", "fast_quadratic_mesh_simplifier": "63d55b154967321212a6426e9b327c95e007785d"} \ No newline at end of file +{"engine": "217d8f4e9760ab846e258b7c8842548b601c2ab9", "world_generator": "09372b146936fda509f5c23a522e998d12f38e13", "entity_spell_system": "26c638881bcb8f1d86360e22fa39f3c95af32429", "ui_extensions": "38acc650db260a831dc26ca96fe9d9a087230bdc", "voxelman": "db77530ec1b70861fb2e3783d3ea6ba75a4ac793", "texture_packer": "7bff901e4946b903a73b266d6a02c317f079ab33", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "entity-spell-system-addons": "d60e746b158d3ebf9d2ea306af1dd24bcae49be5", "mesh_data_resource": "4bda19b12be2c2a79a6121de6d22e48f3934e726", "ess_data": "3bd637fdd3304b64a18287a49a6b7387acf2f5de", "prop_tool": "df438053ebc900966f8f842fc65f0264f1271d49", "procedural_animations": "9c287b9e54dc8d306668a6118a6d2c78415eb8de", "fast_quadratic_mesh_simplifier": "63d55b154967321212a6426e9b327c95e007785d"} \ No newline at end of file diff --git a/game/autoload/EntityDataManager.gd b/game/autoload/Entities.gd similarity index 97% rename from game/autoload/EntityDataManager.gd rename to game/autoload/Entities.gd index f66a6226..c0b52d17 100644 --- a/game/autoload/EntityDataManager.gd +++ b/game/autoload/Entities.gd @@ -38,7 +38,7 @@ var _players : Array var _mobs : Array func _ready(): - EntityDataManager.load_all() + #EntityDataManager.load_all() _spawn_parent = get_node(spawn_parent_path) @@ -166,7 +166,7 @@ func spawn_display_player(name : String) -> Entity: func spawn_player_for_menu(class_id : int, name : String, parent : Node) -> Entity: var createinfo : EntityCreateInfo = EntityCreateInfo.new() var cls : EntityData = EntityDataManager.get_player_character_data(class_id) - var class_profile : ClassProfile = Profiles.get_class_profile(class_id) + var class_profile : ClassProfile = ProfileManager.get_class_profile(class_id) createinfo.entity_data = cls createinfo.player_name = name @@ -194,7 +194,7 @@ func spawn_networked_player(class_id : int, position : Vector3, name : String, var cls : EntityData = Entities.get_entity_data(class_id) - var class_profile : ClassProfile = Profiles.get_class_profile(class_id) + var class_profile : ClassProfile = ProfileManager.get_class_profile(class_id) createinfo.entity_data = cls createinfo.player_name = name @@ -225,7 +225,7 @@ func spawn_player(class_id : int, position : Vector3, name : String, node_name var cls : EntityData = Entities.get_player_character_data(class_id) - var class_profile : ClassProfile = Profiles.get_class_profile(class_id) + var class_profile : ClassProfile = ProfileManager.get_class_profile(class_id) createinfo.entity_data = cls createinfo.player_name = name diff --git a/game/autoload/Entities.tscn b/game/autoload/Entities.tscn new file mode 100644 index 00000000..2d170491 --- /dev/null +++ b/game/autoload/Entities.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://autoload/Entities.gd" type="Script" id=1] +[ext_resource path="res://player/NetworkedPlayer.tscn" type="PackedScene" id=2] +[ext_resource path="res://player/Player.tscn" type="PackedScene" id=3] +[ext_resource path="res://player/Mob.tscn" type="PackedScene" id=4] +[ext_resource path="res://player/DisplayPlayer.tscn" type="PackedScene" id=5] + +[node name="Entities" type="Node"] +script = ExtResource( 1 ) +player_scene = ExtResource( 3 ) +networked_player_scene = ExtResource( 2 ) +mob_scene = ExtResource( 4 ) +player_display_scene = ExtResource( 5 ) +default_level_override = 50 diff --git a/game/autoload/EntityDataManager.tscn b/game/autoload/EntityDataManager.tscn deleted file mode 100644 index d87885af..00000000 --- a/game/autoload/EntityDataManager.tscn +++ /dev/null @@ -1,26 +0,0 @@ -[gd_scene load_steps=6 format=2] - -[ext_resource path="res://autoload/EntityDataManager.gd" type="Script" id=1] -[ext_resource path="res://player/NetworkedPlayer.tscn" type="PackedScene" id=2] -[ext_resource path="res://player/Player.tscn" type="PackedScene" id=3] -[ext_resource path="res://player/Mob.tscn" type="PackedScene" id=4] -[ext_resource path="res://player/DisplayPlayer.tscn" type="PackedScene" id=5] - -[node name="EntityDataManager" type="Node"] -xp_data_path = "res://data/xp/xp_data.tres" -entity_resources_folder = "res://data/entity_resources" -entity_skills_folder = "res://data/entity_skills" -entity_datas_folder = "res://data/entities" -spells_folder = "res://data/spells" -auras_folder = "res://data/auras" -world_spell_datas_folder = "res://data/world_spells" -craft_data_folder = "res://data/crafting" -item_template_folder = "res://data/item_templates" -mob_data_folder = "res://data/mob_data" -player_character_data_folder = "res://data/player_character_data" -script = ExtResource( 1 ) -player_scene = ExtResource( 3 ) -networked_player_scene = ExtResource( 2 ) -mob_scene = ExtResource( 4 ) -player_display_scene = ExtResource( 5 ) -default_level_override = 50 diff --git a/game/autoload/ProfileManager.gd b/game/autoload/ProfileManager.gd deleted file mode 100644 index 538e3f1c..00000000 --- a/game/autoload/ProfileManager.gd +++ /dev/null @@ -1,85 +0,0 @@ -extends ProfileManager - -# Copyright Péter Magyar relintai@gmail.com -# MIT License, functionality from this class needs to be protable to the entity spell system - -# Copyright (c) 2019-2020 Péter Magyar - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -#export (float) var save_interval : float = 20 -#var last_save_time : float = 0 - -func _ready(): - var save_game : File = File.new() - - if save_game.file_exists("user://profile.save"): - load_full() - else: - load_defaults() - - var actions : Array = InputMap.get_actions() - - for action in actions: - var acts : Array = InputMap.get_action_list(action) - - for i in range(len(acts)): - var a = acts[i] - if a is InputEventKey: - var nie : BSInputEventKey = BSInputEventKey.new() - nie.from_input_event_key(a as InputEventKey) - acts[i] = nie - - InputMap.action_erase_event(action, a) - InputMap.action_add_event(action, nie) - - -func _save() -> void: - save_full() - -func _load() -> void: - load_full() - -func save_full() -> void: - var save_game = File.new() - - save_game.open("user://profile.save", File.WRITE) - - save_game.store_line(to_json(to_dict())) - - save_game.close() - -func load_full() -> void: - clear_class_profiles() - - var save_game : File = File.new() - - if save_game.file_exists("user://profile.save"): - if save_game.open("user://profile.save", File.READ) == OK: - - var text : String = save_game.get_as_text() - - if text == "": - load_defaults() - return - - var save_json : Dictionary = parse_json(text) - - from_dict(save_json) - diff --git a/game/autoload/ProfileManager.tscn b/game/autoload/ProfileManager.tscn deleted file mode 100644 index 1d2cc579..00000000 --- a/game/autoload/ProfileManager.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://autoload/ProfileManager.gd" type="Script" id=1] - -[node name="ProfileManager" type="ProfileManager"] -script = ExtResource( 1 ) diff --git a/game/autoload/SettingsManager.gd b/game/autoload/SettingsManager.gd index e29fdc2d..a3d98e09 100644 --- a/game/autoload/SettingsManager.gd +++ b/game/autoload/SettingsManager.gd @@ -44,6 +44,22 @@ var _settings : Dictionary = { func _ready(): load_settings() + var actions : Array = InputMap.get_actions() + + for action in actions: + var acts : Array = InputMap.get_action_list(action) + + for i in range(len(acts)): + var a = acts[i] + if a is InputEventKey: + var nie : BSInputEventKey = BSInputEventKey.new() + nie.from_input_event_key(a as InputEventKey) + acts[i] = nie + + InputMap.action_erase_event(action, a) + InputMap.action_add_event(action, nie) + + func set_value(section, key, value) -> void: _settings[section][key] = value diff --git a/game/project.godot b/game/project.godot index 186f0dfd..f6b9bdaf 100644 --- a/game/project.godot +++ b/game/project.godot @@ -230,8 +230,7 @@ config/version="0.2" Logger="*res://autoload/Logger.tscn" Settings="*res://autoload/SettingsManager.gd" CursorManager="*res://autoload/CursorManager.tscn" -Entities="*res://autoload/EntityDataManager.tscn" -Profiles="*res://autoload/ProfileManager.tscn" +Entities="*res://autoload/Entities.tscn" WorldNumbers="*res://autoload/WorldNumbers.tscn" ThemeAtlas="*res://autoload/ThemeAtlas.tscn" Server="*res://autoload/Server.tscn" @@ -259,6 +258,7 @@ enabled=PoolStringArray( "ess_data", "prop_tool" ) [ess] +data/automatic_load=true data/xp_data_path="res://data/xp/xp_data.tres" data/entity_resources_folder="res://data/entity_resources" data/entity_skills_folder="res://data/entity_skills" @@ -270,7 +270,7 @@ data/craft_data_folder="res://data/crafting" data/item_template_folder="res://data/item_templates" data/mob_data_folder="res://data/mob_data" data/player_character_data_folder="res://data/player_character_data" -data/automatic_load=true +profiles/automatic_load=true [importer_defaults] diff --git a/game/ui/buttons/Buttons.gd b/game/ui/buttons/Buttons.gd index 35d4c2e3..a1923c99 100644 --- a/game/ui/buttons/Buttons.gd +++ b/game/ui/buttons/Buttons.gd @@ -57,7 +57,7 @@ func _lock_button_click(): if cls == null: return - var profile = Profiles.get_class_profile(cls.id) + var profile = ProfileManager.get_class_profile(cls.id) profile.actionbar_locked = not profile.actionbar_locked