sc2ai 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/data/sc2ai/protocol/common.proto +1 -1
  3. data/data/sc2ai/protocol/data.proto +4 -1
  4. data/data/sc2ai/protocol/debug.proto +5 -1
  5. data/data/sc2ai/protocol/error.proto +2 -1
  6. data/data/sc2ai/protocol/query.proto +1 -1
  7. data/data/sc2ai/protocol/raw.proto +8 -6
  8. data/data/sc2ai/protocol/sc2api.proto +21 -7
  9. data/data/sc2ai/protocol/score.proto +2 -1
  10. data/data/sc2ai/protocol/spatial.proto +2 -1
  11. data/data/sc2ai/protocol/ui.proto +4 -1
  12. data/lib/docker_build/Dockerfile.ruby +4 -2
  13. data/lib/sc2ai/api/ability_id.rb +6 -1
  14. data/lib/sc2ai/api/data.rb +15 -0
  15. data/lib/sc2ai/api/tech_tree.rb +1 -1
  16. data/lib/sc2ai/api/tech_tree_data.rb +54 -3
  17. data/lib/sc2ai/connection.rb +0 -1
  18. data/lib/sc2ai/overrides/async/process/child.rb +1 -1
  19. data/lib/sc2ai/player/debug.rb +36 -2
  20. data/lib/sc2ai/player/geo.rb +2 -2
  21. data/lib/sc2ai/player/units.rb +25 -1
  22. data/lib/sc2ai/player.rb +2 -7
  23. data/lib/sc2ai/ports.rb +0 -1
  24. data/lib/sc2ai/protocol/_meta_documentation.rb +249 -4
  25. data/lib/sc2ai/protocol/common_pb.rb +2 -23
  26. data/lib/sc2ai/protocol/data_pb.rb +2 -23
  27. data/lib/sc2ai/protocol/debug_pb.rb +2 -24
  28. data/lib/sc2ai/protocol/error_pb.rb +2 -23
  29. data/lib/sc2ai/protocol/extensions/point_2_d.rb +4 -0
  30. data/lib/sc2ai/protocol/extensions/position.rb +1 -1
  31. data/lib/sc2ai/protocol/extensions/unit.rb +44 -3
  32. data/lib/sc2ai/protocol/extensions/unit_type_data.rb +8 -0
  33. data/lib/sc2ai/protocol/query_pb.rb +2 -24
  34. data/lib/sc2ai/protocol/raw_pb.rb +2 -24
  35. data/lib/sc2ai/protocol/sc2api_pb.rb +2 -31
  36. data/lib/sc2ai/protocol/score_pb.rb +2 -23
  37. data/lib/sc2ai/protocol/spatial_pb.rb +2 -24
  38. data/lib/sc2ai/protocol/ui_pb.rb +2 -23
  39. data/lib/sc2ai/unit_group/filter_ext.rb +16 -1
  40. data/lib/sc2ai/version.rb +1 -1
  41. data/lib/templates/new/.ladderignore +15 -5
  42. data/lib/templates/new/my_bot.rb.tt +1 -1
  43. data/sig/minaswan.rbs +10323 -0
  44. data/sig/sc2ai.rbs +376 -34
  45. metadata +12 -12
  46. data/lib/sc2ai/protocol/extensions/unit_type.rb +0 -9
data/lib/sc2ai/player.rb CHANGED
@@ -51,12 +51,7 @@ module Sc2
51
51
  # @return [Hash]
52
52
  attr_accessor :interface_options
53
53
 
54
- # @return [Api::Race::NoRace] if Observer
55
- # @return [Api::Race::Terran] if is_a? Bot, Human, BotProcess
56
- # @return [Api::Race::Zerg] if is_a? Bot, Human, BotProcess
57
- # @return [Api::Race::Protoss] if is_a? Bot, Human, BotProcess
58
- # @return [Api::Race::Random] if specified random and in-game race hasn't been scouted yet
59
- # @return [nil] if is_a? forgetful person
54
+ # @return [Integer] Api::Race enum
60
55
  attr_accessor :race
61
56
 
62
57
  # @return [String] in-game name
@@ -153,7 +148,7 @@ module Sc2
153
148
  def join_game(server_host:, port_config:)
154
149
  Sc2.logger.debug { "Player \"#{@name}\" joining game..." }
155
150
  response = @api.join_game(name: @name, race: @race, server_host:, port_config:, enable_feature_layer: @enable_feature_layer, interface_options: @interface_options)
156
- if !response.error.nil? && response.error != :MissingParticipation
151
+ if response.error != :EnumResponseJoinGameErrorUnset && response.error != :MissingParticipation
157
152
  raise Sc2::Error, "Player \"#{@name}\" join_game failed: #{response.error}"
158
153
  end
159
154
  add_listener(self, klass: Connection::StatusListener)
data/lib/sc2ai/ports.rb CHANGED
@@ -124,7 +124,6 @@ module Sc2
124
124
  ensure
125
125
  # noinspection RubyScope
126
126
  socket&.close
127
- false
128
127
  end
129
128
  end
130
129
  end
@@ -48,12 +48,257 @@
48
48
  # @!parse
49
49
  # module Api;
50
50
  # # Protobuf virtual enum.
51
- # class Race < Google::Protobuf::AbstractMessage; end;
51
+ # module Race
52
+ # NoRace = 0
53
+ # Terran = 1
54
+ # Zerg = 2
55
+ # Protoss = 3
56
+ # Random = 4
57
+ # end
52
58
  # # Protobuf virtual enum.
53
- # class PlayerType < Google::Protobuf::AbstractMessage; end;
59
+ # module PlayerType
60
+ # Participant = 1
61
+ # Computer = 2
62
+ # Observer = 3
63
+ # end
54
64
  # # Protobuf virtual enum.
55
- # class Difficulty < Google::Protobuf::AbstractMessage; end;
65
+ # module Difficulty
66
+ # VeryEasy = 1
67
+ # Easy = 2
68
+ # Medium = 3
69
+ # MediumHard = 4
70
+ # Hard = 5
71
+ # Harder = 6
72
+ # VeryHard = 7
73
+ # CheatVision = 8
74
+ # CheatMoney = 9
75
+ # CheatInsane = 10
76
+ # end
56
77
  # # Protobuf virtual enum.
