Skip to content

Commit 119e64e

Browse files
committed
world3ではcopyを許可
1 parent fac70f4 commit 119e64e

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
lines changed

src/ability.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,7 @@ import { createSnapshot } from "./history.ts";
55
import * as History from "./history.ts";
66
import type { AbilityInit, Context, Coords, MovableObject } from "./public-types.ts";
77

8-
export function init(cx: Context, options?: AbilityInit) {
9-
cx.state.update((prev) => ({
10-
...prev,
11-
usage: options?.enabled ?? {
12-
copy: Number.POSITIVE_INFINITY,
13-
paste: Number.POSITIVE_INFINITY,
14-
cut: Number.POSITIVE_INFINITY,
15-
},
16-
}));
17-
8+
export function init(cx: Context) {
189
console.log("ability init");
1910
document.addEventListener("copy", (e) => {
2011
const { onGround } = cx.dynamic.player;

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ export async function setup(
7676
inventoryIsInfinite: !!stageDefinition.inventoryIsInfinite,
7777
usage: stageDefinition.usage ?? {
7878
copy: 0,
79-
cut: Infinity,
80-
paste: Infinity,
79+
cut: Number.POSITIVE_INFINITY,
80+
paste: Number.POSITIVE_INFINITY,
8181
},
8282
cells: createCellsFromStageDefinition(stageDefinition),
8383
paused: false,

src/player.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@ import { Block } from "./constants.ts";
77
import type { AbilityInit, Context } from "./public-types.ts";
88
import { highlightHoldTexture, highlightTexture } from "./resources.ts";
99

10-
export function init(
11-
cx: Context,
12-
spriteOptions?: SpriteOptions | Texture,
13-
options?: {
14-
ability?: AbilityInit;
15-
},
16-
) {
10+
export function init(cx: Context, spriteOptions?: SpriteOptions | Texture) {
1711
const sprite = new Sprite(spriteOptions);
1812
// Center the sprite's anchor point
1913
sprite.anchor.set(0.5, 1);
@@ -36,7 +30,7 @@ export function init(
3630
document.addEventListener("keydown", (event) => handleInput(cx, event, true));
3731
document.addEventListener("keyup", (event) => handleInput(cx, event, false));
3832
console.log("player init");
39-
Ability.init(cx, options?.ability);
33+
Ability.init(cx);
4034
return {
4135
sprite,
4236
get coords() {

src/stages/world3.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ export namespace world3 {
1717
inventoryIsInfinite: true,
1818
blockGroups: [],
1919
switchGroups: [],
20+
usage: {
21+
copy: Number.POSITIVE_INFINITY,
22+
cut: Number.POSITIVE_INFINITY,
23+
paste: Number.POSITIVE_INFINITY,
24+
},
2025
};
2126
export const stage2: StageDefinition = {
2227
stage: [
@@ -35,6 +40,11 @@ export namespace world3 {
3540
inventoryIsInfinite: true,
3641
blockGroups: [],
3742
switchGroups: [],
43+
usage: {
44+
copy: Number.POSITIVE_INFINITY,
45+
cut: Number.POSITIVE_INFINITY,
46+
paste: Number.POSITIVE_INFINITY,
47+
},
3848
};
3949
export const stage3: StageDefinition = {
4050
stage: [
@@ -55,6 +65,11 @@ export namespace world3 {
5565
{ x: 13, y: 1, switchId: "1" },
5666
{ x: 10, y: 4, switchId: "1" },
5767
],
68+
usage: {
69+
copy: Number.POSITIVE_INFINITY,
70+
cut: Number.POSITIVE_INFINITY,
71+
paste: Number.POSITIVE_INFINITY,
72+
},
5873
};
5974
export const stage4: StageDefinition = {
6075
stage: [
@@ -95,5 +110,10 @@ export namespace world3 {
95110
{ x: 20, y: 2, switchId: "2" },
96111
{ x: 21, y: 1, switchId: "2" },
97112
],
113+
usage: {
114+
copy: Number.POSITIVE_INFINITY,
115+
cut: Number.POSITIVE_INFINITY,
116+
paste: Number.POSITIVE_INFINITY,
117+
},
98118
};
99119
}

0 commit comments

Comments
 (0)