Method: Api::DebugCreateUnit#initialize

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

#initialize(unit_type: nil, owner: nil, pos: nil, quantity: nil) ⇒ DebugCreateUnit

END writers for optional fields



7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
# File 'lib/sc2ai/protocol/debug_pb.rb', line 7688

def initialize(unit_type: nil, owner: nil, pos: nil, quantity: nil)
  @_bitmask = 0

  if unit_type == nil
    @unit_type = 0
  else
    unless 0 <= unit_type && unit_type <= 4_294_967_295
      raise RangeError,
            "Value (#{unit_type}) for field unit_type is out of bounds (0..4294967295)"
    end
    @_bitmask |= 0x0000000000000001
    @unit_type = unit_type
  end

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

  if pos == nil
    @pos = nil
  else
    @_bitmask |= 0x0000000000000004
    @pos = pos
  end

  if quantity == nil
    @quantity = 0
  else
    unless 0 <= quantity && quantity <= 4_294_967_295
      raise RangeError,
            "Value (#{quantity}) for field quantity is out of bounds (0..4294967295)"
    end
    @_bitmask |= 0x0000000000000008
    @quantity = quantity
  end
end