57
- # class AIBuild < Google::Protobuf::AbstractMessage; end;
78
+ # module AIBuild
79
+ # RandomBuild = 1
80
+ # Rush = 2
81
+ # Timing = 3
82
+ # Power = 4
83
+ # Macro = 5
84
+ # Air = 6
85
+ # end
86
+ # # Protobuf virtual enum.
87
+ # module ActionResult
88
+ # Success = 1;
89
+ # NotSupported = 2;
90
+ # Error = 3;
91
+ # CantQueueThatOrder = 4;
92
+ # Retry = 5;
93
+ # Cooldown = 6;
94
+ # QueueIsFull = 7;
95
+ # RallyQueueIsFull = 8;
96
+ # NotEnoughMinerals = 9;
97
+ # NotEnoughVespene = 10;
98
+ # NotEnoughTerrazine = 11;
99
+ # NotEnoughCustom = 12;
100
+ # NotEnoughFood = 13;
101
+ # FoodUsageImpossible = 14;
102
+ # NotEnoughLife = 15;
103
+ # NotEnoughShields = 16;
104
+ # NotEnoughEnergy = 17;
105
+ # LifeSuppressed = 18;
106
+ # ShieldsSuppressed = 19;
107
+ # EnergySuppressed = 20;
108
+ # NotEnoughCharges = 21;
109
+ # CantAddMoreCharges = 22;
110
+ # TooMuchMinerals = 23;
111
+ # TooMuchVespene = 24;
112
+ # TooMuchTerrazine = 25;
113
+ # TooMuchCustom = 26;
114
+ # TooMuchFood = 27;
115
+ # TooMuchLife = 28;
116
+ # TooMuchShields = 29;
117
+ # TooMuchEnergy = 30;
118
+ # MustTargetUnitWithLife = 31;
119
+ # MustTargetUnitWithShields = 32;
120
+ # MustTargetUnitWithEnergy = 33;
121
+ # CantTrade = 34;
122
+ # CantSpend = 35;
123
+ # CantTargetThatUnit = 36;
124
+ # CouldntAllocateUnit = 37;
125
+ # UnitCantMove = 38;
126
+ # TransportIsHoldingPosition = 39;
127
+ # BuildTechRequirementsNotMet = 40;
128
+ # CantFindPlacementLocation = 41;
129
+ # CantBuildOnThat = 42;
130
+ # CantBuildTooCloseToDropOff = 43;
131
+ # CantBuildLocationInvalid = 44;
132
+ # CantSeeBuildLocation = 45;
133
+ # CantBuildTooCloseToCreepSource = 46;
134
+ # CantBuildTooCloseToResources = 47;
135
+ # CantBuildTooFarFromWater = 48;
136
+ # CantBuildTooFarFromCreepSource = 49;
137
+ # CantBuildTooFarFromBuildPowerSource = 50;
138
+ # CantBuildOnDenseTerrain = 51;
139
+ # CantTrainTooFarFromTrainPowerSource = 52;
140
+ # CantLandLocationInvalid = 53;
141
+ # CantSeeLandLocation = 54;
142
+ # CantLandTooCloseToCreepSource = 55;
143
+ # CantLandTooCloseToResources = 56;
144
+ # CantLandTooFarFromWater = 57;
145
+ # CantLandTooFarFromCreepSource = 58;
146
+ # CantLandTooFarFromBuildPowerSource = 59;
147
+ # CantLandTooFarFromTrainPowerSource = 60;
148
+ # CantLandOnDenseTerrain = 61;
149
+ # AddOnTooFarFromBuilding = 62;
150
+ # MustBuildRefineryFirst = 63;
151
+ # BuildingIsUnderConstruction = 64;
152
+ # CantFindDropOff = 65;
153
+ # CantLoadOtherPlayersUnits = 66;
154
+ # NotEnoughRoomToLoadUnit = 67;
155
+ # CantUnloadUnitsThere = 68;
156
+ # CantWarpInUnitsThere = 69;
157
+ # CantLoadImmobileUnits = 70;
158
+ # CantRechargeImmobileUnits = 71;
159
+ # CantRechargeUnderConstructionUnits = 72;
160
+ # CantLoadThatUnit = 73;
161
+ # NoCargoToUnload = 74;
162
+ # LoadAllNoTargetsFound = 75;
163
+ # NotWhileOccupied = 76;
164
+ # CantAttackWithoutAmmo = 77;
165
+ # CantHoldAnyMoreAmmo = 78;
166
+ # TechRequirementsNotMet = 79;
167
+ # MustLockdownUnitFirst = 80;
168
+ # MustTargetUnit = 81;
169
+ # MustTargetInventory = 82;
170
+ # MustTargetVisibleUnit = 83;
171
+ # MustTargetVisibleLocation = 84;
172
+ # MustTargetWalkableLocation = 85;
173
+ # MustTargetPawnableUnit = 86;
174
+ # YouCantControlThatUnit = 87;
175
+ # YouCantIssueCommandsToThatUnit = 88;
176
+ # MustTargetResources = 89;
177
+ # RequiresHealTarget = 90;
178
+ # RequiresRepairTarget = 91;
179
+ # NoItemsToDrop = 92;
180
+ # CantHoldAnyMoreItems = 93;
181
+ # CantHoldThat = 94;
182
+ # TargetHasNoInventory = 95;
183
+ # CantDropThisItem = 96;
184
+ # CantMoveThisItem = 97;
185
+ # CantPawnThisUnit = 98;
186
+ # MustTargetCaster = 99;
187
+ # CantTargetCaster = 100;
188
+ # MustTargetOuter = 101;
189
+ # CantTargetOuter = 102;
190
+ # MustTargetYourOwnUnits = 103;
191
+ # CantTargetYourOwnUnits = 104;
192
+ # MustTargetFriendlyUnits = 105;
193
+ # CantTargetFriendlyUnits = 106;
194
+ # MustTargetNeutralUnits = 107;
195
+ # CantTargetNeutralUnits = 108;
196
+ # MustTargetEnemyUnits = 109;
197
+ # CantTargetEnemyUnits = 110;
198
+ # MustTargetAirUnits = 111;
199
+ # CantTargetAirUnits = 112;
200
+ # MustTargetGroundUnits = 113;
201
+ # CantTargetGroundUnits = 114;
202
+ # MustTargetStructures = 115;
203
+ # CantTargetStructures = 116;
204
+ # MustTargetLightUnits = 117;
205
+ # CantTargetLightUnits = 118;
206
+ # MustTargetArmoredUnits = 119;
207
+ # CantTargetArmoredUnits = 120;
208
+ # MustTargetBiologicalUnits = 121;
209
+ # CantTargetBiologicalUnits = 122;
210
+ # MustTargetHeroicUnits = 123;
211
+ # CantTargetHeroicUnits = 124;
212
+ # MustTargetRoboticUnits = 125;
213
+ # CantTargetRoboticUnits = 126;
214
+ # MustTargetMechanicalUnits = 127;
215
+ # CantTargetMechanicalUnits = 128;
216
+ # MustTargetPsionicUnits = 129;
217
+ # CantTargetPsionicUnits = 130;
218
+ # MustTargetMassiveUnits = 131;
219
+ # CantTargetMassiveUnits = 132;
220
+ # MustTargetMissile = 133;
221
+ # CantTargetMissile = 134;
222
+ # MustTargetWorkerUnits = 135;
223
+ # CantTargetWorkerUnits = 136;
224
+ # MustTargetEnergyCapableUnits = 137;
225
+ # CantTargetEnergyCapableUnits = 138;
226
+ # MustTargetShieldCapableUnits = 139;
227
+ # CantTargetShieldCapableUnits = 140;
228
+ # MustTargetFlyers = 141;
229
+ # CantTargetFlyers = 142;
230
+ # MustTargetBuriedUnits = 143;
231
+ # CantTargetBuriedUnits = 144;
232
+ # MustTargetCloakedUnits = 145;
233
+ # CantTargetCloakedUnits = 146;
234
+ # MustTargetUnitsInAStasisField = 147;
235
+ # CantTargetUnitsInAStasisField = 148;
236
+ # MustTargetUnderConstructionUnits = 149;
237
+ # CantTargetUnderConstructionUnits = 150;
238
+ # MustTargetDeadUnits = 151;
239
+ # CantTargetDeadUnits = 152;
240
+ # MustTargetRevivableUnits = 153;
241
+ # CantTargetRevivableUnits = 154;
242
+ # MustTargetHiddenUnits = 155;
243
+ # CantTargetHiddenUnits = 156;
244
+ # CantRechargeOtherPlayersUnits = 157;
245
+ # MustTargetHallucinations = 158;
246
+ # CantTargetHallucinations = 159;
247
+ # MustTargetInvulnerableUnits = 160;
248
+ # CantTargetInvulnerableUnits = 161;
249
+ # MustTargetDetectedUnits = 162;
250
+ # CantTargetDetectedUnits = 163;
251
+ # CantTargetUnitWithEnergy = 164;
252
+ # CantTargetUnitWithShields = 165;
253
+ # MustTargetUncommandableUnits = 166;
254
+ # CantTargetUncommandableUnits = 167;
255
+ # MustTargetPreventDefeatUnits = 168;
256
+ # CantTargetPreventDefeatUnits = 169;
257
+ # MustTargetPreventRevealUnits = 170;
258
+ # CantTargetPreventRevealUnits = 171;
259
+ # MustTargetPassiveUnits = 172;
260
+ # CantTargetPassiveUnits = 173;
261
+ # MustTargetStunnedUnits = 174;
262
+ # CantTargetStunnedUnits = 175;
263
+ # MustTargetSummonedUnits = 176;
264
+ # CantTargetSummonedUnits = 177;
265
+ # MustTargetUser1 = 178;
266
+ # CantTargetUser1 = 179;
267
+ # MustTargetUnstoppableUnits = 180;
268
+ # CantTargetUnstoppableUnits = 181;
269
+ # MustTargetResistantUnits = 182;
270
+ # CantTargetResistantUnits = 183;
271
+ # MustTargetDazedUnits = 184;
272
+ # CantTargetDazedUnits = 185;
273
+ # CantLockdown = 186;
274
+ # CantMindControl = 187;
275
+ # MustTargetDestructibles = 188;
276
+ # CantTargetDestructibles = 189;
277
+ # MustTargetItems = 190;
278
+ # CantTargetItems = 191;
279
+ # NoCalldownAvailable = 192;
280
+ # WaypointListFull = 193;
281
+ # MustTargetRace = 194;
282
+ # CantTargetRace = 195;
283
+ # MustTargetSimilarUnits = 196;
284
+ # CantTargetSimilarUnits = 197;
285
+ # CantFindEnoughTargets = 198;
286
+ # AlreadySpawningLarva = 199;
287
+ # CantTargetExhaustedResources = 200;
288
+ # CantUseMinimap = 201;
289
+ # CantUseInfoPanel = 202;
290
+ # OrderQueueIsFull = 203;
291
+ # CantHarvestThatResource = 204;
292
+ # HarvestersNotRequired = 205;
293
+ # AlreadyTargeted = 206;
294
+ # CantAttackWeaponsDisabled = 207;
295
+ # CouldntReachTarget = 208;
296
+ # TargetIsOutOfRange = 209;
297
+ # TargetIsTooClose = 210;
298
+ # TargetIsOutOfArc = 211;
299
+ # CantFindTeleportLocation = 212;
300
+ # InvalidItemClass = 213;
301
+ # CantFindCancelOrder = 214;
302
+ # end
58
303
  # end
59
304
  # @!parse
@@ -5,31 +5,10 @@
5
5
  require 'google/protobuf'
6
6
 
7
7
 
8
- descriptor_data = "\n\x1bsc2ai/protocol/common.proto\x12\x03\x41pi\">\n\x10\x41vailableAbility\x12\x12\n\nability_id\x18\x01 \x01(\x05\x12\x16\n\x0erequires_point\x18\x02 \x01(\x08\"M\n\tImageData\x12\x16\n\x0e\x62its_per_pixel\x18\x01 \x01(\x05\x12\x1a\n\x04size\x18\x02 \x01(\x0b\x32\x0c.Api.Size2DI\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\"\x1e\n\x06PointI\x12\t\n\x01x\x18\x01 \x01(\x05\x12\t\n\x01y\x18\x02 \x01(\x05\">\n\nRectangleI\x12\x17\n\x02p0\x18\x01 \x01(\x0b\x32\x0b.Api.PointI\x12\x17\n\x02p1\x18\x02 \x01(\x0b\x32\x0b.Api.PointI\"\x1f\n\x07Point2D\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\"(\n\x05Point\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\t\n\x01z\x18\x03 \x01(\x02\"\x1f\n\x07Size2DI\x12\t\n\x01x\x18\x01 \x01(\x05\x12\t\n\x01y\x18\x02 \x01(\x05*A\n\x04Race\x12\n\n\x06NoRace\x10\x00\x12\n\n\x06Terran\x10\x01\x12\x08\n\x04Zerg\x10\x02\x12\x0b\n\x07Protoss\x10\x03\x12\n\n\x06Random\x10\x04"
8
+ descriptor_data = "\n\x1bsc2ai/protocol/common.proto\x12\x03\x41pi\"j\n\x10\x41vailableAbility\x12\x17\n\nability_id\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1b\n\x0erequires_point\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\r\n\x0b_ability_idB\x11\n\x0f_requires_point\"\x81\x01\n\tImageData\x12\x1b\n\x0e\x62its_per_pixel\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1f\n\x04size\x18\x02 \x01(\x0b\x32\x0c.Api.Size2DIH\x01\x88\x01\x01\x12\x11\n\x04\x64\x61ta\x18\x03 \x01(\x0cH\x02\x88\x01\x01\x42\x11\n\x0f_bits_per_pixelB\x07\n\x05_sizeB\x07\n\x05_data\"4\n\x06PointI\x12\x0e\n\x01x\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x0e\n\x01y\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x04\n\x02_xB\x04\n\x02_y\"V\n\nRectangleI\x12\x1c\n\x02p0\x18\x01 \x01(\x0b\x32\x0b.Api.PointIH\x00\x88\x01\x01\x12\x1c\n\x02p1\x18\x02 \x01(\x0b\x32\x0b.Api.PointIH\x01\x88\x01\x01\x42\x05\n\x03_p0B\x05\n\x03_p1\"5\n\x07Point2D\x12\x0e\n\x01x\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x0e\n\x01y\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x04\n\x02_xB\x04\n\x02_y\"I\n\x05Point\x12\x0e\n\x01x\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x0e\n\x01y\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12\x0e\n\x01z\x18\x03 \x01(\x02H\x02\x88\x01\x01\x42\x04\n\x02_xB\x04\n\x02_yB\x04\n\x02_z\"5\n\x07Size2DI\x12\x0e\n\x01x\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x0e\n\x01y\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x04\n\x02_xB\x04\n\x02_y*A\n\x04Race\x12\n\n\x06NoRace\x10\x00\x12\n\n\x06Terran\x10\x01\x12\x08\n\x04Zerg\x10\x02\x12\x0b\n\x07Protoss\x10\x03\x12\n\n\x06Random\x10\x04\x62\x06proto3"
9
9
 
10
10
  pool = Google::Protobuf::DescriptorPool.generated_pool
11
-
12
- begin
13
- pool.add_serialized_file(descriptor_data)
14
- rescue TypeError
15
- # Compatibility code: will be removed in the next major version.
16
- require 'google/protobuf/descriptor_pb'
17
- parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
18
- parsed.clear_dependency
19
- serialized = parsed.class.encode(parsed)
20
- file = pool.add_serialized_file(serialized)
21
- warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
22
- imports = [
23
- ]
24
- imports.each do |type_name, expected_filename|
25
- import_file = pool.lookup(type_name).file_descriptor
26
- if import_file.name != expected_filename
27
- warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
28
- end
29
- end
30
- warn "Each proto file must use a consistent fully-qualified name."
31
- warn "This will become an error in the next major version."
32
- end
11
+ pool.add_serialized_file(descriptor_data)
33
12
 
34
13
  module Api
35
14
  AvailableAbility = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.AvailableAbility").msgclass
@@ -7,31 +7,10 @@ require 'google/protobuf'
7
7
  require 'sc2ai/protocol/common_pb'
8
8
 
9
9
 
