Example #1
0
    def convert_to_flat(self, builder):

        DesiredGameInfoState.DesiredGameInfoStateStart(builder)
        if self.world_gravity_z is not None:
            DesiredGameInfoState.DesiredGameInfoStateAddWorldGravityZ(
                builder, Float.CreateFloat(builder, self.world_gravity_z))
        if self.game_speed is not None:
            DesiredGameInfoState.DesiredGameInfoStateAddGameSpeed(
                builder, Float.CreateFloat(builder, self.game_speed))
        return DesiredGameInfoState.DesiredGameInfoStateEnd(builder)
Example #2
0
    def convert_to_flat(self, builder):
        if self.x is None and self.y is None and self.z is None:
            return None  # If no value has to be set this saves some bytes in the builder, will get handled correctly

        Vector3Partial.Vector3PartialStart(builder)
        if self.x is not None:
            Vector3Partial.Vector3PartialAddX(
                builder, Float.CreateFloat(builder, self.x))
        if self.y is not None:
            Vector3Partial.Vector3PartialAddY(
                builder, Float.CreateFloat(builder, self.y))
        if self.z is not None:
            Vector3Partial.Vector3PartialAddZ(
                builder, Float.CreateFloat(builder, self.z))
        return Vector3Partial.Vector3PartialEnd(builder)
Example #3
0
    def convert_to_flat(self, builder):
        if self.pitch is None and self.yaw is None and self.roll is None:
            return None  # If no value has to be set this saves some bytes in the builder, will get handled correctly

        RotatorPartial.RotatorPartialStart(builder)
        if self.pitch is not None:
            RotatorPartial.RotatorPartialAddPitch(
                builder, Float.CreateFloat(builder, self.pitch))
        if self.yaw is not None:
            RotatorPartial.RotatorPartialAddYaw(
                builder, Float.CreateFloat(builder, self.yaw))
        if self.roll is not None:
            RotatorPartial.RotatorPartialAddRoll(
                builder, Float.CreateFloat(builder, self.roll))
        return RotatorPartial.RotatorPartialEnd(builder)
Example #4
0
    def convert_to_flat(self, builder):

        DesiredGameInfoState.DesiredGameInfoStateStart(builder)
        if self.world_gravity_z is not None:
            DesiredGameInfoState.DesiredGameInfoStateAddWorldGravityZ(
                builder, Float.CreateFloat(builder, self.world_gravity_z))
        if self.game_speed is not None:
            DesiredGameInfoState.DesiredGameInfoStateAddGameSpeed(
                builder, Float.CreateFloat(builder, self.game_speed))
        if self.paused is not None:
            DesiredGameInfoState.DesiredGameInfoStateAddPaused(
                builder, Bool.CreateBool(builder, self.paused))
        if self.end_match is not None:
            DesiredGameInfoState.DesiredGameInfoStateAddEndMatch(
                builder, Bool.CreateBool(builder, self.end_match))
        return DesiredGameInfoState.DesiredGameInfoStateEnd(builder)
Example #5
0
    def convert_to_flat(self, builder):
        """
        In this conversion, we always want to return a valid flatbuffer pointer even if all the
        contents are blank because sometimes we need to put empty boost states into the boost list
        to make the indices line up.
        """

        DesiredBoostState.DesiredBoostStateStart(builder)
        if self.respawn_time is not None:
            DesiredBoostState.DesiredBoostStateAddRespawnTime(
                builder, Float.CreateFloat(builder, self.respawn_time))
        return DesiredBoostState.DesiredBoostStateEnd(builder)
Example #6
0
    def convert_to_flat(self, builder):
        """
        In this conversion, we always want to return a valid flatbuffer pointer even if all the
        contents are blank because sometimes we need to put empty car states into the car list
        to make the indices line up.
        """
        physics_offset = None if self.physics is None else self.physics.convert_to_flat(
            builder)

        DesiredCarState.DesiredCarStateStart(builder)
        if physics_offset is not None:
            DesiredCarState.DesiredCarStateAddPhysics(builder, physics_offset)
        if self.boost_amount is not None:
            DesiredCarState.DesiredCarStateAddBoostAmount(
                builder, Float.CreateFloat(builder, self.boost_amount))
        if self.jumped is not None:
            DesiredCarState.DesiredCarStateAddJumped(
                builder, Bool.CreateBool(builder, self.jumped))
        if self.double_jumped is not None:
            DesiredCarState.DesiredCarStateAddDoubleJumped(
                builder, Bool.CreateBool(builder, self.double_jumped))
        return DesiredCarState.DesiredCarStateEnd(builder)
Example #7
0
 def __wrap_float(self, number):
     return Float.CreateFloat(self.builder, number)