class DiamondLang::Helpers::CommandBlock

Constants

Types

Public Class Methods

new(command,type=:chain,data_value=0,auto=true,conditional=false) click to toggle source
Calls superclass method DiamondLang::Helpers::Block::new
# File lib/diamond-lang/helpers/command_block.rb, line 15
def initialize(command,type=:chain,data_value=0,auto=true,conditional=false)
  super Types[type], data_value, {
    Command: command.to_s,
    auto: auto
  }
  conditional = conditional
end

Public Instance Methods

conditional=(val) click to toggle source
# File lib/diamond-lang/helpers/command_block.rb, line 28
def conditional=(val)
  if conditional? && !val
    @data_value -= 8
  elsif !@conditional && val
    @data_value += 8
  end
end
conditional?(data_value=@data_value) click to toggle source
# File lib/diamond-lang/helpers/command_block.rb, line 35
def conditional?(data_value=@data_value)
  data_value >= 8
end
direction() click to toggle source
# File lib/diamond-lang/helpers/command_block.rb, line 9
def direction
  conditional? ? @data_value - 8 : @data_value
end
direction=(val) click to toggle source
# File lib/diamond-lang/helpers/command_block.rb, line 12
def direction=(val)
  @data_value = val + (conditional? ? 8 : 0)
end
type() click to toggle source
# File lib/diamond-lang/helpers/command_block.rb, line 25
def type
  Types.reverse[@id]
end
type=(type) click to toggle source
# File lib/diamond-lang/helpers/command_block.rb, line 22
def type=(type)
  @id = Types[type]
end