10
- descriptor_data = "\n\x19sc2ai/protocol/data.proto\x12\x03\x41pi\x1a\x1bsc2ai/protocol/common.proto\"\xb9\x03\n\x0b\x41\x62ilityData\x12\x12\n\nability_id\x18\x01 \x01(\r\x12\x11\n\tlink_name\x18\x02 \x01(\t\x12\x12\n\nlink_index\x18\x03 \x01(\r\x12\x13\n\x0b\x62utton_name\x18\x04 \x01(\t\x12\x15\n\rfriendly_name\x18\x05 \x01(\t\x12\x0e\n\x06hotkey\x18\x06 \x01(\t\x12\x1c\n\x14remaps_to_ability_id\x18\x07 \x01(\r\x12\x11\n\tavailable\x18\x08 \x01(\x08\x12\'\n\x06target\x18\t \x01(\x0e\x32\x17.Api.AbilityData.Target\x12\x15\n\rallow_minimap\x18\n \x01(\x08\x12\x16\n\x0e\x61llow_autocast\x18\x0b \x01(\x08\x12\x13\n\x0bis_building\x18\x0c \x01(\x08\x12\x18\n\x10\x66ootprint_radius\x18\r \x01(\x02\x12\x1c\n\x14is_instant_placement\x18\x0e \x01(\x08\x12\x12\n\ncast_range\x18\x0f \x01(\x02\"I\n\x06Target\x12\x08\n\x04None\x10\x01\x12\t\n\x05Point\x10\x02\x12\x08\n\x04Unit\x10\x03\x12\x0f\n\x0bPointOrUnit\x10\x04\x12\x0f\n\x0bPointOrNone\x10\x05\"?\n\x0b\x44\x61mageBonus\x12!\n\tattribute\x18\x01 \x01(\x0e\x32\x0e.Api.Attribute\x12\r\n\x05\x62onus\x18\x02 \x01(\x02\"\xc1\x01\n\x06Weapon\x12$\n\x04type\x18\x01 \x01(\x0e\x32\x16.Api.Weapon.TargetType\x12\x0e\n\x06\x64\x61mage\x18\x02 \x01(\x02\x12&\n\x0c\x64\x61mage_bonus\x18\x03 \x03(\x0b\x32\x10.Api.DamageBonus\x12\x0f\n\x07\x61ttacks\x18\x04 \x01(\r\x12\r\n\x05range\x18\x05 \x01(\x02\x12\r\n\x05speed\x18\x06 \x01(\x02\"*\n\nTargetType\x12\n\n\x06Ground\x10\x01\x12\x07\n\x03\x41ir\x10\x02\x12\x07\n\x03\x41ny\x10\x03\"\xf4\x03\n\x0cUnitTypeData\x12\x0f\n\x07unit_id\x18\x01 \x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\tavailable\x18\x03 \x01(\x08\x12\x12\n\ncargo_size\x18\x04 \x01(\r\x12\x14\n\x0cmineral_cost\x18\x0c \x01(\r\x12\x14\n\x0cvespene_cost\x18\r \x01(\r\x12\x15\n\rfood_required\x18\x0e \x01(\x02\x12\x15\n\rfood_provided\x18\x12 \x01(\x02\x12\x12\n\nability_id\x18\x0f \x01(\r\x12\x17\n\x04race\x18\x10 \x01(\x0e\x32\t.Api.Race\x12\x12\n\nbuild_time\x18\x11 \x01(\x02\x12\x13\n\x0bhas_vespene\x18\x13 \x01(\x08\x12\x14\n\x0chas_minerals\x18\x14 \x01(\x08\x12\x13\n\x0bsight_range\x18\x19 \x01(\x02\x12\x12\n\ntech_alias\x18\x15 \x03(\r\x12\x12\n\nunit_alias\x18\x16 \x01(\r\x12\x18\n\x10tech_requirement\x18\x17 \x01(\r\x12\x18\n\x10require_attached\x18\x18 \x01(\x08\x12\"\n\nattributes\x18\x08 \x03(\x0e\x32\x0e.Api.Attribute\x12\x16\n\x0emovement_speed\x18\t \x01(\x02\x12\r\n\x05\x61rmor\x18\n \x01(\x02\x12\x1c\n\x07weapons\x18\x0b \x03(\x0b\x32\x0b.Api.Weapon\"\x86\x01\n\x0bUpgradeData\x12\x12\n\nupgrade_id\x18\x01 \x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x14\n\x0cmineral_cost\x18\x03 \x01(\r\x12\x14\n\x0cvespene_cost\x18\x04 \x01(\r\x12\x15\n\rresearch_time\x18\x05 \x01(\x02\x12\x12\n\nability_id\x18\x06 \x01(\r\")\n\x08\x42uffData\x12\x0f\n\x07\x62uff_id\x18\x01 \x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\"T\n\nEffectData\x12\x11\n\teffect_id\x18\x01 \x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x15\n\rfriendly_name\x18\x03 \x01(\t\x12\x0e\n\x06radius\x18\x04 \x01(\x02*\x9e\x01\n\tAttribute\x12\t\n\x05Light\x10\x01\x12\x0b\n\x07\x41rmored\x10\x02\x12\x0e\n\nBiological\x10\x03\x12\x0e\n\nMechanical\x10\x04\x12\x0b\n\x07Robotic\x10\x05\x12\x0b\n\x07Psionic\x10\x06\x12\x0b\n\x07Massive\x10\x07\x12\r\n\tStructure\x10\x08\x12\t\n\x05Hover\x10\t\x12\n\n\x06Heroic\x10\n\x12\x0c\n\x08Summoned\x10\x0b"
10
+ descriptor_data = "\n\x19sc2ai/protocol/data.proto\x12\x03\x41pi\x1a\x1bsc2ai/protocol/common.proto\"\x96\x06\n\x0b\x41\x62ilityData\x12\x17\n\nability_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tlink_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x17\n\nlink_index\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x18\n\x0b\x62utton_name\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x1a\n\rfriendly_name\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x13\n\x06hotkey\x18\x06 \x01(\tH\x05\x88\x01\x01\x12!\n\x14remaps_to_ability_id\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x16\n\tavailable\x18\x08 \x01(\x08H\x07\x88\x01\x01\x12,\n\x06target\x18\t \x01(\x0e\x32\x17.Api.AbilityData.TargetH\x08\x88\x01\x01\x12\x1a\n\rallow_minimap\x18\n \x01(\x08H\t\x88\x01\x01\x12\x1b\n\x0e\x61llow_autocast\x18\x0b \x01(\x08H\n\x88\x01\x01\x12\x18\n\x0bis_building\x18\x0c \x01(\x08H\x0b\x88\x01\x01\x12\x1d\n\x10\x66ootprint_radius\x18\r \x01(\x02H\x0c\x88\x01\x01\x12!\n\x14is_instant_placement\x18\x0e \x01(\x08H\r\x88\x01\x01\x12\x17\n\ncast_range\x18\x0f \x01(\x02H\x0e\x88\x01\x01\"^\n\x06Target\x12\x13\n\x0f\x45numTargetUnset\x10\x00\x12\x08\n\x04None\x10\x01\x12\t\n\x05Point\x10\x02\x12\x08\n\x04Unit\x10\x03\x12\x0f\n\x0bPointOrUnit\x10\x04\x12\x0f\n\x0bPointOrNone\x10\x05\x42\r\n\x0b_ability_idB\x0c\n\n_link_nameB\r\n\x0b_link_indexB\x0e\n\x0c_button_nameB\x10\n\x0e_friendly_nameB\t\n\x07_hotkeyB\x17\n\x15_remaps_to_ability_idB\x0c\n\n_availableB\t\n\x07_targetB\x10\n\x0e_allow_minimapB\x11\n\x0f_allow_autocastB\x0e\n\x0c_is_buildingB\x13\n\x11_footprint_radiusB\x17\n\x15_is_instant_placementB\r\n\x0b_cast_range\"a\n\x0b\x44\x61mageBonus\x12&\n\tattribute\x18\x01 \x01(\x0e\x32\x0e.Api.AttributeH\x00\x88\x01\x01\x12\x12\n\x05\x62onus\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x0c\n\n_attributeB\x08\n\x06_bonus\"\xa7\x02\n\x06Weapon\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x16.Api.Weapon.TargetTypeH\x00\x88\x01\x01\x12\x13\n\x06\x64\x61mage\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12&\n\x0c\x64\x61mage_bonus\x18\x03 \x03(\x0b\x32\x10.Api.DamageBonus\x12\x14\n\x07\x61ttacks\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x12\n\x05range\x18\x05 \x01(\x02H\x03\x88\x01\x01\x12\x12\n\x05speed\x18\x06 \x01(\x02H\x04\x88\x01\x01\"C\n\nTargetType\x12\x17\n\x13\x45numTargetTypeUnset\x10\x00\x12\n\n\x06Ground\x10\x01\x12\x07\n\x03\x41ir\x10\x02\x12\x07\n\x03\x41ny\x10\x03\x42\x07\n\x05_typeB\t\n\x07_damageB\n\n\x08_attacksB\x08\n\x06_rangeB\x08\n\x06_speed\"\xf9\x06\n\x0cUnitTypeData\x12\x14\n\x07unit_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x16\n\tavailable\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x17\n\ncargo_size\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x19\n\x0cmineral_cost\x18\x0c \x01(\rH\x04\x88\x01\x01\x12\x19\n\x0cvespene_cost\x18\r \x01(\rH\x05\x88\x01\x01\x12\x1a\n\rfood_required\x18\x0e \x01(\x02H\x06\x88\x01\x01\x12\x1a\n\rfood_provided\x18\x12 \x01(\x02H\x07\x88\x01\x01\x12\x17\n\nability_id\x18\x0f \x01(\rH\x08\x88\x01\x01\x12\x1c\n\x04race\x18\x10 \x01(\x0e\x32\t.Api.RaceH\t\x88\x01\x01\x12\x17\n\nbuild_time\x18\x11 \x01(\x02H\n\x88\x01\x01\x12\x18\n\x0bhas_vespene\x18\x13 \x01(\x08H\x0b\x88\x01\x01\x12\x19\n\x0chas_minerals\x18\x14 \x01(\x08H\x0c\x88\x01\x01\x12\x18\n\x0bsight_range\x18\x19 \x01(\x02H\r\x88\x01\x01\x12\x12\n\ntech_alias\x18\x15 \x03(\r\x12\x17\n\nunit_alias\x18\x16 \x01(\rH\x0e\x88\x01\x01\x12\x1d\n\x10tech_requirement\x18\x17 \x01(\rH\x0f\x88\x01\x01\x12\x1d\n\x10require_attached\x18\x18 \x01(\x08H\x10\x88\x01\x01\x12\"\n\nattributes\x18\x08 \x03(\x0e\x32\x0e.Api.Attribute\x12\x1b\n\x0emovement_speed\x18\t \x01(\x02H\x11\x88\x01\x01\x12\x12\n\x05\x61rmor\x18\n \x01(\x02H\x12\x88\x01\x01\x12\x1c\n\x07weapons\x18\x0b \x03(\x0b\x32\x0b.Api.WeaponB\n\n\x08_unit_idB\x07\n\x05_nameB\x0c\n\n_availableB\r\n\x0b_cargo_sizeB\x0f\n\r_mineral_costB\x0f\n\r_vespene_costB\x10\n\x0e_food_requiredB\x10\n\x0e_food_providedB\r\n\x0b_ability_idB\x07\n\x05_raceB\r\n\x0b_build_timeB\x0e\n\x0c_has_vespeneB\x0f\n\r_has_mineralsB\x0e\n\x0c_sight_rangeB\r\n\x0b_unit_aliasB\x13\n\x11_tech_requirementB\x13\n\x11_require_attachedB\x11\n\x0f_movement_speedB\x08\n\x06_armor\"\xff\x01\n\x0bUpgradeData\x12\x17\n\nupgrade_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x19\n\x0cmineral_cost\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x19\n\x0cvespene_cost\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1a\n\rresearch_time\x18\x05 \x01(\x02H\x04\x88\x01\x01\x12\x17\n\nability_id\x18\x06 \x01(\rH\x05\x88\x01\x01\x42\r\n\x0b_upgrade_idB\x07\n\x05_nameB\x0f\n\r_mineral_costB\x0f\n\r_vespene_costB\x10\n\x0e_research_timeB\r\n\x0b_ability_id\"H\n\x08\x42uffData\x12\x14\n\x07\x62uff_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\n\n\x08_buff_idB\x07\n\x05_name\"\x9c\x01\n\nEffectData\x12\x16\n\teffect_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1a\n\rfriendly_name\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x13\n\x06radius\x18\x04 \x01(\x02H\x03\x88\x01\x01\x42\x0c\n\n_effect_idB\x07\n\x05_nameB\x10\n\x0e_friendly_nameB\t\n\x07_radius*\xb6\x01\n\tAttribute\x12\x16\n\x12\x45numAttributeUnset\x10\x00\x12\t\n\x05Light\x10\x01\x12\x0b\n\x07\x41rmored\x10\x02\x12\x0e\n\nBiological\x10\x03\x12\x0e\n\nMechanical\x10\x04\x12\x0b\n\x07Robotic\x10\x05\x12\x0b\n\x07Psionic\x10\x06\x12\x0b\n\x07Massive\x10\x07\x12\r\n\tStructure\x10\x08\x12\t\n\x05Hover\x10\t\x12\n\n\x06Heroic\x10\n\x12\x0c\n\x08Summoned\x10\x0b\x62\x06proto3"
11
11
 
