本文整理汇总了Python中utils.Vec.max方法的典型用法代码示例。如果您正苦于以下问题:Python Vec.max方法的具体用法?Python Vec.max怎么用?Python Vec.max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.Vec
的用法示例。
在下文中一共展示了Vec.max方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: res_cutout_tile
# 需要导入模块: from utils import Vec [as 别名]
# 或者: from utils.Vec import max [as 别名]
def res_cutout_tile(inst, res):
"""Generate random quarter tiles, like in Destroyed or Retro maps.
- "MarkerItem" is the instance to look for.
- "TileSize" can be "2x2" or "4x4".
- rotateMax is the amount of degrees to rotate squarebeam models.
Materials:
- "squarebeams" is the squarebeams variant to use.
- "ceilingwalls" are the sides of the ceiling section.
- "floorbase" is the texture under floor sections.
- "tile_glue" is used on top of a thinner tile segment.
- "clip" is the player_clip texture used over floor segments.
(This allows customising the surfaceprop.)
- "Floor4x4Black", "Ceil2x2White" and other combinations can be used to
override the textures used.
"""
item = resolve_inst(res['markeritem'])
INST_LOCS = {} # Map targetnames -> surface loc
CEIL_IO = [] # Pairs of ceil inst corners to cut out.
FLOOR_IO = [] # Pairs of floor inst corners to cut out.
overlay_ids = {} # When we replace brushes, we need to fix any overlays
# on that surface.
MATS.clear()
floor_edges = [] # Values to pass to add_floor_sides() at the end
sign_loc = set(FORCE_LOCATIONS)
# If any signage is present in the map, we need to force tiles to
# appear at that location!
for over in conditions.VMF.by_class['info_overlay']:
if (
over['material'].casefold() in FORCE_TILE_MATS and
# Only check floor/ceiling overlays
over['basisnormal'] in ('0 0 1', '0 0 -1')
):
loc = Vec.from_str(over['origin'])
# Sometimes (light bridges etc) a sign will be halfway between
# tiles, so in that case we need to force 2 tiles.
loc_min = (loc - (15, 15, 0)) // 32 * 32 + (16, 16, 0)
loc_max = (loc + (15, 15, 0)) // 32 * 32 + (16, 16, 0)
sign_loc.add(loc_min.as_tuple())
sign_loc.add(loc_max.as_tuple())
SETTINGS = {
'floor_chance': utils.conv_int(
res['floorChance', '100'], 100),
'ceil_chance': utils.conv_int(
res['ceilingChance', '100'], 100),
'floor_glue_chance': utils.conv_int(
res['floorGlueChance', '0']),
'ceil_glue_chance': utils.conv_int(
res['ceilingGlueChance', '0']),
'rotate_beams': int(utils.conv_float(
res['rotateMax', '0']) * BEAM_ROT_PRECISION),
'beam_skin': res['squarebeamsSkin', '0'],
'base_is_disp': utils.conv_bool(res['dispBase', '0']),
'quad_floor': res['FloorSize', '4x4'].casefold() == '2x2',
'quad_ceil': res['CeilingSize', '4x4'].casefold() == '2x2',
}
for mat_prop in res['Materials', []]:
MATS[mat_prop.name].append(mat_prop.value)
if SETTINGS['base_is_disp']:
# We want the normal brushes to become nodraw.
MATS['floorbase_disp'] = MATS['floorbase']
MATS['floorbase'] = ['tools/toolsnodraw']
for key, default in TEX_DEFAULT:
if key not in MATS:
MATS[key] = [default]
# Find our marker ents
for inst in conditions.VMF.by_class['func_instance']: # type: VLib.Entity
if inst['file'].casefold() not in item:
continue
targ = inst['targetname']
orient = Vec(0, 0, 1).rotate_by_str(inst['angles', '0 0 0'])
# Check the orientation of the marker to figure out what to generate
if orient == (0, 0, 1):
io_list = FLOOR_IO
else:
io_list = CEIL_IO
# Reuse orient to calculate where the solid face will be.
loc = (orient * -64) + Vec.from_str(inst['origin'])
INST_LOCS[targ] = loc
for out in inst.output_targets():
io_list.append((targ, out))
if not inst.outputs and inst.fixup['$connectioncount'] == '0':
# If the item doesn't have any connections, 'connect'
#.........这里部分代码省略.........
示例2: res_cutout_tile
# 需要导入模块: from utils import Vec [as 别名]
# 或者: from utils.Vec import max [as 别名]
def res_cutout_tile(inst, res):
"""Generate random quarter tiles, like in Destroyed or Retro maps.
- "MarkerItem" is the instance to look for.
- "TileSize" can be "2x2" or "4x4".
- rotateMax is the amount of degrees to rotate squarebeam models.
Materials:
- "squarebeams" is the squarebeams variant to use.
- "ceilingwalls" are the sides of the ceiling section.
- "floorbase" is the texture under floor sections.
- "tile_glue" is used on top of a thinner tile segment.
- "clip" is the player_clip texture used over floor segments.
(This allows customising the surfaceprop.)
- "Floor4x4Black", "Ceil2x2White" and other combinations can be used to
override the textures used.
"""
item = resolve_inst(res['markeritem'])
INST_LOCS = {} # Map targetnames -> surface loc
CEIL_IO = [] # Pairs of ceil inst corners to cut out.
FLOOR_IO = [] # Pairs of floor inst corners to cut out.
overlay_ids = {} # When we replace brushes, we need to fix any overlays
# on that surface.
MATS.clear()
floor_edges = [] # Values to pass to add_floor_sides() at the end
sign_loc = set(FORCE_LOCATIONS)
# If any signage is present in the map, we need to force tiles to
# appear at that location!
for over in conditions.VMF.by_class['info_overlay']:
if (
over['material'].casefold() in FORCE_TILE_MATS and
# Only check floor/ceiling overlays
over['basisnormal'] in ('0 0 1', '0 0 -1')
):
loc = Vec.from_str(over['origin'])
# Sometimes (light bridges etc) a sign will be halfway between
# tiles, so in that case we need to force 2 tiles.
loc_min = (loc - (15, 15, 0)) // 32 * 32 + (16, 16, 0)
loc_max = (loc + (15, 15, 0)) // 32 * 32 + (16, 16, 0)
sign_loc.add(loc_min.as_tuple())
sign_loc.add(loc_max.as_tuple())
SETTINGS = {
'floor_chance': utils.conv_int(
res['floorChance', '100'], 100),
'ceil_chance': utils.conv_int(
res['ceilingChance', '100'], 100),
'floor_glue_chance': utils.conv_int(
res['floorGlueChance', '0']),
'ceil_glue_chance': utils.conv_int(
res['ceilingGlueChance', '0']),
'rotate_beams': int(utils.conv_float(
res['rotateMax', '0']) * BEAM_ROT_PRECISION),
'beam_skin': res['squarebeamsSkin', '0'],
'base_is_disp': utils.conv_bool(res['dispBase', '0']),
'quad_floor': res['FloorSize', '4x4'].casefold() == '2x2',
'quad_ceil': res['CeilingSize', '4x4'].casefold() == '2x2',
}
random.seed(vbsp.MAP_RAND_SEED + '_CUTOUT_TILE_NOISE')
noise = SimplexNoise(period=4 * 40) # 4 tiles/block, 50 blocks max
# We want to know the number of neighbouring tile cutouts before
# placing tiles - blocks away from the sides generate fewer tiles.
floor_neighbours = defaultdict(dict) # all_floors[z][x,y] = count
for mat_prop in res['Materials', []]:
MATS[mat_prop.name].append(mat_prop.value)
if SETTINGS['base_is_disp']:
# We want the normal brushes to become nodraw.
MATS['floorbase_disp'] = MATS['floorbase']
MATS['floorbase'] = ['tools/toolsnodraw']
# Since this uses random data for initialisation, the alpha and
# regular will use slightly different patterns.
alpha_noise = SimplexNoise(period=4 * 50)
else:
alpha_noise = None
for key, default in TEX_DEFAULT:
if key not in MATS:
MATS[key] = [default]
# Find our marker ents
for inst in conditions.VMF.by_class['func_instance']: # type: VLib.Entity
if inst['file'].casefold() not in item:
continue
targ = inst['targetname']
orient = Vec(0, 0, 1).rotate_by_str(inst['angles', '0 0 0'])
# Check the orientation of the marker to figure out what to generate
if orient == (0, 0, 1):
#.........这里部分代码省略.........