
syntax = "proto2";

package SC2APIProtocol;

import "s2clientprotocol/common.proto";
import "s2clientprotocol/error.proto";

message RequestQuery {
  repeated RequestQueryPathing pathing = 1;
  repeated RequestQueryAvailableAbilities abilities = 2;
  repeated RequestQueryBuildingPlacement placements = 3;
  optional bool ignore_resource_requirements = 4;   // Ignores requirements like food, minerals and so on.
}

message ResponseQuery {
  repeated ResponseQueryPathing pathing = 1;
  repeated ResponseQueryAvailableAbilities abilities = 2;
  repeated ResponseQueryBuildingPlacement placements = 3;
}

//--------------------------------------------------------------------------------------------------
message RequestQueryPathing {
  oneof start {
    Point2D start_pos = 1;
    uint64 unit_tag = 2;
  }
  optional Point2D end_pos = 3;
}

message ResponseQueryPathing {
  optional float distance = 1;                      // 0 if no path exists
}

//--------------------------------------------------------------------------------------------------
message RequestQueryAvailableAbilities {
  optional uint64 unit_tag = 1;
}

message ResponseQueryAvailableAbilities {
  repeated AvailableAbility abilities = 1;
  optional uint64 unit_tag = 2;
  optional uint32 unit_type_id = 3;
}

//--------------------------------------------------------------------------------------------------
message RequestQueryBuildingPlacement {
  optional int32 ability_id = 1;
  optional Point2D target_pos = 2;
  optional uint64 placing_unit_tag = 3;             // Not required
}

message ResponseQueryBuildingPlacement  {
  optional ActionResult result = 1;
}