12
12
  pool = Google::Protobuf::DescriptorPool.generated_pool
13
-
14
- begin
15
- pool.add_serialized_file(descriptor_data)
16
- rescue TypeError
17
- # Compatibility code: will be removed in the next major version.
18
- require 'google/protobuf/descriptor_pb'
19
- parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
20
- parsed.clear_dependency
21
- serialized = parsed.class.encode(parsed)
22
- file = pool.add_serialized_file(serialized)
23
- warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
24
- imports = [
25
- ]
26
- imports.each do |type_name, expected_filename|
27
- import_file = pool.lookup(type_name).file_descriptor
28
- if import_file.name != expected_filename
29
- warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
30
- end
31
- end
32
- warn "Each proto file must use a consistent fully-qualified name."
33
- warn "This will become an error in the next major version."
34
- end
13
+ pool.add_serialized_file(descriptor_data)
35
14
 
36
15
  module Api
37
16
  AbilityData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.AbilityData").msgclass
@@ -7,32 +7,10 @@ require 'google/protobuf'
7
7
  require 'sc2ai/protocol/common_pb'
8
8
 
9
9
 
10
- descriptor_data = "\n\x1asc2ai/protocol/debug.proto\x12\x03\x41pi\x1a\x1bsc2ai/protocol/common.proto\"\xe3\x02\n\x0c\x44\x65\x62ugCommand\x12\x1e\n\x04\x64raw\x18\x01 \x01(\x0b\x32\x0e.Api.DebugDrawH\x00\x12)\n\ngame_state\x18\x02 \x01(\x0e\x32\x13.Api.DebugGameStateH\x00\x12+\n\x0b\x63reate_unit\x18\x03 \x01(\x0b\x32\x14.Api.DebugCreateUnitH\x00\x12\'\n\tkill_unit\x18\x04 \x01(\x0b\x32\x12.Api.DebugKillUnitH\x00\x12-\n\x0ctest_process\x18\x05 \x01(\x0b\x32\x15.Api.DebugTestProcessH\x00\x12#\n\x05score\x18\x06 \x01(\x0b\x32\x12.Api.DebugSetScoreH\x00\x12%\n\x08\x65nd_game\x18\x07 \x01(\x0b\x32\x11.Api.DebugEndGameH\x00\x12,\n\nunit_value\x18\x08 \x01(\x0b\x32\x16.Api.DebugSetUnitValueH\x00\x42\t\n\x07\x63ommand\"\x89\x01\n\tDebugDraw\x12\x1c\n\x04text\x18\x01 \x03(\x0b\x32\x0e.Api.DebugText\x12\x1d\n\x05lines\x18\x02 \x03(\x0b\x32\x0e.Api.DebugLine\x12\x1c\n\x05\x62oxes\x18\x03 \x03(\x0b\x32\r.Api.DebugBox\x12!\n\x07spheres\x18\x04 \x03(\x0b\x32\x10.Api.DebugSphere\"6\n\x04Line\x12\x16\n\x02p0\x18\x01 \x01(\x0b\x32\n.Api.Point\x12\x16\n\x02p1\x18\x02 \x01(\x0b\x32\n.Api.Point\"(\n\x05\x43olor\x12\t\n\x01r\x18\x01 \x01(\r\x12\t\n\x01g\x18\x02 \x01(\r\x12\t\n\x01\x62\x18\x03 \x01(\r\"\x82\x01\n\tDebugText\x12\x19\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.Color\x12\x0c\n\x04text\x18\x02 \x01(\t\x12\x1f\n\x0bvirtual_pos\x18\x03 \x01(\x0b\x32\n.Api.Point\x12\x1d\n\tworld_pos\x18\x04 \x01(\x0b\x32\n.Api.Point\x12\x0c\n\x04size\x18\x05 \x01(\r\"?\n\tDebugLine\x12\x19\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.Color\x12\x17\n\x04line\x18\x02 \x01(\x0b\x32\t.Api.Line\"W\n\x08\x44\x65\x62ugBox\x12\x19\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.Color\x12\x17\n\x03min\x18\x02 \x01(\x0b\x32\n.Api.Point\x12\x17\n\x03max\x18\x03 \x01(\x0b\x32\n.Api.Point\"J\n\x0b\x44\x65\x62ugSphere\x12\x19\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.Color\x12\x15\n\x01p\x18\x02 \x01(\x0b\x32\n.Api.Point\x12\t\n\x01r\x18\x03 \x01(\x02\"`\n\x0f\x44\x65\x62ugCreateUnit\x12\x11\n\tunit_type\x18\x01 \x01(\r\x12\r\n\x05owner\x18\x02 \x01(\x05\x12\x19\n\x03pos\x18\x03 \x01(\x0b\x32\x0c.Api.Point2D\x12\x10\n\x08quantity\x18\x04 \x01(\r\"\x1c\n\rDebugKillUnit\x12\x0b\n\x03tag\x18\x01 \x03(\x04\"u\n\x10\x44\x65\x62ugTestProcess\x12(\n\x04test\x18\x01 \x01(\x0e\x32\x1a.Api.DebugTestProcess.Test\x12\x10\n\x08\x64\x65lay_ms\x18\x02 \x01(\x05\"%\n\x04Test\x12\x08\n\x04hang\x10\x01\x12\t\n\x05\x63rash\x10\x02\x12\x08\n\x04\x65xit\x10\x03\"\x1e\n\rDebugSetScore\x12\r\n\x05score\x18\x01 \x01(\x02\"o\n\x0c\x44\x65\x62ugEndGame\x12/\n\nend_result\x18\x01 \x01(\x0e\x32\x1b.Api.DebugEndGame.EndResult\".\n\tEndResult\x12\r\n\tSurrender\x10\x01\x12\x12\n\x0e\x44\x65\x63lareVictory\x10\x02\"\x9a\x01\n\x11\x44\x65\x62ugSetUnitValue\x12\x34\n\nunit_value\x18\x01 \x01(\x0e\x32 .Api.DebugSetUnitValue.UnitValue\x12\r\n\x05value\x18\x02 \x01(\x02\x12\x10\n\x08unit_tag\x18\x03 \x01(\x04\".\n\tUnitValue\x12\n\n\x06\x45nergy\x10\x01\x12\x08\n\x04Life\x10\x02\x12\x0b\n\x07Shields\x10\x03*\xb2\x01\n\x0e\x44\x65\x62ugGameState\x12\x0c\n\x08show_map\x10\x01\x12\x11\n\rcontrol_enemy\x10\x02\x12\x08\n\x04\x66ood\x10\x03\x12\x08\n\x04\x66ree\x10\x04\x12\x11\n\rall_resources\x10\x05\x12\x07\n\x03god\x10\x06\x12\x0c\n\x08minerals\x10\x07\x12\x07\n\x03gas\x10\x08\x12\x0c\n\x08\x63ooldown\x10\t\x12\r\n\ttech_tree\x10\n\x12\x0b\n\x07upgrade\x10\x0b\x12\x0e\n\nfast_build\x10\x0c"
10
+ descriptor_data = "\n\x1asc2ai/protocol/debug.proto\x12\x03\x41pi\x1a\x1bsc2ai/protocol/common.proto\"\xe3\x02\n\x0c\x44\x65\x62ugCommand\x12\x1e\n\x04\x64raw\x18\x01 \x01(\x0b\x32\x0e.Api.DebugDrawH\x00\x12)\n\ngame_state\x18\x02 \x01(\x0e\x32\x13.Api.DebugGameStateH\x00\x12+\n\x0b\x63reate_unit\x18\x03 \x01(\x0b\x32\x14.Api.DebugCreateUnitH\x00\x12\'\n\tkill_unit\x18\x04 \x01(\x0b\x32\x12.Api.DebugKillUnitH\x00\x12-\n\x0ctest_process\x18\x05 \x01(\x0b\x32\x15.Api.DebugTestProcessH\x00\x12#\n\x05score\x18\x06 \x01(\x0b\x32\x12.Api.DebugSetScoreH\x00\x12%\n\x08\x65nd_game\x18\x07 \x01(\x0b\x32\x11.Api.DebugEndGameH\x00\x12,\n\nunit_value\x18\x08 \x01(\x0b\x32\x16.Api.DebugSetUnitValueH\x00\x42\t\n\x07\x63ommand\"\x89\x01\n\tDebugDraw\x12\x1c\n\x04text\x18\x01 \x03(\x0b\x32\x0e.Api.DebugText\x12\x1d\n\x05lines\x18\x02 \x03(\x0b\x32\x0e.Api.DebugLine\x12\x1c\n\x05\x62oxes\x18\x03 \x03(\x0b\x32\r.Api.DebugBox\x12!\n\x07spheres\x18\x04 \x03(\x0b\x32\x10.Api.DebugSphere\"N\n\x04Line\x12\x1b\n\x02p0\x18\x01 \x01(\x0b\x32\n.Api.PointH\x00\x88\x01\x01\x12\x1b\n\x02p1\x18\x02 \x01(\x0b\x32\n.Api.PointH\x01\x88\x01\x01\x42\x05\n\x03_p0B\x05\n\x03_p1\"I\n\x05\x43olor\x12\x0e\n\x01r\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x0e\n\x01g\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x01\x62\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x04\n\x02_rB\x04\n\x02_gB\x04\n\x02_b\"\xd5\x01\n\tDebugText\x12\x1e\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.ColorH\x00\x88\x01\x01\x12\x11\n\x04text\x18\x02 \x01(\tH\x01\x88\x01\x01\x12$\n\x0bvirtual_pos\x18\x03 \x01(\x0b\x32\n.Api.PointH\x02\x88\x01\x01\x12\"\n\tworld_pos\x18\x04 \x01(\x0b\x32\n.Api.PointH\x03\x88\x01\x01\x12\x11\n\x04size\x18\x05 \x01(\rH\x04\x88\x01\x01\x42\x08\n\x06_colorB\x07\n\x05_textB\x0e\n\x0c_virtual_posB\x0c\n\n_world_posB\x07\n\x05_size\"\\\n\tDebugLine\x12\x1e\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.ColorH\x00\x88\x01\x01\x12\x1c\n\x04line\x18\x02 \x01(\x0b\x32\t.Api.LineH\x01\x88\x01\x01\x42\x08\n\x06_colorB\x07\n\x05_line\"\x80\x01\n\x08\x44\x65\x62ugBox\x12\x1e\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.ColorH\x00\x88\x01\x01\x12\x1c\n\x03min\x18\x02 \x01(\x0b\x32\n.Api.PointH\x01\x88\x01\x01\x12\x1c\n\x03max\x18\x03 \x01(\x0b\x32\n.Api.PointH\x02\x88\x01\x01\x42\x08\n\x06_colorB\x06\n\x04_minB\x06\n\x04_max\"o\n\x0b\x44\x65\x62ugSphere\x12\x1e\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.ColorH\x00\x88\x01\x01\x12\x1a\n\x01p\x18\x02 \x01(\x0b\x32\n.Api.PointH\x01\x88\x01\x01\x12\x0e\n\x01r\x18\x03 \x01(\x02H\x02\x88\x01\x01\x42\x08\n\x06_colorB\x04\n\x02_pB\x04\n\x02_r\"\xa1\x01\n\x0f\x44\x65\x62ugCreateUnit\x12\x16\n\tunit_type\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05owner\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x1e\n\x03pos\x18\x03 \x01(\x0b\x32\x0c.Api.Point2DH\x02\x88\x01\x01\x12\x15\n\x08quantity\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x0c\n\n_unit_typeB\x08\n\x06_ownerB\x06\n\x04_posB\x0b\n\t_quantity\"\x1c\n\rDebugKillUnit\x12\x0b\n\x03tag\x18\x01 \x03(\x04\"\xa8\x01\n\x10\x44\x65\x62ugTestProcess\x12-\n\x04test\x18\x01 \x01(\x0e\x32\x1a.Api.DebugTestProcess.TestH\x00\x88\x01\x01\x12\x15\n\x08\x64\x65lay_ms\x18\x02 \x01(\x05H\x01\x88\x01\x01\"8\n\x04Test\x12\x11\n\rEnumTestUnset\x10\x00\x12\x08\n\x04hang\x10\x01\x12\t\n\x05\x63rash\x10\x02\x12\x08\n\x04\x65xit\x10\x03\x42\x07\n\x05_testB\x0b\n\t_delay_ms\"-\n\rDebugSetScore\x12\x12\n\x05score\x18\x01 \x01(\x02H\x00\x88\x01\x01\x42\x08\n\x06_score\"\x9b\x01\n\x0c\x44\x65\x62ugEndGame\x12\x34\n\nend_result\x18\x01 \x01(\x0e\x32\x1b.Api.DebugEndGame.EndResultH\x00\x88\x01\x01\"F\n\tEndResult\x12\x16\n\x12\x45numEndResultUnset\x10\x00\x12\r\n\tSurrender\x10\x01\x12\x12\n\x0e\x44\x65\x63lareVictory\x10\x02\x42\r\n\x0b_end_result\"\xe7\x01\n\x11\x44\x65\x62ugSetUnitValue\x12\x39\n\nunit_value\x18\x01 \x01(\x0e\x32 .Api.DebugSetUnitValue.UnitValueH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12\x15\n\x08unit_tag\x18\x03 \x01(\x04H\x02\x88\x01\x01\"F\n\tUnitValue\x12\x16\n\x12\x45numUnitValueUnset\x10\x00\x12\n\n\x06\x45nergy\x10\x01\x12\x08\n\x04Life\x10\x02\x12\x0b\n\x07Shields\x10\x03\x42\r\n\x0b_unit_valueB\x08\n\x06_valueB\x0b\n\t_unit_tag*\xcf\x01\n\x0e\x44\x65\x62ugGameState\x12\x1b\n\x17\x45numDebugGameStateUnset\x10\x00\x12\x0c\n\x08show_map\x10\x01\x12\x11\n\rcontrol_enemy\x10\x02\x12\x08\n\x04\x66ood\x10\x03\x12\x08\n\x04\x66ree\x10\x04\x12\x11\n\rall_resources\x10\x05\x12\x07\n\x03god\x10\x06\x12\x0c\n\x08minerals\x10\x07\x12\x07\n\x03gas\x10\x08\x12\x0c\n\x08\x63ooldown\x10\t\x12\r\n\ttech_tree\x10\n\x12\x0b\n\x07upgrade\x10\x0b\x12\x0e\n\nfast_build\x10\x0c\x62\x06proto3"
11
11
 
