Update the engine and modules. Also updated most of the project (except for the UI).

This commit is contained in:
Relintai 2021-02-21 00:05:04 +01:00
parent 3cf6261c43
commit ccae78e3be
27 changed files with 329 additions and 205 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11"}, "world_generator": {"master": "2b17341ac2b22d766d6f90426f161f04d9ddc599"}, "entity_spell_system": {"master": "65782c63d5e9fea43ce32701af6fe1c97f0bf0a6"}, "ui_extensions": {"master": "ca7df8435154d1146be36c4fc97e6cc7092d3eb9"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "thread_pool": {"master": "164ad82feb05842cb944c2907b65e521f8c7c465"}}
{"engine": {"3.2": "f15f5b45781eb3de8e5811400f654e3e49580149"}, "world_generator": {"master": "d12ab222a2387e20164b3e7c6236983223ca88ef"}, "entity_spell_system": {"master": "3bbe1138973bafe57638e569e87d28b6e0a0eb46"}, "ui_extensions": {"master": "f1ae14c1be0750f65c77ecaad037dbe1cfb28269"}, "texture_packer": {"master": "c712c4b30839400ba22e5a6b01f2a20fd9b311fa"}, "fastnoise": {"master": "d447fd5364e9ab5a6b14184483eab23cd3fe820b"}, "thread_pool": {"master": "da4e049da09cb726a00f1edb1df935a2e8475902"}}

View File

@ -5,4 +5,5 @@
[resource]
script = ExtResource( 1 )
enabled = true
resource_db = ExtResource( 2 )

View File

@ -1,10 +1,11 @@
[gd_resource type="EntityClassData" load_steps=25 format=2]
[gd_resource type="EntityClassData" load_steps=26 format=2]
[ext_resource path="res://modules/entity_classes/naturalist/spells/16_close_wounds_rank_1.tres" type="Spell" id=1]
[ext_resource path="res://modules/entity_classes/naturalist/spells/19_uproot_rank_1.tres" type="Spell" id=2]
[ext_resource path="res://modules/entity_classes/naturalist/spells/11_aspect_of_wasps_rank_1.tres" type="Spell" id=3]
[ext_resource path="res://modules/core/entity_resources/1_mana_resource.tres" type="EntityResource" id=4]
[ext_resource path="res://modules/entity_classes/naturalist/spells/13_aspect_of_bees_rank_1.tres" type="Spell" id=5]
[ext_resource path="res://modules/entity_classes/naturalist/stats/player_statdata.tres" type="StatData" id=6]
[ext_resource path="res://modules/entity_classes/naturalist/spells/10_aspect_of_scorpions_rank_1.tres" type="Spell" id=7]
[ext_resource path="res://scripts/ai/EntityAIGD.gd" type="Script" id=9]
[ext_resource path="res://modules/entity_classes/naturalist/spells/17_ironbark_rank_1.tres" type="Spell" id=10]
@ -33,6 +34,7 @@ id = 1
resource_name = "Naturalist"
id = 1
text_name = "Naturalist"
stat_data = ExtResource( 6 )
entity_resources = [ ExtResource( 4 ) ]
specs = [ SubResource( 2 ) ]
spells = [ ExtResource( 7 ), ExtResource( 3 ), ExtResource( 15 ), ExtResource( 5 ), ExtResource( 12 ), ExtResource( 23 ), ExtResource( 1 ), ExtResource( 10 ), ExtResource( 24 ), ExtResource( 2 ), ExtResource( 19 ), ExtResource( 18 ), ExtResource( 17 ), ExtResource( 20 ), ExtResource( 11 ), ExtResource( 22 ), ExtResource( 16 ), ExtResource( 21 ), ExtResource( 14 ) ]

View File

@ -13,9 +13,4 @@ aura_type = 1
text_name = "Nature's Swiftness"
text_description = "Increases your movement speed by 60% for 6 sec. This spell is not on the global cooldown."
visual_spell_effects = ExtResource( 2 )
attribute_count = 1
StatModAttribute_0/stat = 1
StatModAttribute_0/base_mod = 0.0
StatModAttribute_0/bonus_mod = 0.0
StatModAttribute_0/percent_mod = 60.0
script = ExtResource( 1 )

View File

