Method: Api::ActionRawUnitCommand#initialize

Defined in:
lib/sc2ai/protocol/raw_pb.rb

#initialize(ability_id: nil, target_world_space_pos: nil, target_unit_tag: nil, unit_tags: [], queue_command: nil) ⇒ ActionRawUnitCommand

END writers for oneof fields



16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
# File 'lib/sc2ai/protocol/raw_pb.rb', line 16954

def initialize(
  ability_id: nil,
  target_world_space_pos: nil,
  target_unit_tag: nil,
  unit_tags: [],
  queue_command: nil
)
  @_bitmask = 0

  @target = nil # oneof field
  if ability_id == nil
    @ability_id = 0
  else
    unless -2_147_483_648 <= ability_id && ability_id <= 2_147_483_647
      raise RangeError,
            "Value (#{ability_id}) for field ability_id is out of bounds (-2147483648..2147483647)"
    end
    @_bitmask |= 0x0000000000000001
    @ability_id = ability_id
  end

  if target_world_space_pos == nil
    @target_world_space_pos = nil
  else
    @target = :target_world_space_pos
    @target_world_space_pos = target_world_space_pos
  end

  if target_unit_tag == nil
    @target_unit_tag = 0
  else
    unless 0 <= target_unit_tag &&
             target_unit_tag <= 18_446_744_073_709_551_615
      raise RangeError,
            "Value (#{target_unit_tag}) for field target_unit_tag is out of bounds (0..18446744073709551615)"
    end

    @target = :target_unit_tag
    @target_unit_tag = target_unit_tag
  end

  unit_tags.each do |v|
    unless 0 <= v && v <= 18_446_744_073_709_551_615
      raise RangeError,
            "Value (#{v}}) for field unit_tags is out of bounds (0..18446744073709551615)"
    end
  end
  @unit_tags = unit_tags

  if queue_command == nil
    @queue_command = false
  else
    @_bitmask |= 0x0000000000000002
    @queue_command = queue_command
  end
end