Exemplo n.º 1
0
def get_decal_instance(name):
    decal = _decals.get(name)

    if decal is None:
        decal = _decals[name] = Decal(name, True)

    return decal
Exemplo n.º 2
0
def effect135(decal, position):
    """
    est_effect_35 <player filter> <delay> <Decal> <Position x y z>
    """
    if not isinstance(decal, Decal):
        decal = Decal(decal)

    if not isinstance(position, Vector):
        position = Vector(*position)

    te = TempEntity('World Decal')
    te.decal = decal
    te.position = position

    return te
Exemplo n.º 3
0
def effect113(decal, origin, index):
    """
    est_effect_13 <player filter> <delay> <decal> <origin x y z> <target entity index>
    """
    if not isinstance(decal, Decal):
        decal = Decal(decal)

    if not isinstance(origin, Vector):
        origin = Vector(*origin)

    te = TempEntity('BSP Decal')
    te.decal = decal
    te.origin = origin
    te.entity_index = index

    return te
Exemplo n.º 4
0
def effect129(decal, position, angle, distance):
    """
    est_effect_29 <player filter> <delay> <decal> <position x y z> <angle p y r> <distance>
    """
    if not isinstance(decal, Decal):
        decal = Decal(*decal)

    if not isinstance(position, Vector):
        position = Vector(*position)

    if not isinstance(angle, QAngle):
        angle = QAngle(*angle)

    te = TempEntity('Player Decal')
    te.decal = decal
    te.origin = position
    te.rotation = angle
    te.distance = distance

    return te
Exemplo n.º 5
0
def effect116(decal, position, start, index, hitbox):
    """
    est_effect_16 <player filter> <delay> <model> <position x y z> <start x y z> <entity index> <hitbox>
    """
    if not isinstance(decal, Decal):
        decal = Decal(decal)

    if not isinstance(position, Vector):
        position = Vector(*position)

    if not isinstance(start, Vector):
        start = Vector(*start)

    te = TempEntity('Entity Decal')
    te.decal = decal
    te.origin = position
    te.start = start
    te.entity_index = index
    te.hitbox = hitbox

    return te
Exemplo n.º 6
0
    def __getattr__(self, name):
        """Return the value of the given alias.

        :param str name: The alias name.
        :rtype: object
        """
        # Get the name of the prop...
        prop_name = self.template.aliases.get(name, None)

        # Was the given name a valid alias?
        if prop_name is not None:

            # Is the name a section?
            if isinstance(prop_name, Section):

                # Is the alias a decal?
                if prop_name['type'] == Decal.__name__:

                    # Return the decal instance...
                    return Decal(string_tables[Decal._precache_table][getattr(
                        self, prop_name['name'])])

                # Otherwise, is the alias an entity?
                elif prop_name['type'] == Entity.__name__:

                    # Return the entity instance...
                    return Entity(getattr(self, prop_name['name']))

                # Otherwise, is the alias a player?
                elif prop_name['type'] == Player.__name__:

                    # Return the player instance...
                    return Player(getattr(self, prop_name['name']))

                # Otherwise, is the alias a model?
                elif prop_name['type'] == Model.__name__:

                    # Get the name of the model...
                    model_name = string_tables[Model._precache_table][getattr(
                        self, prop_name['name'])]

                    # Was the model not precached?
                    if not model_name:

                        # Return an error model...
                        return Model('models/error.mdl')

                    # Return the model instance...
                    return Model(model_name)

                # Otherwise, is the alias a color?
                elif prop_name['type'] == Color.__name__:

                    # Get a tuple to store the RGBA values...
                    values = tuple()

                    # Loop through all aliases...
                    for alias in prop_name['name']:

                        # Add the current value to the tuple...
                        values += (getattr(self, alias), )

                    # Return the color instance...
                    return Color(*values)

                # Otherwise...
                else:

                    # Get the data of the property...
                    prop, offset, type_name = self.template.properties[
                        prop_name['name']]

                    # Return the value of the property...
                    return make_object(manager.get_class(prop_name['type']),
                                       get_object_pointer(self) + offset)

            # Get the data of the property...
            prop, offset, type_name = self.template.properties[prop_name]

            # Return the value of the property...
            return self._get_property(prop_name, prop.type)

        # Return the value of the given attribute...
        return super().__getattribute__(name)
Exemplo n.º 7
0
	def _compile_decals(self):
		for decal in self._decals:
			dl.add('materials/'+self._decals[decal]["vmt"])
			dl.add('materials/'+self._decals[decal]["vtf"])
			self._decals[decal]["index"] = Decal(self._decals[decal]["vmt"], download=False, preload=True)