@rpgjs/action-battle 5.0.0-beta.1 → 5.0.0-beta.3

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,333 +1,303 @@
1
- import { defineModule, Control } from "@rpgjs/common";
2
- import { normalizeActionBattleOptions } from "./index8.js";
3
- import { manhattanDistance, parseAoeMask } from "./index9.js";
4
- const RpgEvent = null;
5
- const DEFAULT_KNOCKBACK = null;
6
- const ACTION_BATTLE_ACTION_BAR_GUI_ID = "action-battle-action-bar";
7
- const DEFAULT_PLAYER_ATTACK_HITBOXES = {
8
- up: { offsetX: -16, offsetY: -48, width: 32, height: 32 },
9
- down: { offsetX: -16, offsetY: 16, width: 32, height: 32 },
10
- left: { offsetX: -48, offsetY: -16, width: 32, height: 32 },
11
- right: { offsetX: 16, offsetY: -16, width: 32, height: 32 },
12
- default: { offsetX: 0, offsetY: -32, width: 32, height: 32 }
13
- };
14
- function getPlayerWeaponKnockbackForce(player) {
15
- try {
16
- const equipments = player.equipments?.() || [];
17
- for (const item of equipments) {
18
- const itemData = player.databaseById?.(item.id());
19
- if (itemData?._type === "weapon" && itemData.knockbackForce !== void 0) {
20
- return itemData.knockbackForce;
21
- }
22
- }
23
- } catch {
24
- }
25
- return DEFAULT_KNOCKBACK.force;
1
+ import { actionBattleTargetingState, actionBattleUiOptions, moveTargetingOffset, startTargeting, stopTargeting } from "./index3.js";
2
+ import { RpgClientEngine, inject } from "@rpgjs/client";
3
+ import { DOMContainer, DOMElement, DOMSprite, computed, cond, effect, h, loop, signal, useDefineProps, useProps } from "canvasengine";
4
+ //#region src/components/action-bar.ce
5
+ if (typeof document !== "undefined" && !document.getElementById("ce-style--home-runner-work-RPG-JS-RPG-JS-packages-action-battle-src-components-action-bar-ce")) {
6
+ const styleElement = document.createElement("style");
7
+ styleElement.id = "ce-style--home-runner-work-RPG-JS-RPG-JS-packages-action-battle-src-components-action-bar-ce";
8
+ styleElement.textContent = ".action-battle-actionbar-root {\n pointer-events: none;\n }\n\n .action-battle-actionbar {\n position: absolute;\n left: 12px;\n right: 12px;\n bottom: 12px;\n pointer-events: auto;\n display: flex;\n justify-content: center;\n }\n\n .action-battle-actionbar-plate {\n width: min(760px, 100%);\n --rpg-ui-hotbar-size: clamp(38px, 8vw, 52px);\n }\n\n .action-battle-actionbar-track {\n --rpg-ui-hotbar-slots: 10;\n }";
9
+ document.head.appendChild(styleElement);
26
10
  }
27
- function applyPlayerHitToEvent(player, target, hooks) {
28
- const ai = target.battleAi;
29
- if (!ai) return void 0;
30
- const knockbackForce = getPlayerWeaponKnockbackForce(player);
31
- const defeated = ai.takeDamage(player);
32
- const dx = target.x() - player.x();
33
- const dy = target.y() - player.y();
34
- const distance = Math.sqrt(dx * dx + dy * dy);
35
- let hitResult = {
36
- damage: 0,
37
- // Will be set by takeDamage internally
38
- knockbackForce,
39
- knockbackDuration: DEFAULT_KNOCKBACK.duration,
40
- defeated,
41
- attacker: player,
42
- target
43
- };
44
- if (hooks?.onBeforeHit) {
45
- const modified = hooks.onBeforeHit(hitResult);
46
- if (modified) {
47
- hitResult = modified;
48
- }
49
- }
50
- if (!hitResult.defeated && hitResult.knockbackForce > 0 && distance > 0) {
51
- const knockbackDirection = {
52
- x: dx / distance,
53
- y: dy / distance
54
- };
55
- target.knockback(knockbackDirection, hitResult.knockbackForce, hitResult.knockbackDuration);
56
- }
57
- if (hooks?.onAfterHit) {
58
- hooks.onAfterHit(hitResult);
59
- }
60
- return hitResult;
11
+ function component($$props) {
12
+ useProps($$props);
13
+ const defineProps = useDefineProps($$props);
14
+ const engine = inject(RpgClientEngine);
15
+ const keyboardControls = engine.globalConfig.keyboardControls;
16
+ const { data, onInteraction, onBack } = defineProps();
17
+ const currentPlayer = engine.getCurrentPlayer();
18
+ const ACTION_BAR_SIZE = 10;
19
+ const SLOT_LABELS = [
20
+ "1",
21
+ "2",
22
+ "3",
23
+ "4",
24
+ "5",
25
+ "6",
26
+ "7",
27
+ "8",
28
+ "9",
29
+ "0"
30
+ ];
31
+ const SLOT_CONFIG_KEYS = [
32
+ "hotbar1",
33
+ "hotbar2",
34
+ "hotbar3",
35
+ "hotbar4",
36
+ "hotbar5",
37
+ "hotbar6",
38
+ "hotbar7",
39
+ "hotbar8",
40
+ "hotbar9",
41
+ "hotbar0"
42
+ ];
43
+ const selectedSlotIndex = signal(-1);
44
+ const uiOptions = computed(() => actionBattleUiOptions());
45
+ const showItems = computed(() => {
46
+ const mode = uiOptions().actionBar?.mode || "both";
47
+ return mode === "items" || mode === "both";
48
+ });
49
+ const showSkills = computed(() => {
50
+ const mode = uiOptions().actionBar?.mode || "both";
51
+ return mode === "skills" || mode === "both";
52
+ });
53
+ const isTargeting = computed(() => actionBattleTargetingState().active);
54
+ const iconSheet = (iconId) => ({
55
+ definition: engine.getSpriteSheet(iconId),
56
+ playing: "default"
57
+ });
58
+ const actionBarSlots = computed(() => {
59
+ const entries = [];
60
+ if (showSkills()) currentPlayer.skills().forEach((skill, index) => {
61
+ entries.push({
62
+ type: "skill",
63
+ skill,
64
+ item: null,
65
+ sourceIndex: index
66
+ });
67
+ });
68
+ if (showItems()) currentPlayer.items().forEach((item, index) => {
69
+ entries.push({
70
+ type: "item",
71
+ skill: null,
72
+ item,
73
+ sourceIndex: index
74
+ });
75
+ });
76
+ const slots = entries.slice(0, ACTION_BAR_SIZE).map((entry, index) => ({
77
+ ...entry,
78
+ label: SLOT_LABELS[index]
79
+ }));
80
+ while (slots.length < ACTION_BAR_SIZE) slots.push({
81
+ type: "empty",
82
+ skill: null,
83
+ item: null,
84
+ sourceIndex: -1,
85
+ label: SLOT_LABELS[slots.length]
86
+ });
87
+ return slots;
88
+ });
89
+ const hasSlotEntry = (slot) => slot.type === "skill" || slot.type === "item";
90
+ const isSlotDisabled = (slot) => {
91
+ if (!hasSlotEntry(slot)) return true;
92
+ const entry = slot.type === "skill" ? slot.skill : slot.item;
93
+ return !entry || !entry.usable;
94
+ };
95
+ const getItemQuantity = (item) => {
96
+ if (!item) return 0;
97
+ if (typeof item.quantity === "function") return item.quantity();
98
+ return item.quantity || 0;
99
+ };
100
+ const selectItem = (item) => {
101
+ if (!item || !item.usable) return;
102
+ if (onInteraction) onInteraction("useItem", { id: item.id });
103
+ };
104
+ const selectSkill = (skill) => {
105
+ if (!skill || !skill.usable) return;
106
+ if ((skill.range ?? 0) > 0 || skill.aoeMask) {
107
+ startTargeting(skill);
108
+ return;
109
+ }
110
+ if (onInteraction) onInteraction("useSkill", { id: skill.id });
111
+ };
112
+ const selectSlot = (index) => {
113
+ const slot = actionBarSlots()[index];
114
+ if (!slot || !hasSlotEntry(slot)) return;
115
+ if (slot.type === "skill") {
116
+ selectSkill(slot.skill);
117
+ return;
118
+ }
119
+ selectItem(slot.item);
120
+ };
121
+ const onSelectSlot = (index) => () => {
122
+ selectedSlotIndex.set(index);
123
+ selectSlot(index);
124
+ };
125
+ const getPlayerTile = () => {
126
+ const player = engine.scene.getCurrentPlayer();
127
+ if (!player) return null;
128
+ const hitbox = player.hitbox?.() || {
129
+ w: 32,
130
+ h: 32
131
+ };
132
+ const tileWidth = hitbox.w || 32;
133
+ const tileHeight = hitbox.h || 32;
134
+ return {
135
+ x: Math.floor((player.x() + hitbox.w / 2) / tileWidth),
136
+ y: Math.floor((player.y() + hitbox.h / 2) / tileHeight)
137
+ };
138
+ };
139
+ const confirmTargeting = () => {
140
+ const state = actionBattleTargetingState();
141
+ if (!state.skill) return;
142
+ const origin = getPlayerTile();
143
+ if (!origin) return;
144
+ const target = {
145
+ x: origin.x + state.offset.x,
146
+ y: origin.y + state.offset.y
147
+ };
148
+ if (onInteraction) onInteraction("useSkill", {
149
+ id: state.skill.id,
150
+ target
151
+ });
152
+ stopTargeting();
153
+ };
154
+ const resolveKeyBind = (key) => {
155
+ if (!key) return null;
156
+ if (typeof key === "string" && keyboardControls?.[key]) return keyboardControls[key];
157
+ return key;
158
+ };
159
+ const slotBind = (index) => keyboardControls?.[SLOT_CONFIG_KEYS[index]] || SLOT_LABELS[index];
160
+ const buildControls = () => {
161
+ const hotbarControls = {};
162
+ actionBarSlots().forEach((slot, index) => {
163
+ if (!hasSlotEntry(slot)) return;
164
+ const bind = slotBind(index);
165
+ hotbarControls[`slot-${index}`] = {
166
+ bind,
167
+ keyDown() {
168
+ if (isTargeting()) return;
169
+ selectedSlotIndex.set(index);
170
+ selectSlot(index);
171
+ }
172
+ };
173
+ if (slot.type === "skill") {
174
+ const skillBind = resolveKeyBind(slot.skill?.key);
175
+ if (!skillBind || skillBind === bind) return;
176
+ hotbarControls[`skill-${index}`] = {
177
+ bind: skillBind,
178
+ keyDown() {
179
+ if (isTargeting()) return;
180
+ selectedSlotIndex.set(index);
181
+ selectSlot(index);
182
+ }
183
+ };
184
+ }
185
+ });
186
+ return {
187
+ left: {
188
+ repeat: true,
189
+ bind: keyboardControls.left,
190
+ throttle: 150,
191
+ keyDown() {
192
+ if (isTargeting()) moveTargetingOffset(-1, 0);
193
+ }
194
+ },
195
+ right: {
196
+ repeat: true,
197
+ bind: keyboardControls.right,
198
+ throttle: 150,
199
+ keyDown() {
200
+ if (isTargeting()) moveTargetingOffset(1, 0);
201
+ }
202
+ },
203
+ up: {
204
+ repeat: true,
205
+ bind: keyboardControls.up,
206
+ throttle: 150,
207
+ keyDown() {
208
+ if (isTargeting()) moveTargetingOffset(0, -1);
209
+ }
210
+ },
211
+ down: {
212
+ repeat: true,
213
+ bind: keyboardControls.down,
214
+ throttle: 150,
215
+ keyDown() {
216
+ if (isTargeting()) moveTargetingOffset(0, 1);
217
+ }
218
+ },
219
+ action: {
220
+ bind: keyboardControls.action,
221
+ keyDown() {
222
+ if (isTargeting()) confirmTargeting();
223
+ }
224
+ },
225
+ escape: {
226
+ bind: keyboardControls.escape,
227
+ keyDown() {
228
+ if (isTargeting()) {
229
+ stopTargeting();
230
+ return;
231
+ }
232
+ if (onBack) onBack();
233
+ }
234
+ },
235
+ ...hotbarControls,
236
+ gamepad: { enabled: true }
237
+ };
238
+ };
239
+ const controls = signal(buildControls());
240
+ effect(() => {
241
+ controls.set(buildControls());
242
+ });
243
+ return h(DOMContainer, {
244
+ width: "100%",
245
+ height: "100%",
246
+ attrs: { class: "action-battle-actionbar-root" },
247
+ controls
248
+ }, h(DOMElement, {
249
+ element: "div",
250
+ attrs: { class: "action-battle-actionbar" }
251
+ }, h(DOMElement, {
252
+ element: "div",
253
+ attrs: { class: "rpg-ui-hotbar action-battle-actionbar-plate" }
254
+ }, h(DOMElement, {
255
+ element: "div",
256
+ attrs: { class: "rpg-ui-hotbar-track action-battle-actionbar-track" }
257
+ }, loop(actionBarSlots, (slot, index) => h(DOMElement, {
258
+ element: "div",
259
+ attrs: {
260
+ class: "rpg-ui-hotbar-slot action-battle-actionbar-slot",
261
+ "data-selected": computed(() => selectedSlotIndex() === index ? "true" : "false"),
262
+ "data-disabled": computed(() => isSlotDisabled(slot) ? "true" : "false"),
263
+ "data-empty": computed(() => hasSlotEntry(slot) ? "false" : "true"),
264
+ "data-type": slot.type,
265
+ tabindex: computed(() => hasSlotEntry(slot) ? index : -1),
266
+ click: hasSlotEntry(slot) ? onSelectSlot(index) : void 0
267
+ }
268
+ }, [
269
+ h(DOMElement, {
270
+ element: "span",
271
+ attrs: { class: "rpg-ui-hotbar-key action-battle-actionbar-key" },
272
+ textContent: slot.label
273
+ }),
274
+ cond(computed(() => slot.type === "skill" && slot.skill?.icon), () => h(DOMSprite, {
275
+ sheet: computed(() => iconSheet(slot.skill.icon)),
276
+ width: "60px",
277
+ height: "60px",
278
+ scale: 2,
279
+ objectFit: "contain"
280
+ }), [computed(() => slot.type === "item" && slot.item?.icon), () => h(DOMSprite, {
281
+ sheet: computed(() => iconSheet(slot.item.icon)),
282
+ width: "60px",
283
+ height: "60px",
284
+ scale: 2,
285
+ objectFit: "contain"
286
+ })], [computed(() => slot.type === "skill" && slot.skill), () => h(DOMElement, {
287
+ element: "span",
288
+ attrs: { class: "rpg-ui-hotbar-text action-battle-actionbar-text" },
289
+ textContent: slot.skill.name
290
+ })], [computed(() => slot.type === "item" && slot.item), () => h(DOMElement, {
291
+ element: "span",
292
+ attrs: { class: "rpg-ui-hotbar-text action-battle-actionbar-text" },
293
+ textContent: slot.item.name
294
+ })]),
295
+ cond(computed(() => slot.type === "item" && slot.item), () => h(DOMElement, {
296
+ element: "span",
297
+ attrs: { class: "rpg-ui-hotbar-count action-battle-actionbar-count" },
298
+ textContent: "x" + getItemQuantity(slot.item)
299
+ }))
300
+ ]))))));
61
301
  }
62
- const resolveSignal = (value) => typeof value === "function" ? value() : value;
63
- const resolveItemData = (player, itemId) => {
64
- try {
65
- return player.databaseById?.(itemId);
66
- } catch {
67
- return null;
68
- }
69
- };
70
- const resolveSkillData = (player, skillId) => {
71
- try {
72
- return player.databaseById?.(skillId);
73
- } catch {
74
- return null;
75
- }
76
- };
77
- const resolveSkillTargeting = (player, skillId, options) => {
78
- const skillsOptions = options.skills;
79
- const skillData = resolveSkillData(player, skillId);
80
- if (skillsOptions?.getTargeting) {
81
- return skillsOptions.getTargeting(skillData);
82
- }
83
- const range = skillData?.range ?? skillData?.targeting?.range ?? skillData?.targeting?.distance;
84
- const aoeMask = skillData?.aoeMask ?? skillData?.targeting?.aoeMask ?? skillData?.targeting?.mask;
85
- if (range === void 0 && aoeMask === void 0) {
86
- return null;
87
- }
88
- return {
89
- range: range ?? 0,
90
- aoeMask
91
- };
92
- };
93
- const normalizeMaskRows = (mask) => {
94
- if (!mask) return [];
95
- if (Array.isArray(mask)) return mask;
96
- return mask.trim().split("\n").map((row) => row.replace(/\r/g, ""));
97
- };
98
- const buildActionBarData = (player, options) => {
99
- const items = (player.items?.() || []).map((item) => {
100
- const id = item.id?.() ?? item.id;
101
- const data = resolveItemData(player, id);
102
- const name = resolveSignal(data?.name) ?? resolveSignal(item.name) ?? id;
103
- const description = resolveSignal(data?.description) ?? resolveSignal(item.description) ?? "";
104
- const icon = resolveSignal(data?.icon) ?? resolveSignal(item.icon);
105
- const quantity = resolveSignal(item.quantity) ?? 1;
106
- const consumable = resolveSignal(data?.consumable);
107
- const itemType = resolveSignal(data?._type);
108
- const usable = quantity > 0 && consumable !== false && (itemType ? itemType === "item" : true);
109
- return {
110
- id,
111
- name,
112
- description,
113
- icon,
114
- quantity,
115
- usable
116
- };
117
- });
118
- const skills = (player.skills?.() || []).map((skill) => {
119
- const id = skill.id?.() ?? skill.id;
120
- const data = resolveSkillData(player, id) || skill;
121
- const name = resolveSignal(data?.name) ?? resolveSignal(skill.name) ?? id;
122
- const description = resolveSignal(data?.description) ?? resolveSignal(skill.description) ?? "";
123
- const icon = resolveSignal(data?.icon) ?? resolveSignal(skill.icon);
124
- const spCost = resolveSignal(data?.spCost) ?? resolveSignal(skill.spCost) ?? 0;
125
- const usable = spCost <= player.sp;
126
- const targeting = resolveSkillTargeting(player, id, options);
127
- const skillEntry = {
128
- id,
129
- name,
130
- description,
131
- icon,
132
- spCost,
133
- usable,
134
- range: targeting?.range ?? 0
135
- };
136
- if (targeting) {
137
- const mask = targeting.aoeMask ?? options.skills?.defaultAoeMask;
138
- if (mask) {
139
- skillEntry.aoeMask = normalizeMaskRows(mask);
140
- }
141
- }
142
- return skillEntry;
143
- });
144
- return { items, skills };
145
- };
146
- const ensureActionBarGui = (player, options) => {
147
- const existing = player.getGui?.(ACTION_BATTLE_ACTION_BAR_GUI_ID);
148
- const gui = existing || player.gui(ACTION_BATTLE_ACTION_BAR_GUI_ID);
149
- if (!gui.__actionBattleReady) {
150
- gui.__actionBattleReady = true;
151
- gui.on("useItem", ({ id }) => {
152
- try {
153
- player.useItem(id);
154
- } catch {
155
- }
156
- gui.update(buildActionBarData(player, options));
157
- });
158
- gui.on("useSkill", ({ id, target }) => {
159
- handleActionBattleSkillUse(player, id, target, options);
160
- gui.update(buildActionBarData(player, options));
161
- });
162
- gui.on("refresh", () => {
163
- gui.update(buildActionBarData(player, options));
164
- });
165
- }
166
- return gui;
167
- };
168
- const openActionBattleActionBar = (player, rawOptions = {}) => {
169
- const options = normalizeActionBattleOptions(rawOptions);
170
- const gui = ensureActionBarGui(player, options);
171
- gui.open(buildActionBarData(player, options));
172
- };
173
- const updateActionBattleActionBar = (player, rawOptions = {}) => {
174
- const options = normalizeActionBattleOptions(rawOptions);
175
- const gui = player.getGui?.(ACTION_BATTLE_ACTION_BAR_GUI_ID);
176
- if (gui) {
177
- gui.update(buildActionBarData(player, options));
178
- }
179
- };
180
- const getTileSize = (map) => ({
181
- width: map?.tileWidth ?? 32,
182
- height: map?.tileHeight ?? 32
183
- });
184
- const getEntityTile = (entity, tileSize) => {
185
- const hitbox = entity.hitbox?.() || { w: tileSize.width, h: tileSize.height };
186
- const x = Math.floor((entity.x() + hitbox.w / 2) / tileSize.width);
187
- const y = Math.floor((entity.y() + hitbox.h / 2) / tileSize.height);
188
- return { x, y };
189
- };
190
- const handleActionBattleSkillUse = (player, skillId, target, options) => {
191
- const map = player.getCurrentMap();
192
- if (!map) {
193
- player.useSkill(skillId);
194
- return;
195
- }
196
- const targeting = resolveSkillTargeting(player, skillId, options);
197
- if (!targeting || !target) {
198
- player.useSkill(skillId);
199
- return;
200
- }
201
- const tileSize = getTileSize(map);
202
- const origin = getEntityTile(player, tileSize);
203
- const targetTile = { x: target.x, y: target.y };
204
- if (manhattanDistance(origin, targetTile) > targeting.range) {
205
- return;
206
- }
207
- const mask = parseAoeMask(
208
- targeting.aoeMask || options.skills?.defaultAoeMask
209
- );
210
- const affected = /* @__PURE__ */ new Set();
211
- mask.cells.forEach((cell) => {
212
- const x = targetTile.x + cell.dx;
213
- const y = targetTile.y + cell.dy;
214
- affected.add(`${x},${y}`);
215
- });
216
- const targets = [];
217
- const affects = options.targeting?.affects || "events";
218
- if (affects === "events" || affects === "both") {
219
- map.getEvents().forEach((event) => {
220
- const tile = getEntityTile(event, tileSize);
221
- if (affected.has(`${tile.x},${tile.y}`)) {
222
- targets.push(event);
223
- }
224
- });
225
- }
226
- if (affects === "players" || affects === "both") {
227
- map.getPlayers().forEach((other) => {
228
- if (other.id === player.id) return;
229
- const tile = getEntityTile(other, tileSize);
230
- if (affected.has(`${tile.x},${tile.y}`)) {
231
- targets.push(other);
232
- }
233
- });
234
- }
235
- if (!options.targeting?.allowEmptyTarget && targets.length === 0) {
236
- return;
237
- }
238
- player.useSkill(skillId, targets);
239
- };
240
- const createActionBattleServer = (rawOptions = {}) => {
241
- const options = normalizeActionBattleOptions(rawOptions);
242
- return defineModule({
243
- player: {
244
- /**
245
- * Handle player input for combat actions
246
- *
247
- * When a player presses the action key, create an attack hitbox
248
- * that can damage AI enemies within range and knockback the event.
249
- * Knockback force is based on the player's equipped weapon.
250
- * Triggers attack animation and visual effects.
251
- *
252
- * @param player - The player performing the action
253
- * @param input - Input data containing pressed keys
254
- */
255
- onInput(player, input) {
256
- if (input.action == Control.Action) {
257
- player.setGraphicAnimation("attack", 1);
258
- const playerX = player.x();
259
- const playerY = player.y();
260
- const direction = player.getDirection();
261
- const directionKey = direction;
262
- const hitboxConfig = DEFAULT_PLAYER_ATTACK_HITBOXES[directionKey] || DEFAULT_PLAYER_ATTACK_HITBOXES.default;
263
- const hitboxes = [
264
- {
265
- x: playerX + hitboxConfig.offsetX,
266
- y: playerY + hitboxConfig.offsetY,
267
- width: hitboxConfig.width,
268
- height: hitboxConfig.height
269
- }
270
- ];
271
- const map = player.getCurrentMap();
272
- map?.createMovingHitbox(hitboxes, { speed: 3 }).subscribe({
273
- next(hits) {
274
- hits.forEach((hit) => {
275
- if (hit instanceof RpgEvent) {
276
- const result = applyPlayerHitToEvent(player, hit);
277
- if (result?.defeated) {
278
- console.log(`Player ${player.id} defeated AI ${hit.id}`);
279
- }
280
- }
281
- });
282
- }
283
- });
284
- }
285
- },
286
- onConnected(player) {
287
- if (options.ui?.actionBar?.enabled && options.ui?.actionBar?.autoOpen) {
288
- openActionBattleActionBar(player, options);
289
- }
290
- }
291
- },
292
- event: {
293
- /**
294
- * Handle player detection when entering AI vision
295
- *
296
- * Called when a player enters an AI event's vision range.
297
- * The AI will start pursuing and attacking the player.
298
- *
299
- * @param event - The AI event
300
- * @param player - The player entering vision
301
- * @param shape - The vision shape
302
- */
303
- onDetectInShape(event, player, shape) {
304
- const ai = event.battleAi;
305
- ai?.onDetectInShape(player, shape);
306
- },
307
- /**
308
- * Handle player leaving AI vision
309
- *
310
- * Called when a player leaves an AI event's vision range.
311
- * The AI will stop pursuing the player.
312
- *
313
- * @param event - The AI event
314
- * @param player - The player leaving vision
315
- * @param shape - The vision shape
316
- */
317
- onDetectOutShape(event, player, shape) {
318
- const ai = event.battleAi;
319
- ai?.onDetectOutShape(player, shape);
320
- }
321
- }
322
- });
323
- };
324
- createActionBattleServer();
325
- export {
326
- ACTION_BATTLE_ACTION_BAR_GUI_ID,
327
- DEFAULT_PLAYER_ATTACK_HITBOXES,
328
- applyPlayerHitToEvent,
329
- createActionBattleServer,
330
- getPlayerWeaponKnockbackForce,
331
- openActionBattleActionBar,
332
- updateActionBattleActionBar
333
- };
302
+ //#endregion
303
+ export { component as default };