@ -1,40 +1,15 @@
[gd_resource type="EntityData" load_steps=8 format=2]
[gd_resource type="EntityData" load_steps=4 format=2]
[ext_resource path="res://modules/core/crafting/2_chest_of_the_infinite_wisdom.tres" type="CraftRecipe" id=1]
[ext_resource path="res://modules/entity_classes/naturalist/1_naturalist.tres" type="EntityClassData" id=2]
[ext_resource path="res://modules/species/species_human.tres" type="EntitySpeciesData" id=3]
[ext_resource path="res://scripts/entities/EntityDataGD.gd" type="Script" id=4]
[ext_resource path="res://modules/core/crafting/1_test_craft.tres" type="CraftRecipe" id=5]
[sub_resource type="SimpleLevelStatData" id=1]
agility = 4
strength = 3
stamina = 6
intellect = 5
spirit = 3
[sub_resource type="StatData" id=2]
level_stat_data = SubResource( 1 )
stat/agility = 23.0
stat/strength = 14.0
stat/stamina = 23.0
stat/intellect = 19.0
stat/spirit = 3.0
stat/health = 100.0
stat/mana = 100.0
stat/speed = 20.0
stat/global_cooldown = 1.5
[resource]
resource_name = "Naturalist"
id = 1
entity_type = 4
entity_controller = 1
is_playable = true
text_name = "Naturalist"
bag_size = 24
stat_data = SubResource( 2 )
entity_species_data = ExtResource( 3 )
entity_class_data = ExtResource( 2 )
craft_recipes = [ ExtResource( 5 ), ExtResource( 1 ) ]
script = ExtResource( 4 )

View File

@ -1,4 +1,4 @@
[gd_resource type="EntityData" load_steps=7 format=2]
[gd_resource type="EntityData" load_steps=5 format=2]
[ext_resource path="res://modules/species/species_human.tres" type="EntitySpeciesData" id=1]
[ext_resource path="res://modules/entity_classes/naturalist/1_naturalist.tres" type="EntityClassData" id=2]
@ -6,32 +6,10 @@
[sub_resource type="LootDataBase" id=1]
[sub_resource type="SimpleLevelStatData" id=2]
agility = 3
strength = 2
stamina = 3
intellect = 4
spirit = 5
[sub_resource type="StatData" id=3]
level_stat_data = SubResource( 2 )
stat/agility = 14.0
stat/strength = 15.0
stat/stamina = 13.0
stat/intellect = 13.0
stat/spirit = 10.0
stat/health = 20.0
stat/mana = 20.0
stat/speed = 20.0
stat/global_cooldown = 1.5
[resource]
resource_name = "Naturalist"
id = 2
entity_type = 4
entity_controller = 2
text_name = "Naturalist"
stat_data = SubResource( 3 )
entity_species_data = ExtResource( 1 )
entity_class_data = ExtResource( 2 )
loot_db = SubResource( 1 )

View File

@ -0,0 +1,19 @@
[gd_resource type="StatData" load_steps=2 format=2]
[sub_resource type="SimpleLevelStatData" id=1]
agility = 3
strength = 2
stamina = 3
intellect = 4
spirit = 5
[resource]
level_stat_data = SubResource( 1 )
stat/agility = 14.0
stat/strength = 15.0
stat/stamina = 13.0
stat/intellect = 13.0
stat/spirit = 10.0
stat/health = 20.0
stat/mana = 20.0
stat/global_cooldown = 1.5

View File

@ -0,0 +1,19 @@
[gd_resource type="StatData" load_steps=2 format=2]
[sub_resource type="SimpleLevelStatData" id=1]
agility = 4
strength = 3
stamina = 6
intellect = 5
spirit = 3
[resource]
level_stat_data = SubResource( 1 )
stat/agility = 23.0
stat/strength = 14.0
stat/stamina = 23.0
stat/intellect = 19.0
stat/spirit = 3.0
stat/health = 100.0
stat/mana = 100.0
stat/global_cooldown = 1.5

View File

@ -54,9 +54,14 @@ func _notification_cmouse_enter() -> void:
Input.set_default_cursor_shape(Input.CURSOR_CROSS)
elif centity_interaction_type == EntityEnums.ENITIY_INTERACTION_TYPE_NONE:
Input.set_default_cursor_shape(Input.CURSOR_ARROW)
elif centity_interaction_type == EntityEnums.ENITIY_INTERACTION_TYPE_TRAIN:
Input.set_default_cursor_shape(Input.CURSOR_HELP)
elif centity_interaction_type == EntityEnums.ENITIY_INTERACTION_TYPE_VENDOR:
Input.set_default_cursor_shape(Input.CURSOR_HELP)
else:
Input.set_default_cursor_shape(Input.CURSOR_MOVE)
func _notification_cmouse_exit() -> void:
Input.set_default_cursor_shape(Input.CURSOR_ARROW)

