示例#1
0
def res_cust_antline(inst, res):
    """Customise the output antline texture, toggle instances.

    This allows adding extra outputs between the instance and the toggle.
    """
    import vbsp

    over_name = "@" + inst["targetname"] + "_indicator"
    for over in VMF.by_class["info_overlay"] & VMF.by_target[over_name]:
        random.seed(over["origin"])
        new_tex = random.choice(res.value[vbsp.ANTLINES[over["material"].casefold()]])
        vbsp.set_antline_mat(over, new_tex, raw_mat=True)

    # allow replacing the indicator_toggle instance
    if res.value["instance"]:
        for toggle in VMF.by_class["func_instance"]:
            if toggle.fixup["indicator_name", ""] == over_name:
                toggle["file"] = res.value["instance"]
                if len(res.value["outputs"]) > 0:
                    for out in inst.outputs[:]:
                        if out.target == toggle["targetname"]:
                            # remove the original outputs
                            inst.outputs.remove(out)
                    for out in res.value["outputs"]:
                        # Allow adding extra outputs to customly
                        # trigger the toggle
                        add_output(inst, out, toggle["targetname"])
                break  # Stop looking!
示例#2
0
def res_cust_antline(inst, res):
    """Customise the output antline texture, toggle instances.

    This allows adding extra outputs between the instance and the toggle.
    """
    over_name = '@' + inst['targetname'] + '_indicator'
    for over in (
            VMF.by_class['info_overlay'] &
            VMF.by_target[over_name]
            ):
        random.seed(over['origin'])
        new_tex = random.choice(
            res.value[
                vbsp.ANTLINES[
                    over['material'].casefold()
                ]
            ]
        )
        vbsp.set_antline_mat(over, new_tex, raw_mat=True)

    # allow replacing the indicator_toggle instance
    if res.value['instance']:
        for toggle in VMF.by_class['func_instance']:
            if toggle.fixup['indicator_name', ''] == over_name:
                toggle['file'] = res.value['instance']
                if len(res.value['outputs']) > 0:
                    for out in inst.outputs[:]:
                        if out.target == toggle['targetname']:
                            # remove the original outputs
                            inst.outputs.remove(out)
                    for out in res.value['outputs']:
                        # Allow adding extra outputs to customly
                        # trigger the toggle
                        add_output(inst, out, toggle['targetname'])
                break  # Stop looking!
示例#3
0
def res_cust_antline(inst, res):
    """Customise the output antline texture, toggle instances.

    This allows adding extra outputs between the instance and the toggle.
    Values:
        straight: The straight overlay texture.
        corner: The corner overlay texture.
        straightFloor: Alt texture used on straight floor segements (P1 style)
        cornerFloor: Alt texture for floor corners (P1 style)
          If these aren't set, the wall textures will be used.
        instance: Use the given indicator_toggle instance instead
        addOut: A set of additional ouputs to add, pointing at the
          toggle instance
    """
    straight_args, corner_args, toggle_inst, toggle_out = res.value

    # The original textures for straight and corner antlines
    straight_ant = vbsp.ANTLINES['straight']
    corner_ant = vbsp.ANTLINES['corner']

    over_name = '@' + inst['targetname'] + '_indicator'

    for over in (
            vbsp.VMF.by_class['info_overlay'] &
            vbsp.VMF.by_target[over_name]
            ):
        folded_mat = over['material'].casefold()
        if folded_mat == straight_ant:
            vbsp.set_antline_mat(over, *straight_args)
        elif folded_mat == corner_ant:
            vbsp.set_antline_mat(over, *corner_args)

        # Ensure this isn't overriden later!
        vbsp.IGNORED_OVERLAYS.add(over)

    # allow replacing the indicator_toggle instance
    if toggle_inst:
        for toggle in vbsp.VMF.by_class['func_instance']:
            if toggle.fixup['indicator_name', ''] != over_name:
                continue
            toggle['file'] = toggle_inst
            if len(toggle_out) > 0:
                for out in inst.outputs[:]:
                    if out.target == toggle['targetname']:
                        # remove the original outputs
                        inst.outputs.remove(out)
                for out in toggle_out:
                    # Allow adding extra outputs to customly
                    # trigger the toggle
                    conditions.add_output(inst, out, toggle['targetname'])
            break  # Stop looking!
示例#4
0
def res_cust_antline(inst: Entity, res: Property):
    """Customise the output antline texture, toggle instances.

    This allows adding extra outputs between the instance and the toggle.
    Values:
        straight: The straight overlay texture.
        corner: The corner overlay texture.
        straightFloor: Alt texture used on straight floor segements (P1 style)
        cornerFloor: Alt texture for floor corners (P1 style)
          If these aren't set, the wall textures will be used.
        instance: Use the given indicator_toggle instance instead
        addOut: A set of additional ouputs to add, pointing at the
          toggle instance
    """
    straight_args, corner_args, toggle_inst, toggle_out = res.value

    # The original textures for straight and corner antlines
    straight_ant = consts.Antlines.STRAIGHT
    corner_ant = consts.Antlines.CORNER

    over_name = '@' + inst['targetname'] + '_indicator'

    for over in (
            vbsp.VMF.by_class['info_overlay'] &
            vbsp.VMF.by_target[over_name]
            ):
        folded_mat = over['material'].casefold()
        if folded_mat == straight_ant:
            vbsp.set_antline_mat(over, *straight_args)
        elif folded_mat == corner_ant:
            vbsp.set_antline_mat(over, *corner_args)

        # Ensure this isn't overriden later!
        vbsp.IGNORED_OVERLAYS.add(over)

    # allow replacing the indicator_toggle instance
    if toggle_inst:
        for toggle in vbsp.VMF.by_class['func_instance']:
            if toggle.fixup['indicator_name', ''] != over_name:
                continue
            toggle['file'] = toggle_inst
            if len(toggle_out) > 0:
                for out in inst.outputs[:]:
                    if out.target == toggle['targetname']:
                        # remove the original outputs
                        inst.outputs.remove(out)
                for out in toggle_out:
                    # Allow adding extra outputs to customly
                    # trigger the toggle
                    conditions.add_output(inst, out, toggle['targetname'])
            break  # Stop looking!