sc2ai 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/data/sc2ai/protocol/common.proto +6 -6
  3. data/data/sc2ai/protocol/data.proto +23 -20
  4. data/data/sc2ai/protocol/debug.proto +25 -21
  5. data/data/sc2ai/protocol/error.proto +217 -215
  6. data/data/sc2ai/protocol/query.proto +1 -1
  7. data/data/sc2ai/protocol/raw.proto +16 -14
  8. data/data/sc2ai/protocol/sc2api.proto +108 -94
  9. data/data/sc2ai/protocol/score.proto +4 -3
  10. data/data/sc2ai/protocol/spatial.proto +6 -5
  11. data/data/sc2ai/protocol/ui.proto +17 -14
  12. data/exe/sc2ai +0 -3
  13. data/lib/docker_build/Dockerfile.ruby +4 -2
  14. data/lib/sc2ai/api/ability_id.rb +6 -1
  15. data/lib/sc2ai/api/data.rb +18 -3
  16. data/lib/sc2ai/api/tech_tree.rb +1 -1
  17. data/lib/sc2ai/api/tech_tree_data.rb +54 -3
  18. data/lib/sc2ai/connection/connection_listener.rb +3 -3
  19. data/lib/sc2ai/connection/requests.rb +31 -35
  20. data/lib/sc2ai/connection/status_listener.rb +1 -1
  21. data/lib/sc2ai/connection.rb +1 -2
  22. data/lib/sc2ai/local_play/client.rb +2 -2
  23. data/lib/sc2ai/local_play/match.rb +7 -2
  24. data/lib/sc2ai/overrides/async/process/child.rb +1 -1
  25. data/lib/sc2ai/paths.rb +12 -2
  26. data/lib/sc2ai/player/actions.rb +54 -35
  27. data/lib/sc2ai/player/debug.rb +54 -20
  28. data/lib/sc2ai/player/game_state.rb +11 -18
  29. data/lib/sc2ai/player/geo.rb +56 -66
  30. data/lib/sc2ai/player/units.rb +41 -17
  31. data/lib/sc2ai/player.rb +104 -47
  32. data/lib/sc2ai/ports.rb +1 -2
  33. data/lib/sc2ai/protocol/_meta_documentation.rb +270 -25
  34. data/lib/sc2ai/protocol/common_pb.rb +3862 -33
  35. data/lib/sc2ai/protocol/data_pb.rb +9106 -36
  36. data/lib/sc2ai/protocol/debug_pb.rb +10434 -45
  37. data/lib/sc2ai/protocol/error_pb.rb +1084 -29
  38. data/lib/sc2ai/protocol/extensions/ability_remapable.rb +9 -9
  39. data/lib/sc2ai/protocol/extensions/action.rb +60 -0
  40. data/lib/sc2ai/protocol/extensions/point_2_d.rb +9 -0
  41. data/lib/sc2ai/protocol/extensions/position.rb +11 -36
  42. data/lib/sc2ai/protocol/extensions/power_source.rb +3 -0
  43. data/lib/sc2ai/protocol/extensions/unit.rb +61 -36
  44. data/lib/sc2ai/protocol/extensions/unit_type_data.rb +8 -0
  45. data/lib/sc2ai/protocol/query_pb.rb +5022 -36
  46. data/lib/sc2ai/protocol/raw_pb.rb +18347 -46
  47. data/lib/sc2ai/protocol/sc2api_pb.rb +48424 -126
  48. data/lib/sc2ai/protocol/score_pb.rb +5965 -30
  49. data/lib/sc2ai/protocol/spatial_pb.rb +11941 -37
  50. data/lib/sc2ai/protocol/ui_pb.rb +12924 -46
  51. data/lib/sc2ai/unit_group/action_ext.rb +0 -2
  52. data/lib/sc2ai/unit_group/filter_ext.rb +24 -8
  53. data/lib/sc2ai/unit_group/geo_ext.rb +0 -2
  54. data/lib/sc2ai/unit_group.rb +1 -1
  55. data/lib/sc2ai/version.rb +2 -3
  56. data/lib/sc2ai.rb +10 -11
  57. data/lib/templates/ladderzip/bin/ladder.tt +0 -3
  58. data/lib/templates/new/.ladderignore +15 -5
  59. data/lib/templates/new/api/common.proto +6 -6
  60. data/lib/templates/new/api/data.proto +23 -20
  61. data/lib/templates/new/api/debug.proto +25 -21
  62. data/lib/templates/new/api/error.proto +217 -215
  63. data/lib/templates/new/api/query.proto +1 -1
  64. data/lib/templates/new/api/raw.proto +16 -14
  65. data/lib/templates/new/api/sc2api.proto +108 -94
  66. data/lib/templates/new/api/score.proto +4 -3
  67. data/lib/templates/new/api/spatial.proto +6 -5
  68. data/lib/templates/new/api/ui.proto +17 -14
  69. data/lib/templates/new/boot.rb.tt +1 -1
  70. data/lib/templates/new/my_bot.rb.tt +2 -2
  71. data/lib/templates/new/run_example_match.rb.tt +2 -2
  72. data/sig/sc2ai.rbs +11072 -1651
  73. metadata +31 -26
  74. data/lib/sc2ai/overrides/kernel.rb +0 -33
  75. data/lib/sc2ai/protocol/extensions/unit_type.rb +0 -9
