h1z1-server 0.45.4-0 → 0.45.4

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.45.4-0",
3
+ "version": "0.45.4",
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",
@@ -14,29 +14,29 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@types/js-yaml": "4.0.9",
17
- "@types/node": "22.14.1",
17
+ "@types/node": "22.15.17",
18
18
  "@types/ws": "8.18.1",
19
19
  "debug": "4.4.0",
20
20
  "h1emu-ai": "0.0.8",
21
21
  "h1emu-core": "1.3.2",
22
22
  "h1z1-dataschema": "1.9.0",
23
23
  "js-yaml": "4.1.0",
24
- "mongodb": "6.15.0",
24
+ "mongodb": "6.16.0",
25
25
  "recast-navigation": "0.34.0",
26
26
  "threads": "1.7.0",
27
27
  "typescript": "5.8.3",
28
- "ws": "8.18.1"
28
+ "ws": "8.18.2"
29
29
  },
30
30
  "directories": {
31
31
  "src": "./src"
32
32
  },
33
33
  "devDependencies": {
34
34
  "cross-env": "^7.0.3",
35
- "globals": "^16.0.0",
36
- "oxlint": "^0.16.6",
35
+ "globals": "^16.1.0",
36
+ "oxlint": "^0.16.9",
37
37
  "prettier": "^3.5.3",
38
- "tsx": "^4.19.3",
39
- "typedoc": "^0.28.2"
38
+ "tsx": "^4.19.4",
39
+ "typedoc": "^0.28.4"
40
40
  },
41
41
  "scripts": {
42
42
  "gen-packets-types": "tsx ./scripts/genPacketsNames.ts",
@@ -869,6 +869,36 @@ export const smeltingData: { [recipeId: number]: smeltRecipe } = {
869
869
  requiredAmount: 1
870
870
  }
871
871
  ]
872
+ },
873
+ 80: {
874
+ filterId: FilterIds.FURNACE,
875
+ rewardId: Items.METAL_BAR,
876
+ components: [
877
+ {
878
+ itemDefinitionId: Items.WEAPON_WILDSTYLE_AK47,
879
+ requiredAmount: 1
880
+ }
881
+ ]
882
+ },
883
+ 81: {
884
+ filterId: FilterIds.FURNACE,
885
+ rewardId: Items.METAL_BAR,
886
+ components: [
887
+ {
888
+ itemDefinitionId: Items.WEAPON_WILDSTYLE_AR,
889
+ requiredAmount: 1
890
+ }
891
+ ]
892
+ },
893
+ 82: {
894
+ filterId: FilterIds.FURNACE,
895
+ rewardId: Items.METAL_BAR,
896
+ components: [
897
+ {
898
+ itemDefinitionId: Items.WEAPON_WILDSTYLE_SHOTGUN,
899
+ requiredAmount: 1
900
+ }
901
+ ]
872
902
  }
873
903
  };
874
904
 
@@ -134,7 +134,7 @@ export class Plant extends ItemObject {
134
134
  characterId: this.characterId,
135
135
  effectId: Effects.EFX_Crop_Fertilizer,
136
136
  position: new Float32Array([pos[0], pos[1], pos[2], 1]),
137
- effectTime: 15
137
+ effectTime: 180
138
138
  }
139
139
  );
140
140
  }
@@ -14,8 +14,14 @@
14
14
  import { TemporaryEntity } from "./temporaryentity";
15
15
  import { ZoneServer2016 } from "../zoneserver";
16
16
  import { Plant } from "./plant";
17
+ import { DamageInfo } from "types/zoneserver";
18
+ import { Items, ConstructionPermissionIds } from "../models/enums";
19
+ import { ZoneClient2016 } from "../classes/zoneclient";
17
20
 
18
21
  export class PlantingDiameter extends TemporaryEntity {
22
+ /** The time (milliseconds) at which the PlantingDiameter was placed */
23
+ placementTime = Date.now();
24
+
19
25
  /** HashMap of the Plant occupying the seed slot */
20
26
  seedSlots: { [id: string]: Plant } = {};
21
27
 
@@ -46,4 +52,55 @@ export class PlantingDiameter extends TemporaryEntity {
46
52
  }
47
53
  return server.deleteEntity(this.characterId, server._temporaryObjects);
48
54
  }
