From dbb956e50bee67918abfdfed46fc71366f99c991 Mon Sep 17 00:00:00 2001 From: Sara Date: Fri, 28 Mar 2025 17:44:10 +0100 Subject: [PATCH] feat: implemented and integrated objective flags system and ui --- godot/Levels/test_level.tscn | 50 ++++++++++++++++++++++++- godot/UI/objective_box.tscn | 6 +++ src/area_transfer.cpp | 3 ++ src/objective_flags.cpp | 70 +++++++++++++++++++++++++++++++---- src/objective_flags.hpp | 17 ++++++--- src/objective_ui.cpp | 72 ++++++++++++++++++++++++++++++++++++ src/objective_ui.hpp | 33 +++++++++++++++++ src/register_types.cpp | 5 +++ 8 files changed, 241 insertions(+), 15 deletions(-) create mode 100644 godot/UI/objective_box.tscn create mode 100644 src/objective_ui.cpp create mode 100644 src/objective_ui.hpp diff --git a/godot/Levels/test_level.tscn b/godot/Levels/test_level.tscn index ffd3b6d..dfd1d86 100644 --- a/godot/Levels/test_level.tscn +++ b/godot/Levels/test_level.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=19 format=3 uid="uid://c62s1jmtgajjk"] +[gd_scene load_steps=24 format=3 uid="uid://c62s1jmtgajjk"] [ext_resource type="PackedScene" uid="uid://dsalxxq3xs842" path="res://rts_game_mode.tscn" id="1_4nchg"] +[ext_resource type="PackedScene" uid="uid://ch8iwss5u4lvd" path="res://UI/objective_box.tscn" id="2_derr6"] [ext_resource type="Environment" uid="uid://cnfk8yrvklysq" path="res://Environments/default_environment.tres" id="2_jq6bw"] [ext_resource type="PackedScene" uid="uid://pme230qx1377" path="res://GameObjects/player_unit.tscn" id="3_wl7wm"] [ext_resource type="PackedScene" uid="uid://ba17jrcaduowj" path="res://GameObjects/enemy_unit.tscn" id="4_0o33v"] @@ -9,6 +10,21 @@ [ext_resource type="PackedScene" uid="uid://ulvv4o73s48a" path="res://Environments/Models/KenneyTrains/track.glb" id="7_8fuqb"] [ext_resource type="Material" uid="uid://dluo26ixa4p8o" path="res://Assets/Models/movement_marker.tres" id="8_wyjwf"] +[sub_resource type="ObjectiveData" id="ObjectiveData_774rb"] +name_config = "destroy_obstacle" +description = "Remove the obstacle with explosives" + +[sub_resource type="ObjectiveData" id="ObjectiveData_v5o70"] +name_config = "gather_at_goal" +description = "Gather at the zone exit" +target_count = 2 + +[sub_resource type="ObjectiveData" id="ObjectiveData_lnmcm"] +name_config = "move_on" +description = "Advance to the next zone" +target_count = 0 +sub_objectives_setting = [SubResource("ObjectiveData_774rb"), SubResource("ObjectiveData_v5o70")] + [sub_resource type="NavigationMesh" id="NavigationMesh_8a2j6"] vertices = PackedVector3Array(-49.9439, 6.15874, -50.0795, -47.9439, 6.15874, -50.0795, -47.9439, 6.15874, -66.0795, -71.4439, 6.15874, -48.0795, -49.9439, 6.15874, -48.0795, -71.4439, 6.15874, -66.0795, 50.0561, 6.15874, -50.0795, 50.0561, 6.15874, -48.0795, 52.0561, 6.15874, -48.0795, 52.0561, 6.15874, -66.0795, -71.4439, 6.15874, 47.9205, -49.9439, 6.15874, 47.9205, 50.0561, 6.15874, 47.9205, 52.0561, 6.15874, 47.9205, -5.44388, 0.408735, -1.57945, -5.19388, 0.408735, -2.82945, -6.94388, 0.408735, -3.07945, -8.94388, 0.408735, -1.57945, -6.69388, 0.408735, -6.57945, -8.94388, 0.408735, -9.32945, 7.55612, 0.408735, -6.57945, 7.80612, 0.408735, -4.57945, 9.30612, 0.408735, -4.57945, 9.30612, 0.408735, -9.32945, -5.69388, 0.408735, -5.32945, -5.69388, 0.408735, -4.07945, -0.443878, 0.408735, -4.07945, -0.443878, 0.408735, -5.32945, 1.30612, 0.408735, -5.32945, 1.30612, 0.408735, -4.07945, 6.55612, 0.408735, -4.07945, 6.55612, 0.408735, -5.32945, 7.55612, 0.408735, -2.82945, 2.55612, 0.408735, -2.82945, 2.55612, 0.408735, -1.57945, 4.80612, 0.408735, -1.32945, 4.80612, 0.408735, 0.920547, 7.05612, 0.408735, 5.17055, 9.30612, 0.408735, 8.17055, 7.30612, 0.408735, 8.17055, 2.55612, 0.408735, 1.17055, 2.55612, 0.408735, 5.17055, -3.94388, 0.408735, -1.32945, 0.306122, 0.408735, -1.32945, -3.94388, 0.408735, 0.920547, 0.306122, 0.408735, 0.920547, -5.69388, 0.408735, 1.17055, -5.69388, 0.408735, 5.17055, -29.1939, 0.408735, 1.17055, -29.1939, 0.408735, 2.92055, -27.1939, 0.408735, 2.92055, -26.9439, 0.408735, 1.42055, -12.6939, 0.408735, 1.42055, -12.4439, 0.408735, 4.92055, -12.9439, 0.408735, 5.17055, -12.9439, 0.408735, 8.17055, -7.44388, 0.408735, 8.17055, -7.44388, 0.408735, 5.42055, -26.9439, 0.408735, 5.17055, -29.1939, 0.408735, 8.17055, -25.9439, 0.408735, 2.67055, -25.9439, 0.408735, 3.92055, -20.6939, 0.408735, 3.92055, -20.6939, 0.408735, 2.67055, -18.9439, 0.408735, 2.67055, -18.9439, 0.408735, 3.92055, -13.6939, 0.408735, 3.92055, -13.6939, 0.408735, 2.67055, -6.19388, 0.408735, 6.42055, -6.19388, 0.408735, 7.92055, -0.943878, 0.408735, 7.92055, -0.943878, 0.408735, 6.42055, 0.806122, 0.408735, 6.42055, 0.806122, 0.408735, 7.92055, 6.05612, 0.408735, 7.92055, 6.05612, 0.408735, 6.42055, -47.9439, 6.15874, 67.9205, -47.9439, 6.15874, 49.9205, -49.9439, 6.15874, 49.9205, -71.4439, 6.15874, 67.9205, 50.0561, 6.15874, 49.9205, 52.0561, 6.15874, 67.9205) polygons = [PackedInt32Array(2, 1, 0), PackedInt32Array(0, 4, 3), PackedInt32Array(3, 5, 0), PackedInt32Array(0, 5, 2), PackedInt32Array(7, 6, 8), PackedInt32Array(8, 6, 9), PackedInt32Array(1, 2, 6), PackedInt32Array(6, 2, 9), PackedInt32Array(3, 4, 10), PackedInt32Array(10, 4, 11), PackedInt32Array(7, 8, 12), PackedInt32Array(12, 8, 13), PackedInt32Array(15, 14, 16), PackedInt32Array(16, 14, 17), PackedInt32Array(16, 17, 18), PackedInt32Array(18, 17, 19), PackedInt32Array(21, 20, 22), PackedInt32Array(22, 20, 23), PackedInt32Array(20, 18, 23), PackedInt32Array(23, 18, 19), PackedInt32Array(27, 26, 24), PackedInt32Array(24, 26, 25), PackedInt32Array(31, 30, 28), PackedInt32Array(28, 30, 29), PackedInt32Array(32, 21, 22), PackedInt32Array(34, 33, 35), PackedInt32Array(35, 33, 32), PackedInt32Array(32, 22, 36), PackedInt32Array(36, 22, 37), PackedInt32Array(37, 22, 38), PackedInt32Array(38, 39, 37), PackedInt32Array(36, 35, 32), PackedInt32Array(40, 36, 41), PackedInt32Array(41, 36, 37), PackedInt32Array(14, 15, 42), PackedInt32Array(42, 15, 43), PackedInt32Array(43, 15, 34), PackedInt32Array(34, 15, 33), PackedInt32Array(43, 45, 42), PackedInt32Array(42, 45, 44), PackedInt32Array(46, 44, 47), PackedInt32Array(47, 44, 45), PackedInt32Array(47, 45, 40), PackedInt32Array(47, 40, 41), PackedInt32Array(50, 49, 51), PackedInt32Array(51, 49, 48), PackedInt32Array(51, 48, 52), PackedInt32Array(52, 48, 46), PackedInt32Array(54, 53, 55), PackedInt32Array(55, 53, 57), PackedInt32Array(55, 57, 56), PackedInt32Array(47, 57, 46), PackedInt32Array(46, 57, 53), PackedInt32Array(46, 53, 52), PackedInt32Array(50, 58, 49), PackedInt32Array(49, 58, 59), PackedInt32Array(54, 55, 58), PackedInt32Array(58, 55, 59), PackedInt32Array(63, 62, 60), PackedInt32Array(60, 62, 61), PackedInt32Array(67, 66, 64), PackedInt32Array(64, 66, 65), PackedInt32Array(71, 70, 68), PackedInt32Array(68, 70, 69), PackedInt32Array(75, 74, 72), PackedInt32Array(72, 74, 73), PackedInt32Array(78, 77, 76), PackedInt32Array(10, 11, 78), PackedInt32Array(10, 78, 79), PackedInt32Array(79, 78, 76), PackedInt32Array(12, 13, 80), PackedInt32Array(80, 13, 81), PackedInt32Array(77, 80, 76), PackedInt32Array(76, 80, 81)] @@ -22,10 +38,11 @@ desired_state_dict = { [sub_resource type="GDScript" id="GDScript_2bv87"] script/source = "extends UtilityLock - +@onready var objectives = %ObjectiveFlags func _on_finish_activate(_item: int, _unit: Unit): self.queue_free() self.get_parent().remove_child(self) + objectives.get_objective_by_name(\"destroy_obstacle\").completed_count += 1 " [sub_resource type="SphereShape3D" id="SphereShape3D_pptgx"] @@ -48,6 +65,14 @@ albedo_color = Color(0, 1, 0.823529, 0.760784) [sub_resource type="BoxMesh" id="BoxMesh_bl5l6"] size = Vector3(7, 1, 1) +[sub_resource type="GDScript" id="GDScript_s2sl4"] +script/source = "extends AreaTransfer + +func _on_progress_changed(amount_after: int) -> void: + if has_node(\"%ObjectiveFlags\"): + %ObjectiveFlags.get_objective_by_name(\"gather_at_goal\").completed_count = amount_after +" + [sub_resource type="BoxShape3D" id="BoxShape3D_c8xhj"] size = Vector3(2.58594, 1, 8.92188) @@ -58,6 +83,22 @@ size = Vector3(2.035, 1, 8.225) [node name="TestLevel" type="Level3D"] game_mode_prototype = ExtResource("1_4nchg") +[node name="ObjectiveFlags" type="ObjectiveFlags" parent="."] +currently_active_objective = SubResource("ObjectiveData_lnmcm") +unique_name_in_owner = true + +[node name="Objectives" type="ObjectiveUI" parent="."] +objective_element_scene = ExtResource("2_derr6") +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 31.0 +offset_top = 28.0 +offset_right = -781.0 +offset_bottom = -360.0 +grow_horizontal = 2 +grow_vertical = 2 + [node name="SpawnPoint3D" type="SpawnPoint3D" parent="."] transform = Transform3D(0, 0, -1, 0, 1, 0, 1, 0, 0, -7.12546, 0, -8.38951) @@ -435,6 +476,9 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.74312, 1.8999e-07, -8.7408 [node name="Tank" parent="." instance=ExtResource("4_0o33v")] transform = Transform3D(0.258819, 0, -0.965926, 0, 1, 0, 0.965926, 0, 0.258819, 2.39385, -7.63685e-07, 1.8472) +[node name="Tank2" parent="." instance=ExtResource("4_0o33v")] +transform = Transform3D(0.963696, 0, -0.267003, 0, 1, 0, 0.267003, 0, 0.963696, 3.77879, -7.63685e-07, 2.38234) + [node name="Tank3" parent="." instance=ExtResource("4_0o33v")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.0413, -7.63685e-07, 2.86749) @@ -447,6 +491,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -28.8374, -0.138102, 4.6354) collision_layer = 4 collision_mask = 6 monitorable = false +script = SubResource("GDScript_s2sl4") [node name="CollisionShape3D" type="CollisionShape3D" parent="AreaTransfer"] shape = SubResource("BoxShape3D_c8xhj") @@ -456,3 +501,4 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.635551, 0) mesh = SubResource("BoxMesh_mq8af") [connection signal="finish_activate" from="WorldEnvironment/NavigationRegion3D/UtilityLock" to="WorldEnvironment/NavigationRegion3D/UtilityLock" method="_on_finish_activate"] +[connection signal="progress_changed" from="AreaTransfer" to="AreaTransfer" method="_on_progress_changed"] diff --git a/godot/UI/objective_box.tscn b/godot/UI/objective_box.tscn new file mode 100644 index 0000000..75cfd62 --- /dev/null +++ b/godot/UI/objective_box.tscn @@ -0,0 +1,6 @@ +[gd_scene format=3 uid="uid://ch8iwss5u4lvd"] + +[node name="ObjectiveBox" type="CheckBox"] +button_mask = 0 +text = "Objectives" +flat = true diff --git a/src/area_transfer.cpp b/src/area_transfer.cpp index 6280686..d13be89 100644 --- a/src/area_transfer.cpp +++ b/src/area_transfer.cpp @@ -8,6 +8,7 @@ void AreaTransfer::_bind_methods() { #define CLASSNAME AreaTransfer GDPROPERTY_HINTED(next_scene, gd::Variant::STRING, gd::PROPERTY_HINT_FILE, "*.tscn,*.scn"); + GDSIGNAL("progress_changed", gd::PropertyInfo(gd::Variant::INT, "amount_after")); } void AreaTransfer::_ready() { @@ -18,6 +19,7 @@ void AreaTransfer::_ready() { void AreaTransfer::_on_body_entered(gd::Node3D *body) { if(CharacterUnit *character{gd::Object::cast_to(body)}) { this->ready_units.insert(character); + this->emit_signal("progress_changed", this->ready_units.size()); } this->check_all_ready(); } @@ -26,6 +28,7 @@ void AreaTransfer::_on_body_exited(gd::Node3D *body) { CharacterUnit *unit{gd::Object::cast_to(body)}; if(unit && this->ready_units.has(unit)) { this->ready_units.erase(unit); + this->emit_signal("progress_changed", this->ready_units.size()); } } diff --git a/src/objective_flags.cpp b/src/objective_flags.cpp index 2f971e6..e757ce8 100644 --- a/src/objective_flags.cpp +++ b/src/objective_flags.cpp @@ -5,8 +5,43 @@ void ObjectiveData::_bind_methods() { #define CLASSNAME ObjectiveData GDSIGNAL("progress_changed"); GDSIGNAL("is_done"); + GDPROPERTY(name_config, gd::Variant::STRING); + GDPROPERTY(description, gd::Variant::STRING); GDPROPERTY(target_count, gd::Variant::INT); + GDPROPERTY(completed_count, gd::Variant::INT); + GDPROPERTY_HINTED(sub_objectives_setting, gd::Variant::ARRAY, gd::PROPERTY_HINT_ARRAY_TYPE, GDRESOURCETYPE("ObjectiveData")); GDFUNCTION(get_is_completed); + GDFUNCTION_ARGS(get_objective_by_name, "name"); +} + +void ObjectiveData::set_name_config(gd::String name) { + this->set_name(name); +} + +gd::String ObjectiveData::get_name_config() { + return this->get_name(); +} + +void ObjectiveData::set_description(gd::String description) { + this->description = description; +} + +gd::String ObjectiveData::get_description() const { + return this->description; +} + +gd::Ref ObjectiveData::get_objective_by_name(gd::StringName name) { + for(gd::Ref objective : this->get_sub_objectives()) { + if(objective->get_name() == name) { + return objective; + } else { + gd::Ref sub_objective{objective->get_objective_by_name(name)}; + if(sub_objective.is_valid()) { + return sub_objective; + } + } + } + return nullptr; } bool ObjectiveData::get_is_completed() const { @@ -38,7 +73,9 @@ int ObjectiveData::get_completed_count() const { void ObjectiveData::set_sub_objectives_setting(gd::Array array) { this->sub_objectives.clear(); for(int i{0}; i < array.size(); ++i) { - this->sub_objectives.push_back(array[i]); + gd::Ref sub_obj_data{array[i]}; + sub_obj_data->connect("progress_changed", callable_mp(this, &self_type::sub_objective_changed)); + this->sub_objectives.push_back(sub_obj_data); } } @@ -50,6 +87,14 @@ gd::Array ObjectiveData::get_sub_objectives_setting() const { return array; } +gd::Vector> const &ObjectiveData::get_sub_objectives() { + return this->sub_objectives; +} + +void ObjectiveData::sub_objective_changed() { + this->emit_signal("progress_changed"); +} + void ObjectiveData::check_is_done() { if(this->get_is_completed()) { this->emit_signal("is_done"); @@ -60,15 +105,24 @@ void ObjectiveData::check_is_done() { void ObjectiveFlags::_bind_methods() { #define CLASSNAME ObjectiveFlags - GDSIGNAL("progress_changed", gd::PropertyInfo(gd::Variant::OBJECT, "objective", gd::PROPERTY_HINT_RESOURCE_TYPE, "ObjectiveData")); + GDSIGNAL("objectives_changed"); + GDPROPERTY_HINTED(currently_active_objective, gd::Variant::OBJECT, gd::PROPERTY_HINT_RESOURCE_TYPE, "ObjectiveData"); + GDFUNCTION_ARGS(get_objective_by_name, "name"); } -void ObjectiveFlags::register_objective(gd::Ref objective_name) { - this->currently_active_objectives.insert(objective_name); -} -void ObjectiveFlags::set_currently_active_objectives(gd::Array array) { - for(int i{0}; i < array.size(); ++i) { - this->register_objective(array[i]); +gd::Ref ObjectiveFlags::get_objective_by_name(gd::StringName name) { + if(this->currently_active_objective->get_name() == name) { + return this->currently_active_objective; + } else { + return this->currently_active_objective->get_objective_by_name(name); } } + +void ObjectiveFlags::set_currently_active_objective(gd::Ref value) { + this->currently_active_objective = value; +} + +gd::Ref ObjectiveFlags::get_currently_active_objective() const { + return this->currently_active_objective; +} diff --git a/src/objective_flags.hpp b/src/objective_flags.hpp index a2764c9..65e1bc5 100644 --- a/src/objective_flags.hpp +++ b/src/objective_flags.hpp @@ -14,6 +14,11 @@ class ObjectiveData : public gd::Resource { GDCLASS(ObjectiveData, gd::Resource); static void _bind_methods(); public: + void set_name_config(gd::String name); + gd::String get_name_config(); + void set_description(gd::String description); + gd::String get_description() const; + gd::Ref get_objective_by_name(gd::StringName name); bool get_is_completed() const; void set_target_count(int value); int get_target_count() const; @@ -21,24 +26,26 @@ public: int get_completed_count() const; void set_sub_objectives_setting(gd::Array array); gd::Array get_sub_objectives_setting() const; + gd::Vector> const &get_sub_objectives(); + void sub_objective_changed(); private: void check_is_done(); private: int target_count{1}; int completed_count{0}; gd::Vector> sub_objectives{}; + gd::String description{"Undescribed objective"}; }; class ObjectiveFlags : public gd::Node { GDCLASS(ObjectiveFlags, gd::Node); static void _bind_methods(); public: - void register_objective(gd::Ref objective_name); - gd::Ref get_objective_by_name(); - void set_currently_active_objectives(gd::Array array); - gd::Array get_currently_active_objectives() const; + gd::Ref get_objective_by_name(gd::StringName name); + void set_currently_active_objective(gd::Ref value); + gd::Ref get_currently_active_objective() const; private: - gd::HashSet> currently_active_objectives{}; + gd::Ref currently_active_objective{}; }; #endif // !OBJECTIVE_FLAGS_HPP diff --git a/src/objective_ui.cpp b/src/objective_ui.cpp new file mode 100644 index 0000000..99af7cd --- /dev/null +++ b/src/objective_ui.cpp @@ -0,0 +1,72 @@ +#include "objective_ui.hpp" +#include +#include +#include +#include "godot_cpp/classes/packed_scene.hpp" +#include "godot_cpp/core/error_macros.hpp" +#include "godot_cpp/core/print_string.hpp" +#include "godot_cpp/templates/pair.hpp" +#include "godot_cpp/variant/variant.hpp" +#include "objective_flags.hpp" +#include "utils/game_root.hpp" +#include "utils/godot_macros.hpp" + +void ObjectiveUI::_bind_methods() { +#define CLASSNAME ObjectiveUI + GDPROPERTY_HINTED(objective_element_scene, gd::Variant::OBJECT, gd::PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"); +} + +void ObjectiveUI::_ready() { + flags = utils::GameRoot3D::get_singleton()->get_levels().begin()->value->get_node("%ObjectiveFlags"); + flags->connect("objectives_changed", callable_mp(this, &self_type::objectives_changed)); + this->build_ui_from(flags->get_currently_active_objective()); + godot::print_line("ObjectiveUI::_ready"); +} + +void ObjectiveUI::build_ui_from(gd::Ref data) { + this->build_ui_element_for(data); + for(gd::Ref sub_objective : data->get_sub_objectives()) { + this->build_ui_from(sub_objective); + } +} + +void ObjectiveUI::build_ui_element_for(gd::Ref data) { + data->connect("progress_changed", callable_mp(this, &self_type::objective_progress).bind(data)); + gd::CheckBox *instance{gd::Object::cast_to(this->objective_element_scene->instantiate())}; + ERR_FAIL_COND_EDMSG(instance == nullptr, "Failed to instantiate checkbox for objective"); + this->add_child(instance); + this->display_elements.insert(data, instance); + this->objective_progress(data); +} + +void ObjectiveUI::clear_ui() { + for(gd::KeyValue, gd::CheckBox*> kvp : this->display_elements) { + if(kvp.value != nullptr) { + kvp.value->queue_free(); + } + } + this->display_elements.clear(); +} + +void ObjectiveUI::objective_progress(gd::Ref data) { + gd::print_line("ObjectiveUI::objective_progress"); + gd::CheckBox *box{this->display_elements.get(data)}; + box->set_pressed(data->get_is_completed()); + box->set_text(data->get_description() + (data->get_target_count() > 1 + ? gd::vformat("(%d/%d)", data->get_completed_count(), data->get_target_count()) + : "" + )); +} + +void ObjectiveUI::objectives_changed() { + this->clear_ui(); + this->build_ui_from(flags->get_currently_active_objective()); +} + +void ObjectiveUI::set_objective_element_scene(gd::Ref scene) { + this->objective_element_scene = scene; +} + +gd::Ref ObjectiveUI::get_objective_element_scene() { + return this->objective_element_scene; +} diff --git a/src/objective_ui.hpp b/src/objective_ui.hpp new file mode 100644 index 0000000..df4a94c --- /dev/null +++ b/src/objective_ui.hpp @@ -0,0 +1,33 @@ +#ifndef OBJECTIVE_UI_HPP +#define OBJECTIVE_UI_HPP + +#include "godot_cpp/classes/check_box.hpp" +#include "godot_cpp/classes/object.hpp" +#include "godot_cpp/classes/packed_scene.hpp" +#include "objective_flags.hpp" +#include +#include + +namespace gd = godot; + +class ObjectiveUI : public gd::VBoxContainer { + GDCLASS(ObjectiveUI, gd::VBoxContainer); + static void _bind_methods(); +public: + virtual void _ready() override; +private: + void build_ui_from(gd::Ref data); + void build_ui_element_for(gd::Ref data); + void clear_ui(); + void objective_progress(gd::Ref data); + void objectives_changed(); +public: + void set_objective_element_scene(gd::Ref scene); + gd::Ref get_objective_element_scene(); +public: + gd::HashMap, gd::CheckBox*> display_elements{}; + gd::Ref objective_element_scene{}; + ObjectiveFlags *flags{nullptr}; +}; + +#endif // !OBJECTIVE_UI_HPP diff --git a/src/register_types.cpp b/src/register_types.cpp index fdde0ce..52ce40e 100644 --- a/src/register_types.cpp +++ b/src/register_types.cpp @@ -14,6 +14,8 @@ #include "item_db.hpp" #include "nav_marker.hpp" #include "nav_room.hpp" +#include "objective_flags.hpp" +#include "objective_ui.hpp" #include "rts_actions.hpp" #include "rts_game_mode.hpp" #include "rts_items.hpp" @@ -77,6 +79,9 @@ void initialize_gdextension_types(gd::ModuleInitializationLevel p_level) { GDREGISTER_RUNTIME_CLASS(RTSGameMode); GDREGISTER_RUNTIME_CLASS(RTSPlayer); GDREGISTER_RUNTIME_CLASS(AreaTransfer); + GDREGISTER_RUNTIME_CLASS(ObjectiveData); + GDREGISTER_RUNTIME_CLASS(ObjectiveFlags); + GDREGISTER_RUNTIME_CLASS(ObjectiveUI); } extern "C" {