forked from phenom/healer-man
Release Healer Man 0.1.5
This commit is contained in:
1 parent
f4c9cf356c
commit
55cfd43d66
62 files changed
+3030
-153
No files matched your search
@@ -1146,9 +1146,10 @@ function RoamingPack({
|
||||
const cleanups = definition.members.map((member, index) => registerMobRuntime(
|
||||
`${definition.id}:${member.id}`,
|
||||
scratchPositions[index],
|
||||
Math.atan2(scratchForwards[index][0], scratchForwards[index][2]),
|
||||
));
|
||||
return () => cleanups.forEach((cleanup) => cleanup());
|
||||
}, [definition.id, definition.members, scratchPositions]);
|
||||
}, [definition.id, definition.members, scratchForwards, scratchPositions]);
|
||||
|
||||
useFrame((_, delta) => {
|
||||
if (!nearby) return;
|
||||
@@ -1242,16 +1243,18 @@ function RoamingPack({
|
||||
chasePosition[1] = patrolPosition[1];
|
||||
chasePosition[2] = patrolPosition[2];
|
||||
}
|
||||
const yaw = Math.atan2(forward[0], forward[2]);
|
||||
updateMobRuntimePosition(
|
||||
instanceId,
|
||||
position[0],
|
||||
position[1],
|
||||
position[2],
|
||||
yaw,
|
||||
);
|
||||
const object = memberRefs.current[index];
|
||||
if (!object) continue;
|
||||
object.position.set(position[0], position[1], position[2]);
|
||||
object.rotation.y = Math.atan2(forward[0], forward[2]);
|
||||
object.rotation.y = yaw;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1298,7 +1301,7 @@ function StaticPopulationMember({ spawn, entities, active, showLabels, useOrigin
|
||||
const entity = entities[spawn.entityId];
|
||||
const groupRef = useRef<Group>(null);
|
||||
const positionRef = useRef<MutableMobVector3>([...spawn.position]);
|
||||
useEffect(() => registerMobRuntime(spawn.id, spawn.position), [spawn.id, spawn.position]);
|
||||
useEffect(() => registerMobRuntime(spawn.id, spawn.position, spawn.yaw ?? 0), [spawn.id, spawn.position, spawn.yaw]);
|
||||
useFrame((_, delta) => {
|
||||
const mob = useCombatStore.getState().mobs[spawn.id];
|
||||
const position = positionRef.current;
|
||||
@@ -1334,7 +1337,6 @@ function StaticPopulationMember({ spawn, entities, active, showLabels, useOrigin
|
||||
position[1] = spawn.position[1];
|
||||
position[2] = spawn.position[2];
|
||||
}
|
||||
updateMobRuntimePosition(spawn.id, position[0], position[1], position[2]);
|
||||
if (groupRef.current) {
|
||||
groupRef.current.position.set(position[0], position[1], position[2]);
|
||||
if (mob?.engaged) {
|
||||
@@ -1345,6 +1347,13 @@ function StaticPopulationMember({ spawn, entities, active, showLabels, useOrigin
|
||||
);
|
||||
}
|
||||
}
|
||||
updateMobRuntimePosition(
|
||||
spawn.id,
|
||||
position[0],
|
||||
position[1],
|
||||
position[2],
|
||||
groupRef.current?.rotation.y ?? spawn.yaw ?? 0,
|
||||
);
|
||||
});
|
||||
if (!entity) return null;
|
||||
|
||||
|
||||
Reference in new issue
Block a user