本文整理汇总了Python中srctools.Vec.max方法的典型用法代码示例。如果您正苦于以下问题:Python Vec.max方法的具体用法?Python Vec.max怎么用?Python Vec.max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类srctools.Vec
的用法示例。
在下文中一共展示了Vec.max方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: res_cutout_tile
# 需要导入模块: from srctools import Vec [as 别名]
# 或者: from srctools.Vec import max [as 别名]
def res_cutout_tile(vmf: srctools.VMF, res: Property):
"""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.
"""
marker_filenames = instanceLocs.resolve(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_locs = set()
# If any signage is present in the map, we need to force tiles to
# appear at that location!
for over in 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')
):
add_signage_loc(sign_locs, Vec.from_str(over['origin']))
for item in connections.ITEMS.values():
for ind_pan in item.ind_panels:
loc = Vec(0, 0, -64)
loc.localise(
Vec.from_str(ind_pan['origin']),
Vec.from_str(ind_pan['angles']),
)
add_signage_loc(sign_locs, loc)
SETTINGS = {
'floor_chance': srctools.conv_int(
res['floorChance', '100'], 100),
'ceil_chance': srctools.conv_int(
res['ceilingChance', '100'], 100),
'floor_glue_chance': srctools.conv_int(
res['floorGlueChance', '0']),
'ceil_glue_chance': srctools.conv_int(
res['ceilingGlueChance', '0']),
'rotate_beams': int(srctools.conv_float(
res['rotateMax', '0']) * BEAM_ROT_PRECISION),
'beam_skin': res['squarebeamsSkin', '0'],
'base_is_disp': srctools.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.find_key('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 vmf.by_class['func_instance']:
if inst['file'].casefold() not in marker_filenames:
continue
targ = inst['targetname']
#.........这里部分代码省略.........