55
+
56
+ OnPlayerSelect(server: ZoneServer2016, client: ZoneClient2016) {
57
+ if (this.canUndoPlacement(server, client)) {
58
+ this.destroy(server);
59
+ client.character.lootItem(
60
+ server,
61
+ server.generateItem(Items.GROUND_TILLER)
62
+ );
63
+ return;
64
+ }
65
+ }
66
+
67
+ OnMeleeHit(server: ZoneServer2016, damageInfo: DamageInfo) {
68
+ const client = server.getClientByCharId(damageInfo.entity),
69
+ weapon = client?.character.getEquippedWeapon();
70
+ if (!client || !weapon) return;
71
+ if (weapon.itemDefinitionId !== Items.WEAPON_HAMMER_DEMOLITION) return;
72
+ for (const a in server._constructionFoundations) {
73
+ const foundation = server._constructionFoundations[a];
74
+ if (
75
+ !foundation.getHasPermission(
76
+ server,
77
+ client.character.characterId,
78
+ ConstructionPermissionIds.DEMOLISH
79
+ )
80
+ )
81
+ return;
82
+ }
83
+
84
+ for (const plant of Object.values(this.seedSlots)) {
85
+ plant.destroy(server);
86
+ }
87
+ server.deleteEntity(this.characterId, server._temporaryObjects);
88
+ }
89
+
90
+ canUndoPlacement(server: ZoneServer2016, client: ZoneClient2016) {
91
+ const weapon = client.character.getEquippedWeapon();
92
+ if (!weapon) return false;
93
+ for (const a in server._constructionFoundations) {
94
+ const foundation = server._constructionFoundations[a];
95
+ return (
96
+ foundation.getHasPermission(
97
+ server,
98
+ client.character.characterId,
99
+ ConstructionPermissionIds.DEMOLISH
100
+ ) &&
101
+ Date.now() < this.placementTime + 120000 &&
102
+ weapon.itemDefinitionId == Items.WEAPON_HAMMER_DEMOLITION
103
+ );
104
+ }
105
+ }
49
106
  }
