From 1fb0c69d6c62c51698ee61f8fa97f2c7e4de2642 Mon Sep 17 00:00:00 2001 From: jc-stemuli Date: Tue, 15 Apr 2025 10:19:18 -0500 Subject: [PATCH 1/5] Changes to make it work with godot 4.4. --- .vscode/settings.json | 3 + fonts/lilita_one_regular.ttf.import | 1 + mission/fifth_mission.tres | 4 +- mission/first_mission.tres | 4 +- mission/fourth_mission.tres | 4 +- mission/second_mission.tres | 4 +- mission/sixth_mission.tres | 4 +- mission/third_mission.tres | 4 +- models/building-garage.glb.import | 1 + models/building-small-a.glb.import | 1 + models/building-small-b.glb.import | 1 + models/building-small-c.glb.import | 1 + models/building-small-d.glb.import | 1 + models/grass-trees-tall.glb.import | 1 + models/grass-trees.glb.import | 1 + models/grass.glb.import | 1 + models/pavement-fountain.glb.import | 1 + models/pavement.glb.import | 1 + models/power_plant.glb.import | 1 + models/road-corner.glb.import | 1 + models/road-intersection.glb.import | 1 + models/road-split.glb.import | 1 + models/road-straight-lightposts.glb.import | 1 + models/road-straight.glb.import | 4 +- people/character-female-a.glb.import | 1 + people/character-female-d.glb.import | 1 + people/character-male-a.glb.import | 1 + people/character-male-b.glb.import | 1 + people/character-male-c.glb.import | 1 + people/character-male-d.glb.import | 1 + people/character-male-e.glb.import | 1 + people/character-male-f.glb.import | 1 + project.godot | 2 +- resources/generic_text_panel.resource.gd.uid | 1 + sample map/map.res | Bin 15091 -> 15091 bytes sample/Environment.tscn | 2 +- scenes/attribution_screen.tscn | 2 +- scenes/character.tscn | 2 +- scenes/character_pathing.tscn | 2 +- scenes/controls_panel.tscn | 2 +- scenes/direct_unlocked_panel.tscn | 2 +- scenes/fullscreen_learning_panel.tscn | 2 +- scenes/generic_text.gd.uid | 1 + scenes/generic_text_panel.tscn | 2 +- scenes/hud.tscn | 2 +- scenes/improved_unlocked_panel.tscn | 7 +- scenes/learning_panel.tscn | 2 +- scenes/main.tscn | 18 +- scenes/main.tscn142492988.tmp | 365 ++++++++++++++++++ scenes/main.tscn342278772.tmp | 365 ++++++++++++++++++ scenes/mission_panel.tscn | 2 +- scenes/pathfinding.tscn | 8 +- scenes/pathing.tscn | 7 +- scenes/sound_panel.tscn | 2 +- scenes/unlocked_items_panel.tscn | 2 +- scripts/NavigationNPC.gd.uid | 1 + scripts/attribution_screen.gd.uid | 1 + scripts/audio_bridge.gd.uid | 1 + scripts/builder.gd | 156 ++++---- scripts/builder.gd.uid | 1 + scripts/controls_panel.gd.uid | 1 + scripts/data_map.gd.uid | 1 + scripts/data_structure.gd.uid | 1 + scripts/fix_mission.gd.uid | 1 + scripts/game_manager.gd | 4 +- scripts/game_manager.gd.uid | 1 + scripts/hud_manager.gd.uid | 1 + scripts/javascript_bridge.gd.uid | 1 + .../building_construction_manager.gd.uid | 1 + scripts/mission/character_controller.gd.uid | 1 + scripts/mission/construction_worker.gd.uid | 1 + scripts/mission/direct_panel_handler.gd.uid | 1 + scripts/mission/fixed_handling.gd.uid | 1 + .../mission/fullscreen_learning_panel.gd.uid | 1 + .../mission/handle_structure_unlocking.gd.uid | 1 + scripts/mission/latex_panel.gd.uid | 1 + scripts/mission/learning_panel.gd.uid | 1 + scripts/mission/learning_panel_main.gd.uid | 1 + scripts/mission/mission_data.gd.uid | 1 + scripts/mission/mission_manager.gd.uid | 1 + scripts/mission/mission_objective.gd.uid | 1 + scripts/mission/mission_ui.gd.uid | 1 + scripts/mission/resident_character.gd.uid | 1 + scripts/mission/unlocked_items_panel.gd.uid | 1 + scripts/navigation_setup.gd.uid | 1 + scripts/pathfinding.gd.uid | 1 + scripts/sound_manager.gd | 64 +-- scripts/sound_manager.gd.uid | 1 + scripts/sound_panel.gd | 2 +- scripts/sound_panel.gd.uid | 1 + scripts/structure.gd.uid | 1 + scripts/view.gd.uid | 1 + structures/building-garage.tres | 6 +- structures/building-small-a.tres | 2 +- structures/building-small-b.tres | 6 +- structures/building-small-c.tres | 6 +- structures/building-small-d.tres | 6 +- structures/grass-trees-tall.tres | 6 +- structures/grass-trees.tres | 2 +- structures/grass.tres | 5 +- structures/pavement-fountain.tres | 6 +- structures/pavement.tres | 6 +- structures/power-plant.tres | 2 +- structures/road-corner.tres | 2 +- structures/road-intersection.tres | 6 +- structures/road-split.tres | 6 +- structures/road-straight-lightposts.tres | 10 +- structures/road-straight.tres | 6 +- 108 files changed, 1038 insertions(+), 159 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 resources/generic_text_panel.resource.gd.uid create mode 100644 scenes/generic_text.gd.uid create mode 100644 scenes/main.tscn142492988.tmp create mode 100644 scenes/main.tscn342278772.tmp create mode 100644 scripts/NavigationNPC.gd.uid create mode 100644 scripts/attribution_screen.gd.uid create mode 100644 scripts/audio_bridge.gd.uid create mode 100644 scripts/builder.gd.uid create mode 100644 scripts/controls_panel.gd.uid create mode 100644 scripts/data_map.gd.uid create mode 100644 scripts/data_structure.gd.uid create mode 100644 scripts/fix_mission.gd.uid create mode 100644 scripts/game_manager.gd.uid create mode 100644 scripts/hud_manager.gd.uid create mode 100644 scripts/javascript_bridge.gd.uid create mode 100644 scripts/mission/building_construction_manager.gd.uid create mode 100644 scripts/mission/character_controller.gd.uid create mode 100644 scripts/mission/construction_worker.gd.uid create mode 100644 scripts/mission/direct_panel_handler.gd.uid create mode 100644 scripts/mission/fixed_handling.gd.uid create mode 100644 scripts/mission/fullscreen_learning_panel.gd.uid create mode 100644 scripts/mission/handle_structure_unlocking.gd.uid create mode 100644 scripts/mission/latex_panel.gd.uid create mode 100644 scripts/mission/learning_panel.gd.uid create mode 100644 scripts/mission/learning_panel_main.gd.uid create mode 100644 scripts/mission/mission_data.gd.uid create mode 100644 scripts/mission/mission_manager.gd.uid create mode 100644 scripts/mission/mission_objective.gd.uid create mode 100644 scripts/mission/mission_ui.gd.uid create mode 100644 scripts/mission/resident_character.gd.uid create mode 100644 scripts/mission/unlocked_items_panel.gd.uid create mode 100644 scripts/navigation_setup.gd.uid create mode 100644 scripts/pathfinding.gd.uid create mode 100644 scripts/sound_manager.gd.uid create mode 100644 scripts/sound_panel.gd.uid create mode 100644 scripts/structure.gd.uid create mode 100644 scripts/view.gd.uid diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4afa3d5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "godotTools.editorPath.godot4": "c:\\Users\\jason\\Downloads\\Godot_v4.4.1-stable_mono_win64\\Godot_v4.4.1-stable_mono_win64\\Godot_v4.4.1-stable_mono_win64.exe" +} \ No newline at end of file diff --git a/fonts/lilita_one_regular.ttf.import b/fonts/lilita_one_regular.ttf.import index 2cf3216..c0d7278 100644 --- a/fonts/lilita_one_regular.ttf.import +++ b/fonts/lilita_one_regular.ttf.import @@ -23,6 +23,7 @@ allow_system_fallback=true force_autohinter=false hinting=1 subpixel_positioning=1 +keep_rounding_remainders=true oversampling=0.0 Fallbacks=null fallbacks=[] diff --git a/mission/fifth_mission.tres b/mission/fifth_mission.tres index 72f925f..240ba44 100644 --- a/mission/fifth_mission.tres +++ b/mission/fifth_mission.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://p3xwn2mp6bm6"] -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_dhx01"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="2_mum3p"] +[ext_resource type="Script" uid="uid://c7v1kbo5amrko" path="res://scripts/mission/mission_objective.gd" id="1_dhx01"] +[ext_resource type="Script" uid="uid://c6f12a8vs3hp6" path="res://scripts/mission/mission_data.gd" id="2_mum3p"] [sub_resource type="Resource" id="Resource_c06be"] script = ExtResource("1_dhx01") diff --git a/mission/first_mission.tres b/mission/first_mission.tres index f5a4fbc..973ffef 100644 --- a/mission/first_mission.tres +++ b/mission/first_mission.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://x5h4xutbldq3"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="1_nv6c6"] -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_yfbrc"] +[ext_resource type="Script" uid="uid://c6f12a8vs3hp6" path="res://scripts/mission/mission_data.gd" id="1_nv6c6"] +[ext_resource type="Script" uid="uid://c7v1kbo5amrko" path="res://scripts/mission/mission_objective.gd" id="1_yfbrc"] [sub_resource type="Resource" id="Resource_ywws1"] script = ExtResource("1_yfbrc") diff --git a/mission/fourth_mission.tres b/mission/fourth_mission.tres index 078cada..356be7b 100644 --- a/mission/fourth_mission.tres +++ b/mission/fourth_mission.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://bho4qh41asyk1"] -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_dhx01"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="2_mum3p"] +[ext_resource type="Script" uid="uid://c7v1kbo5amrko" path="res://scripts/mission/mission_objective.gd" id="1_dhx01"] +[ext_resource type="Script" uid="uid://c6f12a8vs3hp6" path="res://scripts/mission/mission_data.gd" id="2_mum3p"] [sub_resource type="Resource" id="Resource_c06be"] script = ExtResource("1_dhx01") diff --git a/mission/second_mission.tres b/mission/second_mission.tres index 0733835..7fbd4e5 100644 --- a/mission/second_mission.tres +++ b/mission/second_mission.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://cjr36hqnmyn0x"] -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_dhx01"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="2_mum3p"] +[ext_resource type="Script" uid="uid://c7v1kbo5amrko" path="res://scripts/mission/mission_objective.gd" id="1_dhx01"] +[ext_resource type="Script" uid="uid://c6f12a8vs3hp6" path="res://scripts/mission/mission_data.gd" id="2_mum3p"] [sub_resource type="Resource" id="Resource_7c02e"] script = ExtResource("1_dhx01") diff --git a/mission/sixth_mission.tres b/mission/sixth_mission.tres index c2e4983..a74efb4 100644 --- a/mission/sixth_mission.tres +++ b/mission/sixth_mission.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://bv4r7ebpjdce4"] -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_nxtw6"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="2_83mjp"] +[ext_resource type="Script" uid="uid://c7v1kbo5amrko" path="res://scripts/mission/mission_objective.gd" id="1_nxtw6"] +[ext_resource type="Script" uid="uid://c6f12a8vs3hp6" path="res://scripts/mission/mission_data.gd" id="2_83mjp"] [sub_resource type="Resource" id="Resource_power_plant"] script = ExtResource("1_nxtw6") diff --git a/mission/third_mission.tres b/mission/third_mission.tres index 20b5330..35427b3 100644 --- a/mission/third_mission.tres +++ b/mission/third_mission.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://dykbopx8n3c3v"] -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_l3spi"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="2_b4llw"] +[ext_resource type="Script" uid="uid://c7v1kbo5amrko" path="res://scripts/mission/mission_objective.gd" id="1_l3spi"] +[ext_resource type="Script" uid="uid://c6f12a8vs3hp6" path="res://scripts/mission/mission_data.gd" id="2_b4llw"] [sub_resource type="Resource" id="Resource_c06be"] script = ExtResource("1_l3spi") diff --git a/models/building-garage.glb.import b/models/building-garage.glb.import index 3788a98..81af067 100644 --- a/models/building-garage.glb.import +++ b/models/building-garage.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/building-small-a.glb.import b/models/building-small-a.glb.import index c6ee372..8de0518 100644 --- a/models/building-small-a.glb.import +++ b/models/building-small-a.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/building-small-b.glb.import b/models/building-small-b.glb.import index 16a0479..43ce53c 100644 --- a/models/building-small-b.glb.import +++ b/models/building-small-b.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/building-small-c.glb.import b/models/building-small-c.glb.import index 7567162..a392b33 100644 --- a/models/building-small-c.glb.import +++ b/models/building-small-c.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/building-small-d.glb.import b/models/building-small-d.glb.import index 94d07a2..7f84e70 100644 --- a/models/building-small-d.glb.import +++ b/models/building-small-d.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/grass-trees-tall.glb.import b/models/grass-trees-tall.glb.import index bb6ab24..57d34e2 100644 --- a/models/grass-trees-tall.glb.import +++ b/models/grass-trees-tall.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/grass-trees.glb.import b/models/grass-trees.glb.import index 59486dd..fd49c51 100644 --- a/models/grass-trees.glb.import +++ b/models/grass-trees.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/grass.glb.import b/models/grass.glb.import index 32ca1be..86edbf7 100644 --- a/models/grass.glb.import +++ b/models/grass.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/pavement-fountain.glb.import b/models/pavement-fountain.glb.import index 671160c..63e4cfb 100644 --- a/models/pavement-fountain.glb.import +++ b/models/pavement-fountain.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/pavement.glb.import b/models/pavement.glb.import index 4697b56..2f2c35d 100644 --- a/models/pavement.glb.import +++ b/models/pavement.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/power_plant.glb.import b/models/power_plant.glb.import index 9057ff1..09c9374 100644 --- a/models/power_plant.glb.import +++ b/models/power_plant.glb.import @@ -18,6 +18,7 @@ nodes/root_name="" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/road-corner.glb.import b/models/road-corner.glb.import index efb2456..fd7d4d3 100644 --- a/models/road-corner.glb.import +++ b/models/road-corner.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/road-intersection.glb.import b/models/road-intersection.glb.import index 13ab702..1a6777f 100644 --- a/models/road-intersection.glb.import +++ b/models/road-intersection.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/road-split.glb.import b/models/road-split.glb.import index 272ad57..983f5c3 100644 --- a/models/road-split.glb.import +++ b/models/road-split.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/road-straight-lightposts.glb.import b/models/road-straight-lightposts.glb.import index 6c0fe2b..f58f4ce 100644 --- a/models/road-straight-lightposts.glb.import +++ b/models/road-straight-lightposts.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/models/road-straight.glb.import b/models/road-straight.glb.import index be5f216..9ed5ca9 100644 --- a/models/road-straight.glb.import +++ b/models/road-straight.glb.import @@ -18,6 +18,7 @@ nodes/root_name="Scene Root" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true @@ -38,8 +39,7 @@ _subresources={ "generate/lods": 0, "generate/shadow_meshes": 0, "lods/normal_merge_angle": 60.0, -"lods/normal_split_angle": 25.0, -"save_to_file/enabled": true, +"save_to_file/enabled": false, "save_to_file/path": "res://mesges/road-mesh.res" } } diff --git a/people/character-female-a.glb.import b/people/character-female-a.glb.import index 3a0ddf0..566d293 100644 --- a/people/character-female-a.glb.import +++ b/people/character-female-a.glb.import @@ -18,6 +18,7 @@ nodes/root_name="" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/people/character-female-d.glb.import b/people/character-female-d.glb.import index 0cce47e..7708fc8 100644 --- a/people/character-female-d.glb.import +++ b/people/character-female-d.glb.import @@ -18,6 +18,7 @@ nodes/root_name="" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/people/character-male-a.glb.import b/people/character-male-a.glb.import index 10aa1dc..1b312e5 100644 --- a/people/character-male-a.glb.import +++ b/people/character-male-a.glb.import @@ -18,6 +18,7 @@ nodes/root_name="" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/people/character-male-b.glb.import b/people/character-male-b.glb.import index 06702c5..633ad43 100644 --- a/people/character-male-b.glb.import +++ b/people/character-male-b.glb.import @@ -18,6 +18,7 @@ nodes/root_name="" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/people/character-male-c.glb.import b/people/character-male-c.glb.import index 2dc05c4..7849268 100644 --- a/people/character-male-c.glb.import +++ b/people/character-male-c.glb.import @@ -18,6 +18,7 @@ nodes/root_name="" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/people/character-male-d.glb.import b/people/character-male-d.glb.import index 0360a71..bf068d4 100644 --- a/people/character-male-d.glb.import +++ b/people/character-male-d.glb.import @@ -18,6 +18,7 @@ nodes/root_name="" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/people/character-male-e.glb.import b/people/character-male-e.glb.import index a1d2a6a..c357c3a 100644 --- a/people/character-male-e.glb.import +++ b/people/character-male-e.glb.import @@ -18,6 +18,7 @@ nodes/root_name="" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/people/character-male-f.glb.import b/people/character-male-f.glb.import index a2c7c19..d3e343c 100644 --- a/people/character-male-f.glb.import +++ b/people/character-male-f.glb.import @@ -18,6 +18,7 @@ nodes/root_name="" nodes/apply_root_scale=true nodes/root_scale=1.0 nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true diff --git a/project.godot b/project.godot index 8f2d8ca..a686089 100644 --- a/project.godot +++ b/project.godot @@ -13,7 +13,7 @@ config_version=5 config/name="Starter Kit City Builder" config/tags=PackedStringArray("starterkit") run/main_scene="res://scenes/main.tscn" -config/features=PackedStringArray("4.3", "Forward Plus") +config/features=PackedStringArray("4.4", "Forward Plus") boot_splash/bg_color=Color(0.92549, 0.92549, 0.960784, 1) boot_splash/image="res://splash-screen.png" config/icon="res://icon.png" diff --git a/resources/generic_text_panel.resource.gd.uid b/resources/generic_text_panel.resource.gd.uid new file mode 100644 index 0000000..0a7c59d --- /dev/null +++ b/resources/generic_text_panel.resource.gd.uid @@ -0,0 +1 @@ +uid://d1rme8o0ewiet diff --git a/sample map/map.res b/sample map/map.res index 32a67ab1d0521e93f6ea06767c3e6706d9cbd96f..fb5935cd11d7725d7440b975d1d4c74868cb45b7 100644 GIT binary patch delta 39 xcmV+?0NDTYb@O$w9svlC+6b_cmp~7bCIK%A-*&bAsFBGVdy|0y7_)W(eK}*55Z?d* delta 39 xcmV+?0NDTYb@O$w9svk2)ia~cN4Rm5CIK%A$t&uu*Q9wYdy|0y7_)W(eK}^T5as{? diff --git a/sample/Environment.tscn b/sample/Environment.tscn index 4436688..b20d9c2 100644 --- a/sample/Environment.tscn +++ b/sample/Environment.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=5 format=3 uid="uid://b8ne7pqtnju2y"] -[ext_resource type="Script" uid="uid://dsdxor1cwpqp" path="res://sample/UpdateLatex.gd" id="2"] +[ext_resource type="Script" uid="uid://dvs8h3w31nbty" path="res://sample/UpdateLatex.gd" id="2"] [sub_resource type="Image" id="Image_0hed4"] data = { diff --git a/scenes/attribution_screen.tscn b/scenes/attribution_screen.tscn index 847a083..527e06b 100644 --- a/scenes/attribution_screen.tscn +++ b/scenes/attribution_screen.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=3 uid="uid://ib2t48fgsw62"] [ext_resource type="FontFile" uid="uid://d0cxd77jybrcn" path="res://fonts/lilita_one_regular.ttf" id="1_ncwjb"] -[ext_resource type="Script" uid="uid://dsdnejv05yxyb" path="res://scripts/attribution_screen.gd" id="1_qwu4y"] +[ext_resource type="Script" uid="uid://b1014mouu2vqu" path="res://scripts/attribution_screen.gd" id="1_qwu4y"] [node name="AttributionScreen" type="CanvasLayer"] script = ExtResource("1_qwu4y") diff --git a/scenes/character.tscn b/scenes/character.tscn index 85556b7..4770ee5 100644 --- a/scenes/character.tscn +++ b/scenes/character.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=8 format=3 uid="uid://b4gkfwf4i3ydl"] -[ext_resource type="Script" uid="uid://c2u81fdo7uou3" path="res://scripts/mission/character_controller.gd" id="1_g3a7y"] +[ext_resource type="Script" uid="uid://dexknr7it5val" path="res://scripts/mission/character_controller.gd" id="1_g3a7y"] [ext_resource type="PackedScene" uid="uid://h2jjkvc4edsp" path="res://people/character-female-d.glb" id="2_d5jmi"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_b4w3n"] diff --git a/scenes/character_pathing.tscn b/scenes/character_pathing.tscn index 12a34f3..4191cd5 100644 --- a/scenes/character_pathing.tscn +++ b/scenes/character_pathing.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=3 uid="uid://7aqckirt7b41"] [ext_resource type="PackedScene" uid="uid://h2jjkvc4edsp" path="res://people/character-female-d.glb" id="1_anb25"] -[ext_resource type="Script" uid="uid://88a6avyptj0n" path="res://scripts/NavigationNPC.gd" id="1_eug4x"] +[ext_resource type="Script" uid="uid://buvxhq2ipa8gt" path="res://scripts/NavigationNPC.gd" id="1_eug4x"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_8rf01"] radius = 0.307771 diff --git a/scenes/controls_panel.tscn b/scenes/controls_panel.tscn index a303f5d..e30b874 100644 --- a/scenes/controls_panel.tscn +++ b/scenes/controls_panel.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=3 uid="uid://bqjnp7uypupog"] [ext_resource type="FontFile" uid="uid://d0cxd77jybrcn" path="res://fonts/lilita_one_regular.ttf" id="1_tnlhn"] -[ext_resource type="Script" path="res://scripts/controls_panel.gd" id="1_xyuqg"] +[ext_resource type="Script" uid="uid://b2vlnidm83s8y" path="res://scripts/controls_panel.gd" id="1_xyuqg"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f2mso"] bg_color = Color(0.145098, 0.172549, 0.231373, 0.941176) diff --git a/scenes/direct_unlocked_panel.tscn b/scenes/direct_unlocked_panel.tscn index 2bcf775..6156a53 100644 --- a/scenes/direct_unlocked_panel.tscn +++ b/scenes/direct_unlocked_panel.tscn @@ -89,4 +89,4 @@ autowrap_mode = 2 layout_mode = 2 theme_override_colors/font_color = Color(1, 0, 0, 1) theme_override_font_sizes/font_size = 20 -text = "CLOSE" \ No newline at end of file +text = "CLOSE" diff --git a/scenes/fullscreen_learning_panel.tscn b/scenes/fullscreen_learning_panel.tscn index 15adfe0..946d744 100644 --- a/scenes/fullscreen_learning_panel.tscn +++ b/scenes/fullscreen_learning_panel.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=3 uid="uid://cq1w6ovisjgsg"] -[ext_resource type="Script" uid="uid://w2g0h4c8ymo4" path="res://scripts/mission/fullscreen_learning_panel.gd" id="1_kq0jb"] +[ext_resource type="Script" uid="uid://d4isuuaa51b7x" path="res://scripts/mission/fullscreen_learning_panel.gd" id="1_kq0jb"] [sub_resource type="StyleBoxEmpty" id="StyleBoxFlat_empty"] diff --git a/scenes/generic_text.gd.uid b/scenes/generic_text.gd.uid new file mode 100644 index 0000000..66ca523 --- /dev/null +++ b/scenes/generic_text.gd.uid @@ -0,0 +1 @@ +uid://c7qrkyfuarnfa diff --git a/scenes/generic_text_panel.tscn b/scenes/generic_text_panel.tscn index 4277065..e207f23 100644 --- a/scenes/generic_text_panel.tscn +++ b/scenes/generic_text_panel.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=3 uid="uid://dmsy06s02tcw4"] -[ext_resource type="Script" path="res://scenes/generic_text.gd" id="1_qcnox"] +[ext_resource type="Script" uid="uid://c7qrkyfuarnfa" path="res://scenes/generic_text.gd" id="1_qcnox"] [ext_resource type="FontFile" uid="uid://d0cxd77jybrcn" path="res://fonts/lilita_one_regular.ttf" id="2_7oj77"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f2mso"] diff --git a/scenes/hud.tscn b/scenes/hud.tscn index 1897437..c471667 100644 --- a/scenes/hud.tscn +++ b/scenes/hud.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=10 format=3 uid="uid://cgk66f6rg03mj"] -[ext_resource type="Script" path="res://scripts/hud_manager.gd" id="1_6vdxc"] +[ext_resource type="Script" uid="uid://caabw5op0u6tc" path="res://scripts/hud_manager.gd" id="1_6vdxc"] [ext_resource type="Texture2D" uid="uid://hendpftbt4iw" path="res://sprites/population_icon.png" id="2_28oy1"] [ext_resource type="Texture2D" uid="uid://jk3mremfu7lm" path="res://sprites/electricity_icon.png" id="3_2u5bk"] [ext_resource type="FontFile" uid="uid://d0cxd77jybrcn" path="res://fonts/lilita_one_regular.ttf" id="4_qfmf5"] diff --git a/scenes/improved_unlocked_panel.tscn b/scenes/improved_unlocked_panel.tscn index ee7596b..51720f9 100644 --- a/scenes/improved_unlocked_panel.tscn +++ b/scenes/improved_unlocked_panel.tscn @@ -1,6 +1,7 @@ [gd_scene load_steps=2 format=3 uid="uid://bb04k2hkfmls6"] -[ext_resource type="Script" path="res://scripts/mission/improved_unlocked_panel.gd" id="1_r3fws"] +[sub_resource type="Resource" id="Resource_0aveo"] +metadata/__load_path__ = "res://scripts/mission/improved_unlocked_panel.gd" [node name="ImprovedUnlockedPanel" type="Control"] layout_mode = 3 @@ -9,7 +10,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -script = ExtResource("1_r3fws") +script = SubResource("Resource_0aveo") [node name="ColorRect" type="ColorRect" parent="."] layout_mode = 1 @@ -66,4 +67,4 @@ size_flags_vertical = 3 layout_mode = 2 text = "Close" -[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/CloseButton" to="." method="_on_close_button_pressed"] \ No newline at end of file +[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/CloseButton" to="." method="_on_close_button_pressed"] diff --git a/scenes/learning_panel.tscn b/scenes/learning_panel.tscn index 61a8ea2..40106d0 100644 --- a/scenes/learning_panel.tscn +++ b/scenes/learning_panel.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=5 format=3 uid="uid://ceae06aaigfhh"] -[ext_resource type="Script" path="res://scripts/mission/learning_panel.gd" id="1_wn8yp"] +[ext_resource type="Script" uid="uid://52tdmmosdbpa" path="res://scripts/mission/learning_panel.gd" id="1_wn8yp"] [sub_resource type="StyleBoxEmpty" id="StyleBoxFlat_empty"] diff --git a/scenes/main.tscn b/scenes/main.tscn index b68b42f..2fdadce 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,19 +1,19 @@ [gd_scene load_steps=33 format=3 uid="uid://vgwrcfy1qawf"] -[ext_resource type="Script" path="res://scripts/builder.gd" id="1_jybm7"] +[ext_resource type="Script" uid="uid://snp3i7itqnqc" path="res://scripts/builder.gd" id="1_jybm7"] [ext_resource type="Environment" uid="uid://jbptgqvstei3" path="res://scenes/main-environment.tres" id="1_yndf3"] -[ext_resource type="Script" path="res://scripts/structure.gd" id="2_54v6r"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_54v6r"] [ext_resource type="Resource" uid="uid://dv14kkhb6umkv" path="res://structures/road-straight.tres" id="2_bwyku"] [ext_resource type="Texture2D" uid="uid://cbk07cxgshg26" path="res://sprites/selector.png" id="4_wr1wv"] [ext_resource type="Resource" uid="uid://cntgl86ianngh" path="res://structures/building-small-a.tres" id="5_v5o2m"] [ext_resource type="Resource" uid="uid://ccb475jeg7ym5" path="res://structures/grass-trees.tres" id="6_fwsy4"] -[ext_resource type="Script" path="res://scripts/view.gd" id="8_yovpv"] -[ext_resource type="Script" path="res://scripts/mission/mission_manager.gd" id="10_oe3re"] +[ext_resource type="Script" uid="uid://cu76h00erned0" path="res://scripts/view.gd" id="8_yovpv"] +[ext_resource type="Script" uid="uid://bnpqjt5n1s20m" path="res://scripts/mission/mission_manager.gd" id="10_oe3re"] [ext_resource type="PackedScene" uid="uid://dmsy06s02tcw4" path="res://scenes/generic_text_panel.tscn" id="13_7i6dj"] -[ext_resource type="Script" path="res://scripts/mission/mission_ui.gd" id="13_xvw5w"] -[ext_resource type="Script" path="res://resources/generic_text_panel.resource.gd" id="14_76jlq"] -[ext_resource type="Script" path="res://scripts/mission/learning_panel.gd" id="14_q2ymb"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="14_vcrh8"] +[ext_resource type="Script" uid="uid://bxuxhmlcqp64g" path="res://scripts/mission/mission_ui.gd" id="13_xvw5w"] +[ext_resource type="Script" uid="uid://d1rme8o0ewiet" path="res://resources/generic_text_panel.resource.gd" id="14_76jlq"] +[ext_resource type="Script" uid="uid://52tdmmosdbpa" path="res://scripts/mission/learning_panel.gd" id="14_q2ymb"] +[ext_resource type="Script" uid="uid://c6f12a8vs3hp6" path="res://scripts/mission/mission_data.gd" id="14_vcrh8"] [ext_resource type="Resource" uid="uid://x5h4xutbldq3" path="res://mission/first_mission.tres" id="15_obmwc"] [ext_resource type="Resource" uid="uid://cjr36hqnmyn0x" path="res://mission/second_mission.tres" id="16_rl54y"] [ext_resource type="Resource" uid="uid://dykbopx8n3c3v" path="res://mission/third_mission.tres" id="17_rrdy6"] @@ -23,7 +23,7 @@ [ext_resource type="PackedScene" uid="uid://cgk66f6rg03mj" path="res://scenes/hud.tscn" id="18_hud"] [ext_resource type="PackedScene" uid="uid://bqjnp7uypupog" path="res://scenes/controls_panel.tscn" id="19_controls"] [ext_resource type="Resource" uid="uid://p3xwn2mp6bm6" path="res://mission/fifth_mission.tres" id="19_e8sub"] -[ext_resource type="Script" path="res://scripts/game_manager.gd" id="20_game_manager"] +[ext_resource type="Script" uid="uid://dlqco4kmwr3er" path="res://scripts/game_manager.gd" id="20_game_manager"] [ext_resource type="Resource" uid="uid://bv4r7ebpjdce4" path="res://mission/sixth_mission.tres" id="20_r0ysx"] [ext_resource type="PackedScene" uid="uid://b4s46k58ddpyc" path="res://scenes/sound_panel.tscn" id="21_sound_panel"] diff --git a/scenes/main.tscn142492988.tmp b/scenes/main.tscn142492988.tmp new file mode 100644 index 0000000..2fdadce --- /dev/null +++ b/scenes/main.tscn142492988.tmp @@ -0,0 +1,365 @@ +[gd_scene load_steps=33 format=3 uid="uid://vgwrcfy1qawf"] + +[ext_resource type="Script" uid="uid://snp3i7itqnqc" path="res://scripts/builder.gd" id="1_jybm7"] +[ext_resource type="Environment" uid="uid://jbptgqvstei3" path="res://scenes/main-environment.tres" id="1_yndf3"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_54v6r"] +[ext_resource type="Resource" uid="uid://dv14kkhb6umkv" path="res://structures/road-straight.tres" id="2_bwyku"] +[ext_resource type="Texture2D" uid="uid://cbk07cxgshg26" path="res://sprites/selector.png" id="4_wr1wv"] +[ext_resource type="Resource" uid="uid://cntgl86ianngh" path="res://structures/building-small-a.tres" id="5_v5o2m"] +[ext_resource type="Resource" uid="uid://ccb475jeg7ym5" path="res://structures/grass-trees.tres" id="6_fwsy4"] +[ext_resource type="Script" uid="uid://cu76h00erned0" path="res://scripts/view.gd" id="8_yovpv"] +[ext_resource type="Script" uid="uid://bnpqjt5n1s20m" path="res://scripts/mission/mission_manager.gd" id="10_oe3re"] +[ext_resource type="PackedScene" uid="uid://dmsy06s02tcw4" path="res://scenes/generic_text_panel.tscn" id="13_7i6dj"] +[ext_resource type="Script" uid="uid://bxuxhmlcqp64g" path="res://scripts/mission/mission_ui.gd" id="13_xvw5w"] +[ext_resource type="Script" uid="uid://d1rme8o0ewiet" path="res://resources/generic_text_panel.resource.gd" id="14_76jlq"] +[ext_resource type="Script" uid="uid://52tdmmosdbpa" path="res://scripts/mission/learning_panel.gd" id="14_q2ymb"] +[ext_resource type="Script" uid="uid://c6f12a8vs3hp6" path="res://scripts/mission/mission_data.gd" id="14_vcrh8"] +[ext_resource type="Resource" uid="uid://x5h4xutbldq3" path="res://mission/first_mission.tres" id="15_obmwc"] +[ext_resource type="Resource" uid="uid://cjr36hqnmyn0x" path="res://mission/second_mission.tres" id="16_rl54y"] +[ext_resource type="Resource" uid="uid://dykbopx8n3c3v" path="res://mission/third_mission.tres" id="17_rrdy6"] +[ext_resource type="FontFile" uid="uid://d0cxd77jybrcn" path="res://fonts/lilita_one_regular.ttf" id="17_vlub6"] +[ext_resource type="PackedScene" uid="uid://b4gkfwf4i3ydl" path="res://scenes/character.tscn" id="18_8lrh8"] +[ext_resource type="Resource" uid="uid://bho4qh41asyk1" path="res://mission/fourth_mission.tres" id="18_h4fpv"] +[ext_resource type="PackedScene" uid="uid://cgk66f6rg03mj" path="res://scenes/hud.tscn" id="18_hud"] +[ext_resource type="PackedScene" uid="uid://bqjnp7uypupog" path="res://scenes/controls_panel.tscn" id="19_controls"] +[ext_resource type="Resource" uid="uid://p3xwn2mp6bm6" path="res://mission/fifth_mission.tres" id="19_e8sub"] +[ext_resource type="Script" uid="uid://dlqco4kmwr3er" path="res://scripts/game_manager.gd" id="20_game_manager"] +[ext_resource type="Resource" uid="uid://bv4r7ebpjdce4" path="res://mission/sixth_mission.tres" id="20_r0ysx"] +[ext_resource type="PackedScene" uid="uid://b4s46k58ddpyc" path="res://scenes/sound_panel.tscn" id="21_sound_panel"] + +[sub_resource type="Resource" id="Resource_1gdbm"] +script = ExtResource("14_76jlq") +panel_type = 0 +title = "Welcome to Stem City " +body_text = "Hi League Community, + + Your goal is to build a thriving community from the ground up. As you complete missions, you'll unlock new structures to expand and improve your city. + + Each mission introduces important Math concepts used in urban planning and city management. You'll apply mathematics while watching your city grow. + +You are the very first group of students who get to test this. So keep in mind there will be bugs, but do note them. + +We are aware of the following bugs: +- Population count may be off by 1 +- Lighting Baking in Web Builds are too bright +- We don't restrict building off of roads which will cause workers not to reach buildings +- Building overlap +- No builders for Power Plant + + + Ready to start planning your city? Click Close to see the controls and begin your first mission! + + +" +button_text = "Close" + +[sub_resource type="Resource" id="Resource_ja86h"] +script = ExtResource("14_76jlq") +panel_type = 1 +title = "Welcome to Stem City" +body_text = "Congratulations, City Planner! + + You've completed all the guided missions and unlocked the full potential of Stem City. Your understanding of urban planning and STEM concepts has helped create a thriving community. + + But the journey doesn't end here! Continue expanding your city using all the structures you've unlocked. Experiment with different layouts, create new neighborhoods, and see how large you can grow your population. + + The future of Stem City is now in your hands - keep building and exploring! +" +button_text = "Close" + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mission"] +bg_color = Color(0.145098, 0.172549, 0.231373, 0.941176) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0.356863, 0.670588, 0.768627, 1) +corner_radius_top_left = 8 +corner_radius_top_right = 8 +corner_radius_bottom_right = 8 +corner_radius_bottom_left = 8 +shadow_size = 5 +shadow_offset = Vector2(2, 2) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_lsmd5"] +bg_color = Color(0.196078, 0.196078, 0.196078, 0.960784) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0.294118, 0.478431, 0.729412, 1) +corner_radius_top_left = 8 +corner_radius_top_right = 8 +corner_radius_bottom_right = 8 +corner_radius_bottom_left = 8 +shadow_size = 5 +shadow_offset = Vector2(3, 3) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_description"] +bg_color = Color(0.145098, 0.145098, 0.164706, 0.768627) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.294118, 0.478431, 0.729412, 0.301961) +corner_radius_top_left = 4 +corner_radius_top_right = 4 +corner_radius_bottom_right = 4 +corner_radius_bottom_left = 4 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_graph"] +bg_color = Color(0.117647, 0.137255, 0.160784, 0.768627) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.294118, 0.478431, 0.729412, 0.301961) +corner_radius_top_left = 4 +corner_radius_top_right = 4 +corner_radius_bottom_right = 4 +corner_radius_bottom_left = 4 + +[node name="Main" type="Node3D"] +script = ExtResource("20_game_manager") +intro_text_resource = SubResource("Resource_1gdbm") +outro_text_resource = SubResource("Resource_ja86h") + +[node name="Builder" type="Node3D" parent="." node_paths=PackedStringArray("selector", "selector_container", "view_camera", "gridmap", "cash_display")] +script = ExtResource("1_jybm7") +structures = Array[ExtResource("2_54v6r")]([ExtResource("2_bwyku"), ExtResource("5_v5o2m"), ExtResource("6_fwsy4")]) +selector = NodePath("Selector") +selector_container = NodePath("Selector/Container") +view_camera = NodePath("../View/Camera") +gridmap = NodePath("../GridMap") +cash_display = NodePath("../CanvasLayer/HUD/HBoxContainer/CashItem/CashLabel") + +[node name="Selector" type="Node3D" parent="Builder"] + +[node name="Sprite" type="Sprite3D" parent="Builder/Selector"] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0.06, 0) +texture = ExtResource("4_wr1wv") + +[node name="Container" type="Node3D" parent="Builder/Selector"] + +[node name="View" type="Node3D" parent="."] +transform = Transform3D(0.707107, -0.40558, 0.579228, 0, 0.819152, 0.573576, -0.707107, -0.40558, 0.579228, 0, 0, 0) +script = ExtResource("8_yovpv") + +[node name="Camera" type="Camera3D" parent="View"] +transform = Transform3D(1, 0, 0, 0, 1, 7.15256e-07, 0, 0, 1, 0, 27.98, 49.5918) +environment = ExtResource("1_yndf3") +fov = 20.0 + +[node name="GridMap" type="GridMap" parent="."] +cell_size = Vector3(1, 1, 1) +cell_center_x = false +cell_center_y = false +cell_center_z = false + +[node name="Sun" type="DirectionalLight3D" parent="."] +transform = Transform3D(-0.422618, -0.694272, 0.582563, 0, 0.642788, 0.766044, -0.906308, 0.323744, -0.271654, 0, 0, 0) +shadow_enabled = true +shadow_opacity = 0.75 + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="HUD" parent="CanvasLayer" instance=ExtResource("18_hud")] + +[node name="ControlsPanel" parent="CanvasLayer" instance=ExtResource("19_controls")] + +[node name="SoundPanel" parent="CanvasLayer" instance=ExtResource("21_sound_panel")] +anchors_preset = 8 + +[node name="GenericTextPanel" parent="CanvasLayer" instance=ExtResource("13_7i6dj")] +resource_data = ExtResource("14_76jlq") + +[node name="MissionManager" type="Node" parent="." node_paths=PackedStringArray("mission_ui", "builder")] +script = ExtResource("10_oe3re") +missions = Array[ExtResource("14_vcrh8")]([ExtResource("15_obmwc"), ExtResource("16_rl54y"), ExtResource("17_rrdy6"), ExtResource("18_h4fpv"), ExtResource("19_e8sub"), ExtResource("20_r0ysx")]) +mission_ui = NodePath("MissionPanel") +builder = NodePath("../Builder") +character_scene = ExtResource("18_8lrh8") + +[node name="MissionPanel" type="PanelContainer" parent="MissionManager" node_paths=PackedStringArray("mission_title_label", "mission_description_label", "objectives_container")] +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -450.0 +offset_top = 20.0 +offset_right = -20.0 +grow_horizontal = 0 +size_flags_vertical = 0 +theme_override_styles/panel = SubResource("StyleBoxFlat_mission") +script = ExtResource("13_xvw5w") +mission_title_label = NodePath("MarginContainer/VBoxContainer/MissionTitleLabel") +mission_description_label = NodePath("MarginContainer/VBoxContainer/MissionDescriptionLabel") +objectives_container = NodePath("MarginContainer/VBoxContainer/ObjectivesContainer") + +[node name="MarginContainer" type="MarginContainer" parent="MissionManager/MissionPanel"] +layout_mode = 2 +theme_override_constants/margin_left = 20 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 + +[node name="VBoxContainer" type="VBoxContainer" parent="MissionManager/MissionPanel/MarginContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/separation = 15 + +[node name="MissionTitleLabel" type="Label" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_fonts/font = ExtResource("17_vlub6") +theme_override_font_sizes/font_size = 24 +text = "Mission Title" +horizontal_alignment = 1 + +[node name="HSeparator" type="HSeparator" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="MissionDescriptionLabel" type="Label" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 1 +theme_override_font_sizes/font_size = 16 +text = "Mission description goes here..." +autowrap_mode = 2 +text_overrun_behavior = 4 + +[node name="HSeparator2" type="HSeparator" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="ObjectivesLabel" type="Label" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_colors/font_color = Color(0.678431, 0.847059, 1, 1) +theme_override_font_sizes/font_size = 18 +text = "Objectives:" + +[node name="ObjectivesContainer" type="VBoxContainer" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/separation = 10 + +[node name="LearningPanel" type="PanelContainer" parent="MissionManager"] +visible = false +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 50.0 +offset_top = 50.0 +offset_right = -50.0 +offset_bottom = -50.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_styles/panel = SubResource("StyleBoxFlat_lsmd5") +script = ExtResource("14_q2ymb") + +[node name="MarginContainer" type="MarginContainer" parent="MissionManager/LearningPanel"] +layout_mode = 2 +theme_override_constants/margin_left = 30 +theme_override_constants/margin_top = 30 +theme_override_constants/margin_right = 30 +theme_override_constants/margin_bottom = 30 + +[node name="VBoxContainer" type="VBoxContainer" parent="MissionManager/LearningPanel/MarginContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/separation = 20 + +[node name="TitleLabel" type="Label" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_fonts/font = ExtResource("17_vlub6") +theme_override_font_sizes/font_size = 32 +text = "Learning Module" +horizontal_alignment = 1 + +[node name="HSeparator" type="HSeparator" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="DescriptionPanel" type="PanelContainer" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +size_flags_stretch_ratio = 0.5 +theme_override_styles/panel = SubResource("StyleBoxFlat_description") + +[node name="MarginContainer" type="MarginContainer" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/DescriptionPanel"] +layout_mode = 2 +theme_override_constants/margin_left = 15 +theme_override_constants/margin_top = 15 +theme_override_constants/margin_right = 15 +theme_override_constants/margin_bottom = 15 + +[node name="DescriptionLabel" type="Label" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/DescriptionPanel/MarginContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_font_sizes/font_size = 20 +text = "Description goes here..." +autowrap_mode = 2 + +[node name="GraphTitle" type="Label" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 24 +text = "Graph:" +horizontal_alignment = 1 + +[node name="GraphContainer" type="Panel" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +custom_minimum_size = Vector2(0, 300) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +size_flags_stretch_ratio = 2.0 +theme_override_styles/panel = SubResource("StyleBoxFlat_graph") + +[node name="AnswerContainer" type="VBoxContainer" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="QuestionLabel" type="Label" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/AnswerContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 18 +text = "How many workers do we need to build 10 houses in a week?" +horizontal_alignment = 1 + +[node name="AnswerField" type="LineEdit" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/AnswerContainer"] +custom_minimum_size = Vector2(150, 40) +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_font_sizes/font_size = 18 +placeholder_text = "Enter answer" +alignment = 1 +max_length = 5 + +[node name="CheckButton" type="Button" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/AnswerContainer"] +custom_minimum_size = Vector2(150, 40) +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_font_sizes/font_size = 16 +text = "Check Answer" + +[node name="FeedbackLabel" type="Label" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/AnswerContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_font_sizes/font_size = 18 +horizontal_alignment = 1 +autowrap_mode = 2 +text_overrun_behavior = 3 +max_lines_visible = 6 + +[node name="HBoxContainer" type="HBoxContainer" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +alignment = 1 + +[node name="CompleteButton" type="Button" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(200, 50) +layout_mode = 2 +theme_override_font_sizes/font_size = 18 +disabled = true +text = "Complete" + +[node name="ObjectiveLabel" type="Label" parent="MissionManager"] +offset_right = 40.0 +offset_bottom = 23.0 + +[connection signal="all_missions_completed" from="MissionManager" to="." method="_on_mission_manager_all_missions_completed"] +[connection signal="pressed" from="MissionManager/LearningPanel/MarginContainer/VBoxContainer/HBoxContainer/CompleteButton" to="MissionManager/LearningPanel" method="_on_complete_button_pressed"] diff --git a/scenes/main.tscn342278772.tmp b/scenes/main.tscn342278772.tmp new file mode 100644 index 0000000..2fdadce --- /dev/null +++ b/scenes/main.tscn342278772.tmp @@ -0,0 +1,365 @@ +[gd_scene load_steps=33 format=3 uid="uid://vgwrcfy1qawf"] + +[ext_resource type="Script" uid="uid://snp3i7itqnqc" path="res://scripts/builder.gd" id="1_jybm7"] +[ext_resource type="Environment" uid="uid://jbptgqvstei3" path="res://scenes/main-environment.tres" id="1_yndf3"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_54v6r"] +[ext_resource type="Resource" uid="uid://dv14kkhb6umkv" path="res://structures/road-straight.tres" id="2_bwyku"] +[ext_resource type="Texture2D" uid="uid://cbk07cxgshg26" path="res://sprites/selector.png" id="4_wr1wv"] +[ext_resource type="Resource" uid="uid://cntgl86ianngh" path="res://structures/building-small-a.tres" id="5_v5o2m"] +[ext_resource type="Resource" uid="uid://ccb475jeg7ym5" path="res://structures/grass-trees.tres" id="6_fwsy4"] +[ext_resource type="Script" uid="uid://cu76h00erned0" path="res://scripts/view.gd" id="8_yovpv"] +[ext_resource type="Script" uid="uid://bnpqjt5n1s20m" path="res://scripts/mission/mission_manager.gd" id="10_oe3re"] +[ext_resource type="PackedScene" uid="uid://dmsy06s02tcw4" path="res://scenes/generic_text_panel.tscn" id="13_7i6dj"] +[ext_resource type="Script" uid="uid://bxuxhmlcqp64g" path="res://scripts/mission/mission_ui.gd" id="13_xvw5w"] +[ext_resource type="Script" uid="uid://d1rme8o0ewiet" path="res://resources/generic_text_panel.resource.gd" id="14_76jlq"] +[ext_resource type="Script" uid="uid://52tdmmosdbpa" path="res://scripts/mission/learning_panel.gd" id="14_q2ymb"] +[ext_resource type="Script" uid="uid://c6f12a8vs3hp6" path="res://scripts/mission/mission_data.gd" id="14_vcrh8"] +[ext_resource type="Resource" uid="uid://x5h4xutbldq3" path="res://mission/first_mission.tres" id="15_obmwc"] +[ext_resource type="Resource" uid="uid://cjr36hqnmyn0x" path="res://mission/second_mission.tres" id="16_rl54y"] +[ext_resource type="Resource" uid="uid://dykbopx8n3c3v" path="res://mission/third_mission.tres" id="17_rrdy6"] +[ext_resource type="FontFile" uid="uid://d0cxd77jybrcn" path="res://fonts/lilita_one_regular.ttf" id="17_vlub6"] +[ext_resource type="PackedScene" uid="uid://b4gkfwf4i3ydl" path="res://scenes/character.tscn" id="18_8lrh8"] +[ext_resource type="Resource" uid="uid://bho4qh41asyk1" path="res://mission/fourth_mission.tres" id="18_h4fpv"] +[ext_resource type="PackedScene" uid="uid://cgk66f6rg03mj" path="res://scenes/hud.tscn" id="18_hud"] +[ext_resource type="PackedScene" uid="uid://bqjnp7uypupog" path="res://scenes/controls_panel.tscn" id="19_controls"] +[ext_resource type="Resource" uid="uid://p3xwn2mp6bm6" path="res://mission/fifth_mission.tres" id="19_e8sub"] +[ext_resource type="Script" uid="uid://dlqco4kmwr3er" path="res://scripts/game_manager.gd" id="20_game_manager"] +[ext_resource type="Resource" uid="uid://bv4r7ebpjdce4" path="res://mission/sixth_mission.tres" id="20_r0ysx"] +[ext_resource type="PackedScene" uid="uid://b4s46k58ddpyc" path="res://scenes/sound_panel.tscn" id="21_sound_panel"] + +[sub_resource type="Resource" id="Resource_1gdbm"] +script = ExtResource("14_76jlq") +panel_type = 0 +title = "Welcome to Stem City " +body_text = "Hi League Community, + + Your goal is to build a thriving community from the ground up. As you complete missions, you'll unlock new structures to expand and improve your city. + + Each mission introduces important Math concepts used in urban planning and city management. You'll apply mathematics while watching your city grow. + +You are the very first group of students who get to test this. So keep in mind there will be bugs, but do note them. + +We are aware of the following bugs: +- Population count may be off by 1 +- Lighting Baking in Web Builds are too bright +- We don't restrict building off of roads which will cause workers not to reach buildings +- Building overlap +- No builders for Power Plant + + + Ready to start planning your city? Click Close to see the controls and begin your first mission! + + +" +button_text = "Close" + +[sub_resource type="Resource" id="Resource_ja86h"] +script = ExtResource("14_76jlq") +panel_type = 1 +title = "Welcome to Stem City" +body_text = "Congratulations, City Planner! + + You've completed all the guided missions and unlocked the full potential of Stem City. Your understanding of urban planning and STEM concepts has helped create a thriving community. + + But the journey doesn't end here! Continue expanding your city using all the structures you've unlocked. Experiment with different layouts, create new neighborhoods, and see how large you can grow your population. + + The future of Stem City is now in your hands - keep building and exploring! +" +button_text = "Close" + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mission"] +bg_color = Color(0.145098, 0.172549, 0.231373, 0.941176) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0.356863, 0.670588, 0.768627, 1) +corner_radius_top_left = 8 +corner_radius_top_right = 8 +corner_radius_bottom_right = 8 +corner_radius_bottom_left = 8 +shadow_size = 5 +shadow_offset = Vector2(2, 2) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_lsmd5"] +bg_color = Color(0.196078, 0.196078, 0.196078, 0.960784) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0.294118, 0.478431, 0.729412, 1) +corner_radius_top_left = 8 +corner_radius_top_right = 8 +corner_radius_bottom_right = 8 +corner_radius_bottom_left = 8 +shadow_size = 5 +shadow_offset = Vector2(3, 3) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_description"] +bg_color = Color(0.145098, 0.145098, 0.164706, 0.768627) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.294118, 0.478431, 0.729412, 0.301961) +corner_radius_top_left = 4 +corner_radius_top_right = 4 +corner_radius_bottom_right = 4 +corner_radius_bottom_left = 4 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_graph"] +bg_color = Color(0.117647, 0.137255, 0.160784, 0.768627) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.294118, 0.478431, 0.729412, 0.301961) +corner_radius_top_left = 4 +corner_radius_top_right = 4 +corner_radius_bottom_right = 4 +corner_radius_bottom_left = 4 + +[node name="Main" type="Node3D"] +script = ExtResource("20_game_manager") +intro_text_resource = SubResource("Resource_1gdbm") +outro_text_resource = SubResource("Resource_ja86h") + +[node name="Builder" type="Node3D" parent="." node_paths=PackedStringArray("selector", "selector_container", "view_camera", "gridmap", "cash_display")] +script = ExtResource("1_jybm7") +structures = Array[ExtResource("2_54v6r")]([ExtResource("2_bwyku"), ExtResource("5_v5o2m"), ExtResource("6_fwsy4")]) +selector = NodePath("Selector") +selector_container = NodePath("Selector/Container") +view_camera = NodePath("../View/Camera") +gridmap = NodePath("../GridMap") +cash_display = NodePath("../CanvasLayer/HUD/HBoxContainer/CashItem/CashLabel") + +[node name="Selector" type="Node3D" parent="Builder"] + +[node name="Sprite" type="Sprite3D" parent="Builder/Selector"] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0.06, 0) +texture = ExtResource("4_wr1wv") + +[node name="Container" type="Node3D" parent="Builder/Selector"] + +[node name="View" type="Node3D" parent="."] +transform = Transform3D(0.707107, -0.40558, 0.579228, 0, 0.819152, 0.573576, -0.707107, -0.40558, 0.579228, 0, 0, 0) +script = ExtResource("8_yovpv") + +[node name="Camera" type="Camera3D" parent="View"] +transform = Transform3D(1, 0, 0, 0, 1, 7.15256e-07, 0, 0, 1, 0, 27.98, 49.5918) +environment = ExtResource("1_yndf3") +fov = 20.0 + +[node name="GridMap" type="GridMap" parent="."] +cell_size = Vector3(1, 1, 1) +cell_center_x = false +cell_center_y = false +cell_center_z = false + +[node name="Sun" type="DirectionalLight3D" parent="."] +transform = Transform3D(-0.422618, -0.694272, 0.582563, 0, 0.642788, 0.766044, -0.906308, 0.323744, -0.271654, 0, 0, 0) +shadow_enabled = true +shadow_opacity = 0.75 + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="HUD" parent="CanvasLayer" instance=ExtResource("18_hud")] + +[node name="ControlsPanel" parent="CanvasLayer" instance=ExtResource("19_controls")] + +[node name="SoundPanel" parent="CanvasLayer" instance=ExtResource("21_sound_panel")] +anchors_preset = 8 + +[node name="GenericTextPanel" parent="CanvasLayer" instance=ExtResource("13_7i6dj")] +resource_data = ExtResource("14_76jlq") + +[node name="MissionManager" type="Node" parent="." node_paths=PackedStringArray("mission_ui", "builder")] +script = ExtResource("10_oe3re") +missions = Array[ExtResource("14_vcrh8")]([ExtResource("15_obmwc"), ExtResource("16_rl54y"), ExtResource("17_rrdy6"), ExtResource("18_h4fpv"), ExtResource("19_e8sub"), ExtResource("20_r0ysx")]) +mission_ui = NodePath("MissionPanel") +builder = NodePath("../Builder") +character_scene = ExtResource("18_8lrh8") + +[node name="MissionPanel" type="PanelContainer" parent="MissionManager" node_paths=PackedStringArray("mission_title_label", "mission_description_label", "objectives_container")] +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -450.0 +offset_top = 20.0 +offset_right = -20.0 +grow_horizontal = 0 +size_flags_vertical = 0 +theme_override_styles/panel = SubResource("StyleBoxFlat_mission") +script = ExtResource("13_xvw5w") +mission_title_label = NodePath("MarginContainer/VBoxContainer/MissionTitleLabel") +mission_description_label = NodePath("MarginContainer/VBoxContainer/MissionDescriptionLabel") +objectives_container = NodePath("MarginContainer/VBoxContainer/ObjectivesContainer") + +[node name="MarginContainer" type="MarginContainer" parent="MissionManager/MissionPanel"] +layout_mode = 2 +theme_override_constants/margin_left = 20 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 + +[node name="VBoxContainer" type="VBoxContainer" parent="MissionManager/MissionPanel/MarginContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/separation = 15 + +[node name="MissionTitleLabel" type="Label" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_fonts/font = ExtResource("17_vlub6") +theme_override_font_sizes/font_size = 24 +text = "Mission Title" +horizontal_alignment = 1 + +[node name="HSeparator" type="HSeparator" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="MissionDescriptionLabel" type="Label" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 1 +theme_override_font_sizes/font_size = 16 +text = "Mission description goes here..." +autowrap_mode = 2 +text_overrun_behavior = 4 + +[node name="HSeparator2" type="HSeparator" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="ObjectivesLabel" type="Label" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_colors/font_color = Color(0.678431, 0.847059, 1, 1) +theme_override_font_sizes/font_size = 18 +text = "Objectives:" + +[node name="ObjectivesContainer" type="VBoxContainer" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/separation = 10 + +[node name="LearningPanel" type="PanelContainer" parent="MissionManager"] +visible = false +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 50.0 +offset_top = 50.0 +offset_right = -50.0 +offset_bottom = -50.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_styles/panel = SubResource("StyleBoxFlat_lsmd5") +script = ExtResource("14_q2ymb") + +[node name="MarginContainer" type="MarginContainer" parent="MissionManager/LearningPanel"] +layout_mode = 2 +theme_override_constants/margin_left = 30 +theme_override_constants/margin_top = 30 +theme_override_constants/margin_right = 30 +theme_override_constants/margin_bottom = 30 + +[node name="VBoxContainer" type="VBoxContainer" parent="MissionManager/LearningPanel/MarginContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/separation = 20 + +[node name="TitleLabel" type="Label" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_fonts/font = ExtResource("17_vlub6") +theme_override_font_sizes/font_size = 32 +text = "Learning Module" +horizontal_alignment = 1 + +[node name="HSeparator" type="HSeparator" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="DescriptionPanel" type="PanelContainer" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +size_flags_stretch_ratio = 0.5 +theme_override_styles/panel = SubResource("StyleBoxFlat_description") + +[node name="MarginContainer" type="MarginContainer" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/DescriptionPanel"] +layout_mode = 2 +theme_override_constants/margin_left = 15 +theme_override_constants/margin_top = 15 +theme_override_constants/margin_right = 15 +theme_override_constants/margin_bottom = 15 + +[node name="DescriptionLabel" type="Label" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/DescriptionPanel/MarginContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_font_sizes/font_size = 20 +text = "Description goes here..." +autowrap_mode = 2 + +[node name="GraphTitle" type="Label" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 24 +text = "Graph:" +horizontal_alignment = 1 + +[node name="GraphContainer" type="Panel" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +custom_minimum_size = Vector2(0, 300) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +size_flags_stretch_ratio = 2.0 +theme_override_styles/panel = SubResource("StyleBoxFlat_graph") + +[node name="AnswerContainer" type="VBoxContainer" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="QuestionLabel" type="Label" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/AnswerContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 18 +text = "How many workers do we need to build 10 houses in a week?" +horizontal_alignment = 1 + +[node name="AnswerField" type="LineEdit" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/AnswerContainer"] +custom_minimum_size = Vector2(150, 40) +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_font_sizes/font_size = 18 +placeholder_text = "Enter answer" +alignment = 1 +max_length = 5 + +[node name="CheckButton" type="Button" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/AnswerContainer"] +custom_minimum_size = Vector2(150, 40) +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_font_sizes/font_size = 16 +text = "Check Answer" + +[node name="FeedbackLabel" type="Label" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/AnswerContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_font_sizes/font_size = 18 +horizontal_alignment = 1 +autowrap_mode = 2 +text_overrun_behavior = 3 +max_lines_visible = 6 + +[node name="HBoxContainer" type="HBoxContainer" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer"] +layout_mode = 2 +alignment = 1 + +[node name="CompleteButton" type="Button" parent="MissionManager/LearningPanel/MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(200, 50) +layout_mode = 2 +theme_override_font_sizes/font_size = 18 +disabled = true +text = "Complete" + +[node name="ObjectiveLabel" type="Label" parent="MissionManager"] +offset_right = 40.0 +offset_bottom = 23.0 + +[connection signal="all_missions_completed" from="MissionManager" to="." method="_on_mission_manager_all_missions_completed"] +[connection signal="pressed" from="MissionManager/LearningPanel/MarginContainer/VBoxContainer/HBoxContainer/CompleteButton" to="MissionManager/LearningPanel" method="_on_complete_button_pressed"] diff --git a/scenes/mission_panel.tscn b/scenes/mission_panel.tscn index fb794e6..1f12a18 100644 --- a/scenes/mission_panel.tscn +++ b/scenes/mission_panel.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://cam5blhxixlnb"] -[ext_resource type="Script" path="res://scripts/mission/mission_ui.gd" id="1_wl28p"] +[ext_resource type="Script" uid="uid://bxuxhmlcqp64g" path="res://scripts/mission/mission_ui.gd" id="1_wl28p"] [node name="Control" type="Control"] layout_mode = 3 diff --git a/scenes/pathfinding.tscn b/scenes/pathfinding.tscn index ad87827..5c94820 100644 --- a/scenes/pathfinding.tscn +++ b/scenes/pathfinding.tscn @@ -1,13 +1,15 @@ [gd_scene load_steps=7 format=3 uid="uid://c6qxpgne58hon"] -[ext_resource type="PackedScene" uid="uid://b4tgtg0j2dgh8" path="res://models/road-straight.glb" id="1_e1p8p"] -[ext_resource type="Script" uid="uid://dm10exi6726ue" path="res://scripts/pathfinding.gd" id="2_3elxe"] +[ext_resource type="Script" uid="uid://boe3mr1ujtk2s" path="res://scripts/pathfinding.gd" id="2_3elxe"] [ext_resource type="PackedScene" uid="uid://h2jjkvc4edsp" path="res://people/character-female-d.glb" id="3_8fawu"] [sub_resource type="NavigationMesh" id="NavigationMesh_h3aaa"] [sub_resource type="ArrayMesh" id="ArrayMesh_3nstm"] +[sub_resource type="Resource" id="Resource_a0y0n"] +metadata/__load_path__ = "res://models/road-straight.glb" + [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_sokgf"] radius = 0.343066 height = 1.11949 @@ -21,7 +23,7 @@ navigation_mesh = SubResource("NavigationMesh_h3aaa") mesh = SubResource("ArrayMesh_3nstm") skeleton = NodePath("../..") -[node name="road-straight" parent="NavigationRegion3D/MeshInstance3D" instance=ExtResource("1_e1p8p")] +[node name="road-straight" parent="NavigationRegion3D/MeshInstance3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.280188, 0.345876, 0.507542) [node name="CharacterBody3D" type="CharacterBody3D" parent="NavigationRegion3D"] diff --git a/scenes/pathing.tscn b/scenes/pathing.tscn index ef2645a..7e21c5c 100644 --- a/scenes/pathing.tscn +++ b/scenes/pathing.tscn @@ -1,12 +1,13 @@ [gd_scene load_steps=3 format=3 uid="uid://b3kdhu8jq41iq"] -[ext_resource type="PackedScene" uid="uid://b4tgtg0j2dgh8" path="res://models/road-straight.glb" id="2_kgyfd"] - [sub_resource type="NavigationMesh" id="NavigationMesh_qdlwc"] vertices = PackedVector3Array(-1.27868, 0.435088, -1.17848, -1.27868, 0.435088, 1.32152, 1.22132, 0.435088, 1.32152, 1.22132, 0.435088, -1.17848) polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1)] agent_radius = 0.25 +[sub_resource type="Resource" id="Resource_dvt8f"] +metadata/__load_path__ = "res://models/road-straight.glb" + [node name="NavigationRegion3D" type="NavigationRegion3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0819869, 0) navigation_mesh = SubResource("NavigationMesh_qdlwc") @@ -14,7 +15,7 @@ navigation_mesh = SubResource("NavigationMesh_qdlwc") [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(0.030951, -0.708895, 0.704634, -0.0307357, 0.703964, 0.709571, -0.999048, -0.0436194, -3.08005e-08, 2.29147, 2.02866, 0) -[node name="road-straight" parent="." instance=ExtResource("2_kgyfd")] +[node name="road-straight" parent="."] transform = Transform3D(3, 0, 0, 0, 3, 0, 0, 0, 3, -0.0286824, -0.0649124, 0.0715187) [editable path="road-straight"] diff --git a/scenes/sound_panel.tscn b/scenes/sound_panel.tscn index aa20768..e8f5d04 100644 --- a/scenes/sound_panel.tscn +++ b/scenes/sound_panel.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=7 format=3 uid="uid://b4s46k58ddpyc"] -[ext_resource type="Script" uid="uid://danypf5uo4vob" path="res://scripts/sound_panel.gd" id="1_c6ykp"] +[ext_resource type="Script" uid="uid://wxdjmv1kdo1r" path="res://scripts/sound_panel.gd" id="1_c6ykp"] [ext_resource type="FontFile" uid="uid://d0cxd77jybrcn" path="res://fonts/lilita_one_regular.ttf" id="2_kpgjp"] [ext_resource type="Texture2D" uid="uid://hx3maksi7ma" path="res://sprites/unmuted.png" id="3_c3hj5"] [ext_resource type="Texture2D" uid="uid://djxd33vvtr58p" path="res://sprites/muted.png" id="4_jdlh2"] diff --git a/scenes/unlocked_items_panel.tscn b/scenes/unlocked_items_panel.tscn index 67b6493..f18c562 100644 --- a/scenes/unlocked_items_panel.tscn +++ b/scenes/unlocked_items_panel.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=3 uid="uid://cc3c30ioo11if"] -[ext_resource type="Script" path="res://scripts/mission/unlocked_items_panel.gd" id="1_j0tih"] +[ext_resource type="Script" uid="uid://uftqbpj0c2u8" path="res://scripts/mission/unlocked_items_panel.gd" id="1_j0tih"] [ext_resource type="FontFile" uid="uid://d0cxd77jybrcn" path="res://fonts/lilita_one_regular.ttf" id="2_exmr5"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2q5cr"] diff --git a/scripts/NavigationNPC.gd.uid b/scripts/NavigationNPC.gd.uid new file mode 100644 index 0000000..b237800 --- /dev/null +++ b/scripts/NavigationNPC.gd.uid @@ -0,0 +1 @@ +uid://buvxhq2ipa8gt diff --git a/scripts/attribution_screen.gd.uid b/scripts/attribution_screen.gd.uid new file mode 100644 index 0000000..8db81d8 --- /dev/null +++ b/scripts/attribution_screen.gd.uid @@ -0,0 +1 @@ +uid://b1014mouu2vqu diff --git a/scripts/audio_bridge.gd.uid b/scripts/audio_bridge.gd.uid new file mode 100644 index 0000000..b340e2e --- /dev/null +++ b/scripts/audio_bridge.gd.uid @@ -0,0 +1 @@ +uid://csqc100kx2nsm diff --git a/scripts/builder.gd b/scripts/builder.gd index 550d60a..b0125b5 100644 --- a/scripts/builder.gd +++ b/scripts/builder.gd @@ -55,22 +55,24 @@ func _ready(): # Sound effects now handled in game_manager.gd for structure in structures: - + if structure.model == null: + continue + var id = mesh_library.get_last_unused_item_id() mesh_library.create_item(id) mesh_library.set_item_mesh(id, get_mesh(structure.model)) # Apply appropriate scaling for buildings and roads - var transform = Transform3D() - if structure.model.resource_path.contains("power_plant"): + var _xform = Transform3D() + if structure.model.resource_path != null and structure.model.resource_path.contains("power_plant"): # Scale power plant model to be much smaller (0.5x) - transform = transform.scaled(Vector3(0.5, 0.5, 0.5)) + _xform = _xform.scaled(Vector3(0.5, 0.5, 0.5)) elif structure.type == Structure.StructureType.RESIDENTIAL_BUILDING or structure.type == Structure.StructureType.ROAD: # Scale buildings and roads to be consistent (3x) - transform = transform.scaled(Vector3(3.0, 3.0, 3.0)) + _xform = _xform.scaled(Vector3(3.0, 3.0, 3.0)) - mesh_library.set_item_mesh_transform(id, transform) + mesh_library.set_item_mesh_transform(id, _xform) gridmap.mesh_library = mesh_library @@ -80,7 +82,10 @@ func _ready(): if "unlocked" in structures[i] and structures[i].unlocked: index = i found_unlocked = true - print("Starting with unlocked structure: " + structures[i].model.resource_path) + if structures[i].model != null: + print("Starting with unlocked structure: " + structures[i].model.resource_path) + else: + print("Starting with unlocked structure: (no model)") break if not found_unlocked: @@ -133,7 +138,7 @@ func is_mouse_over_ui() -> bool: # Get HUD dimensions for debug var hud = get_node_or_null("/root/Main/CanvasLayer/HUD") if hud: - var hud_rect = hud.get_global_rect() + var _hud_rect = hud.get_global_rect() # Get HBoxContainer dimensions - this is the actual content area var hbox = hud.get_node_or_null("HBoxContainer") @@ -173,6 +178,9 @@ func is_mouse_over_ui() -> bool: func get_mesh(packed_scene): # Instantiate the scene to access its properties + if packed_scene == null: + return + var scene_instance = packed_scene.instantiate() var mesh_instance = null @@ -227,13 +235,13 @@ func action_build(gridmap_position): # For residential buildings, we use the construction manager in mission 3 var is_residential = structures[index].type == Structure.StructureType.RESIDENTIAL_BUILDING # For power plants, we handle them specially - var is_power_plant = structures[index].model.resource_path.contains("power_plant") + var is_power_plant = structures[index].model != null and structures[index].model.resource_path.contains("power_plant") # For grass and trees (terrain), we need special handling var is_terrain = structures[index].type == Structure.StructureType.TERRAIN - # Check if we're in mission 3 (when we should use construction workers) + # Function to check if we're in mission 3 (when we should use construction workers) var use_worker_construction = true - var mission_manager = get_node_or_null("/root/Main/MissionManager") + var _mission_manager = get_node_or_null("/root/Main/MissionManager") # Sound effects are handled via game_manager.gd through the structure_placed signal if is_road: @@ -355,7 +363,7 @@ func action_demolish(gridmap_position): # Check for building model in the scene as a direct child of builder var building_model_name = "Building_" + str(int(gridmap_position.x)) + "_" + str(int(gridmap_position.z)) - var has_building_model = has_node(building_model_name) + var _has_building_model = has_node(building_model_name) # Store structure index before removal for signaling var structure_index = -1 @@ -423,7 +431,7 @@ func action_demolish(gridmap_position): # This function is no longer needed since we're using a single NavRegion3D # Keeping it for compatibility, but it doesn't do anything now -func remove_navigation_region(position: Vector3): +func remove_navigation_region(_pos: Vector3): # With our new approach using a single nav region, we just rebake # the entire navigation mesh when roads are added or removed @@ -480,15 +488,31 @@ func update_structure(): for n in selector_container.get_children(): selector_container.remove_child(n) + # Check if we have a valid structure and model + if index < 0 or index >= structures.size(): + print("Invalid structure index: ", index) + return + + if not structures[index].model: + # print("No model found for structure at index: ", index) + return + # Create new structure preview in selector var _model = structures[index].model.instantiate() + if not _model: + print("Failed to instantiate model for structure at index: ", index) + return + selector_container.add_child(_model) # Get reference to the selector sprite var selector_sprite = selector.get_node("Sprite") + if not selector_sprite: + print("No Sprite node found in selector") + return # Apply appropriate scaling based on structure type - if structures[index].model.resource_path.contains("power_plant"): + if structures[index].model.resource_path != null and structures[index].model.resource_path.contains("power_plant"): # Scale power plant model to be much smaller (0.5x) _model.scale = Vector3(0.5, 0.5, 0.5) # Center the power plant model within the selector @@ -496,7 +520,7 @@ func update_structure(): elif (structures[index].type == Structure.StructureType.RESIDENTIAL_BUILDING or structures[index].type == Structure.StructureType.ROAD or structures[index].type == Structure.StructureType.TERRAIN - or structures[index].model.resource_path.contains("grass")): + or (structures[index].model.resource_path != null and structures[index].model.resource_path.contains("grass"))): # Scale buildings, roads, and decorative terrain to match (3x) _model.scale = Vector3(3.0, 3.0, 3.0) _model.position.y += 0.0 # No need for Y adjustment with scaling @@ -514,13 +538,13 @@ func update_cash(): cash_display.text = "$" + str(map.cash) # Function to add a road model as a child of the navigation region -func _add_road_to_navregion(position: Vector3, structure_index: int): +func _add_road_to_navregion(_pos: Vector3, structure_index: int): # Make sure we have a navigation region if not nav_region: setup_navigation_region() # Create a unique name for this road based on its position - var road_name = "Road_" + str(int(position.x)) + "_" + str(int(position.z)) + var road_name = "Road_" + str(int(_pos.x)) + "_" + str(int(_pos.z)) # Check if a road with this name already exists if nav_region.has_node(road_name): @@ -528,7 +552,7 @@ func _add_road_to_navregion(position: Vector3, structure_index: int): # Instantiate the road model - get the actual model based on road type var road_model - var model_path = structures[structure_index].model.resource_path + var model_path = structures[structure_index].model.resource_path if structures[structure_index].model != null else "" if model_path.contains("road-straight"): # Use the specific road-straight model that works with navmesh road_model = load("res://models/road-straight.glb").instantiate() @@ -545,27 +569,27 @@ func _add_road_to_navregion(position: Vector3, structure_index: int): nav_region.add_child(road_model) # Create the transform directly matching the exact one from pathing.tscn - var transform = Transform3D() + var _transform = Transform3D() # Set scale first - transform.basis = Basis().scaled(Vector3(3.0, 3.0, 3.0)) + _transform.basis = Basis().scaled(Vector3(3.0, 3.0, 3.0)) # Then apply rotation from the selector to preserve the rotation the player chose - transform.basis = transform.basis * selector.basis + _transform.basis = _transform.basis * selector.basis # Set position - transform.origin = position - transform.origin.y = -0.065 # From the pathing scene y offset + _transform.origin = _pos + _transform.origin.y = -0.065 # From the pathing scene y offset # Apply the complete transform in one go - road_model.transform = transform + road_model.transform = _transform # Function to add a power plant as a direct child of the builder -func _add_power_plant(position: Vector3, structure_index: int): +func _add_power_plant(_pos: Vector3, structure_index: int): # Create a unique name for this power plant based on its position - var power_plant_name = "PowerPlant_" + str(int(position.x)) + "_" + str(int(position.z)) + var power_plant_name = "PowerPlant_" + str(int(_pos.x)) + "_" + str(int(_pos.z)) # Check if a power plant with this name already exists if has_node(power_plant_name): @@ -579,30 +603,30 @@ func _add_power_plant(position: Vector3, structure_index: int): add_child(power_plant_model) # Create the transform - var transform = Transform3D() + var _transform = Transform3D() # Set scale (using the smaller 0.5x scale) - transform.basis = Basis().scaled(Vector3(0.5, 0.5, 0.5)) + _transform.basis = Basis().scaled(Vector3(0.5, 0.5, 0.5)) # Apply rotation from the selector to preserve the rotation the player chose - transform.basis = transform.basis * selector.basis + _transform.basis = _transform.basis * selector.basis # Set position with offset to center the model at the grid position - transform.origin = position + _transform.origin = _pos # Apply position offset to center the model (matching the preview) # These offsets need to be transformed based on the current rotation var offset = selector.basis * Vector3(0.25, 0, -0.25) - transform.origin += offset + _transform.origin += offset # Apply the complete transform in one go - power_plant_model.transform = transform + power_plant_model.transform = _transform # Function to remove a power plant -func _remove_power_plant(position: Vector3): +func _remove_power_plant(_pos: Vector3): # Get the power plant name based on its position - var power_plant_name = "PowerPlant_" + str(int(position.x)) + "_" + str(int(position.z)) + var power_plant_name = "PowerPlant_" + str(int(_pos.x)) + "_" + str(int(_pos.z)) # Check if a power plant with this name exists if has_node(power_plant_name): @@ -615,21 +639,21 @@ func _remove_power_plant(position: Vector3): pass # Function to remove a resident model when a residential building is demolished -func _remove_resident_for_building(position: Vector3): +func _remove_resident_for_building(_pos: Vector3): # First, check if we have a nav region reference if not nav_region and has_node("NavRegion3D"): nav_region = get_node("NavRegion3D") if nav_region: # Look for resident with matching position in the name - var resident_name = "Resident_" + str(int(position.x)) + "_" + str(int(position.z)) + var resident_name = "Resident_" + str(int(_pos.x)) + "_" + str(int(_pos.z)) # First try to find by exact name - var found = false + var _found = false for child in nav_region.get_children(): if child.name.begins_with(resident_name): child.queue_free() - found = true + _found = true # Update the HUD population count var hud = get_node_or_null("/root/Main/CanvasLayer/HUD") @@ -653,9 +677,9 @@ func _update_mission_objective_on_demolish(): mission_manager.update_objective_progress(mission_id, MissionObjective.ObjectiveType.BUILD_RESIDENTIAL, -1) # Function to remove terrain (grass or trees) -func _remove_terrain(position: Vector3): +func _remove_terrain(_pos: Vector3): # Get the terrain name based on its position - var terrain_name = "Terrain_" + str(int(position.x)) + "_" + str(int(position.z)) + var terrain_name = "Terrain_" + str(int(_pos.x)) + "_" + str(int(_pos.z)) # Check if terrain with this name exists if has_node(terrain_name): @@ -667,15 +691,15 @@ func _remove_terrain(position: Vector3): pass # Function to remove building model from scene -func _remove_building_model(position: Vector3): +func _remove_building_model(_pos: Vector3): # Try multiple possible naming patterns var building_patterns = [ - "Building_" + str(int(position.x)) + "_" + str(int(position.z)), - "building-small-a_" + str(int(position.x)) + "_" + str(int(position.z)), - "building-small-b_" + str(int(position.x)) + "_" + str(int(position.z)), - "building-small-c_" + str(int(position.x)) + "_" + str(int(position.z)), - "building-small-d_" + str(int(position.x)) + "_" + str(int(position.z)), - "building-garage_" + str(int(position.x)) + "_" + str(int(position.z)) + "Building_" + str(int(_pos.x)) + "_" + str(int(_pos.z)), + "building-small-a_" + str(int(_pos.x)) + "_" + str(int(_pos.z)), + "building-small-b_" + str(int(_pos.x)) + "_" + str(int(_pos.z)), + "building-small-c_" + str(int(_pos.x)) + "_" + str(int(_pos.z)), + "building-small-d_" + str(int(_pos.x)) + "_" + str(int(_pos.z)), + "building-garage_" + str(int(_pos.x)) + "_" + str(int(_pos.z)) ] # Check if we can find the building model with any of the pattern names @@ -696,7 +720,7 @@ func _remove_building_model(position: Vector3): continue # Check if this building is at our position (with some tolerance) - var pos_diff = (child.global_transform.origin - position).abs() + var pos_diff = (child.global_transform.origin - _pos).abs() if pos_diff.x < 0.5 and pos_diff.z < 0.5: child.queue_free() found = true @@ -712,7 +736,7 @@ func _remove_building_model(position: Vector3): continue # Check if this building is at our position (with some tolerance) - var pos_diff = (child.global_transform.origin - position).abs() + var pos_diff = (child.global_transform.origin - _pos).abs() if pos_diff.x < 0.5 and pos_diff.z < 0.5: child.queue_free() found = true @@ -722,20 +746,20 @@ func _remove_building_model(position: Vector3): if !found and gridmap: for child in gridmap.get_children(): # Check if this is any model at our position (with some tolerance) - var pos_diff = (child.global_transform.origin - position).abs() + var pos_diff = (child.global_transform.origin - _pos).abs() if pos_diff.x < 0.5 and pos_diff.z < 0.5: child.queue_free() found = true break # Function to remove a road model from the navigation region -func _remove_road_from_navregion(position: Vector3): +func _remove_road_from_navregion(_pos: Vector3): # Make sure we have a navigation region if not nav_region: return # Get the road name based on its position - var road_name = "Road_" + str(int(position.x)) + "_" + str(int(position.z)) + var road_name = "Road_" + str(int(_pos.x)) + "_" + str(int(_pos.z)) # Check if a road with this name exists if nav_region.has_node(road_name): @@ -758,7 +782,7 @@ func _add_existing_roads_to_navregion(): child.queue_free() # Find all road cells in the gridmap - var added_count = 0 + var _added_count = 0 # We need to convert any existing roads in the GridMap to our new system # Find existing road cells and add them to the NavRegion3D, then clear from GridMap @@ -770,7 +794,7 @@ func _add_existing_roads_to_navregion(): _add_road_to_navregion(cell, structure_index) # Remove from the GridMap since we're now handling roads differently gridmap.set_cell_item(cell, -1) - added_count += 1 + _added_count += 1 # Function to move all character NPCs to be children of the navigation region func _move_characters_to_navregion(): @@ -799,9 +823,9 @@ func _move_characters_to_navregion(): # Function to add terrain (grass or trees) as a direct child -func _add_terrain(position: Vector3, structure_index: int): +func _add_terrain(_pos: Vector3, structure_index: int): # Create a unique name for this terrain element based on its position - var terrain_name = "Terrain_" + str(int(position.x)) + "_" + str(int(position.z)) + var terrain_name = "Terrain_" + str(int(_pos.x)) + "_" + str(int(_pos.z)) # Check if terrain with this name already exists if has_node(terrain_name): @@ -815,22 +839,22 @@ func _add_terrain(position: Vector3, structure_index: int): add_child(terrain_model) # Create the transform - var transform = Transform3D() + var _transform = Transform3D() # Set scale (using 3.0 scale as per other terrain elements) - transform.basis = Basis().scaled(Vector3(3.0, 3.0, 3.0)) + _transform.basis = Basis().scaled(Vector3(3.0, 3.0, 3.0)) # Apply rotation from the selector to preserve the rotation the player chose - transform.basis = transform.basis * selector.basis + _transform.basis = _transform.basis * selector.basis # Set position - transform.origin = position + _transform.origin = _pos # Apply the complete transform in one go - terrain_model.transform = transform + terrain_model.transform = _transform # Callback for when construction is completed -func _on_construction_completed(position: Vector3): +func _on_construction_completed(_pos: Vector3): # We need to find a residential structure index to add to gridmap var residential_index = -1 for i in range(structures.size()): @@ -843,14 +867,14 @@ func _on_construction_completed(position: Vector3): var rotation_index = 0 # Try to get the rotation index from the construction manager - if construction_manager and construction_manager.construction_sites.has(position): - var site = construction_manager.construction_sites[position] + if construction_manager and construction_manager.construction_sites.has(_pos): + var site = construction_manager.construction_sites[_pos] if site.has("rotation_index"): rotation_index = site["rotation_index"] # Add the completed residential building to the gridmap with the correct rotation - gridmap.set_cell_item(position, residential_index, rotation_index) + gridmap.set_cell_item(_pos, residential_index, rotation_index) # Check if we need to spawn a character for mission 1 var mission_manager = get_node_or_null("/root/Main/MissionManager") @@ -862,7 +886,7 @@ func _on_construction_completed(position: Vector3): # Now check if we need to manually handle mission 1 character spawning if mission_manager.current_mission and mission_manager.current_mission.id == "1" and not mission_manager.character_spawned: mission_manager.character_spawned = true - mission_manager._spawn_character_on_road(position) + mission_manager._spawn_character_on_road(_pos) # NOTE: We removed the structure_placed signal emission here to fix the population double-counting else: diff --git a/scripts/builder.gd.uid b/scripts/builder.gd.uid new file mode 100644 index 0000000..dfc268f --- /dev/null +++ b/scripts/builder.gd.uid @@ -0,0 +1 @@ +uid://snp3i7itqnqc diff --git a/scripts/controls_panel.gd.uid b/scripts/controls_panel.gd.uid new file mode 100644 index 0000000..a9f3171 --- /dev/null +++ b/scripts/controls_panel.gd.uid @@ -0,0 +1 @@ +uid://b2vlnidm83s8y diff --git a/scripts/data_map.gd.uid b/scripts/data_map.gd.uid new file mode 100644 index 0000000..34e6593 --- /dev/null +++ b/scripts/data_map.gd.uid @@ -0,0 +1 @@ +uid://pwnd0fyfkjed diff --git a/scripts/data_structure.gd.uid b/scripts/data_structure.gd.uid new file mode 100644 index 0000000..365bf72 --- /dev/null +++ b/scripts/data_structure.gd.uid @@ -0,0 +1 @@ +uid://3r6pls585y3h diff --git a/scripts/fix_mission.gd.uid b/scripts/fix_mission.gd.uid new file mode 100644 index 0000000..2d59b66 --- /dev/null +++ b/scripts/fix_mission.gd.uid @@ -0,0 +1 @@ +uid://b50gqdyny3llp diff --git a/scripts/game_manager.gd b/scripts/game_manager.gd index c36c874..fc05427 100644 --- a/scripts/game_manager.gd +++ b/scripts/game_manager.gd @@ -42,7 +42,7 @@ func _ready(): controls_panel.closed.connect(_on_controls_panel_closed) # Check for audio initialization status (important for web) - var sound_manager = get_node_or_null("/root/SoundManager") + var _sound_manager = get_node_or_null("/root/SoundManager") var can_initialize_audio = true # # if OS.has_feature("web") and sound_manager: @@ -232,7 +232,7 @@ func setup_construction_sfx(): construction_sfx.bus = "SFX" # Use the SFX bus # Play the building sound effect when a structure is placed -func _on_structure_placed(structure_index, position): +func _on_structure_placed(_structure_index, _position): # Check web audio initialized status if needed var can_play_audio = true if OS.has_feature("web"): diff --git a/scripts/game_manager.gd.uid b/scripts/game_manager.gd.uid new file mode 100644 index 0000000..42cc4a2 --- /dev/null +++ b/scripts/game_manager.gd.uid @@ -0,0 +1 @@ +uid://dlqco4kmwr3er diff --git a/scripts/hud_manager.gd.uid b/scripts/hud_manager.gd.uid new file mode 100644 index 0000000..6a360a2 --- /dev/null +++ b/scripts/hud_manager.gd.uid @@ -0,0 +1 @@ +uid://caabw5op0u6tc diff --git a/scripts/javascript_bridge.gd.uid b/scripts/javascript_bridge.gd.uid new file mode 100644 index 0000000..f9bb07b --- /dev/null +++ b/scripts/javascript_bridge.gd.uid @@ -0,0 +1 @@ +uid://b40gjqb6qr1w7 diff --git a/scripts/mission/building_construction_manager.gd.uid b/scripts/mission/building_construction_manager.gd.uid new file mode 100644 index 0000000..ba61e06 --- /dev/null +++ b/scripts/mission/building_construction_manager.gd.uid @@ -0,0 +1 @@ +uid://bpbtgm8hnxt3g diff --git a/scripts/mission/character_controller.gd.uid b/scripts/mission/character_controller.gd.uid new file mode 100644 index 0000000..726aa33 --- /dev/null +++ b/scripts/mission/character_controller.gd.uid @@ -0,0 +1 @@ +uid://dexknr7it5val diff --git a/scripts/mission/construction_worker.gd.uid b/scripts/mission/construction_worker.gd.uid new file mode 100644 index 0000000..d6421a7 --- /dev/null +++ b/scripts/mission/construction_worker.gd.uid @@ -0,0 +1 @@ +uid://dfytqya2vsi81 diff --git a/scripts/mission/direct_panel_handler.gd.uid b/scripts/mission/direct_panel_handler.gd.uid new file mode 100644 index 0000000..1161255 --- /dev/null +++ b/scripts/mission/direct_panel_handler.gd.uid @@ -0,0 +1 @@ +uid://dptrv1nv60fl2 diff --git a/scripts/mission/fixed_handling.gd.uid b/scripts/mission/fixed_handling.gd.uid new file mode 100644 index 0000000..e556627 --- /dev/null +++ b/scripts/mission/fixed_handling.gd.uid @@ -0,0 +1 @@ +uid://d1wadrwuwmuuk diff --git a/scripts/mission/fullscreen_learning_panel.gd.uid b/scripts/mission/fullscreen_learning_panel.gd.uid new file mode 100644 index 0000000..9544108 --- /dev/null +++ b/scripts/mission/fullscreen_learning_panel.gd.uid @@ -0,0 +1 @@ +uid://d4isuuaa51b7x diff --git a/scripts/mission/handle_structure_unlocking.gd.uid b/scripts/mission/handle_structure_unlocking.gd.uid new file mode 100644 index 0000000..7cfa446 --- /dev/null +++ b/scripts/mission/handle_structure_unlocking.gd.uid @@ -0,0 +1 @@ +uid://l2b10qh2u8n4 diff --git a/scripts/mission/latex_panel.gd.uid b/scripts/mission/latex_panel.gd.uid new file mode 100644 index 0000000..672ebaa --- /dev/null +++ b/scripts/mission/latex_panel.gd.uid @@ -0,0 +1 @@ +uid://ynwv56k844ps diff --git a/scripts/mission/learning_panel.gd.uid b/scripts/mission/learning_panel.gd.uid new file mode 100644 index 0000000..f4b506f --- /dev/null +++ b/scripts/mission/learning_panel.gd.uid @@ -0,0 +1 @@ +uid://52tdmmosdbpa diff --git a/scripts/mission/learning_panel_main.gd.uid b/scripts/mission/learning_panel_main.gd.uid new file mode 100644 index 0000000..8aa1cc3 --- /dev/null +++ b/scripts/mission/learning_panel_main.gd.uid @@ -0,0 +1 @@ +uid://dmelvshrg8l56 diff --git a/scripts/mission/mission_data.gd.uid b/scripts/mission/mission_data.gd.uid new file mode 100644 index 0000000..525bd78 --- /dev/null +++ b/scripts/mission/mission_data.gd.uid @@ -0,0 +1 @@ +uid://c6f12a8vs3hp6 diff --git a/scripts/mission/mission_manager.gd.uid b/scripts/mission/mission_manager.gd.uid new file mode 100644 index 0000000..a29ea9f --- /dev/null +++ b/scripts/mission/mission_manager.gd.uid @@ -0,0 +1 @@ +uid://bnpqjt5n1s20m diff --git a/scripts/mission/mission_objective.gd.uid b/scripts/mission/mission_objective.gd.uid new file mode 100644 index 0000000..a4fbbd7 --- /dev/null +++ b/scripts/mission/mission_objective.gd.uid @@ -0,0 +1 @@ +uid://c7v1kbo5amrko diff --git a/scripts/mission/mission_ui.gd.uid b/scripts/mission/mission_ui.gd.uid new file mode 100644 index 0000000..211705b --- /dev/null +++ b/scripts/mission/mission_ui.gd.uid @@ -0,0 +1 @@ +uid://bxuxhmlcqp64g diff --git a/scripts/mission/resident_character.gd.uid b/scripts/mission/resident_character.gd.uid new file mode 100644 index 0000000..35ae935 --- /dev/null +++ b/scripts/mission/resident_character.gd.uid @@ -0,0 +1 @@ +uid://lcb3ablmkaw8 diff --git a/scripts/mission/unlocked_items_panel.gd.uid b/scripts/mission/unlocked_items_panel.gd.uid new file mode 100644 index 0000000..b559045 --- /dev/null +++ b/scripts/mission/unlocked_items_panel.gd.uid @@ -0,0 +1 @@ +uid://uftqbpj0c2u8 diff --git a/scripts/navigation_setup.gd.uid b/scripts/navigation_setup.gd.uid new file mode 100644 index 0000000..bd82591 --- /dev/null +++ b/scripts/navigation_setup.gd.uid @@ -0,0 +1 @@ +uid://urmot4hfnvtb diff --git a/scripts/pathfinding.gd.uid b/scripts/pathfinding.gd.uid new file mode 100644 index 0000000..fe37280 --- /dev/null +++ b/scripts/pathfinding.gd.uid @@ -0,0 +1 @@ +uid://boe3mr1ujtk2s diff --git a/scripts/sound_manager.gd b/scripts/sound_manager.gd index 6db63f3..efe487f 100644 --- a/scripts/sound_manager.gd +++ b/scripts/sound_manager.gd @@ -189,10 +189,10 @@ func _on_react_audio_ready(): audio_ready.emit() # Called when AudioBridge connects to the platform-one sound manager -func _on_audio_bridge_connected(is_connected: bool): - print("AudioBridge connected: ", is_connected) +func _on_audio_bridge_connected(connected: bool): + print("AudioBridge connected: ", connected) - if is_connected: + if connected: audio_initialized = true # Request the sound state from the platform-one sound manager @@ -221,24 +221,42 @@ func init_web_audio_from_js(): #if OS.has_feature("web") and not audio_initialized: #_initialize_web_audio() -# Initialize audio for web builds +# Initialize web audio system func _initialize_web_audio(): + # Only initialize if we haven't already if audio_initialized: return - # For web builds, we notify JavaScript to initialize audio -# if OS.has_feature("web"): -# JSBridge.JavaScriptGlobal.handle_audio_action("INITIALIZE_AUDIO") -# -# # We don't need to create any dummy players, as JavaScript will handle the audio -# audio_initialized = true -# audio_ready.emit() -# return - - # For non-web platforms, initialize Godot audio (this shouldn't get called) -# if not OS.has_feature("web"): - # Set the flag to prevent multiple initializations + # Try to initialize the audio context + if Engine.has_singleton("JavaScriptBridge"): + var js = Engine.get_singleton("JavaScriptBridge") + js.eval(""" + (function() { + try { + // Create or get the audio context + if (!window._godotAudioContext) { + window._godotAudioContext = new (window.AudioContext || window.webkitAudioContext)(); + console.log('SoundManager: Created new audio context'); + } + + // Resume the audio context if it's suspended + if (window._godotAudioContext.state === 'suspended') { + window._godotAudioContext.resume(); + console.log('SoundManager: Resumed audio context'); + } + + // Set initialized flag + window._godotAudioInitialized = true; + } catch(e) { + console.error('SoundManager: Error initializing audio:', e); + } + })() + """) + + # Set our initialized flag audio_initialized = true + + # Emit the ready signal audio_ready.emit() # Play background music @@ -252,7 +270,7 @@ func play_music(sound_name: String, loop: bool = true): # For web builds, try multiple bridge options # if OS.has_feature("web"): # # Try AudioBridge first (platform-one integration) -# if audio_bridge != null and audio_bridge.get("is_connected") == true: +# if audio_bridge != null and audio_bridge.get("connected") == true: # print("Using AudioBridge to play music: ", sound_name) # if audio_bridge.has_method("play_music") and audio_bridge.play_music(sound_name): # return @@ -300,7 +318,7 @@ func play_sfx(sound_name: String): # For web builds, try multiple bridge options #if OS.has_feature("web"): ## Try AudioBridge first (platform-one integration) - #if audio_bridge != null and audio_bridge.get("is_connected") == true: + #if audio_bridge != null and audio_bridge.get("connected") == true: #print("Using AudioBridge to play sfx: ", sound_name) #if audio_bridge.has_method("play_sfx") and audio_bridge.play_sfx(sound_name): #return @@ -350,7 +368,7 @@ func stop_music(): # For web builds, try multiple bridge options #if OS.has_feature("web"): ## Try AudioBridge first (platform-one integration) - #if audio_bridge != null and audio_bridge.get("is_connected") == true: + #if audio_bridge != null and audio_bridge.get("connected") == true: #print("Using AudioBridge to stop music") #if audio_bridge.has_method("stop_music") and audio_bridge.stop_music(): #current_music = "" @@ -377,7 +395,7 @@ func set_music_volume(volume: float): pass # if OS.has_feature("web"): # # Try AudioBridge first (platform-one integration) -# if audio_bridge != null and audio_bridge.get("is_connected") == true: +# if audio_bridge != null and audio_bridge.get("connected") == true: # print("Using AudioBridge to set music volume: ", music_volume) # if audio_bridge.has_method("set_music_volume"): # audio_bridge.set_music_volume(music_volume) @@ -401,7 +419,7 @@ func set_sfx_volume(volume: float): if false: pass # # Try AudioBridge first (platform-one integration) -# if audio_bridge != null and audio_bridge.get("is_connected") == true: +# if audio_bridge != null and audio_bridge.get("connected") == true: # print("Using AudioBridge to set sfx volume: ", sfx_volume) # if audio_bridge.has_method("set_sfx_volume"): # audio_bridge.set_sfx_volume(sfx_volume) @@ -425,7 +443,7 @@ func toggle_music_mute(): if false: pass # # Try AudioBridge first (platform-one integration) -# if audio_bridge != null and audio_bridge.get("is_connected") == true: +# if audio_bridge != null and audio_bridge.get("connected") == true: # print("Using AudioBridge to toggle music mute: ", music_muted) # if audio_bridge.has_method("toggle_music_mute"): # audio_bridge.toggle_music_mute() @@ -449,7 +467,7 @@ func toggle_sfx_mute(): if false: pass # # Try AudioBridge first (platform-one integration) -# if audio_bridge != null and audio_bridge.get("is_connected") == true: +# if audio_bridge != null and audio_bridge.get("connected") == true: # print("Using AudioBridge to toggle sfx mute: ", sfx_muted) # if audio_bridge.has_method("toggle_sfx_mute"): # audio_bridge.toggle_sfx_mute() diff --git a/scripts/sound_manager.gd.uid b/scripts/sound_manager.gd.uid new file mode 100644 index 0000000..c20ba87 --- /dev/null +++ b/scripts/sound_manager.gd.uid @@ -0,0 +1 @@ +uid://dwbcncga3rbmv diff --git a/scripts/sound_panel.gd b/scripts/sound_panel.gd index a97b782..f19b1ca 100644 --- a/scripts/sound_panel.gd +++ b/scripts/sound_panel.gd @@ -106,4 +106,4 @@ func _update_music_label(value): func _update_sfx_label(value): var percentage = int(value * 100) - sfx_value_label.text = str(percentage) + "%" \ No newline at end of file + sfx_value_label.text = str(percentage) + "%" diff --git a/scripts/sound_panel.gd.uid b/scripts/sound_panel.gd.uid new file mode 100644 index 0000000..3870c02 --- /dev/null +++ b/scripts/sound_panel.gd.uid @@ -0,0 +1 @@ +uid://wxdjmv1kdo1r diff --git a/scripts/structure.gd.uid b/scripts/structure.gd.uid new file mode 100644 index 0000000..9a51f05 --- /dev/null +++ b/scripts/structure.gd.uid @@ -0,0 +1 @@ +uid://cw0jlq5d8r66g diff --git a/scripts/view.gd.uid b/scripts/view.gd.uid new file mode 100644 index 0000000..6c6bd20 --- /dev/null +++ b/scripts/view.gd.uid @@ -0,0 +1 @@ +uid://cu76h00erned0 diff --git a/structures/building-garage.tres b/structures/building-garage.tres index 8834ad4..32f09b2 100644 --- a/structures/building-garage.tres +++ b/structures/building-garage.tres @@ -1,10 +1,11 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://bqb6g3t0tebno"] [ext_resource type="PackedScene" uid="uid://d0nnrx2y4px2v" path="res://models/building-garage.glb" id="1_gyclk"] -[ext_resource type="Script" path="res://scripts/structure.gd" id="2_jrinw"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_jrinw"] [resource] script = ExtResource("2_jrinw") +title = "" model = ExtResource("1_gyclk") type = 1 price = 70 @@ -12,3 +13,6 @@ population_count = 0 kW_usage = 0.0 kW_production = 0.0 selector_scale = 2.8 +unlocked = false +description = "Description" +thumbnail = "Thumbnail" diff --git a/structures/building-small-a.tres b/structures/building-small-a.tres index d4118c5..dbc39b9 100644 --- a/structures/building-small-a.tres +++ b/structures/building-small-a.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://cntgl86ianngh"] [ext_resource type="PackedScene" uid="uid://cnycdi6t5tj01" path="res://models/building-small-a.glb" id="1_v5apy"] -[ext_resource type="Script" path="res://scripts/structure.gd" id="2_q3i1h"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_q3i1h"] [resource] script = ExtResource("2_q3i1h") diff --git a/structures/building-small-b.tres b/structures/building-small-b.tres index 5d4213e..1572073 100644 --- a/structures/building-small-b.tres +++ b/structures/building-small-b.tres @@ -1,10 +1,11 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://c5fveedgvunju"] [ext_resource type="PackedScene" uid="uid://d2h51qlls136h" path="res://models/building-small-b.glb" id="1_klt7o"] -[ext_resource type="Script" uid="uid://smbpvh2nwds4" path="res://scripts/structure.gd" id="2_a2t3e"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_a2t3e"] [resource] script = ExtResource("2_a2t3e") +title = "" model = ExtResource("1_klt7o") type = 1 price = 60 @@ -12,3 +13,6 @@ population_count = 1 kW_usage = 1.0 kW_production = 0.0 selector_scale = 2.8 +unlocked = false +description = "Description" +thumbnail = "Thumbnail" diff --git a/structures/building-small-c.tres b/structures/building-small-c.tres index c7f8340..3ffd66d 100644 --- a/structures/building-small-c.tres +++ b/structures/building-small-c.tres @@ -1,10 +1,11 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://bh65eqgid4kxy"] [ext_resource type="PackedScene" uid="uid://m74mvao50wnm" path="res://models/building-small-c.glb" id="1_6yyww"] -[ext_resource type="Script" uid="uid://smbpvh2nwds4" path="res://scripts/structure.gd" id="2_rkiq0"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_rkiq0"] [resource] script = ExtResource("2_rkiq0") +title = "" model = ExtResource("1_6yyww") type = 1 price = 70 @@ -12,3 +13,6 @@ population_count = 1 kW_usage = 1.0 kW_production = 0.0 selector_scale = 2.8 +unlocked = false +description = "Description" +thumbnail = "Thumbnail" diff --git a/structures/building-small-d.tres b/structures/building-small-d.tres index 3632028..c4b56d0 100644 --- a/structures/building-small-d.tres +++ b/structures/building-small-d.tres @@ -1,10 +1,11 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://dtal0tl2ee336"] [ext_resource type="PackedScene" uid="uid://h0vrvst3cumo" path="res://models/building-small-d.glb" id="1_164xq"] -[ext_resource type="Script" uid="uid://smbpvh2nwds4" path="res://scripts/structure.gd" id="2_8ewai"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_8ewai"] [resource] script = ExtResource("2_8ewai") +title = "" model = ExtResource("1_164xq") type = 1 price = 70 @@ -12,3 +13,6 @@ population_count = 1 kW_usage = 1.0 kW_production = 0.0 selector_scale = 2.8 +unlocked = false +description = "Description" +thumbnail = "Thumbnail" diff --git a/structures/grass-trees-tall.tres b/structures/grass-trees-tall.tres index 4db482a..ab9dcda 100644 --- a/structures/grass-trees-tall.tres +++ b/structures/grass-trees-tall.tres @@ -1,10 +1,11 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://y6jafhfnhbrp"] [ext_resource type="PackedScene" uid="uid://dy26b1ba2j2v1" path="res://models/grass-trees-tall.glb" id="1_nbdd1"] -[ext_resource type="Script" uid="uid://smbpvh2nwds4" path="res://scripts/structure.gd" id="2_b2sah"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_b2sah"] [resource] script = ExtResource("2_b2sah") +title = "" model = ExtResource("1_nbdd1") type = 6 price = 25 @@ -12,3 +13,6 @@ population_count = 0 kW_usage = 0.0 kW_production = 0.0 selector_scale = 2.8 +unlocked = false +description = "Description" +thumbnail = "Thumbnail" diff --git a/structures/grass-trees.tres b/structures/grass-trees.tres index 0a19f92..6ad0190 100644 --- a/structures/grass-trees.tres +++ b/structures/grass-trees.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://ccb475jeg7ym5"] [ext_resource type="PackedScene" uid="uid://b1711sieed2u6" path="res://models/grass-trees.glb" id="1_lcgc1"] -[ext_resource type="Script" path="res://scripts/structure.gd" id="2_pnpij"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_pnpij"] [resource] script = ExtResource("2_pnpij") diff --git a/structures/grass.tres b/structures/grass.tres index f82ca97..195a577 100644 --- a/structures/grass.tres +++ b/structures/grass.tres @@ -1,10 +1,11 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://tm532uesguhk"] [ext_resource type="PackedScene" uid="uid://cr3btp34bp3eg" path="res://models/grass.glb" id="1_2n0ef"] -[ext_resource type="Script" uid="uid://smbpvh2nwds4" path="res://scripts/structure.gd" id="2_1i4lf"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_1i4lf"] [resource] script = ExtResource("2_1i4lf") +title = "" model = ExtResource("1_2n0ef") type = 6 price = 10 @@ -14,4 +15,4 @@ kW_production = 0.0 selector_scale = 2.8 unlocked = false description = "Some lush green grass!" -thumbnail = "res://sprites/residential/grass.png" \ No newline at end of file +thumbnail = "res://sprites/residential/grass.png" diff --git a/structures/pavement-fountain.tres b/structures/pavement-fountain.tres index 886e036..07ae59e 100644 --- a/structures/pavement-fountain.tres +++ b/structures/pavement-fountain.tres @@ -1,10 +1,11 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://dqqe3iofnleup"] [ext_resource type="PackedScene" uid="uid://6v0t536s83vb" path="res://models/pavement-fountain.glb" id="1_r2n53"] -[ext_resource type="Script" uid="uid://smbpvh2nwds4" path="res://scripts/structure.gd" id="2_wqyte"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_wqyte"] [resource] script = ExtResource("2_wqyte") +title = "" model = ExtResource("1_r2n53") type = 6 price = 10 @@ -12,3 +13,6 @@ population_count = 0 kW_usage = 0.0 kW_production = 0.0 selector_scale = 2.8 +unlocked = false +description = "Description" +thumbnail = "Thumbnail" diff --git a/structures/pavement.tres b/structures/pavement.tres index 8e1ba07..1d64f21 100644 --- a/structures/pavement.tres +++ b/structures/pavement.tres @@ -1,10 +1,11 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://ch8vtcpine1lc"] [ext_resource type="PackedScene" uid="uid://cpv75mfsda1ml" path="res://models/pavement.glb" id="1_gudnj"] -[ext_resource type="Script" uid="uid://smbpvh2nwds4" path="res://scripts/structure.gd" id="2_i48go"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_i48go"] [resource] script = ExtResource("2_i48go") +title = "" model = ExtResource("1_gudnj") type = 6 price = 10 @@ -12,3 +13,6 @@ population_count = 0 kW_usage = 0.0 kW_production = 0.0 selector_scale = 2.8 +unlocked = false +description = "Description" +thumbnail = "Thumbnail" diff --git a/structures/power-plant.tres b/structures/power-plant.tres index 6579061..efe84a2 100644 --- a/structures/power-plant.tres +++ b/structures/power-plant.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://c4qbn3d85prxx"] [ext_resource type="PackedScene" uid="uid://ckxkrnomcegue" path="res://models/power_plant.glb" id="1_r8n8k"] -[ext_resource type="Script" path="res://scripts/structure.gd" id="3_oloyn"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="3_oloyn"] [resource] script = ExtResource("3_oloyn") diff --git a/structures/road-corner.tres b/structures/road-corner.tres index ac61309..a9a53d7 100644 --- a/structures/road-corner.tres +++ b/structures/road-corner.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://d2jplegnkl6u2"] [ext_resource type="PackedScene" uid="uid://c4ccm2qr5wa58" path="res://models/road-corner.glb" id="1_r8n8k"] -[ext_resource type="Script" path="res://scripts/structure.gd" id="3_oloyn"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="3_oloyn"] [resource] script = ExtResource("3_oloyn") diff --git a/structures/road-intersection.tres b/structures/road-intersection.tres index 693009b..36b57d2 100644 --- a/structures/road-intersection.tres +++ b/structures/road-intersection.tres @@ -1,10 +1,11 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://dveu4dnue0d54"] [ext_resource type="PackedScene" uid="uid://euxdh7lkq0oj" path="res://models/road-intersection.glb" id="1_pnjl2"] -[ext_resource type="Script" uid="uid://smbpvh2nwds4" path="res://scripts/structure.gd" id="2_3eq5k"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_3eq5k"] [resource] script = ExtResource("2_3eq5k") +title = "" model = ExtResource("1_pnjl2") type = 0 price = 25 @@ -12,3 +13,6 @@ population_count = 0 kW_usage = 0.0 kW_production = 0.0 selector_scale = 2.8 +unlocked = false +description = "Description" +thumbnail = "Thumbnail" diff --git a/structures/road-split.tres b/structures/road-split.tres index b647258..fc0e49e 100644 --- a/structures/road-split.tres +++ b/structures/road-split.tres @@ -1,10 +1,11 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://cqvwy36htu81"] [ext_resource type="PackedScene" uid="uid://mu30r6rmht07" path="res://models/road-split.glb" id="1_ku0rj"] -[ext_resource type="Script" uid="uid://smbpvh2nwds4" path="res://scripts/structure.gd" id="2_xa71m"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_xa71m"] [resource] script = ExtResource("2_xa71m") +title = "" model = ExtResource("1_ku0rj") type = 0 price = 25 @@ -12,3 +13,6 @@ population_count = 0 kW_usage = 0.0 kW_production = 0.0 selector_scale = 2.8 +unlocked = false +description = "Description" +thumbnail = "Thumbnail" diff --git a/structures/road-straight-lightposts.tres b/structures/road-straight-lightposts.tres index ea26a8d..16a53a3 100644 --- a/structures/road-straight-lightposts.tres +++ b/structures/road-straight-lightposts.tres @@ -1,14 +1,18 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://mxrnqinnsqnt"] -[ext_resource type="PackedScene" uid="uid://5kchntr735l" path="res://models/road-straight-lightposts.glb" id="1_i07jw"] -[ext_resource type="Script" uid="uid://smbpvh2nwds4" path="res://scripts/structure.gd" id="2_470aq"] +[ext_resource type="PackedScene" uid="uid://5kchntr735l" path="res://models/road-straight-lightposts.glb" id="1_m2j1i"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="2_470aq"] [resource] script = ExtResource("2_470aq") -model = ExtResource("1_i07jw") +title = "" +model = ExtResource("1_m2j1i") type = 0 price = 25 population_count = 0 kW_usage = 0.0 kW_production = 0.0 selector_scale = 2.8 +unlocked = false +description = "Description" +thumbnail = "Thumbnail" diff --git a/structures/road-straight.tres b/structures/road-straight.tres index 43839d5..73f3bb0 100644 --- a/structures/road-straight.tres +++ b/structures/road-straight.tres @@ -1,12 +1,12 @@ [gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://dv14kkhb6umkv"] -[ext_resource type="Script" path="res://scripts/structure.gd" id="1_5fmmh"] -[ext_resource type="PackedScene" uid="uid://b4tgtg0j2dgh8" path="res://models/road-straight.glb" id="1_ump1f"] +[ext_resource type="Script" uid="uid://cw0jlq5d8r66g" path="res://scripts/structure.gd" id="1_5fmmh"] +[ext_resource type="Resource" uid="uid://b4tgtg0j2dgh8" path="res://models/road-straight.glb" id="1_qlpqf"] [resource] script = ExtResource("1_5fmmh") title = "Road" -model = ExtResource("1_ump1f") +model = ExtResource("1_qlpqf") type = 0 price = 25 population_count = 0 From a36338ef935445189068399309f31835470714b5 Mon Sep 17 00:00:00 2001 From: Wade Date: Thu, 17 Apr 2025 12:23:32 -0500 Subject: [PATCH 2/5] Add Mission Debrief Message when starting missions. --- mission/first_mission.tres | 4 ++-- models/road-straight.glb.import | 14 +------------- resources/generic_text_panel.resource.gd | 2 +- scenes/main.tscn | 2 ++ scenes/mission_panel.tscn | 2 +- scenes/objective_label.tscn | 13 ------------- scripts/game_manager.gd | 14 ++++++++++++++ 7 files changed, 21 insertions(+), 30 deletions(-) delete mode 100644 scenes/objective_label.tscn diff --git a/mission/first_mission.tres b/mission/first_mission.tres index f5a4fbc..aae7703 100644 --- a/mission/first_mission.tres +++ b/mission/first_mission.tres @@ -15,8 +15,8 @@ completed = false [resource] script = ExtResource("1_nv6c6") id = "1" -title = "Building Roads" -description = "Welcome to the city builder! Let's start by placing your first road." +title = "Census Planning" +description = "As the new city planner, you need to establish a baseline understanding of your growing community. The mayor has requested a comprehensive census to guide future development." objectives = Array[ExtResource("1_yfbrc")]([SubResource("Resource_ywws1")]) rewards = { "cash": 250 diff --git a/models/road-straight.glb.import b/models/road-straight.glb.import index be5f216..1137de0 100644 --- a/models/road-straight.glb.import +++ b/models/road-straight.glb.import @@ -31,18 +31,6 @@ animation/trimming=false animation/remove_immutable_tracks=true animation/import_rest_as_RESET=false import_script/path="" -_subresources={ -"meshes": { -"road-straight_road-straight": { -"generate/lightmap_uv": 0, -"generate/lods": 0, -"generate/shadow_meshes": 0, -"lods/normal_merge_angle": 60.0, -"lods/normal_split_angle": 25.0, -"save_to_file/enabled": true, -"save_to_file/path": "res://mesges/road-mesh.res" -} -} -} +_subresources={} gltf/naming_version=0 gltf/embedded_image_handling=1 diff --git a/resources/generic_text_panel.resource.gd b/resources/generic_text_panel.resource.gd index 93d69f8..2a46957 100644 --- a/resources/generic_text_panel.resource.gd +++ b/resources/generic_text_panel.resource.gd @@ -2,7 +2,7 @@ extends Resource class_name GenericText -@export_enum("intro", "outro") var panel_type +@export_enum("intro", "outro", "mission") var panel_type @export var title: String = "Welcome to Stem City" @export_multiline var body_text: String = "Some sample body" @export var button_text: String = "Close" diff --git a/scenes/main.tscn b/scenes/main.tscn index b68b42f..2f03a0b 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -213,6 +213,7 @@ theme_override_fonts/font = ExtResource("17_vlub6") theme_override_font_sizes/font_size = 24 text = "Mission Title" horizontal_alignment = 1 +autowrap_mode = 2 [node name="HSeparator" type="HSeparator" parent="MissionManager/MissionPanel/MarginContainer/VBoxContainer"] layout_mode = 2 @@ -362,4 +363,5 @@ offset_right = 40.0 offset_bottom = 23.0 [connection signal="all_missions_completed" from="MissionManager" to="." method="_on_mission_manager_all_missions_completed"] +[connection signal="mission_started" from="MissionManager" to="." method="_on_mission_manager_mission_started"] [connection signal="pressed" from="MissionManager/LearningPanel/MarginContainer/VBoxContainer/HBoxContainer/CompleteButton" to="MissionManager/LearningPanel" method="_on_complete_button_pressed"] diff --git a/scenes/mission_panel.tscn b/scenes/mission_panel.tscn index fb794e6..fc8c9b1 100644 --- a/scenes/mission_panel.tscn +++ b/scenes/mission_panel.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=2 format=3 uid="uid://cam5blhxixlnb"] +[gd_scene load_steps=2 format=3 uid="uid://bo6c8g64ixmo"] [ext_resource type="Script" path="res://scripts/mission/mission_ui.gd" id="1_wl28p"] diff --git a/scenes/objective_label.tscn b/scenes/objective_label.tscn deleted file mode 100644 index 9109c9f..0000000 --- a/scenes/objective_label.tscn +++ /dev/null @@ -1,13 +0,0 @@ -[gd_scene format=3 uid="uid://b7oa3hlu1ki3v"] - -[node name="ObjectiveLabel" type="Control"] -layout_mode = 3 -anchors_preset = 0 -offset_right = 40.0 -offset_bottom = 23.0 - -[node name="Label" type="Label" parent="."] -layout_mode = 0 -offset_right = 40.0 -offset_bottom = 23.0 -text = "Objective" diff --git a/scripts/game_manager.gd b/scripts/game_manager.gd index c36c874..c44ce92 100644 --- a/scripts/game_manager.gd +++ b/scripts/game_manager.gd @@ -296,3 +296,17 @@ func _on_mission_manager_all_missions_completed() -> void: if generic_text_panel and outro_text_resource: generic_text_panel.apply_resource_data(outro_text_resource) generic_text_panel.show_panel() + + +func _on_mission_manager_mission_started(mission: MissionData) -> void: + var mission_text = GenericText.new() + mission_text.panel_type = 2 + mission_text.title = mission.title + mission_text.body_text = mission.description + mission_text.button_text = "Start Mission" + + print(generic_text_panel) + if generic_text_panel: + generic_text_panel.apply_resource_data(mission_text) + generic_text_panel.show_panel() + From 234337a0e4a9af78b4c99ea1ece2c192eed0d039 Mon Sep 17 00:00:00 2001 From: Wade Date: Thu, 17 Apr 2025 20:19:01 -0500 Subject: [PATCH 3/5] Update Mission workflow and add event bus --- configs/data.config.gd | 8 + global/event_bus.gd | 10 + mission/fifth_mission.tres | 1 - mission/first_mission.tres | 11 +- mission/fourth_mission.tres | 1 - mission/second_mission.tres | 11 +- mission/sixth_mission.tres | 1 - mission/third_mission.tres | 9 +- project.godot | 1 + scenes/main.tscn | 11 +- scripts/audio_bridge.gd | 1 - scripts/builder.gd | 4 +- scripts/game_manager.gd | 16 +- scripts/hud_manager.gd | 12 +- .../mission/building_construction_manager.gd | 71 ++--- scripts/mission/mission_manager.gd | 249 +++++------------- scripts/mission/mission_objective.gd | 18 +- scripts/sound_manager.gd | 2 +- 18 files changed, 145 insertions(+), 292 deletions(-) create mode 100644 configs/data.config.gd create mode 100644 global/event_bus.gd diff --git a/configs/data.config.gd b/configs/data.config.gd new file mode 100644 index 0000000..cd424b3 --- /dev/null +++ b/configs/data.config.gd @@ -0,0 +1,8 @@ +# Mission Configs +enum ObjectiveType { + BUILD_STRUCTURE, + BUILD_RESIDENTIAL, + REACH_CASH_AMOUNT, + REACH_POPULATION, + LEARNING, +} diff --git a/global/event_bus.gd b/global/event_bus.gd new file mode 100644 index 0000000..63130d3 --- /dev/null +++ b/global/event_bus.gd @@ -0,0 +1,10 @@ +extends Node + +signal population_update(new_population:int) + +var current_scene = null + +func _ready(): + var root = get_tree().root + # Using a negative index counts from the end, so this gets the last child node of `root`. + current_scene = root.get_child(-1) diff --git a/mission/fifth_mission.tres b/mission/fifth_mission.tres index 72f925f..e276237 100644 --- a/mission/fifth_mission.tres +++ b/mission/fifth_mission.tres @@ -9,7 +9,6 @@ type = 7 target_count = 1 current_count = 0 description = "Calculate how many power plants are needed to supply electricity to 40 houses." -structure_index = -1 completed = false [resource] diff --git a/mission/first_mission.tres b/mission/first_mission.tres index aae7703..94db62a 100644 --- a/mission/first_mission.tres +++ b/mission/first_mission.tres @@ -1,16 +1,17 @@ -[gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://x5h4xutbldq3"] +[gd_resource type="Resource" script_class="MissionData" load_steps=5 format=3 uid="uid://x5h4xutbldq3"] [ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="1_nv6c6"] [ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_yfbrc"] +[ext_resource type="Resource" uid="uid://dv14kkhb6umkv" path="res://structures/road-straight.tres" id="2_d0ffl"] [sub_resource type="Resource" id="Resource_ywws1"] script = ExtResource("1_yfbrc") -type = 2 -target_count = 1 +type = 0 +target_count = 3 current_count = 0 -description = "Build a road" -structure_index = -1 +description = "Build 3 connecting roads" completed = false +structure = ExtResource("2_d0ffl") [resource] script = ExtResource("1_nv6c6") diff --git a/mission/fourth_mission.tres b/mission/fourth_mission.tres index 078cada..06dd0e7 100644 --- a/mission/fourth_mission.tres +++ b/mission/fourth_mission.tres @@ -9,7 +9,6 @@ type = 3 target_count = 40 current_count = 0 description = "Build 40 residential buildings with construction workers" -structure_index = -1 completed = false [resource] diff --git a/mission/second_mission.tres b/mission/second_mission.tres index 0733835..d419998 100644 --- a/mission/second_mission.tres +++ b/mission/second_mission.tres @@ -1,21 +1,22 @@ -[gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://cjr36hqnmyn0x"] +[gd_resource type="Resource" script_class="MissionData" load_steps=5 format=3 uid="uid://cjr36hqnmyn0x"] [ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_dhx01"] +[ext_resource type="Resource" uid="uid://cntgl86ianngh" path="res://structures/building-small-a.tres" id="2_em5vq"] [ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="2_mum3p"] [sub_resource type="Resource" id="Resource_7c02e"] script = ExtResource("1_dhx01") -type = 3 -target_count = 1 +type = 0 +target_count = 3 current_count = 0 description = "Build a residential building" -structure_index = -1 completed = false +structure = ExtResource("2_em5vq") [resource] script = ExtResource("2_mum3p") id = "2" -title = "Building Homes" +title = "Census Planning" description = "Now that we have a road, let's build a residential building for our citizens!" objectives = Array[ExtResource("1_dhx01")]([SubResource("Resource_7c02e")]) rewards = { diff --git a/mission/sixth_mission.tres b/mission/sixth_mission.tres index c2e4983..24f9d99 100644 --- a/mission/sixth_mission.tres +++ b/mission/sixth_mission.tres @@ -9,7 +9,6 @@ type = 10 target_count = 1 current_count = 0 description = "Build a power plant to provide electricity to your city" -structure_index = 7 completed = false [resource] diff --git a/mission/third_mission.tres b/mission/third_mission.tres index 20b5330..e16c146 100644 --- a/mission/third_mission.tres +++ b/mission/third_mission.tres @@ -5,17 +5,16 @@ [sub_resource type="Resource" id="Resource_c06be"] script = ExtResource("1_l3spi") -type = 7 -target_count = 1 +type = 2 +target_count = 50 current_count = 0 -description = "Compare two construction companies and determine which one is more efficient for building 40 houses in a week." -structure_index = -1 +description = "Reach a population of 50 citizens" completed = false [resource] script = ExtResource("2_b4llw") id = "3" -title = "Compare Construction Companies" +title = "Census Planning" description = "As your city grows, you need to choose the most efficient construction company." objectives = Array[ExtResource("1_l3spi")]([SubResource("Resource_c06be")]) rewards = { diff --git a/project.godot b/project.godot index 8f2d8ca..a2feb9d 100644 --- a/project.godot +++ b/project.godot @@ -25,6 +25,7 @@ general/default_playback_type.web=0 [autoload] SoundManager="*res://scripts/sound_manager.gd" +EventBus="*res://global/event_bus.gd" [display] diff --git a/scenes/main.tscn b/scenes/main.tscn index 2f03a0b..59a48ca 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -31,20 +31,13 @@ script = ExtResource("14_76jlq") panel_type = 0 title = "Welcome to Stem City " -body_text = "Hi League Community, +body_text = "Welcome to Stem City! Your goal is to build a thriving community from the ground up. As you complete missions, you'll unlock new structures to expand and improve your city. - Each mission introduces important Math concepts used in urban planning and city management. You'll apply mathematics while watching your city grow. +As the new city planner, you need to establish a baseline understanding of your growing community. The mayor has requested a comprehensive census to guide future development. -You are the very first group of students who get to test this. So keep in mind there will be bugs, but do note them. -We are aware of the following bugs: -- Population count may be off by 1 -- Lighting Baking in Web Builds are too bright -- We don't restrict building off of roads which will cause workers not to reach buildings -- Building overlap -- No builders for Power Plant Ready to start planning your city? Click Close to see the controls and begin your first mission! diff --git a/scripts/audio_bridge.gd b/scripts/audio_bridge.gd index 819b041..629ad21 100644 --- a/scripts/audio_bridge.gd +++ b/scripts/audio_bridge.gd @@ -106,7 +106,6 @@ func connect_to_sound_manager() -> bool: })(); """ - // Set up the callback js.set_callback("godot_audio_state_callback", Callable(self, "_on_audio_state_received")) result = js.eval(post_message_script) diff --git a/scripts/builder.gd b/scripts/builder.gd index 550d60a..5970c8c 100644 --- a/scripts/builder.gd +++ b/scripts/builder.gd @@ -646,11 +646,9 @@ func _update_mission_objective_on_demolish(): var mission_manager = get_node_or_null("/root/Main/MissionManager") if mission_manager and mission_manager.current_mission: - # Check if we're in mission 3 (build 40 residential buildings) - if mission_manager.current_mission.id != "3": # For other missions, use the normal method var mission_id = mission_manager.current_mission.id - mission_manager.update_objective_progress(mission_id, MissionObjective.ObjectiveType.BUILD_RESIDENTIAL, -1) + mission_manager.update_objective_progress(mission_id, MissionObjective.ObjectiveType, -1) # Function to remove terrain (grass or trees) func _remove_terrain(position: Vector3): diff --git a/scripts/game_manager.gd b/scripts/game_manager.gd index c44ce92..1617c5e 100644 --- a/scripts/game_manager.gd +++ b/scripts/game_manager.gd @@ -1,6 +1,11 @@ extends Node -# This script handles overall game management tasks +# This script handles overall game management tasks, including audio management and UI interactions. +var config = ConfigFile.new() + + + + var music_player: AudioStreamPlayer var building_sfx: AudioStreamPlayer @@ -14,6 +19,11 @@ var construction_sfx: AudioStreamPlayer func _ready(): + # Load data from a file. + var err = config.load("global://config.cfg") + # If the file didn't load, ignore it. + if err != OK: + return # Register SoundManager in the main loop for JavaScript bridge to find Engine.get_main_loop().set_meta("sound_manager", get_node_or_null("/root/SoundManager")) @@ -299,6 +309,10 @@ func _on_mission_manager_all_missions_completed() -> void: func _on_mission_manager_mission_started(mission: MissionData) -> void: + var mission_manager: Node = get_node_or_null("/root/Main/MissionManager") + if mission_manager and mission_manager.mission_ui: + mission_manager.mission_ui.update_mission_display(mission) + var mission_text = GenericText.new() mission_text.panel_type = 2 mission_text.title = mission.title diff --git a/scripts/hud_manager.gd b/scripts/hud_manager.gd index 08d09d4..984efb2 100644 --- a/scripts/hud_manager.gd +++ b/scripts/hud_manager.gd @@ -1,16 +1,15 @@ extends Node # Signals -signal population_updated(new_population) -signal electricity_updated(usage, production) +signal electricity_updated(usage, production) # Variables var total_population: int = 0 var total_kW_usage: float = 0.0 var total_kW_production: float = 0.0 # References -var builder +var buildeJuj var building_construction_manager var population_label: Label var electricity_label: Label @@ -19,14 +18,17 @@ var population_tooltip: Control var electricity_tooltip: Control var controls_panel: PanelContainer var sound_panel: PanelContainer +var builder:Node func _ready(): # Connect to signals from the builder builder = get_node_or_null("/root/Main/Builder") - population_updated.connect(update_population_count) if builder: builder.structure_placed.connect(_on_structure_placed) builder.structure_removed.connect(_on_structure_removed) + + + EventBus.population_update.connect(set_population_count) # Initialize UI elements population_label = $HBoxContainer/PopulationItem/PopulationLabel @@ -119,7 +121,7 @@ func _on_structure_removed(structure_index, position): # Update Population -func update_population_count(count: int): +func set_population_count(count: int): total_population += count population_label.text = str(total_population) diff --git a/scripts/mission/building_construction_manager.gd b/scripts/mission/building_construction_manager.gd index a504e59..d809455 100644 --- a/scripts/mission/building_construction_manager.gd +++ b/scripts/mission/building_construction_manager.gd @@ -1,13 +1,19 @@ extends Node class_name BuildingConstructionManager +# Constants +const ObjectiveType = preload("res://configs/data.config.gd").ObjectiveType + + # Signals signal construction_completed(position) signal worker_construction_started signal worker_construction_ended + const CONSTRUCTION_TIME = 10.0 # seconds to build a building + # References to necessary scenes and resources var worker_scene: PackedScene var hud_manager: Node @@ -259,8 +265,8 @@ func _on_worker_construction_started(): func _on_worker_construction_ended(): # Forward the signal for mission managers/other systems that need it worker_construction_ended.emit() -func _on_update_population(count: int): - hud_manager.population_updated.emit(count) +func update_population(count: int): + EventBus.population_update.emit(count) @@ -307,40 +313,11 @@ func _complete_construction(position: Vector3): # Spawn a resident from the new building (except for first building in mission 1) if should_spawn_resident: _spawn_resident_from_building(position) - - # Update population in the HUD when construction is complete - # Try different possible paths to find the HUD - var hud = get_node_or_null("/root/Main/CanvasLayer/HUD") - - # If not found, try to find it by group (we added the HUD to "hud" group) - if not hud: - var hud_nodes = get_tree().get_nodes_in_group("hud") - if hud_nodes.size() > 0: - hud = hud_nodes[0] - - # If not found, try other common paths - if not hud: - var scene_root = get_tree().get_root() - for child in scene_root.get_children(): - if child.name == "Main": - if child.has_node("CanvasLayer/HUD"): - hud = child.get_node("CanvasLayer/HUD") - break - - # Last resort - try to find using builder's cash_display - if not hud and builder and builder.cash_display: - var parent = builder.cash_display.get_parent() - while parent and parent.get_parent(): - if "HUD" in parent.name: - hud = parent - break - parent = parent.get_parent() - - if hud and site["structure_index"] >= 0 and site["structure_index"] < builder.structures.size(): - var structure = builder.structures[site["structure_index"]] - - if structure.type == Structure.StructureType.RESIDENTIAL_BUILDING and structure.population_count > 0: - _on_update_population(structure.population_count) + + var structure = builder.structures[site["structure_index"]] + + if structure.type == Structure.StructureType.RESIDENTIAL_BUILDING and structure.population_count > 0: + update_population(structure.population_count) # hud.total_population += structure.population_count # hud.update_hud() # hud.population_updated.emit(hud.total_population) @@ -375,25 +352,13 @@ func _update_mission_objective_on_completion(structure_index: int): # Check if this is a residential building if structure_index >= 0 and structure_index < builder.structures.size(): var structure = builder.structures[structure_index] - - if structure.type == Structure.StructureType.RESIDENTIAL_BUILDING: - # For mission 3, we'll rely on the fix_mission.gd script to maintain an accurate count - # This prevents double counting, as we just need to make sure buildings are counted - # based on their actual presence in the scene - if mission_manager.current_mission.id == "3": - # Instead of directly updating, we'll wait for the fix script to apply the proper count - pass - - # Special handling for mission 1 - elif mission_manager.current_mission.id == "1": - # For mission 1, we need to make sure the objectives are updated - mission_manager.update_objective_progress( + + if mission_manager.current_objective.type == ObjectiveType.BUILD_RESIDENTIAL && structure.type == Structure.StructureType.RESIDENTIAL_BUILDING: + mission_manager.update_objective_progress( mission_manager.current_mission.id, - MissionObjective.ObjectiveType.BUILD_RESIDENTIAL + 1 ) - - # Trigger an immediate progress check - mission_manager.check_mission_progress(mission_manager.current_mission.id) + mission_manager.check_mission_progress(mission_manager.current_mission.id) # Place the final building at the construction site func _place_final_building(position: Vector3, structure_index: int): diff --git a/scripts/mission/mission_manager.gd b/scripts/mission/mission_manager.gd index 7c7c7b2..bb582e6 100644 --- a/scripts/mission/mission_manager.gd +++ b/scripts/mission/mission_manager.gd @@ -4,6 +4,8 @@ class_name MissionManager # Add the JavaScript bridge for HTML5 export # This ensures JavaScript is available and degrades gracefully on other platforms const JSBridge = preload("res://scripts/javascript_bridge.gd") +const ObjectiveType = preload("res://configs/data.config.gd").ObjectiveType + signal mission_started(mission: MissionData) signal mission_completed(mission: MissionData) @@ -18,14 +20,15 @@ signal all_missions_completed() @export var character_scene: PackedScene var current_mission: MissionData +var current_objective: MissionObjective var active_missions: Dictionary = {} # mission_id: MissionData var character_spawned: bool = false var learning_companion_connected: bool = false # Panel state tracking -var is_unlocked_panel_showing = false -var delayed_mission_start_queue = [] # Queue of missions to start after unlocked panel closes +var is_unlocked_panel_showing: bool = false +var delayed_mission_start_queue = [] # Queue of missions to start after unlocked panel closes # Mission skip variables var skip_key_presses: int = 0 @@ -225,138 +228,14 @@ func start_mission(mission: MissionData): current_mission = mission active_missions[mission.id] = mission + mission_started.emit(current_mission) - # Send mission started event to the learning companion - # This will also send the companion dialog data - _on_mission_started_for_companion(mission) - - # Fix for mission 3 to ensure accurate count - if mission.id == "3": - # Reset the residential building count to 0 to avoid any double counting - for objective in mission.objectives: - if objective.type == MissionObjective.ObjectiveType.BUILD_RESIDENTIAL: - objective.current_count = 0 - objective.completed = false - - # Load and run the fix script to count actual buildings - var FixMissionScript = load("res://scripts/fix_mission.gd") - if FixMissionScript: - var fix_node = Node.new() - fix_node.set_script(FixMissionScript) - fix_node.name = "FixMissionHelper" - add_child(fix_node) - - # Add decorative structures and curved roads - # Use more robust checking - fallback to ID for backward compatibility - var is_construction_or_expansion = (mission.id == "2" or mission.id == "3") - if is_construction_or_expansion and builder: - # Check if we need to add the road-corner and decoration structures - var has_road_corner = false - var has_grass_trees_tall = false - var has_grass = false - - # Look through existing structures to see if we already have them - for structure in builder.structures: - if structure.model.resource_path.contains("road-corner"): - has_road_corner = true - elif structure.model.resource_path.contains("grass-trees-tall"): - has_grass_trees_tall = true - elif structure.model.resource_path.contains("grass") and not structure.model.resource_path.contains("trees"): - has_grass = true - - # Add the road-corner if missing - if not has_road_corner: - var road_corner = load("res://structures/road-corner.tres") - if road_corner: - builder.structures.append(road_corner) - - # Add the grass-trees-tall if missing - if not has_grass_trees_tall: - var grass_trees_tall = load("res://structures/grass-trees-tall.tres") - if grass_trees_tall: - builder.structures.append(grass_trees_tall) - - # Add the grass if missing - if not has_grass: - var grass = load("res://structures/grass.tres") - if grass: - builder.structures.append(grass) - - # Special handling for power plant mission: add power plant - # Use more robust checking for power missions - check power_math_content as well - elif (mission.id == "5" or mission.power_math_content != "") and builder: - # Check if we need to add the power plant - var has_power_plant = false - - # Look through existing structures to see if we already have it - for structure in builder.structures: - if structure.model.resource_path.contains("power_plant"): - has_power_plant = true - break - - # Add the power plant if missing - if not has_power_plant: - var power_plant = load("res://structures/power-plant.tres") - if power_plant: - builder.structures.append(power_plant) - - # Update the mesh library to include the new structures - if builder.gridmap and builder.gridmap.mesh_library: - var mesh_library = builder.gridmap.mesh_library - - # Update mesh library for any new structures - for i in range(builder.structures.size()): - var structure = builder.structures[i] - if i >= mesh_library.get_item_list().size(): - var id = mesh_library.get_last_unused_item_id() - mesh_library.create_item(id) - mesh_library.set_item_mesh(id, builder.get_mesh(structure.model)) - - # Apply appropriate scaling for all road types, buildings, and terrain - var transform = Transform3D() - if structure.model.resource_path.contains("power_plant"): - # Scale power plant model to be much smaller (0.5x) - transform = transform.scaled(Vector3(0.5, 0.5, 0.5)) - elif (structure.type == Structure.StructureType.RESIDENTIAL_BUILDING - or structure.type == Structure.StructureType.ROAD - or structure.type == Structure.StructureType.TERRAIN - or structure.model.resource_path.contains("grass")): - # Scale buildings, roads, and decorative terrain to be consistent (3x) - transform = transform.scaled(Vector3(3.0, 3.0, 3.0)) - - mesh_library.set_item_mesh_transform(id, transform) - - # Make sure the builder's structure selector is updated - builder.update_structure() - - # Check if mission has a learning objective - var has_learning_objective = false - # Make sure mission has valid objectives data - if mission != null and mission.objectives != null: - for objective in mission.objectives: - if objective != null and objective.type == MissionObjective.ObjectiveType.LEARNING: - has_learning_objective = true - break + # Set the first objective as the current objective + if mission.objectives.size() > 0: + current_objective = mission.objectives[0] + print("Set current objective: " + str(current_objective.type) + " - " + current_objective.description) - # Show learning panel if mission has a learning objective - if has_learning_objective: - # Determine which panel to use based on whether full_screen_path is provided - if not mission.full_screen_path.is_empty(): - # Use fullscreen panel for fullscreen missions - if fullscreen_learning_panel: - fullscreen_learning_panel.show_fullscreen_panel(mission) - else: - print("ERROR: Fullscreen learning panel not available but mission requires it") - else: - # Use regular panel for traditional missions - if learning_panel: - learning_panel.show_learning_panel(mission) - else: - print("ERROR: Regular learning panel not available") - # Emit signal and update UI - mission_started.emit(mission) - update_mission_ui() func complete_mission(mission_id: String): if not active_missions.has(mission_id): @@ -403,33 +282,25 @@ func complete_mission(mission_id: String): # Send the "end" event to the companion await get_tree().create_timer(2.0).timeout -func update_objective_progress(mission_id, objective_type, count_change = 1): +func update_objective_progress(mission_id,count_change = 1): if not active_missions.has(mission_id): return - var mission = active_missions[mission_id] - for objective in mission.objectives: - if objective.type == objective_type: - objective.current_count += count_change - - # Only update to completed if we've reached the target - if objective.current_count >= objective.target_count and not objective.completed: - objective.completed = true - objective_completed.emit(objective) - - # Send dialog event if available - var dialog_key = "objective_completed_" + str(objective.type) - _send_companion_dialog(dialog_key, mission) - - # Update UI - update_mission_ui() - - # Emit progress signal for objective - objective_progress.emit(objective, objective.current_count) - - # Check if the mission is complete - check_mission_completion(mission_id) - break + current_objective.current_count += count_change + + # IF this is true then objectives are completed + if current_objective.target_count <= current_objective.current_count: + current_objective.completed = true + objective_completed.emit(current_objective) + var dialog_key = "objective_completed_" + str(current_objective.type) + _send_companion_dialog(dialog_key, current_mission) ## So Companion can react + update_current_objective(current_mission) # Go ahead and progress to nex objective if it exists. + + + update_mission_ui() + objective_progress.emit(current_objective, current_objective.current_count) + check_mission_completion(mission_id) + func check_objective_completion(mission_id, objective_type): if not active_missions.has(mission_id): @@ -469,6 +340,9 @@ func reset_objective_count(objective_type, new_count): # Send dialog event if available var dialog_key = "objective_completed_" + str(objective.type) _send_companion_dialog(dialog_key, mission) + + # Update current objective to next incomplete one + update_current_objective(mission) # Update UI update_mission_ui() @@ -512,15 +386,19 @@ func _on_structure_placed(structure_index, position): print("Structure placed: " + structure.model.resource_path) # Update objectives based on structure type + match current_objective.type: + ObjectiveType.BUILD_STRUCTURE: + update_objective_progress(current_mission.id, 1) + + + if current_mission: - if structure.type == Structure.StructureType.ROAD: - update_objective_progress(current_mission.id, MissionObjective.ObjectiveType.BUILD_ROAD) - elif structure.type == Structure.StructureType.RESIDENTIAL_BUILDING: + if structure.type == Structure.StructureType.RESIDENTIAL_BUILDING: # Note: for mission 3, the objective update happens after construction is complete # See builder.gd -> _on_construction_completed # Special check for mission 1 since we might need to manually spawn a character - if current_mission.id == "1" and not character_spawned: + if character_spawned: # Only spawn a new character if: # 1. This is mission 1 # 2. We haven't spawned a character yet @@ -535,16 +413,6 @@ func _on_structure_placed(structure_index, position): if spawn_character: # This will be done after construction completes in mission_manager._on_construction_completed print("Character will be spawned after construction completes") - else: - # Update the objective progress for building a residential structure - update_objective_progress(current_mission.id, MissionObjective.ObjectiveType.BUILD_RESIDENTIAL) - else: - # Normal case - not mission 1 or character already spawned - update_objective_progress(current_mission.id, MissionObjective.ObjectiveType.BUILD_RESIDENTIAL) - elif structure.type == Structure.StructureType.POWER_PLANT: - # For mission 5, we update the economy/power objective when a power plant is built - if current_mission.id == "6": - update_objective_progress(current_mission.id, MissionObjective.ObjectiveType.ECONOMY) # Check for power plant unlocking in normal gameplay if structure.type == Structure.StructureType.POWER_PLANT: @@ -558,21 +426,6 @@ func _on_structure_placed(structure_index, position): hud.total_kW_production += power_produced hud.update_hud() -# # Check for residential building placement to update population -# if structure.type == Structure.StructureType.RESIDENTIAL_BUILDING: -# # This should increase the city's population -# var population_added = structure.population_count -# if population_added > 0: -# # Get the HUD if available -# var hud = get_node_or_null("/root/Main/CanvasLayer/HUD") -# if hud: -# # Update the population display -# hud.total_population += population_added -# hud.update_hud() -# -# # Emit signal for population update -# hud.population_updated.emit(hud.total_population) - # Only used for mission 3, to disable builder functionality during the companion dialog func _on_learning_panel_opened(): if builder: @@ -765,9 +618,6 @@ func _spawn_character_on_road(building_position: Vector3): # Set character as spawned to prevent multiple spawns character_spawned = true - # Update the objective progress for meeting a character - if current_mission and current_mission.id == "1": - update_objective_progress(current_mission.id, MissionObjective.ObjectiveType.MEET_CHARACTER) # Make sure the character has auto-patrol is enabled if the character supports it if character.get("auto_patrol") != null: @@ -1223,6 +1073,27 @@ func _send_companion_dialog(dialog_key, mission): JSBridge.get_interface().sendCompanionDialog(dialog_key, dialog_data) return true return false + +# Helper function to update the current objective to the next incomplete one +func update_current_objective(mission = null): + # If no mission was provided, use the current mission + if mission == null: + mission = current_mission + + if not mission: + return + + # Look for the first incomplete objective + for objective in mission.objectives: + if not objective.completed: + current_objective = objective + print("Updated current objective: " + str(current_objective.type) + " - " + current_objective.description) + return + + # If all objectives are complete, keep the last one as current + if mission.objectives.size() > 0: + current_objective = mission.objectives[-1] + print("All objectives complete, keeping last one as current objective") # Fallback to force a connection if the normal method doesn't work func _force_learning_companion_connection(): @@ -1239,3 +1110,7 @@ func _force_learning_companion_connection(): # Send initial event if we've already started if current_mission: _on_mission_started_for_companion(current_mission) + + +func _on_hud_population_updated(new_population: Variant) -> void: + update_objective_progress(current_mission.id, new_population) diff --git a/scripts/mission/mission_objective.gd b/scripts/mission/mission_objective.gd index 38420db..30dca04 100644 --- a/scripts/mission/mission_objective.gd +++ b/scripts/mission/mission_objective.gd @@ -1,27 +1,17 @@ extends Resource class_name MissionObjective -enum ObjectiveType { - BUILD_STRUCTURE, - BUILD_SPECIFIC_STRUCTURE, - BUILD_ROAD, - BUILD_RESIDENTIAL, - BUILD_COMMERCIAL, - BUILD_INDUSTRIAL, - REACH_CASH_AMOUNT, - LEARNING, - CUSTOM, - MEET_CHARACTER, - ECONOMY -} +const ObjectiveType = preload("res://configs/data.config.gd").ObjectiveType @export var type: ObjectiveType @export var target_count: int = 1 @export var current_count: int = 0 @export var description: String = "" -@export var structure_index: int = -1 # For BUILD_SPECIFIC_STRUCTURE type @export var completed: bool = false +@export_subgroup("Structure") +@export var structure: Structure + func is_completed() -> bool: return current_count >= target_count diff --git a/scripts/sound_manager.gd b/scripts/sound_manager.gd index 6db63f3..be80df7 100644 --- a/scripts/sound_manager.gd +++ b/scripts/sound_manager.gd @@ -11,7 +11,7 @@ var react_sound_bridge = null # Will be instantiated from a script var audio_bridge = null # Will be instantiated from a script # Volume ranges from 0.0 to 1.0 -var music_volume: float = 0.1 +var music_volume: float = 0.0 var sfx_volume: float = 0.1 # Mute states From ee149159c53c1a51c7b7dd8ecb7017b6c12e60e3 Mon Sep 17 00:00:00 2001 From: Wade Date: Fri, 18 Apr 2025 13:42:44 -0500 Subject: [PATCH 4/5] Working missions based on adjustments for unit 1.02 --- global/event_bus.gd | 2 +- global/globals.gd | 17 ++++ mission/fifth_mission.tres | 78 ------------------ mission/first_mission.tres | 64 -------------- mission/fourth_mission.tres | 67 --------------- mission/second_mission.tres | 64 -------------- mission/sixth_mission.tres | 67 --------------- mission/third_mission.tres | 62 -------------- models/building-small-d.glb | Bin 39348 -> 0 bytes models/building-small-d.glb.import | 36 -------- project.godot | 1 + scenes/main.tscn | 19 +++-- scripts/NavigationNPC.gd | 1 - scripts/builder.gd | 10 +-- scripts/hud_manager.gd | 14 +++- .../mission/building_construction_manager.gd | 2 +- scripts/mission/construction_worker.gd | 9 +- scripts/mission/mission_manager.gd | 37 ++++++--- scripts/mission/mission_ui.gd | 8 +- structures/building-small-d.tres | 14 ---- 20 files changed, 76 insertions(+), 496 deletions(-) create mode 100644 global/globals.gd delete mode 100644 mission/fifth_mission.tres delete mode 100644 mission/first_mission.tres delete mode 100644 mission/fourth_mission.tres delete mode 100644 mission/second_mission.tres delete mode 100644 mission/sixth_mission.tres delete mode 100644 mission/third_mission.tres delete mode 100644 models/building-small-d.glb delete mode 100644 models/building-small-d.glb.import delete mode 100644 structures/building-small-d.tres diff --git a/global/event_bus.gd b/global/event_bus.gd index 63130d3..a92004f 100644 --- a/global/event_bus.gd +++ b/global/event_bus.gd @@ -1,6 +1,6 @@ extends Node -signal population_update(new_population:int) +signal population_update(count:int) var current_scene = null diff --git a/global/globals.gd b/global/globals.gd new file mode 100644 index 0000000..b3eaf78 --- /dev/null +++ b/global/globals.gd @@ -0,0 +1,17 @@ +extends Node + +@export var population: int = 0 + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +func set_population_count(count: int) -> void: + # Update the population count + population += count + + # Emit the signal to notify other nodes + EventBus.population_update.emit(population) + + # Print the updated population for debugging diff --git a/mission/fifth_mission.tres b/mission/fifth_mission.tres deleted file mode 100644 index e276237..0000000 --- a/mission/fifth_mission.tres +++ /dev/null @@ -1,78 +0,0 @@ -[gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://p3xwn2mp6bm6"] - -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_dhx01"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="2_mum3p"] - -[sub_resource type="Resource" id="Resource_c06be"] -script = ExtResource("1_dhx01") -type = 7 -target_count = 1 -current_count = 0 -description = "Calculate how many power plants are needed to supply electricity to 40 houses." -completed = false - -[resource] -script = ExtResource("2_mum3p") -id = "5" -title = "Residential Energy Usage" -description = "" -objectives = Array[ExtResource("1_dhx01")]([SubResource("Resource_c06be")]) -rewards = { -"cash": 0 -} -next_mission_id = "6" -graph_path = "" -full_screen_path = "" -intro_text = "A neighborhood is calculating energy usage from gaming consoles and TVs. -At House A, they ran 2 gaming consoles and 3 TVs and used a total of 660 kilowatt-hours (kWh) of electricity. -At House B, they ran 4 gaming consoles and 1 TV and used 760 kWh of electricity." -question_text = "" -correct_answer = "150,70" -feedback_text = "Correct! You've accurately calculated that gaming consoles use 150 kWh and TVs use 70 kWh. Using a system of equations: 2x + 3y = 660 and 4x + y = 760, you can solve by substitution to find x = 150 and y = 70." -incorrect_feedback = "Not quite right. Try setting up a system of equations: -- House A: 2 gaming consoles + 3 TVs = 660 kWh -- House B: 4 gaming consoles + 1 TV = 760 kWh -Let x be the kWh for gaming consoles and y be the kWh for TVs. -So we have: 2x + 3y = 660 and 4x + y = 760" -company_data = "" -power_math_content = "" -num_of_user_inputs = 2 -input_labels = Array[String](["Gaming Consoles", "TVs"]) -companion_dialog = { -"correct_answer": { -"animation": "celebration", -"duration": 5000, -"text": "Excellent work! You correctly determined that gaming consoles use 150 kWh and TVs use 70 kWh." -}, -"hint_request": { -"animation": "thinking", -"duration": 5000, -"text": "Try setting up two equations: 2x + 3y = 660 for House A and 4x + y = 760 for House B, where x is the energy used by consoles and y is the energy used by TVs." -}, -"hint_second": { -"animation": "thinking", -"duration": 5000, -"text": "You can solve this by substitution. Rearrange the second equation to find y = 760 - 4x, then substitute this into the first equation." -}, -"incorrect_answer": { -"animation": "sad", -"duration": 5000, -"text": "Not quite right. Let's try setting up the equations again. Remember, we have 2 consoles and 3 TVs using 660 kWh at House A, and 4 consoles and 1 TV using 760 kWh at House B." -}, -"mission_completed": { -"animation": "happy", -"duration": 5000, -"text": "Now that we know the energy usage, we can plan our city's power needs much better. Well done!" -}, -"mission_started": { -"animation": "greeting", -"duration": 5000, -"text": "Let's tackle a challenging energy problem! We need to figure out how much electricity gaming consoles and TVs use." -}, -"question_shown": { -"animation": "thinking", -"duration": 5000, -"text": "This is a system of equations problem. We have two houses with different combinations of gaming consoles and TVs." -} -} -unlocked_items = Array[String](["res://models/power_plant.glb"]) diff --git a/mission/first_mission.tres b/mission/first_mission.tres deleted file mode 100644 index 94db62a..0000000 --- a/mission/first_mission.tres +++ /dev/null @@ -1,64 +0,0 @@ -[gd_resource type="Resource" script_class="MissionData" load_steps=5 format=3 uid="uid://x5h4xutbldq3"] - -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="1_nv6c6"] -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_yfbrc"] -[ext_resource type="Resource" uid="uid://dv14kkhb6umkv" path="res://structures/road-straight.tres" id="2_d0ffl"] - -[sub_resource type="Resource" id="Resource_ywws1"] -script = ExtResource("1_yfbrc") -type = 0 -target_count = 3 -current_count = 0 -description = "Build 3 connecting roads" -completed = false -structure = ExtResource("2_d0ffl") - -[resource] -script = ExtResource("1_nv6c6") -id = "1" -title = "Census Planning" -description = "As the new city planner, you need to establish a baseline understanding of your growing community. The mayor has requested a comprehensive census to guide future development." -objectives = Array[ExtResource("1_yfbrc")]([SubResource("Resource_ywws1")]) -rewards = { -"cash": 250 -} -next_mission_id = "2" -graph_path = "" -full_screen_path = "" -intro_text = "Welcome to Stem City! Let's learn how to build a city from the ground up. Start by building a road." -question_text = "" -correct_answer = "" -feedback_text = "" -incorrect_feedback = "" -company_data = "" -power_math_content = "" -num_of_user_inputs = 1 -input_labels = Array[String]([]) -companion_dialog = { -"correct_answer": { -"animation": "happy", -"duration": 5000, -"text": ["Great job! That's the right answer!", "Perfect! You got it right!"] -}, -"incorrect_answer": { -"animation": "sad", -"duration": 5000, -"text": ["Hmm, that doesn't look right. Let's try again.", "Not quite right. Don't worry, you can try again!"] -}, -"mission_completed": { -"animation": "happy", -"duration": 6000, -"text": ["You've completed your first mission! Great job building your first road!"] -}, -"mission_started": { -"animation": "excited", -"duration": 6000, -"text": ["Welcome to Stem City! I'm your learning companion. Let's build a city together!", "Time to start our adventure in Stem City! I'll help you build your first city."] -}, -"objective_completed_2": { -"animation": "happy", -"duration": 5000, -"text": ["You built a road! Now your citizens can move around the city.", "Nice work on that road! Roads help connect different parts of your city."] -} -} -unlocked_items = Array[String](["res://models/building-small-a.glb"]) diff --git a/mission/fourth_mission.tres b/mission/fourth_mission.tres deleted file mode 100644 index 06dd0e7..0000000 --- a/mission/fourth_mission.tres +++ /dev/null @@ -1,67 +0,0 @@ -[gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://bho4qh41asyk1"] - -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_dhx01"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="2_mum3p"] - -[sub_resource type="Resource" id="Resource_c06be"] -script = ExtResource("1_dhx01") -type = 3 -target_count = 40 -current_count = 0 -description = "Build 40 residential buildings with construction workers" -completed = false - -[resource] -script = ExtResource("2_mum3p") -id = "4" -title = "City Expansion Project" -description = "Your city needs to grow! Build 40 residential buildings using your team of construction workers. Watch as they construct each building from the ground up!" -objectives = Array[ExtResource("1_dhx01")]([SubResource("Resource_c06be")]) -rewards = { -"cash": 0 -} -next_mission_id = "5" -graph_path = "" -full_screen_path = "" -intro_text = "Your city is expanding rapidly! Now that you've learned which construction company is more efficient, it's time to put them to work." -question_text = "" -correct_answer = "" -feedback_text = "" -incorrect_feedback = "" -company_data = "" -power_math_content = "" -num_of_user_inputs = 1 -input_labels = Array[String]([]) -companion_dialog = { -"hint_request": { -"animation": "thinking", -"duration": 5000, -"text": "Try placing the construction workers near where you want to build. They'll automatically start constructing buildings!" -}, -"mission_completed": { -"animation": "celebration", -"duration": 5000, -"text": "Amazing job! You've successfully built all 40 residential buildings. The city looks fantastic!" -}, -"mission_progress_25": { -"animation": "happy", -"duration": 5000, -"text": "Great progress! You've completed 25% of the buildings. Keep it up!" -}, -"mission_progress_50": { -"animation": "excited", -"duration": 5000, -"text": "Halfway there! The city is really taking shape now." -}, -"mission_progress_75": { -"animation": "excited", -"duration": 5000, -"text": "Almost there! Just a few more buildings to go." -}, -"mission_started": { -"animation": "greeting", -"duration": 5000, -"text": "Welcome to the City Expansion Project! We need to build 40 residential buildings using our construction workers." -} -} -unlocked_items = Array[String]([]) diff --git a/mission/second_mission.tres b/mission/second_mission.tres deleted file mode 100644 index d419998..0000000 --- a/mission/second_mission.tres +++ /dev/null @@ -1,64 +0,0 @@ -[gd_resource type="Resource" script_class="MissionData" load_steps=5 format=3 uid="uid://cjr36hqnmyn0x"] - -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_dhx01"] -[ext_resource type="Resource" uid="uid://cntgl86ianngh" path="res://structures/building-small-a.tres" id="2_em5vq"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="2_mum3p"] - -[sub_resource type="Resource" id="Resource_7c02e"] -script = ExtResource("1_dhx01") -type = 0 -target_count = 3 -current_count = 0 -description = "Build a residential building" -completed = false -structure = ExtResource("2_em5vq") - -[resource] -script = ExtResource("2_mum3p") -id = "2" -title = "Census Planning" -description = "Now that we have a road, let's build a residential building for our citizens!" -objectives = Array[ExtResource("1_dhx01")]([SubResource("Resource_7c02e")]) -rewards = { -"cash": 250 -} -next_mission_id = "3" -graph_path = "" -full_screen_path = "" -intro_text = "Great job on the road! Now let's build a residential building where our citizens can live." -question_text = "" -correct_answer = "" -feedback_text = "" -incorrect_feedback = "" -company_data = "" -power_math_content = "" -num_of_user_inputs = 1 -input_labels = Array[String]([]) -companion_dialog = { -"correct_answer": { -"animation": "happy", -"duration": 5000, -"text": ["Great job! That's the right answer!", "Perfect! You got it right!"] -}, -"incorrect_answer": { -"animation": "sad", -"duration": 5000, -"text": ["Hmm, that doesn't look right. Let's try again.", "Not quite right. Don't worry, you can try again!"] -}, -"mission_completed": { -"animation": "happy", -"duration": 6000, -"text": ["You've completed your second mission! Great job building your first residential building!"] -}, -"mission_started": { -"animation": "excited", -"duration": 6000, -"text": ["Now it's time to build homes for our citizens!", "Let's add a residential building to our city!"] -}, -"objective_completed_3": { -"animation": "excited", -"duration": 5000, -"text": ["Amazing! You built your first residential building where people can live.", "You just built a home for your city residents! The population is growing."] -} -} -unlocked_items = Array[String](["res://models/grass-trees.glb", "res://models/grass.glb"]) diff --git a/mission/sixth_mission.tres b/mission/sixth_mission.tres deleted file mode 100644 index 24f9d99..0000000 --- a/mission/sixth_mission.tres +++ /dev/null @@ -1,67 +0,0 @@ -[gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://bv4r7ebpjdce4"] - -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_nxtw6"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="2_83mjp"] - -[sub_resource type="Resource" id="Resource_power_plant"] -script = ExtResource("1_nxtw6") -type = 10 -target_count = 1 -current_count = 0 -description = "Build a power plant to provide electricity to your city" -completed = false - -[resource] -script = ExtResource("2_83mjp") -id = "6" -title = "Powering Your City" -description = "Now that you've calculated how many power plants you need, it's time to build one to power your growing city of 40 houses." -objectives = Array[ExtResource("1_nxtw6")]([SubResource("Resource_power_plant")]) -rewards = { -"cash": 1000 -} -next_mission_id = "" -graph_path = "" -full_screen_path = "" -intro_text = "Your calculations showed that one power plant will be sufficient to power all 40 houses in your city. Let's build that power plant now to keep your residents happy!" -question_text = "" -correct_answer = "" -feedback_text = "" -incorrect_feedback = "" -company_data = "" -power_math_content = "" -num_of_user_inputs = 1 -input_labels = Array[String]([]) -companion_dialog = { -"building_selected": { -"animation": "happy", -"duration": 5000, -"text": "Great choice! The power plant will supply all the energy our residents need." -}, -"hint_request": { -"animation": "thinking", -"duration": 5000, -"text": "Click on the power plant in your building menu and then place it in an open area of your city." -}, -"mission_completed": { -"animation": "celebration", -"duration": 5000, -"text": "Congratulations! Your city now has power for all residents. You've learned how to use systems of equations to solve real-world problems!" -}, -"mission_started": { -"animation": "greeting", -"duration": 5000, -"text": "Time to power up our city! Based on our calculations, we need to build a power plant to provide electricity to all 40 houses." -}, -"placement_hint": { -"animation": "thinking", -"duration": 5000, -"text": "Try to place the power plant away from residential areas but close enough to supply power efficiently." -}, -"placement_success": { -"animation": "excited", -"duration": 5000, -"text": "Perfect placement! Now the power plant can distribute electricity to all the houses in your city." -} -} -unlocked_items = Array[String]([]) diff --git a/mission/third_mission.tres b/mission/third_mission.tres deleted file mode 100644 index e16c146..0000000 --- a/mission/third_mission.tres +++ /dev/null @@ -1,62 +0,0 @@ -[gd_resource type="Resource" script_class="MissionData" load_steps=4 format=3 uid="uid://dykbopx8n3c3v"] - -[ext_resource type="Script" path="res://scripts/mission/mission_objective.gd" id="1_l3spi"] -[ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="2_b4llw"] - -[sub_resource type="Resource" id="Resource_c06be"] -script = ExtResource("1_l3spi") -type = 2 -target_count = 50 -current_count = 0 -description = "Reach a population of 50 citizens" -completed = false - -[resource] -script = ExtResource("2_b4llw") -id = "3" -title = "Census Planning" -description = "As your city grows, you need to choose the most efficient construction company." -objectives = Array[ExtResource("1_l3spi")]([SubResource("Resource_c06be")]) -rewards = { -"cash": 500 -} -next_mission_id = "4" -graph_path = "res://images/mission_2.png" -full_screen_path = "" -intro_text = "Your city is rapidly growing, and you need to build houses to accommodate new residents! Two different construction companies offer to help. Study the company data below, find the unit rates (houses per worker), and determine which company would require fewer workers to build 40 houses in a week. Which company requires fewer workers to build 40 houses in a week? (A or B)" -question_text = "Which company requires fewer workers to build 40 houses in a week? (A or B)" -correct_answer = "A" -feedback_text = "Correct! Company A (City Builders Inc.) would require fewer workers to build 40 houses. Company A builds at a rate of 4 houses per worker per week, while Company B builds at a rate of 3 houses per worker per week. For 40 houses, Company A needs 10 workers while Company B needs about 13.33 workers." -incorrect_feedback = "Not quite right. Look carefully at the data for both companies. Compare their rates: Company A builds 4 houses per worker per week, while Company B builds 3 houses per worker per week. Calculate how many workers each would need for 40 houses." -company_data = "" -power_math_content = "" -num_of_user_inputs = 1 -input_labels = Array[String]([]) -companion_dialog = { -"correct_answer": { -"animation": "happy", -"duration": 5000, -"text": ["Perfect! Company A is more efficient because each worker builds more houses per week.", "Exactly right! You found the company that can build the houses with fewer workers."] -}, -"incorrect_answer": { -"animation": "sad", -"duration": 5000, -"text": ["Let's think about this differently. Look at how many houses each worker can build per week and calculate from there.", "Not quite right. Check the rates carefully: how many houses can one worker build in a week for each company?"] -}, -"mission_completed": { -"animation": "happy", -"duration": 6000, -"text": "Great job selecting the most efficient construction company! Your city will grow faster now." -}, -"mission_started": { -"animation": "excited", -"duration": 6000, -"text": ["It's time to expand our city! We need to choose the most efficient construction company.", "We have two construction companies offering their services. Let's analyze which one is better!"] -}, -"objective_completed_7": { -"animation": "happy", -"duration": 5000, -"text": ["You've solved the construction company problem! That's good mathematical thinking.", "You've made a wise decision based on the data. That's how city planners work!"] -} -} -unlocked_items = Array[String](["res://models/road-corner.glb"]) diff --git a/models/building-small-d.glb b/models/building-small-d.glb deleted file mode 100644 index e65482774c03cfee4196a0ffc7f6f8c7922ce24f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 39348 zcmeHQ34B~txj*NKhzN)X$fAfNvRP`DHfd`+!&6(?X&REWw3OngSPB$H zK&2IteNluWh=@(5tRfar%A&Y|kH@PUqPRbwzW@K+`@eJMb|#rLp@4QS-#y>=o&UF< zbMKwZ%&)YzPoL)4ZUkxr3_iW4fDXWyYPDIr6Znr}jWSudDgg zp01{j?v}Y-b22B7$aK$y)6BS$0}z>$7mrwklQY0PLjI1A1*D$7j)R@tY zqZ;bR)HgI%2wx8AbAp@oQmP+RN_9y}H6zD1jA>+B$2N|x!K<#GJs;gTwl?VoT0XYk zV;UR%;xsnYjviAxs;*}2dU=d0mxoWzuYYa*C?MhuFzuiNCLJ&}Nu{x_5rt{75%gqk zwP=asjkd6-c~WynYtQV=xcbJ1`nn>3yD!|0ekaZd@M9Y5u??x2*3;EC3mdZ*%h=P@ z)yiwEe$?28y5f#Xtf#cJ_-n9et@uUFhWM*(9My>MVS=@_4WoE*RGCrT*xEW=yrGBD zW9r!4DjlF?u0`ko`!bb5Jv-bsr>WK778YgZb+zH1Fg?1Vbbnyx+;-efnmR{zcC=z0 z<6DNb{#G%ksi(QCt*Jd)oX#0tM>Y50M$$HO>fCv)vpaAb;T>*9Q+M-0bQZg&uB~HM zGj0tivUppgzWgl>6S&VEGtGn|eRMw44 z0G;U%-rY2(vmH+ee`m)XbYfdOmLfB5?AS4l3>7~XqWKu?op#Ti*EKVGHmtv*i_Im* z9C-L-JgrQQC%iZoJQwk~N7hW5Abr4xc=5CgZN-Or&&Pg3eU7%F{{X`|zK9R=k>1;S zM2rb|`3!9<@!n4mSGI_`Cc9$!2^{;#x3s*F6(8#FAR9d`+E%av45YZFe{cXr;Yps`7cXsiBT-@$UllpKCo3?@V^ZD zC@y=XxXeLuq3@L~^#LZd?M-6sv0t{nzB_l-j(7LI@TpTgzxls@(YpeAnCD(>ysr0& z7n(i4?}R6MSKq%5J;~?Ze9eh{moNFt1lsO;;Pk$83g7bj$DYmfHD2+k*ORZLmmm6+ zAI4QI`tNF6?Bmjpa$~HW{@&&Dq(0=!;X|K{75ZU~%zyHov-`rhs{Mxdbtg5dC+bz0 zzwqo;=u>quXJP15wycrs$m=2+*IUlkiCnmHd zFO2lWOV4Y34X$-!$Q!fT=O8^}Nk6LoWzW-Ayz&<&?FY4cpVarqGY7^JMm+V5MLlDQ zPv@^ZRSWT~_s!23&m{mWU@!soB&sV6>up5YlC@zfJ1y!c9fI3JU@ z3+@kIzhe2161{lF5-_-OPhpf>+E#ktd@SNaKEfC8lX&iDd4HpxadfW}PyP0{ zoa_5TKjNuBeZrQBUVP-gG=J5|+*Fr%;zK_4Pd$669Bw`ID$g^Pc-ALOxmv<}$cK5# z59^X%y!=bAJhi6Gjj@Rj^ORorO10CL`-*t2uWF}H^2|ZJ{76s#<#^&%m+F-t^@kYc zOkR5BtbS?_5F?%#$R*El;o+wb*CzHZF%eH&Jrk)HPd#$z6<&NCEAfN4o)7inS%Y}_ zA)b2WAWWDK`4A&p=#uvUFHDY$bZTEgv1s${{4gS>Q7iZdF>_XiI+aM#j_`R zFNC8Ow#D}$uCnjAleEGg9&j?eJbJ@6I?OK;~jfzWs7&pvQal;x_m)1h-MLqBP z%kdrt_vb$Fcvd7l1cK zc+bZ@tmKDlp|~Nw#7__x*reVPTk7L_X`7964*9VEwDp*1yxsFr?h(J)W;elKqR&E3 zd`eGUpvQbMhsZwKOVUTW1jBp~BifSzKJi1}0VbR7t=5J027MOqYt&k^&X`Bc;+_n6 z>ixP${Y!ZI@p}3Qc)vzLT#t!r<-Tdj#r2B!y`r8N))w>B!&jmg@B0w=@p{??_|T`< zt0%;TykfE5*r&G@hI;amU4mgxr1!jR1AUl7Ul2FMm-rzj&WCu_TVhLnoSVmlyljz! z$3$4(vyz?JHw z@LSeNwTT>h+u zdi96Aat`&%S+%H##E2&ba>?En9{OI@0{^&9lWPs{QIl(`PdxGP>#r~3#aHqp4Ca}C zALELrZJfW?i&x)d8}~fPf%-7dFo)1*S|7#@dBz16wM5sK_^5B;XV(!=J@%N-hknFU zkM<;CoO>Y@0^|C*%F@a6eXPd@ZdjMk2N?Rmx$PyfP{t0l~be3+;FurBGv%fIx> zQ)|lH*mL5^D+lR?*ZNYgo(L1)=aW6D+A;6@pzA_<`V9L}j;F2aQoZt{{t&|)REzY= zxmZj2{h*%Hk9gWX|NEQ9uUXTc`$X61?6aLe{xWC&t@Ow=Xve9j^BJC`>TH*>-k0Zo$U4WPkkCgJuxAkKB=cq>V*ko zh4?TZ^2Dce3w<&NVwg{e4|5BB-o5Z*+&l6)ey6j;i+Rs4o_cw&_|q;sqvZRb@cSC^ z{C-E@vpjL!g(cs)NdMHKBN7b1uhDlgw0-+CEAbvCpJOcX%t07_UlV?x<&HbXGEC0ZGQO{AMFh73j4xbNub@eY#PwHjdFlXgM|6$zI7kt;R1!J|I zb)n~(Po-F4KI*MvDF^vfZtMyBrW}Y5W0lK?wjo|VnJ4RFtS?@3PSR)ArFyk?!l+lW zWj@3xf7;@{g!{$Ly!Y@vmhjZ;vo-3)>$8jKeiePzM4tC6eWpYn_aN_+et3_SfAQ4o z9!UQI4?oHK#)Q{>m40CBpEcye?=kfqCBJhNukR4~HwC}1WUt8cd)x4PM)9-_zlUWE z{{6Ei$_alvB)qRrdg8=K7=J&tKf(6I=FC_&Bb&_4*he<`d>n zq7QQj;|BWBcD)>w8}m`zFt%;cpvnOSrd-}}6S*O+(z6YKoi!P_fTrS4sLLT-x;#qMu zd|=DC@)_okV@~o3jB+c{hnSEL@S)F;_v;(im<#Y}eUe+MCuQ{khCYR< z+e`ASqz9C-m=|C9q4C~DE{Ii9Z>W#+Gt^b!vw=S3`vO0O08>dH+GYdWGI?%T&*Q$a z-@YD>ab9`y=xHH{Te2>k99qxAwezvc)V01o>{|uCq;DZ6tfdNliJ!oBy*x2Ttlu*s z|MF&|b0qdE zbq{myN8d*rI|59?LznE~kZ00C-md^(O;1WN$r|<3^8^$2B*a(J_tUrJno8LwYg*d3 zV$PvH?0LwCn2;ZA|HJ%Ke6rSI+{i!98~HlD_klzG`;ETs7Zt$!duq&A(kGbso^CLf z*oOK_JYx90!T5vZvjILE_|FCT>v_Z6O7x*^$cKJHKJ>|4xk9w-N1tHe$M4BFhq8M3 z@)-IH`Or4x0}T5n+mNs1rx5rlRIu#}F+sg0wxOOIHn^VuQ+VI^xc1iqpF=Ku<%fGM zc<-X)_+IGuaCl!VqfaoLqb=`qB>4&T0nhuo@FCCprSzd6zAuo^T!0B}(|<2y;~YwC zgBp|f8t_-bQ;ut)|H1IgU-*iAkV7Hl5i?IY_EEy)TGf4S)B9>P3VllY%f1cwwXnWV zXg2cmI;cspnFL;&-dD2=;T{NiTt6k(6|X7c@hZ8dsMoc&>H4bNPxdX?bFUDOD4VV? z|LkKY(2FW~zb?Y%1DmpZu-{Am*6v52++%@B`2Mc1!R(W_j+pOr|3Q9PUo|{&>??#f7`m4-0jUQ_MiN9Q`e^tsGd%yg9#ry5 zp7N!E41YeKz<*k1{9eraeB*fZ=jAw`WIm3c%tKxk=OcUO!~A5=c&x9iOg-lrhxO48 z`S&u9xS#9I(|@X;v@gW=h1h;oZ13ZT^Rd03XS{g*gl9aipZw+6U-mV~Cz*#1IK8;H z2P+Tt`c3S8zP#y0*)Wf4?x+7=*JE6BydZu(uqJxF5^~aSu03Prqi9L20p!8%m-XX%kbmBw}78~F0w1i+oka8m*S`WX&!byzi2G_i|mSWl$Zbf%;P1? zKB`e2NcL>37`m){)i1;=C>mpHUiGHuH-cPteS>_;&a0kH>p!^r0oOcSfAIN8PWIYH zmectRSzd2{>zZfn-0$!3*DkA0WPi_)tUW~;RO0VdkW=e5OGeSg(^Ag%}J zA@_HGMIL%_FAa4+4X=Ih`zZhZEs#-DJ{QOX&3n9lSM^8#o3Il5vhxwn_}|tsURr*j z_*=9B=SzQ+Rh5jq{cqW1Un28!SI!6ddO3=d*Y8d$&I4EC5BZkJ@az3Weev~`$mnlL zyg-H@-@j_-JwB)hb|v;@=Y#w`KFHt8LH=dsU_JbN8Cm_%e2E;axBM5l9#I|nT(JJK z@8f*bC%--(ALUuH-&AkE^XQSEr%(24lRW5tpl5o$_U>=dn)aLDtGfRB`!sq_Ui^D? zr}*!0%|ph%FV08Lq@t|9w=w$b19sfY$=|<~=Jjk7K8joX`#y?Wl%qV0a%5+W{HNte zU&N_$@03@e1rmS`O;>^FjTR)lV-6^~+z$e3XZ;*Uuwg zjJ`k0uSBk5f9AA%Bkb@#|KU3y`A@FhjVup$J*D?A_Frqv{!!la_i?o1!?T}~{p0sL zJZt~F-eg>7elIHjD&?W>-(l-lmH8&|V*F6^AF6#ipN%aKHUIVO3%a^=zu9#EQAgOT z_4);!UK=u>>=*Ri`_4z+_#Aj$$?A>ruTmarKZmVCF-$$T8o&oj!ndoJW>G?`>8ZTL+?9#II8Z|%IF>Nn7J*NF?Ui!4$(sHct z2md`v_DQ(<`e|kRCY<~TCqEj68>&C#e+lsVpv?7OKdx}H7cN@&B3|?I zr+MKursriBjVrMq=OYh}%&R{+jZ5Rp&nwP`j>WtbZ*XHeZrY#brLQEX^#kG4^Rgf8 zC_fuIrsJjkXkPkCa#}wSUh~Fu`hBJG5&Zky+-Dl2{k{_at}U;RmH2zK6fb?Wzl%7@ zX+M(XNA}f^ye=81{3!p!HL8y7Z#mA#)hK;Bk91t&rBBO6KT&_vvg|afPwJoaX}^*O z8kK)BZq(PboW^Nh`)=st3BJEYKaw@_Ij|D%XG-OC9%(t9cUo4ww4G$(HA=6sn2+)* z9c5Q(RD6w<{7RqpBfCnYu5*oPob>5YIO(gEh0`ee^q8KPoE|IL30G-e`ZR914{1M=)AsT+@VIIJgzu}>PwkVmEPbVMsQX9v zw@Ra)8=9{qr}e^XOwUVBkHS|w%3kNXo6Q!WEzMiZHfC$H6=)mtR<-G9_nJM;`^+9V?_u^bdxPH-$6jV1aC@75 z&HF*oxQ`hD?Ou@gG5g`5Tw^|9M&dlu)S5c*H8^TbJ-9kE%8Uj@W4&pBwia@|X~aQ! zoEdAzfX0~*;(y{f!HfrGP0k!>4lw(J4m1auiRKV zG}%lsQ_Y9W(V(ejnmN`SW2S?SHOH9`n-k3Opbwi9%_-(&a}wwjbE=tPn#^gS8D^$w zG0kQc&a+IbnGL=LN2_TAH`{!~d=wOoZKfUCR>*B;4i3tlX0GV~b(+(0beb+4ou=FL zfI4xWhjBj6unsCmS!0X=FS!||y3zWD(t8Xq^0Lt1N|GEbT( zKu?*caXe*yh~p{qBl8pUWAhB?C+4T-S@U!AGxHqI&zfK0{2b2Dng24+gQxtw`ERq% z{EvA7w9fnz$2#*X^J~yLoY$G(;QSl&Tk~S9ebM~R{K5R*yaf7#dD;Bg{K@Fo7*?q%|M&mH`y)io9z~$ zE$v(EHg;>f6=)m#R=b^jo81<)oqfCA(e7Zk2kmIzVRx}R+nqqW*j?>z_FeX!pxx}d zZN|RG?heY>_u4(}`|KW|J?&n0U%QXp8?>)|za44!vm-zw?FVd~t+h3vI$LiW>}Wd* z)L~uTLP6bW3$JpcTarRiy@%99Jl0DIW7<7_7*`8)k zwWokivrTrEooQ!)X4z&t+qT*k&}`dg+wDi~M?md%j_tH_Z3n2+o{po_cH!J*yK(e@ z>jpm$T(_N%^L%>-q%OMv=LL2ljs^Bi=+Cf=FfOoXVLZbw#(A+l8=A9lKHF;-;ruZi zXW2Z?dHZpDj{T(l1n3<5DIDk6B{(m!=i*pmm*TwCo`++pJs;=u?FBf_x65!|W-qiC z+0WQdgD$e4#c`3n80U-aB{(j&m*RY>{hYnbe!+eobeUalFSlQ`D?pdqFWD>Ym+cjx zEA3VGT6>MX8g#9_&faKmu-Aibv^UwC?N{wrKsVd3*_HNIdkbi#z0KZXZ?|6u-C@6B z@3P;tcY^M+-?FRhx9#1aRkqizwguYw7ckF|phwOK8 zJY*ln@sRzVebhc;*MJ_ikJ-oV5A65tTAUxZPvE>3=e71p`xJP}PuZvKGxkUJhoEQd zk8wO>e`0?MdIslb?9Xuinf=~|FXXTJ#YWpuCxDRUjVJMzr?Z5{>uIu zX%f7*Xxv~Dx^2IoMVxi`8k+?(9ype@{+actqXbZ-Gg<5q4fNL#yY-CNx@pl#jT zaBS`+yq>s&TbAYFwSG$5;od zccXCByU}ipYjh2uF>b6I?>^|pfyTQDZhx0^S_=z82j@C)3T;1{|@7#Fy+FfPRTOwdA{7rMnR?>^?v2Ibwy z-8t@)?h~MM+^5`9cdlCkTI$Yo%iIO-e9$s?p}WX^#(f%ek^8K>)Lr5(23_ht=Pq+! zaGwWV=9at5-51>o(BUF)uMH@X|#^`INwP3~s*RreLp z&F*V%rMuPL0$S;A!}&J%bsV?3+i||#-GSqF_YHTK`=+}SbeH>?FyiK+`TyNare0g-2?7^(1Y$f?qT;`_Ymk|_dWNhd&I2)J?b8FkGmhZ?}Hw9 YYjIxdp1`rzJ&E&^?kOBkx~JX$11p#!EC2ui diff --git a/models/building-small-d.glb.import b/models/building-small-d.glb.import deleted file mode 100644 index 94d07a2..0000000 --- a/models/building-small-d.glb.import +++ /dev/null @@ -1,36 +0,0 @@ -[remap] - -importer="scene" -importer_version=1 -type="PackedScene" -uid="uid://h0vrvst3cumo" -path="res://.godot/imported/building-small-d.glb-5e1b608dc43429cd8ce16f120ad53455.scn" - -[deps] - -source_file="res://models/building-small-d.glb" -dest_files=["res://.godot/imported/building-small-d.glb-5e1b608dc43429cd8ce16f120ad53455.scn"] - -[params] - -nodes/root_type="Node3D" -nodes/root_name="Scene Root" -nodes/apply_root_scale=true -nodes/root_scale=1.0 -nodes/import_as_skeleton_bones=false -meshes/ensure_tangents=true -meshes/generate_lods=true -meshes/create_shadow_meshes=true -meshes/light_baking=1 -meshes/lightmap_texel_size=0.2 -meshes/force_disable_compression=false -skins/use_named_skins=true -animation/import=true -animation/fps=30 -animation/trimming=false -animation/remove_immutable_tracks=true -animation/import_rest_as_RESET=false -import_script/path="" -_subresources={} -gltf/naming_version=0 -gltf/embedded_image_handling=1 diff --git a/project.godot b/project.godot index a2feb9d..f2649e6 100644 --- a/project.godot +++ b/project.godot @@ -26,6 +26,7 @@ general/default_playback_type.web=0 SoundManager="*res://scripts/sound_manager.gd" EventBus="*res://global/event_bus.gd" +Globals="*res://global/globals.gd" [display] diff --git a/scenes/main.tscn b/scenes/main.tscn index 59a48ca..66b0f20 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=33 format=3 uid="uid://vgwrcfy1qawf"] +[gd_scene load_steps=34 format=3 uid="uid://vgwrcfy1qawf"] [ext_resource type="Script" path="res://scripts/builder.gd" id="1_jybm7"] [ext_resource type="Environment" uid="uid://jbptgqvstei3" path="res://scenes/main-environment.tres" id="1_yndf3"] @@ -8,24 +8,25 @@ [ext_resource type="Resource" uid="uid://cntgl86ianngh" path="res://structures/building-small-a.tres" id="5_v5o2m"] [ext_resource type="Resource" uid="uid://ccb475jeg7ym5" path="res://structures/grass-trees.tres" id="6_fwsy4"] [ext_resource type="Script" path="res://scripts/view.gd" id="8_yovpv"] +[ext_resource type="Resource" uid="uid://tm532uesguhk" path="res://structures/grass.tres" id="9_2t3p4"] +[ext_resource type="Resource" uid="uid://d2jplegnkl6u2" path="res://structures/road-corner.tres" id="10_ii8xx"] [ext_resource type="Script" path="res://scripts/mission/mission_manager.gd" id="10_oe3re"] [ext_resource type="PackedScene" uid="uid://dmsy06s02tcw4" path="res://scenes/generic_text_panel.tscn" id="13_7i6dj"] [ext_resource type="Script" path="res://scripts/mission/mission_ui.gd" id="13_xvw5w"] [ext_resource type="Script" path="res://resources/generic_text_panel.resource.gd" id="14_76jlq"] [ext_resource type="Script" path="res://scripts/mission/learning_panel.gd" id="14_q2ymb"] [ext_resource type="Script" path="res://scripts/mission/mission_data.gd" id="14_vcrh8"] -[ext_resource type="Resource" uid="uid://x5h4xutbldq3" path="res://mission/first_mission.tres" id="15_obmwc"] -[ext_resource type="Resource" uid="uid://cjr36hqnmyn0x" path="res://mission/second_mission.tres" id="16_rl54y"] -[ext_resource type="Resource" uid="uid://dykbopx8n3c3v" path="res://mission/third_mission.tres" id="17_rrdy6"] +[ext_resource type="Resource" uid="uid://x5h4xutbldq3" path="res://mission/unit_1.02/census_planning_1.tres" id="15_obmwc"] +[ext_resource type="Resource" uid="uid://cjr36hqnmyn0x" path="res://mission/unit_1.02/census_planning_2.tres" id="16_rl54y"] +[ext_resource type="Resource" uid="uid://dykbopx8n3c3v" path="res://mission/unit_1.02/census_planning_3.tres" id="17_rrdy6"] [ext_resource type="FontFile" uid="uid://d0cxd77jybrcn" path="res://fonts/lilita_one_regular.ttf" id="17_vlub6"] [ext_resource type="PackedScene" uid="uid://b4gkfwf4i3ydl" path="res://scenes/character.tscn" id="18_8lrh8"] -[ext_resource type="Resource" uid="uid://bho4qh41asyk1" path="res://mission/fourth_mission.tres" id="18_h4fpv"] [ext_resource type="PackedScene" uid="uid://cgk66f6rg03mj" path="res://scenes/hud.tscn" id="18_hud"] [ext_resource type="PackedScene" uid="uid://bqjnp7uypupog" path="res://scenes/controls_panel.tscn" id="19_controls"] -[ext_resource type="Resource" uid="uid://p3xwn2mp6bm6" path="res://mission/fifth_mission.tres" id="19_e8sub"] [ext_resource type="Script" path="res://scripts/game_manager.gd" id="20_game_manager"] -[ext_resource type="Resource" uid="uid://bv4r7ebpjdce4" path="res://mission/sixth_mission.tres" id="20_r0ysx"] +[ext_resource type="Resource" uid="uid://442cwthak2pa" path="res://mission/unit_1.03_1.05/market_research_1.tres" id="20_ngu16"] [ext_resource type="PackedScene" uid="uid://b4s46k58ddpyc" path="res://scenes/sound_panel.tscn" id="21_sound_panel"] +[ext_resource type="Resource" uid="uid://dtal0tl2ee336" path="res://structures/store.tres" id="21_y11qv"] [sub_resource type="Resource" id="Resource_1gdbm"] script = ExtResource("14_76jlq") @@ -119,7 +120,7 @@ outro_text_resource = SubResource("Resource_ja86h") [node name="Builder" type="Node3D" parent="." node_paths=PackedStringArray("selector", "selector_container", "view_camera", "gridmap", "cash_display")] script = ExtResource("1_jybm7") -structures = Array[ExtResource("2_54v6r")]([ExtResource("2_bwyku"), ExtResource("5_v5o2m"), ExtResource("6_fwsy4")]) +structures = Array[ExtResource("2_54v6r")]([ExtResource("2_bwyku"), ExtResource("5_v5o2m"), ExtResource("6_fwsy4"), ExtResource("21_y11qv"), ExtResource("9_2t3p4"), ExtResource("10_ii8xx")]) selector = NodePath("Selector") selector_container = NodePath("Selector/Container") view_camera = NodePath("../View/Camera") @@ -168,7 +169,7 @@ resource_data = ExtResource("14_76jlq") [node name="MissionManager" type="Node" parent="." node_paths=PackedStringArray("mission_ui", "builder")] script = ExtResource("10_oe3re") -missions = Array[ExtResource("14_vcrh8")]([ExtResource("15_obmwc"), ExtResource("16_rl54y"), ExtResource("17_rrdy6"), ExtResource("18_h4fpv"), ExtResource("19_e8sub"), ExtResource("20_r0ysx")]) +missions = Array[ExtResource("14_vcrh8")]([ExtResource("15_obmwc"), ExtResource("16_rl54y"), ExtResource("17_rrdy6"), ExtResource("20_ngu16")]) mission_ui = NodePath("MissionPanel") builder = NodePath("../Builder") character_scene = ExtResource("18_8lrh8") diff --git a/scripts/NavigationNPC.gd b/scripts/NavigationNPC.gd index 01bdac8..53e6940 100644 --- a/scripts/NavigationNPC.gd +++ b/scripts/NavigationNPC.gd @@ -36,7 +36,6 @@ func _ready() -> void: func _start_initial_movement(): await get_tree().process_frame pick_random_target() - print("Initial movement target set for character at ", global_position) # Force movement to a specific target func _unhandled_input(event: InputEvent) -> void: diff --git a/scripts/builder.gd b/scripts/builder.gd index 5970c8c..fbeb088 100644 --- a/scripts/builder.gd +++ b/scripts/builder.gd @@ -66,7 +66,7 @@ func _ready(): if structure.model.resource_path.contains("power_plant"): # Scale power plant model to be much smaller (0.5x) transform = transform.scaled(Vector3(0.5, 0.5, 0.5)) - elif structure.type == Structure.StructureType.RESIDENTIAL_BUILDING or structure.type == Structure.StructureType.ROAD: + else: # Scale buildings and roads to be consistent (3x) transform = transform.scaled(Vector3(3.0, 3.0, 3.0)) @@ -493,16 +493,10 @@ func update_structure(): _model.scale = Vector3(0.5, 0.5, 0.5) # Center the power plant model within the selector _model.position = Vector3(-3.0, 0.0, 3.0) # Reset position - elif (structures[index].type == Structure.StructureType.RESIDENTIAL_BUILDING - or structures[index].type == Structure.StructureType.ROAD - or structures[index].type == Structure.StructureType.TERRAIN - or structures[index].model.resource_path.contains("grass")): + else: # Scale buildings, roads, and decorative terrain to match (3x) _model.scale = Vector3(3.0, 3.0, 3.0) _model.position.y += 0.0 # No need for Y adjustment with scaling - else: - # Standard positioning for other structures - _model.position.y += 0.25 # Get the selector scale from the structure resource var scale_factor = structures[index].selector_scale diff --git a/scripts/hud_manager.gd b/scripts/hud_manager.gd index 984efb2..279c9f4 100644 --- a/scripts/hud_manager.gd +++ b/scripts/hud_manager.gd @@ -28,7 +28,7 @@ func _ready(): builder.structure_removed.connect(_on_structure_removed) - EventBus.population_update.connect(set_population_count) +# EventBus.population_update.connect(set_population_count) # Initialize UI elements population_label = $HBoxContainer/PopulationItem/PopulationLabel @@ -36,6 +36,8 @@ func _ready(): electricity_indicator = $HBoxContainer/ElectricityItem/ElectricityValues/ElectricityIndicator population_tooltip = $PopulationTooltip electricity_tooltip = $ElectricityTooltip + + # Ensure electricity indicator starts with red color if electricity_indicator: @@ -60,7 +62,15 @@ func _ready(): electricity_tooltip.visible = false # Update HUD - update_hud() + update_hud() + + +func _process(delta): + # Update the population label if it changes + if population_label and Globals.population != total_population: + total_population = Globals.population + population_label.text = str(total_population) + # Called when a structure is placed func _on_structure_placed(structure_index, position): diff --git a/scripts/mission/building_construction_manager.gd b/scripts/mission/building_construction_manager.gd index d809455..90b343f 100644 --- a/scripts/mission/building_construction_manager.gd +++ b/scripts/mission/building_construction_manager.gd @@ -266,7 +266,7 @@ func _on_worker_construction_ended(): # Forward the signal for mission managers/other systems that need it worker_construction_ended.emit() func update_population(count: int): - EventBus.population_update.emit(count) + Globals.set_population_count(count) diff --git a/scripts/mission/construction_worker.gd b/scripts/mission/construction_worker.gd index 5a029ad..2d1a6a8 100644 --- a/scripts/mission/construction_worker.gd +++ b/scripts/mission/construction_worker.gd @@ -216,24 +216,21 @@ func loop_construction_sound(): # Play the sound again construction_sound.play() - print("DEBUG: Looping sound for worker " + str(my_sound_id)) - else: - print("DEBUG: Cannot loop sound - either worker not active or sound not set up") + func finish_construction(): - print("DEBUG: Worker " + str(my_sound_id) + " finishing construction") is_construction_active = false construction_finished = true # Stop the construction sound if construction_sound and construction_sound.playing: construction_sound.stop() - print("DEBUG: Stopped sound for worker " + str(my_sound_id)) + # Stop the sound loop timer if loop_timer and loop_timer.is_inside_tree(): loop_timer.stop() - print("DEBUG: Stopped timer for worker " + str(my_sound_id)) + # Emit signal for compatibility construction_ended.emit() diff --git a/scripts/mission/mission_manager.gd b/scripts/mission/mission_manager.gd index bb582e6..d1d2de9 100644 --- a/scripts/mission/mission_manager.gd +++ b/scripts/mission/mission_manager.gd @@ -6,7 +6,6 @@ class_name MissionManager const JSBridge = preload("res://scripts/javascript_bridge.gd") const ObjectiveType = preload("res://configs/data.config.gd").ObjectiveType - signal mission_started(mission: MissionData) signal mission_completed(mission: MissionData) signal objective_completed(objective: MissionObjective) @@ -42,7 +41,8 @@ var learning_panel var fullscreen_learning_panel func _ready(): - + + EventBus.population_update.connect(population_updated) if builder: # Connect to builder signals builder.connect("structure_placed", _on_structure_placed) @@ -282,19 +282,32 @@ func complete_mission(mission_id: String): # Send the "end" event to the companion await get_tree().create_timer(2.0).timeout -func update_objective_progress(mission_id,count_change = 1): +func update_objective_progress(mission_id,count_change=1): if not active_missions.has(mission_id): return - current_objective.current_count += count_change + match current_objective.type: + ObjectiveType.BUILD_RESIDENTIAL,ObjectiveType.BUILD_STRUCTURE: + current_objective.current_count += count_change + if current_objective.target_count <= current_objective.current_count: + current_objective.completed = true + objective_completed.emit(current_objective) + var dialog_key = "objective_completed_" + str(current_objective.type) + _send_companion_dialog(dialog_key, current_mission) ## So Companion can react + update_current_objective(current_mission) # Go ahead and progress to nex objective if it exists. + ObjectiveType.REACH_POPULATION: + + if Globals.population >= current_objective.target_count: + current_objective.completed = true + objective_completed.emit(current_objective) + var dialog_key = "objective_completed_" + str(current_objective.type) + _send_companion_dialog(dialog_key, current_mission) ## So Companion can react + update_current_objective(current_mission) # Go ahead and progress to nex objective if it exists. + + # IF this is true then objectives are completed - if current_objective.target_count <= current_objective.current_count: - current_objective.completed = true - objective_completed.emit(current_objective) - var dialog_key = "objective_completed_" + str(current_objective.type) - _send_companion_dialog(dialog_key, current_mission) ## So Companion can react - update_current_objective(current_mission) # Go ahead and progress to nex objective if it exists. + update_mission_ui() @@ -1112,5 +1125,5 @@ func _force_learning_companion_connection(): _on_mission_started_for_companion(current_mission) -func _on_hud_population_updated(new_population: Variant) -> void: - update_objective_progress(current_mission.id, new_population) +func population_updated(new_population: Variant) -> void: + update_objective_progress(current_mission.id) diff --git a/scripts/mission/mission_ui.gd b/scripts/mission/mission_ui.gd index e04c1cc..4362d30 100644 --- a/scripts/mission/mission_ui.gd +++ b/scripts/mission/mission_ui.gd @@ -54,11 +54,11 @@ func update_mission_display(mission: MissionData): label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART # Format the objective text - var progress = "" - if objective.target_count > 1: - progress = " (%d/%d)" % [objective.current_count, objective.target_count] +# var progress = "" +# if objective.target_count && objective.type > 1: +# progress = " (%d/%d)" % [objective.current_count, objective.target_count] - label.text = "%s%s" % [objective.description, progress] + label.text = objective.description # Style completed objectives differently if objective.completed: diff --git a/structures/building-small-d.tres b/structures/building-small-d.tres deleted file mode 100644 index 3632028..0000000 --- a/structures/building-small-d.tres +++ /dev/null @@ -1,14 +0,0 @@ -[gd_resource type="Resource" script_class="Structure" load_steps=3 format=3 uid="uid://dtal0tl2ee336"] - -[ext_resource type="PackedScene" uid="uid://h0vrvst3cumo" path="res://models/building-small-d.glb" id="1_164xq"] -[ext_resource type="Script" uid="uid://smbpvh2nwds4" path="res://scripts/structure.gd" id="2_8ewai"] - -[resource] -script = ExtResource("2_8ewai") -model = ExtResource("1_164xq") -type = 1 -price = 70 -population_count = 1 -kW_usage = 1.0 -kW_production = 0.0 -selector_scale = 2.8 From c847284718ea6069123dad07f6f8ff18a314cab0 Mon Sep 17 00:00:00 2001 From: Wade Date: Mon, 21 Apr 2025 11:14:25 -0500 Subject: [PATCH 5/5] latest changes --- scenes/main.tscn | 37 ++++++- scripts/builder.gd | 3 +- .../mission/building_construction_manager.gd | 23 +--- scripts/mission/mission_manager.gd | 104 +++++++++--------- 4 files changed, 95 insertions(+), 72 deletions(-) diff --git a/scenes/main.tscn b/scenes/main.tscn index 66b0f20..3526936 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=34 format=3 uid="uid://vgwrcfy1qawf"] +[gd_scene load_steps=63 format=3 uid="uid://vgwrcfy1qawf"] [ext_resource type="Script" path="res://scripts/builder.gd" id="1_jybm7"] [ext_resource type="Environment" uid="uid://jbptgqvstei3" path="res://scenes/main-environment.tres" id="1_yndf3"] @@ -11,6 +11,8 @@ [ext_resource type="Resource" uid="uid://tm532uesguhk" path="res://structures/grass.tres" id="9_2t3p4"] [ext_resource type="Resource" uid="uid://d2jplegnkl6u2" path="res://structures/road-corner.tres" id="10_ii8xx"] [ext_resource type="Script" path="res://scripts/mission/mission_manager.gd" id="10_oe3re"] +[ext_resource type="Resource" uid="uid://mxrnqinnsqnt" path="res://structures/road-straight-lightposts.tres" id="11_20frt"] +[ext_resource type="Resource" uid="uid://c4qbn3d85prxx" path="res://structures/power-plant.tres" id="12_xtc7p"] [ext_resource type="PackedScene" uid="uid://dmsy06s02tcw4" path="res://scenes/generic_text_panel.tscn" id="13_7i6dj"] [ext_resource type="Script" path="res://scripts/mission/mission_ui.gd" id="13_xvw5w"] [ext_resource type="Script" path="res://resources/generic_text_panel.resource.gd" id="14_76jlq"] @@ -24,9 +26,36 @@ [ext_resource type="PackedScene" uid="uid://cgk66f6rg03mj" path="res://scenes/hud.tscn" id="18_hud"] [ext_resource type="PackedScene" uid="uid://bqjnp7uypupog" path="res://scenes/controls_panel.tscn" id="19_controls"] [ext_resource type="Script" path="res://scripts/game_manager.gd" id="20_game_manager"] -[ext_resource type="Resource" uid="uid://442cwthak2pa" path="res://mission/unit_1.03_1.05/market_research_1.tres" id="20_ngu16"] +[ext_resource type="Resource" uid="uid://442cwthak2pa" path="res://mission/unit_1.02/market_research_1.tres" id="20_ngu16"] [ext_resource type="PackedScene" uid="uid://b4s46k58ddpyc" path="res://scenes/sound_panel.tscn" id="21_sound_panel"] [ext_resource type="Resource" uid="uid://dtal0tl2ee336" path="res://structures/store.tres" id="21_y11qv"] +[ext_resource type="Resource" uid="uid://bom5bu47dy5kp" path="res://mission/unit_1.02/market_research_2.tres" id="24_xud6a"] +[ext_resource type="Resource" uid="uid://csrqvfwp63ygr" path="res://mission/unit_1.02/market_research_3.tres" id="25_6hx7u"] +[ext_resource type="Resource" uid="uid://qwiwim2pg88f" path="res://mission/unit_1.02/market_research_4.tres" id="26_lvk23"] +[ext_resource type="Resource" uid="uid://cfgw8dblm55c5" path="res://mission/unit_1.03_1.05/grid_growth_1.tres" id="27_s0e58"] +[ext_resource type="Resource" uid="uid://ba3ndftq7dht7" path="res://mission/unit_1.03_1.05/grid_growth_2.tres" id="28_hurxs"] +[ext_resource type="Resource" uid="uid://dgimr2v12rjqu" path="res://mission/unit_1.03_1.05/grid_growth_3.tres" id="29_rhn1n"] +[ext_resource type="Resource" uid="uid://dm2o4dq2oml53" path="res://mission/unit_1.03_1.05/grid_growth_4.tres" id="30_4rwkv"] +[ext_resource type="Resource" uid="uid://btwrfq37q8vey" path="res://mission/unit_1.03_1.05/traffic_flow_1.tres" id="31_j2idb"] +[ext_resource type="Resource" uid="uid://cf7gpb4j7gq1g" path="res://mission/unit_1.03_1.05/traffic_flow_2.tres" id="32_ipu0c"] +[ext_resource type="Resource" uid="uid://ddmxjjyxgxyxo" path="res://mission/unit_1.03_1.05/traffic_flow_3.tres" id="33_c0l5e"] +[ext_resource type="Resource" uid="uid://doxd30r8qbgdq" path="res://mission/unit_1.03_1.05/traffic_flow_4.tres" id="34_21t20"] +[ext_resource type="Resource" uid="uid://duaxn13myfx22" path="res://mission/unit_1.06/sustainable_dev_1.tres" id="35_o0bjh"] +[ext_resource type="Resource" uid="uid://fuxb3pfbbwjm" path="res://mission/unit_1.06/sustainable_dev_2.tres" id="36_2wodh"] +[ext_resource type="Resource" uid="uid://byd5jxiutxpky" path="res://mission/unit_1.06/sustainable_dev_3.tres" id="37_psgx1"] +[ext_resource type="Resource" uid="uid://daug1o7kppqit" path="res://mission/unit_1.06/sustainable_dev_4.tres" id="38_hw762"] +[ext_resource type="Resource" uid="uid://cp7tcpktwlrkt" path="res://mission/unit_1.06/urban_planning_1.tres" id="39_ymw5p"] +[ext_resource type="Resource" uid="uid://c3q1afcvwi4rk" path="res://mission/unit_1.06/urban_planning_2.tres" id="40_uggp1"] +[ext_resource type="Resource" uid="uid://ct1k7n2oopwdu" path="res://mission/unit_1.06/urban_planning_3.tres" id="41_f0dxf"] +[ext_resource type="Resource" uid="uid://d1fykuxfmh2q1" path="res://mission/unit_1.06/urban_planning_4.tres" id="42_fv8gl"] +[ext_resource type="Resource" uid="uid://detwnqsq87r30" path="res://mission/unit_1.07/economic_forecast_1.tres" id="43_qvne6"] +[ext_resource type="Resource" uid="uid://bj7tjuknfaeyg" path="res://mission/unit_1.07/economic_forecast_2.tres" id="44_haub2"] +[ext_resource type="Resource" uid="uid://ctyrlnq5cxuiu" path="res://mission/unit_1.07/economic_forecast_3.tres" id="45_xs8xk"] +[ext_resource type="Resource" uid="uid://ct45gjmw5b7pa" path="res://mission/unit_1.07/economic_forecast_4.tres" id="46_pob6d"] +[ext_resource type="Resource" uid="uid://bwrkqv42wk8f" path="res://mission/unit_1.07/resource_alloc_1.tres" id="47_6w4y8"] +[ext_resource type="Resource" uid="uid://d0nblitd4ixir" path="res://mission/unit_1.07/resource_alloc_2.tres" id="48_ck35a"] +[ext_resource type="Resource" uid="uid://cxh8dgf54oimx" path="res://mission/unit_1.07/resource_alloc_3.tres" id="49_cvgxw"] +[ext_resource type="Resource" uid="uid://cpfr2xnjtpcog" path="res://mission/unit_1.07/resource_alloc_4.tres" id="50_6ke0d"] [sub_resource type="Resource" id="Resource_1gdbm"] script = ExtResource("14_76jlq") @@ -120,7 +149,7 @@ outro_text_resource = SubResource("Resource_ja86h") [node name="Builder" type="Node3D" parent="." node_paths=PackedStringArray("selector", "selector_container", "view_camera", "gridmap", "cash_display")] script = ExtResource("1_jybm7") -structures = Array[ExtResource("2_54v6r")]([ExtResource("2_bwyku"), ExtResource("5_v5o2m"), ExtResource("6_fwsy4"), ExtResource("21_y11qv"), ExtResource("9_2t3p4"), ExtResource("10_ii8xx")]) +structures = Array[ExtResource("2_54v6r")]([ExtResource("2_bwyku"), ExtResource("5_v5o2m"), ExtResource("6_fwsy4"), ExtResource("21_y11qv"), ExtResource("9_2t3p4"), ExtResource("10_ii8xx"), ExtResource("11_20frt"), ExtResource("12_xtc7p")]) selector = NodePath("Selector") selector_container = NodePath("Selector/Container") view_camera = NodePath("../View/Camera") @@ -169,7 +198,7 @@ resource_data = ExtResource("14_76jlq") [node name="MissionManager" type="Node" parent="." node_paths=PackedStringArray("mission_ui", "builder")] script = ExtResource("10_oe3re") -missions = Array[ExtResource("14_vcrh8")]([ExtResource("15_obmwc"), ExtResource("16_rl54y"), ExtResource("17_rrdy6"), ExtResource("20_ngu16")]) +missions = Array[ExtResource("14_vcrh8")]([ExtResource("15_obmwc"), ExtResource("16_rl54y"), ExtResource("17_rrdy6"), ExtResource("20_ngu16"), ExtResource("24_xud6a"), ExtResource("25_6hx7u"), ExtResource("26_lvk23"), ExtResource("27_s0e58"), ExtResource("28_hurxs"), ExtResource("29_rhn1n"), ExtResource("30_4rwkv"), ExtResource("31_j2idb"), ExtResource("32_ipu0c"), ExtResource("33_c0l5e"), ExtResource("34_21t20"), ExtResource("35_o0bjh"), ExtResource("36_2wodh"), ExtResource("37_psgx1"), ExtResource("38_hw762"), ExtResource("39_ymw5p"), ExtResource("40_uggp1"), ExtResource("41_f0dxf"), ExtResource("42_fv8gl"), ExtResource("43_qvne6"), ExtResource("44_haub2"), ExtResource("45_xs8xk"), ExtResource("46_pob6d"), ExtResource("47_6w4y8"), ExtResource("48_ck35a"), ExtResource("49_cvgxw"), ExtResource("50_6ke0d")]) mission_ui = NodePath("MissionPanel") builder = NodePath("../Builder") character_scene = ExtResource("18_8lrh8") diff --git a/scripts/builder.gd b/scripts/builder.gd index fbeb088..943eded 100644 --- a/scripts/builder.gd +++ b/scripts/builder.gd @@ -254,8 +254,7 @@ func action_build(gridmap_position): # Make sure any existing NPCs are children of the navigation region _move_characters_to_navregion() elif is_power_plant: - # Special handling for power plants - add directly as a child of the builder - _add_power_plant(gridmap_position, index) + #add_power_plant(gridmap_position, index) # We still set the cell item for collision detection gridmap.set_cell_item(gridmap_position, index, gridmap.get_orthogonal_index_from_basis(selector.basis)) diff --git a/scripts/mission/building_construction_manager.gd b/scripts/mission/building_construction_manager.gd index 90b343f..133d655 100644 --- a/scripts/mission/building_construction_manager.gd +++ b/scripts/mission/building_construction_manager.gd @@ -21,14 +21,18 @@ var nav_region: NavigationRegion3D var builder: Node3D var building_plot_scene: PackedScene var final_building_scene: PackedScene +var mission_manager: MissionManager # Keep track of all construction sites var construction_sites = {} # position (Vector3) -> construction data (dict) func _ready(): + # Load the worker character scene - add more fallbacks to ensure we get a valid model + builder = get_node_or_null('/root/Main/Builder') worker_scene = load("res://people/character-male-a.glb") hud_manager = get_node_or_null("/root/Main/CanvasLayer/HUD") + mission_manager = builder.get_node_or_null("/root/Main/MissionManager") if not worker_scene: worker_scene = load("res://people/character-female-a.glb") if not worker_scene: @@ -299,7 +303,7 @@ func _complete_construction(position: Vector3): _place_final_building(position, site["structure_index"]) # Update mission objective now that construction is complete - _update_mission_objective_on_completion(site["structure_index"]) +# _update_mission_objective_on_completion(site["structure_index"]) # Check if we should spawn a resident var mission_manager = builder.get_node_or_null("/root/Main/MissionManager") @@ -342,23 +346,8 @@ func handle_demolition(position: Vector3): # Remove the entry from the dictionary construction_sites.erase(position) - -# Function to update mission objective when construction is complete -func _update_mission_objective_on_completion(structure_index: int): - # Get reference to mission manager - var mission_manager = builder.get_node_or_null("/root/Main/MissionManager") + - if mission_manager and mission_manager.current_mission: - # Check if this is a residential building - if structure_index >= 0 and structure_index < builder.structures.size(): - var structure = builder.structures[structure_index] - - if mission_manager.current_objective.type == ObjectiveType.BUILD_RESIDENTIAL && structure.type == Structure.StructureType.RESIDENTIAL_BUILDING: - mission_manager.update_objective_progress( - mission_manager.current_mission.id, - 1 - ) - mission_manager.check_mission_progress(mission_manager.current_mission.id) # Place the final building at the construction site func _place_final_building(position: Vector3, structure_index: int): diff --git a/scripts/mission/mission_manager.gd b/scripts/mission/mission_manager.gd index d1d2de9..4bc3411 100644 --- a/scripts/mission/mission_manager.gd +++ b/scripts/mission/mission_manager.gd @@ -255,8 +255,8 @@ func complete_mission(mission_id: String): print("Handling structure unlocking for mission: " + mission.id) _handle_structure_unlocking(mission) - # Remove from active missions - active_missions.erase(mission_id) + # Keep a copy of the mission for UI display during transition + var completed_mission = mission # Figure out if there's a next mission var next_mission: MissionData @@ -270,26 +270,40 @@ func complete_mission(mission_id: String): # Emit mission completed signal mission_completed.emit(mission) - # Start the next mission if one is available + # Only remove from active missions after we're ready to show the next one + # This ensures the UI always has a mission to display if next_mission: - # Start the next mission after a short delay + # Keep the active mission during the delay await get_tree().create_timer(2.0).timeout + + # Only now remove the old mission + active_missions.erase(mission_id) + + # Start the next mission start_mission(next_mission) else: + # Only remove after delay for last mission too + await get_tree().create_timer(2.0).timeout + active_missions.erase(mission_id) + all_missions_completed.emit() print("No more missions available - all complete!") # Send the "end" event to the companion await get_tree().create_timer(2.0).timeout -func update_objective_progress(mission_id,count_change=1): - if not active_missions.has(mission_id): - return - - +func update_objective_progress(structure:Structure = null): match current_objective.type: - ObjectiveType.BUILD_RESIDENTIAL,ObjectiveType.BUILD_STRUCTURE: - current_objective.current_count += count_change + ObjectiveType.BUILD_RESIDENTIAL: + current_objective.current_count += structure.population_count + if current_objective.target_count <= current_objective.current_count: + current_objective.completed = true + objective_completed.emit(current_objective) + var dialog_key = "objective_completed_" + str(current_objective.type) + _send_companion_dialog(dialog_key, current_mission) ## So Companion can react + update_current_objective(current_mission) + ObjectiveType.BUILD_STRUCTURE: + current_objective.current_count += 1 if current_objective.target_count <= current_objective.current_count: current_objective.completed = true objective_completed.emit(current_objective) @@ -297,14 +311,12 @@ func update_objective_progress(mission_id,count_change=1): _send_companion_dialog(dialog_key, current_mission) ## So Companion can react update_current_objective(current_mission) # Go ahead and progress to nex objective if it exists. ObjectiveType.REACH_POPULATION: - if Globals.population >= current_objective.target_count: current_objective.completed = true objective_completed.emit(current_objective) var dialog_key = "objective_completed_" + str(current_objective.type) _send_companion_dialog(dialog_key, current_mission) ## So Companion can react update_current_objective(current_mission) # Go ahead and progress to nex objective if it exists. - # IF this is true then objectives are completed @@ -312,8 +324,20 @@ func update_objective_progress(mission_id,count_change=1): update_mission_ui() objective_progress.emit(current_objective, current_objective.current_count) - check_mission_completion(mission_id) + + + + +func is_structure_of_current_mission(structure:Structure): + if not current_mission: + print("ERROR: No current mission to check structure against") + return false + if current_objective.structure == structure: + return true + else: + return false + func check_objective_completion(mission_id, objective_type): if not active_missions.has(mission_id): @@ -398,12 +422,10 @@ func _on_structure_placed(structure_index, position): var structure = builder.structures[structure_index] print("Structure placed: " + structure.model.resource_path) - # Update objectives based on structure type - match current_objective.type: - ObjectiveType.BUILD_STRUCTURE: - update_objective_progress(current_mission.id, 1) - - + # Check if this structure is needed for the current objective + if current_mission and is_structure_of_current_mission(structure): + # Update the objective progress + update_objective_progress(structure) if current_mission: if structure.type == Structure.StructureType.RESIDENTIAL_BUILDING: @@ -861,33 +883,13 @@ func _handle_structure_unlocking(mission): # If we already have explicit unlocked items defined, skip the hardcoded rules var has_explicit_unlocks = mission is Resource and "unlocked_items" in mission and mission.unlocked_items.size() > 0 - # Check for power plant unlocking in power-related missions (only if no explicit unlocks) - if (not has_explicit_unlocks) and (mission.id == "4" or mission.id == "5" or mission.power_math_content != ""): - print("Using hardcoded power plant unlocks for mission: " + mission.id) - for structure in builder.structures: - if structure.model and structure.model.resource_path.contains("power_plant"): - # Make sure structure has the unlocked property before setting it - if "unlocked" in structure: - structure.unlocked = true - # Only add to unlocked_structures if not already there - if not unlocked_structures.has(structure): - unlocked_structures.append(structure) - else: - print("WARNING: Power plant structure doesn't have an 'unlocked' property") - - # Check for curved roads and decorations in city expansion missions (only if no explicit unlocks) - if (not has_explicit_unlocks) and (mission.id == "2" or mission.id == "3"): - print("Using hardcoded curved roads and decorations for mission: " + mission.id) - for structure in builder.structures: - if structure.model and (structure.model.resource_path.contains("road-corner") or structure.model.resource_path.contains("grass-trees-tall")): - # Make sure structure has the unlocked property before setting it - if "unlocked" in structure: - structure.unlocked = true - # Only add to unlocked_structures if not already there - if not unlocked_structures.has(structure): - unlocked_structures.append(structure) - else: - print("WARNING: Road/decoration structure doesn't have an 'unlocked' property") + # Commented out hardcoded power plant unlocking + # Only use explicit unlocks from the mission data's unlocked_items array + # No more hardcoded behavior for specific mission IDs + + # Commented out hardcoded curved roads and decorations unlocking + # Only use explicit unlocks from the mission data's unlocked_items array + # No more hardcoded behavior for specific mission IDs # Make sure the builder starts with a valid unlocked structure selected var found_unlocked = false @@ -1103,10 +1105,13 @@ func update_current_objective(mission = null): print("Updated current objective: " + str(current_objective.type) + " - " + current_objective.description) return - # If all objectives are complete, keep the last one as current + # If all objectives are complete, keep the last one as current and complete the mission if mission.objectives.size() > 0: current_objective = mission.objectives[-1] print("All objectives complete, keeping last one as current objective") + # Complete the mission when we've found that all objectives are complete + if mission.id in active_missions: + check_mission_completion(mission.id) # Fallback to force a connection if the normal method doesn't work func _force_learning_companion_connection(): @@ -1126,4 +1131,5 @@ func _force_learning_companion_connection(): func population_updated(new_population: Variant) -> void: - update_objective_progress(current_mission.id) + if current_objective.type == ObjectiveType.REACH_POPULATION: + update_objective_progress()