From df563bf1b1c5643b369c20e079edd0dae747cafe Mon Sep 17 00:00:00 2001 From: Kirill Date: Tue, 5 May 2026 23:49:12 +0300 Subject: [PATCH] Refactor code structure for improved readability and maintainability; removed redundant code blocks and optimized existing functions. --- Autoload/Global.gd | 30 ++--- Autoload/{locale.en.csv => locale.en.txt} | 0 Autoload/{locale.ru.csv => locale.ru.txt} | 0 ..._entitites.csv => owniverse_entitites.txt} | 44 +++--- Autoload/owniverse_items.csv | 125 ------------------ Autoload/owniverse_items.txt | 125 ++++++++++++++++++ Autoload/{SaveManager.gd => save_manager.gd} | 0 ...SaveManager.gd.uid => save_manager.gd.uid} | 0 .../{templates.en.csv => templates.en.txt} | 0 Stage/stage.gd | 91 ++++++++----- Tools/Counter.gd | 9 -- UI/Border/border.tscn | 4 +- ...sionPointer.png => aggression_pointer.png} | 0 ...ityPointer.png => burnability_pointer.png} | 0 .../{BorderWarning.png => border_warning.png} | 0 .../{DensityCrunch.png => density_crunch.png} | 0 ...DensityPointer.png => density_pointer.png} | 0 .../{DensityRip.png => density_rip.png} | 0 .../Trends/{TrendBar1.png => trend_bar1.png} | 0 .../Trends/{TrendBar2.png => trend_bar2.png} | 0 .../Trends/{TrendBar3.png => trend_bar3.png} | 0 .../Trends/{TrendBar4.png => trend_bar4.png} | 0 .../Trends/{TrendBar5.png => trend_bar5.png} | 0 ...{TrendBarEmpty.png => trend_bar_empty.png} | 0 .../{TrendIcon1.png => trend_icon_1.png} | 0 .../{TrendIcon2.png => trend_icon_2.png} | 0 .../{TrendIcon3.png => trend_icon_3.png} | 0 .../{TrendIcon4.png => trend_icon_4.png} | 0 .../{TrendIcon5.png => trend_icon_5.png} | 0 ...pirituality.png => trend_spirituality.png} | 0 .../Time&Speed/{TimeX.png => time_x.png} | 0 .../Selected.png | 0 .../owniverse_item.gd} | 3 +- .../owniverse_item.gd.uid} | 0 .../owniverse_item.tscn} | 24 ++-- command_processor.gd | 2 +- export_presets.cfg | 10 +- project.godot | 10 +- world.tscn | 81 ++++++------ world/Background/starry_sky_layer.tscn | 4 +- world/entity.gd | 52 ++------ world/owniverse.gd | 42 +++++- world/owniverse_512.png | 3 + world/owniverse_splash_512.png | 3 + 44 files changed, 350 insertions(+), 312 deletions(-) rename Autoload/{locale.en.csv => locale.en.txt} (100%) rename Autoload/{locale.ru.csv => locale.ru.txt} (100%) rename Autoload/{owniverse_entitites.csv => owniverse_entitites.txt} (91%) delete mode 100644 Autoload/owniverse_items.csv create mode 100644 Autoload/owniverse_items.txt rename Autoload/{SaveManager.gd => save_manager.gd} (100%) rename Autoload/{SaveManager.gd.uid => save_manager.gd.uid} (100%) rename Autoload/{templates.en.csv => templates.en.txt} (100%) rename UI/Indicators/Aggression/{AggressionPointer.png => aggression_pointer.png} (100%) rename UI/Indicators/Burnability/{BurnabilityPointer.png => burnability_pointer.png} (100%) rename UI/Indicators/Density/{BorderWarning.png => border_warning.png} (100%) rename UI/Indicators/Density/{DensityCrunch.png => density_crunch.png} (100%) rename UI/Indicators/Density/{DensityPointer.png => density_pointer.png} (100%) rename UI/Indicators/Density/{DensityRip.png => density_rip.png} (100%) rename UI/Indicators/Trends/{TrendBar1.png => trend_bar1.png} (100%) rename UI/Indicators/Trends/{TrendBar2.png => trend_bar2.png} (100%) rename UI/Indicators/Trends/{TrendBar3.png => trend_bar3.png} (100%) rename UI/Indicators/Trends/{TrendBar4.png => trend_bar4.png} (100%) rename UI/Indicators/Trends/{TrendBar5.png => trend_bar5.png} (100%) rename UI/Indicators/Trends/{TrendBarEmpty.png => trend_bar_empty.png} (100%) rename UI/Indicators/Trends/{TrendIcon1.png => trend_icon_1.png} (100%) rename UI/Indicators/Trends/{TrendIcon2.png => trend_icon_2.png} (100%) rename UI/Indicators/Trends/{TrendIcon3.png => trend_icon_3.png} (100%) rename UI/Indicators/Trends/{TrendIcon4.png => trend_icon_4.png} (100%) rename UI/Indicators/Trends/{TrendIcon5.png => trend_icon_5.png} (100%) rename UI/Indicators/Trends/{TrendSpirituality.png => trend_spirituality.png} (100%) rename UI/TopMenu/Time&Speed/{TimeX.png => time_x.png} (100%) rename UI/{ItemButton => owniverse_item}/Selected.png (100%) rename UI/{ItemButton/item_button.gd => owniverse_item/owniverse_item.gd} (97%) rename UI/{ItemButton/item_button.gd.uid => owniverse_item/owniverse_item.gd.uid} (100%) rename UI/{ItemButton/item_button.tscn => owniverse_item/owniverse_item.tscn} (69%) create mode 100644 world/owniverse_512.png create mode 100644 world/owniverse_splash_512.png diff --git a/Autoload/Global.gd b/Autoload/Global.gd index edcd0ee..73706be 100644 --- a/Autoload/Global.gd +++ b/Autoload/Global.gd @@ -10,15 +10,6 @@ var Settings: Dictionary = { # TODO getter setter for locale -var Owniverse: Dictionary = { - "datetime": {}, - "sector": "", - "location": "", - "charsheet": {}, - "fleet": {}, - "inventory": {}, - } - var Locales: Dictionary = {} var Locale = "en" @@ -43,15 +34,15 @@ func get_description(item_id: String, items: Array = []) -> String: return description - func _ready() -> void: - OwniverseEntities = _read_from_csv("res://Autoload/owniverse_entitites.csv") - OwniverseItems = _read_from_csv("res://Autoload/owniverse_items.csv") + + OwniverseEntities = _read_from_csv("res://autoload/owniverse_entitites.txt") + OwniverseItems = _read_from_csv("res://autoload/owniverse_items.txt") - Locales["en"] = _read_from_csv("res://Autoload/locale.en.csv") - Locales["ru"] = _read_from_csv("res://Autoload/locale.ru.csv") + Locales["en"] = _read_from_csv("res://autoload/locale.en.txt") + Locales["ru"] = _read_from_csv("res://autoload/locale.ru.txt") - Templates["en"] = _read_from_csv("res://Autoload/templates.en.csv") + Templates["en"] = _read_from_csv("res://autoload/templates.en.txt") func _read_from_csv(file_path: String) -> Dictionary: @@ -97,6 +88,15 @@ func _read_from_csv(file_path: String) -> Dictionary: return dict_data + +func _read_folder_list(folder_name: String) -> void: + var dir := DirAccess.open(folder_name) + if dir == null: printerr("Could not open folder: ", folder_name); return + dir.list_dir_begin() + for file: String in dir.get_files(): + print(" → ", file) + + func _print_dict(dict_to_print: Dictionary): for d in dict_to_print: print(d, " → ", dict_to_print[d]) diff --git a/Autoload/locale.en.csv b/Autoload/locale.en.txt similarity index 100% rename from Autoload/locale.en.csv rename to Autoload/locale.en.txt diff --git a/Autoload/locale.ru.csv b/Autoload/locale.ru.txt similarity index 100% rename from Autoload/locale.ru.csv rename to Autoload/locale.ru.txt diff --git a/Autoload/owniverse_entitites.csv b/Autoload/owniverse_entitites.txt similarity index 91% rename from Autoload/owniverse_entitites.csv rename to Autoload/owniverse_entitites.txt index a3a0a9f..58aa70a 100644 --- a/Autoload/owniverse_entitites.csv +++ b/Autoload/owniverse_entitites.txt @@ -1,6 +1,6 @@ id|is_visible|unlock|cost|bind|mass|space|lifespan|auto|gamma|blast|life_product|voids|output|destroy_level|degradation|planets|count_as|group_as|event_group|space_bonus|civ_bonus|claim -S|1|start|||||||||||||||||S||| -H|1|start|||||||||||||||||H||| +S|1|prime|||||||||||||||||S||| +H|1|prime|||||||||||||||||H||| He|1|He:1|||||||||||||||||||| Met|1|Met:1|||||||||||||||||||| BD|1|BD:1|||||||||||||||||||| @@ -131,23 +131,23 @@ C4.2|1|C4.2:1|||||||||||||||C4||||| C4.3|1|C4.3:1|||||||||||||||C4||||| C4.4|1|C4.4:1|||||||||||||||C4||||| Ct|0||||||||||||||||||||| -FHYD|1|FHYD:1|||||||||||||||||||| -FTEM|1|FTEM:1|||||||||||||||||||| -FITE|1|FITE:1|||||||||||||||||||| -FSIN|1|FSIN:1|||||||||||||||||||| -FPRI|1|FPRI:1|||||||||||||||||||| -FSTE|1|FSTE:1|||||||||||||||||||| -FREN|1|FREN:1|||||||||||||||||||| -FINF|1|FINF:1|||||||||||||||||||| -FFRO|1|FFRO:1|||||||||||||||||||| -FDES|1|FDES:1|||||||||||||||||||| -FROC|1|FROC:1|||||||||||||||||||| -FPAN|1|FPAN:1|||||||||||||||||||| -FGAI|1|FGAI:1|||||||||||||||||||| -FDAR|1|FDAR:1|||||||||||||||||||| -FEDE|1|FEDE:1|||||||||||||||||||| -FPAC|1|FPAC:1|||||||||||||||||||| -FENR|1|FENR:1|||||||||||||||||||| -FMOR|1|FMOR:1|||||||||||||||||||| -FDIS|1|FDIS:1|||||||||||||||||||| -FREP|1|FREP:1|||||||||||||||||||| +fsho|1|fsho:1|||||||||||||||||||| +finf|1|finf:1|||||||||||||||||||| +ftem|1|ftem:1|||||||||||||||||||| +fcol|1|fcol:1|||||||||||||||||||| +fpri|1|fpri:1|||||||||||||||||||| +fsin|1|fsin:1|||||||||||||||||||| +fren|1|fren:1|||||||||||||||||||| +finf|1|finf:1|||||||||||||||||||| +ffro|1|ffro:1|||||||||||||||||||| +fdes|1|fdes:1|||||||||||||||||||| +froc|1|froc:1|||||||||||||||||||| +fpan|1|fpan:1|||||||||||||||||||| +fgai|1|fgai:1|||||||||||||||||||| +fdar|1|fdar:1|||||||||||||||||||| +fede|1|fede:1|||||||||||||||||||| +fpac|1|fpac:1|||||||||||||||||||| +fenr|1|fenr:1|||||||||||||||||||| +fmor|1|fmor:1|||||||||||||||||||| +fdis|1|fdis:1|||||||||||||||||||| +frep|1|frep:1|||||||||||||||||||| \ No newline at end of file diff --git a/Autoload/owniverse_items.csv b/Autoload/owniverse_items.csv deleted file mode 100644 index ff8bb07..0000000 --- a/Autoload/owniverse_items.csv +++ /dev/null @@ -1,125 +0,0 @@ -id|name|image|page|row|col|sub_page -Shovelin|Shovelin|UI/0-Forces/|0|0|0| -Inflatin|Inflatin|UI/0-Forces/|0|0|1| -Temporite|Temporite|UI/0-Forces/|0|0|2| -Collisite|Collisite|UI/0-Forces/|0|0|3| -Primex|Primex|UI/0-Forces/|0|0|4| -Singularite|Singularite|UI/0-Forces/|0|1|0| -Renewin|Renewin|UI/0-Forces/|0|1|1| -Infusite|Infusite|UI/0-Forces/|0|1|2| -Frostin|Frostin|UI/0-Forces/|0|1|3| -Destellarite|Destellarite|UI/0-Forces/|0|1|4| -Rockex|Rockex|UI/0-Forces/|0|2|0| -Panspermin|Panspermin|UI/0-Forces/|0|2|1| -Gaianite|Gaianite|UI/0-Forces/|0|2|2| -Darwinite|Darwinite|UI/0-Forces/|0|2|3| -Edenex|Edenex|UI/0-Forces/|0|2|4| -Pacifin|Pacifin|UI/0-Forces/|0|3|0| -Enragein|Enragein|UI/0-Forces/|0|3|1| -Moralite|Moralite|UI/0-Forces/|0|3|2| -Discriminite|Discriminite|UI/0-Forces/|0|3|3| -Reprex|Reprex|UI/0-Forces/|0|3|4| -S|Space|UI/1-Resources/|1|0|0| -H|Hydrogen|UI/1-Resources/|1|1|0| -He|Helium|UI/1-Resources/|1|2|0| -Met|Metal|UI/1-Resources/|1|3|0| -N|Nebula|UI/2-Stars/|2|0|0| -G|Globula|UI/2-Stars/|2|0|1| -STN|StarNursery|UI/2-Stars/|2|0|2| -MC|MolecularCloud|UI/2-Stars/|2|0|3| -ASTN|ActiveStarNursery|UI/2-Stars/|2|0|4| -BD|BrownDwarf|UI/2-Stars/|2|1|0| -RD|RedDwarf|UI/2-Stars/|2|1|1| -OD|OrangeDwarf|UI/2-Stars/|2|1|2| -YD|YellowDwarf|UI/2-Stars/|2|1|3| -WYD|WhiteYellowDwarf|UI/2-Stars/|2|1|4| -RG|RedGiant|UI/2-Stars/|2|2|0| -WS|WhiteStar|UI/2-Stars/|2|2|1| -BG|BlueGiant|UI/2-Stars/|2|2|2| -SG|Supergiant|UI/2-Stars/|2|2|3| -HG|Hypergiant|UI/2-Stars/|2|2|4| -WD|WhiteDwarf|UI/2-Stars/|2|3|0| -NS|NeutronStar|UI/2-Stars/|2|3|1| -MGT|Magnetar|UI/2-Stars/|2|3|2| -BH|BlackHole|UI/2-Stars/|2|3|3| -SMBH|SupermassiveBlackHole|UI/2-Stars/|2|3|4| -SCD|StarClusterScattered|UI/3-Structures/|3|0|0| -SCS|StarClusterSmall|UI/3-Structures/|3|0|1| -SCM|StarClusterMedium|UI/3-Structures/|3|0|2| -SCL|StarClusterLarge|UI/3-Structures/|3|0|3| -SCG|StarClusterGiant|UI/3-Structures/|3|0|4| -GED|GalaxyEllipticalDwarf|UI/3-Structures/|3|1|0| -GES|GalaxyEllipticalSmall|UI/3-Structures/|3|1|1| -GEM|GalaxyEllipticalMedium|UI/3-Structures/|3|1|2| -GEL|GalaxyEllipticalLarge|UI/3-Structures/|3|1|3| -GEG|GalaxyEllipticalGiant|UI/3-Structures/|3|1|4| -GSD|GalaxySpiralDwarf|UI/3-Structures/|3|2|0| -GSS|GalaxySpiralSmall|UI/3-Structures/|3|2|1| -GSM|GalaxySpiralMedium|UI/3-Structures/|3|2|2| -GSL|GalaxySpiralLarge|UI/3-Structures/|3|2|3| -GSG|GalaxySpiralGiant|UI/3-Structures/|3|2|4| -LGG|GalacticGroup|UI/3-Structures/|3|3|0| -LSC|GalacticSupercluster|UI/3-Structures/|3|3|1| -LGF|GalacticFilament|UI/3-Structures/|3|3|2| -LGW|GalacticWall|UI/3-Structures/|3|3|3| -LUB|UniverseBubble|UI/3-Structures/|3|3|4| -GG|GasGiant|UI/4-Life/|4|0|0| -AB|AsteroidBelt|UI/4-Life/|4|0|1| -RP|RockyPlanet|UI/4-Life/|4|0|2| -HP|HabitablePlanet|UI/4-Life/|4|0|3| -LP|LivingPlanet|UI/4-Life/|4|0|4|5 -C0|Civ0|UI/4-Life/|4|1|0|6 -C1|Civ1|UI/4-Life/|4|1|1|7 -C2|Civ2|UI/4-Life/|4|1|2|8 -C3|Civ3|UI/4-Life/|4|1|3|9 -C4|Civ4|UI/4-Life/|4|1|4|10 -EON1|Archean|UI/4-Life/Living/|5|0|0| -EON2|Proterozoic|UI/4-Life/Living/|5|0|1| -EON3|Paleozoic|UI/4-Life/Living/|5|0|2| -EON4|Mezozoic|UI/4-Life/Living/|5|0|3| -EON5|Cenozoic|UI/4-Life/Living/|5|0|4| -C0.0|Civ0.0|UI/4-Life/Civ0/|6|0|0| -C0.1|Civ0.1|UI/4-Life/Civ0/|6|0|1| -C0.2|Civ0.2|UI/4-Life/Civ0/|6|0|2| -C0.3|Civ0.3|UI/4-Life/Civ0/|6|0|3| -C0.4|Civ0.4|UI/4-Life/Civ0/|6|0|4| -C0.5|Civ0.5|UI/4-Life/Civ0/|6|1|0| -C0.6|Civ0.6|UI/4-Life/Civ0/|6|1|1| -C0.7|Civ0.7|UI/4-Life/Civ0/|6|1|2| -C0.8|Civ0.8|UI/4-Life/Civ0/|6|1|3| -C0.9|Civ0.9|UI/4-Life/Civ0/|6|1|4| -C1.0|Civ1.0|UI/4-Life/Civ1/|7|0|0| -C1.1|Civ1.1|UI/4-Life/Civ1/|7|0|1| -C1.2|Civ1.2|UI/4-Life/Civ1/|7|0|2| -C1.3|Civ1.3|UI/4-Life/Civ1/|7|0|3| -C1.4|Civ1.4|UI/4-Life/Civ1/|7|0|4| -C1.5|Civ1.5|UI/4-Life/Civ1/|7|1|0| -C1.6|Civ1.6|UI/4-Life/Civ1/|7|1|1| -C1.7|Civ1.7|UI/4-Life/Civ1/|7|1|2| -C1.8|Civ1.8|UI/4-Life/Civ1/|7|1|3| -C1.9|Civ1.9|UI/4-Life/Civ1/|7|1|4| -C2.0|Civ2.0|UI/4-Life/Civ2/|8|0|0| -C2.1|Civ2.1|UI/4-Life/Civ2/|8|0|1| -C2.2|Civ2.2|UI/4-Life/Civ2/|8|0|2| -C2.3|Civ2.3|UI/4-Life/Civ2/|8|0|3| -C2.4|Civ2.4|UI/4-Life/Civ2/|8|0|4| -C2.5|Civ2.5|UI/4-Life/Civ2/|8|1|0| -C2.6|Civ2.6|UI/4-Life/Civ2/|8|1|1| -C2.7|Civ2.7|UI/4-Life/Civ2/|8|1|2| -C2.8|Civ2.8|UI/4-Life/Civ2/|8|1|3| -C2.9|Civ2.9|UI/4-Life/Civ2/|8|1|4| -C3.0|Civ3.0|UI/4-Life/Civ3/|9|0|0| -C3.1|Civ3.1|UI/4-Life/Civ3/|9|0|1| -C3.2|Civ3.2|UI/4-Life/Civ3/|9|0|2| -C3.3|Civ3.3|UI/4-Life/Civ3/|9|0|3| -C3.4|Civ3.4|UI/4-Life/Civ3/|9|0|4| -C3.5|Civ3.5|UI/4-Life/Civ3/|9|1|0| -C3.6|Civ3.6|UI/4-Life/Civ3/|9|1|1| -C3.7|Civ3.7|UI/4-Life/Civ3/|9|1|2| -C3.8|Civ3.8|UI/4-Life/Civ3/|9|1|3| -C3.9|Civ3.9|UI/4-Life/Civ3/|9|1|4| -C4.0|Civ4.0|UI/4-Life/Civ4/|10|0|0| -C4.1|Civ4.1|UI/4-Life/Civ4/|10|0|1| -C4.2|Civ4.2|UI/4-Life/Civ4/|10|0|2| -C4.3|Civ4.3|UI/4-Life/Civ4/|10|0|3| -C4.4|Civ4.4|UI/4-Life/Civ4/|10|0|4| diff --git a/Autoload/owniverse_items.txt b/Autoload/owniverse_items.txt new file mode 100644 index 0000000..2ab54df --- /dev/null +++ b/Autoload/owniverse_items.txt @@ -0,0 +1,125 @@ +id|name|image|page|row|col|sub_page +fsho|Shovelin|ui/0-forces/|0|0|0| +finf|Inflatin|ui/0-forces/|0|0|1| +ftem|Temporite|ui/0-forces/|0|0|2| +fcol|Collisite|ui/0-forces/|0|0|3| +fpri|Primex|ui/0-forces/|0|0|4| +fsin|Singularite|ui/0-forces/|0|1|0| +fren|Renewin|ui/0-forces/|0|1|1| +finf|Infusite|ui/0-forces/|0|1|2| +ffro|Frostin|ui/0-forces/|0|1|3| +fdes|Destellarite|ui/0-forces/|0|1|4| +froc|Rockex|ui/0-forces/|0|2|0| +fpan|Panspermin|ui/0-forces/|0|2|1| +fgai|Gaianite|ui/0-forces/|0|2|2| +fdar|Darwinite|ui/0-forces/|0|2|3| +fede|Edenex|ui/0-forces/|0|2|4| +fpac|Pacifin|ui/0-forces/|0|3|0| +fenr|Enragein|ui/0-forces/|0|3|1| +fmor|Moralite|ui/0-forces/|0|3|2| +fdis|Discriminite|ui/0-forces/|0|3|3| +frep|Reprex|ui/0-forces/|0|3|4| +S|Space|ui/1-resources/|1|0|0| +H|Hydrogen|ui/1-resources/|1|1|0| +He|Helium|ui/1-resources/|1|2|0| +Met|Metal|ui/1-resources/|1|3|0| +N|Nebula|ui/2-stars/|2|0|0| +G|Globula|ui/2-stars/|2|0|1| +STN|StarNursery|ui/2-stars/|2|0|2| +MC|MolecularCloud|ui/2-stars/|2|0|3| +ASTN|ActiveStarNursery|ui/2-stars/|2|0|4| +BD|BrownDwarf|ui/2-stars/|2|1|0| +RD|RedDwarf|ui/2-stars/|2|1|1| +OD|OrangeDwarf|ui/2-stars/|2|1|2| +YD|YellowDwarf|ui/2-stars/|2|1|3| +WYD|WhiteYellowDwarf|ui/2-stars/|2|1|4| +RG|RedGiant|ui/2-stars/|2|2|0| +WS|WhiteStar|ui/2-stars/|2|2|1| +BG|BlueGiant|ui/2-stars/|2|2|2| +SG|Supergiant|ui/2-stars/|2|2|3| +HG|Hypergiant|ui/2-stars/|2|2|4| +WD|WhiteDwarf|ui/2-stars/|2|3|0| +NS|NeutronStar|ui/2-stars/|2|3|1| +MGT|Magnetar|ui/2-stars/|2|3|2| +BH|BlackHole|ui/2-stars/|2|3|3| +SMBH|SupermassiveBlackHole|ui/2-stars/|2|3|4| +SCD|StarClusterScattered|ui/3-structures/|3|0|0| +SCS|StarClusterSmall|ui/3-structures/|3|0|1| +SCM|StarClusterMedium|ui/3-structures/|3|0|2| +SCL|StarClusterLarge|ui/3-structures/|3|0|3| +SCG|StarClusterGiant|ui/3-structures/|3|0|4| +GED|GalaxyEllipticalDwarf|ui/3-structures/|3|1|0| +GES|GalaxyEllipticalSmall|ui/3-structures/|3|1|1| +GEM|GalaxyEllipticalMedium|ui/3-structures/|3|1|2| +GEL|GalaxyEllipticalLarge|ui/3-structures/|3|1|3| +GEG|GalaxyEllipticalGiant|ui/3-structures/|3|1|4| +GSD|GalaxySpiralDwarf|ui/3-structures/|3|2|0| +GSS|GalaxySpiralSmall|ui/3-structures/|3|2|1| +GSM|GalaxySpiralMedium|ui/3-structures/|3|2|2| +GSL|GalaxySpiralLarge|ui/3-structures/|3|2|3| +GSG|GalaxySpiralGiant|ui/3-structures/|3|2|4| +LGG|GalacticGroup|ui/3-structures/|3|3|0| +LSC|GalacticSupercluster|ui/3-structures/|3|3|1| +LGF|GalacticFilament|ui/3-structures/|3|3|2| +LGW|GalacticWall|ui/3-structures/|3|3|3| +LUB|UniverseBubble|ui/3-structures/|3|3|4| +GG|GasGiant|ui/4-life/|4|0|0| +AB|AsteroidBelt|ui/4-life/|4|0|1| +RP|RockyPlanet|ui/4-life/|4|0|2| +HP|HabitablePlanet|ui/4-life/|4|0|3| +LP|LivingPlanet|ui/4-life/|4|0|4|5 +C0|Civ0|ui/4-life/|4|1|0|6 +C1|Civ1|ui/4-life/|4|1|1|7 +C2|Civ2|ui/4-life/|4|1|2|8 +C3|Civ3|ui/4-life/|4|1|3|9 +C4|Civ4|ui/4-life/|4|1|4|10 +EON1|Archean|ui/4-life/living/|5|0|0| +EON2|Proterozoic|ui/4-life/living/|5|0|1| +EON3|Paleozoic|ui/4-life/living/|5|0|2| +EON4|Mezozoic|ui/4-life/living/|5|0|3| +EON5|Cenozoic|ui/4-life/living/|5|0|4| +C0.0|Civ0.0|ui/4-life/civ0/|6|0|0| +C0.1|Civ0.1|ui/4-life/civ0/|6|0|1| +C0.2|Civ0.2|ui/4-life/civ0/|6|0|2| +C0.3|Civ0.3|ui/4-life/civ0/|6|0|3| +C0.4|Civ0.4|ui/4-life/civ0/|6|0|4| +C0.5|Civ0.5|ui/4-life/civ0/|6|1|0| +C0.6|Civ0.6|ui/4-life/civ0/|6|1|1| +C0.7|Civ0.7|ui/4-life/civ0/|6|1|2| +C0.8|Civ0.8|ui/4-life/civ0/|6|1|3| +C0.9|Civ0.9|ui/4-life/civ0/|6|1|4| +C1.0|Civ1.0|ui/4-life/civ1/|7|0|0| +C1.1|Civ1.1|ui/4-life/civ1/|7|0|1| +C1.2|Civ1.2|ui/4-life/civ1/|7|0|2| +C1.3|Civ1.3|ui/4-life/civ1/|7|0|3| +C1.4|Civ1.4|ui/4-life/civ1/|7|0|4| +C1.5|Civ1.5|ui/4-life/civ1/|7|1|0| +C1.6|Civ1.6|ui/4-life/civ1/|7|1|1| +C1.7|Civ1.7|ui/4-life/civ1/|7|1|2| +C1.8|Civ1.8|ui/4-life/civ1/|7|1|3| +C1.9|Civ1.9|ui/4-life/civ1/|7|1|4| +C2.0|Civ2.0|ui/4-life/civ2/|8|0|0| +C2.1|Civ2.1|ui/4-life/civ2/|8|0|1| +C2.2|Civ2.2|ui/4-life/civ2/|8|0|2| +C2.3|Civ2.3|ui/4-life/civ2/|8|0|3| +C2.4|Civ2.4|ui/4-life/civ2/|8|0|4| +C2.5|Civ2.5|ui/4-life/civ2/|8|1|0| +C2.6|Civ2.6|ui/4-life/civ2/|8|1|1| +C2.7|Civ2.7|ui/4-life/civ2/|8|1|2| +C2.8|Civ2.8|ui/4-life/civ2/|8|1|3| +C2.9|Civ2.9|ui/4-life/civ2/|8|1|4| +C3.0|Civ3.0|ui/4-life/civ3/|9|0|0| +C3.1|Civ3.1|ui/4-life/civ3/|9|0|1| +C3.2|Civ3.2|ui/4-life/civ3/|9|0|2| +C3.3|Civ3.3|ui/4-life/civ3/|9|0|3| +C3.4|Civ3.4|ui/4-life/civ3/|9|0|4| +C3.5|Civ3.5|ui/4-life/civ3/|9|1|0| +C3.6|Civ3.6|ui/4-life/civ3/|9|1|1| +C3.7|Civ3.7|ui/4-life/civ3/|9|1|2| +C3.8|Civ3.8|ui/4-life/civ3/|9|1|3| +C3.9|Civ3.9|ui/4-life/civ3/|9|1|4| +C4.0|Civ4.0|ui/4-life/civ4/|10|0|0| +C4.1|Civ4.1|ui/4-life/civ4/|10|0|1| +C4.2|Civ4.2|ui/4-life/civ4/|10|0|2| +C4.3|Civ4.3|ui/4-life/civ4/|10|0|3| +C4.4|Civ4.4|ui/4-life/civ4/|10|0|4| \ No newline at end of file diff --git a/Autoload/SaveManager.gd b/Autoload/save_manager.gd similarity index 100% rename from Autoload/SaveManager.gd rename to Autoload/save_manager.gd diff --git a/Autoload/SaveManager.gd.uid b/Autoload/save_manager.gd.uid similarity index 100% rename from Autoload/SaveManager.gd.uid rename to Autoload/save_manager.gd.uid diff --git a/Autoload/templates.en.csv b/Autoload/templates.en.txt similarity index 100% rename from Autoload/templates.en.csv rename to Autoload/templates.en.txt diff --git a/Stage/stage.gd b/Stage/stage.gd index ed9744e..c0783df 100644 --- a/Stage/stage.gd +++ b/Stage/stage.gd @@ -1,14 +1,15 @@ extends Control -const ITEM_BUTTON = preload("uid://d3xjfxwe3w16v") +signal produce_items(item_id: String, amount: int) + +const OWNIVERSE_ITEM = preload("uid://d3xjfxwe3w16v") const SPEED_TEXTURE_NAME_TEMPLATE = "res://UI/TopMenu/Time&Speed/Time%s.png" const PAGE_COUNT = 5 const PAGE_WIDTH = 1080 const DRAG_TOLERANCE = 360 -const SWIPE_DURATION: float = 2 -const SWIPE_DELAY = 2000 # msec +const SWIPE_DURATION: float = 0.4 @onready var stage_page_scroller: ScrollContainer = $StageRows/PageScroller @@ -65,23 +66,44 @@ var g_counters: Dictionary[String, Counter] = { "swipe": Counter.new(), } -var ActiveItems: Dictionary = {} +var g_active_items: Dictionary = {} + +var owniverse:Owniverse = Owniverse.new() +var owniverse_items: Dictionary[String, OwniverseItem] = {} +var locked_items:Dictionary = {} + +var item_list_to_update: Dictionary = {} -var owniverse = Owniverse.new() func set_datetime(value: String): date_time.text = value +#region Item manipulations: update and visibility + + +func add_to_update_list(item_id: String, amount: int) -> void: + if item_list_to_update.has(item_id): + item_list_to_update[item_id] += amount + else: + item_list_to_update[item_id] = amount + + +func set_owniverse_item_value() -> void: + for item_id in owniverse.items_to_update: + var item:OwniverseItem = owniverse_items[item_id] + item.description.text = str(roundi(owniverse.items_to_update[item_id])) + owniverse.items_to_update = {} + + +func unlock_owniverse_item() -> void: + pass + +#endregion func _on_indicator_pressed(indicator_name: String, page: int = 0): _set_description(indicator_name, page) -func item_selected(item: OwniverseItem) -> void: - _control_page(item) - _set_item_description(item) - - func _set_item_description(item: OwniverseItem) -> void: var description: String = "[b]" \ + Global.get_localized_item_description(item.item_name, "label") \ @@ -100,14 +122,15 @@ func _set_description(item_name: String, page: int) -> void: func _control_page(item: OwniverseItem) -> void: - if !ActiveItems.has(item.item_page): - ActiveItems[item.item_page] = null + # TODO переписать это ↓ + if !g_active_items.has(item.item_page): + g_active_items[item.item_page] = null - var current_item: OwniverseItem = ActiveItems[item.item_page] + var current_item: OwniverseItem = g_active_items[item.item_page] if current_item == item: return - ActiveItems[item.item_page] = item + g_active_items[item.item_page] = item if current_item != null and current_item.item_page == item.item_page: current_item.set_selection(false) @@ -125,21 +148,35 @@ func _control_page(item: OwniverseItem) -> void: item_pages[current_item.item_sub_page].visible = false -func _init_items() -> bool: - +func _init_owniverse_items() -> bool: + owniverse_items = {} for item_id in Global.OwniverseItems: var item_props: Dictionary = Global.OwniverseItems[item_id] - var item: OwniverseItem = ITEM_BUTTON.instantiate() + var item: OwniverseItem = OWNIVERSE_ITEM.instantiate() if !item_props.has("page"): printerr("Item `", item_id, "` has no `page` key.") return false var page: int = int(item_props.page) item_pages[page].add_child(item) item.init_button(item_props) - item.item_activated.connect(item_selected) + item.item_activated.connect(item_activated) + + if owniverse.entities.has(item_id): + item.visible = owniverse.entities[item_id].is_unlocked + + owniverse_items[item_id] = item return false + + +func item_activated(item: OwniverseItem) -> void: + _control_page(item) + _set_item_description(item) + print(item.item_id) + if item.item_id == "S" or item.item_id == "H": + owniverse.produce(item.item_id, 1) + func _check_counters(delta: float) -> Array: var actions: Array = [] @@ -165,8 +202,6 @@ func _do_actions(actions: Array) -> void: #region Swipe - - func _swipe_to_nearest_page() -> void: if stage_page_scroller.scroll_horizontal % PAGE_WIDTH == 0: return @@ -198,7 +233,9 @@ func _input(event: InputEvent) -> void: func _ready() -> void: owniverse.init_enitities() - _init_items() + _init_owniverse_items() + + g_counters.swipe.sec = 0.2 func _process(delta: float) -> void: @@ -210,15 +247,6 @@ func _process(delta: float) -> void: _do_actions(actions) -func _on_burger_button_pressed() -> void: - print("b") - pass # Replace with function body. - - -func _on_report_button_pressed() -> void: - print("r") - pass # Replace with function body. - func _change_speed(delta: int) -> void: var speed: int = owniverse.change_speed(delta) var ind: int = 1 @@ -237,6 +265,7 @@ func _change_speed(delta: int) -> void: else: g_time_minus.texture_normal = load(SPEED_TEXTURE_NAME_TEMPLATE % str(speed - 1)) g_time_plus.texture_normal = load(SPEED_TEXTURE_NAME_TEMPLATE % str(speed + 1)) - + + func _on_topmenu_button_pressed(ButtonName) -> void: print(ButtonName) diff --git a/Tools/Counter.gd b/Tools/Counter.gd index d844c9d..9ab5915 100644 --- a/Tools/Counter.gd +++ b/Tools/Counter.gd @@ -2,15 +2,9 @@ class_name Counter extends RefCounted var is_active: bool = false - var sec: float = 1 var value: float = 0 -#func set_inactive() -> void: - #is_active = false -# -#func set_active() -> void: - #is_active = true func is_reached() -> bool: if value >= sec: @@ -24,6 +18,3 @@ func add_delta(delta: float) -> void: func debug() -> void: print(is_active, " | ", value, " of ", sec) - -#func _init(): - diff --git a/UI/Border/border.tscn b/UI/Border/border.tscn index a3ae800..2d1c57f 100644 --- a/UI/Border/border.tscn +++ b/UI/Border/border.tscn @@ -1,6 +1,6 @@ -[gd_scene load_steps=2 format=3 uid="uid://dg15dpxiepicb"] +[gd_scene format=3 uid="uid://dg15dpxiepicb"] -[ext_resource type="Texture2D" uid="uid://chxxghyul1im7" path="res://UI/Border/border-2px.png" id="1_6kaf8"] +[ext_resource type="Texture2D" uid="uid://chxxghyul1im7" path="res://ui/border/border-2px.png" id="1_6kaf8"] [node name="Border" type="TextureRect"] texture = ExtResource("1_6kaf8") diff --git a/UI/Indicators/Aggression/AggressionPointer.png b/UI/Indicators/Aggression/aggression_pointer.png similarity index 100% rename from UI/Indicators/Aggression/AggressionPointer.png rename to UI/Indicators/Aggression/aggression_pointer.png diff --git a/UI/Indicators/Burnability/BurnabilityPointer.png b/UI/Indicators/Burnability/burnability_pointer.png similarity index 100% rename from UI/Indicators/Burnability/BurnabilityPointer.png rename to UI/Indicators/Burnability/burnability_pointer.png diff --git a/UI/Indicators/Density/BorderWarning.png b/UI/Indicators/Density/border_warning.png similarity index 100% rename from UI/Indicators/Density/BorderWarning.png rename to UI/Indicators/Density/border_warning.png diff --git a/UI/Indicators/Density/DensityCrunch.png b/UI/Indicators/Density/density_crunch.png similarity index 100% rename from UI/Indicators/Density/DensityCrunch.png rename to UI/Indicators/Density/density_crunch.png diff --git a/UI/Indicators/Density/DensityPointer.png b/UI/Indicators/Density/density_pointer.png similarity index 100% rename from UI/Indicators/Density/DensityPointer.png rename to UI/Indicators/Density/density_pointer.png diff --git a/UI/Indicators/Density/DensityRip.png b/UI/Indicators/Density/density_rip.png similarity index 100% rename from UI/Indicators/Density/DensityRip.png rename to UI/Indicators/Density/density_rip.png diff --git a/UI/Indicators/Trends/TrendBar1.png b/UI/Indicators/Trends/trend_bar1.png similarity index 100% rename from UI/Indicators/Trends/TrendBar1.png rename to UI/Indicators/Trends/trend_bar1.png diff --git a/UI/Indicators/Trends/TrendBar2.png b/UI/Indicators/Trends/trend_bar2.png similarity index 100% rename from UI/Indicators/Trends/TrendBar2.png rename to UI/Indicators/Trends/trend_bar2.png diff --git a/UI/Indicators/Trends/TrendBar3.png b/UI/Indicators/Trends/trend_bar3.png similarity index 100% rename from UI/Indicators/Trends/TrendBar3.png rename to UI/Indicators/Trends/trend_bar3.png diff --git a/UI/Indicators/Trends/TrendBar4.png b/UI/Indicators/Trends/trend_bar4.png similarity index 100% rename from UI/Indicators/Trends/TrendBar4.png rename to UI/Indicators/Trends/trend_bar4.png diff --git a/UI/Indicators/Trends/TrendBar5.png b/UI/Indicators/Trends/trend_bar5.png similarity index 100% rename from UI/Indicators/Trends/TrendBar5.png rename to UI/Indicators/Trends/trend_bar5.png diff --git a/UI/Indicators/Trends/TrendBarEmpty.png b/UI/Indicators/Trends/trend_bar_empty.png similarity index 100% rename from UI/Indicators/Trends/TrendBarEmpty.png rename to UI/Indicators/Trends/trend_bar_empty.png diff --git a/UI/Indicators/Trends/TrendIcon1.png b/UI/Indicators/Trends/trend_icon_1.png similarity index 100% rename from UI/Indicators/Trends/TrendIcon1.png rename to UI/Indicators/Trends/trend_icon_1.png diff --git a/UI/Indicators/Trends/TrendIcon2.png b/UI/Indicators/Trends/trend_icon_2.png similarity index 100% rename from UI/Indicators/Trends/TrendIcon2.png rename to UI/Indicators/Trends/trend_icon_2.png diff --git a/UI/Indicators/Trends/TrendIcon3.png b/UI/Indicators/Trends/trend_icon_3.png similarity index 100% rename from UI/Indicators/Trends/TrendIcon3.png rename to UI/Indicators/Trends/trend_icon_3.png diff --git a/UI/Indicators/Trends/TrendIcon4.png b/UI/Indicators/Trends/trend_icon_4.png similarity index 100% rename from UI/Indicators/Trends/TrendIcon4.png rename to UI/Indicators/Trends/trend_icon_4.png diff --git a/UI/Indicators/Trends/TrendIcon5.png b/UI/Indicators/Trends/trend_icon_5.png similarity index 100% rename from UI/Indicators/Trends/TrendIcon5.png rename to UI/Indicators/Trends/trend_icon_5.png diff --git a/UI/Indicators/Trends/TrendSpirituality.png b/UI/Indicators/Trends/trend_spirituality.png similarity index 100% rename from UI/Indicators/Trends/TrendSpirituality.png rename to UI/Indicators/Trends/trend_spirituality.png diff --git a/UI/TopMenu/Time&Speed/TimeX.png b/UI/TopMenu/Time&Speed/time_x.png similarity index 100% rename from UI/TopMenu/Time&Speed/TimeX.png rename to UI/TopMenu/Time&Speed/time_x.png diff --git a/UI/ItemButton/Selected.png b/UI/owniverse_item/Selected.png similarity index 100% rename from UI/ItemButton/Selected.png rename to UI/owniverse_item/Selected.png diff --git a/UI/ItemButton/item_button.gd b/UI/owniverse_item/owniverse_item.gd similarity index 97% rename from UI/ItemButton/item_button.gd rename to UI/owniverse_item/owniverse_item.gd index e9fc1e5..af679c3 100644 --- a/UI/ItemButton/item_button.gd +++ b/UI/owniverse_item/owniverse_item.gd @@ -11,10 +11,12 @@ const ENTITY_HEIGHT = 256 @onready var description: Label = $Description @onready var selection: TextureRect = $Selection + var item_id: String = "" var item_name: String = "" var item_page: int = -1 var item_sub_page: int = -1 +var item_type = "" func set_selection(flag: bool) -> void: @@ -30,7 +32,6 @@ func init_button(properties: Dictionary): item_page = int(properties.page) item_sub_page = int(properties.sub_page) name = properties.id - set_selection(false) func _on_button_up() -> void: diff --git a/UI/ItemButton/item_button.gd.uid b/UI/owniverse_item/owniverse_item.gd.uid similarity index 100% rename from UI/ItemButton/item_button.gd.uid rename to UI/owniverse_item/owniverse_item.gd.uid diff --git a/UI/ItemButton/item_button.tscn b/UI/owniverse_item/owniverse_item.tscn similarity index 69% rename from UI/ItemButton/item_button.tscn rename to UI/owniverse_item/owniverse_item.tscn index 5540112..92cb83a 100644 --- a/UI/ItemButton/item_button.tscn +++ b/UI/owniverse_item/owniverse_item.tscn @@ -1,15 +1,25 @@ [gd_scene format=3 uid="uid://d3xjfxwe3w16v"] -[ext_resource type="Script" uid="uid://bxxllddlgurus" path="res://UI/ItemButton/item_button.gd" id="1_e6ro1"] -[ext_resource type="Texture2D" uid="uid://56w57w6iu3np" path="res://UI/ItemButton/Selected.png" id="2_eurq3"] +[ext_resource type="Script" uid="uid://bxxllddlgurus" path="res://ui/owniverse_item/owniverse_item.gd" id="1_e6ro1"] +[ext_resource type="Texture2D" uid="uid://56w57w6iu3np" path="res://ui/owniverse_item/Selected.png" id="2_eurq3"] [node name="Button" type="Control" unique_id=667620208] +visible = false layout_mode = 3 anchors_preset = 0 offset_right = 216.0 offset_bottom = 260.0 +mouse_filter = 1 script = ExtResource("1_e6ro1") +[node name="Selection" type="TextureRect" parent="." unique_id=674793134] +visible = false +layout_mode = 0 +offset_right = 216.0 +offset_bottom = 216.0 +mouse_filter = 2 +texture = ExtResource("2_eurq3") + [node name="TextureButton" type="TextureButton" parent="." unique_id=1377839155] custom_minimum_size = Vector2(216, 216) layout_mode = 0 @@ -22,11 +32,7 @@ layout_mode = 0 offset_top = 220.0 offset_right = 216.0 offset_bottom = 260.0 +theme_override_font_sizes/font_size = 31 +horizontal_alignment = 1 -[node name="Selection" type="TextureRect" parent="." unique_id=674793134] -layout_mode = 0 -offset_right = 40.0 -offset_bottom = 40.0 -texture = ExtResource("2_eurq3") - -[connection signal="button_up" from="TextureButton" to="." method="_on_button_up"] +[connection signal="pressed" from="TextureButton" to="." method="_on_button_up"] diff --git a/command_processor.gd b/command_processor.gd index 7541e13..ef9e5c7 100644 --- a/command_processor.gd +++ b/command_processor.gd @@ -2,4 +2,4 @@ extends Node func print_smth(smth: String): pass - #print(smth) + print(smth) diff --git a/export_presets.cfg b/export_presets.cfg index f56a813..d3cd0d8 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -8,7 +8,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../Documents/Owad/Owniverse.I/Builds/owniverse.0.6.7.exe" +export_path="../../Documents/Owad/Owniverse.I/Builds/owniverse.0.6.9-125.exe" patches=PackedStringArray() patch_delta_encoding=false patch_delta_compression_level_zstd=19 @@ -74,13 +74,13 @@ Remove-Item -Recurse -Force '{temp_dir}'" name="Android" platform="Android" -runnable=false +runnable=true dedicated_server=false custom_features="" export_filter="all_resources" -include_filter="" +include_filter="res://autoload/*.*, *.gd, *.tscn, *.tres, *.json, *.txt, *.png, res://autoload/entitites.txt" exclude_filter="" -export_path="../../Documents/Owad/Owniverse.I/Builds/owniverse.0.6.8-124.aab" +export_path="../../Documents/Owad/Owniverse.I/Builds/owniverse.0.6.9-125.aab" patches=PackedStringArray() patch_delta_encoding=false patch_delta_compression_level_zstd=19 @@ -110,7 +110,7 @@ architectures/armeabi-v7a=false architectures/arm64-v8a=true architectures/x86=false architectures/x86_64=false -version/code=123 +version/code=126 version/name="" package/unique_name="com.KIDGameProduction.Owniverse" package/name="Owniverse" diff --git a/project.godot b/project.godot index 044bae7..36665cc 100644 --- a/project.godot +++ b/project.godot @@ -15,15 +15,17 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true [application] config/name="Owniverse" -config/version="0.6.7" +config/version="0.6.10" run/main_scene="uid://bv384dpmvjv8o" config/features=PackedStringArray("4.6", "Mobile") -config/icon="res://icon.svg" +boot_splash/show_image=false +boot_splash/stretch_mode=0 +config/icon="uid://do5teb1i7uiuw" [autoload] -Global="*res://Autoload/Global.gd" -SaveManager="*res://Autoload/SaveManager.gd" +Global="*uid://5xb12usvrifm" +SaveManager="*uid://ul0srjc4gcgg" [display] diff --git a/world.tscn b/world.tscn index 3f4b111..7e19a77 100644 --- a/world.tscn +++ b/world.tscn @@ -1,47 +1,47 @@ [gd_scene format=3 uid="uid://bv384dpmvjv8o"] -[ext_resource type="Script" uid="uid://d2wrwichuoncd" path="res://World/Background/background.gd" id="1_fj7yv"] -[ext_resource type="PackedScene" uid="uid://icbk3la71t7h" path="res://World/Background/starry_sky_layer.tscn" id="3_aqk2v"] -[ext_resource type="Script" uid="uid://iiva6x8uo0f2" path="res://Stage/stage.gd" id="3_bh8nc"] -[ext_resource type="Texture2D" uid="uid://5f80g4i46ycl" path="res://UI/TopMenu/Buttons/button.burger.normal.png" id="4_2u3nc"] -[ext_resource type="Texture2D" uid="uid://caia36a08wlqs" path="res://UI/TopMenu/Buttons/button.burger.pressed.png" id="5_2u3nc"] +[ext_resource type="Script" uid="uid://d2wrwichuoncd" path="res://world/Background/background.gd" id="1_fj7yv"] +[ext_resource type="PackedScene" uid="uid://icbk3la71t7h" path="res://world/Background/starry_sky_layer.tscn" id="3_aqk2v"] +[ext_resource type="Script" uid="uid://iiva6x8uo0f2" path="res://stage/stage.gd" id="3_bh8nc"] +[ext_resource type="Texture2D" uid="uid://5f80g4i46ycl" path="res://ui/topmenu/buttons/button.burger.normal.png" id="4_2u3nc"] +[ext_resource type="Texture2D" uid="uid://caia36a08wlqs" path="res://ui/topmenu/buttons/button.burger.pressed.png" id="5_2u3nc"] [ext_resource type="Script" uid="uid://xte4iwvipeve" path="res://command_processor.gd" id="5_036b0"] -[ext_resource type="Texture2D" uid="uid://cjcchycx7biyl" path="res://UI/TopMenu/Time&Speed/TimeX.png" id="6_ikiii"] +[ext_resource type="Texture2D" uid="uid://cjcchycx7biyl" path="res://ui/topmenu/time&speed/time_x.png" id="6_ikiii"] [ext_resource type="FontFile" uid="uid://d3k1ddvv0rmhs" path="res://fonts/Roboto_Condensed/RobotoCondensed-Light.ttf" id="6_wse8f"] [ext_resource type="FontFile" uid="uid://dtyi81a0phumr" path="res://fonts/Roboto_Condensed/RobotoCondensed-Bold.ttf" id="7_ic0uy"] -[ext_resource type="Texture2D" uid="uid://davmv5mwt3mo1" path="res://UI/TopMenu/Time&Speed/speed.png" id="8_2u3nc"] -[ext_resource type="Texture2D" uid="uid://cnjtnggw5ccq3" path="res://UI/TopMenu/Time&Speed/Time1.png" id="8_cbp6q"] +[ext_resource type="Texture2D" uid="uid://davmv5mwt3mo1" path="res://ui/topmenu/time&speed/speed.png" id="8_2u3nc"] +[ext_resource type="Texture2D" uid="uid://cnjtnggw5ccq3" path="res://ui/topmenu/time&speed/time1.png" id="8_cbp6q"] [ext_resource type="FontFile" uid="uid://8s0fv3gfj317" path="res://fonts/Roboto_Condensed/RobotoCondensed-BoldItalic.ttf" id="8_k3n1d"] [ext_resource type="FontFile" uid="uid://derqj4pbwtae6" path="res://fonts/Roboto_Condensed/RobotoCondensed-Italic.ttf" id="9_2o6r5"] -[ext_resource type="Texture2D" uid="uid://rmdsdkck0vst" path="res://UI/TopMenu/Buttons/buton.report.normal.png" id="9_26xuy"] -[ext_resource type="Texture2D" uid="uid://dbhkuw2jshyoh" path="res://UI/TopMenu/Buttons/buton.report.pressed.png" id="10_bc84e"] -[ext_resource type="Texture2D" uid="uid://dgkmobpfbbffa" path="res://UI/Pages/Forces.en.png" id="13_il2jm"] -[ext_resource type="Texture2D" uid="uid://i43jaaejvh5f" path="res://UI/Indicators/Energy/Energy.png" id="16_udxuc"] -[ext_resource type="Texture2D" uid="uid://cvc1stj3hoax5" path="res://UI/Indicators/Density/Density.png" id="17_ikiii"] -[ext_resource type="Texture2D" uid="uid://bef36h52n7lxb" path="res://UI/Indicators/Energy/border-energy.png" id="18_mc2jv"] -[ext_resource type="Texture2D" uid="uid://blq0anccuu387" path="res://UI/Pages/Resources.en.png" id="18_wjb0r"] -[ext_resource type="Texture2D" uid="uid://38fl8ovnubh8" path="res://UI/Pages/Stars.en.png" id="20_mc2jv"] -[ext_resource type="Texture2D" uid="uid://bm8ae1ffv7xq5" path="res://UI/Indicators/Density/DensityPointer.png" id="20_wjb0r"] -[ext_resource type="Texture2D" uid="uid://df2nus1pmcc67" path="res://UI/Indicators/Density/DensityCrunch.png" id="21_4h6ng"] -[ext_resource type="Texture2D" uid="uid://cbi24bwo70nk" path="res://UI/Pages/Structures.en.png" id="21_bo7i5"] -[ext_resource type="Texture2D" uid="uid://bpff5o5oa4wag" path="res://UI/Pages/Planets.en.png" id="22_4h6ng"] -[ext_resource type="Texture2D" uid="uid://bbk74pjqgxe32" path="res://UI/Indicators/Density/DensityRip.png" id="22_o3ebs"] -[ext_resource type="Texture2D" uid="uid://ysbavtgmq7me" path="res://UI/Indicators/Explosiveness/Explosiveness.png" id="24_qktwf"] -[ext_resource type="Texture2D" uid="uid://sry5js57vds4" path="res://UI/Indicators/Burnability/BurnabilityPointer.png" id="25_bh8nc"] -[ext_resource type="Texture2D" uid="uid://dbcmaot2c3tg5" path="res://UI/Indicators/Burnability/Burnability.png" id="27_jjr1n"] -[ext_resource type="Texture2D" uid="uid://bbint5cvwtrou" path="res://UI/Indicators/Explosiveness/ExplosivenessPointer.png" id="27_qktwf"] -[ext_resource type="PackedScene" uid="uid://dg15dpxiepicb" path="res://UI/Border/border.tscn" id="28_o3ebs"] -[ext_resource type="Texture2D" uid="uid://cfttpatxe6k2u" path="res://UI/Indicators/Aggression/Aggression.png" id="30_gggvi"] -[ext_resource type="Texture2D" uid="uid://dm87u2ku8wec8" path="res://UI/Indicators/Aggression/AggressionPointer.png" id="31_w44yn"] -[ext_resource type="Texture2D" uid="uid://bgjcnwl61nu5i" path="res://UI/Indicators/Trends/TrendBar1.png" id="33_w44yn"] -[ext_resource type="Texture2D" uid="uid://caiyhk6vv53iu" path="res://UI/Indicators/Trends/TrendBar2.png" id="34_g1i3r"] -[ext_resource type="Texture2D" uid="uid://dspjxpbpwq52k" path="res://UI/Indicators/Trends/TrendIcon2.png" id="35_my276"] -[ext_resource type="Texture2D" uid="uid://dxutg6k0ck226" path="res://UI/Indicators/Trends/TrendBar3.png" id="36_jas3d"] -[ext_resource type="Texture2D" uid="uid://bp72c0myjnl61" path="res://UI/Indicators/Trends/TrendIcon3.png" id="37_7htu6"] -[ext_resource type="Texture2D" uid="uid://qrjhpvw8ou3o" path="res://UI/Indicators/Trends/TrendBar4.png" id="38_7qk3m"] -[ext_resource type="Texture2D" uid="uid://bwqmmmg6w7dho" path="res://UI/Indicators/Trends/TrendIcon4.png" id="39_xpnt2"] -[ext_resource type="Texture2D" uid="uid://4tpbmpe6tbk0" path="res://UI/Indicators/Trends/TrendBar5.png" id="40_ruyqm"] -[ext_resource type="Texture2D" uid="uid://cnf3ml5gj2cvl" path="res://UI/Indicators/Trends/TrendIcon5.png" id="41_fnoqa"] +[ext_resource type="Texture2D" uid="uid://rmdsdkck0vst" path="res://ui/topmenu/buttons/buton.report.normal.png" id="9_26xuy"] +[ext_resource type="Texture2D" uid="uid://dbhkuw2jshyoh" path="res://ui/topmenu/buttons/buton.report.pressed.png" id="10_bc84e"] +[ext_resource type="Texture2D" uid="uid://dgkmobpfbbffa" path="res://ui/pages/forces.en.png" id="13_il2jm"] +[ext_resource type="Texture2D" uid="uid://i43jaaejvh5f" path="res://ui/indicators/energy/energy.png" id="16_udxuc"] +[ext_resource type="Texture2D" uid="uid://cvc1stj3hoax5" path="res://ui/indicators/density/density.png" id="17_ikiii"] +[ext_resource type="Texture2D" uid="uid://bef36h52n7lxb" path="res://ui/indicators/energy/border-energy.png" id="18_mc2jv"] +[ext_resource type="Texture2D" uid="uid://blq0anccuu387" path="res://ui/pages/resources.en.png" id="18_wjb0r"] +[ext_resource type="Texture2D" uid="uid://38fl8ovnubh8" path="res://ui/pages/stars.en.png" id="20_mc2jv"] +[ext_resource type="Texture2D" uid="uid://bm8ae1ffv7xq5" path="res://ui/indicators/density/density_pointer.png" id="20_wjb0r"] +[ext_resource type="Texture2D" uid="uid://df2nus1pmcc67" path="res://ui/indicators/density/density_crunch.png" id="21_4h6ng"] +[ext_resource type="Texture2D" uid="uid://cbi24bwo70nk" path="res://ui/pages/structures.en.png" id="21_bo7i5"] +[ext_resource type="Texture2D" uid="uid://bpff5o5oa4wag" path="res://ui/pages/planets.en.png" id="22_4h6ng"] +[ext_resource type="Texture2D" uid="uid://bbk74pjqgxe32" path="res://ui/indicators/density/density_rip.png" id="22_o3ebs"] +[ext_resource type="Texture2D" uid="uid://ysbavtgmq7me" path="res://ui/indicators/explosiveness/explosiveness.png" id="24_qktwf"] +[ext_resource type="Texture2D" uid="uid://sry5js57vds4" path="res://ui/indicators/burnability/burnability_pointer.png" id="25_bh8nc"] +[ext_resource type="Texture2D" uid="uid://dbcmaot2c3tg5" path="res://ui/indicators/burnability/burnability.png" id="27_jjr1n"] +[ext_resource type="Texture2D" uid="uid://bbint5cvwtrou" path="res://ui/indicators/explosiveness/explosivenessPointer.png" id="27_qktwf"] +[ext_resource type="PackedScene" uid="uid://dg15dpxiepicb" path="res://ui/border/border.tscn" id="28_o3ebs"] +[ext_resource type="Texture2D" uid="uid://cfttpatxe6k2u" path="res://ui/indicators/aggression/aggression.png" id="30_gggvi"] +[ext_resource type="Texture2D" uid="uid://dm87u2ku8wec8" path="res://ui/indicators/aggression/aggression_pointer.png" id="31_w44yn"] +[ext_resource type="Texture2D" uid="uid://bgjcnwl61nu5i" path="res://ui/indicators/trends/trend_bar1.png" id="33_w44yn"] +[ext_resource type="Texture2D" uid="uid://caiyhk6vv53iu" path="res://ui/indicators/trends/trend_bar2.png" id="34_g1i3r"] +[ext_resource type="Texture2D" uid="uid://dspjxpbpwq52k" path="res://ui/indicators/trends/trend_icon_2.png" id="35_my276"] +[ext_resource type="Texture2D" uid="uid://dxutg6k0ck226" path="res://ui/indicators/trends/trend_bar3.png" id="36_jas3d"] +[ext_resource type="Texture2D" uid="uid://bp72c0myjnl61" path="res://ui/indicators/trends/trend_icon_3.png" id="37_7htu6"] +[ext_resource type="Texture2D" uid="uid://qrjhpvw8ou3o" path="res://ui/indicators/trends/trend_bar4.png" id="38_7qk3m"] +[ext_resource type="Texture2D" uid="uid://bwqmmmg6w7dho" path="res://ui/indicators/trends/trend_icon_4.png" id="39_xpnt2"] +[ext_resource type="Texture2D" uid="uid://4tpbmpe6tbk0" path="res://ui/indicators/trends/trend_bar5.png" id="40_ruyqm"] +[ext_resource type="Texture2D" uid="uid://cnf3ml5gj2cvl" path="res://ui/indicators/trends/trend_icon_5.png" id="41_fnoqa"] [node name="World" type="Node2D" unique_id=1392592456] @@ -237,6 +237,7 @@ layout_mode = 2 [node name="Forces" type="Control" parent="Stage/StageRows/PageScroller/HBoxContainer/ForcePage" unique_id=2057408842] custom_minimum_size = Vector2(1080, 1024) layout_mode = 2 +mouse_filter = 1 [node name="ResourcePage" type="VBoxContainer" parent="Stage/StageRows/PageScroller/HBoxContainer" unique_id=1417647206] layout_mode = 2 @@ -375,6 +376,7 @@ layout_mode = 2 [node name="Resources" type="Control" parent="Stage/StageRows/PageScroller/HBoxContainer/ResourcePage/HBoxContainer" unique_id=1538364728] custom_minimum_size = Vector2(256, 1024) layout_mode = 2 +mouse_filter = 2 [node name="RichTextLabel" type="RichTextLabel" parent="Stage/StageRows/PageScroller/HBoxContainer/ResourcePage/HBoxContainer" unique_id=420150583] layout_mode = 2 @@ -820,6 +822,10 @@ offset_top = 512.0 offset_right = 1080.0 offset_bottom = 1024.0 +[node name="ItemAmountUpdate" type="Timer" parent="Stage" unique_id=1953928024] +wait_time = 0.2 +autostart = true + [node name="CommandProcessor" type="Node" parent="." unique_id=2069361293] script = ExtResource("5_036b0") @@ -835,3 +841,4 @@ script = ExtResource("5_036b0") [connection signal="pressed" from="Stage/StageRows/PageScroller/HBoxContainer/StructurePage/StructureHeader/DensityIndicator" to="Stage" method="_on_indicator_pressed" binds= ["Density", 3]] [connection signal="pressed" from="Stage/StageRows/PageScroller/HBoxContainer/LifePage/LifeHeader/AggressionIndicator" to="Stage" method="_on_indicator_pressed" binds= ["Aggression", 4]] [connection signal="pressed" from="Stage/StageRows/PageScroller/HBoxContainer/LifePage/LifeHeader/TrendIndicator" to="Stage" method="_on_indicator_pressed" binds= ["Trends", 4]] +[connection signal="timeout" from="Stage/ItemAmountUpdate" to="Stage" method="set_owniverse_item_value"] diff --git a/world/Background/starry_sky_layer.tscn b/world/Background/starry_sky_layer.tscn index 978b081..97df226 100644 --- a/world/Background/starry_sky_layer.tscn +++ b/world/Background/starry_sky_layer.tscn @@ -1,6 +1,6 @@ -[gd_scene load_steps=2 format=3 uid="uid://icbk3la71t7h"] +[gd_scene format=3 uid="uid://icbk3la71t7h"] -[ext_resource type="Script" uid="uid://bq7xkdvq4iejn" path="res://World/Background/starry_sky_layer.gd" id="1_st4ay"] +[ext_resource type="Script" uid="uid://bq7xkdvq4iejn" path="res://world/Background/starry_sky_layer.gd" id="1_st4ay"] [node name="StarrySkyLayer" type="Parallax2D"] scroll_offset = Vector2(1080, 1920) diff --git a/world/entity.gd b/world/entity.gd index ab4cfdf..0bc77c9 100644 --- a/world/entity.gd +++ b/world/entity.gd @@ -4,6 +4,7 @@ class_name OwniverseEntity var id: String var is_visible: bool = false var unlock: Dictionary = {} +var is_unlocked: bool = false var cost: Dictionary = {} var bind: Dictionary = {} var mass: float @@ -18,15 +19,7 @@ var output_or: Dictionary = {} var output_and: Dictionary = {} var destroy_level: int var degradation: Dictionary = {} -#deg_mass: "", -#deg_h: "", -#He": "", -#Met": "", var planets: Dictionary = {} -#var habitable: "", -#var rocky: "", -#var gas giant: "", -#var asteroids: "", var count_as: String var group_as: String var event_group: String @@ -34,43 +27,15 @@ var space_bonus: float var civ_bonus: float var claim: String -var SCD: Dictionary = { - "id": "SCD", - "is_visible": "1", - "unlock": "Star:300", - "cost": "", - "bind": "Star:1000", - "mass": "", - "space": "", - "lifespan": "10000000", - "auto": "", "gamma": "", - "blast": "", - "life_product": "", - "voids": "", - "output": "", - "destroy_level": "", - "deg_mass": "", - "H": "", - "He": "", - "Met": "", - "planets": "", - "habitable": "", - "rocky": "", - "gas giant": "", - "asteroids": "", - "count_as": "", - "group_as": "SC", - "event_group": "SC", - "space_bonus": "0.1", - "civ_bonus": "4", - "claim": "C2.3" -} +var amount: float = 0.0 func init_entity(values: Dictionary) -> bool: id = values.id is_visible = values.is_visible == "1" unlock = _parse_and_string(values.unlock) + if "prime" == values.unlock: + is_unlocked = true cost = _parse_and_string(values.cost) bind = _parse_and_string(values.bind) mass = float(values.mass) @@ -111,10 +76,11 @@ func _parse_or_string(source_line: String) -> Dictionary: func _parse_and_string(source_line: String) -> Dictionary: var result = {} - if source_line.contains("&"): - var first_split = source_line.split("&") - for elem in first_split: - var second_split = elem.split(":") + var first_split = source_line.split("&") + + for elem in first_split: + var second_split = elem.split(":") + if len(second_split) == 2: result[second_split[0]] = float(second_split[1]) return result diff --git a/world/owniverse.gd b/world/owniverse.gd index d782d46..65d55f8 100644 --- a/world/owniverse.gd +++ b/world/owniverse.gd @@ -5,13 +5,46 @@ var g_datetime: float = 0 var g_speed: int = 1 var g_speed_in_years = 1 -var g_entities: Dictionary[String, OwniverseEntity] = {} +var entities: Dictionary[String, OwniverseEntity] = {} + +var items_to_update: Dictionary[String, float] = {} + +var cumulative_amount: Dictionary[String, float] = {} + +#region Production + +func produce(item_id: String, amount: int) -> void: + if item_id == "S" or item_id == 'H': + entities[item_id].amount += 1 + + _process_enitity(item_id, amount) + + +func automated_production() -> void: + pass + + +# add to all lists +func _process_enitity(item_id: String, amount: int) -> void: + items_to_update[item_id] = entities[item_id].amount + + +func _count_cumulative(item_id: String, amount: int) -> void: + if cumulative_amount.has(item_id): + cumulative_amount[item_id] += amount + else: + cumulative_amount[item_id] = amount + + +#endregion + func init_enitities() -> void: for entity_id in Global.OwniverseEntities: var entity = OwniverseEntity.new() entity.init_entity(Global.OwniverseEntities[entity_id]) - g_entities[entity_id] = entity + entities[entity_id] = entity + func add_time_delta(delta) -> float: var year_delta:float = delta * g_speed_in_years @@ -21,11 +54,8 @@ func add_time_delta(delta) -> float: g_datetime += year_delta return g_datetime + func change_speed(delta: int) -> int: g_speed = clamp(g_speed + delta, 1, Global.SPEED_LIMIT) g_speed_in_years = pow(10, g_speed-1) return g_speed - - -func hello(): - print("ello") diff --git a/world/owniverse_512.png b/world/owniverse_512.png new file mode 100644 index 0000000..43a70b0 --- /dev/null +++ b/world/owniverse_512.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7acb3a5712d35c3c40adeac8656d539525b07a6f1e990976f90803f720dd954 +size 418995 diff --git a/world/owniverse_splash_512.png b/world/owniverse_splash_512.png new file mode 100644 index 0000000..d4fbacf --- /dev/null +++ b/world/owniverse_splash_512.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa863eb61c4e7be2388c57aa0cbf0048b7b1c03535ef4789efcf254eca7897c0 +size 438796