feat: clicking units no longer results in floating goal markers

This commit is contained in:
Sara 2024-08-30 10:00:04 +02:00
parent 6d844b89b8
commit a20f642691

View file

@ -108,6 +108,7 @@ void RTSPlayer::order_activate_object_under_cursor() {
marker->set_global_position(dict["position"]); marker->set_global_position(dict["position"]);
this->selected_unit->begin_marker_temporary(marker); this->selected_unit->begin_marker_temporary(marker);
} }
bool RTSPlayer::order_activate_object(gd::Node3D *node) { bool RTSPlayer::order_activate_object(gd::Node3D *node) {
// get the hit object as a marker // get the hit object as a marker
if(GoalMarker *marker = gd::Object::cast_to<GoalMarker>(node)) { if(GoalMarker *marker = gd::Object::cast_to<GoalMarker>(node)) {
@ -119,7 +120,7 @@ bool RTSPlayer::order_activate_object(gd::Node3D *node) {
this->selected_unit->set_target_goal(unit, goap::Goal::create("is_target_dead", true)); this->selected_unit->set_target_goal(unit, goap::Goal::create("is_target_dead", true));
return true; return true;
} }
return false; return unit != nullptr;
} }