@hytopia.com/examples 1.0.13 → 1.0.14
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,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"health": 130,
|
|
3
|
-
"currentRegionId": "stalkhaven",
|
|
3
|
+
"currentRegionId": "stalkhaven-port",
|
|
4
4
|
"skillExperience": [
|
|
5
5
|
[
|
|
6
6
|
"exploration",
|
|
@@ -131,10 +131,10 @@
|
|
|
131
131
|
}
|
|
132
132
|
]
|
|
133
133
|
},
|
|
134
|
-
"currentRegionSpawnFacingAngle":
|
|
134
|
+
"currentRegionSpawnFacingAngle": 180,
|
|
135
135
|
"currentRegionSpawnPoint": {
|
|
136
|
-
"x":
|
|
137
|
-
"y":
|
|
138
|
-
"z":
|
|
136
|
+
"x": -6,
|
|
137
|
+
"y": 8,
|
|
138
|
+
"z": -28
|
|
139
139
|
}
|
|
140
140
|
}
|
|
@@ -124,14 +124,14 @@ export default abstract class BaseWeaponItem extends BaseItem {
|
|
|
124
124
|
attack.reach,
|
|
125
125
|
);
|
|
126
126
|
|
|
127
|
-
if (target
|
|
127
|
+
if (target) {
|
|
128
128
|
const damage = this.calculateDamageWithVariance(attack.damage, attack.damageVariance);
|
|
129
129
|
this.dealDamage(target, damage, attackDirection, attack.knockbackForce);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
protected dealDamage(target: Entity, damage: number, knockbackDirection: Vector3Like, knockbackForce?: number): void {
|
|
134
|
-
if (!isDamageable(target)) {
|
|
134
|
+
if (!isDamageable(target) || target instanceof GamePlayerEntity) { // disabled instanceof for pvp support later.
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Quaternion } from 'hytopia';
|
|
2
2
|
import GameRegion from '../../GameRegion';
|
|
3
|
+
import Spawner from '../../systems/Spawner';
|
|
3
4
|
import PortalEntity from '../../entities/PortalEntity';
|
|
5
|
+
import type { WanderOptions } from '../../entities/BaseEntity';
|
|
4
6
|
|
|
7
|
+
// NPCs
|
|
5
8
|
import CapfolkVillagerEntity from '../../entities/npcs/CapfolkVillagerEntity';
|
|
6
9
|
import CaptainSpornEntity from './npcs/CaptainSpornEntity';
|
|
7
10
|
import CommanderMarkEntity from './npcs/CommanderMarkEntity';
|
|
@@ -28,6 +31,7 @@ export default class StalkhavenRegion extends GameRegion {
|
|
|
28
31
|
super.setup();
|
|
29
32
|
|
|
30
33
|
this._setupNPCs();
|
|
34
|
+
this._setupNPCSpawners();
|
|
31
35
|
this._setupPortals();
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -38,31 +42,38 @@ export default class StalkhavenRegion extends GameRegion {
|
|
|
38
42
|
(new CommanderMarkEntity({ facingAngle: 180 })).spawn(this.world, { x: 3, y: 3, z: 12 });
|
|
39
43
|
(new HealerMycelisEntity({ facingAngle: 180 })).spawn(this.world, { x: -13.5, y: 3, z: -30 });
|
|
40
44
|
(new MerchantFinnEntity({ facingAngle: 90 })).spawn(this.world, { x: 13, y: 3, z: 26.5 });
|
|
45
|
+
}
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
private _setupNPCSpawners(): void {
|
|
48
|
+
const wanderOptions: WanderOptions = {
|
|
49
|
+
idleMinMs: 5000,
|
|
50
|
+
idleMaxMs: 15000,
|
|
51
|
+
maxWanderRadius: 12,
|
|
52
|
+
moveOptions: {
|
|
53
|
+
moveCompletesWhenStuck: true,
|
|
54
|
+
moveStoppingDistance: 1,
|
|
55
|
+
}
|
|
56
|
+
}
|
|
51
57
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const capfolkVillagerSpawner = new Spawner({
|
|
59
|
+
groundCheckDistance: 10,
|
|
60
|
+
maxSpawns: 10,
|
|
61
|
+
spawnables: [
|
|
62
|
+
{ entityConstructor: CapfolkVillagerEntity, weight: 1, wanders: true, wanderOptions },
|
|
63
|
+
],
|
|
64
|
+
spawnRegions: [
|
|
65
|
+
{
|
|
66
|
+
min: { x: -24, y: 2, z: -29 },
|
|
67
|
+
max: { x: 29, y: 12, z: 38 },
|
|
68
|
+
weight: 1,
|
|
62
69
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
],
|
|
71
|
+
spawnIntervalMs: 60000,
|
|
72
|
+
world: this.world,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
capfolkVillagerSpawner.start(true);
|
|
76
|
+
}
|
|
66
77
|
|
|
67
78
|
private _setupPortals(): void {
|
|
68
79
|
const chitterForestPortal = new PortalEntity({
|