@zardoy/flying-squid 0.0.87 → 0.0.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.entity = exports.server = void 0;
4
+ const isPlayer = (arg) => arg.type === 'player';
4
5
  const server = function (serv) {
5
6
  let ticking = false;
6
7
  serv.on('tick', function (delta) {
@@ -26,10 +27,17 @@ const server = function (serv) {
26
27
  players[0].collect(entity);
27
28
  }
28
29
  }
30
+ // if (isPlayer(entity) && entity.isFake && !entity.size) {
31
+ // entity.size = new Vec3(0.6, 1.8, 0.6)
32
+ // entity.gravity = new Vec3(0, -20, 0)
33
+ // entity.friction = new Vec3(0.6, 0.6, 0.6)
34
+ // entity.terminalvelocity = new Vec3(27, 27, 27)
35
+ // }
29
36
  if (!entity.velocity || !entity.size)
30
37
  return;
31
38
  const { position, onGround } = await entity.calculatePhysics(delta);
32
39
  if (entity.type === 'mob' ||
40
+ entity.type === 'player' ||
33
41
  (entity.type === 'object' &&
34
42
  (entity.velocity.x !== 0 ||
35
43
  entity.velocity.y !== 0 ||
@@ -1,10 +1,11 @@
1
+ import { Vec3 } from 'vec3';
1
2
  export declare const entity: (entity: Entity, serv: Server, { version }: Options) => void;
2
3
  export declare const server: (serv: Server) => void;
3
4
  declare global {
4
5
  interface Entity {
5
6
  /** Gravity of entity (non-players) to calculate physics. */
6
- gravity: any;
7
+ gravity: Vec3;
7
8
  /** Decreases velocity when touching blocks */
8
- friction: any;
9
+ friction: Vec3;
9
10
  }
10
11
  }
@@ -50,7 +50,7 @@ const player = function (player, serv) {
50
50
  player.gameMode = serv.gameMode;
51
51
  player.prevGameMode = player.gameMode;
52
52
  player.findSpawnPoint = async () => {
53
- player.spawnPoint = await serv.getSpawnPoint(player.world);
53
+ player.spawnPoint ??= await serv.getSpawnPoint(player.world);
54
54
  };
55
55
  player._client.on('settings', ({ viewDistance }) => {
56
56
  player.view = viewDistance;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zardoy/flying-squid",
3
3
  "description": "A minecraft server written in TS",
4
- "version": "0.0.87",
4
+ "version": "0.0.88",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "bin": "dist/app.js",