@@ -1,5 +1,5 @@
1
1
 
2
- syntax = "proto2";
2
+ syntax = "proto3";
3
3
 
4
4
  package Api;
5
5
 
@@ -59,25 +59,27 @@ message UnitOrder {
59
59
  }
60
60
 
61
61
  enum DisplayType {
62
- Visible = 1; // Fully visible
63
- Snapshot = 2; // Dimmed version of unit left behind after entering fog of war
64
- Hidden = 3; // Fully hidden
65
- Placeholder = 4; // Building that hasn't started construction.
62
+ ENUM_DISPLAY_TYPE_UNSET = 0; // PROTO3 COMPAT
63
+ VISIBLE = 1; // FULLY VISIBLE
64
+ SNAPSHOT = 2; // DIMMED VERSION OF UNIT LEFT BEHIND AFTER ENTERING FOG OF WAR
65
+ HIDDEN = 3; // FULLY HIDDEN
66
+ PLACEHOLDER = 4; // BUILDING THAT HASN'T STARTED CONSTRUCTION.
66
67
  }
67
68
 
68
69
  enum Alliance {
69
- Self = 1;
70
- Ally = 2;
71
- Neutral = 3;
72
- Enemy = 4;
70
+ ENUM_ALLIANCE_UNSET = 0; // PROTO3 COMPAT
71
+ SELF = 1;
72
+ ALLY = 2;
73
+ NEUTRAL = 3;
74
+ ENEMY = 4;
73
75
  }
74
76
 
75
77
  enum CloakState {
76
- CloakedUnknown = 0; // Under the fog, so unknown whether it's cloaked or not.
77
- Cloaked = 1;
78
- CloakedDetected = 2;
79
- NotCloaked = 3;
80
- CloakedAllied = 4;
78
+ CLOAKED_UNKNOWN = 0; // UNDER THE FOG, SO UNKNOWN WHETHER IT'S CLOAKED OR NOT.
79
+ CLOAKED = 1;
80
+ CLOAKED_DETECTED = 2;
81
+ NOT_CLOAKED = 3;
82
+ CLOAKED_ALLIED = 4;
81
83
  }
82
84
 
