def fset(ptr, value):
            """Set the property value and notify if networked."""
            # Does the property have True/False values?
            if true_value is not None:

                # Get the proper value to set
                value = true_value if value else false_value

            # Is the property a native type?
            if native_type:

                # Set the property
                getattr(ptr, 'set_' + type_name)(value, offset)

            # Is the property not a native type?
            else:

                # Get the class to set the property as
                cls = self.get_class(type_name)

                # Set the property
                get_object_pointer(value).copy(
                    ptr + offset, cls._size)

            # Is the property networked?
            if networked:

                # Notify the change of state
                edict_from_pointer(ptr).state_changed()
Exemple #2
0
        def fset(ptr, value):
            """Set the property value and notify if networked."""
            # Is the property a native type?
            if native_type:

                # Does the value need cast to a string?
                if type_name == 'char':
                    value = chr(value)

                # Set the property
                getattr(ptr, 'set_' + type_name)(value, offset)

            # Is the property not a native type?
            else:

                # Get the class to set the property as
                cls = self.get_class(type_name)

                # Set the property
                get_object_pointer(value).copy(ptr + offset, cls._size)

            # Is the property networked?
            if networked:

                # Notify the change of state
                edict_from_pointer(ptr).state_changed()
Exemple #3
0
        def fset(ptr, value):
            """Set the property value and notify if networked."""
            # Is the property a native type?
            if native_type:

                # Does the value need cast to a string?
                if type_name == 'char':
                    value = chr(value)

                # Set the property
                getattr(ptr, 'set_' + type_name)(value, offset)

            # Is the property not a native type?
            else:

                # Get the class to set the property as
                cls = self.get_class(type_name)

                # Set the property
                get_object_pointer(value).copy(
                    ptr + offset, cls._size)

            # Is the property networked?
            if networked:

                # Notify the change of state
                edict_from_pointer(ptr).state_changed()
Exemple #4
0
def _pre_bump_weapon(args):
	"""Switch the player's team if they are a CT picking up the bomb."""
	global _bump_player
	if edict_from_pointer(args[1]).classname != 'weapon_c4':
		return
	_bump_player = make_object(Player, args[0])
	if _bump_player.team == 3:
		Entity(_bump_player.index).team = 2
	else:
		_bump_player = None
def _on_weapon_bump(args):
    """Return whether the player is allowed to pickup the weapon."""
    return weapon_restriction_manager.on_player_bumping_weapon(
        make_object(Player, args[0]),
        edict_from_pointer(args[1]).classname)
def _on_weapon_bump(args):
    """Return whether the player is allowed to pickup the weapon."""
    return weapon_restriction_manager.on_player_bumping_weapon(
        make_object(Player, args[0]), edict_from_pointer(args[1]).classname)