View File

@ -75,7 +75,7 @@ remote func creceive_spawn_for(data: String, global_name : String, position: Vec
remote func creceive_despawn_for(path : NodePath) -> void:
# print("recdespawnfor " + path)
var ent = get_scene_tree().root.get_node_or_null(path)
var ent = get_tree().root.get_node_or_null(path)
if ent:
ent.queue_free()
@ -83,7 +83,7 @@ remote func creceive_despawn_for(path : NodePath) -> void:
puppet func spawn_owned_player(data : String, position : Vector3) -> Entity:
var createinfo : EntityCreateInfo = EntityCreateInfo.new()
createinfo.guid = get_scene_tree().multiplayer.get_network_unique_id()
createinfo.guid = get_tree().multiplayer.get_network_unique_id()
# createinfo.player_name = ""
createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_PLAYER
createinfo.entity_player_type = EntityEnums.ENTITY_PLAYER_TYPE_PLAYER
@ -263,14 +263,14 @@ func _request_entity_spawn(createinfo : EntityCreateInfo):
if (createinfo.parent_path == ""):
if _spawn_parent == null:
_spawn_parent = get_scene_tree().root.get_node(spawn_parent_path)
_spawn_parent = get_tree().root.get_node(spawn_parent_path)
if _spawn_parent.current_scene != null:
var spawn_parent = _spawn_parent.current_scene
spawn_parent.add_child(entity_node)
else:
get_scene_tree().root.get_node(createinfo.parent_path).add_child(entity_node)
get_tree().root.get_node(createinfo.parent_path).add_child(entity_node)
entity_node.setup(createinfo)
entity_node.set_maunal_process(true)

View File

@ -1,10 +0,0 @@
[gd_resource type="ESSEntitySpawner" load_steps=3 format=2]
[ext_resource path="res://player/bs_entity_spawner.gd" type="Script" id=1]
[ext_resource path="res://player/DisplayPlayer.tscn" type="PackedScene" id=4]
[resource]
script = ExtResource( 1 )
player_display_scene = ExtResource( 4 )
spawn_parent_path = "/root/Main"
default_level_override = 0

View File

@ -0,0 +1,8 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://player/bs_entity_spawner.gd" type="Script" id=1]
[ext_resource path="res://player/DisplayPlayer.tscn" type="PackedScene" id=2]
[node name="ESSEntitySpawner" type="ESSEntitySpawner"]
script = ExtResource( 1 )
player_display_scene = ExtResource( 2 )

View File

@ -133,6 +133,16 @@ _global_script_classes=[ {
"class": "SpellGD",
"language": "GDScript",
"path": "res://scripts/spells/gd_spell_script.gd"
}, {
"base": "GameModule",
"class": "UIGuiChildModule",
"language": "GDScript",
"path": "res://scripts/game_modules/ui_gui_child_module.gd"
}, {
"base": "GameModule",
"class": "UIWindowModule",
"language": "GDScript",
"path": "res://scripts/game_modules/ui_window_module.gd"
} ]
_global_script_class_icons={
"AuraGD": "",
@ -159,7 +169,9 @@ _global_script_class_icons={
"PlayerMaster": "",
"SpeedResource": "",
"SpellEffectVisualBasic": "",
"SpellGD": ""
"SpellGD": "",
"UIGuiChildModule": "",
"UIWindowModule": ""
}
Node="input/actionbar_5_11"
@ -178,6 +190,8 @@ WorldNumbers="*res://ui/world_numbers_2d/WorldNumbers.tscn"
CursorManager="*res://cursors/autoload/CursorManager.tscn"
Settings="*res://ui/autoload/SettingsManager.tscn"
Logger="*res://autoload/Logger.tscn"
DataManager="*res://scripts/game_modules/DataManager.tscn"
EntitySpawner="*res://player/bs_entity_spawner.tscn"
[debug]
@ -199,13 +213,13 @@ window/size/viewport_scale=100
[ess]
data/ess_resource_db_path="res://data/resource_db.tres"
data/ess_entity_spawner_path="res://player/bs_entity_spawner.tres"
enums/stats="Agility,Strength,Stamina,Intellect,Spirit,Health,Mana,Speed,Global Cooldown,Haste,Haste Rating,Resilience,Armor,Attack Power,Spell Power,Melee Crit,Melee Crit bonus,Spell Crit,Spell Crit Bonus,Block,Parry,Damage Reduction,Melee Damage Reduction,Spell Damage Reduction,Damage Taken,Heal Taken,Melee Damage,Spell Damage,Holy Resist,Shadow Resist,Nature Resist,Fire Resist,Frost Resist,Lightning Resist,Chaos Resist,Silence Resist,Fear Resist,Stun Resist,Energy,Rage,XP Rate"
enums/skeletons_bones=PoolStringArray( "", "root,pelvis,spine,spine_1,spine_2,neck,head,left_clavicle,left_upper_arm,left_forearm,left_hand,left_thumb_base,left_thumb_end,left_fingers_base,left_fingers_end,right_clavicle,right_upper_arm,right_forearm,right_hand,right_thumb_base,right_thumb_end,right_fingers_base,right_fingers_end,left_thigh,left_calf,left_foot,right_thigh,right_calf,right_foot" )
enums/skeletons_bone_attachment_points=PoolStringArray( "", "left_hand,right_hand,torso,root,right_hip,left_hip,spine_2,weapon_left,weapon_right,weapon_left_back,weapon_right_back,weapon_shield_left" )
xp/class_xps=PoolIntArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
xp/character_xps=PoolIntArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
profiles/automatic_save=true
data/ess_entity_spawner_path="res://player/bs_entity_spawner.tres"
level/max_character_level=60
level/max_class_level=60

View File

@ -40,63 +40,11 @@ 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_entity_spawner()
# ESS.resource_db = ESSResourceDBMap.new()
ESS.resource_db = ESSResourceDBStatic.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():
if path == "res://":
load_modules_at(path + file_name)
else:
load_modules_at(path + "/" + file_name)
else:
if file_name == "game_module.tres":
var res : Resource = null
if path == "res://":
res = ResourceLoader.load(path + file_name)
else:
res = 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:
for s in get_tree().get_nodes_in_group("save"):
@ -143,12 +91,6 @@ 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
func get_world():
return world_scene

View File

@ -0,0 +1,9 @@
extends Aura
export(String) var spell_name : String
export(float) var reduction_value : float
func _notification_ccast(what : int, data : AuraData, info: SpellCastInfo):
if SpellEnums.NOTIFICATION_CAST_STARTED:
if info.spell.get_name() == spell_name:
info.cast_time -= reduction_value

View File

@ -0,0 +1,26 @@
extends "aura_script.gd"
export(bool) var does_stack : bool = true
export(float) var mod_speed : float = 0
func apply_mods(ad : AuraData):
#slows never stack
if mod_speed < 0:
ad.owner.gets_speed().add_non_stacking_mod(mod_speed)
return
if does_stack:
ad.owner.gets_speed().add_stacking_mod(mod_speed)
else:
ad.owner.gets_speed().add_non_stacking_mod(mod_speed)
func deapply_mods(ad : AuraData):
#slows never stack
if mod_speed < 0:
ad.owner.gets_speed().remove_non_stacking_mod(mod_speed)
return
if does_stack:
ad.owner.gets_speed().remove_stacking_mod(mod_speed)
else:
ad.owner.gets_speed().remove_non_stacking_mod(mod_speed)

View File

@ -0,0 +1,14 @@
extends "aura_script.gd"
export(String) var spell_name : String
export(float) var mod_value : float
func _sapply_passives_damage_deal(data : SpellDamageInfo):
var spell : Spell = data.spell_source_get()
if !spell:
return
if spell.get_name() == spell_name:
data.damage *= (100.0 + mod_value) / 100.0

View File

@ -21,69 +21,54 @@ class_name AuraGD
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
#func _handle_aura_damage(aura_data : AuraData, damage_info : SpellDamageInfo) -> void:
# randomize()
#
# if damage_info.dealer == null:
# printerr("_handle_aura_damage: damage_info.dealer is null! ")
# return
#
# damage_info.damage = damage_min + (randi() % (damage_max - damage_min))
#
# if scale_with_level:
# damage_info.damage *= int(float(damage_info.dealer.scharacter_level) / float(EntityEnums.MAX_CHARACTER_LEVEL))
#
# damage_info.damage_source_type = aura_data.aura.damage_type
#
# if (is_instance_valid(damage_info.dealer)):
# damage_info.dealer.sdeal_damage_to(damage_info)
#
#func _handle_aura_heal(aura_data : AuraData, shi : SpellHealInfo) -> void:
# randomize()
#
# shi.heal = heal_min + (randi() % (heal_max - heal_min))
# shi.damage *= shi.dealer.scharacter_level / float(EntityEnums.MAX_CHARACTER_LEVEL)
# shi.heal_source_type = aura_data.aura.aura_type
#
# shi.dealer.sdeal_heal_to(shi)
#
#func _sapply(info : AuraApplyInfo) -> void:
## var add : bool = false
# var ad : AuraData = info.target.aura_gets_by(info.caster, info.aura.id)
#
# if ad == null:
## add = true
# ad = AuraData.new()
#
# setup_aura_data(ad, info);
#
# for i in range(stat_attribute_get_count()):
# info.target.stat_mod(id, stat_attribute_get_base_mod(i), stat_attribute_get_bonus_mod(i), stat_attribute_get_percent_mod(i))
#
# if states_add != 0:
# for i in range(EntityEnums.ENTITY_STATE_TYPE_INDEX_MAX):
# var t : int = 1 << i
#
# if states_add & t != 0:
# info.target.adds_state_ref(i)
#
#
# info.target.aura_adds(ad);
# else:
# ad.remaining_time = time
#
func _sapply(info : AuraApplyInfo) -> void:
# var add : bool = false
var ad : AuraData = info.target.aura_gets_by(info.caster, info.aura.id)
if ad == null:
# add = true
ad = AuraData.new()
setup_aura_data(ad, info);
for i in range(stat_attribute_get_count()):
info.target.stat_mod(stat_attribute_get_stat(id), stat_attribute_get_base_mod(i), stat_attribute_get_bonus_mod(i), stat_attribute_get_percent_mod(i))
if states_add != 0:
for i in range(EntityEnums.ENTITY_STATE_TYPE_INDEX_MAX):
var t : int = 1 << i
if states_add & t != 0:
info.target.adds_state_ref(i)
info.target.aura_adds(ad);
apply_mods(ad)
else:
ad.remaining_time = time
func _sdeapply(data : AuraData) -> void:
for i in range(stat_attribute_get_count()):
data.owner.stat_mod(stat_attribute_get_stat(id), -stat_attribute_get_base_mod(i), -stat_attribute_get_bonus_mod(i), -stat_attribute_get_percent_mod(i))
if states_add != 0:
for i in range(EntityEnums.ENTITY_STATE_TYPE_INDEX_MAX):
var t : int = 1 << i
if states_add & t != 0:
data.owner.removes_state_ref(i)
deapply_mods(data)
func apply_mods(ad : AuraData):
pass
func deapply_mods(ad : AuraData):
pass
#func _sdeapply(data : AuraData) -> void:
# for i in range(stat_attribute_get_count()):
# data.owner.stat_mod(id, stat_attribute_get_base_mod(i), stat_attribute_get_bonus_mod(i), stat_attribute_get_percent_mod(i))
#
# if states_add != 0:
# for i in range(EntityEnums.ENTITY_STATE_TYPE_INDEX_MAX):
# var t : int = 1 << i
#
# if states_add & t != 0:
# data.owner.removes_state_ref(i)
func _con_aura_added(data : AuraData) -> void:
if data.owner.get_character_skeleton() == null or data.owner.get_character_skeleton().root_attach_point == null:

View File

@ -51,6 +51,10 @@ func _sinteract(entity: Entity) -> void:
entity.starget_bag = target.sbag
entity.ssend_open_window(EntityEnums.ENTITY_WINDOW_LOOT)
elif target.sentity_interaction_type == EntityEnums.ENITIY_INTERACTION_TYPE_TRAIN:
entity.ssend_open_window(EntityEnums.ENTITY_WINDOW_TRAINER)
elif target.sentity_interaction_type == EntityEnums.ENITIY_INTERACTION_TYPE_VENDOR:
entity.ssend_open_window(EntityEnums.ENTITY_WINDOW_VENDOR)
func _cans_interact(entity):
var target : Entity = entity.gets_target()

View File

@ -0,0 +1,78 @@
extends Node
const PLAYER_UI_INSTANCE : int = 0
export(PackedScene) var player_ui : PackedScene
var _modules : Array
func _ready() -> void:
ProfileManager.load()
# ESS.resource_db = ESSResourceDBMap.new()
ESS.resource_db = ESSResourceDBStatic.new()
ESS.resource_db.remap_ids = true
# ESS.load_all()
initialize_modules()
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():
if path == "res://":
load_modules_at(path + file_name)
else:
load_modules_at(path + "/" + file_name)
else:
if file_name == "game_module.tres":
var res : Resource = null
if path == "res://":
res = ResourceLoader.load(path + file_name)
else:
res = ResourceLoader.load(path + "/" + file_name)
if res.enabled:
_modules.append(res)
file_name = dir.get_next()
else:
print("An error occurred when trying to access the path: " + path)
func request_instance(what : int) -> Node:
var inst : Node = null
if what == PLAYER_UI_INSTANCE:
inst = player_ui.instance()
inst.initialize()
for module in _modules:
# if module.has_method("on_request_instance"):
module.on_request_instance(what, inst)
return inst
class ModulePathSorter:
static func sort_ascending(a, b):
if a.resource_path < b.resource_path:
return true
return false

View File

@ -0,0 +1,8 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://scripts/game_modules/DataManager.gd" type="Script" id=1]
[ext_resource path="res://ui/player_ui/player_ui.tscn" type="PackedScene" id=2]
[node name="DataManager" type="Node"]
script = ExtResource( 1 )
player_ui = ExtResource( 2 )

View File

@ -1,6 +1,8 @@
extends Resource
class_name GameModule
export(bool) var enabled : bool = true
export(ESSResourceDB) var resource_db : ESSResourceDB
func load_module():
@ -18,3 +20,6 @@ func load_module():
# for s in r.get_spells():
# print(s.resource_name)
# print(s.get_id())
func on_request_instance(what : int, node : Node) -> void:
return

View File

@ -0,0 +1,15 @@
extends GameModule
class_name UIGuiChildModule
export(PackedScene) var scene : PackedScene
export(bool) var hide : bool = false
func on_request_instance(what : int, node : Node) -> void:
if what == DataManager.PLAYER_UI_INSTANCE:
var sc = scene.instance()
node.gui_base.add_child(sc)
if hide:
sc.hide()

View File

@ -0,0 +1,22 @@
extends GameModule
class_name UIWindowModule
export(PackedScene) var scene : PackedScene
export(Texture) var opener_button_texture : Texture
export(int) var index : int = -1
export(bool) var add_button : bool = true
func on_request_instance(what : int, node : Node) -> void:
if what == DataManager.PLAYER_UI_INSTANCE:
var sc = scene.instance()
node.windows.add_child(sc)
if add_button:
var b = node.buttons.add_image_button(opener_button_texture, index)
b.connect("toggled", sc, "_on_button_toggled")
sc.opener_button = b
sc.hide()

View File

@ -3,6 +3,9 @@ extends Theme
export(float) var content_margin_vertical_normal : float = 6
export(float) var content_margin_vertical_touch : float = 10
export(float) var content_margin_horizontal_normal : float = 5
export(float) var content_margin_horizontal_touch : float = 20
func _init():
Settings.connect("setting_changed", self, "setting_changed")
Settings.connect("settings_loaded", self, "settings_loaded")
@ -20,21 +23,26 @@ func settings_loaded():
func adapt(touchscreen_mode : bool) -> void:
var content_martgin_vert : float = 0
var content_margin_horiz : float = 0
if touchscreen_mode:
content_martgin_vert = content_margin_vertical_touch
content_margin_horiz = content_margin_horizontal_touch
else:
content_martgin_vert = content_margin_vertical_normal
content_margin_horiz = content_margin_horizontal_normal
for sbs in get_stylebox_list("Button"):
var sb : StyleBoxTexture = get_stylebox(sbs, "Button") as StyleBoxTexture
if sb == null:
continue
sb.margin_top = content_martgin_vert
sb.margin_bottom = content_martgin_vert
sb.content_margin_top = content_martgin_vert
sb.content_margin_bottom = content_martgin_vert
sb.content_margin_left = content_margin_horiz
sb.content_margin_right = content_margin_horiz

View File

@ -60,7 +60,7 @@ func create_planet():
else:
ind = _force_planet
var planet_data : PlanetData = ResourceLoader.load(planet_files[ind], "PlanetData")
var planet_data : Planet = ResourceLoader.load(planet_files[ind], "PlanetData")
if planet_data == null:
print("planet_data is null!")

File diff suppressed because one or more lines are too long