Page 1 of 1

Large main buildings

Posted: Tue Jul 24, 2018 4:59 am
by EneCtin
Is there a way to make the buildings larger? Most are the size of a tent or a truck. Some I'd like to see larger (refinery, steam engine, factories, etc) plus cost a fair amount to build.

I guess the object image needs to be redone, and some other file for size and connector locations.
Do you know where I could look&read (I might go tweak-ing) and if I can replace/rewrite things and the game accept those new data?

Re: Large main buildings

Posted: Tue Jul 24, 2018 5:08 am
by darkfrei
Yes, you can make new sizes of buildings. But you must be pretty good with data.raw prototypes.
Some example with vanilla bildings scaling: https://mods.factorio.com/mod/NuclearScale
Another example with pipes connection https://mods.factorio.com/mod/AllMyFluids

Re: Large main buildings

Posted: Tue Jul 24, 2018 12:09 pm
by eradicator
I wrote half of a generic scaling function for entities the other day. Works on base images and shadows so far, but not working visualizations, pipes etc. Maybe it'll help you understand how this works. Or maybe it's too complicated :p.

Code: Select all

function sprite .scale (layers,factor,working_visualization)
  --scales all sub-nodes of an entity's sprite tree
  --works recursively so input can be any level above what you want to change
  --i.e. can also be the entity prototype itself, or just entity.animations etc
  working_visualization = working_visualization or false
  local this = layers
  for name,layer in pairs(layers) do
    if (type(layer) == 'table') then
      if layer.filename then
        --scale
        layers[name].scale = (layers[name].scale or 1) * factor
        
        --shift factor
        local shift_factor
        if layer.draw_as_shadow or working_visualization then
          shift_factor = factor
        else
          shift_factor = factor/2
          end
        --apply shift
        layers[name].shift = erlib.point.multiply(layers[name].shift or {0,0},shift_factor) --almost correct :/
        end
      sprite .scale(layer,factor,working_visualization) --recursion through subtables
      end
    end
  end