gaesup-world 0.8.38 → 0.8.41

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.
@@ -13,7 +13,6 @@ import { useKeyboardControls } from "@react-three/drei";
13
13
  import { vec3 } from "@react-three/rapier";
14
14
  import { useCallback, useContext, useEffect, useMemo } from "react";
15
15
  import * as THREE from "three";
16
- import { V3 } from "../../utils";
17
16
  import { update } from "../../utils/context";
18
17
  import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
19
18
  export default function initControllerProps(props) {
@@ -47,32 +46,6 @@ export default function initControllerProps(props) {
47
46
  });
48
47
  }
49
48
  }, [context === null || context === void 0 ? void 0 : context.mode.controller, keyControl, context === null || context === void 0 ? void 0 : context.control]);
50
- // autoStart
51
- useEffect(function () {
52
- if (context === null || context === void 0 ? void 0 : context.clickerOption.autoStart) {
53
- var u = context === null || context === void 0 ? void 0 : context.activeState.position;
54
- var v = context === null || context === void 0 ? void 0 : context.clickerOption.queue.shift();
55
- if (context === null || context === void 0 ? void 0 : context.clickerOption.loop) {
56
- context === null || context === void 0 ? void 0 : context.clickerOption.queue.push(v);
57
- }
58
- var newAngle = Math.atan2(v.z - u.z, v.x - u.x);
59
- context.clicker.angle = newAngle;
60
- context.clicker.point = V3(v.x, 0, v.z);
61
- context.clicker.isOn = true;
62
- }
63
- dispatch({
64
- type: "update",
65
- payload: {
66
- clicker: __assign({}, context === null || context === void 0 ? void 0 : context.clicker),
67
- clickerOption: __assign({}, context === null || context === void 0 ? void 0 : context.clickerOption),
68
- },
69
- });
70
- }, [
71
- context === null || context === void 0 ? void 0 : context.clicker,
72
- context,
73
- context === null || context === void 0 ? void 0 : context.clickerOption,
74
- context === null || context === void 0 ? void 0 : context.clickerOption.autoStart,
75
- ]);
76
49
  var groundRay = useMemo(function () {
77
50
  return {
78
51
  origin: vec3(),
@@ -18,10 +18,10 @@ import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/contex
18
18
  export function GaeSupProps(_a) {
19
19
  var _b = _a.type, type = _b === void 0 ? "normal" : _b, text = _a.text, position = _a.position, children = _a.children;
20
20
  var groupRef = useRef(null);
21
- var minimap = useContext(GaesupWorldContext).minimap;
21
+ var _c = useContext(GaesupWorldContext), minimap = _c.minimap, activeState = _c.activeState, clickerOption = _c.clickerOption;
22
22
  var dispatch = useContext(GaesupWorldDispatchContext);
23
23
  // clicker
24
- var _c = useClicker(), moveClicker = _c.moveClicker, moveDoubleClicker = _c.moveDoubleClicker;
24
+ var _d = useClicker(), moveClicker = _d.moveClicker, moveDoubleClicker = _d.moveDoubleClicker;
25
25
  useEffect(function () {
26
26
  if (groupRef.current) {
27
27
  var box = new THREE.Box3().setFromObject(groupRef.current);
@@ -2,7 +2,7 @@ import { vec3 } from "@react-three/rapier";
2
2
  import { calcNorm } from "../../utils";
3
3
  export default function stop(prop) {
4
4
  var _a;
5
- var rigidBodyRef = prop.rigidBodyRef, _b = prop.worldContext, control = _b.control, clicker = _b.clicker, mode = _b.mode, clickerOption = _b.clickerOption, activeState = _b.activeState, dispatch = prop.dispatch;
5
+ var rigidBodyRef = prop.rigidBodyRef, _b = prop.worldContext, control = _b.control, clicker = _b.clicker, mode = _b.mode, clickerOption = _b.clickerOption, activeState = _b.activeState;
6
6
  var keyS = control.keyS;
7
7
  if (keyS && mode.controller === "clicker") {
8
8
  clicker.isOn = false;
@@ -11,7 +11,7 @@ export default function stop(prop) {
11
11
  // 목적지 도착 (클리커 막기 로직)
12
12
  var u = vec3((_a = rigidBodyRef.current) === null || _a === void 0 ? void 0 : _a.translation());
13
13
  var norm = calcNorm(u, clicker.point, false);
14
- if (norm < 1 && mode.controller === "clicker") {
14
+ if ((norm < 1 || clickerOption.autoStart) && mode.controller === "clicker") {
15
15
  if (clickerOption.track && clickerOption.queue.length !== 0) {
16
16
  clicker.point = clickerOption.queue.shift();
17
17
  var v = vec3(clicker.point);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaesup-world",
3
- "version": "0.8.38",
3
+ "version": "0.8.41",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",