Ejemplo n.º 1
0
def res_cust_antline_setup(res):
    def find(cat):
        """Helper to reduce code duplication."""
        return [p.value for p in res.find_all(cat)]

    # Allow overriding these options. If unset use the style's value - the
    # amount of destruction will usually be the same.
    broken_chance = utils.conv_float(res[
        'broken_antline_chance',
        vbsp.get_opt('broken_antline_chance')
    ])
    broken_dist = utils.conv_float(res[
        'broken_antline_distance',
        vbsp.get_opt('broken_antline_distance')
    ])

    toggle_inst = res['instance', '']
    toggle_out = list(res.find_all('addOut'))

    # These textures are required - the base ones.
    straight_tex = find('straight')
    corner_tex = find('corner')

    # Arguments to pass to setAntlineMat
    straight_args = [
        straight_tex,
        find('straightFloor') or (),
        # Extra broken antline textures / options, if desired.
        broken_chance,
        broken_dist,
        find('brokenStraight') or (),
        find('brokenStraightFloor') or (),
    ]

    # The same but for corners.
    corner_args = [
        corner_tex,
        find('cornerFloor') or (),
        broken_chance,
        broken_dist,
        find('brokenCorner') or (),
        find('brokenCornerFloor') or (),
    ]

    if not straight_tex or not corner_tex:
        # If we don't have two textures, something's wrong. Remove this result.
        LOGGER.warning('custAntline has no textures!')
        return None
    else:
        return straight_args, corner_args, toggle_inst, toggle_out
Ejemplo n.º 2
0
def res_cave_portrait(inst, res):
    """Checks to see if the Cave Portrait option is set for the given

    skin pack.
    """
    import vbsp
    return vbsp.get_opt('cave_port_skin') != ''
Ejemplo n.º 3
0
def res_cave_portrait(inst, res):
    """A variant of AddOverlay for adding Cave Portraits.

    If the set quote pack is not Cave Johnson, this does nothing.
    Otherwise, this overlays an instance, setting the $skin variable
    appropriately.
    """
    import vbsp

    skin = vbsp.get_opt("cave_port_skin")
    if skin != "":
        new_inst = res_add_overlay_inst(inst, res)
        new_inst.fixup["$skin"] = skin