Skip to content

Commit

Permalink
Merge pull request #25 from lugobots/fix-protobuf-bug
Browse files Browse the repository at this point in the history
Fixes TypeError: reader.skipField is not a function
  • Loading branch information
rubens21 authored Apr 12, 2024
2 parents f21167f + f05f3c6 commit a82890b
Show file tree
Hide file tree
Showing 16 changed files with 1,625 additions and 15 deletions.
8 changes: 4 additions & 4 deletions dist/game-snapshot-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Expand Down
34 changes: 34 additions & 0 deletions dist/pb/remote_grpc_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ interface IRemoteService extends grpc.ServiceDefinition<grpc.UntypedServiceImple
setPlayerProperties: IRemoteService_ISetPlayerProperties;
setGameProperties: IRemoteService_ISetGameProperties;
resumeListeningPhase: IRemoteService_IResumeListeningPhase;
resetPlayerPositions: IRemoteService_IResetPlayerPositions;
getGameSnapshot: IRemoteService_IGetGameSnapshot;
}

interface IRemoteService_IPauseOrResume extends grpc.MethodDefinition<remote_pb.PauseResumeRequest, remote_pb.CommandResponse> {
Expand Down Expand Up @@ -82,6 +84,24 @@ interface IRemoteService_IResumeListeningPhase extends grpc.MethodDefinition<rem
responseSerialize: grpc.serialize<remote_pb.ResumeListeningResponse>;
responseDeserialize: grpc.deserialize<remote_pb.ResumeListeningResponse>;
}
interface IRemoteService_IResetPlayerPositions extends grpc.MethodDefinition<remote_pb.ResetPlayerPositionsRequest, remote_pb.ResetPlayerPositionsResponse> {
path: "/lugo.Remote/ResetPlayerPositions";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<remote_pb.ResetPlayerPositionsRequest>;
requestDeserialize: grpc.deserialize<remote_pb.ResetPlayerPositionsRequest>;
responseSerialize: grpc.serialize<remote_pb.ResetPlayerPositionsResponse>;
responseDeserialize: grpc.deserialize<remote_pb.ResetPlayerPositionsResponse>;
}
interface IRemoteService_IGetGameSnapshot extends grpc.MethodDefinition<remote_pb.GameSnapshotRequest, remote_pb.GameSnapshotResponse> {
path: "/lugo.Remote/GetGameSnapshot";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<remote_pb.GameSnapshotRequest>;
requestDeserialize: grpc.deserialize<remote_pb.GameSnapshotRequest>;
responseSerialize: grpc.serialize<remote_pb.GameSnapshotResponse>;
responseDeserialize: grpc.deserialize<remote_pb.GameSnapshotResponse>;
}

export const RemoteService: IRemoteService;

Expand All @@ -93,6 +113,8 @@ export interface IRemoteServer extends grpc.UntypedServiceImplementation {
setPlayerProperties: grpc.handleUnaryCall<remote_pb.PlayerProperties, remote_pb.CommandResponse>;
setGameProperties: grpc.handleUnaryCall<remote_pb.GameProperties, remote_pb.CommandResponse>;
resumeListeningPhase: grpc.handleUnaryCall<remote_pb.ResumeListeningRequest, remote_pb.ResumeListeningResponse>;
resetPlayerPositions: grpc.handleUnaryCall<remote_pb.ResetPlayerPositionsRequest, remote_pb.ResetPlayerPositionsResponse>;
getGameSnapshot: grpc.handleUnaryCall<remote_pb.GameSnapshotRequest, remote_pb.GameSnapshotResponse>;
}

export interface IRemoteClient {
Expand All @@ -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<grpc.CallOptions>, 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<grpc.CallOptions>, 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<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall;
}

export class RemoteClient extends grpc.Client implements IRemoteClient {
Expand All @@ -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<grpc.CallOptions>, 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<grpc.CallOptions>, 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<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: remote_pb.GameSnapshotResponse) => void): grpc.ClientUnaryCall;
}
66 changes: 66 additions & 0 deletions dist/pb/remote_grpc_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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);
80 changes: 80 additions & 0 deletions dist/pb/remote_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
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<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
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<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
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<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
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,
}
}
Loading

0 comments on commit a82890b

Please sign in to comment.