12
12
  pool = Google::Protobuf::DescriptorPool.generated_pool
13
-
14
- begin
15
- pool.add_serialized_file(descriptor_data)
16
- rescue TypeError
17
- # Compatibility code: will be removed in the next major version.
18
- require 'google/protobuf/descriptor_pb'
19
- parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
20
- parsed.clear_dependency
21
- serialized = parsed.class.encode(parsed)
22
- file = pool.add_serialized_file(serialized)
23
- warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
24
- imports = [
25
- ["Api.Point", "sc2ai/protocol/common.proto"],
26
- ]
27
- imports.each do |type_name, expected_filename|
28
- import_file = pool.lookup(type_name).file_descriptor
29
- if import_file.name != expected_filename
30
- warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
31
- end
32
- end
33
- warn "Each proto file must use a consistent fully-qualified name."
34
- warn "This will become an error in the next major version."
35
- end
13
+ pool.add_serialized_file(descriptor_data)
36
14
 
37
15
  module Api
38
16
  DebugCommand = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugCommand").msgclass
@@ -5,31 +5,10 @@
5
5
  require 'google/protobuf'
6
6
 
7
7
 
8
- descriptor_data = "\n\x1asc2ai/protocol/error.proto\x12\x03\x41pi*\xa8-\n\x0c\x41\x63tionResult\x12\x0b\n\x07Success\x10\x01\x12\x10\n\x0cNotSupported\x10\x02\x12\t\n\x05\x45rror\x10\x03\x12\x16\n\x12\x43\x61ntQueueThatOrder\x10\x04\x12\t\n\x05Retry\x10\x05\x12\x0c\n\x08\x43ooldown\x10\x06\x12\x0f\n\x0bQueueIsFull\x10\x07\x12\x14\n\x10RallyQueueIsFull\x10\x08\x12\x15\n\x11NotEnoughMinerals\x10\t\x12\x14\n\x10NotEnoughVespene\x10\n\x12\x16\n\x12NotEnoughTerrazine\x10\x0b\x12\x13\n\x0fNotEnoughCustom\x10\x0c\x12\x11\n\rNotEnoughFood\x10\r\x12\x17\n\x13\x46oodUsageImpossible\x10\x0e\x12\x11\n\rNotEnoughLife\x10\x0f\x12\x14\n\x10NotEnoughShields\x10\x10\x12\x13\n\x0fNotEnoughEnergy\x10\x11\x12\x12\n\x0eLifeSuppressed\x10\x12\x12\x15\n\x11ShieldsSuppressed\x10\x13\x12\x14\n\x10\x45nergySuppressed\x10\x14\x12\x14\n\x10NotEnoughCharges\x10\x15\x12\x16\n\x12\x43\x61ntAddMoreCharges\x10\x16\x12\x13\n\x0fTooMuchMinerals\x10\x17\x12\x12\n\x0eTooMuchVespene\x10\x18\x12\x14\n\x10TooMuchTerrazine\x10\x19\x12\x11\n\rTooMuchCustom\x10\x1a\x12\x0f\n\x0bTooMuchFood\x10\x1b\x12\x0f\n\x0bTooMuchLife\x10\x1c\x12\x12\n\x0eTooMuchShields\x10\x1d\x12\x11\n\rTooMuchEnergy\x10\x1e\x12\x1a\n\x16MustTargetUnitWithLife\x10\x1f\x12\x1d\n\x19MustTargetUnitWithShields\x10 \x12\x1c\n\x18MustTargetUnitWithEnergy\x10!\x12\r\n\tCantTrade\x10\"\x12\r\n\tCantSpend\x10#\x12\x16\n\x12\x43\x61ntTargetThatUnit\x10$\x12\x17\n\x13\x43ouldntAllocateUnit\x10%\x12\x10\n\x0cUnitCantMove\x10&\x12\x1e\n\x1aTransportIsHoldingPosition\x10\'\x12\x1f\n\x1b\x42uildTechRequirementsNotMet\x10(\x12\x1d\n\x19\x43\x61ntFindPlacementLocation\x10)\x12\x13\n\x0f\x43\x61ntBuildOnThat\x10*\x12\x1e\n\x1a\x43\x61ntBuildTooCloseToDropOff\x10+\x12\x1c\n\x18\x43\x61ntBuildLocationInvalid\x10,\x12\x18\n\x14\x43\x61ntSeeBuildLocation\x10-\x12\"\n\x1e\x43\x61ntBuildTooCloseToCreepSource\x10.\x12 \n\x1c\x43\x61ntBuildTooCloseToResources\x10/\x12\x1c\n\x18\x43\x61ntBuildTooFarFromWater\x10\x30\x12\"\n\x1e\x43\x61ntBuildTooFarFromCreepSource\x10\x31\x12\'\n#CantBuildTooFarFromBuildPowerSource\x10\x32\x12\x1b\n\x17\x43\x61ntBuildOnDenseTerrain\x10\x33\x12\'\n#CantTrainTooFarFromTrainPowerSource\x10\x34\x12\x1b\n\x17\x43\x61ntLandLocationInvalid\x10\x35\x12\x17\n\x13\x43\x61ntSeeLandLocation\x10\x36\x12!\n\x1d\x43\x61ntLandTooCloseToCreepSource\x10\x37\x12\x1f\n\x1b\x43\x61ntLandTooCloseToResources\x10\x38\x12\x1b\n\x17\x43\x61ntLandTooFarFromWater\x10\x39\x12!\n\x1d\x43\x61ntLandTooFarFromCreepSource\x10:\x12&\n\"CantLandTooFarFromBuildPowerSource\x10;\x12&\n\"CantLandTooFarFromTrainPowerSource\x10<\x12\x1a\n\x16\x43\x61ntLandOnDenseTerrain\x10=\x12\x1b\n\x17\x41\x64\x64OnTooFarFromBuilding\x10>\x12\x1a\n\x16MustBuildRefineryFirst\x10?\x12\x1f\n\x1b\x42uildingIsUnderConstruction\x10@\x12\x13\n\x0f\x43\x61ntFindDropOff\x10\x41\x12\x1d\n\x19\x43\x61ntLoadOtherPlayersUnits\x10\x42\x12\x1b\n\x17NotEnoughRoomToLoadUnit\x10\x43\x12\x18\n\x14\x43\x61ntUnloadUnitsThere\x10\x44\x12\x18\n\x14\x43\x61ntWarpInUnitsThere\x10\x45\x12\x19\n\x15\x43\x61ntLoadImmobileUnits\x10\x46\x12\x1d\n\x19\x43\x61ntRechargeImmobileUnits\x10G\x12&\n\"CantRechargeUnderConstructionUnits\x10H\x12\x14\n\x10\x43\x61ntLoadThatUnit\x10I\x12\x13\n\x0fNoCargoToUnload\x10J\x12\x19\n\x15LoadAllNoTargetsFound\x10K\x12\x14\n\x10NotWhileOccupied\x10L\x12\x19\n\x15\x43\x61ntAttackWithoutAmmo\x10M\x12\x17\n\x13\x43\x61ntHoldAnyMoreAmmo\x10N\x12\x1a\n\x16TechRequirementsNotMet\x10O\x12\x19\n\x15MustLockdownUnitFirst\x10P\x12\x12\n\x0eMustTargetUnit\x10Q\x12\x17\n\x13MustTargetInventory\x10R\x12\x19\n\x15MustTargetVisibleUnit\x10S\x12\x1d\n\x19MustTargetVisibleLocation\x10T\x12\x1e\n\x1aMustTargetWalkableLocation\x10U\x12\x1a\n\x16MustTargetPawnableUnit\x10V\x12\x1a\n\x16YouCantControlThatUnit\x10W\x12\"\n\x1eYouCantIssueCommandsToThatUnit\x10X\x12\x17\n\x13MustTargetResources\x10Y\x12\x16\n\x12RequiresHealTarget\x10Z\x12\x18\n\x14RequiresRepairTarget\x10[\x12\x11\n\rNoItemsToDrop\x10\\\x12\x18\n\x14\x43\x61ntHoldAnyMoreItems\x10]\x12\x10\n\x0c\x43\x61ntHoldThat\x10^\x12\x18\n\x14TargetHasNoInventory\x10_\x12\x14\n\x10\x43\x61ntDropThisItem\x10`\x12\x14\n\x10\x43\x61ntMoveThisItem\x10\x61\x12\x14\n\x10\x43\x61ntPawnThisUnit\x10\x62\x12\x14\n\x10MustTargetCaster\x10\x63\x12\x14\n\x10\x43\x61ntTargetCaster\x10\x64\x12\x13\n\x0fMustTargetOuter\x10\x65\x12\x13\n\x0f\x43\x61ntTargetOuter\x10\x66\x12\x1a\n\x16MustTargetYourOwnUnits\x10g\x12\x1a\n\x16\x43\x61ntTargetYourOwnUnits\x10h\x12\x1b\n\x17MustTargetFriendlyUnits\x10i\x12\x1b\n\x17\x43\x61ntTargetFriendlyUnits\x10j\x12\x1a\n\x16MustTargetNeutralUnits\x10k\x12\x1a\n\x16\x43\x61ntTargetNeutralUnits\x10l\x12\x18\n\x14MustTargetEnemyUnits\x10m\x12\x18\n\x14\x43\x61ntTargetEnemyUnits\x10n\x12\x16\n\x12MustTargetAirUnits\x10o\x12\x16\n\x12\x43\x61ntTargetAirUnits\x10p\x12\x19\n\x15MustTargetGroundUnits\x10q\x12\x19\n\x15\x43\x61ntTargetGroundUnits\x10r\x12\x18\n\x14MustTargetStructures\x10s\x12\x18\n\x14\x43\x61ntTargetStructures\x10t\x12\x18\n\x14MustTargetLightUnits\x10u\x12\x18\n\x14\x43\x61ntTargetLightUnits\x10v\x12\x1a\n\x16MustTargetArmoredUnits\x10w\x12\x1a\n\x16\x43\x61ntTargetArmoredUnits\x10x\x12\x1d\n\x19MustTargetBiologicalUnits\x10y\x12\x1d\n\x19\x43\x61ntTargetBiologicalUnits\x10z\x12\x19\n\x15MustTargetHeroicUnits\x10{\x12\x19\n\x15\x43\x61ntTargetHeroicUnits\x10|\x12\x1a\n\x16MustTargetRoboticUnits\x10}\x12\x1a\n\x16\x43\x61ntTargetRoboticUnits\x10~\x12\x1d\n\x19MustTargetMechanicalUnits\x10\x7f\x12\x1e\n\x19\x43\x61ntTargetMechanicalUnits\x10\x80\x01\x12\x1b\n\x16MustTargetPsionicUnits\x10\x81\x01\x12\x1b\n\x16\x43\x61ntTargetPsionicUnits\x10\x82\x01\x12\x1b\n\x16MustTargetMassiveUnits\x10\x83\x01\x12\x1b\n\x16\x43\x61ntTargetMassiveUnits\x10\x84\x01\x12\x16\n\x11MustTargetMissile\x10\x85\x01\x12\x16\n\x11\x43\x61ntTargetMissile\x10\x86\x01\x12\x1a\n\x15MustTargetWorkerUnits\x10\x87\x01\x12\x1a\n\x15\x43\x61ntTargetWorkerUnits\x10\x88\x01\x12!\n\x1cMustTargetEnergyCapableUnits\x10\x89\x01\x12!\n\x1c\x43\x61ntTargetEnergyCapableUnits\x10\x8a\x01\x12!\n\x1cMustTargetShieldCapableUnits\x10\x8b\x01\x12!\n\x1c\x43\x61ntTargetShieldCapableUnits\x10\x8c\x01\x12\x15\n\x10MustTargetFlyers\x10\x8d\x01\x12\x15\n\x10\x43\x61ntTargetFlyers\x10\x8e\x01\x12\x1a\n\x15MustTargetBuriedUnits\x10\x8f\x01\x12\x1a\n\x15\x43\x61ntTargetBuriedUnits\x10\x90\x01\x12\x1b\n\x16MustTargetCloakedUnits\x10\x91\x01\x12\x1b\n\x16\x43\x61ntTargetCloakedUnits\x10\x92\x01\x12\"\n\x1dMustTargetUnitsInAStasisField\x10\x93\x01\x12\"\n\x1d\x43\x61ntTargetUnitsInAStasisField\x10\x94\x01\x12%\n MustTargetUnderConstructionUnits\x10\x95\x01\x12%\n CantTargetUnderConstructionUnits\x10\x96\x01\x12\x18\n\x13MustTargetDeadUnits\x10\x97\x01\x12\x18\n\x13\x43\x61ntTargetDeadUnits\x10\x98\x01\x12\x1d\n\x18MustTargetRevivableUnits\x10\x99\x01\x12\x1d\n\x18\x43\x61ntTargetRevivableUnits\x10\x9a\x01\x12\x1a\n\x15MustTargetHiddenUnits\x10\x9b\x01\x12\x1a\n\x15\x43\x61ntTargetHiddenUnits\x10\x9c\x01\x12\"\n\x1d\x43\x61ntRechargeOtherPlayersUnits\x10\x9d\x01\x12\x1d\n\x18MustTargetHallucinations\x10\x9e\x01\x12\x1d\n\x18\x43\x61ntTargetHallucinations\x10\x9f\x01\x12 \n\x1bMustTargetInvulnerableUnits\x10\xa0\x01\x12 \n\x1b\x43\x61ntTargetInvulnerableUnits\x10\xa1\x01\x12\x1c\n\x17MustTargetDetectedUnits\x10\xa2\x01\x12\x1c\n\x17\x43\x61ntTargetDetectedUnits\x10\xa3\x01\x12\x1d\n\x18\x43\x61ntTargetUnitWithEnergy\x10\xa4\x01\x12\x1e\n\x19\x43\x61ntTargetUnitWithShields\x10\xa5\x01\x12!\n\x1cMustTargetUncommandableUnits\x10\xa6\x01\x12!\n\x1c\x43\x61ntTargetUncommandableUnits\x10\xa7\x01\x12!\n\x1cMustTargetPreventDefeatUnits\x10\xa8\x01\x12!\n\x1c\x43\x61ntTargetPreventDefeatUnits\x10\xa9\x01\x12!\n\x1cMustTargetPreventRevealUnits\x10\xaa\x01\x12!\n\x1c\x43\x61ntTargetPreventRevealUnits\x10\xab\x01\x12\x1b\n\x16MustTargetPassiveUnits\x10\xac\x01\x12\x1b\n\x16\x43\x61ntTargetPassiveUnits\x10\xad\x01\x12\x1b\n\x16MustTargetStunnedUnits\x10\xae\x01\x12\x1b\n\x16\x43\x61ntTargetStunnedUnits\x10\xaf\x01\x12\x1c\n\x17MustTargetSummonedUnits\x10\xb0\x01\x12\x1c\n\x17\x43\x61ntTargetSummonedUnits\x10\xb1\x01\x12\x14\n\x0fMustTargetUser1\x10\xb2\x01\x12\x14\n\x0f\x43\x61ntTargetUser1\x10\xb3\x01\x12\x1f\n\x1aMustTargetUnstoppableUnits\x10\xb4\x01\x12\x1f\n\x1a\x43\x61ntTargetUnstoppableUnits\x10\xb5\x01\x12\x1d\n\x18MustTargetResistantUnits\x10\xb6\x01\x12\x1d\n\x18\x43\x61ntTargetResistantUnits\x10\xb7\x01\x12\x19\n\x14MustTargetDazedUnits\x10\xb8\x01\x12\x19\n\x14\x43\x61ntTargetDazedUnits\x10\xb9\x01\x12\x11\n\x0c\x43\x61ntLockdown\x10\xba\x01\x12\x14\n\x0f\x43\x61ntMindControl\x10\xbb\x01\x12\x1c\n\x17MustTargetDestructibles\x10\xbc\x01\x12\x1c\n\x17\x43\x61ntTargetDestructibles\x10\xbd\x01\x12\x14\n\x0fMustTargetItems\x10\xbe\x01\x12\x14\n\x0f\x43\x61ntTargetItems\x10\xbf\x01\x12\x18\n\x13NoCalldownAvailable\x10\xc0\x01\x12\x15\n\x10WaypointListFull\x10\xc1\x01\x12\x13\n\x0eMustTargetRace\x10\xc2\x01\x12\x13\n\x0e\x43\x61ntTargetRace\x10\xc3\x01\x12\x1b\n\x16MustTargetSimilarUnits\x10\xc4\x01\x12\x1b\n\x16\x43\x61ntTargetSimilarUnits\x10\xc5\x01\x12\x1a\n\x15\x43\x61ntFindEnoughTargets\x10\xc6\x01\x12\x19\n\x14\x41lreadySpawningLarva\x10\xc7\x01\x12!\n\x1c\x43\x61ntTargetExhaustedResources\x10\xc8\x01\x12\x13\n\x0e\x43\x61ntUseMinimap\x10\xc9\x01\x12\x15\n\x10\x43\x61ntUseInfoPanel\x10\xca\x01\x12\x15\n\x10OrderQueueIsFull\x10\xcb\x01\x12\x1c\n\x17\x43\x61ntHarvestThatResource\x10\xcc\x01\x12\x1a\n\x15HarvestersNotRequired\x10\xcd\x01\x12\x14\n\x0f\x41lreadyTargeted\x10\xce\x01\x12\x1e\n\x19\x43\x61ntAttackWeaponsDisabled\x10\xcf\x01\x12\x17\n\x12\x43ouldntReachTarget\x10\xd0\x01\x12\x17\n\x12TargetIsOutOfRange\x10\xd1\x01\x12\x15\n\x10TargetIsTooClose\x10\xd2\x01\x12\x15\n\x10TargetIsOutOfArc\x10\xd3\x01\x12\x1d\n\x18\x43\x61ntFindTeleportLocation\x10\xd4\x01\x12\x15\n\x10InvalidItemClass\x10\xd5\x01\x12\x18\n\x13\x43\x61ntFindCancelOrder\x10\xd6\x01"
8
+ descriptor_data = "\n\x1asc2ai/protocol/error.proto\x12\x03\x41pi*\xc3-\n\x0c\x41\x63tionResult\x12\x19\n\x15\x45numActionResultUnset\x10\x00\x12\x0b\n\x07Success\x10\x01\x12\x10\n\x0cNotSupported\x10\x02\x12\t\n\x05\x45rror\x10\x03\x12\x16\n\x12\x43\x61ntQueueThatOrder\x10\x04\x12\t\n\x05Retry\x10\x05\x12\x0c\n\x08\x43ooldown\x10\x06\x12\x0f\n\x0bQueueIsFull\x10\x07\x12\x14\n\x10RallyQueueIsFull\x10\x08\x12\x15\n\x11NotEnoughMinerals\x10\t\x12\x14\n\x10NotEnoughVespene\x10\n\x12\x16\n\x12NotEnoughTerrazine\x10\x0b\x12\x13\n\x0fNotEnoughCustom\x10\x0c\x12\x11\n\rNotEnoughFood\x10\r\x12\x17\n\x13\x46oodUsageImpossible\x10\x0e\x12\x11\n\rNotEnoughLife\x10\x0f\x12\x14\n\x10NotEnoughShields\x10\x10\x12\x13\n\x0fNotEnoughEnergy\x10\x11\x12\x12\n\x0eLifeSuppressed\x10\x12\x12\x15\n\x11ShieldsSuppressed\x10\x13\x12\x14\n\x10\x45nergySuppressed\x10\x14\x12\x14\n\x10NotEnoughCharges\x10\x15\x12\x16\n\x12\x43\x61ntAddMoreCharges\x10\x16\x12\x13\n\x0fTooMuchMinerals\x10\x17\x12\x12\n\x0eTooMuchVespene\x10\x18\x12\x14\n\x10TooMuchTerrazine\x10\x19\x12\x11\n\rTooMuchCustom\x10\x1a\x12\x0f\n\x0bTooMuchFood\x10\x1b\x12\x0f\n\x0bTooMuchLife\x10\x1c\x12\x12\n\x0eTooMuchShields\x10\x1d\x12\x11\n\rTooMuchEnergy\x10\x1e\x12\x1a\n\x16MustTargetUnitWithLife\x10\x1f\x12\x1d\n\x19MustTargetUnitWithShields\x10 \x12\x1c\n\x18MustTargetUnitWithEnergy\x10!\x12\r\n\tCantTrade\x10\"\x12\r\n\tCantSpend\x10#\x12\x16\n\x12\x43\x61ntTargetThatUnit\x10$\x12\x17\n\x13\x43ouldntAllocateUnit\x10%\x12\x10\n\x0cUnitCantMove\x10&\x12\x1e\n\x1aTransportIsHoldingPosition\x10\'\x12\x1f\n\x1b\x42uildTechRequirementsNotMet\x10(\x12\x1d\n\x19\x43\x61ntFindPlacementLocation\x10)\x12\x13\n\x0f\x43\x61ntBuildOnThat\x10*\x12\x1e\n\x1a\x43\x61ntBuildTooCloseToDropOff\x10+\x12\x1c\n\x18\x43\x61ntBuildLocationInvalid\x10,\x12\x18\n\x14\x43\x61ntSeeBuildLocation\x10-\x12\"\n\x1e\x43\x61ntBuildTooCloseToCreepSource\x10.\x12 \n\x1c\x43\x61ntBuildTooCloseToResources\x10/\x12\x1c\n\x18\x43\x61ntBuildTooFarFromWater\x10\x30\x12\"\n\x1e\x43\x61ntBuildTooFarFromCreepSource\x10\x31\x12\'\n#CantBuildTooFarFromBuildPowerSource\x10\x32\x12\x1b\n\x17\x43\x61ntBuildOnDenseTerrain\x10\x33\x12\'\n#CantTrainTooFarFromTrainPowerSource\x10\x34\x12\x1b\n\x17\x43\x61ntLandLocationInvalid\x10\x35\x12\x17\n\x13\x43\x61ntSeeLandLocation\x10\x36\x12!\n\x1d\x43\x61ntLandTooCloseToCreepSource\x10\x37\x12\x1f\n\x1b\x43\x61ntLandTooCloseToResources\x10\x38\x12\x1b\n\x17\x43\x61ntLandTooFarFromWater\x10\x39\x12!\n\x1d\x43\x61ntLandTooFarFromCreepSource\x10:\x12&\n\"CantLandTooFarFromBuildPowerSource\x10;\x12&\n\"CantLandTooFarFromTrainPowerSource\x10<\x12\x1a\n\x16\x43\x61ntLandOnDenseTerrain\x10=\x12\x1b\n\x17\x41\x64\x64OnTooFarFromBuilding\x10>\x12\x1a\n\x16MustBuildRefineryFirst\x10?\x12\x1f\n\x1b\x42uildingIsUnderConstruction\x10@\x12\x13\n\x0f\x43\x61ntFindDropOff\x10\x41\x12\x1d\n\x19\x43\x61ntLoadOtherPlayersUnits\x10\x42\x12\x1b\n\x17NotEnoughRoomToLoadUnit\x10\x43\x12\x18\n\x14\x43\x61ntUnloadUnitsThere\x10\x44\x12\x18\n\x14\x43\x61ntWarpInUnitsThere\x10\x45\x12\x19\n\x15\x43\x61ntLoadImmobileUnits\x10\x46\x12\x1d\n\x19\x43\x61ntRechargeImmobileUnits\x10G\x12&\n\"CantRechargeUnderConstructionUnits\x10H\x12\x14\n\x10\x43\x61ntLoadThatUnit\x10I\x12\x13\n\x0fNoCargoToUnload\x10J\x12\x19\n\x15LoadAllNoTargetsFound\x10K\x12\x14\n\x10NotWhileOccupied\x10L\x12\x19\n\x15\x43\x61ntAttackWithoutAmmo\x10M\x12\x17\n\x13\x43\x61ntHoldAnyMoreAmmo\x10N\x12\x1a\n\x16TechRequirementsNotMet\x10O\x12\x19\n\x15MustLockdownUnitFirst\x10P\x12\x12\n\x0eMustTargetUnit\x10Q\x12\x17\n\x13MustTargetInventory\x10R\x12\x19\n\x15MustTargetVisibleUnit\x10S\x12\x1d\n\x19MustTargetVisibleLocation\x10T\x12\x1e\n\x1aMustTargetWalkableLocation\x10U\x12\x1a\n\x16MustTargetPawnableUnit\x10V\x12\x1a\n\x16YouCantControlThatUnit\x10W\x12\"\n\x1eYouCantIssueCommandsToThatUnit\x10X\x12\x17\n\x13MustTargetResources\x10Y\x12\x16\n\x12RequiresHealTarget\x10Z\x12\x18\n\x14RequiresRepairTarget\x10[\x12\x11\n\rNoItemsToDrop\x10\\\x12\x18\n\x14\x43\x61ntHoldAnyMoreItems\x10]\x12\x10\n\x0c\x43\x61ntHoldThat\x10^\x12\x18\n\x14TargetHasNoInventory\x10_\x12\x14\n\x10\x43\x61ntDropThisItem\x10`\x12\x14\n\x10\x43\x61ntMoveThisItem\x10\x61\x12\x14\n\x10\x43\x61ntPawnThisUnit\x10\x62\x12\x14\n\x10MustTargetCaster\x10\x63\x12\x14\n\x10\x43\x61ntTargetCaster\x10\x64\x12\x13\n\x0fMustTargetOuter\x10\x65\x12\x13\n\x0f\x43\x61ntTargetOuter\x10\x66\x12\x1a\n\x16MustTargetYourOwnUnits\x10g\x12\x1a\n\x16\x43\x61ntTargetYourOwnUnits\x10h\x12\x1b\n\x17MustTargetFriendlyUnits\x10i\x12\x1b\n\x17\x43\x61ntTargetFriendlyUnits\x10j\x12\x1a\n\x16MustTargetNeutralUnits\x10k\x12\x1a\n\x16\x43\x61ntTargetNeutralUnits\x10l\x12\x18\n\x14MustTargetEnemyUnits\x10m\x12\x18\n\x14\x43\x61ntTargetEnemyUnits\x10n\x12\x16\n\x12MustTargetAirUnits\x10o\x12\x16\n\x12\x43\x61ntTargetAirUnits\x10p\x12\x19\n\x15MustTargetGroundUnits\x10q\x12\x19\n\x15\x43\x61ntTargetGroundUnits\x10r\x12\x18\n\x14MustTargetStructures\x10s\x12\x18\n\x14\x43\x61ntTargetStructures\x10t\x12\x18\n\x14MustTargetLightUnits\x10u\x12\x18\n\x14\x43\x61ntTargetLightUnits\x10v\x12\x1a\n\x16MustTargetArmoredUnits\x10w\x12\x1a\n\x16\x43\x61ntTargetArmoredUnits\x10x\x12\x1d\n\x19MustTargetBiologicalUnits\x10y\x12\x1d\n\x19\x43\x61ntTargetBiologicalUnits\x10z\x12\x19\n\x15MustTargetHeroicUnits\x10{\x12\x19\n\x15\x43\x61ntTargetHeroicUnits\x10|\x12\x1a\n\x16MustTargetRoboticUnits\x10}\x12\x1a\n\x16\x43\x61ntTargetRoboticUnits\x10~\x12\x1d\n\x19MustTargetMechanicalUnits\x10\x7f\x12\x1e\n\x19\x43\x61ntTargetMechanicalUnits\x10\x80\x01\x12\x1b\n\x16MustTargetPsionicUnits\x10\x81\x01\x12\x1b\n\x16\x43\x61ntTargetPsionicUnits\x10\x82\x01\x12\x1b\n\x16MustTargetMassiveUnits\x10\x83\x01\x12\x1b\n\x16\x43\x61ntTargetMassiveUnits\x10\x84\x01\x12\x16\n\x11MustTargetMissile\x10\x85\x01\x12\x16\n\x11\x43\x61ntTargetMissile\x10\x86\x01\x12\x1a\n\x15MustTargetWorkerUnits\x10\x87\x01\x12\x1a\n\x15\x43\x61ntTargetWorkerUnits\x10\x88\x01\x12!\n\x1cMustTargetEnergyCapableUnits\x10\x89\x01\x12!\n\x1c\x43\x61ntTargetEnergyCapableUnits\x10\x8a\x01\x12!\n\x1cMustTargetShieldCapableUnits\x10\x8b\x01\x12!\n\x1c\x43\x61ntTargetShieldCapableUnits\x10\x8c\x01\x12\x15\n\x10MustTargetFlyers\x10\x8d\x01\x12\x15\n\x10\x43\x61ntTargetFlyers\x10\x8e\x01\x12\x1a\n\x15MustTargetBuriedUnits\x10\x8f\x01\x12\x1a\n\x15\x43\x61ntTargetBuriedUnits\x10\x90\x01\x12\x1b\n\x16MustTargetCloakedUnits\x10\x91\x01\x12\x1b\n\x16\x43\x61ntTargetCloakedUnits\x10\x92\x01\x12\"\n\x1dMustTargetUnitsInAStasisField\x10\x93\x01\x12\"\n\x1d\x43\x61ntTargetUnitsInAStasisField\x10\x94\x01\x12%\n MustTargetUnderConstructionUnits\x10\x95\x01\x12%\n CantTargetUnderConstructionUnits\x10\x96\x01\x12\x18\n\x13MustTargetDeadUnits\x10\x97\x01\x12\x18\n\x13\x43\x61ntTargetDeadUnits\x10\x98\x01\x12\x1d\n\x18MustTargetRevivableUnits\x10\x99\x01\x12\x1d\n\x18\x43\x61ntTargetRevivableUnits\x10\x9a\x01\x12\x1a\n\x15MustTargetHiddenUnits\x10\x9b\x01\x12\x1a\n\x15\x43\x61ntTargetHiddenUnits\x10\x9c\x01\x12\"\n\x1d\x43\x61ntRechargeOtherPlayersUnits\x10\x9d\x01\x12\x1d\n\x18MustTargetHallucinations\x10\x9e\x01\x12\x1d\n\x18\x43\x61ntTargetHallucinations\x10\x9f\x01\x12 \n\x1bMustTargetInvulnerableUnits\x10\xa0\x01\x12 \n\x1b\x43\x61ntTargetInvulnerableUnits\x10\xa1\x01\x12\x1c\n\x17MustTargetDetectedUnits\x10\xa2\x01\x12\x1c\n\x17\x43\x61ntTargetDetectedUnits\x10\xa3\x01\x12\x1d\n\x18\x43\x61ntTargetUnitWithEnergy\x10\xa4\x01\x12\x1e\n\x19\x43\x61ntTargetUnitWithShields\x10\xa5\x01\x12!\n\x1cMustTargetUncommandableUnits\x10\xa6\x01\x12!\n\x1c\x43\x61ntTargetUncommandableUnits\x10\xa7\x01\x12!\n\x1cMustTargetPreventDefeatUnits\x10\xa8\x01\x12!\n\x1c\x43\x61ntTargetPreventDefeatUnits\x10\xa9\x01\x12!\n\x1cMustTargetPreventRevealUnits\x10\xaa\x01\x12!\n\x1c\x43\x61ntTargetPreventRevealUnits\x10\xab\x01\x12\x1b\n\x16MustTargetPassiveUnits\x10\xac\x01\x12\x1b\n\x16\x43\x61ntTargetPassiveUnits\x10\xad\x01\x12\x1b\n\x16MustTargetStunnedUnits\x10\xae\x01\x12\x1b\n\x16\x43\x61ntTargetStunnedUnits\x10\xaf\x01\x12\x1c\n\x17MustTargetSummonedUnits\x10\xb0\x01\x12\x1c\n\x17\x43\x61ntTargetSummonedUnits\x10\xb1\x01\x12\x14\n\x0fMustTargetUser1\x10\xb2\x01\x12\x14\n\x0f\x43\x61ntTargetUser1\x10\xb3\x01\x12\x1f\n\x1aMustTargetUnstoppableUnits\x10\xb4\x01\x12\x1f\n\x1a\x43\x61ntTargetUnstoppableUnits\x10\xb5\x01\x12\x1d\n\x18MustTargetResistantUnits\x10\xb6\x01\x12\x1d\n\x18\x43\x61ntTargetResistantUnits\x10\xb7\x01\x12\x19\n\x14MustTargetDazedUnits\x10\xb8\x01\x12\x19\n\x14\x43\x61ntTargetDazedUnits\x10\xb9\x01\x12\x11\n\x0c\x43\x61ntLockdown\x10\xba\x01\x12\x14\n\x0f\x43\x61ntMindControl\x10\xbb\x01\x12\x1c\n\x17MustTargetDestructibles\x10\xbc\x01\x12\x1c\n\x17\x43\x61ntTargetDestructibles\x10\xbd\x01\x12\x14\n\x0fMustTargetItems\x10\xbe\x01\x12\x14\n\x0f\x43\x61ntTargetItems\x10\xbf\x01\x12\x18\n\x13NoCalldownAvailable\x10\xc0\x01\x12\x15\n\x10WaypointListFull\x10\xc1\x01\x12\x13\n\x0eMustTargetRace\x10\xc2\x01\x12\x13\n\x0e\x43\x61ntTargetRace\x10\xc3\x01\x12\x1b\n\x16MustTargetSimilarUnits\x10\xc4\x01\x12\x1b\n\x16\x43\x61ntTargetSimilarUnits\x10\xc5\x01\x12\x1a\n\x15\x43\x61ntFindEnoughTargets\x10\xc6\x01\x12\x19\n\x14\x41lreadySpawningLarva\x10\xc7\x01\x12!\n\x1c\x43\x61ntTargetExhaustedResources\x10\xc8\x01\x12\x13\n\x0e\x43\x61ntUseMinimap\x10\xc9\x01\x12\x15\n\x10\x43\x61ntUseInfoPanel\x10\xca\x01\x12\x15\n\x10OrderQueueIsFull\x10\xcb\x01\x12\x1c\n\x17\x43\x61ntHarvestThatResource\x10\xcc\x01\x12\x1a\n\x15HarvestersNotRequired\x10\xcd\x01\x12\x14\n\x0f\x41lreadyTargeted\x10\xce\x01\x12\x1e\n\x19\x43\x61ntAttackWeaponsDisabled\x10\xcf\x01\x12\x17\n\x12\x43ouldntReachTarget\x10\xd0\x01\x12\x17\n\x12TargetIsOutOfRange\x10\xd1\x01\x12\x15\n\x10TargetIsTooClose\x10\xd2\x01\x12\x15\n\x10TargetIsOutOfArc\x10\xd3\x01\x12\x1d\n\x18\x43\x61ntFindTeleportLocation\x10\xd4\x01\x12\x15\n\x10InvalidItemClass\x10\xd5\x01\x12\x18\n\x13\x43\x61ntFindCancelOrder\x10\xd6\x01\x62\x06proto3"
9
9
 
