diff --git a/assets/buildings/labolatory.png b/assets/buildings/labolatory.png new file mode 100644 index 0000000..e229b7d Binary files /dev/null and b/assets/buildings/labolatory.png differ diff --git a/assets/buildings/labolatory.png.import b/assets/buildings/labolatory.png.import new file mode 100644 index 0000000..af8e3b0 --- /dev/null +++ b/assets/buildings/labolatory.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://de5drs5j21a34" +path="res://.godot/imported/labolatory.png-fa4bdd4a0ce66e3be36171e95748be48.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/buildings/labolatory.png" +dest_files=["res://.godot/imported/labolatory.png-fa4bdd4a0ce66e3be36171e95748be48.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/top_panel.tscn b/scenes/top_panel.tscn index fd3877b..fe5d9ea 100644 --- a/scenes/top_panel.tscn +++ b/scenes/top_panel.tscn @@ -34,3 +34,7 @@ text = "ddfdf" [node name="Technologies" type="Button" parent="HBoxContainer"] layout_mode = 2 text = "Technologies" + +[node name="SinceLabel" type="Label" parent="HBoxContainer"] +layout_mode = 2 +text = "ddfdf" diff --git a/scripts/BuildingsList.gd b/scripts/BuildingsList.gd index b050345..3564953 100644 --- a/scripts/BuildingsList.gd +++ b/scripts/BuildingsList.gd @@ -72,6 +72,18 @@ var BUILDINGS = { "build_time": 5.0, "texture": "res://assets/buildings/terraforming_center.png", "required_tech": null + }, + "laboratory": { + "name": "Laboratory", + "description": "Umożliwia prace naukowe", + "bonuses": { + + }, + "resource": null, + "cost": {"iron": 10}, + "build_time": 5.0, + "texture": "res://assets/buildings/labolatory.png", + "required_tech": null } } diff --git a/scripts/PlayerData.gd b/scripts/PlayerData.gd index 7e92587..bf6482a 100644 --- a/scripts/PlayerData.gd +++ b/scripts/PlayerData.gd @@ -27,7 +27,7 @@ var resources := { "chronite": 0.0, } -var science_points: float = 0.0 +var since_doc: float = 0.0 # Technologie odkryte var unlocked_techs = ["advanced_mining"] diff --git a/scripts/galaxy.gd b/scripts/galaxy.gd index bb29c09..16d68f0 100644 --- a/scripts/galaxy.gd +++ b/scripts/galaxy.gd @@ -49,6 +49,10 @@ func _generate_galaxy(count: int): planet.pname = Names.planet_names[randi() % Names.planet_names.size()] planet.orbit_radius = 55 + j * 40 planet.orbit_speed = randf_range(0.004, 0.01) + planet.since_potential = 0.1 + (2.0 - 0.1) * pow(randf(), 4.0) + + + planet.size = randi_range(1, 3) #assign_max_population(planet) generate_planet_resources(planet) # <-- tu losujemy surowce diff --git a/scripts/planet.gd b/scripts/planet.gd index 34a32cc..dc1402d 100644 --- a/scripts/planet.gd +++ b/scripts/planet.gd @@ -8,6 +8,7 @@ class_name Planet var pop_timer: float = 0.0 var res_timer: float = 0.0 var cons_timer: float = 0.0 +var since_pop: float = 0.0 var pname: String = "" var orbit_radius: float = 30.0 @@ -18,6 +19,8 @@ var size = 1 var max_pop = 1 var population: int = 0 var res_rich: float = 0.0 +var since_doc: float = 0.0 +var since_potential: float = 0.5 var resources := {} var buildings := [] var bonuses = { @@ -55,6 +58,7 @@ func _process(delta): if is_colonized: _pop_growth(delta) _res_growth(delta) + _since_growth(delta) _res_consumption(delta) print_data() label.text = str(pname) @@ -145,6 +149,24 @@ func _pop_growth(delta): else: population = max(population - 1000, 100) pop_timer = 0.0 +func _since_growth(delta): + since_pop += delta + if since_pop >= Settings.UPDATE_INTERVAL: + if has_building("laboratory"): + since_doc += since_potential * log(1 + population * 0.00001) + since_pop = 0 + + +func has_building(building_id: String) -> bool: + for b in buildings: + if typeof(b) == TYPE_DICTIONARY: + if b.get("id", "") == building_id: + return true + # jeśli trzymasz budynki jako stringi (rzadziej), obsłuż to też: + elif typeof(b) == TYPE_STRING and b == building_id: + return true + return false + func _res_growth(delta): res_timer += delta if res_timer < Settings.UPDATE_INTERVAL: diff --git a/scripts/planet_panel.gd b/scripts/planet_panel.gd index b44db41..47162eb 100644 --- a/scripts/planet_panel.gd +++ b/scripts/planet_panel.gd @@ -33,10 +33,11 @@ func _update_info(): text += "Biosfera: %.2f (+%.2f)\n" % [planet.biosfere, planet.bonuses.get("biosfere", 0.0)] text += "Zasobność surowców: %.2f\n" % planet.res_rich + text += "Potencjał naukowy: %.2f\n" % planet.since_potential text += "Limit populacji: %s\n" % GameData.format_number(planet.max_pop) text += "Populacja: %d\n" % int(planet.population) text += "Status: %s\n" % ("Skolonizowana" if planet.is_colonized else "Nieskolonizowana") - + text += "Raporty naukowe: %.2f\n" % planet.since_doc # Surowce var has_any_resource = false for key in planet.resources.keys(): @@ -130,7 +131,8 @@ func _on_send_resources_pressed(): if not planet: return - + PlayerData.since_doc += planet.since_doc + planet.since_doc = 0 for res_name in planet.resources.keys(): var res = planet.resources[res_name] if res.has("amount") and res["amount"] > 0: diff --git a/scripts/top_panel.gd b/scripts/top_panel.gd index de6cade..20e1f06 100644 --- a/scripts/top_panel.gd +++ b/scripts/top_panel.gd @@ -5,6 +5,7 @@ extends Control @onready var label_iron = $HBoxContainer/IronLabel @onready var label_water = $HBoxContainer/WaterLabel @onready var label_copper = $HBoxContainer/CopperLabel +@onready var label_since = $HBoxContainer/SinceLabel #@onready var label_population = $HBoxContainer/LabelPopulation func update_info(): @@ -15,6 +16,7 @@ func update_info(): label_iron.text = "%s: %.2f" % [tr("iron"), PlayerData.resources.iron] label_water.text = "%s: %.2f" % [tr("water"), PlayerData.resources.water] label_copper.text = "%s: %.2f" % [tr("copper"), PlayerData.resources.copper] + label_since.text = "%s: %.2f" % [tr("since"), PlayerData.since_doc] #label_population.text = "👥 Populacja: %s" % GameData.format_number(player.total_population)