feat: upgraded project to godot 4.3

This commit is contained in:
Sara 2024-08-16 00:14:04 +02:00
parent a8151b2663
commit 7ceea27259
19 changed files with 53 additions and 35 deletions

View file

@ -11,7 +11,7 @@ void EnemyWorldState::_bind_methods() {
GDPROPERTY_HINTED(available_goals_inspector, gd::Variant::ARRAY, gd::PROPERTY_HINT_ARRAY_TYPE, GDRESOURCETYPE("Goal"));
}
void EnemyWorldState::_ready() { GDGAMEONLY();
void EnemyWorldState::_ready() {
this->parent_unit->connect("plan_interrupted", callable_mp(this, &EnemyWorldState::queue_select_and_set_target));
this->awareness_area = this->get_node<gd::Area3D>("%AwarenessArea");
this->awareness_area->connect("body_entered", callable_mp(this, &EnemyWorldState::on_awareness_entered));

View file

@ -85,7 +85,7 @@ void Planner::_bind_methods() {
GDPROPERTY_HINTED(actions_inspector, gd::Variant::ARRAY, gd::PROPERTY_HINT_ARRAY_TYPE, ActionDB::get_array_hint());
}
void Planner::_ready() { GDGAMEONLY();
void Planner::_ready() {
this->world_state = this->get_node<ActorWorldState>("%ActorWorldState");
}

View file

@ -14,8 +14,8 @@ void NavMarker::_bind_methods() {
void NavMarker::_process(double) {
#ifdef DEBUG_ENABLED
GDEDITORONLY()
if(gd::EditorInterface::get_singleton()->get_selection()->get_selected_nodes().has(this)) {
// only run in editor while selected
if(gd::Engine::get_singleton()->is_editor_hint() && gd::EditorInterface::get_singleton()->get_selection()->get_selected_nodes().has(this)) {
gd::RID const map_id{this->get_world_3d()->get_navigation_map()};
gd::Vector3 const new_point{gd::NavigationServer3D::get_singleton()->map_get_closest_point(map_id, this->get_global_position())};
this->set_global_position(new_point);

View file

@ -22,12 +22,12 @@ NavRoom *NavRoom::get_closest_room(gd::Vector3 const &closest_to) {
return candidate;
}
void NavRoom::_enter_tree() { GDGAMEONLY()
void NavRoom::_enter_tree() {
NavRoom::rooms.push_back(this);
this->connect("child_entered_tree", callable_mp(this, &NavRoom::on_child_entered));
}
void NavRoom::_exit_tree() { GDGAMEONLY()
void NavRoom::_exit_tree() {
NavRoom::rooms.erase(this);
}

View file

@ -50,24 +50,24 @@ void initialize_gdextension_types(gd::ModuleInitializationLevel p_level)
ItemDB::register_item<Lasercutter>();
ItemDB::register_item<Welder>();
GDREGISTER_CLASS(goap::ActorWorldState);
GDREGISTER_RUNTIME_CLASS(goap::ActorWorldState);
GDREGISTER_CLASS(goap::Goal);
GDREGISTER_CLASS(goap::Planner);
GDREGISTER_CLASS(goap::State);
GDREGISTER_RUNTIME_CLASS(goap::Planner);
GDREGISTER_RUNTIME_CLASS(goap::State);
GDREGISTER_CLASS(MoveTo);
GDREGISTER_CLASS(Animate);
GDREGISTER_CLASS(Activate);
GDREGISTER_CLASS(UnitWorldState);
GDREGISTER_CLASS(EnemyWorldState);
GDREGISTER_CLASS(GoalMarker);
GDREGISTER_CLASS(Unit);
GDREGISTER_CLASS(RTSGameMode);
GDREGISTER_CLASS(RTSPlayer);
GDREGISTER_CLASS(EntityHealth);
GDREGISTER_RUNTIME_CLASS(MoveTo);
GDREGISTER_RUNTIME_CLASS(Animate);
GDREGISTER_RUNTIME_CLASS(Activate);
GDREGISTER_RUNTIME_CLASS(UnitWorldState);
GDREGISTER_RUNTIME_CLASS(EnemyWorldState);
GDREGISTER_RUNTIME_CLASS(GoalMarker);
GDREGISTER_RUNTIME_CLASS(Unit);
GDREGISTER_RUNTIME_CLASS(EntityHealth);
GDREGISTER_CLASS(NavMarker);
GDREGISTER_CLASS(NavRoom);
GDREGISTER_CLASS(Inventory);
GDREGISTER_RUNTIME_CLASS(NavRoom);
GDREGISTER_RUNTIME_CLASS(Inventory);
GDREGISTER_CLASS(RTSGameMode);
GDREGISTER_RUNTIME_CLASS(RTSPlayer);
}
extern "C"

View file

@ -7,6 +7,6 @@ void RTSGameMode::_bind_methods() {
#define CLASSNAME RTSGameMode
}
void RTSGameMode::_ready() { GDGAMEONLY();
void RTSGameMode::_ready() {
godot::Engine::get_singleton()->set_max_fps(60);
}

View file

@ -20,7 +20,7 @@ void Unit::_bind_methods() {
GDFUNCTION(use_weapon);
}
void Unit::_enter_tree() { GDGAMEONLY();
void Unit::_enter_tree() {
this->agent = this->get_node<gd::NavigationAgent3D>("%NavigationAgent3D");
this->agent->connect("velocity_computed", callable_mp(this, &Unit::on_velocity_computed));
this->planner = this->get_node<goap::Planner>("%Planner");
@ -32,7 +32,7 @@ void Unit::_enter_tree() { GDGAMEONLY();
this->inventory = this->get_node<Inventory>("%Inventory");
}
void Unit::_physics_process(double) { GDGAMEONLY();
void Unit::_physics_process(double) {
this->move_and_slide();
if(!this->get_velocity().is_zero_approx()) {
gd::RID const map_id{this->get_world_3d()->get_navigation_map()};

View file

@ -24,7 +24,7 @@ void UnitWorldState::_bind_methods() {
GDFUNCTION(get_target_global_position);
}
void UnitWorldState::_enter_tree() { GDGAMEONLY();
void UnitWorldState::_enter_tree() {
this->parent_unit = gd::Object::cast_to<Unit>(this->get_parent());
this->agent = this->get_node<gd::NavigationAgent3D>("%NavigationAgent3D");
this->eye_location = this->get_node<gd::Node3D>("%Eyes");