Пример #1
0
def effect120(model,
              position,
              scale,
              frame_rate,
              flags,
              radius,
              magnitude,
              normal=None,
              material=None):
    """
    est_effect_20 <player filter> <delay> <model> <position x y z> <scale> <framerate> <flags> <radius> <magnitude> [normal x y z] [material type]
    """
    if not isinstance(position, Vector):
        position = Vector(*position)

    te = TempEntity('Explosion')
    te.position = position
    te.scale = scale
    te.frame_rate = frame_rate
    te.flags = flags
    te.radius = radius
    te.magnitude = magnitude

    if normal is not None:
        if not isinstance(normal, Vector):
            normal = Vector(*normal)

        te.normal = normal

    if material is not None:
        te.material_type = material

    return te
Пример #2
0
def effect120(model,
              position,
              scale,
              frame_rate,
              flags,
              radius,
              magnitude,
              normal=None,
              material=None):
    """
    est_effect_20 <player filter> <delay> <model> <position x y z> <scale> <framerate> <flags> <radius> <magnitude> [normal x y z] [material type]
    """
    if not isinstance(position, Vector):
        position = Vector(*position)

    te = TempEntity('Explosion')
    te.position = position
    te.scale = scale
    te.frame_rate = frame_rate
    te.flags = flags
    te.radius = radius
    te.magnitude = magnitude

    if normal is not None:
        if not isinstance(normal, Vector):
            normal = Vector(*normal)

        te.normal = normal

    if material is not None:
        if isinstance(material, str):
            # /game/server/func_break.h
            # typedef enum { matGlass = 0, matWood, matMetal, matFlesh, matCinderBlock, matCeilingTile, matComputer, matUnbreakableGlass, matRocks, matWeb, matNone, matLastMaterial } Materials;
            material = {
                'glass': 0,
                'wood': 1,
                'metal': 2,
                'flesh': 3,
                'cinderblock': 4,
                'ceilingtile': 5,
                'computer': 6,
                'unbreakableglass': 7,
                'rocks': 8,
                'web': 9
            }.get(material.lower(), 0)

        te.material_type = material

    return te