10
10
  pool = Google::Protobuf::DescriptorPool.generated_pool
11
-
12
- begin
13
- pool.add_serialized_file(descriptor_data)
14
- rescue TypeError
15
- # Compatibility code: will be removed in the next major version.
16
- require 'google/protobuf/descriptor_pb'
17
- parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
18
- parsed.clear_dependency
19
- serialized = parsed.class.encode(parsed)
20
- file = pool.add_serialized_file(serialized)
21
- warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
22
- imports = [
23
- ]
24
- imports.each do |type_name, expected_filename|
25
- import_file = pool.lookup(type_name).file_descriptor
26
- if import_file.name != expected_filename
27
- warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
28
- end
29
- end
30
- warn "Each proto file must use a consistent fully-qualified name."
31
- warn "This will become an error in the next major version."
32
- end
11
+ pool.add_serialized_file(descriptor_data)
33
12
 
34
13
  module Api
35
14
  ActionResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.ActionResult").enummodule
@@ -10,6 +10,10 @@ module Api
10
10
  self.class == other.class && hash == other.hash
11
11
  end
12
12
 
13
+ # Returns self
14
+ # @return [self]
15
+ def to_p2d = self
16
+
13
17
  # Create a new 3d Point, by adding a y axis.
14
18
  # @return [Api::Point]
