class TyranoDsl::ExportGame::ElementsWriters::VariablesWriter

Write a variable

Public Instance Methods

write(world) click to toggle source

@param [TyranoDsl::Elements::World] world @return [Array]

# File lib/tyrano_dsl/export_game/elements_writers/variables_writer.rb, line 12
def write(world)
  log {'Writing variables'}
  variable_content = {}
  world.variables.values.each do |variable|
    variable_content[variable.target_name] = {
        :val => variable.initial_value,
        :kind => 'f'
    }
  end
  [
      TyranoDsl::ExportGame::FileActions::JsonPatch.new(
          'builder_config.json',
          ['map_var'],
          variable_content
      )
  ]
end