@@ -223,6 +223,7 @@ export class ProjectileEntity extends BaseLightweightCharacter {
223
223
  if (this.itemDefinitionId == Items.WEAPON_BOW_RECURVE)
224
224
  server.explosionDamage(this);
225
225
  if (this.itemDefinitionId == Items.GRENADE_GAS) {
226
+ if (server.isPvE) return;
226
227
  this.gasDamageInterval = setInterval(() => {
227
228
  for (const a in server._characters) {
228
229
  const character = server._characters[a];
@@ -422,24 +422,24 @@ export class WeatherManager extends EventEmitter {
422
422
  break;
423
423
  }
424
424
 
425
- this.fogAllowed = Math.random() < 0.33; // 33% chance for fog
425
+ this.fogAllowed = Math.random() < 0.2; // 20% chance for fog
426
426
  if (!this.lastDayWasFoggy && this.fogAllowed) {
427
427
  this.lastDayWasFoggy = true;
428
428
  const fogType = rnd_number(3, 1, true);
429
429
  switch (fogType) {
430
430
  case 1:
431
- this.desiredfogDensity = 0.0002;
431
+ this.desiredfogDensity = rnd_number(0.0002, 0.00008);
432
432
  this.desiredfogFloor = 120;
433
433
  this.desiredfogGradient = 0.02;
434
434
  break;
435
435
  case 2:
436
- this.desiredfogDensity = 0.0002;
436
+ this.desiredfogDensity = rnd_number(0.0002, 0.00008);
437
437
  this.desiredfogFloor = 160;
438
438
  this.desiredfogGradient = 0.02;
439
439
  if (this.desiredSkyColor < 0.5) this.desiredSkyColor = 0.5;
440
440
  break;
441
441
  case 3:
442
- this.desiredfogDensity = 0.0002;
442
+ this.desiredfogDensity = rnd_number(0.0002, 0.00008);
443
443
  this.desiredfogFloor = 200;
444
444
  this.desiredfogGradient = 0.02;
445
445
  this.desiredSkyColor = rnd_number(1, 0.5);
@@ -1090,6 +1090,7 @@ export class WorldDataManager {
1090
1090
  return {
1091
1091
  ...this.getBaseFullEntitySaveData(entity, serverId),
1092
1092
  seedSlots: slots,
1093
+ placementTime: entity.placementTime,
1093
1094
  fertilizedTimestamp: entity.fertilizedTimestamp,
1094
1095
  isFertilized: entity.isFertilized
1095
1096
  };
@@ -846,6 +846,9 @@ export enum Items {
846
846
  WEAPON_TOXIC_AK47 = 2480,
847
847
  WEAPON_TOXIC_SHOTGUN = 2446,
848
848
  WEAPON_SHOWDOWN_AR = 2781,
849
+ WEAPON_WILDSTYLE_AR = 2601,
850
+ WEAPON_WILDSTYLE_AK47 = 2600,
851
+ WEAPON_WILDSTYLE_SHOTGUN = 2597,
849
852
 
850
853
  //#endregion
851
854
 
@@ -7446,7 +7446,7 @@ export class ZoneServer2016 extends EventEmitter {
7446
7446
  plant.state.position[2],
7447
7447
  1
7448
7448
  ]),
7449
- effectTime: 15
7449
+ effectTime: 180
7450
7450
  }
7451
7451
  );
7452
7452
  });
@@ -162,6 +162,7 @@ export interface PlantingDiameterSaveData
162
162
  extends BaseFullEntitySaveData {
163
163
  seedSlots: { [id: string]: PlantSaveData };
164
164
  fertilizedTimestamp: number;
165
+ placementTime: number;
165
166
  isFertilized: boolean;
166
167
  }
167
168
 
@@ -184,4 +185,4 @@ export interface CharacterMetricsSaveData {
184
185
  startedSurvivingTP: number;
185
186
  vehiclesDestroyed: number;
186
187
  playersKilled: number;
187
- }
188
+ }
package/config.yaml DELETED
@@ -1,174 +0,0 @@
1
- server:
2
- welcomeMessage: "Welcome to H1emu! :D"
3
- adminMessage: "You are an Admin!"
4
- proximityItemsDistance: 2
5
- interactionDistance: 3
6
- charactersRenderDistance: 350
7
- tickRate: 2000
8
- worldRoutineRate: 10000
9
- enableLoginServerKickRequests: true
10
- rebootTime: 48 # hours (0 to disable)
11
- rebootWarnTime: 600 # seconds
12
- isPvE: false
13
- isHeadshotOnly: false
14
- isFirstPersonOnly: false
15
- isNoBuildInPois: true
16
- baseConstructionDamage: 34000
17
-
18
- # Rcon
19
-
20
- rcon:
21
- password: ""
22
- port: 0
23
-
24
- # VoiceChat
25
-
26
- voicechat:
27
- useVoiceChatV2: false
28
- joinVoiceChatOnConnect: false
29
- serverAccessToken: ""
30
-
31
- # Fairplay / anticheat config
32
-
33
- fairplay:
34
- useFairplay: true
35
- maxPing: 250
36
-
37
- # Removing an entry below will allow clients with a certain rejectionFlag to join
38
- # ex. Removing "5 # UNVERIFIED" will allow users with an unverified h1emu status to join
39
-
40
- # by default, globally banned, hwid banned, vpn detected, and unverified clients will have their
41
- # connections rejected
42
- acceptedRejectionTypes:
43
- # LOCAL_BAN, SERVER_LOCKED, and SERVER_REBOOT are always accepted
44
- - 2 # GLOBAL_BAN
45
- - 3 # VPN
46
- - 4 # HWID
47
- - 5 # UNVERIFIED
48
-
49
- useAssetValidation: true
50
- # how long the client has to send it's hashes before it's kicked (3 min default)
51
- hashSubmissionTimeout: 180000
52
-
53
- # clients with these packs are allowed to join, but they are optional (must be in numerical order)
54
- allowedPacks:
55
- #- file_name: ""
56
- # crc32_hash: ""
57
-
58
- # clients without these packs will be kicked (must be in numerical order)
59
- requiredPacks:
60
- #- file_name: ""
61
- # crc32_hash: ""
62
-
63
- weather:
64
- defaultTemplate: "h1emubaseweather"
65
- dynamicEnabled: true
66
-
67
- # Anything to do with loot, vehicle, and npc spawning / despawning
68
- worldobjects:
69
- # Respawn timers
70
-
71
- hasCustomLootRespawnTime: false
72
- lootRespawnTimer: 1200000 # 30 minutes
73
- vehicleRespawnTimer: 600000 # 10 minutes
74
- npcRespawnTimer: 600000 # 10 minutes
75
-
76
- # Despawn timers
77
-
78
- # Player dropped items on the ground
79
- itemDespawnTimer: 600000 # 10 minutes
80
- # Spawned objects on the ground
81
- lootDespawnTimer: 2400000 # 40 minutes
82
- deadNpcDespawnTimer: 600000 # 10 minutes
83
- lootbagDespawnTimer: 1800000 # 30 minutes
84
-
85
- # Misc
86
- minAirdropSurvivors: 10
87
- vehicleSpawnCap: 120
88
- # How far any other vehicle has to be for another to spawn
89
- vehicleSpawnRadius: 50
90
- # How far another spawned npc has to be for another to spawn
91
- npcSpawnRadius: 3
92
- chanceNpc: 100 # To be reworked: 100 max
93
- chanceScreamer: 5 # To be reworked: 1000 max
94
-
95
- chanceWornLetter: 1 # 100 max
96
-
97
- waterSourceRefillAmount: 2
98
- waterSourceReplenishTimer: 300000 # 5 minutes
99
-
100
- crowbarHitRewardChance: 20 # 100 max
101
- crowbarHitDamage: 10 # Default 25
102
-
103
- # Trees, blackberry bushes, and sticks
104
- speedtree:
105
- minBlackberryHarvest: 1
106
- maxBlackberryHarvest: 2
107
- # from blackberry bushes only
108
- branchHarvestChance: 0.1 # maximum of 1 for 100% chance
109
-
110
- minStickHarvest: 1
111
- maxStickHarvest: 2
112
-
113
- treeRespawnTimeMS: 1800000 # 30 minutes
114
- minWoodLogHarvest: 2
115
- maxWoodLogHarvest: 6
116
- minTreeHits: 12 # minimum hits it takes to chop a tree
117
- maxTreeHits: 20 # maximum hits it takes to chop a tree
118
-
119
- construction:
120
- # allowPOIPlacement: false - deprecated in favor of isNoBuildInPOIs ^
121
- allowStackedPlacement: false
122
- allowOutOfBoundsPlacement: false
123
- placementRange: 30
124
- spawnPointBlockedPlacementRange: 25
125
- vehicleSpawnPointBlockedPlacementRange: 30
126
- playerFoundationBlockedPlacementRange: 70
127
- playerShackBlockedPlacementRange: 20
128
-
129
- decay:
130
- decayTickInterval: 1200000 # 20 minutes per decay tick
131
- constructionDamageTicks: 3 # damage structures every hour
132
-
133
- # with default values it'll take 10 days for a base to fully decay
134
- ticksToFullDecay: 240 # how many decay ticks * constructionDamageTicks it takes to fully decay any construction entity.
135
-
136
- # unused for now but is planned
137
- worldFreeplaceDecayMultiplier: 2 # used to multiply decay damage for freeplace constuction with no parent
138
-
139
- ##### DEPRECATED - NO LONGER DOES ANYTHING #####
140
- baseConstructionDamage: 125000 # construction damage per required ticks
141
- repairBoxHealValue: 1000000 # heals base to full condition
142
- ##### #####
143
-
144
- vehicleDamageTicks: 3 # damage vehicles every hour
145
- vacantFoundationTicks: 3 # destroy empty foundations after 1 hour
146
- griefFoundationTimer: 72 # destroy grief foundations after 3 days (72 hours)
147
- griefCheckSlotAmount: 4 # must have a minimum of 4 wall slots to avoid anti-grief
148
- baseVehicleDamage: 2000 # 2% damage per 3 ticks (1 hour)
149
- maxVehiclesPerArea: 2 # the max amount of vehicles that can be in an area before they start taking more damage
150
- vehicleDamageRange: 25 # how large of a range to detect maxVehiclesPerArea
151
- dailyRepairMaterials:
152
- - itemDefinitionId: 16 # wood log
153
- requiredCount: 1
154
- - itemDefinitionId: 109 # wood plank
155
- requiredCount: 10
156
- - itemDefinitionId: 135 # nail
157
- requiredCount: 4
158
- - itemDefinitionId: 141 # metal bracket
159
- requiredCount: 4
160
- - itemDefinitionId: 46 # metal sheet
161
- requiredCount: 1
162
- - itemDefinitionId: 114 # metal shard
163
- requiredCount: 8
164
- - itemDefinitionId: 111 # wood stick
165
- requiredCount: 2
166
-
167
- smelting:
168
- burnTime: 120000 # consume fuel every 120 seconds
169
- smeltTime: 7000 # smelt 1 item every 7 seconds
170
- gametime:
171
- timeFrozen: false # Froze ingameTime
172
- nightTimeMultiplier: 2 # This way night time pass 2 times faster than daytime
173
- timeMultiplier: 36 # 1 hour IRL = 36 hours ingame, so 20 min for a full day
174
- baseTime: 6 # server ingameTime start at 6 AM, 18 = 6PM