sc2ai 0.0.7 → 0.0.8
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.
- checksums.yaml +4 -4
- data/lib/sc2ai/player/units.rb +0 -34
- data/lib/sc2ai/player.rb +4 -4
- data/lib/sc2ai/version.rb +1 -1
- data/sig/sc2ai.rbs +4 -21
- metadata +22 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1251b565054a0ef77f14f73faf35e150b2e5b08a7228f9c47b505956fbe8007
|
4
|
+
data.tar.gz: e27ea67a1cbb29d00e421dff8d387ab6fe7dd570e3f3fd5ba755e45ede5e58f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d81392a64774357b5755d5a6298d2b672fdead2f60019aa7a63ee5993974f40e3100178f1ff3f43519bdbe53227340318d22cf58d6f49455cbf7dbf8e6c23eca
|
7
|
+
data.tar.gz: 17ffe6116796d81b8b301aa45e23546399e9d4e3e09608751e5064ce1ac6eea06cb6f8e8229a174dd03adc37fd08c580b468d5a2b5ff670a79eac366475c7767
|
data/lib/sc2ai/player/units.rb
CHANGED
@@ -141,31 +141,6 @@ module Sc2
|
|
141
141
|
|
142
142
|
# Event-driven unit groups ---
|
143
143
|
|
144
|
-
# @!attribute event_units_created
|
145
|
-
# Units created since last frame (visible only, units not structures)
|
146
|
-
# Read this on_step. Alternative to callback on_unit_created
|
147
|
-
# @note Morphed units should watch #event_units_type_changed
|
148
|
-
# @return [Sc2::UnitGroup] group of created units
|
149
|
-
attr_accessor :event_units_created
|
150
|
-
|
151
|
-
# Units which had their type changed since last frame
|
152
|
-
# Read this on_step. Alternative to callback on_unit_type_changed
|
153
|
-
# @!attribute event_units_type_changed
|
154
|
-
# @return [Sc2::UnitGroup] group effected
|
155
|
-
attr_accessor :event_units_type_changed
|
156
|
-
|
157
|
-
# Structures seen since last frame with building not completed (< 1.0)
|
158
|
-
# Read this on_step. Alternative to callback on_structure_started
|
159
|
-
# @!attribute event_structures_started
|
160
|
-
# @return [Sc2::UnitGroup] a group of structures started
|
161
|
-
attr_accessor :event_structures_started
|
162
|
-
|
163
|
-
# Structures which had their building completed (==1.0) since last frame
|
164
|
-
# Read this on_step. Alternative to callback on_structure_completed
|
165
|
-
# @!attribute event_structures_completed
|
166
|
-
# @return [Sc2::UnitGroup] a group of structures started
|
167
|
-
attr_accessor :event_structures_completed
|
168
|
-
|
169
144
|
# Units and Structures which had their health/shields reduced since last frame
|
170
145
|
# Read this on_step. Alternative to callback on_unit_damaged
|
171
146
|
# @!attribute event_units_damaged
|
@@ -330,10 +305,6 @@ module Sc2
|
|
330
305
|
@_all_seen_unit_tags ||= Set.new(@units.tags)
|
331
306
|
|
332
307
|
# Event-driven unit groups as callback alternatives
|
333
|
-
@event_units_created = UnitGroup.new
|
334
|
-
@event_structures_started = UnitGroup.new
|
335
|
-
@event_structures_completed = UnitGroup.new
|
336
|
-
@event_units_type_changed = UnitGroup.new
|
337
308
|
@event_units_damaged = UnitGroup.new
|
338
309
|
# @event_units_buffed = UnitGroup.new
|
339
310
|
|
@@ -428,14 +399,11 @@ module Sc2
|
|
428
399
|
|
429
400
|
if unit.is_structure?
|
430
401
|
if unit.build_progress < 1
|
431
|
-
@event_structures_started.add(unit)
|
432
402
|
on_structure_started(unit)
|
433
403
|
else
|
434
|
-
@event_structures_completed.add(unit)
|
435
404
|
on_structure_completed(unit)
|
436
405
|
end
|
437
406
|
else
|
438
|
-
@event_units_created.add(unit)
|
439
407
|
on_unit_created(unit)
|
440
408
|
end
|
441
409
|
@_all_seen_unit_tags.add(unit.tag)
|
@@ -446,7 +414,6 @@ module Sc2
|
|
446
414
|
def issue_existing_unit_callbacks(unit, previous_unit)
|
447
415
|
# Check if a unit type has changed
|
448
416
|
if unit.unit_type != previous_unit.unit_type
|
449
|
-
@event_units_type_changed.add(unit)
|
450
417
|
on_unit_type_changed(unit, previous_unit.unit_type)
|
451
418
|
end
|
452
419
|
|
@@ -459,7 +426,6 @@ module Sc2
|
|
459
426
|
|
460
427
|
if unit.is_structure?
|
461
428
|
if previous_unit.build_progress < 1 && unit.build_progress == 1
|
462
|
-
@event_structures_completed.add(unit)
|
463
429
|
on_structure_completed(unit)
|
464
430
|
end
|
465
431
|
end
|
data/lib/sc2ai/player.rb
CHANGED
@@ -329,7 +329,7 @@ module Sc2
|
|
329
329
|
|
330
330
|
# Callback for unit destroyed. Tags might be found in `previous.all_units`
|
331
331
|
# This excludes unknown objects, like projectiles and only shows things the API has "seen" as a unit
|
332
|
-
# Override to use in your bot class or use Player.
|
332
|
+
# Override to use in your bot class or use Player.
|
333
333
|
# @param unit [Api::Unit]
|
334
334
|
# @see Sc2::Player::Units#units_destroyed
|
335
335
|
def on_unit_destroyed(unit)
|
@@ -343,7 +343,7 @@ module Sc2
|
|
343
343
|
|
344
344
|
# Callback for unit type changing.
|
345
345
|
# To detect certain unit creations, you should use this method to watch morphs.
|
346
|
-
# Override to use in your bot class or use Player.
|
346
|
+
# Override to use in your bot class or use Player.
|
347
347
|
# @param unit [Api::Unit]
|
348
348
|
# @param previous_unit_type_id [Integer] Api::UnitTypeId::*
|
349
349
|
def on_unit_type_changed(unit, previous_unit_type_id)
|
@@ -356,13 +356,13 @@ module Sc2
|
|
356
356
|
end
|
357
357
|
|
358
358
|
# Callback for structure building is completed
|
359
|
-
# Override to use in your bot class or use Player.
|
359
|
+
# Override to use in your bot class or use Player.
|
360
360
|
# @param unit [Api::Unit]
|
361
361
|
def on_structure_completed(unit)
|
362
362
|
end
|
363
363
|
|
364
364
|
# Callback for unit (Unit/Structure) taking damage
|
365
|
-
# Override to use in your bot class or use Player.
|
365
|
+
# Override to use in your bot class or use Player.
|
366
366
|
# @param unit [Api::Unit]
|
367
367
|
# @param amount [Integer] of damage
|
368
368
|
def on_unit_damaged(unit, amount)
|
data/lib/sc2ai/version.rb
CHANGED
data/sig/sc2ai.rbs
CHANGED
@@ -627,7 +627,7 @@ module Sc2
|
|
627
627
|
# sord omit - no YARD return type given, using untyped
|
628
628
|
# Callback for unit destroyed. Tags might be found in `previous.all_units`
|
629
629
|
# This excludes unknown objects, like projectiles and only shows things the API has "seen" as a unit
|
630
|
-
# Override to use in your bot class or use Player.
|
630
|
+
# Override to use in your bot class or use Player.
|
631
631
|
#
|
632
632
|
# _@param_ `unit`
|
633
633
|
#
|
@@ -644,7 +644,7 @@ module Sc2
|
|
644
644
|
# sord omit - no YARD return type given, using untyped
|
645
645
|
# Callback for unit type changing.
|
646
646
|
# To detect certain unit creations, you should use this method to watch morphs.
|
647
|
-
# Override to use in your bot class or use Player.
|
647
|
+
# Override to use in your bot class or use Player.
|
648
648
|
#
|
649
649
|
# _@param_ `unit`
|
650
650
|
#
|
@@ -660,14 +660,14 @@ module Sc2
|
|
660
660
|
|
661
661
|
# sord omit - no YARD return type given, using untyped
|
662
662
|
# Callback for structure building is completed
|
663
|
-
# Override to use in your bot class or use Player.
|
663
|
+
# Override to use in your bot class or use Player.
|
664
664
|
#
|
665
665
|
# _@param_ `unit`
|
666
666
|
def on_structure_completed: (Api::Unit unit) -> untyped
|
667
667
|
|
668
668
|
# sord omit - no YARD return type given, using untyped
|
669
669
|
# Callback for unit (Unit/Structure) taking damage
|
670
|
-
# Override to use in your bot class or use Player.
|
670
|
+
# Override to use in your bot class or use Player.
|
671
671
|
#
|
672
672
|
# _@param_ `unit`
|
673
673
|
#
|
@@ -1652,23 +1652,6 @@ module Sc2
|
|
1652
1652
|
# Privately keep track of all seen Unit tags (excl structures) in order to detect new created units
|
1653
1653
|
attr_accessor all_seen_unit_tags: untyped
|
1654
1654
|
|
1655
|
-
# sord omit - no YARD type given for :event_units_created, using untyped
|
1656
|
-
# Units created since last frame (visible only, units not structures)
|
1657
|
-
# Read this on_step. Alternative to callback on_unit_created
|
1658
|
-
#
|
1659
|
-
# _@note_ — Morphed units should watch #event_units_type_changed
|
1660
|
-
# @return [Sc2::UnitGroup] group of created units
|
1661
|
-
attr_accessor event_units_created: untyped
|
1662
|
-
|
1663
|
-
# _@return_ — group effected
|
1664
|
-
attr_accessor event_units_type_changed: Sc2::UnitGroup
|
1665
|
-
|
1666
|
-
# _@return_ — a group of structures started
|
1667
|
-
attr_accessor event_structures_started: Sc2::UnitGroup
|
1668
|
-
|
1669
|
-
# _@return_ — a group of structures started
|
1670
|
-
attr_accessor event_structures_completed: Sc2::UnitGroup
|
1671
|
-
|
1672
1655
|
# _@return_ — group of Units and Structures effected
|
1673
1656
|
attr_accessor event_units_damaged: Sc2::UnitGroup
|
1674
1657
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sc2ai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dyson Returns
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -262,6 +262,20 @@ dependencies:
|
|
262
262
|
- - "~>"
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: '1.17'
|
265
|
+
- !ruby/object:Gem::Dependency
|
266
|
+
name: conventional-changelog
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
268
|
+
requirements:
|
269
|
+
- - ">="
|
270
|
+
- !ruby/object:Gem::Version
|
271
|
+
version: '0'
|
272
|
+
type: :development
|
273
|
+
prerelease: false
|
274
|
+
version_requirements: !ruby/object:Gem::Requirement
|
275
|
+
requirements:
|
276
|
+
- - ">="
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: '0'
|
265
279
|
description: This is a Ruby interface to STARCRAFT® II. Write your own AI using an
|
266
280
|
easy interface and compete against others.
|
267
281
|
email:
|
@@ -368,13 +382,14 @@ files:
|
|
368
382
|
- lib/templates/new/my_bot.rb.tt
|
369
383
|
- lib/templates/new/run_example_match.rb.tt
|
370
384
|
- sig/sc2ai.rbs
|
371
|
-
homepage: https://
|
385
|
+
homepage: https://sc2ai.pages.dev/
|
372
386
|
licenses:
|
373
387
|
- MIT
|
374
388
|
- Nonstandard
|
375
389
|
metadata:
|
376
|
-
homepage_uri: https://
|
377
|
-
|
390
|
+
homepage_uri: https://sc2ai.pages.dev/
|
391
|
+
source_code_uri: https://gitlab.com/dysonreturns/sc2ai
|
392
|
+
changelog_uri: https://sc2ai.pages.dev/file.CHANGELOG
|
378
393
|
post_install_message:
|
379
394
|
rdoc_options: []
|
380
395
|
require_paths:
|
@@ -383,14 +398,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
383
398
|
requirements:
|
384
399
|
- - ">="
|
385
400
|
- !ruby/object:Gem::Version
|
386
|
-
version: 3.2.
|
401
|
+
version: 3.2.5
|
387
402
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
388
403
|
requirements:
|
389
404
|
- - ">="
|
390
405
|
- !ruby/object:Gem::Version
|
391
406
|
version: '0'
|
392
407
|
requirements: []
|
393
|
-
rubygems_version: 3.5.
|
408
|
+
rubygems_version: 3.5.14
|
394
409
|
signing_key:
|
395
410
|
specification_version: 4
|
396
411
|
summary: STARCRAFT® II AI API
|