mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-10 08:42:11 +01:00
Now the game pretty much supports modding. MainScene will now look through the project opening all files named game_module.tres and in alphabetic order of their resource_path if exist it calls load_module on them. ESS's resourcedb is now created by MainScene, and it's the static type, with id remapping on. Append your resourcedbs into it. See game_module.gd. Also updated HEADS to grab the latest ESS.
This commit is contained in:
parent
ce28c217ad
commit
1de820dfcc
2
HEADS
2
HEADS
@ -1 +1 @@
|
||||
{"engine": {"3.2": "50582446ad13a7ce034bdd8695409bf26c1abac3", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "9d946f1623b9cb57b2e1d9681ac3b7f7e7b746d4"}, "entity_spell_system": {"master": "6c9bea09bc91bc62c0bb2493b1b5b2e1cc88bd6c"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "23c4321d71927a0e2d08b5d19fc4c5bb8242e7d2"}, "texture_packer": {"master": "b29b499adf570aa7f85af69ef080ff0d5e04afae"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "4ee946963a16bbfdb4dbb5df52134d22aa168041"}, "procedural_animations": {"master": "9ae56c17230ba9c6160777650b2b89eecdc8df9e"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "f6d3d65cc6ce4dddfc68054164feec1f612ecd1f"}, "props": {"master": "b2bcb5ea6469b19298cd849c1232ddb5ad26f71c"}}
|
||||
{"engine": {"3.2": "50582446ad13a7ce034bdd8695409bf26c1abac3", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "9d946f1623b9cb57b2e1d9681ac3b7f7e7b746d4"}, "entity_spell_system": {"master": "b5ed3b16c8ec7bc3fe6147e67b59dc7ffb64e88c"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "23c4321d71927a0e2d08b5d19fc4c5bb8242e7d2"}, "texture_packer": {"master": "b29b499adf570aa7f85af69ef080ff0d5e04afae"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "4ee946963a16bbfdb4dbb5df52134d22aa168041"}, "procedural_animations": {"master": "9ae56c17230ba9c6160777650b2b89eecdc8df9e"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "f6d3d65cc6ce4dddfc68054164feec1f612ecd1f"}, "props": {"master": "b2bcb5ea6469b19298cd849c1232ddb5ad26f71c"}}
|
9
game/data/game_module.tres
Normal file
9
game/data/game_module.tres
Normal file
@ -0,0 +1,9 @@
|
||||
[gd_resource type="Resource" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/game_modules/GameModule.gd" type="Script" id=1]
|
||||
[ext_resource path="res://data/resource_db.tres" type="ESSResourceDBFolders" id=2]
|
||||
|
||||
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
||||
resource_db = ExtResource( 2 )
|
@ -117,7 +117,7 @@ func load_player(file_name : String, position : Vector3, network_owner : int) ->
|
||||
|
||||
func spawn_player_for_menu(class_id : int, name : String, parent : Node) -> Entity:
|
||||
var createinfo : EntityCreateInfo = EntityCreateInfo.new()
|
||||
var cls : EntityData = ESS.get_player_character_data(class_id)
|
||||
var cls : EntityData = ESS.resource_db.get_entity_data(class_id)
|
||||
var class_profile : ClassProfile = ProfileManager.getc_player_profile().get_class_profile(class_id)
|
||||
|
||||
var level : int = 1
|
||||
|
@ -184,6 +184,11 @@ _global_script_classes=[ {
|
||||
"language": "GDScript",
|
||||
"path": "res://steering_ai_framework/GSAIUtils.gd"
|
||||
}, {
|
||||
"base": "Resource",
|
||||
"class": "GameModule",
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/game_modules/GameModule.gd"
|
||||
}, {
|
||||
"base": "ItemTemplate",
|
||||
"class": "ItemTemplateGD",
|
||||
"language": "GDScript",
|
||||
@ -295,6 +300,7 @@ _global_script_class_icons={
|
||||
"GSAISteeringBehavior": "",
|
||||
"GSAITargetAcceleration": "",
|
||||
"GSAIUtils": "",
|
||||
"GameModule": "",
|
||||
"ItemTemplateGD": "",
|
||||
"LayeredTextureMaker": "",
|
||||
"Main": "",
|
||||
|
@ -85,6 +85,14 @@ func refresh():
|
||||
continue
|
||||
|
||||
var display : Entity = ESS.entity_spawner.spawn_display_player(file_name, player_display_container_node.get_path())
|
||||
|
||||
var entity_data : EntityData = ESS.get_resource_db().get_entity_data(display.characterclass_id)
|
||||
|
||||
if entity_data == null:
|
||||
print("EntityData not found!")
|
||||
display.queue_free()
|
||||
continue
|
||||
|
||||
#player_display_container_node.add_child(display)
|
||||
#display.owner = player_display_container_node
|
||||
|
||||
|
@ -36,13 +36,54 @@ var _loading_screen : Node
|
||||
var current_scene : Node
|
||||
var current_character_file_name : String = ""
|
||||
|
||||
var _modules : Array
|
||||
|
||||
func _ready() -> void:
|
||||
_loading_screen = get_node(loading_screen_path)
|
||||
|
||||
ProfileManager.load()
|
||||
ESS.load_all()
|
||||
ESS.load_entity_spawner()
|
||||
ESS.resource_db = ESSResourceDBStatic.new()
|
||||
# ESS.resource_db = ESSResourceDBFolders.new()
|
||||
ESS.resource_db.remap_ids = true
|
||||
# ESS.load_all()
|
||||
|
||||
initialize_modules()
|
||||
|
||||
switch_scene(start_scene)
|
||||
|
||||
func initialize_modules() -> void:
|
||||
_modules.clear()
|
||||
|
||||
load_modules_at("res://")
|
||||
|
||||
_modules.sort_custom(ModulePathSorter, "sort_ascending")
|
||||
|
||||
for module in _modules:
|
||||
if module.has_method("load_module"):
|
||||
module.load_module()
|
||||
|
||||
func load_modules_at(path : String) -> void:
|
||||
var dir = Directory.new()
|
||||
if dir.open(path) == OK:
|
||||
dir.list_dir_begin()
|
||||
var file_name = dir.get_next()
|
||||
while file_name != "":
|
||||
if file_name == "." or file_name == "..":
|
||||
file_name = dir.get_next()
|
||||
continue
|
||||
|
||||
if dir.current_is_dir():
|
||||
load_modules_at(path + "/" + file_name)
|
||||
else:
|
||||
if file_name == "game_module.tres":
|
||||
var res : Resource = ResourceLoader.load(path + "/" + file_name)
|
||||
|
||||
_modules.append(res)
|
||||
|
||||
file_name = dir.get_next()
|
||||
else:
|
||||
print("An error occurred when trying to access the path: " + path)
|
||||
|
||||
func switch_scene(scene : int) -> void:
|
||||
if current_scene != null:
|
||||
@ -110,3 +151,9 @@ func show_loading_screen() -> void:
|
||||
|
||||
func hide_loading_screen() -> void:
|
||||
_loading_screen.hide()
|
||||
|
||||
class ModulePathSorter:
|
||||
static func sort_ascending(a, b):
|
||||
if a.resource_path < b.resource_path:
|
||||
return true
|
||||
return false
|
||||
|
12
game/scripts/game_modules/GameModule.gd
Normal file
12
game/scripts/game_modules/GameModule.gd
Normal file
@ -0,0 +1,12 @@
|
||||
extends Resource
|
||||
class_name GameModule
|
||||
|
||||
export(ESSResourceDB) var resource_db : ESSResourceDB
|
||||
|
||||
func load_module():
|
||||
if resource_db != null:
|
||||
resource_db.initialize()
|
||||
|
||||
ESS.resource_db.add_entity_resource_db(resource_db)
|
||||
|
||||
# var r : ESSResourceDB = ESS.resource_db
|
@ -161,7 +161,10 @@ func setup_icon() -> void:
|
||||
ThemeAtlas.unref_texture(icon_rect.texture)
|
||||
icon_rect.texture = null
|
||||
|
||||
var spell = ESS.get_resource_db().get_spell(button_entry.item_id)
|
||||
var spell = ESS.resource_db.get_spell(button_entry.item_id)
|
||||
|
||||
if spell == null:
|
||||
return
|
||||
|
||||
if spell.icon != null:
|
||||
icon_rect.texture = ThemeAtlas.add_texture(spell.icon)
|
||||
|
@ -240,4 +240,4 @@ func save() -> void:
|
||||
if _player == null or _player_file_name == "":
|
||||
return
|
||||
|
||||
ESS.get_ess_entity_spawner().save_player(_player, _player_file_name)
|
||||
ESS.entity_spawner.save_player(_player, _player_file_name)
|
||||
|
Loading…
Reference in New Issue
Block a user