diff --git a/project.godot b/project.godot index d33e8ac..1cf680d 100644 --- a/project.godot +++ b/project.godot @@ -67,7 +67,7 @@ enabled=PackedStringArray("res://addons/cvd_sim/plugin.cfg") [gui] -timers/tooltip_delay_sec=0.15 +timers/tooltip_delay_sec=0.03 theme/default_font_multichannel_signed_distance_field=true [input] @@ -77,7 +77,7 @@ ui_left={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":65,"physical_keycode":0,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null) -, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } ui_right={ @@ -154,3 +154,5 @@ next_turn={ textures/canvas_textures/default_texture_filter=0 renderer/rendering_method="mobile" +2d/snap/snap_2d_transforms_to_pixel=true +2d/snap/snap_2d_vertices_to_pixel=true diff --git a/scenes/buildings/eco_dome.tscn b/scenes/buildings/eco_dome.tscn index b2d2f31..3de7f0d 100644 --- a/scenes/buildings/eco_dome.tscn +++ b/scenes/buildings/eco_dome.tscn @@ -10,9 +10,9 @@ [sub_resource type="Resource" id="Resource_j3rju"] script = ExtResource("3_j3rju") cost = Dictionary[int, float]({ -0: 1.0, +0: 3.0, 1: 0.0, -2: 8.0, +2: 6.0, 3: 0.0 }) metadata/_custom_type_script = "uid://0leikb15bp7y" @@ -22,7 +22,7 @@ script = ExtResource("3_j3rju") cost = Dictionary[int, float]({ 0: 5.0, 1: 0.0, -2: 15.0, +2: 5.0, 3: 0.0 }) metadata/_custom_type_script = "uid://0leikb15bp7y" @@ -30,9 +30,9 @@ metadata/_custom_type_script = "uid://0leikb15bp7y" [sub_resource type="Resource" id="Resource_fo458"] script = ExtResource("3_j3rju") cost = Dictionary[int, float]({ -0: 25.0, +0: 8.0, 1: 0.0, -2: 20.0, +2: 8.0, 3: 0.0 }) metadata/_custom_type_script = "uid://0leikb15bp7y" @@ -312,8 +312,8 @@ _data = { [node name="EcoDome" instance=ExtResource("1_sid64")] script = ExtResource("2_hww1b") -production_table = Array[int]([0, 3, 5, 25]) -power_table = Array[int]([0, 5, 15, 30]) +production_table = Array[int]([0, 3, 6, 12]) +power_table = Array[int]([0, 10, 15, 20]) building_spec = SubResource("Resource_v4082") [node name="BuildingDebugger" parent="." index="1" node_paths=PackedStringArray("target")] @@ -332,6 +332,7 @@ libraries = { [node name="Select" parent="Audio" index="1"] stream = ExtResource("6_8kgej") +volume_db = 3.0 bus = &"Effects" [node name="Destroy" parent="Audio" index="2"] diff --git a/scenes/buildings/headquarters.tscn b/scenes/buildings/headquarters.tscn index 14d8394..9c5fe21 100644 --- a/scenes/buildings/headquarters.tscn +++ b/scenes/buildings/headquarters.tscn @@ -337,6 +337,7 @@ script = null [node name="Select" parent="Audio" index="1"] stream = ExtResource("4_l6mfu") +volume_db = 4.0 bus = &"Effects" [node name="Destroy" parent="Audio" index="2"] diff --git a/scenes/buildings/iron_refinery.tscn b/scenes/buildings/iron_refinery.tscn index 2283187..c84877a 100644 --- a/scenes/buildings/iron_refinery.tscn +++ b/scenes/buildings/iron_refinery.tscn @@ -10,9 +10,9 @@ [sub_resource type="Resource" id="Resource_gymdt"] script = ExtResource("3_gymdt") cost = Dictionary[int, float]({ -0: 5.0, +0: 1.0, 1: 0.0, -2: 10.0, +2: 8.0, 3: 0.0 }) metadata/_custom_type_script = "uid://0leikb15bp7y" @@ -20,9 +20,9 @@ metadata/_custom_type_script = "uid://0leikb15bp7y" [sub_resource type="Resource" id="Resource_g6fhf"] script = ExtResource("3_gymdt") cost = Dictionary[int, float]({ -0: 10.0, +0: 3.0, 1: 0.0, -2: 20.0, +2: 8.0, 3: 0.0 }) metadata/_custom_type_script = "uid://0leikb15bp7y" @@ -30,9 +30,9 @@ metadata/_custom_type_script = "uid://0leikb15bp7y" [sub_resource type="Resource" id="Resource_e5l8k"] script = ExtResource("3_gymdt") cost = Dictionary[int, float]({ -0: 15.0, +0: 5.0, 1: 0.0, -2: 45.0, +2: 15.0, 3: 0.0 }) metadata/_custom_type_script = "uid://0leikb15bp7y" @@ -308,8 +308,8 @@ _data = { [node name="IronRefinery" instance=ExtResource("1_tn2a3")] script = ExtResource("2_n1xno") -production_table = Array[int]([0, 3, 5, 25]) -power_table = Array[int]([0, 5, 15, 30]) +production_table = Array[int]([0, 1, 2, 5]) +power_table = Array[int]([0, 10, 15, 20]) building_spec = SubResource("Resource_ry6o0") [node name="BuildingDebugger" parent="." index="1" node_paths=PackedStringArray("target")] @@ -328,6 +328,7 @@ libraries = { [node name="Select" parent="Audio" index="1"] stream = ExtResource("6_g6fhf") +volume_db = 3.0 bus = &"Effects" [node name="Destroy" parent="Audio" index="2"] diff --git a/scenes/buildings/power_plant.tscn b/scenes/buildings/power_plant.tscn index 6abd3a7..cf72557 100644 --- a/scenes/buildings/power_plant.tscn +++ b/scenes/buildings/power_plant.tscn @@ -10,9 +10,9 @@ [sub_resource type="Resource" id="Resource_jn2df"] script = ExtResource("3_jn2df") cost = Dictionary[int, float]({ -0: 5.0, +0: 3.0, 1: 0.0, -2: 5.0, +2: 3.0, 3: 0.0 }) metadata/_custom_type_script = "uid://0leikb15bp7y" @@ -20,9 +20,9 @@ metadata/_custom_type_script = "uid://0leikb15bp7y" [sub_resource type="Resource" id="Resource_e41u7"] script = ExtResource("3_jn2df") cost = Dictionary[int, float]({ -0: 5.0, +0: 4.0, 1: 0.0, -2: 10.0, +2: 4.0, 3: 0.0 }) metadata/_custom_type_script = "uid://0leikb15bp7y" @@ -30,9 +30,9 @@ metadata/_custom_type_script = "uid://0leikb15bp7y" [sub_resource type="Resource" id="Resource_ra8a1"] script = ExtResource("3_jn2df") cost = Dictionary[int, float]({ -0: 10.0, +0: 5.0, 1: 0.0, -2: 10.0, +2: 5.0, 3: 0.0 }) metadata/_custom_type_script = "uid://0leikb15bp7y" @@ -315,7 +315,7 @@ _data = { [node name="PowerPlant" instance=ExtResource("1_afyay")] script = ExtResource("2_5nqxb") -production_table = Array[int]([0, 10, 20, 30]) +production_table = Array[int]([0, 10, 20, 40]) building_spec = SubResource("Resource_pap3h") [node name="BuildingDebugger" parent="." index="1" node_paths=PackedStringArray("target")] @@ -337,6 +337,7 @@ active = true [node name="Select" parent="Audio" index="1"] stream = ExtResource("6_e41u7") +volume_db = 3.0 bus = &"Effects" [node name="Destroy" parent="Audio" index="2"] diff --git a/scenes/buildings/residential.tscn b/scenes/buildings/residential.tscn index ebe2078..0435f95 100644 --- a/scenes/buildings/residential.tscn +++ b/scenes/buildings/residential.tscn @@ -20,7 +20,7 @@ metadata/_custom_type_script = "uid://0leikb15bp7y" [sub_resource type="Resource" id="Resource_c44lc"] script = ExtResource("3_c44lc") cost = Dictionary[int, float]({ -0: 10.0, +0: 5.0, 1: 0.0, 2: 10.0, 3: 0.0 @@ -30,9 +30,9 @@ metadata/_custom_type_script = "uid://0leikb15bp7y" [sub_resource type="Resource" id="Resource_gnoo8"] script = ExtResource("3_c44lc") cost = Dictionary[int, float]({ -0: 25.0, +0: 10.0, 1: 0.0, -2: 15.0, +2: 10.0, 3: 0.0 }) metadata/_custom_type_script = "uid://0leikb15bp7y" @@ -306,8 +306,8 @@ _data = { [node name="Residential" instance=ExtResource("1_e3wr7")] script = ExtResource("2_4f3d3") -capacity_table = Array[int]([0, 5, 10, 25]) -power_table = Array[int]([0, 10, 20, 30]) +capacity_table = Array[int]([0, 5, 10, 20]) +power_table = Array[int]([0, 10, 15, 20]) building_spec = SubResource("Resource_wakwv") [node name="BuildingDebugger" parent="." index="1" node_paths=PackedStringArray("target")] diff --git a/scenes/ui_components/hud.tscn b/scenes/ui_components/hud.tscn index 091d097..4a3a231 100644 --- a/scenes/ui_components/hud.tscn +++ b/scenes/ui_components/hud.tscn @@ -279,6 +279,7 @@ offset_bottom = 111.0 grow_horizontal = 2 [node name="Box" type="PanelContainer" parent="HUD/TopMid"] +unique_name_in_owner = true texture_filter = 2 layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_otepx") @@ -703,7 +704,7 @@ text = "Welcome to Lunarium! Establish the first colony on the moon by reaching a -population of 50! +population of 50. Don't forget to power your buildings and feed your diff --git a/scenes/ui_components/notification_ui.tscn b/scenes/ui_components/notification_ui.tscn index 62d36ff..6930439 100644 --- a/scenes/ui_components/notification_ui.tscn +++ b/scenes/ui_components/notification_ui.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=6 format=3 uid="uid://ce5pyvkrsuwy"] +[gd_scene load_steps=7 format=3 uid="uid://ce5pyvkrsuwy"] [ext_resource type="Script" uid="uid://b1kx34gg7jrl7" path="res://scripts/ui_components/notification_ui.gd" id="1_cgvyd"] [ext_resource type="LabelSettings" uid="uid://dte7ki6on48e4" path="res://resources/ui/label_settings_regular.tres" id="1_iw8wg"] @@ -22,6 +22,12 @@ corner_radius_bottom_left = 24 shadow_color = Color(0, 0, 0, 0.2) shadow_size = 4 +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_07uv6"] +content_margin_left = 15.0 +content_margin_top = 15.0 +content_margin_right = 15.0 +content_margin_bottom = 15.0 + [sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_cgvyd"] streams_count = 1 stream_0/stream = ExtResource("3_07uv6") @@ -34,6 +40,7 @@ script = ExtResource("1_cgvyd") [node name="Label" type="Label" parent="."] layout_mode = 2 +theme_override_styles/normal = SubResource("StyleBoxEmpty_07uv6") label_settings = ExtResource("1_iw8wg") [node name="NotifSound" type="AudioStreamPlayer" parent="."] diff --git a/scenes/world.tscn b/scenes/world.tscn index a009362..37d34f0 100644 --- a/scenes/world.tscn +++ b/scenes/world.tscn @@ -34,7 +34,6 @@ streams_count = 10 stream_0/stream = ExtResource("3_0nbtd") stream_1/stream = ExtResource("4_37qwj") stream_2/stream = ExtResource("5_navra") -stream_2/weight = 2.0 stream_3/stream = ExtResource("6_luhhm") stream_4/stream = ExtResource("7_fh13f") stream_5/stream = ExtResource("8_rup4s") diff --git a/scripts/buildings/eco_dome.gd b/scripts/buildings/eco_dome.gd index 4334d7e..77d433f 100644 --- a/scripts/buildings/eco_dome.gd +++ b/scripts/buildings/eco_dome.gd @@ -54,7 +54,7 @@ func _get_selection_payload() -> Dictionary: "\n ": "", "PRODUCTION": str(int(_get_production_rate())) + " FOOD PER TURN", "\n ": "", - "POWER REQUIRED": int(get_power_draw()), + "POWER DRAW": int(get_power_draw()), "POWERED": "YES" if is_powered else "NO", "\n": "", "UPGRADE COST": "MAX LEVEL" if current_level == max_level else str(int(self.building_spec.cost_levels[current_level].cost[ResourceManager.ResourceType.FOOD])) + " FOOD AND " + str(int(self.building_spec.cost_levels[current_level].cost[ResourceManager.ResourceType.IRON])) + " IRON" diff --git a/scripts/buildings/headquarters.gd b/scripts/buildings/headquarters.gd index 9441e50..ec63de2 100644 --- a/scripts/buildings/headquarters.gd +++ b/scripts/buildings/headquarters.gd @@ -32,7 +32,7 @@ func _get_selection_payload() -> Dictionary: "\n ": "", "PRODUCTION": str(iron_per_turn) + " IRON PER TURN", "\n ": "", - "POWER REQUIRED": int(get_power_draw()), + "POWER DRAW": int(get_power_draw()), "POWERED": "YES" if is_powered else "NO", "\n": "", } diff --git a/scripts/buildings/iron_refinery.gd b/scripts/buildings/iron_refinery.gd index 47351bc..f55cbb8 100644 --- a/scripts/buildings/iron_refinery.gd +++ b/scripts/buildings/iron_refinery.gd @@ -53,7 +53,7 @@ func _get_selection_payload() -> Dictionary: "\n ": "", "PRODUCTION": str(int(_get_production_rate())) + " IRON PER TURN", "\n ": "", - "POWER REQUIRED": int(get_power_draw()), + "POWER DRAW": int(get_power_draw()), "POWERED": "YES" if is_powered else "NO", "\n": "", "UPGRADE COST": "MAX LEVEL" if current_level == max_level else str(int(self.building_spec.cost_levels[current_level].cost[ResourceManager.ResourceType.FOOD])) + " FOOD AND " + str(int(self.building_spec.cost_levels[current_level].cost[ResourceManager.ResourceType.IRON])) + " IRON" diff --git a/scripts/buildings/power_plant.gd b/scripts/buildings/power_plant.gd index 9df47fa..5180dcd 100644 --- a/scripts/buildings/power_plant.gd +++ b/scripts/buildings/power_plant.gd @@ -50,7 +50,7 @@ func _get_selection_payload() -> Dictionary: "\n ": "", "PRODUCTION": str(int(_get_production_rate())) + " ELECTRICITY", "\n ": "", - "POWER REQUIRED": int(get_power_draw()), + "POWER DRAW": int(get_power_draw()), "\n": "", "UPGRADE COST": "MAX LEVEL" if current_level == max_level else str(int(self.building_spec.cost_levels[current_level].cost[ResourceManager.ResourceType.FOOD])) + " FOOD AND " + str(int(self.building_spec.cost_levels[current_level].cost[ResourceManager.ResourceType.IRON])) + " IRON" } diff --git a/scripts/buildings/residential.gd b/scripts/buildings/residential.gd index a0d4aaa..856ac5b 100644 --- a/scripts/buildings/residential.gd +++ b/scripts/buildings/residential.gd @@ -46,9 +46,9 @@ func _get_selection_payload() -> Dictionary: super() return { "\n ": "", - "HOUSING CAPACITY": str(get_housing_capacity()) + " POPULATION", + "CAPACITY": str(get_housing_capacity()) + " POPULATION", "\n ": "", - "POWER REQUIRED": int(get_power_draw()), + "POWER DRAW": int(get_power_draw()), "POWERED": "YES" if is_powered else "NO", "\n": "", "UPGRADE COST": "MAX LEVEL" if current_level == max_level else str(int(self.building_spec.cost_levels[current_level].cost[ResourceManager.ResourceType.FOOD])) + " FOOD AND " + str(int(self.building_spec.cost_levels[current_level].cost[ResourceManager.ResourceType.IRON])) + " IRON" diff --git a/scripts/managers/building_manager.gd b/scripts/managers/building_manager.gd index 6d6e0ca..e630b9b 100644 --- a/scripts/managers/building_manager.gd +++ b/scripts/managers/building_manager.gd @@ -205,7 +205,7 @@ func get_adjacent_positions(building_id: int) -> Array: return adjacent_tiles.get(building_id, []) - +# Use this method for building buffs func get_adjacent_buildings(building_id: int) -> Array[BuildingType]: var adjacent_positions: Array = get_adjacent_positions(building_id) var adjacent_buildings: Array[BuildingType] = [] diff --git a/scripts/managers/event_manager.gd b/scripts/managers/event_manager.gd index 3a3840f..126a449 100644 --- a/scripts/managers/event_manager.gd +++ b/scripts/managers/event_manager.gd @@ -1,7 +1,7 @@ class_name EventManager extends Node -enum Event { NONE, PARASITE, STORM, FOG, PLAGUE, HARVEST } +enum Event { NONE, PARASITE, STORM, FOG, PLAGUE, HARVEST, ECLIPSE } var event_turn_lengths: Dictionary[Event, int] = { Event.NONE: -1, @@ -9,7 +9,8 @@ var event_turn_lengths: Dictionary[Event, int] = { Event.STORM: 4, Event.FOG: 2, Event.PLAGUE: 4, - Event.HARVEST: 3 + Event.HARVEST: 3, + Event.ECLIPSE: 5 } var current_event: Event @@ -41,26 +42,30 @@ func _handle_runtime_event(_turn_number: int) -> void: var rand = randf() #rand = 0.93 # TODO: this is for testing, deleteme - # 85% nothing happens, 3% for each event (on next turn) - if rand < 0.85: + # 82% nothing happens, 3% for each event (on next turn) + if rand < 0.82: print("No event triggered") return - elif rand < 0.88: + elif rand < 0.85: print("Parasite event triggered") Signals.notification.emit(NotificationManager.Notification.new("Parasites have infested your eco-domes")) _trigger_parasite() - elif rand < 0.91: + elif rand < 0.88: print("Electromagnetic storm event triggered") Signals.notification.emit(NotificationManager.Notification.new("An electromagnetic storm has begun")) _trigger_storm() - elif rand < 0.94: + elif rand < 0.91: print("Fog event triggered") Signals.notification.emit(NotificationManager.Notification.new("Methane fog has covered the surface")) _trigger_fog() - elif rand < 0.97: + elif rand < 0.94: print("Plague event triggered") Signals.notification.emit(NotificationManager.Notification.new("A deadly plague has hit your colonists")) _trigger_plague() + elif rand < 0.97: + print("Lunar eclipse triggered") + Signals.notification.emit(NotificationManager.Notification.new("A lunar eclipse has caused a cold winter")) + _trigger_eclipse() else: print("Harvest event triggered") Signals.notification.emit(NotificationManager.Notification.new("The soil is rich, a harvest begins")) @@ -113,3 +118,6 @@ func _trigger_plague() -> void: func _trigger_harvest() -> void: event_turns_left = event_turn_lengths[Event.HARVEST] pass + +func _trigger_eclipse() -> void: + event_turns_left = event_turn_lengths[Event.ECLIPSE] diff --git a/scripts/managers/game_manager.gd b/scripts/managers/game_manager.gd index e998f6e..837f821 100644 --- a/scripts/managers/game_manager.gd +++ b/scripts/managers/game_manager.gd @@ -127,7 +127,7 @@ func get_total_housing_capacity() -> int: for building in placed_buildings: if building is Residential and building.is_powered: total_capacity += building.get_housing_capacity() - return total_capacity + return total_capacity + 1 # Plus one for starting colonist func get_total_elec_capacity() -> int: diff --git a/scripts/ui_components/resource_display.gd b/scripts/ui_components/resource_display.gd index c0f184a..04af94a 100644 --- a/scripts/ui_components/resource_display.gd +++ b/scripts/ui_components/resource_display.gd @@ -59,7 +59,8 @@ func _update_display() -> void: # Special-case: POPULATION uses occupied/housing capacity if resource == ResourceManager.ResourceType.POPULATION: var housing_cap := game_manager.get_total_housing_capacity() - text = "%d/%d" % [value, housing_cap + 1] # plus 1 for starting colonist + text = "%d" % value + %Box.tooltip_text = "Housing capacity: %d" % housing_cap return # If the resource has no capacity, show only the value