New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gathertown/gather-game-common

Package Overview
Dependencies
Maintainers
3
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gathertown/gather-game-common - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

2

dist/src/config.js

@@ -5,4 +5,4 @@ "use strict";

exports.config = {
gameServerProtocolVersion: 11,
gameServerProtocolVersion: 10
};
//# sourceMappingURL=config.js.map
import { NetworkSchema } from "./NetworkGameStateCodec";
import { Position } from "./Position";
export declare type Player = {

@@ -10,2 +9,3 @@ x: number;

sprite: number;
distanceThreshold: number;
ghost: number;

@@ -72,5 +72,4 @@ map: string;

export declare function oppositeMoveDirection(direction: MoveDirection): MoveDirection | null;
export declare const positionAfterMove: (start: Position, dir: MoveDirection | null, dist?: number) => Position;
export declare function nextSpriteDirection(current: SpriteDirection, direction: MoveDirection): SpriteDirection;
export declare function directionToFacePlayer(player: Player, target: Player): MoveDirection | null;
export declare function whisperIdToColor(id: string): string;
"use strict";
var _a, _b;
exports.__esModule = true;
exports.whisperIdToColor = exports.directionToFacePlayer = exports.nextSpriteDirection = exports.positionAfterMove = exports.oppositeMoveDirection = exports.TEMPORARY_EMOTES = exports.EMOTE_SHORTCUTS = exports.EMOTE_EMOJIS = exports.Emote = exports.MoveDirection = exports.SpriteDirection = exports.PlayerNetworkSchema = void 0;
exports.whisperIdToColor = exports.directionToFacePlayer = exports.nextSpriteDirection = exports.oppositeMoveDirection = exports.TEMPORARY_EMOTES = exports.EMOTE_SHORTCUTS = exports.EMOTE_EMOJIS = exports.Emote = exports.MoveDirection = exports.SpriteDirection = exports.PlayerNetworkSchema = void 0;
var NetworkGameStateCodec_1 = require("./NetworkGameStateCodec");

@@ -18,2 +18,3 @@ var Position_1 = require("./Position");

{ id: "sprite", type: NetworkGameStateCodec_1.NetworkType.UINT16 },
{ id: "distanceThreshold", type: NetworkGameStateCodec_1.NetworkType.UINT8 },
{ id: "spotlighted", type: NetworkGameStateCodec_1.NetworkType.UINT8 },

@@ -31,3 +32,3 @@ { id: "emote", type: NetworkGameStateCodec_1.NetworkType.UINT8 },

],
deltaKeys: ["x", "y", "direction", "ghost", "lastInputId", "activelySpeaking"],
deltaKeys: ["x", "y", "direction", "ghost", "lastInputId", "activelySpeaking"]
};

@@ -106,19 +107,2 @@ var SpriteDirection;

exports.oppositeMoveDirection = oppositeMoveDirection;
var positionAfterMove = function (start, dir, dist) {
if (dist === void 0) { dist = 1; }
var x = start.x, y = start.y;
switch (dir) {
case MoveDirection.Left:
return { x: x - dist, y: y };
case MoveDirection.Right:
return { x: x + dist, y: y };
case MoveDirection.Up:
return { x: x, y: y - dist };
case MoveDirection.Down:
return { x: x, y: y + dist };
default:
return start;
}
};
exports.positionAfterMove = positionAfterMove;
// Returns the next SpriteDirection to use after applying the given MoveDirection.

@@ -125,0 +109,0 @@ function nextSpriteDirection(current, direction) {

@@ -0,1 +1,2 @@

import { MoveDirection } from "./Player";
export interface Position {

@@ -5,2 +6,3 @@ readonly x: number;

}
export declare const positionAfterMove: (start: Position, dir: MoveDirection | null, dist?: number) => Position;
export declare const isPosEqual: (a: Position, b: Position) => boolean;

@@ -7,0 +9,0 @@ export declare function serializePosition(p: Position): string;

"use strict";
exports.__esModule = true;
exports.isPosWithinRect = exports.euclideanDistance = exports.manhattanDistance = exports.deserializePosition = exports.serializePosition = exports.isPosEqual = void 0;
exports.isPosWithinRect = exports.euclideanDistance = exports.manhattanDistance = exports.deserializePosition = exports.serializePosition = exports.isPosEqual = exports.positionAfterMove = void 0;
var Player_1 = require("./Player");
var positionAfterMove = function (start, dir, dist) {
if (dist === void 0) { dist = 1; }
var x = start.x, y = start.y;
switch (dir) {
case Player_1.MoveDirection.Left:
return { x: x - dist, y: y };
case Player_1.MoveDirection.Right:
return { x: x + dist, y: y };
case Player_1.MoveDirection.Up:
return { x: x, y: y - dist };
case Player_1.MoveDirection.Down:
return { x: x, y: y + dist };
default:
return start;
}
};
exports.positionAfterMove = positionAfterMove;
var isPosEqual = function (a, b) {

@@ -5,0 +23,0 @@ return a.x === b.x && a.y === b.y;

{
"name": "@gathertown/gather-game-common",
"version": "3.0.0",
"version": "4.0.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/src/index.js",

export const config = {
gameServerProtocolVersion: 11,
gameServerProtocolVersion: 10,
};
import { NetworkType, NetworkSchema } from "./NetworkGameStateCodec";
import { Position, manhattanDistance } from "./Position";
import { manhattanDistance } from "./Position";

@@ -11,2 +11,3 @@ export type Player = {

sprite: number;
distanceThreshold: number;
ghost: number;

@@ -35,2 +36,3 @@ map: string;

{ id: "sprite", type: NetworkType.UINT16 },
{ id: "distanceThreshold", type: NetworkType.UINT8 },
{ id: "spotlighted", type: NetworkType.UINT8 },

@@ -127,22 +129,2 @@ { id: "emote", type: NetworkType.UINT8 },

export const positionAfterMove = (
start: Position,
dir: MoveDirection | null,
dist = 1,
): Position => {
const { x, y } = start;
switch (dir) {
case MoveDirection.Left:
return { x: x - dist, y };
case MoveDirection.Right:
return { x: x + dist, y };
case MoveDirection.Up:
return { x, y: y - dist };
case MoveDirection.Down:
return { x, y: y + dist };
default:
return start;
}
};
// Returns the next SpriteDirection to use after applying the given MoveDirection.

@@ -149,0 +131,0 @@ export function nextSpriteDirection(

@@ -0,1 +1,3 @@

import { MoveDirection } from "./Player";
export interface Position {

@@ -6,2 +8,22 @@ readonly x: number;

export const positionAfterMove = (
start: Position,
dir: MoveDirection | null,
dist = 1,
): Position => {
const { x, y } = start;
switch (dir) {
case MoveDirection.Left:
return { x: x - dist, y };
case MoveDirection.Right:
return { x: x + dist, y };
case MoveDirection.Up:
return { x, y: y - dist };
case MoveDirection.Down:
return { x, y: y + dist };
default:
return start;
}
};
export const isPosEqual = (a: Position, b: Position): boolean => {

@@ -8,0 +30,0 @@ return a.x === b.x && a.y === b.y;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc