Release Healer Man 0.1.23
This commit is contained in:
1 parent
7f6001723a
commit
c4346751a9
9 files changed
+205
-23
No files matched your search
+52
-15
@@ -43,6 +43,7 @@ import {
|
||||
registerMobRuntime,
|
||||
updateMobRuntimePosition,
|
||||
} from "../game/mobRuntimeRegistry";
|
||||
import { combatHasLineOfSight } from "../game/combatSpatial";
|
||||
import { registerDungeonRuntimeReset } from "../game/dungeonRuntimeReset";
|
||||
import { scaledDungeonEnemyLevel } from "../game/dungeonLevelScaling";
|
||||
import { stepFearedMobAway } from "../game/mobMotion";
|
||||
@@ -76,6 +77,7 @@ import {
|
||||
} from "./mobAnimationCadence";
|
||||
import { useGameGLTF } from "./useGameGLTF";
|
||||
import { onlineSynchronizedMobTransform, requestOnlineInteraction } from "../game/onlineSessionRuntime";
|
||||
import { isMobAggroRangeVisible } from "./mobAggroRangeVisibility";
|
||||
|
||||
const MOVEMENT_LOCKING_MOB_STATUSES: ReadonlySet<string> = new Set([
|
||||
"stun", "root", "sleep", "knockdown", "freeze", "charm", "confuse",
|
||||
@@ -119,6 +121,7 @@ function mobTargetPosition(
|
||||
return getPartyRuntimePosition(targetActorId) ?? playerPosition;
|
||||
}
|
||||
const PROXIMITY_CHECK_INTERVAL = 0.3;
|
||||
const AGGRO_RANGE_VISIBILITY_CHECK_INTERVAL = 0.25;
|
||||
let preparedCreatureTemplates = new WeakMap<Object3D, Object3D>();
|
||||
let preparedCreatureTemplateRoots = new Set<Object3D>();
|
||||
registerDungeonRuntimeReset(() => {
|
||||
@@ -812,6 +815,54 @@ function usePopulationProximity(points: readonly MobVector3[]): boolean {
|
||||
return nearby;
|
||||
}
|
||||
|
||||
function MobAggroRangeRing({
|
||||
instanceId,
|
||||
aggroRange,
|
||||
boss,
|
||||
}: {
|
||||
readonly instanceId: string;
|
||||
readonly aggroRange: number;
|
||||
readonly boss: boolean;
|
||||
}) {
|
||||
const visibleRef = useRef(false);
|
||||
const [visible, setVisible] = useState(false);
|
||||
const elapsedRef = useRef(AGGRO_RANGE_VISIBILITY_CHECK_INTERVAL);
|
||||
|
||||
useFrame((_, delta) => {
|
||||
elapsedRef.current += delta;
|
||||
if (elapsedRef.current < AGGRO_RANGE_VISIBILITY_CHECK_INTERVAL) return;
|
||||
elapsedRef.current = 0;
|
||||
const playerPosition = useGameStore.getState().playerPosition;
|
||||
const mobPosition = getMobRuntimeTransform(instanceId)?.position;
|
||||
const nextVisible = Boolean(mobPosition && isMobAggroRangeVisible(
|
||||
playerPosition,
|
||||
mobPosition,
|
||||
combatHasLineOfSight,
|
||||
));
|
||||
if (nextVisible === visibleRef.current) return;
|
||||
visibleRef.current = nextVisible;
|
||||
setVisible(nextVisible);
|
||||
});
|
||||
|
||||
return (
|
||||
<mesh
|
||||
name={`mob-aggro-range-${instanceId}`}
|
||||
position={[0, 0.045, 0]}
|
||||
rotation={[Math.PI / 2, 0, 0]}
|
||||
renderOrder={2}
|
||||
visible={visible}
|
||||
>
|
||||
<torusGeometry args={[aggroRange, boss ? 0.075 : 0.05, 4, 56]} />
|
||||
<meshBasicMaterial
|
||||
color={boss ? "#e59a55" : "#c96b55"}
|
||||
transparent
|
||||
opacity={boss ? 0.62 : 0.5}
|
||||
depthWrite={false}
|
||||
/>
|
||||
</mesh>
|
||||
);
|
||||
}
|
||||
|
||||
function ProxyMob({
|
||||
definition,
|
||||
instanceId,
|
||||
@@ -960,21 +1011,7 @@ function ProxyMob({
|
||||
</AnimatedMobBody>
|
||||
|
||||
{showAggroRanges && gameMode === "dungeon" && mob && !dead && !mob.engaged ? (
|
||||
<mesh
|
||||
name={`mob-aggro-range-${instanceId}`}
|
||||
position={[0, 0.045, 0]}
|
||||
rotation={[Math.PI / 2, 0, 0]}
|
||||
renderOrder={2}
|
||||
>
|
||||
<torusGeometry args={[mob.aggroRange, boss ? 0.075 : 0.05, 4, 56]} />
|
||||
<meshBasicMaterial
|
||||
color={boss ? "#e59a55" : "#c96b55"}
|
||||
transparent
|
||||
opacity={boss ? 0.62 : 0.5}
|
||||
depthTest={false}
|
||||
depthWrite={false}
|
||||
/>
|
||||
</mesh>
|
||||
<MobAggroRangeRing instanceId={instanceId} aggroRange={mob.aggroRange} boss={boss} />
|
||||
) : null}
|
||||
|
||||
{boss && !dead ? (
|
||||
|
||||
Reference in new issue
Block a user