本文整理汇总了Python中srctools.Vec.join方法的典型用法代码示例。如果您正苦于以下问题:Python Vec.join方法的具体用法?Python Vec.join怎么用?Python Vec.join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类srctools.Vec
的用法示例。
在下文中一共展示了Vec.join方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: res_rand_vec
# 需要导入模块: from srctools import Vec [as 别名]
# 或者: from srctools.Vec import join [as 别名]
def res_rand_vec(inst: Entity, res: Property) -> None:
"""A modification to RandomNum which generates a random vector instead.
'decimal', 'seed' and 'ResultVar' work like RandomNum. min/max x/y/z
are for each section. If the min and max are equal that number will be used
instead.
"""
is_float = srctools.conv_bool(res['decimal'])
var = res['resultvar', '$random']
set_random_seed(inst, 'e' + res['seed', 'random'])
if is_float:
func = random.uniform
else:
func = random.randint
value = Vec()
for axis in 'xyz':
max_val = srctools.conv_float(res['max_' + axis, 0.0])
min_val = srctools.conv_float(res['min_' + axis, 0.0])
if min_val == max_val:
value[axis] = min_val
else:
value[axis] = func(min_val, max_val)
inst.fixup[var] = value.join(' ')
示例2: res_cutout_tile
# 需要导入模块: from srctools import Vec [as 别名]
# 或者: from srctools.Vec import join [as 别名]
#.........这里部分代码省略.........
vmf,
box_min - (64, 64, 0),
box_max + (64, 64, -8),
skin=SETTINGS['beam_skin'],
max_rot=SETTINGS['rotate_beams'],
)
else:
# Make the squarebeams props, using big models if possible
gen_squarebeams(
vmf,
box_min + (-64, -64, 0),
box_max + (64, 64, -8),
skin=SETTINGS['beam_skin']
)
# Add a player_clip brush across the whole area
vmf.add_brush(vmf.make_prism(
p1=box_min - (64, 64, FLOOR_DEPTH),
p2=box_max + (64, 64, 0),
mat=MATS['clip'][0],
).solid)
# Add a noportal_volume covering the surface, in case there's
# room for a portal.
noportal_solid = vmf.make_prism(
# Don't go all the way to the sides, so it doesn't affect wall
# brushes.
p1=box_min - (63, 63, 9),
p2=box_max + (63, 63, 0),
mat='tools/toolsinvisible',
).solid
noportal_ent = vmf.create_ent(
classname='func_noportal_volume',
origin=box_min.join(' '),
)
noportal_ent.solids.append(noportal_solid)
if SETTINGS['base_is_disp']:
# Use displacements for the base instead.
make_alpha_base(
vmf,
box_min + (-64, -64, 0),
box_max + (64, 64, 0),
noise=alpha_noise,
)
for x, y in utils.iter_grid(
min_x=int(box_min.x),
max_x=int(box_max.x) + 1,
min_y=int(box_min.y),
max_y=int(box_max.y) + 1,
stride=128,
):
# Build the set of all positions..
floor_neighbours[z][x, y] = -1
# Mark borders we need to fill in, and the angle (for func_instance)
# The wall is the face pointing inwards towards the bottom brush,
# and the ceil is the ceiling of the block above the bordering grid
# points.
for x in range(int(box_min.x), int(box_max.x) + 1, 128):
# North
floor_edges.append(BorderPoints(
wall=Vec(x, box_max.y + 64, z - 64),
ceil=Vec_tuple(x, box_max.y + 128, z),
rot=270,
示例3: res_make_tag_fizzler
# 需要导入模块: from srctools import Vec [as 别名]
# 或者: from srctools.Vec import join [as 别名]
#.........这里部分代码省略.........
else:
# Align just based on whether we're in front or behind.
sign_dir = Vec()
sign_dir[other_axis] = sign_floor_loc[other_axis] - normal
sign_angle = math.degrees(
math.atan2(sign_dir.y, sign_dir.x)
)
# Round to nearest 90 degrees
# Add 45 so the switchover point is at the diagonals
sign_angle = (sign_angle + 45) // 90 * 90
# Rotate to fit the instances - south is down
sign_angle = int(sign_angle + 90) % 360
if inst_normal.z > 0:
sign_angle = '0 {} 0'.format(sign_angle)
elif inst_normal.z < 0:
# Flip upside-down for ceilings
sign_angle = '0 {} 180'.format(sign_angle)
else:
# On a wall, face upright
sign_angle = PETI_INST_ANGLE[inst_normal.as_tuple()]
# If disable_other, we show off signs. Otherwise we don't use that sign.
blue_sign = blue_sign_on if blue_enabled else blue_sign_off if disable_other else None
oran_sign = oran_sign_on if oran_enabled else oran_sign_off if disable_other else None
if blue_sign:
vmf.create_ent(
classname='func_instance',
file=blue_sign,
targetname=inst['targetname'],
angles=sign_angle,
origin=blue_loc.join(' '),
)
if oran_sign:
vmf.create_ent(
classname='func_instance',
file=oran_sign,
targetname=inst['targetname'],
angles=sign_angle,
origin=oran_loc.join(' '),
)
# Now modify the fizzler...
# Subtract the sign from the list of connections, but don't go below
# zero
fizzler.base_inst.fixup['$connectioncount'] = str(max(
0,
srctools.conv_int(fizzler.base_inst.fixup['$connectioncount', '']) - 1
))
# Find the direction the fizzler normal is.
# Signs will associate with the given side!
bbox_min, bbox_max = fizzler.emitters[0]
fizz_norm_axis = fizzler.normal().axis()
sign_center = (bbox_min[fizz_norm_axis] + bbox_max[fizz_norm_axis]) / 2
# Figure out what the sides will set values to...
pos_blue = False
pos_oran = False
neg_blue = False