h1z1-server 0.47.4-8 → 0.47.4-9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "h1z1-server",
3
- "version": "0.47.4-8",
3
+ "version": "0.47.4-9",
4
4
  "description": "Library for emulating h1z1 servers",
5
5
  "author": "Quentin Gruber <quentingruber@gmail.com> (http://github.com/quentingruber)",
6
6
  "license": "GPL-3.0-only",
@@ -22,7 +22,6 @@ import {
22
22
  fixEulerOrder,
23
23
  getConstructionSlotId,
24
24
  getDistance,
25
- isPosInPoi,
26
25
  isPosInRadius,
27
26
  isPosInRadiusWithY,
28
27
  movePoint
@@ -380,6 +379,7 @@ export class ConstructionManager {
380
379
  return false;
381
380
  }
382
381
  detectPOIPlacement(
382
+ server: ZoneServer2016,
383
383
  itemDefinitionId: number,
384
384
  position: Float32Array,
385
385
  client: Client,
@@ -388,7 +388,7 @@ export class ConstructionManager {
388
388
  if (client.isDebugMode) return false;
389
389
  if (this.overridePlacementItems.includes(itemDefinitionId)) return false;
390
390
 
391
- const isInPoi = isPosInPoi(position);
391
+ const isInPoi = server.isPosInPoi(position);
392
392
  // allow placement in poi if object is parented to a foundation
393
393
  if (isInPoi && !isInsidePermissionedFoundation) {
394
394
  return true;
@@ -447,6 +447,7 @@ export class ConstructionManager {
447
447
  if (
448
448
  server.isNoBuildInPois &&
449
449
  this.detectPOIPlacement(
450
+ server,
450
451
  itemDefinitionId,
451
452
  position,
452
453
  client,
@@ -15,7 +15,7 @@ import { setInterval } from "timers";
15
15
  import { ZoneServer2016 } from "../zoneserver";
16
16
  import { AccountItems } from "../models/enums";
17
17
  import { ZoneClient2016 } from "../classes/zoneclient";
18
- import { isHalloween, isPosInPoi } from "../../../utils/utils";
18
+ import { isHalloween } from "../../../utils/utils";
19
19
 
20
20
  interface Reward {
21
21
  itemId: AccountItems;
@@ -194,7 +194,7 @@ export class RewardManager {
194
194
  if (
195
195
  client.character.playTime - client.character.lastDropPlaytime >
196
196
  (isHalloween() ? 60 : 120) &&
197
- isPosInPoi(client.character.state.position)
197
+ this.server.isPosInPoi(client.character.state.position)
198
198
  ) {
199
199
  this.dropPlayTimeReward(client);
200
200
  }
@@ -105,7 +105,8 @@ import {
105
105
  flhash,
106
106
  getDateString,
107
107
  chance,
108
- quat2heading
108
+ quat2heading,
109
+ isInsideSquare
109
110
  } from "../../utils/utils";
110
111
 
111
112
  import { Db, MongoClient, WithId } from "mongodb";
@@ -9893,6 +9894,27 @@ export class ZoneServer2016 extends EventEmitter {
9893
9894
  isBattleRoyale(): boolean {
9894
9895
  return this.gameMode > 0;
9895
9896
  }
9897
+
9898
+ isPosInPoi(position: Float32Array): boolean {
9899
+ let isInPoi = false;
9900
+ Z1_POIs.forEach((point: any) => {
9901
+ let useRange = true;
9902
+ if (point.bounds) {
9903
+ useRange = false;
9904
+ point.bounds.forEach((bound: any) => {
9905
+ if (isInsideSquare([position[0], position[2]], bound)) {
9906
+ isInPoi = true;
9907
+ return;
9908
+ }
9909
+ });
9910
+ }
9911
+ if (useRange && isPosInRadius(point.range, position, point.position)) {
9912
+ isInPoi = true;
9913
+ }
9914
+ });
9915
+
9916
+ return isInPoi;
9917
+ }
9896
9918
  }
9897
9919
 
9898
9920
  if (process.env.VSCODE_DEBUG === "true") {
@@ -34,7 +34,6 @@ import { ZoneClient2016 } from "servers/ZoneServer2016/classes/zoneclient";
34
34
  import * as crypto from "crypto";
35
35
  import { ZoneClient } from "servers/ZoneServer2015/classes/zoneclient";
36
36
  import { ConstructionDoor } from "../servers/ZoneServer2016/entities/constructiondoor";
37
- import { PluginManager } from "../servers/ZoneServer2016/managers/pluginmanager";
38
37
 
39
38
  const startTime = Date.now();
40
39
 
@@ -1685,28 +1684,6 @@ export function luck(l: number) {
1685
1684
  return Math.floor(Math.random() * l) === 0;
1686
1685
  }
1687
1686
 
1688
- const Z1_POIs = PluginManager.loadServerData("2016/zoneData/Z1_POIs");
1689
- export function isPosInPoi(position: Float32Array): boolean {
1690
- let isInPoi = false;
1691
- Z1_POIs.forEach((point: any) => {
1692
- let useRange = true;
1693
- if (point.bounds) {
1694
- useRange = false;
1695
- point.bounds.forEach((bound: any) => {
1696
- if (isInsideSquare([position[0], position[2]], bound)) {
1697
- isInPoi = true;
1698
- return;
1699
- }
1700
- });
1701
- }
1702
- if (useRange && isPosInRadius(point.range, position, point.position)) {
1703
- isInPoi = true;
1704
- }
1705
- });
1706
-
1707
- return isInPoi;
1708
- }
1709
-
1710
1687
  export function chance(chanceNum: number): boolean {
1711
1688
  return Math.random() * 1000 < chanceNum;
1712
1689
  }