diff --git a/dist/game-snapshot-inspector.js b/dist/game-snapshot-inspector.js index 3bb16e7..90eb651 100644 --- a/dist/game-snapshot-inspector.js +++ b/dist/game-snapshot-inspector.js @@ -76,7 +76,10 @@ var GameSnapshotInspector = /** @class */ (function () { return this.makeOrderMoveFromPoint((_b = (_a = this.me) === null || _a === void 0 ? void 0 : _a.getPosition()) !== null && _b !== void 0 ? _b : Geo.newZeroedPoint(), target, specs_1.SPECS.PLAYER_MAX_SPEED); }; GameSnapshotInspector.prototype.makeOrderMoveFromPoint = function (origin, target, speed) { - var vec = Geo.NewVector(origin, target); + var vec = ORIENTATION.NORTH; + if (Math.abs((0, _1.distanceBetweenPoints)(origin, target)) > 0) { + vec = Geo.NewVector(origin, target); + } var vel = Geo.NewZeroedVelocity(Geo.normalize(vec)); vel.setSpeed(speed); var moveOrder = new Lugo.Move(); @@ -87,9 +90,6 @@ var GameSnapshotInspector = /** @class */ (function () { var _a, _b; var origin = (_b = (_a = this.me) === null || _a === void 0 ? void 0 : _a.getPosition()) !== null && _b !== void 0 ? _b : Geo.newZeroedPoint(); var targetPoint = Geo.TargetFrom(direction, origin); - if (Math.abs((0, _1.distanceBetweenPoints)(targetPoint, direction)) == 0) { - return this.makeOrderMoveFromPoint(direction, new Lugo.Point(), 0); - } return this.makeOrderMoveFromPoint(origin, targetPoint, speed); }; GameSnapshotInspector.prototype.makeOrderMoveByDirection = function (direction, speed) { diff --git a/dist/pb/remote_grpc_pb.d.ts b/dist/pb/remote_grpc_pb.d.ts index 1e52fa8..6ee31b6 100644 --- a/dist/pb/remote_grpc_pb.d.ts +++ b/dist/pb/remote_grpc_pb.d.ts @@ -17,6 +17,8 @@ interface IRemoteService extends grpc.ServiceDefinition { @@ -82,6 +84,24 @@ interface IRemoteService_IResumeListeningPhase extends grpc.MethodDefinition; responseDeserialize: grpc.deserialize; } +interface IRemoteService_IResetPlayerPositions extends grpc.MethodDefinition { + path: "/lugo.Remote/ResetPlayerPositions"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IRemoteService_IGetGameSnapshot extends grpc.MethodDefinition { + path: "/lugo.Remote/GetGameSnapshot"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} export const RemoteService: IRemoteService; @@ -93,6 +113,8 @@ export interface IRemoteServer extends grpc.UntypedServiceImplementation { setPlayerProperties: grpc.handleUnaryCall; setGameProperties: grpc.handleUnaryCall; resumeListeningPhase: grpc.handleUnaryCall; + resetPlayerPositions: grpc.handleUnaryCall; + getGameSnapshot: grpc.handleUnaryCall; } export interface IRemoteClient { @@ -117,6 +139,12 @@ export interface IRemoteClient { resumeListeningPhase(request: remote_pb.ResumeListeningRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; resumeListeningPhase(request: remote_pb.ResumeListeningRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; resumeListeningPhase(request: remote_pb.ResumeListeningRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; + resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + getGameSnapshot(request: remote_pb.GameSnapshotRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; + getGameSnapshot(request: remote_pb.GameSnapshotRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; + getGameSnapshot(request: remote_pb.GameSnapshotRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; } export class RemoteClient extends grpc.Client implements IRemoteClient { @@ -142,4 +170,10 @@ export class RemoteClient extends grpc.Client implements IRemoteClient { public resumeListeningPhase(request: remote_pb.ResumeListeningRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; public resumeListeningPhase(request: remote_pb.ResumeListeningRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; public resumeListeningPhase(request: remote_pb.ResumeListeningRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; + public resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + public resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + public resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + public getGameSnapshot(request: remote_pb.GameSnapshotRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; + public getGameSnapshot(request: remote_pb.GameSnapshotRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; + public getGameSnapshot(request: remote_pb.GameSnapshotRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; } diff --git a/dist/pb/remote_grpc_pb.js b/dist/pb/remote_grpc_pb.js index 577c3d0..49ca4b8 100644 --- a/dist/pb/remote_grpc_pb.js +++ b/dist/pb/remote_grpc_pb.js @@ -39,6 +39,28 @@ function deserialize_lugo_GameProperties(buffer_arg) { return remote_pb.GameProperties.deserializeBinary(new Uint8Array(buffer_arg)); } +function serialize_lugo_GameSnapshotRequest(arg) { + if (!(arg instanceof remote_pb.GameSnapshotRequest)) { + throw new Error('Expected argument of type lugo.GameSnapshotRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_lugo_GameSnapshotRequest(buffer_arg) { + return remote_pb.GameSnapshotRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_lugo_GameSnapshotResponse(arg) { + if (!(arg instanceof remote_pb.GameSnapshotResponse)) { + throw new Error('Expected argument of type lugo.GameSnapshotResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_lugo_GameSnapshotResponse(buffer_arg) { + return remote_pb.GameSnapshotResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + function serialize_lugo_NextOrderRequest(arg) { if (!(arg instanceof remote_pb.NextOrderRequest)) { throw new Error('Expected argument of type lugo.NextOrderRequest'); @@ -83,6 +105,28 @@ function deserialize_lugo_PlayerProperties(buffer_arg) { return remote_pb.PlayerProperties.deserializeBinary(new Uint8Array(buffer_arg)); } +function serialize_lugo_ResetPlayerPositionsRequest(arg) { + if (!(arg instanceof remote_pb.ResetPlayerPositionsRequest)) { + throw new Error('Expected argument of type lugo.ResetPlayerPositionsRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_lugo_ResetPlayerPositionsRequest(buffer_arg) { + return remote_pb.ResetPlayerPositionsRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_lugo_ResetPlayerPositionsResponse(arg) { + if (!(arg instanceof remote_pb.ResetPlayerPositionsResponse)) { + throw new Error('Expected argument of type lugo.ResetPlayerPositionsResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_lugo_ResetPlayerPositionsResponse(buffer_arg) { + return remote_pb.ResetPlayerPositionsResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + function serialize_lugo_ResumeListeningRequest(arg) { if (!(arg instanceof remote_pb.ResumeListeningRequest)) { throw new Error('Expected argument of type lugo.ResumeListeningRequest'); @@ -187,6 +231,28 @@ var RemoteService = exports.RemoteService = { responseSerialize: serialize_lugo_ResumeListeningResponse, responseDeserialize: deserialize_lugo_ResumeListeningResponse, }, + resetPlayerPositions: { + path: '/lugo.Remote/ResetPlayerPositions', + requestStream: false, + responseStream: false, + requestType: remote_pb.ResetPlayerPositionsRequest, + responseType: remote_pb.ResetPlayerPositionsResponse, + requestSerialize: serialize_lugo_ResetPlayerPositionsRequest, + requestDeserialize: deserialize_lugo_ResetPlayerPositionsRequest, + responseSerialize: serialize_lugo_ResetPlayerPositionsResponse, + responseDeserialize: deserialize_lugo_ResetPlayerPositionsResponse, + }, + getGameSnapshot: { + path: '/lugo.Remote/GetGameSnapshot', + requestStream: false, + responseStream: false, + requestType: remote_pb.GameSnapshotRequest, + responseType: remote_pb.GameSnapshotResponse, + requestSerialize: serialize_lugo_GameSnapshotRequest, + requestDeserialize: deserialize_lugo_GameSnapshotRequest, + responseSerialize: serialize_lugo_GameSnapshotResponse, + responseDeserialize: deserialize_lugo_GameSnapshotResponse, + }, }; exports.RemoteClient = grpc.makeGenericClientConstructor(RemoteService); diff --git a/dist/pb/remote_pb.d.ts b/dist/pb/remote_pb.d.ts index 94c14b5..f45037d 100644 --- a/dist/pb/remote_pb.d.ts +++ b/dist/pb/remote_pb.d.ts @@ -234,3 +234,83 @@ export namespace ResumeListeningResponse { export type AsObject = { } } + +export class ResetPlayerPositionsRequest extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResetPlayerPositionsRequest.AsObject; + static toObject(includeInstance: boolean, msg: ResetPlayerPositionsRequest): ResetPlayerPositionsRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResetPlayerPositionsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResetPlayerPositionsRequest; + static deserializeBinaryFromReader(message: ResetPlayerPositionsRequest, reader: jspb.BinaryReader): ResetPlayerPositionsRequest; +} + +export namespace ResetPlayerPositionsRequest { + export type AsObject = { + } +} + +export class ResetPlayerPositionsResponse extends jspb.Message { + + hasGameSnapshot(): boolean; + clearGameSnapshot(): void; + getGameSnapshot(): server_pb.GameSnapshot | undefined; + setGameSnapshot(value?: server_pb.GameSnapshot): ResetPlayerPositionsResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResetPlayerPositionsResponse.AsObject; + static toObject(includeInstance: boolean, msg: ResetPlayerPositionsResponse): ResetPlayerPositionsResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResetPlayerPositionsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResetPlayerPositionsResponse; + static deserializeBinaryFromReader(message: ResetPlayerPositionsResponse, reader: jspb.BinaryReader): ResetPlayerPositionsResponse; +} + +export namespace ResetPlayerPositionsResponse { + export type AsObject = { + gameSnapshot?: server_pb.GameSnapshot.AsObject, + } +} + +export class GameSnapshotRequest extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GameSnapshotRequest.AsObject; + static toObject(includeInstance: boolean, msg: GameSnapshotRequest): GameSnapshotRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GameSnapshotRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GameSnapshotRequest; + static deserializeBinaryFromReader(message: GameSnapshotRequest, reader: jspb.BinaryReader): GameSnapshotRequest; +} + +export namespace GameSnapshotRequest { + export type AsObject = { + } +} + +export class GameSnapshotResponse extends jspb.Message { + + hasGameSnapshot(): boolean; + clearGameSnapshot(): void; + getGameSnapshot(): server_pb.GameSnapshot | undefined; + setGameSnapshot(value?: server_pb.GameSnapshot): GameSnapshotResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GameSnapshotResponse.AsObject; + static toObject(includeInstance: boolean, msg: GameSnapshotResponse): GameSnapshotResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GameSnapshotResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GameSnapshotResponse; + static deserializeBinaryFromReader(message: GameSnapshotResponse, reader: jspb.BinaryReader): GameSnapshotResponse; +} + +export namespace GameSnapshotResponse { + export type AsObject = { + gameSnapshot?: server_pb.GameSnapshot.AsObject, + } +} diff --git a/dist/pb/remote_pb.js b/dist/pb/remote_pb.js index 33ed6eb..be09f9d 100644 --- a/dist/pb/remote_pb.js +++ b/dist/pb/remote_pb.js @@ -23,10 +23,14 @@ goog.exportSymbol('proto.lugo.BallProperties', null, global); goog.exportSymbol('proto.lugo.CommandResponse', null, global); goog.exportSymbol('proto.lugo.CommandResponse.StatusCode', null, global); goog.exportSymbol('proto.lugo.GameProperties', null, global); +goog.exportSymbol('proto.lugo.GameSnapshotRequest', null, global); +goog.exportSymbol('proto.lugo.GameSnapshotResponse', null, global); goog.exportSymbol('proto.lugo.NextOrderRequest', null, global); goog.exportSymbol('proto.lugo.NextTurnRequest', null, global); goog.exportSymbol('proto.lugo.PauseResumeRequest', null, global); goog.exportSymbol('proto.lugo.PlayerProperties', null, global); +goog.exportSymbol('proto.lugo.ResetPlayerPositionsRequest', null, global); +goog.exportSymbol('proto.lugo.ResetPlayerPositionsResponse', null, global); goog.exportSymbol('proto.lugo.ResumeListeningRequest', null, global); goog.exportSymbol('proto.lugo.ResumeListeningResponse', null, global); /** @@ -218,6 +222,90 @@ if (goog.DEBUG && !COMPILED) { */ proto.lugo.ResumeListeningResponse.displayName = 'proto.lugo.ResumeListeningResponse'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lugo.ResetPlayerPositionsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lugo.ResetPlayerPositionsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lugo.ResetPlayerPositionsRequest.displayName = 'proto.lugo.ResetPlayerPositionsRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lugo.ResetPlayerPositionsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lugo.ResetPlayerPositionsResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lugo.ResetPlayerPositionsResponse.displayName = 'proto.lugo.ResetPlayerPositionsResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lugo.GameSnapshotRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lugo.GameSnapshotRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lugo.GameSnapshotRequest.displayName = 'proto.lugo.GameSnapshotRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lugo.GameSnapshotResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lugo.GameSnapshotResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lugo.GameSnapshotResponse.displayName = 'proto.lugo.GameSnapshotResponse'; +} @@ -1730,4 +1818,508 @@ proto.lugo.ResumeListeningResponse.serializeBinaryToWriter = function(message, w }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lugo.ResetPlayerPositionsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.lugo.ResetPlayerPositionsRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lugo.ResetPlayerPositionsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.ResetPlayerPositionsRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lugo.ResetPlayerPositionsRequest} + */ +proto.lugo.ResetPlayerPositionsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lugo.ResetPlayerPositionsRequest; + return proto.lugo.ResetPlayerPositionsRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lugo.ResetPlayerPositionsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lugo.ResetPlayerPositionsRequest} + */ +proto.lugo.ResetPlayerPositionsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lugo.ResetPlayerPositionsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lugo.ResetPlayerPositionsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lugo.ResetPlayerPositionsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.ResetPlayerPositionsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lugo.ResetPlayerPositionsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.lugo.ResetPlayerPositionsResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lugo.ResetPlayerPositionsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.ResetPlayerPositionsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + gameSnapshot: (f = msg.getGameSnapshot()) && server_pb.GameSnapshot.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lugo.ResetPlayerPositionsResponse} + */ +proto.lugo.ResetPlayerPositionsResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lugo.ResetPlayerPositionsResponse; + return proto.lugo.ResetPlayerPositionsResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lugo.ResetPlayerPositionsResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lugo.ResetPlayerPositionsResponse} + */ +proto.lugo.ResetPlayerPositionsResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new server_pb.GameSnapshot; + reader.readMessage(value,server_pb.GameSnapshot.deserializeBinaryFromReader); + msg.setGameSnapshot(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lugo.ResetPlayerPositionsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lugo.ResetPlayerPositionsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lugo.ResetPlayerPositionsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.ResetPlayerPositionsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGameSnapshot(); + if (f != null) { + writer.writeMessage( + 1, + f, + server_pb.GameSnapshot.serializeBinaryToWriter + ); + } +}; + + +/** + * optional GameSnapshot game_snapshot = 1; + * @return {?proto.lugo.GameSnapshot} + */ +proto.lugo.ResetPlayerPositionsResponse.prototype.getGameSnapshot = function() { + return /** @type{?proto.lugo.GameSnapshot} */ ( + jspb.Message.getWrapperField(this, server_pb.GameSnapshot, 1)); +}; + + +/** + * @param {?proto.lugo.GameSnapshot|undefined} value + * @return {!proto.lugo.ResetPlayerPositionsResponse} returns this +*/ +proto.lugo.ResetPlayerPositionsResponse.prototype.setGameSnapshot = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.lugo.ResetPlayerPositionsResponse} returns this + */ +proto.lugo.ResetPlayerPositionsResponse.prototype.clearGameSnapshot = function() { + return this.setGameSnapshot(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.lugo.ResetPlayerPositionsResponse.prototype.hasGameSnapshot = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lugo.GameSnapshotRequest.prototype.toObject = function(opt_includeInstance) { + return proto.lugo.GameSnapshotRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lugo.GameSnapshotRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.GameSnapshotRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lugo.GameSnapshotRequest} + */ +proto.lugo.GameSnapshotRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lugo.GameSnapshotRequest; + return proto.lugo.GameSnapshotRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lugo.GameSnapshotRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lugo.GameSnapshotRequest} + */ +proto.lugo.GameSnapshotRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lugo.GameSnapshotRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lugo.GameSnapshotRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lugo.GameSnapshotRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.GameSnapshotRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lugo.GameSnapshotResponse.prototype.toObject = function(opt_includeInstance) { + return proto.lugo.GameSnapshotResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lugo.GameSnapshotResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.GameSnapshotResponse.toObject = function(includeInstance, msg) { + var f, obj = { + gameSnapshot: (f = msg.getGameSnapshot()) && server_pb.GameSnapshot.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lugo.GameSnapshotResponse} + */ +proto.lugo.GameSnapshotResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lugo.GameSnapshotResponse; + return proto.lugo.GameSnapshotResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lugo.GameSnapshotResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lugo.GameSnapshotResponse} + */ +proto.lugo.GameSnapshotResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new server_pb.GameSnapshot; + reader.readMessage(value,server_pb.GameSnapshot.deserializeBinaryFromReader); + msg.setGameSnapshot(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lugo.GameSnapshotResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lugo.GameSnapshotResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lugo.GameSnapshotResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.GameSnapshotResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGameSnapshot(); + if (f != null) { + writer.writeMessage( + 1, + f, + server_pb.GameSnapshot.serializeBinaryToWriter + ); + } +}; + + +/** + * optional GameSnapshot game_snapshot = 1; + * @return {?proto.lugo.GameSnapshot} + */ +proto.lugo.GameSnapshotResponse.prototype.getGameSnapshot = function() { + return /** @type{?proto.lugo.GameSnapshot} */ ( + jspb.Message.getWrapperField(this, server_pb.GameSnapshot, 1)); +}; + + +/** + * @param {?proto.lugo.GameSnapshot|undefined} value + * @return {!proto.lugo.GameSnapshotResponse} returns this +*/ +proto.lugo.GameSnapshotResponse.prototype.setGameSnapshot = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.lugo.GameSnapshotResponse} returns this + */ +proto.lugo.GameSnapshotResponse.prototype.clearGameSnapshot = function() { + return this.setGameSnapshot(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.lugo.GameSnapshotResponse.prototype.hasGameSnapshot = function() { + return jspb.Message.getField(this, 1) != null; +}; + + goog.object.extend(exports, proto.lugo); diff --git a/dist/pb/server_pb.d.ts b/dist/pb/server_pb.d.ts index a788404..f8d9adb 100644 --- a/dist/pb/server_pb.d.ts +++ b/dist/pb/server_pb.d.ts @@ -182,6 +182,8 @@ export class Player extends jspb.Message { clearInitPosition(): void; getInitPosition(): physics_pb.Point | undefined; setInitPosition(value?: physics_pb.Point): Player; + getIsJumping(): boolean; + setIsJumping(value: boolean): Player; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Player.AsObject; @@ -200,6 +202,7 @@ export namespace Player { velocity?: physics_pb.Velocity.AsObject, teamSide: Team.Side, initPosition?: physics_pb.Point.AsObject, + isJumping: boolean, } } diff --git a/dist/pb/server_pb.js b/dist/pb/server_pb.js index 6c2db5a..3bb5f0e 100644 --- a/dist/pb/server_pb.js +++ b/dist/pb/server_pb.js @@ -1438,7 +1438,8 @@ proto.lugo.Player.toObject = function(includeInstance, msg) { position: (f = msg.getPosition()) && physics_pb.Point.toObject(includeInstance, f), velocity: (f = msg.getVelocity()) && physics_pb.Velocity.toObject(includeInstance, f), teamSide: jspb.Message.getFieldWithDefault(msg, 4, 0), - initPosition: (f = msg.getInitPosition()) && physics_pb.Point.toObject(includeInstance, f) + initPosition: (f = msg.getInitPosition()) && physics_pb.Point.toObject(includeInstance, f), + isJumping: jspb.Message.getBooleanFieldWithDefault(msg, 6, false) }; if (includeInstance) { @@ -1498,6 +1499,10 @@ proto.lugo.Player.deserializeBinaryFromReader = function(msg, reader) { reader.readMessage(value,physics_pb.Point.deserializeBinaryFromReader); msg.setInitPosition(value); break; + case 6: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsJumping(value); + break; default: reader.skipField(); break; @@ -1565,6 +1570,13 @@ proto.lugo.Player.serializeBinaryToWriter = function(message, writer) { physics_pb.Point.serializeBinaryToWriter ); } + f = message.getIsJumping(); + if (f) { + writer.writeBool( + 6, + f + ); + } }; @@ -1715,6 +1727,24 @@ proto.lugo.Player.prototype.hasInitPosition = function() { }; +/** + * optional bool is_jumping = 6; + * @return {boolean} + */ +proto.lugo.Player.prototype.getIsJumping = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.lugo.Player} returns this + */ +proto.lugo.Player.prototype.setIsJumping = function(value) { + return jspb.Message.setProto3BooleanField(this, 6, value); +}; + + diff --git a/package-lock.json b/package-lock.json index e8e09df..515d4fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,16 @@ { "name": "@lugobots/lugo4node", - "version": "2.0.2", + "version": "2.0.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@lugobots/lugo4node", - "version": "2.0.2", + "version": "2.0.6", "license": "ISC", "dependencies": { "@grpc/grpc-js": "^1.6.7", - "google-protobuf": "^3.20.1", + "google-protobuf": "^3.21.2", "process": "^0.11.10", "typescript": "^4.9.4" }, diff --git a/package.json b/package.json index 9519cbb..25a2740 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lugobots/lugo4node", - "version": "2.0.4", + "version": "2.0.6", "description": "Lugo4Node is a NodeJS implementation of a client player for [Lugo](https://lugobots.ai/) game.", "main": "dist/index.js", "scripts": { @@ -14,7 +14,7 @@ "license": "ISC", "dependencies": { "@grpc/grpc-js": "^1.6.7", - "google-protobuf": "^3.20.1", + "google-protobuf": "^3.21.2", "process": "^0.11.10", "typescript": "^4.9.4" }, diff --git a/src/game-snapshot-inspector.ts b/src/game-snapshot-inspector.ts index 17e40a8..b891ebc 100644 --- a/src/game-snapshot-inspector.ts +++ b/src/game-snapshot-inspector.ts @@ -97,7 +97,10 @@ export default class GameSnapshotInspector { } makeOrderMoveFromPoint(origin: Lugo.Point, target: Lugo.Point, speed: number): Lugo.Order { - const vec: Lugo.Vector = Geo.NewVector(origin, target); + let vec: Lugo.Vector = ORIENTATION.NORTH + if (Math.abs(distanceBetweenPoints(origin, target)) > 0) { + vec = Geo.NewVector(origin, target); + } const vel: Lugo.Velocity = Geo.NewZeroedVelocity(Geo.normalize(vec)); vel.setSpeed(speed); const moveOrder = new Lugo.Move() @@ -108,9 +111,6 @@ export default class GameSnapshotInspector { makeOrderMoveFromVector(direction: Lugo.Vector, speed: number): Lugo.Order { const origin = this.me?.getPosition() ?? Geo.newZeroedPoint(); const targetPoint: Lugo.Point = Geo.TargetFrom(direction, origin); - if (Math.abs(distanceBetweenPoints(targetPoint, direction)) == 0) { - return this.makeOrderMoveFromPoint(direction, new Lugo.Point(), 0); - } return this.makeOrderMoveFromPoint(origin, targetPoint, speed); } diff --git a/src/pb/remote_grpc_pb.d.ts b/src/pb/remote_grpc_pb.d.ts index 1e52fa8..6ee31b6 100644 --- a/src/pb/remote_grpc_pb.d.ts +++ b/src/pb/remote_grpc_pb.d.ts @@ -17,6 +17,8 @@ interface IRemoteService extends grpc.ServiceDefinition { @@ -82,6 +84,24 @@ interface IRemoteService_IResumeListeningPhase extends grpc.MethodDefinition; responseDeserialize: grpc.deserialize; } +interface IRemoteService_IResetPlayerPositions extends grpc.MethodDefinition { + path: "/lugo.Remote/ResetPlayerPositions"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} +interface IRemoteService_IGetGameSnapshot extends grpc.MethodDefinition { + path: "/lugo.Remote/GetGameSnapshot"; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} export const RemoteService: IRemoteService; @@ -93,6 +113,8 @@ export interface IRemoteServer extends grpc.UntypedServiceImplementation { setPlayerProperties: grpc.handleUnaryCall; setGameProperties: grpc.handleUnaryCall; resumeListeningPhase: grpc.handleUnaryCall; + resetPlayerPositions: grpc.handleUnaryCall; + getGameSnapshot: grpc.handleUnaryCall; } export interface IRemoteClient { @@ -117,6 +139,12 @@ export interface IRemoteClient { resumeListeningPhase(request: remote_pb.ResumeListeningRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; resumeListeningPhase(request: remote_pb.ResumeListeningRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; resumeListeningPhase(request: remote_pb.ResumeListeningRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; + resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + getGameSnapshot(request: remote_pb.GameSnapshotRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; + getGameSnapshot(request: remote_pb.GameSnapshotRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; + getGameSnapshot(request: remote_pb.GameSnapshotRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; } export class RemoteClient extends grpc.Client implements IRemoteClient { @@ -142,4 +170,10 @@ export class RemoteClient extends grpc.Client implements IRemoteClient { public resumeListeningPhase(request: remote_pb.ResumeListeningRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; public resumeListeningPhase(request: remote_pb.ResumeListeningRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; public resumeListeningPhase(request: remote_pb.ResumeListeningRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.ResumeListeningResponse) => void): grpc.ClientUnaryCall; + public resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + public resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + public resetPlayerPositions(request: remote_pb.ResetPlayerPositionsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.ResetPlayerPositionsResponse) => void): grpc.ClientUnaryCall; + public getGameSnapshot(request: remote_pb.GameSnapshotRequest, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; + public getGameSnapshot(request: remote_pb.GameSnapshotRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; + public getGameSnapshot(request: remote_pb.GameSnapshotRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall; } diff --git a/src/pb/remote_grpc_pb.js b/src/pb/remote_grpc_pb.js index 577c3d0..49ca4b8 100644 --- a/src/pb/remote_grpc_pb.js +++ b/src/pb/remote_grpc_pb.js @@ -39,6 +39,28 @@ function deserialize_lugo_GameProperties(buffer_arg) { return remote_pb.GameProperties.deserializeBinary(new Uint8Array(buffer_arg)); } +function serialize_lugo_GameSnapshotRequest(arg) { + if (!(arg instanceof remote_pb.GameSnapshotRequest)) { + throw new Error('Expected argument of type lugo.GameSnapshotRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_lugo_GameSnapshotRequest(buffer_arg) { + return remote_pb.GameSnapshotRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_lugo_GameSnapshotResponse(arg) { + if (!(arg instanceof remote_pb.GameSnapshotResponse)) { + throw new Error('Expected argument of type lugo.GameSnapshotResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_lugo_GameSnapshotResponse(buffer_arg) { + return remote_pb.GameSnapshotResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + function serialize_lugo_NextOrderRequest(arg) { if (!(arg instanceof remote_pb.NextOrderRequest)) { throw new Error('Expected argument of type lugo.NextOrderRequest'); @@ -83,6 +105,28 @@ function deserialize_lugo_PlayerProperties(buffer_arg) { return remote_pb.PlayerProperties.deserializeBinary(new Uint8Array(buffer_arg)); } +function serialize_lugo_ResetPlayerPositionsRequest(arg) { + if (!(arg instanceof remote_pb.ResetPlayerPositionsRequest)) { + throw new Error('Expected argument of type lugo.ResetPlayerPositionsRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_lugo_ResetPlayerPositionsRequest(buffer_arg) { + return remote_pb.ResetPlayerPositionsRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_lugo_ResetPlayerPositionsResponse(arg) { + if (!(arg instanceof remote_pb.ResetPlayerPositionsResponse)) { + throw new Error('Expected argument of type lugo.ResetPlayerPositionsResponse'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_lugo_ResetPlayerPositionsResponse(buffer_arg) { + return remote_pb.ResetPlayerPositionsResponse.deserializeBinary(new Uint8Array(buffer_arg)); +} + function serialize_lugo_ResumeListeningRequest(arg) { if (!(arg instanceof remote_pb.ResumeListeningRequest)) { throw new Error('Expected argument of type lugo.ResumeListeningRequest'); @@ -187,6 +231,28 @@ var RemoteService = exports.RemoteService = { responseSerialize: serialize_lugo_ResumeListeningResponse, responseDeserialize: deserialize_lugo_ResumeListeningResponse, }, + resetPlayerPositions: { + path: '/lugo.Remote/ResetPlayerPositions', + requestStream: false, + responseStream: false, + requestType: remote_pb.ResetPlayerPositionsRequest, + responseType: remote_pb.ResetPlayerPositionsResponse, + requestSerialize: serialize_lugo_ResetPlayerPositionsRequest, + requestDeserialize: deserialize_lugo_ResetPlayerPositionsRequest, + responseSerialize: serialize_lugo_ResetPlayerPositionsResponse, + responseDeserialize: deserialize_lugo_ResetPlayerPositionsResponse, + }, + getGameSnapshot: { + path: '/lugo.Remote/GetGameSnapshot', + requestStream: false, + responseStream: false, + requestType: remote_pb.GameSnapshotRequest, + responseType: remote_pb.GameSnapshotResponse, + requestSerialize: serialize_lugo_GameSnapshotRequest, + requestDeserialize: deserialize_lugo_GameSnapshotRequest, + responseSerialize: serialize_lugo_GameSnapshotResponse, + responseDeserialize: deserialize_lugo_GameSnapshotResponse, + }, }; exports.RemoteClient = grpc.makeGenericClientConstructor(RemoteService); diff --git a/src/pb/remote_pb.d.ts b/src/pb/remote_pb.d.ts index 94c14b5..f45037d 100644 --- a/src/pb/remote_pb.d.ts +++ b/src/pb/remote_pb.d.ts @@ -234,3 +234,83 @@ export namespace ResumeListeningResponse { export type AsObject = { } } + +export class ResetPlayerPositionsRequest extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResetPlayerPositionsRequest.AsObject; + static toObject(includeInstance: boolean, msg: ResetPlayerPositionsRequest): ResetPlayerPositionsRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResetPlayerPositionsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResetPlayerPositionsRequest; + static deserializeBinaryFromReader(message: ResetPlayerPositionsRequest, reader: jspb.BinaryReader): ResetPlayerPositionsRequest; +} + +export namespace ResetPlayerPositionsRequest { + export type AsObject = { + } +} + +export class ResetPlayerPositionsResponse extends jspb.Message { + + hasGameSnapshot(): boolean; + clearGameSnapshot(): void; + getGameSnapshot(): server_pb.GameSnapshot | undefined; + setGameSnapshot(value?: server_pb.GameSnapshot): ResetPlayerPositionsResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ResetPlayerPositionsResponse.AsObject; + static toObject(includeInstance: boolean, msg: ResetPlayerPositionsResponse): ResetPlayerPositionsResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ResetPlayerPositionsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ResetPlayerPositionsResponse; + static deserializeBinaryFromReader(message: ResetPlayerPositionsResponse, reader: jspb.BinaryReader): ResetPlayerPositionsResponse; +} + +export namespace ResetPlayerPositionsResponse { + export type AsObject = { + gameSnapshot?: server_pb.GameSnapshot.AsObject, + } +} + +export class GameSnapshotRequest extends jspb.Message { + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GameSnapshotRequest.AsObject; + static toObject(includeInstance: boolean, msg: GameSnapshotRequest): GameSnapshotRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GameSnapshotRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GameSnapshotRequest; + static deserializeBinaryFromReader(message: GameSnapshotRequest, reader: jspb.BinaryReader): GameSnapshotRequest; +} + +export namespace GameSnapshotRequest { + export type AsObject = { + } +} + +export class GameSnapshotResponse extends jspb.Message { + + hasGameSnapshot(): boolean; + clearGameSnapshot(): void; + getGameSnapshot(): server_pb.GameSnapshot | undefined; + setGameSnapshot(value?: server_pb.GameSnapshot): GameSnapshotResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GameSnapshotResponse.AsObject; + static toObject(includeInstance: boolean, msg: GameSnapshotResponse): GameSnapshotResponse.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GameSnapshotResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GameSnapshotResponse; + static deserializeBinaryFromReader(message: GameSnapshotResponse, reader: jspb.BinaryReader): GameSnapshotResponse; +} + +export namespace GameSnapshotResponse { + export type AsObject = { + gameSnapshot?: server_pb.GameSnapshot.AsObject, + } +} diff --git a/src/pb/remote_pb.js b/src/pb/remote_pb.js index 33ed6eb..be09f9d 100644 --- a/src/pb/remote_pb.js +++ b/src/pb/remote_pb.js @@ -23,10 +23,14 @@ goog.exportSymbol('proto.lugo.BallProperties', null, global); goog.exportSymbol('proto.lugo.CommandResponse', null, global); goog.exportSymbol('proto.lugo.CommandResponse.StatusCode', null, global); goog.exportSymbol('proto.lugo.GameProperties', null, global); +goog.exportSymbol('proto.lugo.GameSnapshotRequest', null, global); +goog.exportSymbol('proto.lugo.GameSnapshotResponse', null, global); goog.exportSymbol('proto.lugo.NextOrderRequest', null, global); goog.exportSymbol('proto.lugo.NextTurnRequest', null, global); goog.exportSymbol('proto.lugo.PauseResumeRequest', null, global); goog.exportSymbol('proto.lugo.PlayerProperties', null, global); +goog.exportSymbol('proto.lugo.ResetPlayerPositionsRequest', null, global); +goog.exportSymbol('proto.lugo.ResetPlayerPositionsResponse', null, global); goog.exportSymbol('proto.lugo.ResumeListeningRequest', null, global); goog.exportSymbol('proto.lugo.ResumeListeningResponse', null, global); /** @@ -218,6 +222,90 @@ if (goog.DEBUG && !COMPILED) { */ proto.lugo.ResumeListeningResponse.displayName = 'proto.lugo.ResumeListeningResponse'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lugo.ResetPlayerPositionsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lugo.ResetPlayerPositionsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lugo.ResetPlayerPositionsRequest.displayName = 'proto.lugo.ResetPlayerPositionsRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lugo.ResetPlayerPositionsResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lugo.ResetPlayerPositionsResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lugo.ResetPlayerPositionsResponse.displayName = 'proto.lugo.ResetPlayerPositionsResponse'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lugo.GameSnapshotRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lugo.GameSnapshotRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lugo.GameSnapshotRequest.displayName = 'proto.lugo.GameSnapshotRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lugo.GameSnapshotResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lugo.GameSnapshotResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lugo.GameSnapshotResponse.displayName = 'proto.lugo.GameSnapshotResponse'; +} @@ -1730,4 +1818,508 @@ proto.lugo.ResumeListeningResponse.serializeBinaryToWriter = function(message, w }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lugo.ResetPlayerPositionsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.lugo.ResetPlayerPositionsRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lugo.ResetPlayerPositionsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.ResetPlayerPositionsRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lugo.ResetPlayerPositionsRequest} + */ +proto.lugo.ResetPlayerPositionsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lugo.ResetPlayerPositionsRequest; + return proto.lugo.ResetPlayerPositionsRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lugo.ResetPlayerPositionsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lugo.ResetPlayerPositionsRequest} + */ +proto.lugo.ResetPlayerPositionsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lugo.ResetPlayerPositionsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lugo.ResetPlayerPositionsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lugo.ResetPlayerPositionsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.ResetPlayerPositionsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lugo.ResetPlayerPositionsResponse.prototype.toObject = function(opt_includeInstance) { + return proto.lugo.ResetPlayerPositionsResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lugo.ResetPlayerPositionsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.ResetPlayerPositionsResponse.toObject = function(includeInstance, msg) { + var f, obj = { + gameSnapshot: (f = msg.getGameSnapshot()) && server_pb.GameSnapshot.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lugo.ResetPlayerPositionsResponse} + */ +proto.lugo.ResetPlayerPositionsResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lugo.ResetPlayerPositionsResponse; + return proto.lugo.ResetPlayerPositionsResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lugo.ResetPlayerPositionsResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lugo.ResetPlayerPositionsResponse} + */ +proto.lugo.ResetPlayerPositionsResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new server_pb.GameSnapshot; + reader.readMessage(value,server_pb.GameSnapshot.deserializeBinaryFromReader); + msg.setGameSnapshot(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lugo.ResetPlayerPositionsResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lugo.ResetPlayerPositionsResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lugo.ResetPlayerPositionsResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.ResetPlayerPositionsResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGameSnapshot(); + if (f != null) { + writer.writeMessage( + 1, + f, + server_pb.GameSnapshot.serializeBinaryToWriter + ); + } +}; + + +/** + * optional GameSnapshot game_snapshot = 1; + * @return {?proto.lugo.GameSnapshot} + */ +proto.lugo.ResetPlayerPositionsResponse.prototype.getGameSnapshot = function() { + return /** @type{?proto.lugo.GameSnapshot} */ ( + jspb.Message.getWrapperField(this, server_pb.GameSnapshot, 1)); +}; + + +/** + * @param {?proto.lugo.GameSnapshot|undefined} value + * @return {!proto.lugo.ResetPlayerPositionsResponse} returns this +*/ +proto.lugo.ResetPlayerPositionsResponse.prototype.setGameSnapshot = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.lugo.ResetPlayerPositionsResponse} returns this + */ +proto.lugo.ResetPlayerPositionsResponse.prototype.clearGameSnapshot = function() { + return this.setGameSnapshot(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.lugo.ResetPlayerPositionsResponse.prototype.hasGameSnapshot = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lugo.GameSnapshotRequest.prototype.toObject = function(opt_includeInstance) { + return proto.lugo.GameSnapshotRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lugo.GameSnapshotRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.GameSnapshotRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lugo.GameSnapshotRequest} + */ +proto.lugo.GameSnapshotRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lugo.GameSnapshotRequest; + return proto.lugo.GameSnapshotRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lugo.GameSnapshotRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lugo.GameSnapshotRequest} + */ +proto.lugo.GameSnapshotRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lugo.GameSnapshotRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lugo.GameSnapshotRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lugo.GameSnapshotRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.GameSnapshotRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lugo.GameSnapshotResponse.prototype.toObject = function(opt_includeInstance) { + return proto.lugo.GameSnapshotResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lugo.GameSnapshotResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.GameSnapshotResponse.toObject = function(includeInstance, msg) { + var f, obj = { + gameSnapshot: (f = msg.getGameSnapshot()) && server_pb.GameSnapshot.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lugo.GameSnapshotResponse} + */ +proto.lugo.GameSnapshotResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lugo.GameSnapshotResponse; + return proto.lugo.GameSnapshotResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lugo.GameSnapshotResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lugo.GameSnapshotResponse} + */ +proto.lugo.GameSnapshotResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new server_pb.GameSnapshot; + reader.readMessage(value,server_pb.GameSnapshot.deserializeBinaryFromReader); + msg.setGameSnapshot(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lugo.GameSnapshotResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lugo.GameSnapshotResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lugo.GameSnapshotResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lugo.GameSnapshotResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGameSnapshot(); + if (f != null) { + writer.writeMessage( + 1, + f, + server_pb.GameSnapshot.serializeBinaryToWriter + ); + } +}; + + +/** + * optional GameSnapshot game_snapshot = 1; + * @return {?proto.lugo.GameSnapshot} + */ +proto.lugo.GameSnapshotResponse.prototype.getGameSnapshot = function() { + return /** @type{?proto.lugo.GameSnapshot} */ ( + jspb.Message.getWrapperField(this, server_pb.GameSnapshot, 1)); +}; + + +/** + * @param {?proto.lugo.GameSnapshot|undefined} value + * @return {!proto.lugo.GameSnapshotResponse} returns this +*/ +proto.lugo.GameSnapshotResponse.prototype.setGameSnapshot = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.lugo.GameSnapshotResponse} returns this + */ +proto.lugo.GameSnapshotResponse.prototype.clearGameSnapshot = function() { + return this.setGameSnapshot(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.lugo.GameSnapshotResponse.prototype.hasGameSnapshot = function() { + return jspb.Message.getField(this, 1) != null; +}; + + goog.object.extend(exports, proto.lugo); diff --git a/src/pb/server_pb.d.ts b/src/pb/server_pb.d.ts index a788404..f8d9adb 100644 --- a/src/pb/server_pb.d.ts +++ b/src/pb/server_pb.d.ts @@ -182,6 +182,8 @@ export class Player extends jspb.Message { clearInitPosition(): void; getInitPosition(): physics_pb.Point | undefined; setInitPosition(value?: physics_pb.Point): Player; + getIsJumping(): boolean; + setIsJumping(value: boolean): Player; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Player.AsObject; @@ -200,6 +202,7 @@ export namespace Player { velocity?: physics_pb.Velocity.AsObject, teamSide: Team.Side, initPosition?: physics_pb.Point.AsObject, + isJumping: boolean, } } diff --git a/src/pb/server_pb.js b/src/pb/server_pb.js index 6c2db5a..3bb5f0e 100644 --- a/src/pb/server_pb.js +++ b/src/pb/server_pb.js @@ -1438,7 +1438,8 @@ proto.lugo.Player.toObject = function(includeInstance, msg) { position: (f = msg.getPosition()) && physics_pb.Point.toObject(includeInstance, f), velocity: (f = msg.getVelocity()) && physics_pb.Velocity.toObject(includeInstance, f), teamSide: jspb.Message.getFieldWithDefault(msg, 4, 0), - initPosition: (f = msg.getInitPosition()) && physics_pb.Point.toObject(includeInstance, f) + initPosition: (f = msg.getInitPosition()) && physics_pb.Point.toObject(includeInstance, f), + isJumping: jspb.Message.getBooleanFieldWithDefault(msg, 6, false) }; if (includeInstance) { @@ -1498,6 +1499,10 @@ proto.lugo.Player.deserializeBinaryFromReader = function(msg, reader) { reader.readMessage(value,physics_pb.Point.deserializeBinaryFromReader); msg.setInitPosition(value); break; + case 6: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIsJumping(value); + break; default: reader.skipField(); break; @@ -1565,6 +1570,13 @@ proto.lugo.Player.serializeBinaryToWriter = function(message, writer) { physics_pb.Point.serializeBinaryToWriter ); } + f = message.getIsJumping(); + if (f) { + writer.writeBool( + 6, + f + ); + } }; @@ -1715,6 +1727,24 @@ proto.lugo.Player.prototype.hasInitPosition = function() { }; +/** + * optional bool is_jumping = 6; + * @return {boolean} + */ +proto.lugo.Player.prototype.getIsJumping = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.lugo.Player} returns this + */ +proto.lugo.Player.prototype.setIsJumping = function(value) { + return jspb.Message.setProto3BooleanField(this, 6, value); +}; + +