15
19
  def to_3d(z: 0)
@@ -105,7 +105,7 @@ module Sc2
105
105
  # @return [Sc2::Position] self
106
106
  def random_offset!(offset)
107
107
  offset = offset.to_f
108
- range = rand(-offset..offset)
108
+ range = -offset..offset
109
109
  offset!(rand(range), rand(range))
110
110
  self
111
111
  end
@@ -42,6 +42,26 @@ module Api
42
42
  @bot.previous.all_units[tag]
43
43
  end
44
44
 
45
+ # Returns whether a unit is alive or not
46
+ # Useful for cached Unit objects to see if they are still relevant.
47
+ # @return [Boolean] alive
48
+ def is_alive?
49
+ !@bot.all_units[tag].nil?
50
+ end
51
+
52
+ # Replaces protobuf values with latest from game
53
+ # @return [Boolean] true if refreshed or false unchanged
54
+ def refresh!
55
+ new_unit = @bot.all_units[tag]
56
+ return false if new_unit.nil? || new_unit == self
57
+
58
+ self.class.descriptor.entries.each do |entry|
59
+ send(:"#{entry.name}=", new_unit.send(:method_missing, entry.name.to_sym))
60
+ end
61
+
62
+ true
63
+ end
64
+
45
65
  # Attributes ---
