Skip to content
Phil Wilson edited this page Feb 26, 2015 · 6 revisions

##General Guidelines for adding new block textures to Overviewer##

So far all changes to overviewer to make it work for BTW has been done in overviewer_core/textures.py. This is where the blocks are built.

Blocks a built and added differently based on how detailed the block is: ###Basic Blocks Basic blocks are ones that don't need anything special done with the textures and don't have data values. For these you just call the block function, set the blockid, the top_image and optionally the side_image. If no side_image is set it uses the same texture all around. Examples are light blocks and the Hibatchi:

#fcLightBlockOn
block(blockid=223, top_image="textures/blocks/fcBlockLightBlock_lit.png")

#FcBBQ aka Hibachi
block(blockid=224, top_image="textures/blocks/fcBlockHibachi_top.png", side_image="textures/blocks/fcBlockHibachi_side.png")

###Low Complexity Blocks These are the blocks that have data values attached, sometimes referred to as damage values. Most of the time this is due to rotation, but it is also used for blocks that share the same block ID. For these you have to define a function, I believe it is extending another class, but I don't know how python handles classes. in this you define your block ids, data values, transparency and other optional values first then define the function. The function handles selecting and or rotating the images that build the block based on the datavalue. Often I have combined many blocks into one for these if the method for putting them together is the same (stratified ores and blocks that can face 4 vs 6 directions are a couple of those). Examples of Low Complexity Blocks are storage blocks: block of dung, block of SFS, etc. and the pump:

#fcAestheticOpaque
@material(blockid=215, data=range(12), solid=True)
def fcAestheticOpaque(self, blockid, data):
  #Wicker
  if data==0:
    return self.build_block(self.load_image_texture("textures/blocks/fcBlockWicker.png"), self.load_image_texture("textures/blocks/fcBlockWicker.png"))
  # oldDung
  if data==1:
    return self.build_block(self.load_image_texture("textures/blocks/fcBlockDung.png"), self.load_image_texture("textures/blocks/fcBlockDung.png"))
  # oldSteel
  if data==2:
    return self.build_block(self.load_image_texture("textures/blocks/fcBlockSoulforgedSteel.png"), self.load_image_texture("textures/blocks/fcBlockSoulforgedSteel.png"))
  #Hellfire
  if data==3:
    return self.build_block(self.load_image_texture("textures/blocks/fcBlockConcentratedHellfire.png"), self.load_image_texture("textures/blocks/fcBlockConcentratedHellfire.png"))
  #Padding
  if data==4:
    return self.build_block(self.load_image_texture("textures/blocks/fcBlockPadding.png"), self.load_image_texture("textures/blocks/fcBlockPadding.png"))
  #Soap
  if data==5:
    return self.build_block(self.load_image_texture("textures/blocks/fcBlockSoap_top.png"), self.load_image_texture("textures/blocks/fcBlockSoap_top.png"))
  #etc.

# Pump
@material(blockid=[195],data=range(8), solid=True)
def fcFourDirectionalBlocks(self, blockid, data):
if blockid == 195:
  #Pump -- currently the only 4 direction block added
  top = self.load_image_texture("textures/blocks/fcBlockScrewPump_top.png")
  side = self.load_image_texture("textures/blocks/fcBlockScrewPump_side.png")
  front = self.load_image_texture("textures/blocks/fcBlockScrewPump_front.png")
  if data in (0,4):
    #Facing North
    img = self.build_block(top,side);
  elif data in (1,5):
    #Facing South
    img = self.build_full_block(top,None,None,side,front);
  elif data in (2,6):
    #Facing West
    img = self.build_full_block(top,None,None,front,side);
  elif data in (3,7):
    #Facing East
    img = self.build_block(top,side);
return img;    

###High Complexity Blocks I consider High Complexity blocks to be any that require some form of image cutting. These are similar to the low complexity blocks in having data values and are even more likely to have many block ids in one function as the block id usually only changes the texture where as the data value indicates the direction and is the same across multiple blocks (eg. siding). These are started the same way as the Low Complexity Blocks with function definitions but then you have to use crop to cut up the textures and then alpha_over to allow for transparency. I'm not going to provide example code here as these block as several lines. Search for #BTW Micro-blocks, #fcWoolSlab or #BTW Axels in textures.py

###Future Work So far all work has focused on getting the blocks in. Blocks like fences, glass pane type blocks (wicker), and anything that's bigger than a single block will probably take work in another file. Vanilla Fences and glass panes have to have information somewhere else that adds connection data based on it's neighbor. Windmills, water wheels and the like will require overlaying images over a much larger area than the system in textures.py is setup for (although I haven't tried).

If more comments are wanted in the code or something above is unclear please send a message, make an issue or suggest a merge.