diff --git a/HEADS b/HEADS index 617ce4f5..31b69f80 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "02ed72c3733aa2290dec9ffca52a7bbbc96382c3", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "4fe75fd30b1e8993d929d38b609af6b331919873"}, "entity_spell_system": {"master": "cc4c5edc91ff1eb0573712563796edcf248c45a3"}, "ui_extensions": {"master": "8c4302f7f700d0c03adeeba305e728c39521ab65"}, "voxelman": {"master": "c752086bdd5a23d67dff37b3cb7184f48d3757b2"}, "texture_packer": {"master": "c62297108f9d4add231b4f1e582821956d337b9d"}, "fastnoise": {"master": "f7aed39c065f465abcb6f1651ea0256306818934"}, "mesh_data_resource": {"master": "b9cb58897af8e4fc9526b3355528f10f3d2c19e1"}, "procedural_animations": {"master": "0d6e4c86437acaeb96e267fa7d51519d2296fa5b"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "58d46884a492e644b16f988479d286fc8a342239"}, "props": {"master": "0aceb2aeca8a9d7cd2c312b66cf23dc330f041b2"}} \ No newline at end of file +{"engine": {"3.2": "36a30f681fc8c3256829616f32ee452b15674752", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "9d946f1623b9cb57b2e1d9681ac3b7f7e7b746d4"}, "entity_spell_system": {"master": "d5fa8c67bf5a5206cef387361cff4dc145533e63"}, "ui_extensions": {"master": "8c4302f7f700d0c03adeeba305e728c39521ab65"}, "voxelman": {"master": "17b033e7072f516c0bd96a3bd1e374543259b3e9"}, "texture_packer": {"master": "b29b499adf570aa7f85af69ef080ff0d5e04afae"}, "fastnoise": {"master": "f7aed39c065f465abcb6f1651ea0256306818934"}, "mesh_data_resource": {"master": "b9cb58897af8e4fc9526b3355528f10f3d2c19e1"}, "procedural_animations": {"master": "9ae56c17230ba9c6160777650b2b89eecdc8df9e"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "58d46884a492e644b16f988479d286fc8a342239"}, "props": {"master": "0aceb2aeca8a9d7cd2c312b66cf23dc330f041b2"}} \ No newline at end of file diff --git a/game/autoload/Entities.gd b/game/autoload/Entities.gd index 11f1176e..b6bc0ce8 100644 --- a/game/autoload/Entities.gd +++ b/game/autoload/Entities.gd @@ -38,8 +38,9 @@ func _ready(): _spawn_parent = get_node(spawn_parent_path) ProfileManager.load() - EntityDataManager.load_all() - EntityDataManager.connect("on_entity_spawn_requested", self, "on_entity_spawn_requested") + ESS.load_resource_db() + ESS.get_resource_db().load_all() + ESS.connect("on_entity_spawn_requested", self, "on_entity_spawn_requested") # get_tree().connect("network_peer_connected", self, "_player_connected") # get_tree().connect("network_peer_disconnected", self, "_player_disconnected") @@ -64,7 +65,7 @@ remote func creceive_spawn_for(data: String, global_name : String, position: Vec createinfo.serialized_data = parse_json(data) createinfo.transform.origin = position - EntityDataManager.request_entity_spawn(createinfo) + ESS.request_entity_spawn(createinfo) Logger.info("Player spawned ") @@ -87,7 +88,7 @@ puppet func spawn_owned_player(data : String, position : Vector3) -> Entity: createinfo.serialized_data = parse_json(data) createinfo.transform.origin = position - EntityDataManager.request_entity_spawn(createinfo) + ESS.request_entity_spawn(createinfo) Logger.info("Player spawned ") @@ -105,13 +106,13 @@ func load_player(file_name : String, position : Vector3, network_owner : int) -> createinfo.transform.origin = position createinfo.networked = false Logger.info("Player spawned ") - EntityDataManager.request_entity_spawn(createinfo) + ESS.request_entity_spawn(createinfo) return createinfo.created_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 cls : EntityData = ESS.get_player_character_data(class_id) var class_profile : ClassProfile = ProfileManager.getc_player_profile().get_class_profile(class_id) var level : int = 1 @@ -131,7 +132,7 @@ func spawn_player_for_menu(class_id : int, name : String, parent : Node) -> Enti createinfo.networked = false createinfo.parent_path = parent.get_path() - EntityDataManager.request_entity_spawn(createinfo) + ESS.request_entity_spawn(createinfo) Logger.info("Player spawned " + str(createinfo)) @@ -150,7 +151,7 @@ func spawn_display_player(file_name : String, node_path : NodePath) -> Entity: Logger.info("Player spawned ") - EntityDataManager.request_entity_spawn(createinfo) + ESS.request_entity_spawn(createinfo) return createinfo.created_entity @@ -178,7 +179,7 @@ func spawn_networked_player(class_id : int, position : Vector3, name : String, createinfo.networked = false createinfo.transform.origin = position - EntityDataManager.request_entity_spawn(createinfo) + ESS.request_entity_spawn(createinfo) Logger.info("Player spawned " + str(createinfo)) @@ -207,7 +208,7 @@ func spawn_player(class_id : int, position : Vector3, name : String, node_name createinfo.transform.origin = position createinfo.networked = false - EntityDataManager.request_entity_spawn(createinfo) + ESS.request_entity_spawn(createinfo) Logger.info("Player spawned " + str(createinfo)) @@ -217,7 +218,7 @@ func spawn_player(class_id : int, position : Vector3, name : String, node_name func spawn_mob(class_id : int, level : int, position : Vector3) -> void: var createinfo : EntityCreateInfo = EntityCreateInfo.new() - var cls : EntityData = EntityDataManager.get_entity_data(class_id) + var cls : EntityData = ESS.get_resource_db().get_entity_data(class_id) createinfo.class_id = class_id createinfo.entity_data = cls @@ -228,7 +229,7 @@ func spawn_mob(class_id : int, level : int, position : Vector3) -> void: createinfo.entity_player_type = EntityEnums.ENTITY_PLAYER_TYPE_AI createinfo.transform.origin = position - EntityDataManager.request_entity_spawn_deferred(createinfo) + ESS.request_entity_spawn_deferred(createinfo) Logger.info("Mob spawned " + str(createinfo)) diff --git a/game/data/item_templates/2_test.tres b/game/data/item_templates/2_test.tres index 32bea07e..f43b9e85 100644 --- a/game/data/item_templates/2_test.tres +++ b/game/data/item_templates/2_test.tres @@ -7,8 +7,8 @@ [resource] resource_name = "Iron Bar" id = 2 -text_name = "Iron Bar" stack_size = 10 icon = ExtResource( 2 ) use_spell = ExtResource( 3 ) +text_name = "Iron Bar" script = ExtResource( 1 ) diff --git a/game/data/player_character_data/1_naturalist.tres b/game/data/player_character_data/1_naturalist.tres index 226faf45..f648e01b 100644 --- a/game/data/player_character_data/1_naturalist.tres +++ b/game/data/player_character_data/1_naturalist.tres @@ -10,6 +10,7 @@ resource_name = "Naturalist" id = 1 entity_type = 4 entity_controller = 1 +is_playable = true text_name = "Naturalist" bag_size = 24 entity_class_data = ExtResource( 1 ) diff --git a/game/data/resource_db.tres b/game/data/resource_db.tres new file mode 100644 index 00000000..a2c1c2e3 --- /dev/null +++ b/game/data/resource_db.tres @@ -0,0 +1,5 @@ +[gd_resource type="ESSResourceDB" format=2] + +[resource] +xp_data_path = "res://data/xp/xp_data.tres" +folders = PoolStringArray( "res://data/entity_skills", "res://data/entities", "res://data/spells", "res://data/auras", "res://data/crafting", "res://data/item_templates", "res://data/player_character_data", "res://data/species", "res://data/mob_data", "res://data/world_spells", "res://data/entity_resources" ) diff --git a/game/dungeon_generator/MainDungeonGenerator.gd b/game/dungeon_generator/MainDungeonGenerator.gd index 7186f643..f63e9121 100644 --- a/game/dungeon_generator/MainDungeonGenerator.gd +++ b/game/dungeon_generator/MainDungeonGenerator.gd @@ -7,7 +7,6 @@ enum GenType { } -export(PropData) var prop : PropData export(MeshDataResource) var prop_mesht : MeshDataResource @@ -138,16 +137,16 @@ func generate_terrarin(chunk : VoxelChunk) -> void: # # buffer.set_voxel(int(255.0 * val), x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL) - var prop_data : VoxelChunkPropData = VoxelChunkPropData.new() - prop_data.x = 10 - prop_data.y = 3 - prop_data.z = 10 -# prop_data.rotation = Vector3(randi() % 360, randi() % 360, randi() % 360) -# prop_data.scale = Vector3(2, 2, 2) -# prop_data.mesh = prop_mesht - prop_data.prop = prop +# var prop_data : VoxelChunkPropData = VoxelChunkPropData.new() +# prop_data.x = 10 +# prop_data.y = 3 +# prop_data.z = 10 +## prop_data.rotation = Vector3(randi() % 360, randi() % 360, randi() % 360) +## prop_data.scale = Vector3(2, 2, 2) +## prop_data.mesh = prop_mesht +# prop_data.prop = prop - chunk.add_prop(prop_data) +# chunk.add_prop(prop_data) # generate_caves(chunk) @@ -216,35 +215,35 @@ func generate_test(chunk : VoxelChunk) ->void: func spawn_equiv_class(buffer : VoxelChunk, cls : int, x : int, y : int, z : int) -> void: # var size : int = 100 - if cls & VoxelMesherTransvoxel.VOXEL_ENTRY_MASK_000: + if cls & VoxelMesherUVTransvoxel.VOXEL_ENTRY_MASK_000: buffer.set_voxel(1, x, y, z, VoxelChunk.DEFAULT_CHANNEL_TYPE) buffer.set_voxel(randi() % 255, x, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL) - if cls & VoxelMesherTransvoxel.VOXEL_ENTRY_MASK_100: + if cls & VoxelMesherUVTransvoxel.VOXEL_ENTRY_MASK_100: buffer.set_voxel(1, x + 1, y, z, VoxelChunk.DEFAULT_CHANNEL_TYPE) buffer.set_voxel(randi() % 255, x + 1, y, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL) - if cls & VoxelMesherTransvoxel.VOXEL_ENTRY_MASK_001: + if cls & VoxelMesherUVTransvoxel.VOXEL_ENTRY_MASK_001: buffer.set_voxel(1, x, y, z + 1, VoxelChunk.DEFAULT_CHANNEL_TYPE) buffer.set_voxel(randi() % 255, x, y, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL) - if cls & VoxelMesherTransvoxel.VOXEL_ENTRY_MASK_101: + if cls & VoxelMesherUVTransvoxel.VOXEL_ENTRY_MASK_101: buffer.set_voxel(1, x + 1, y, z + 1, VoxelChunk.DEFAULT_CHANNEL_TYPE) buffer.set_voxel(randi() % 255, x + 1, y, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL) - if cls & VoxelMesherTransvoxel.VOXEL_ENTRY_MASK_010: + if cls & VoxelMesherUVTransvoxel.VOXEL_ENTRY_MASK_010: buffer.set_voxel(1, x, y + 1, z, VoxelChunk.DEFAULT_CHANNEL_TYPE) buffer.set_voxel(randi() % 255, x, y + 1, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL) - if cls & VoxelMesherTransvoxel.VOXEL_ENTRY_MASK_110: + if cls & VoxelMesherUVTransvoxel.VOXEL_ENTRY_MASK_110: buffer.set_voxel(1, x + 1, y + 1, z, VoxelChunk.DEFAULT_CHANNEL_TYPE) buffer.set_voxel(randi() % 255, x + 1, y + 1, z, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL) - if cls & VoxelMesherTransvoxel.VOXEL_ENTRY_MASK_011: + if cls & VoxelMesherUVTransvoxel.VOXEL_ENTRY_MASK_011: buffer.set_voxel(1, x, y + 1, z + 1, VoxelChunk.DEFAULT_CHANNEL_TYPE) buffer.set_voxel(randi() % 255, x, y + 1, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL) - if cls & VoxelMesherTransvoxel.VOXEL_ENTRY_MASK_111: + if cls & VoxelMesherUVTransvoxel.VOXEL_ENTRY_MASK_111: buffer.set_voxel(1, x + 1, y + 1, z + 1, VoxelChunk.DEFAULT_CHANNEL_TYPE) buffer.set_voxel(randi() % 255, x + 1, y + 1, z + 1, VoxelChunk.DEFAULT_CHANNEL_ISOLEVEL) diff --git a/game/player/Mob.gd b/game/player/Mob.gd index cb19fa6c..da47822b 100644 --- a/game/player/Mob.gd +++ b/game/player/Mob.gd @@ -293,10 +293,10 @@ func set_max_visible_distance(var value : float) -> void: # sentity_name = sentity_data.text_name func _son_xp_gained(value : int) -> void: - if not EntityDataManager.get_xp_data().can_character_level_up(gets_character_level()): + if not ESS.get_resource_db().get_xp_data().can_character_level_up(gets_character_level()): return - var xpr : int = EntityDataManager.get_xp_data().get_character_xp(gets_character_level()); + var xpr : int = ESS.get_resource_db().get_xp_data().get_character_xp(gets_character_level()); if xpr <= scharacter_xp: scharacter_levelup(1) diff --git a/game/project.godot b/game/project.godot index a3c43b85..938a2c81 100644 --- a/game/project.godot +++ b/game/project.godot @@ -357,19 +357,8 @@ enabled=PoolStringArray( "ess_data" ) spells/allow_class_spell_learning=true spells/allow_class_recipe_learning=true level/use_class_xp=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" -data/entity_datas_folder="res://data/entities" -data/spells_folder="res://data/spells" -data/auras_folder="res://data/auras" -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/entity_species_data_folder="res://data/species" +data/ess_resource_db_path="res://data/resource_db.tres" profiles/automatic_save=true -data/world_spell_datas_folder="res://data/world_spells" [importer_defaults] diff --git a/game/scenes/CharacterCreationMenu.gd b/game/scenes/CharacterCreationMenu.gd index f642a5e5..bdcfd7a7 100644 --- a/game/scenes/CharacterCreationMenu.gd +++ b/game/scenes/CharacterCreationMenu.gd @@ -38,8 +38,11 @@ func _ready(): var fb : Button = null - for i in range(EntityDataManager.get_player_character_data_count()): - var d : EntityData = EntityDataManager.get_player_character_data_index(i) + for i in range(ESS.get_resource_db().get_entity_data_count()): + var d : EntityData = ESS.get_resource_db().get_entity_data_index(i) + + if not d.is_playable: + continue var ce : Button = character_entry.instance() as Button diff --git a/game/scenes/CharacterSelectorMenu.gd b/game/scenes/CharacterSelectorMenu.gd index 37574f12..c12d749f 100644 --- a/game/scenes/CharacterSelectorMenu.gd +++ b/game/scenes/CharacterSelectorMenu.gd @@ -98,7 +98,7 @@ func refresh(): centry.connect("pressed", self, "character_selection_changed") - centry.setup(file_name, display.sentity_name, EntityDataManager.get_player_character_data(display.characterclass_id).text_name, display.scharacter_level, display.sclass_level, display) + centry.setup(file_name, display.sentity_name, ESS.get_resource_db().get_entity_data(display.characterclass_id).text_name, display.scharacter_level, display.sclass_level, display) if first_entry == null: first_entry = centry @@ -143,7 +143,7 @@ func renounce_character() -> void: var class_profile : ClassProfile = ProfileManager.getc_player_profile().get_class_profile(b.entity.characterclass_id) - var xp_data : XPData = EntityDataManager.get_xp_data() + var xp_data : XPData = ESS.get_resource_db().get_xp_data() if xp_data.can_class_level_up(class_profile.level): class_profile.xp += b.entity.sclass_xp diff --git a/game/scenes/World.tscn b/game/scenes/World.tscn index f75966d1..430f91f2 100644 --- a/game/scenes/World.tscn +++ b/game/scenes/World.tscn @@ -61,6 +61,7 @@ max_frame_chunk_build_steps = 4 library = ExtResource( 2 ) level_generator = SubResource( 1 ) voxel_scale = 3.0 +chunk_spawn_range = 5 build_flags = 511 script = ExtResource( 8 ) diff --git a/game/ui/actionbars/ActionBarEntry.gd b/game/ui/actionbars/ActionBarEntry.gd index f69038cc..c0542d56 100644 --- a/game/ui/actionbars/ActionBarEntry.gd +++ b/game/ui/actionbars/ActionBarEntry.gd @@ -161,7 +161,7 @@ func setup_icon() -> void: ThemeAtlas.unref_texture(icon_rect.texture) icon_rect.texture = null - var spell = EntityDataManager.get_spell(button_entry.item_id) + var spell = ESS.get_resource_db().get_spell(button_entry.item_id) if spell.icon != null: icon_rect.texture = ThemeAtlas.add_texture(spell.icon) @@ -182,7 +182,7 @@ func setup_icon() -> void: ThemeAtlas.unref_texture(icon_rect.texture) icon_rect.texture = null - var item : ItemTemplate = EntityDataManager.get_item_template(button_entry.item_id) + var item : ItemTemplate = ESS.get_resource_db().get_item_template(button_entry.item_id) if item.icon != null: icon_rect.texture = ThemeAtlas.add_texture(item.icon) @@ -258,7 +258,7 @@ func drop_data(pos, esd) -> void: button_entry.type = ActionBarButtonEntry.ACTION_BAR_BUTTON_ENTRY_TYPE_ITEM if button_entry.item_id != esd.item_id: - var it : ItemTemplate = EntityDataManager.get_item_template(esd.item_id) + var it : ItemTemplate = ESS.get_resource_db().get_item_template(esd.item_id) if it == null or it.use_spell == null: button_entry.item_id = 0 diff --git a/game/ui/unitframes/UnitframeBase.gd b/game/ui/unitframes/UnitframeBase.gd index 513892d9..506d97f7 100644 --- a/game/ui/unitframes/UnitframeBase.gd +++ b/game/ui/unitframes/UnitframeBase.gd @@ -136,7 +136,7 @@ func clevel_changed(entity: Entity, value : int) -> void: _level_text.text = str(_player.ccharacter_level) _xp_range.min_value = 0 - _xp_range.max_value = EntityDataManager.get_xp_data().get_character_xp(_player.ccharacter_level) + _xp_range.max_value = ESS.get_resource_db().get_xp_data().get_character_xp(_player.ccharacter_level) func con_xp_gained(entity: Entity, val: int) -> void: _xp_range.value = _player.ccharacter_xp