46
66
 
47
67
  # Returns static [Api::UnitTypeData] for a unit
@@ -375,7 +395,13 @@ module Api
375
395
  )
376
396
  end
377
397
 
378
- # Checks whether the unit has
398
+ # Checks whether a unit is gathering or returning gathered minerals/gas
399
+ # @return [Boolean] true if either gathering or returning, false otherwise
400
+ def is_harvesting?
401
+ is_performing_ability?([Api::AbilityId::HARVEST_GATHER, Api::AbilityId::HARVEST_RETURN])
402
+ end
403
+
404
+ # Checks whether a unit's first order for ability
379
405
  # @param ability_ids [Integer, Array<Integer>] accepts one or an array of Api::AbilityId
380
406
  def is_performing_ability?(ability_ids)
381
407
  return false if orders.empty?
@@ -538,7 +564,8 @@ module Api
538
564
  when Api::UnitTypeId::STARPORT, Api::UnitTypeId::STARPORTFLYING
539
565
  Api::UnitTypeId::STARPORTREACTOR
540
566
  end
541
- build(unit_type_id: unit_type_id, queue_command:)
567
+
568
+ build(unit_type_id: unit_type_id, target: target_for_addon_placement, queue_command:)
542
569
  end
543
570
 
544
571
  # For Terran builds a tech lab add-on on the current structure
@@ -552,7 +579,21 @@ module Api
552
579
  when Api::UnitTypeId::STARPORT, Api::UnitTypeId::STARPORTFLYING
553
580
  Api::UnitTypeId::STARPORTTECHLAB
554
581
  end
555
- build(unit_type_id: unit_type_id, queue_command:)
582
+ build(unit_type_id: unit_type_id, target: target_for_addon_placement, queue_command:)
583
+ end
584
+
585
+ private def target_for_addon_placement
586
+ # Attempts to auto-move left if not placeable
587
+ x = pos.x.floor
588
+ y = pos.y.floor
589
+ if !bot.geo.placeable?(x: x + 3, y: y - 1) ||
590
+ !bot.geo.placeable?(x: x + 3, y: y) ||
591
+ !bot.geo.placeable?(x: x + 2, y: y - 1) ||
592
+ !bot.geo.placeable?(x: x + 2, y: y)
593
+ return Api::Point2D[pos.x - 1, pos.y]
594
+ end
595
+
596
+ nil
556
597
  end
557
598
 
558
599
  # PROTOSS Convenience functions ---
@@ -15,6 +15,14 @@ module Api
15
15
  # i.e. 250G Broodlord = 100G Corruptor + 150G Morph
16
16
  # @return [Integer] sum of vespene gas costs
17
17
  attr_accessor :vespene_cost_sum
18
+
19
+ # @!attribute placement_length
20
+ # Length of tiles to build.
21
+ # i.e. 5 for any Base-type (5x5)
22
+ # i.e. 3 for Barracks (3x3)
23
+ # i.e. 2 for Supply Depot (2x2)
24
+ # @return [Integer] side-length for placement
25
+ attr_accessor :placement_length
18
26
  end
19
27
  end
20
28
  Api::UnitTypeData.include Api::UnitTypeDataExtension