Esempio n. 1
0
    def __init__(self,
                 srcnode: ba.Node = None,
                 pos: Sequence[float] = None,
                 velocity: Sequence[float] = None,
                 magnitude: float = 1.0,
                 velocity_magnitude: float = 0.0,
                 radius: float = 1.0,
                 source_player: ba.Player = None,
                 kick_back: float = 1.0,
                 flat_damage: float = None,
                 hit_type: str = 'generic',
                 force_direction: Sequence[float] = None,
                 hit_subtype: str = 'default'):
        """Instantiate a message with given values."""

        self.srcnode = srcnode
        self.pos = pos if pos is not None else _ba.Vec3()
        self.velocity = velocity if velocity is not None else _ba.Vec3()
        self.magnitude = magnitude
        self.velocity_magnitude = velocity_magnitude
        self.radius = radius

        # We should not be getting passed an invalid ref.
        assert source_player is None or source_player.exists()
        self._source_player = source_player
        self.kick_back = kick_back
        self.flat_damage = flat_damage
        self.hit_type = hit_type
        self.hit_subtype = hit_subtype
        self.force_direction = (force_direction
                                if force_direction is not None else velocity)
Esempio n. 2
0
    def __init__(self, player: ba.Player, was_killed: bool,
                 killerplayer: Optional[ba.Player], how: ba.DeathType):
        """Instantiate a message with the given values."""

        # Invalid refs should never be passed as args.
        assert player.exists()
        self._player = player

        # Invalid refs should never be passed as args.
        assert killerplayer is None or killerplayer.exists()
        self._killerplayer = killerplayer
        self.killed = was_killed
        self.how = how