Exemplo n.º 1
0
 def apply_cell(self, mapblock, rx, ry, hf, tf):
     if hf < 0.5:
         mapblock.tiles[rx, ry] = select_tile(UOTiles.rock, tf)
         mapblock.heights[rx, ry] = self.height + int(hf * 16) + 12
     else:
         mapblock.tiles[rx, ry] = select_tile(UOTiles.snow, tf)
         mapblock.heights[rx, ry] = self.height + int(hf * 16) + 13
Exemplo n.º 2
0
 def apply_cell(self, mapblock, rx, ry, hf, tf):
     # grass or dirt or smth
     if hf < 0.8:
         mapblock.tiles[rx, ry] = select_tile(UOTiles.forest, tf)
         mapblock.heights[rx, ry] = self.height + int(hf * 8)
     else:
         mapblock.tiles[rx, ry] = select_tile(UOTiles.grass, tf)
         mapblock.heights[rx, ry] = self.height + int(hf * 8)
Exemplo n.º 3
0
 def apply_cell(self, mapblock, rx, ry, hf, tf):
     if hf < 0.1:
         mapblock.tiles[rx, ry] = select_tile(UOTiles.water_deep, tf)
         mapblock.heights[rx, ry] = self.height
     else:
         # water normal.
         mapblock.tiles[rx, ry] = select_tile(UOTiles.water, tf)
         mapblock.heights[rx, ry] = self.height
Exemplo n.º 4
0
 def execute(self, mapblock, rx, ry, layer=0):
     # execute the directives of this filter on cell rx ry.
     if layer == LAYER_MAP:
         # map layer
         mapblock.tiles_mod[rx, ry] = select_tile(self.directive, mapblock.tile_map[rx, ry])
         # if random_range: add random_range.
         # mapblock.heights[rx, ry] += numpy.randint(*self.random_range)
     elif layer == LAYER_STATIC:
         art = select_tile(self.directive, mapblock.tile_map[rx, ry])
         mapblock.add_static(rx, ry, art, z=mapblock.heights[rx, ry])
Exemplo n.º 5
0
 def apply_cell(self, mapblock, rx, ry, hf, tf):
     if hf < 0.15:
         # dirt
         mapblock.tiles[rx, ry] = select_tile(UOTiles.dirt, tf)
         mapblock.heights[rx, ry] = self.height + int(hf * 8) + 5
     elif hf < 0.3:
         # rocksides
         mapblock.tiles[rx, ry] = select_tile(UOTiles.dirt_stones, tf)
         mapblock.heights[rx, ry] = self.height + int(hf * 8) + 6
     else:
         mapblock.tiles[rx, ry] = select_tile(UOTiles.rock, tf)
         mapblock.heights[rx, ry] = self.height + int(hf * 16) + 12
Exemplo n.º 6
0
 def apply_cell(self, mapblock, rx, ry, hf, tf):
     if hf < 0.2:
         # water normal.
         mapblock.tiles[rx, ry] = select_tile(UOTiles.water, tf)
         mapblock.heights[rx, ry] = self.height
     elif hf < 0.4:
         # sandcoast
         mapblock.tiles[rx, ry] = select_tile(UOTiles.sand, tf)
         mapblock.heights[rx, ry] = self.height + int(hf * 8)
     else:
         # grass or dirt or smth
         mapblock.tiles[rx, ry] = select_tile(UOTiles.grass, tf)
         mapblock.heights[rx, ry] = self.height + int(hf * 8)
Exemplo n.º 7
0
 def place_items(self, group, mapblock, rx, ry):
     max_chance = 0x1000
     if group in self.items.keys():
         # 
         chance = self.items[group]['chance']
         item_combis = self.items[group]['items']
         if (mapblock.height_map[rx, ry] * max_chance) < chance:
             items = select_tile(item_combis, mapblock.tile_map[rx, ry])
             for item in items:
                 artid, z, color, rrx, rry = item
                 mapblock.add_static_overflow(rx + rrx, ry + rry,
                                              artid, z, color)
Exemplo n.º 8
0
 def apply_cell(self, mapblock, rx, ry, hf, tf):
     # convert our hf to a hex.
     # dragon_scripts.groups.get_group_list() # funny
     group = select_tile_linear([2, 5] + [ 0, ] * 15 + [1, 1, 0xa, 0xa], hf)
     alt = int(hf * 10) # grass + forest
     tileg = dragon_scripts.groups.get_by_groupalt(group, alt)
     if tileg is None:
         mapblock.tiles[rx, ry] = 0x2
         mapblock.heights[rx, ry] = 0
     else:
         mapblock.tiles[rx, ry] = select_tile(tileg.tiles, tf)
         mapblock.heights[rx, ry] = tileg.alt
Exemplo n.º 9
0
 def apply(self, mapblock, height_map=None, tile_map=None):
     if height_map is None:
         height_map = mapblock.height_map
     if tile_map is None:
         tile_map = mapblock.tile_map
     for x in xrange(8):
         for y in xrange(8):
             c, group = self.continent.quad_cell(self.bx, self.by, x, y)
             mapblock.tiles[x, y] = select_tile(group.tiles, tile_map[x, y])
             if group.options.get('flat', False):
                 mapblock.heights[x, y] = 0
             else:
                 mapblock.heights[x, y] = min(126, c + (int(height_map[x, y] * 8.8)))
Exemplo n.º 10
0
 def apply_cell(self, mapblock, rx, ry, hf, tf):
     # grass!
     mapblock.tiles[rx, ry] = select_tile(UOTiles.grass, tf)
     mapblock.heights[rx, ry] = int(hf * 6)
Exemplo n.º 11
0
 def execute_mapset(self, mapblock, rx, ry, tileset):
     if tileset:
         mapblock.tiles_mod[rx, ry] = select_tile(tileset, mapblock.tile_map[rx, ry])