本文整理汇总了Python中srctools.Property.vec方法的典型用法代码示例。如果您正苦于以下问题:Python Property.vec方法的具体用法?Python Property.vec怎么用?Python Property.vec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类srctools.Property
的用法示例。
在下文中一共展示了Property.vec方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: res_make_tag_coop_spawn
# 需要导入模块: from srctools import Property [as 别名]
# 或者: from srctools.Property import vec [as 别名]
def res_make_tag_coop_spawn(vmf: VMF, inst: Entity, res: Property):
"""Create the spawn point for ATLAS in the entry corridor.
It produces either an instance or the normal spawn entity. This is required since ATLAS may need to have the paint gun logic.
The two parameters `origin` and `facing` must be set to determine the required position.
If `global` is set, the spawn point will be absolute instead of relative to the current instance.
"""
if vbsp.GAME_MODE != 'COOP':
return RES_EXHAUSTED
is_tag = vbsp_options.get(str, 'game_id') == utils.STEAM_IDS['TAG']
origin = res.vec('origin')
normal = res.vec('facing', z=1)
# Some styles might want to ignore the instance we're running on.
if not res.bool('global'):
origin = origin.rotate_by_str(inst['angles'])
normal = normal.rotate_by_str(inst['angles'])
origin += Vec.from_str(inst['origin'])
angles = normal.to_angle()
if is_tag:
vmf.create_ent(
classname='func_instance',
targetname='paint_gun',
origin=origin - (0, 0, 16),
angles=angles,
# Generated by the BEE2 app.
file='instances/bee2/tag_coop_gun.vmf',
)
# Blocks ATLAS from having a gun
vmf.create_ent(
classname='info_target',
targetname='supress_blue_portalgun_spawn',
origin=origin,
angles='0 0 0',
)
# Allows info_target to work
vmf.create_ent(
classname='env_global',
targetname='no_spawns',
globalstate='portalgun_nospawn',
initialstate=1,
spawnflags=1, # Use initial state
origin=origin,
)
vmf.create_ent(
classname='info_coop_spawn',
targetname='@coop_spawn_blue',
ForceGunOnSpawn=int(not is_tag),
origin=origin,
angles=angles,
enabled=1,
StartingTeam=3, # ATLAS
)
return RES_EXHAUSTED
示例2: res_monitor_setup
# 需要导入模块: from srctools import Property [as 别名]
# 或者: from srctools.Property import vec [as 别名]
def res_monitor_setup(res: Property):
return (
res['breakInst', None],
res['bullseye_name', ''],
res.vec('bullseye_loc'),
res['bullseye_parent', ''],
)
示例3: parse
# 需要导入模块: from srctools import Property [as 别名]
# 或者: from srctools.Property import vec [as 别名]
def parse(cls, conf: Property) -> 'FizzlerBrush':
"""Parse from a config file."""
if 'side_color' in conf:
side_color = conf.vec('side_color')
else:
side_color = None
outputs = [
Output.parse(prop)
for prop in
conf.find_children('Outputs')
]
textures = {}
for group in TexGroup:
textures[group] = conf['tex_' + group.value, None]
keys = {
prop.name: prop.value
for prop in
conf.find_children('keys')
}
local_keys = {
prop.name: prop.value
for prop in
conf.find_children('localkeys')
}
if 'classname' not in keys:
raise ValueError(
'Fizzler Brush "{}" does not have a classname!'.format(
conf['name'],
)
)
return FizzlerBrush(
name=conf['name'],
textures=textures,
keys=keys,
local_keys=local_keys,
outputs=outputs,
thickness=conf.float('thickness', 2.0),
stretch_center=conf.bool('stretch_center', True),
side_color=side_color,
singular=conf.bool('singular'),
mat_mod_name=conf['mat_mod_name', None],
mat_mod_var=conf['mat_mod_var', None],
set_axis_var=conf.bool('set_axis_var'),
)
示例4: res_sendificator_laser_setup
# 需要导入模块: from srctools import Property [as 别名]
# 或者: from srctools.Property import vec [as 别名]
def res_sendificator_laser_setup(res: Property):
return (
res.vec('offset'),
res.vec('direction', 0, 0, 1)
)
示例5: res_antlaser
# 需要导入模块: from srctools import Property [as 别名]
# 或者: from srctools.Property import vec [as 别名]
def res_antlaser(vmf: VMF, res: Property):
"""The condition to generate AntLasers.
This is executed once to modify all instances.
"""
conf_inst = instanceLocs.resolve(res['instance'])
conf_glow_height = Vec(z=res.float('GlowHeight', 48) - 64)
conf_las_start = Vec(z=res.float('LasStart') - 64)
conf_rope_off = res.vec('RopePos')
conf_toggle_targ = res['toggleTarg', '']
beam_conf = res.find_key('BeamKeys', [])
glow_conf = res.find_key('GlowKeys', [])
cable_conf = res.find_key('CableKeys', [])
if beam_conf:
# Grab a copy of the beam spawnflags so we can set our own options.
conf_beam_flags = beam_conf.int('spawnflags')
# Mask out certain flags.
conf_beam_flags &= (
0
| 1 # Start On
| 2 # Toggle
| 4 # Random Strike
| 8 # Ring
| 16 # StartSparks
| 32 # EndSparks
| 64 # Decal End
#| 128 # Shade Start
#| 256 # Shade End
#| 512 # Taper Out
)
else:
conf_beam_flags = 0
conf_outputs = [
Output.parse(prop)
for prop in res
if prop.name in ('onenabled', 'ondisabled')
]
# Find all the markers.
nodes = {} # type: Dict[str, Item]
for inst in vmf.by_class['func_instance']:
if inst['file'].casefold() not in conf_inst:
continue
name = inst['targetname']
try:
# Remove the item - it's no longer going to exist after
# we're done.
nodes[name] = connections.ITEMS.pop(name)
except KeyError:
raise ValueError('No item for "{}"?'.format(name)) from None
if not nodes:
# None at all.
return conditions.RES_EXHAUSTED
# Now find every connected group, recording inputs, outputs and links.
todo = set(nodes.values())
groups = [] # type: List[Group]
# Node -> is grouped already.
node_pairing = dict.fromkeys(nodes.values(), False)
while todo:
start = todo.pop()
# Synthesise the Item used for logic.
# We use a random info_target to manage the IO data.
group = Group(start)
groups.append(group)
for node in group.nodes:
# If this node has no non-node outputs, destroy the antlines.
has_output = False
node_pairing[node] = True
for conn in list(node.outputs):
neighbour = conn.to_item
todo.discard(neighbour)
pair_state = node_pairing.get(neighbour, None)
if pair_state is None:
# Not a node, a target of our logic.
conn.from_item = group.item
has_output = True
continue
elif pair_state is False:
# Another node.
group.nodes.append(neighbour)
# else: True, node already added.
# For nodes, connect link.
conn.remove()
group.links.add(frozenset({node, neighbour}))
# If we have a real output, we need to transfer it.
# Otherwise we can just destroy it.
if has_output:
node.transfer_antlines(group.item)
#.........这里部分代码省略.........