83
85
  message PassengerUnit {
@@ -1,5 +1,5 @@
1
1
 
2
- syntax = "proto2";
2
+ syntax = "proto3";
3
3
 
4
4
  package Api;
5
5
 
@@ -155,13 +155,14 @@ message Response {
155
155
  }
156
156
 
157
157
  enum Status {
158
- launched = 1; // Game has been launch and is not yet doing anything.
159
- init_game = 2; // Create game has been called, and the host is awaiting players.
160
- in_game = 3; // In a single or multiplayer game.
161
- in_replay = 4; // In a replay.
162
- ended = 5; // Game has ended, can still request game info, but ready for a new game.
163
- quit = 6; // Application is shutting down.
164
- unknown = 99; // Should not happen, but indicates an error if it occurs.
158
+ ENUM_STATUS_UNSET = 0; // PROTO3 COMPAT
159
+ LAUNCHED = 1; // GAME HAS BEEN LAUNCH AND IS NOT YET DOING ANYTHING.
160
+ INIT_GAME = 2; // CREATE GAME HAS BEEN CALLED, AND THE HOST IS AWAITING PLAYERS.
161
+ IN_GAME = 3; // IN A SINGLE OR MULTIPLAYER GAME.
162
+ IN_REPLAY = 4; // IN A REPLAY.
163
+ ENDED = 5; // GAME HAS ENDED, CAN STILL REQUEST GAME INFO, BUT READY FOR A NEW GAME.
164
+ QUIT = 6; // APPLICATION IS SHUTTING DOWN.
165
+ UNKNOWN = 99; // SHOULD NOT HAPPEN, BUT INDICATES AN ERROR IF IT OCCURS.
165
166
  }
166
167
 
167
168
  //-----------------------------------------------------------------------------
@@ -191,14 +192,15 @@ message LocalMap {
191
192
 
192
193
  message ResponseCreateGame {
193
194
  enum Error {
194
- MissingMap = 1;
195
- InvalidMapPath = 2;
196
- InvalidMapData = 3;
197
- InvalidMapName = 4;
198
- InvalidMapHandle = 5;
199
- MissingPlayerSetup = 6;
200
- InvalidPlayerSetup = 7;
201
- MultiplayerUnsupported = 8; // Multiplayer is not supported in the current build.
195
+ ENUM_RESPONSE_CREATE_GAME_ERROR_UNSET = 0; // PROTO3 COMPAT
196
+ MISSING_MAP = 1;
197
+ INVALID_MAP_PATH = 2;
198
+ INVALID_MAP_DATA = 3;
199
+ INVALID_MAP_NAME = 4;
200
+ INVALID_MAP_HANDLE = 5;
201
+ MISSING_PLAYER_SETUP = 6;
202
+ INVALID_PLAYER_SETUP = 7;
203
+ MULTIPLAYER_UNSUPPORTED = 8; // MULTIPLAYER IS NOT SUPPORTED IN THE CURRENT BUILD.
202
204
  }
203
205
  optional Error error = 1;
204
206
  optional string error_details = 2;
@@ -231,21 +233,22 @@ message ResponseJoinGame {
231
233
  optional uint32 player_id = 1;
232
234
 
233
235
  enum Error {
234
- MissingParticipation = 1;
235
- InvalidObservedPlayerId = 2;
236
- MissingOptions = 3;
237
- MissingPorts = 4;
238
- GameFull = 5;
239
- LaunchError = 6;
240
-
241
- // Multiplayer specific.
242
- FeatureUnsupported = 7; // Multiplayer is not supported in the current build for the requested features.
243
- NoSpaceForUser = 8;
244
- MapDoesNotExist = 9;
245
- CannotOpenMap = 10;
246
- ChecksumError = 11;
247
- NetworkError = 12;
248
- OtherError = 13;
236
+ ENUM_RESPONSE_JOIN_GAME_ERROR_UNSET = 0; // PROTO3 COMPAT
237
+ MISSING_PARTICIPATION = 1;
238
+ INVALID_OBSERVED_PLAYER_ID = 2;
239
+ MISSING_OPTIONS = 3;
240
+ MISSING_PORTS = 4;
241
+ GAME_FULL = 5;
242
+ LAUNCH_ERROR = 6;
243
+
244
+ // MULTIPLAYER SPECIFIC.
245
+ FEATURE_UNSUPPORTED = 7; // MULTIPLAYER IS NOT SUPPORTED IN THE CURRENT BUILD FOR THE REQUESTED FEATURES.
246
+ NO_SPACE_FOR_USER = 8;
247
+ MAP_DOES_NOT_EXIST = 9;
248
+ CANNOT_OPEN_MAP = 10;
249
+ CHECKSUM_ERROR = 11;
250
+ NETWORK_ERROR = 12;
251
+ OTHER_ERROR = 13;
249
252
  }
250
253
  optional Error error = 2;
251
254
  optional string error_details = 3;
@@ -258,7 +261,8 @@ message RequestRestartGame {
258
261
  // The defaultRestartGameLoops is specified to be (1<<18) by default
259
262
  message ResponseRestartGame {
260
263
  enum Error {
261
- LaunchError = 1;
264
+ ENUM_RESPONSE_RESTART_GAME_ERROR_UNSET = 0; // PROTO3 COMPAT
265
+ LAUNCH_ERROR = 1;
262
266
  }
263
267
  optional Error error = 1;
264
268
  optional string error_details = 2;
@@ -282,13 +286,14 @@ message RequestStartReplay {
282
286
 
283
287
  message ResponseStartReplay {
284
288
  enum Error {
285
- MissingReplay = 1;
286
- InvalidReplayPath = 2;
287
- InvalidReplayData = 3;
288
- InvalidMapData = 4;
289
- InvalidObservedPlayerId = 5;
290
- MissingOptions = 6;
291
- LaunchError = 7;
289
+ ENUM_RESPONSE_START_REPLAY_ERROR_UNSET = 0; // PROTO3 COMPAT
290
+ MISSING_REPLAY = 1;
291
+ INVALID_REPLAY_PATH = 2;
292
+ INVALID_REPLAY_DATA = 3;
293
+ INVALID_MAP_DATA = 4;
294
+ INVALID_OBSERVED_PLAYER_ID = 5;
295
+ MISSING_OPTIONS = 6;
296
+ LAUNCH_ERROR = 7;
292
297
  }
293
298
  optional Error error = 1;
294
299
  optional string error_details = 2;
@@ -301,7 +306,8 @@ message RequestMapCommand {
301
306
 
302
307
  message ResponseMapCommand {
303
308
  enum Error {
304
- NoTriggerError = 1;
309
+ ENUM_RESPONSE_MAP_COMMAND_ERROR_UNSET = 0; // PROTO3 COMPAT
310
+ NO_TRIGGER_ERROR = 1;
305
311
  }
306
312
  optional Error error = 1;
307
313
  optional string error_details = 2;
@@ -343,11 +349,11 @@ message RequestGameInfo {
343
349
 
344
350
  message ResponseGameInfo {
345
351
  optional string map_name = 1;
346
- repeated string mod_names = 6;
347
352
  optional string local_map_path = 2;
348
353
  repeated PlayerInfo player_info = 3;
349
354
  optional StartRaw start_raw = 4; // Populated if Raw interface is enabled.
350
355
  optional InterfaceOptions options = 5;
356
+ repeated string mod_names = 6;
351
357
  }
352
358
 
353
359
  //-----------------------------------------------------------------------------
@@ -453,11 +459,12 @@ message ResponseReplayInfo {
453
459
  optional uint32 base_build = 8;
454
460
 
455
461
  enum Error {
456
- MissingReplay = 1;
457
- InvalidReplayPath = 2;
458
- InvalidReplayData = 3;
459
- ParsingError = 4;
460
- DownloadError = 5;
462
+ ENUM_RESPONSE_REPLAY_INFO_ERROR_UNSET = 0; // PROTO3 COMPAT
463
+ MISSING_REPLAY = 1;
464
+ INVALID_REPLAY_PATH = 2;
465
+ INVALID_REPLAY_DATA = 3;
466
+ PARSING_ERROR = 4;
467
+ DOWNLOAD_ERROR = 5;
461
468
  }
462
469
  optional Error error = 9;
463
470
  optional string error_details = 10;
@@ -484,7 +491,8 @@ message RequestSaveMap {
484
491
 
485
492
  message ResponseSaveMap {
486
493
  enum Error {
487
- InvalidMapData = 1;
494
+ ENUM_RESPONSE_SAVE_MAP_ERROR_UNSET = 0; // PROTO3 COMPAT
495
+ INVALID_MAP_DATA = 1;
488
496
  }
489
497
  optional Error error = 1;
490
498
  }
@@ -514,31 +522,34 @@ message ResponseDebug {
514
522
  //
515
523
 
516
524
  enum Difficulty {
517
- VeryEasy = 1;
518
- Easy = 2;
519
- Medium = 3;
520
- MediumHard = 4;
521
- Hard = 5;
522
- Harder = 6;
523
- VeryHard = 7;
524
- CheatVision = 8;
525
- CheatMoney = 9;
526
- CheatInsane = 10;
525
+ ENUM_DIFFICULTY_UNSET = 0; // PROTO3 COMPAT
526
+ VERY_EASY = 1;
527
+ EASY = 2;
528
+ MEDIUM = 3;
529
+ MEDIUM_HARD = 4;
530
+ HARD = 5;
531
+ HARDER = 6;
532
+ VERY_HARD = 7;
533
+ CHEAT_VISION = 8;
534
+ CHEAT_MONEY = 9;
535
+ CHEAT_INSANE = 10;
527
536
  }
528
537
 
529
538
  enum PlayerType {
530
- Participant = 1;
531
- Computer = 2;
532
- Observer = 3;
539
+ ENUM_PLAYER_TYPE_UNSET = 0; // PROTO3 COMPAT
540
+ PARTICIPANT = 1;
541
+ COMPUTER = 2;
542
+ OBSERVER = 3;
533
543
  }
534
544
 
535
545
  enum AIBuild {
536
- RandomBuild = 1;
537
- Rush = 2;
538
- Timing = 3;
539
- Power = 4;
540
- Macro = 5;
541
- Air = 6;
546
+ ENUM_AI_BUILD_UNSET = 0; // PROTO3 COMPAT
547
+ RANDOM_BUILD = 1;
548
+ RUSH = 2;
549
+ TIMING = 3;
550
+ POWER = 4;
551
+ MACRO = 5;
552
+ AIR = 6;
542
553
  }
543
554
 
544
555
  message PlayerSetup {
@@ -638,8 +649,9 @@ message Action {
638
649
 
639
650
  message ActionChat {
640
651
  enum Channel {
641
- Broadcast = 1;
642
- Team = 2;
652
+ ENUM_CHANNEL_UNSET = 0; // PROTO3 COMPAT
653
+ BROADCAST = 1;
654
+ TEAM = 2;
643
655
  }
644
656
  optional Channel channel = 1;
645
657
  optional string message = 2;
@@ -681,35 +693,37 @@ message ActionObserverCameraFollowUnits {
681
693
  }
682
694
 
683
695
  enum Alert {
684
- AlertError = 3;
685
- AddOnComplete = 4;
686
- BuildingComplete = 5;
687
- BuildingUnderAttack = 6;
688
- LarvaHatched = 7;
689
- MergeComplete = 8;
690
- MineralsExhausted = 9;
691
- MorphComplete = 10;
692
- MothershipComplete = 11;
693
- MULEExpired = 12;
694
- NuclearLaunchDetected = 1;
695
- NukeComplete = 13;
696
- NydusWormDetected = 2;
697
- ResearchComplete = 14;
698
- TrainError = 15;
699
- TrainUnitComplete = 16;
700
- TrainWorkerComplete = 17;
701
- TransformationComplete = 18;
702
- UnitUnderAttack = 19;
703
- UpgradeComplete = 20;
704
- VespeneExhausted = 21;
705
- WarpInComplete = 22;
696
+ ENUM_ALERT_UNSET = 0; // PROTO3 COMPAT
697
+ ALERT_ERROR = 3;
698
+ ADD_ON_COMPLETE = 4;
699
+ BUILDING_COMPLETE = 5;
700
+ BUILDING_UNDER_ATTACK = 6;
701
+ LARVA_HATCHED = 7;
702
+ MERGE_COMPLETE = 8;
703
+ MINERALS_EXHAUSTED = 9;
704
+ MORPH_COMPLETE = 10;
705
+ MOTHERSHIP_COMPLETE = 11;
706
+ MULE_EXPIRED = 12;
707
+ NUCLEAR_LAUNCH_DETECTED = 1;
708
+ NUKE_COMPLETE = 13;
709
+ NYDUS_WORM_DETECTED = 2;
710
+ RESEARCH_COMPLETE = 14;
711
+ TRAIN_ERROR = 15;
712
+ TRAIN_UNIT_COMPLETE = 16;
713
+ TRAIN_WORKER_COMPLETE = 17;
714
+ TRANSFORMATION_COMPLETE = 18;
715
+ UNIT_UNDER_ATTACK = 19;
716
+ UPGRADE_COMPLETE = 20;
717
+ VESPENE_EXHAUSTED = 21;
718
+ WARP_IN_COMPLETE = 22;
706
719
  }
707
720
 
708
721
  enum Result {
709
- Victory = 1;
710
- Defeat = 2;
711
- Tie = 3;
712
- Undecided = 4;
722
+ ENUM_RESULT_UNSET = 0; // PROTO3 COMPAT
723
+ VICTORY = 1;
724
+ DEFEAT = 2;
725
+ TIE = 3;
726
+ UNDECIDED = 4;
713
727
  }
714
728
 
715
729
  message PlayerResult {
@@ -1,12 +1,13 @@
1
1
 
2
- syntax = "proto2";
2
+ syntax = "proto3";
3
3
 
4
4
  package Api;
5
5
 
6
6
  message Score {
7
7
  enum ScoreType {
8
- Curriculum = 1; // map generated score (from curriculum maps with special scoring)
9
- Melee = 2; // summation of in-progress and current units/buildings value + minerals + vespene
8
+ ENUM_SCORE_TYPE_UNSET = 0; // PROTO3 COMPAT
9
+ CURRICULUM = 1; // MAP GENERATED SCORE (FROM CURRICULUM MAPS WITH SPECIAL SCORING)
10
+ MELEE = 2; // SUMMATION OF IN_PROGRESS AND CURRENT UNITS/BUILDINGS VALUE + MINERALS + VESPENE
10
11
  }
11
12
 
12
13
  optional ScoreType score_type = 6;
@@ -1,5 +1,5 @@
1
1
 
2
- syntax = "proto2";
2
+ syntax = "proto3";
3
3
 
4
4
  package Api;
5
5
 
@@ -101,10 +101,11 @@ message ActionSpatialCameraMove {
101
101
  message ActionSpatialUnitSelectionPoint {
102
102
  optional PointI selection_screen_coord = 1;
103
103
  enum Type {
104
- Select = 1; // Equivalent to normal click. Changes selection to unit.
105
- Toggle = 2; // Equivalent to shift+click. Toggle selection of unit.
106
- AllType = 3; // Equivalent to control+click. Selects all units of a given type.
107
- AddAllType = 4; // Equivalent to shift+control+click. Selects all units of a given type.
104
+ ENUM_ACTION_SPATIAL_UNIT_SELECTION_POINT_TYPE_UNSET = 0; // PROTO3 COMPAT
105
+ SELECT = 1; // EQUIVALENT TO NORMAL CLICK. CHANGES SELECTION TO UNIT.
106
+ TOGGLE = 2; // EQUIVALENT TO SHIFT+CLICK. TOGGLE SELECTION OF UNIT.
107
+ ALL_TYPE = 3; // EQUIVALENT TO CONTROL+CLICK. SELECTS ALL UNITS OF A GIVEN TYPE.
108
+ ADD_ALL_TYPE = 4; // EQUIVALENT TO SHIFT+CONTROL+CLICK. SELECTS ALL UNITS OF A GIVEN TYPE.
108
109
  }
109
110
  optional Type type = 2;
110
111
  }
@@ -1,5 +1,5 @@
1
1
 
2
- syntax = "proto2";
2
+ syntax = "proto3";
3
3
 
4
4
  package Api;
5
5
 
@@ -90,11 +90,12 @@ message ActionUI {
90
90
 
91
91
  message ActionControlGroup {
92
92
  enum ControlGroupAction {
93
- Recall = 1; // Equivalent to number hotkey. Replaces current selection with control group.
94
- Set = 2; // Equivalent to Control + number hotkey. Sets control group to current selection.
95
- Append = 3; // Equivalent to Shift + number hotkey. Adds current selection into control group.
96
- SetAndSteal = 4; // Equivalent to Control + Alt + number hotkey. Sets control group to current selection. Units are removed from other control groups.
97
- AppendAndSteal = 5; // Equivalent to Shift + Alt + number hotkey. Adds current selection into control group. Units are removed from other control groups.
93
+ ENUM_CONTROL_GROUP_ACTION_UNSET = 0; // PROTO3 COMPAT
94
+ RECALL = 1; // EQUIVALENT TO NUMBER HOTKEY. REPLACES CURRENT SELECTION WITH CONTROL GROUP.
95
+ SET = 2; // EQUIVALENT TO CONTROL + NUMBER HOTKEY. SETS CONTROL GROUP TO CURRENT SELECTION.
96
+ APPEND = 3; // EQUIVALENT TO SHIFT + NUMBER HOTKEY. ADDS CURRENT SELECTION INTO CONTROL GROUP.
97
+ SET_AND_STEAL = 4; // EQUIVALENT TO CONTROL + ALT + NUMBER HOTKEY. SETS CONTROL GROUP TO CURRENT SELECTION. UNITS ARE REMOVED FROM OTHER CONTROL GROUPS.
98
+ APPEND_AND_STEAL = 5; // EQUIVALENT TO SHIFT + ALT + NUMBER HOTKEY. ADDS CURRENT SELECTION INTO CONTROL GROUP. UNITS ARE REMOVED FROM OTHER CONTROL GROUPS.
98
99
  }
99
100
  optional ControlGroupAction action = 1;
100
101
  optional uint32 control_group_index = 2;
@@ -113,20 +114,22 @@ message ActionSelectLarva {
113
114
 
114
115
  message ActionSelectIdleWorker {
115
116
  enum Type {
116
- Set = 1; // Equivalent to click with no modifiers. Replaces selection with single idle worker.
117
- Add = 2; // Equivalent to shift+click. Adds single idle worker to current selection.
118
- All = 3; // Equivalent to control+click. Selects all idle workers.
119
- AddAll = 4; // Equivalent to shift+control+click. Adds all idle workers to current selection.
117
+ ENUM_ACTION_SELECT_IDLE_WORKER_TYPE_UNSET = 0; // PROTO3 COMPAT
118
+ SET = 1; // EQUIVALENT TO CLICK WITH NO MODIFIERS. REPLACES SELECTION WITH SINGLE IDLE WORKER.
119
+ ADD = 2; // EQUIVALENT TO SHIFT+CLICK. ADDS SINGLE IDLE WORKER TO CURRENT SELECTION.
120
+ ALL = 3; // EQUIVALENT TO CONTROL+CLICK. SELECTS ALL IDLE WORKERS.
121
+ ADD_ALL = 4; // EQUIVALENT TO SHIFT+CONTROL+CLICK. ADDS ALL IDLE WORKERS TO CURRENT SELECTION.
120
122
  }
121
123
  optional Type type = 1;
122
124
  }
123
125
 
124
126
  message ActionMultiPanel {
125
127
  enum Type {
126
- SingleSelect = 1; // Click on icon
127
- DeselectUnit = 2; // Shift Click on icon
128
- SelectAllOfType = 3; // Control Click on icon.
129
- DeselectAllOfType = 4; // Control+Shift Click on icon.
128
+ ENUM_ACTION_MULTI_PANEL_TYPE_UNSET = 0; // PROTO3 COMPAT
129
+ SINGLE_SELECT = 1; // CLICK ON ICON
130
+ DESELECT_UNIT = 2; // SHIFT CLICK ON ICON
131
+ SELECT_ALL_OF_TYPE = 3; // CONTROL CLICK ON ICON.
132
+ DESELECT_ALL_OF_TYPE = 4; // CONTROL+SHIFT CLICK ON ICON.
130
133
  }
131
134
  optional Type type = 1;
132
135
  optional int32 unit_index = 2;
data/exe/sc2ai CHANGED
@@ -1,9 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- # require "pathname"
5
- # $LOAD_PATH.unshift(Pathname(File.dirname(__FILE__)).parent.join("lib").expand_path.to_s)
6
-
7
4
  require "sc2ai/cli/cli"
8
5
 
9
6
  # This got old quickly.
@@ -29,7 +29,7 @@ WORKDIR /root/ruby-builder
29
29
  RUN rm ruby-$RUBY_VERSION.tar.gz
30
30
  RUN rm -rf ./ruby-$RUBY_VERSION
31
31
  RUN rm yaml-0.2.5.tar.gz
32
- RUN rm -rf ./yaml-0.2.5
32
+ #RUN rm -rf ./yaml-0.2.5
33
33
 
34
34
  # Package config
35
35
  # numo-linalg needs openblas, copy to ruby-prefix/lib/ dir.
@@ -57,9 +57,11 @@ RUN gem install 'sc2ai'
57
57
 
58
58
  FROM debian:12-slim
59
59
  COPY --from=build /root/ruby-builder /root/ruby-builder
60
-
60
+ ENV AIARENA "true"
61
61
  RUN /root/ruby-builder/.ruby/bin/ruby --yjit -v
62
62
 
63
+ RUN /root/ruby-builder/.ruby/bin/bundle config set --global without test development
64
+
63
65
  RUN apt-get update
64
66
  RUN apt-get purge $(aptitude search '~i!~M!~prequired!~pimportant!~R~prequired!~R~R~prequired!~R~pimportant!~R~R~pimportant!busybox!grub!initramfs-tools' | awk '{print $2}') --assume-yes
65
67
  RUN apt-get purge aptitude --assume-yes
@@ -1305,7 +1305,12 @@ module Api
1305
1305
  # @param ability_id [Integer]
1306
1306
  # @return [Integer] either the current id if no remap or the remapped id
1307
1307
  def generic_id(ability_id)
1308
- remap_ids[ability_id] || ability_id
1308
+ @_non_remap_ids ||= {}
1309
+ if @_non_remap_ids[ability_id]
1310
+ @_non_remap_ids[ability_id]
1311
+ else
1312
+ remap_ids[ability_id] || (@_non_remap_ids[ability_id] = ability_id)
1313
+ end
1309
1314
  end
1310
1315
 
1311
1316
  private
@@ -46,7 +46,7 @@ module Sc2
46
46
 
47
47
  # Indexes ability data by ability id
48
48
  # @param abilities [Array<Api::AbilityData>]
49
- # @return [Hash<Integer, Api::AbilityData] indexed data
49
+ # @return [Hash<Integer, Api::AbilityData>] indexed data
50
50
  def abilities_from_proto(abilities)
51
51
  result = {}
52
52
 
@@ -75,7 +75,7 @@ module Sc2
75
75
 
76
76
  # Indexes upgrades data by id
77
77
  # @param upgrades [Array<Api::UpgradeData>]
78
- # @return [Hash<Integer, Api::UpgradeData] indexed data
78
+ # @return [Hash<Integer, Api::UpgradeData>] indexed data
79
79
  def upgrades_from_proto(upgrades)
80
80
  result = {}
81
81
  upgrades.each do |u|
@@ -107,6 +107,7 @@ module Sc2
107
107
  def override_unit_data
108
108
  correct_unit_type_costs
109
109
  correct_unit_type_sum
110
+ decorate_unit_type_placement_length
110
111
  end
111
112
 
112
113
  # @private
@@ -246,7 +247,7 @@ module Sc2
246
247
  unit_data.mineral_cost_sum += units[Api::UnitTypeId::GATEWAY].mineral_cost
247
248
  unit_data.vespene_cost_sum += units[Api::UnitTypeId::GATEWAY].vespene_cost
248
249
  else
249
- if unit_data.race == Api::Race::Zerg && unit_data.attributes.include?(:Structure)
250
+ if unit_data.race == Api::Race::ZERG && unit_data.attributes.include?(Api::Attribute::STRUCTURE)
250
251
  unit_data.mineral_cost_sum += units[Api::UnitTypeId::DRONE].mineral_cost
251
252
  end
252
253
  end
@@ -254,5 +255,19 @@ module Sc2
254
255
  unit_data
255
256
  end
256
257
  end
258
+
259
+ # @private
260
+ # Adds placement_length to units if applicable
261
+ private def decorate_unit_type_placement_length
262
+ @units.each_value do |unit_type_data|
263
+ unit_type_data.placement_length = 0
264
+ next unless unit_type_data.ability_id
265
+ next unless @abilities[unit_type_data.ability_id]
266
+ footprint_radius = @abilities[unit_type_data.ability_id].footprint_radius
267
+ if footprint_radius
268
+ unit_type_data.placement_length = (footprint_radius * 2.0).to_i
269
+ end
270
+ end
271
+ end
257
272
  end
258
273
  end
@@ -68,7 +68,7 @@ module Api
68
68
  # @param unit_type_id [Integer] the unit which you want to check
69
69
  # @return [Array<Integer>] returns an array of unit type ids as per Api:UnitTypeId
70
70
  def unit_created_from(unit_type_id:)
71
- unit_created_from_data[unit_type_id]
71
+ unit_created_from_data[unit_type_id] || []
72
72
  end
73
73
 
74
74
  # Returns what the unit type an upgrade is researched from