diff --git a/src/rts_player.cpp b/src/rts_player.cpp index 8a0b774..6d54c8c 100644 --- a/src/rts_player.cpp +++ b/src/rts_player.cpp @@ -99,16 +99,14 @@ void RTSPlayer::order_activate_object_under_cursor() { return; // fetch whatever's under the cursor in the "objects" layer gd::Dictionary const dict = this->raycast_from_cursor(0x4); - if(dict.is_empty()) + if(dict.is_empty() || this->order_activate_object(gd::Object::cast_to(dict["collider"]))) return; - if(!this->order_activate_object(gd::Object::cast_to(dict["collider"]))) { - GoalMarker *marker = gd::Object::cast_to(this->ground_marker_scene->instantiate()); - // setup position before planning to achieve goal - this->add_child(marker); - marker->set_as_top_level(true); - marker->set_global_position(dict["position"]); - this->selected_unit->begin_marker_temporary(marker); - } + GoalMarker *marker = gd::Object::cast_to(this->ground_marker_scene->instantiate()); + // setup position before planning to achieve goal + this->add_child(marker); + marker->set_as_top_level(true); + marker->set_global_position(dict["position"]); + this->selected_unit->begin_marker_temporary(marker); } bool RTSPlayer::order_activate_object(gd::Node3D *node) { // get the hit object as a marker