@lewismoten/gamemaker-sandbox-tools 3.1.0 → 3.4.0
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.
- package/CHANGELOG.md +44 -0
- package/NOTICE.md +105 -3
- package/README.md +301 -15
- package/dist/audio-files.js +82 -0
- package/dist/audio.js +23 -138
- package/dist/block-merge.js +43 -0
- package/dist/color-reduce.js +44 -0
- package/dist/colors.js +87 -0
- package/dist/delta.js +75 -0
- package/dist/disk-diff.js +220 -0
- package/dist/drawing.js +83 -869
- package/dist/embroidery/compile.js +85 -0
- package/dist/embroidery/dst.js +79 -0
- package/dist/embroidery/exp.js +26 -0
- package/dist/embroidery/fill.js +49 -0
- package/dist/embroidery/geom.js +82 -0
- package/dist/embroidery/pes.js +79 -0
- package/dist/embroidery/satin.js +29 -0
- package/dist/embroidery/simulate.js +30 -0
- package/dist/embroidery/strokeFont.js +253 -0
- package/dist/embroidery/svg.js +24 -0
- package/dist/embroidery/types.js +13 -0
- package/dist/embroidery/units.js +26 -0
- package/dist/embroidery/validate.js +15 -0
- package/dist/formats/blocks.js +1 -103
- package/dist/formats/character.js +1 -83
- package/dist/formats/cmf.js +1 -37
- package/dist/formats/fli.js +1 -296
- package/dist/formats/fliLimits.js +1 -54
- package/dist/formats/game.js +1 -193
- package/dist/formats/gif.js +1 -125
- package/dist/formats/graphicScripts.js +1 -44
- package/dist/formats/map.js +1 -38
- package/dist/formats/monster.js +1 -69
- package/dist/formats/palette.js +1 -58
- package/dist/formats/recording.js +1 -17
- package/dist/formats/sound.js +1 -44
- package/dist/formats/voc.js +1 -303
- package/dist/gif-shrink.js +56 -0
- package/dist/image/png.js +42 -0
- package/dist/images.js +81 -43
- package/dist/kit/actors.js +19 -0
- package/dist/kit/align.js +204 -0
- package/dist/kit/blit.js +45 -0
- package/dist/kit/blockRoles.js +97 -0
- package/dist/kit/clips.js +40 -0
- package/dist/kit/coverPaint.js +18 -0
- package/dist/kit/disk.js +76 -0
- package/dist/kit/fadeOut.js +13 -0
- package/dist/kit/fliClips.js +133 -0
- package/dist/kit/fliShrink.js +277 -0
- package/dist/kit/gameSim.js +235 -0
- package/dist/kit/hopBot.js +142 -0
- package/dist/kit/levelGen.js +1423 -0
- package/dist/kit/levelGrid.js +33 -0
- package/dist/kit/levelPicture.js +27 -0
- package/dist/kit/menuVersion.js +19 -0
- package/dist/kit/microText.js +35 -0
- package/dist/kit/mumble.js +74 -0
- package/dist/kit/music.js +8 -0
- package/dist/kit/palRamps.js +32 -0
- package/dist/kit/palette.js +49 -0
- package/dist/kit/pcText.js +72 -0
- package/dist/kit/photo.js +150 -0
- package/dist/kit/pixels.js +79 -0
- package/dist/kit/png.js +40 -0
- package/dist/kit/quantize.js +72 -0
- package/dist/kit/raytrace.js +379 -0
- package/dist/kit/recordedDemo.js +10 -0
- package/dist/kit/reel.js +77 -0
- package/dist/kit/road3d.js +67 -0
- package/dist/kit/routeChecks.js +8 -0
- package/dist/kit/saveSlots.js +11 -0
- package/dist/kit/sceneInit.js +13 -0
- package/dist/kit/sceneSim.js +112 -0
- package/dist/kit/screenText.js +15 -0
- package/dist/kit/sdftext.js +237 -0
- package/dist/kit/shading.js +69 -0
- package/dist/kit/song.js +251 -0
- package/dist/kit/songFx.js +179 -0
- package/dist/kit/sound.js +52 -0
- package/dist/kit/synthParts.js +20 -0
- package/dist/kit/tar.js +53 -0
- package/dist/kit/textBounds.js +84 -0
- package/dist/kit/textfit.js +246 -0
- package/dist/kit/transforms.js +57 -0
- package/dist/kit/tune.js +21 -0
- package/dist/look-alike.js +50 -0
- package/dist/menu-version.js +4 -0
- package/dist/mesh/colorBodies.js +137 -0
- package/dist/mesh/decimate.js +207 -0
- package/dist/mesh/meshCheck.js +51 -0
- package/dist/mesh/overhang.js +41 -0
- package/dist/mesh/sampledField.js +12 -0
- package/dist/mesh/stl.js +36 -0
- package/dist/mesh/surfaceNets.js +79 -0
- package/dist/mesh/tetraMesh.js +62 -0
- package/dist/mesh/threeMf.js +58 -0
- package/dist/mesh/zipFile.js +52 -0
- package/dist/microFont.js +101 -0
- package/dist/music/compose.js +72 -0
- package/dist/pack/meshPack.js +198 -0
- package/dist/pack/threeMfPack.js +92 -0
- package/dist/palette-reserve.js +116 -0
- package/dist/palettes.js +138 -0
- package/dist/release-notes.js +40 -0
- package/dist/simulation.js +16 -2774
- package/dist/text.js +74 -0
- package/dist/types/audio.d.ts +4 -0
- package/dist/types/audioFiles.d.ts +22 -0
- package/dist/types/audioWav.d.ts +4 -0
- package/dist/types/blockMerge.d.ts +24 -0
- package/dist/types/colorReduce.d.ts +23 -0
- package/dist/types/{web/packages/tools/src/colors.d.ts → colors.d.ts} +6 -0
- package/dist/types/delta.d.ts +32 -0
- package/dist/types/diskDiff.d.ts +47 -0
- package/dist/types/drawing.d.ts +15 -0
- package/dist/types/embroidery/compile.d.ts +3 -0
- package/dist/types/embroidery/dst.d.ts +13 -0
- package/dist/types/embroidery/exp.d.ts +8 -0
- package/dist/types/embroidery/fill.d.ts +6 -0
- package/dist/types/embroidery/geom.d.ts +19 -0
- package/dist/types/embroidery/pes.d.ts +10 -0
- package/dist/types/embroidery/satin.d.ts +11 -0
- package/dist/types/embroidery/simulate.d.ts +19 -0
- package/dist/types/embroidery/strokeFont.d.ts +20 -0
- package/dist/types/embroidery/svg.d.ts +3 -0
- package/dist/types/embroidery/types.d.ts +70 -0
- package/dist/types/embroidery/units.d.ts +10 -0
- package/dist/types/embroidery/validate.d.ts +22 -0
- package/dist/types/formats/blocks.d.ts +1 -0
- package/dist/types/formats/character.d.ts +1 -0
- package/dist/types/formats/cmf.d.ts +1 -0
- package/dist/types/formats/fli.d.ts +1 -0
- package/dist/types/formats/fliLimits.d.ts +1 -0
- package/dist/types/formats/game.d.ts +1 -0
- package/dist/types/formats/gif.d.ts +1 -0
- package/dist/types/formats/graphicScripts.d.ts +1 -0
- package/dist/types/formats/map.d.ts +1 -0
- package/dist/types/formats/monster.d.ts +1 -0
- package/dist/types/formats/palette.d.ts +1 -0
- package/dist/types/formats/recording.d.ts +1 -0
- package/dist/types/formats/sound.d.ts +1 -0
- package/dist/types/formats/voc.d.ts +1 -0
- package/dist/types/gifShrink.d.ts +8 -0
- package/dist/types/image/animatedGif.d.ts +9 -0
- package/dist/types/image/surface.d.ts +26 -0
- package/dist/types/images.d.ts +13 -0
- package/dist/types/kit/actors.d.ts +7 -0
- package/dist/types/kit/align.d.ts +93 -0
- package/dist/types/kit/audioEvents.d.ts +26 -0
- package/dist/types/kit/blit.d.ts +20 -0
- package/dist/types/kit/blockRoles.d.ts +243 -0
- package/dist/types/{games/kit → kit}/clips.d.ts +1 -1
- package/dist/types/kit/coverPaint.d.ts +7 -0
- package/dist/types/kit/disk.d.ts +15 -0
- package/dist/types/kit/fadeOut.d.ts +12 -0
- package/dist/types/kit/fliClips.d.ts +32 -0
- package/dist/types/kit/fliShrink.d.ts +149 -0
- package/dist/types/{games/kit → kit}/gameSim.d.ts +9 -5
- package/dist/types/kit/hopBot.d.ts +72 -0
- package/dist/types/kit/laserClearance.d.ts +16 -0
- package/dist/types/kit/laserJoints.d.ts +39 -0
- package/dist/types/kit/laserLayout.d.ts +54 -0
- package/dist/types/kit/laserPixels.d.ts +52 -0
- package/dist/types/kit/laserPreview.d.ts +9 -0
- package/dist/types/kit/laserSvg.d.ts +35 -0
- package/dist/types/kit/levelGen/castle.d.ts +17 -0
- package/dist/types/kit/levelGen/dungeon.d.ts +11 -0
- package/dist/types/kit/levelGen/forest.d.ts +17 -0
- package/dist/types/kit/levelGen/furnish.d.ts +31 -0
- package/dist/types/kit/levelGen/grid.d.ts +46 -0
- package/dist/types/kit/levelGen/index.d.ts +138 -0
- package/dist/types/kit/levelGen/interior.d.ts +18 -0
- package/dist/types/kit/levelGen/jumpModel.d.ts +78 -0
- package/dist/types/kit/levelGen/needs.d.ts +44 -0
- package/dist/types/kit/levelGen/overworld.d.ts +21 -0
- package/dist/types/kit/levelGen/platform.d.ts +59 -0
- package/dist/types/kit/levelGen/platformCap.d.ts +13 -0
- package/dist/types/kit/levelGen/platformReach.d.ts +37 -0
- package/dist/types/kit/levelGen/props.d.ts +37 -0
- package/dist/types/kit/levelGen/town.d.ts +24 -0
- package/dist/types/kit/levelGrid.d.ts +16 -0
- package/dist/types/kit/levelPicture.d.ts +9 -0
- package/dist/types/kit/menuVersion.d.ts +7 -0
- package/dist/types/kit/microText.d.ts +18 -0
- package/dist/types/kit/mumble.d.ts +41 -0
- package/dist/types/kit/music.d.ts +1 -0
- package/dist/types/kit/palMerge.d.ts +10 -0
- package/dist/types/kit/palRamps.d.ts +28 -0
- package/dist/types/kit/pcText.d.ts +19 -0
- package/dist/types/kit/photo.d.ts +69 -0
- package/dist/types/kit/png.d.ts +7 -0
- package/dist/types/kit/quantize.d.ts +20 -0
- package/dist/types/kit/raytrace.d.ts +169 -0
- package/dist/types/kit/recordedDemo.d.ts +1 -0
- package/dist/types/kit/road3d.d.ts +71 -0
- package/dist/types/kit/routeChecks.d.ts +6 -0
- package/dist/types/kit/saveSlots.d.ts +17 -0
- package/dist/types/kit/sceneInit.d.ts +11 -0
- package/dist/types/{games/kit → kit}/sceneSim.d.ts +5 -5
- package/dist/types/kit/screenText.d.ts +3 -0
- package/dist/types/kit/sdftext.d.ts +34 -0
- package/dist/types/kit/shading.d.ts +23 -0
- package/dist/types/kit/shareBlocks.d.ts +20 -0
- package/dist/types/kit/song.d.ts +89 -0
- package/dist/types/kit/songFx.d.ts +99 -0
- package/dist/types/kit/synthParts.d.ts +7 -0
- package/dist/types/kit/tar.d.ts +13 -0
- package/dist/types/kit/textfit.d.ts +74 -0
- package/dist/types/kit/transforms.d.ts +8 -0
- package/dist/types/lookAlike.d.ts +31 -0
- package/dist/types/menuVersionEntry.d.ts +1 -0
- package/dist/types/mesh/colorBodies.d.ts +18 -0
- package/dist/types/mesh/decimate.d.ts +10 -0
- package/dist/types/mesh/fieldTrinket.d.ts +40 -0
- package/dist/types/mesh/figureShapes.d.ts +24 -0
- package/dist/types/mesh/mesh.d.ts +9 -0
- package/dist/types/mesh/meshCheck.d.ts +22 -0
- package/dist/types/mesh/overhang.d.ts +24 -0
- package/dist/types/mesh/pixelFigure.d.ts +41 -0
- package/dist/types/mesh/sampledField.d.ts +3 -0
- package/dist/types/mesh/sdfShapes.d.ts +20 -0
- package/dist/types/mesh/stl.d.ts +9 -0
- package/dist/types/mesh/strokeText.d.ts +8 -0
- package/dist/types/mesh/surfaceNets.d.ts +14 -0
- package/dist/types/mesh/tetraMesh.d.ts +4 -0
- package/dist/types/mesh/threeMf.d.ts +12 -0
- package/dist/types/mesh/trinketKinds.d.ts +72 -0
- package/dist/types/mesh/trinketTool.d.ts +26 -0
- package/dist/types/mesh/voxel.d.ts +10 -0
- package/dist/types/mesh/zipFile.d.ts +13 -0
- package/dist/types/microFont.d.ts +6 -0
- package/dist/types/pack/meshPack.d.ts +26 -0
- package/dist/types/pack/threeMfPack.d.ts +11 -0
- package/dist/types/palettePresetData.d.ts +4 -0
- package/dist/types/palettePresets.d.ts +12 -0
- package/dist/types/paletteReserve.d.ts +52 -0
- package/dist/types/palettes.d.ts +4 -0
- package/dist/types/releaseNotes.d.ts +3 -0
- package/dist/types/simulation.d.ts +6 -0
- package/dist/types/{web/packages/tools/src/text.d.ts → text.d.ts} +6 -6
- package/package.json +145 -15
- package/dist/binary-D7wuaC5g.js +0 -120
- package/dist/pixels-DzfIIUOl.js +0 -76
- package/dist/types/games/kit/blit.d.ts +0 -10
- package/dist/types/games/kit/music.d.ts +0 -1
- package/dist/types/games/kit/pcText.d.ts +0 -8
- package/dist/types/games/kit/shading.d.ts +0 -11
- package/dist/types/web/packages/tools/src/audio.d.ts +0 -3
- package/dist/types/web/packages/tools/src/drawing.d.ts +0 -10
- package/dist/types/web/packages/tools/src/images.d.ts +0 -2
- package/dist/types/web/packages/tools/src/microFont.d.ts +0 -1
- package/dist/types/web/packages/tools/src/simulation.d.ts +0 -3
- package/dist/types/web/scripts/cdGames.d.ts +0 -103
- package/dist/types/web/scripts/gameShots.d.ts +0 -12
- package/dist/types/web/scripts/ogImage.d.ts +0 -21
- package/dist/types/web/src/audio/cmfLoad.d.ts +0 -7
- package/dist/types/web/src/audio/cmfPlayer.d.ts +0 -69
- package/dist/types/web/src/audio/context.d.ts +0 -12
- package/dist/types/web/src/audio/engine.d.ts +0 -39
- package/dist/types/web/src/audio/music.worklet.d.ts +0 -14
- package/dist/types/web/src/audio/opl.d.ts +0 -37
- package/dist/types/web/src/audio/output.d.ts +0 -13
- package/dist/types/web/src/desk/boxes/boxFacts.d.ts +0 -85
- package/dist/types/web/src/dosPlayer/fileExtensions.d.ts +0 -44
- package/dist/types/web/src/dosPlayer/patchRules.d.ts +0 -24
- package/dist/types/web/src/dosPlayer/patchTable.d.ts +0 -80
- package/dist/types/web/src/edition.d.ts +0 -6
- package/dist/types/web/src/eggs/eggState.d.ts +0 -26
- package/dist/types/web/src/eggs/eggs.d.ts +0 -31
- package/dist/types/web/src/engine/character.d.ts +0 -30
- package/dist/types/web/src/engine/funcKeys.d.ts +0 -33
- package/dist/types/web/src/engine/game.d.ts +0 -52
- package/dist/types/web/src/engine/keys.d.ts +0 -17
- package/dist/types/web/src/engine/machine.d.ts +0 -99
- package/dist/types/web/src/engine/menus.d.ts +0 -46
- package/dist/types/web/src/engine/monsters.d.ts +0 -19
- package/dist/types/web/src/engine/playGain.d.ts +0 -11
- package/dist/types/web/src/engine/playerLook.d.ts +0 -26
- package/dist/types/web/src/engine/recorder.d.ts +0 -60
- package/dist/types/web/src/engine/render.d.ts +0 -8
- package/dist/types/web/src/engine/scene.d.ts +0 -156
- package/dist/types/web/src/engine/scroll.d.ts +0 -16
- package/dist/types/web/src/engine/showGraphic.d.ts +0 -39
- package/dist/types/web/src/engine/slowPc.d.ts +0 -62
- package/dist/types/web/src/engine/touch.d.ts +0 -33
- package/dist/types/web/src/engine/world.d.ts +0 -215
- package/dist/types/web/src/export/gameAbout.d.ts +0 -15
- package/dist/types/web/src/formats/binary.d.ts +0 -44
- package/dist/types/web/src/formats/blocks.d.ts +0 -52
- package/dist/types/web/src/formats/character.d.ts +0 -65
- package/dist/types/web/src/formats/cmf.d.ts +0 -33
- package/dist/types/web/src/formats/fli.d.ts +0 -45
- package/dist/types/web/src/formats/fliLimits.d.ts +0 -13
- package/dist/types/web/src/formats/game.d.ts +0 -72
- package/dist/types/web/src/formats/gif.d.ts +0 -15
- package/dist/types/web/src/formats/graphicScripts.d.ts +0 -18
- package/dist/types/web/src/formats/highscore.d.ts +0 -10
- package/dist/types/web/src/formats/map.d.ts +0 -24
- package/dist/types/web/src/formats/monster.d.ts +0 -48
- package/dist/types/web/src/formats/palette.d.ts +0 -15
- package/dist/types/web/src/formats/recording.d.ts +0 -7
- package/dist/types/web/src/formats/sound.d.ts +0 -13
- package/dist/types/web/src/formats/voc.d.ts +0 -13
- package/dist/types/web/src/gfx/cp437Glyphs.d.ts +0 -2
- package/dist/types/web/src/gfx/font8x8.d.ts +0 -2
- package/dist/types/web/src/gfx/levelPicture.d.ts +0 -81
- package/dist/types/web/src/gfx/screen.d.ts +0 -46
- package/dist/types/web/src/gfx/titlePicture.d.ts +0 -21
- package/dist/types/web/src/input/chords.d.ts +0 -22
- package/dist/types/web/src/input/deskMouse.d.ts +0 -14
- package/dist/types/web/src/input/keyboard.d.ts +0 -39
- package/dist/types/web/src/input/scancodes.d.ts +0 -3
- package/dist/types/web/src/manual/printables/types.d.ts +0 -277
- package/dist/types/web/src/project/bizarre.d.ts +0 -28
- package/dist/types/web/src/project/companion.d.ts +0 -35
- package/dist/types/web/src/project/diskFacts.d.ts +0 -30
- package/dist/types/web/src/project/files.d.ts +0 -124
- package/dist/types/web/src/project/gameFiles.d.ts +0 -49
- package/dist/types/web/src/project/gamePack.d.ts +0 -17
- package/dist/types/web/src/project/health.d.ts +0 -30
- package/dist/types/web/src/project/secretGames.d.ts +0 -19
- package/dist/types/web/src/project/storage.d.ts +0 -46
- package/dist/types/web/src/project/streamGame.d.ts +0 -38
- package/dist/types/web/src/project/zip.d.ts +0 -33
- package/dist/types/web/src/retro/dos/disks.d.ts +0 -33
- package/dist/types/web/src/retro/text/cp437.d.ts +0 -4
- package/dist/types/web/src/seededRandom.d.ts +0 -6
- package/dist/types/web/src/tinHearts/deskHearts.d.ts +0 -33
- package/dist/types/web/src/tinHearts/manifest.d.ts +0 -30
- package/dist/types/web/src/tinHearts/tinHearts.d.ts +0 -84
- package/dist/types/web/src/walkthrough/format.d.ts +0 -92
- package/dist/types/web/src/walkthrough/madeUpScores.d.ts +0 -6
- package/dist/types/web/src/walkthrough/runtime.d.ts +0 -134
- /package/dist/types/{web/src/assistant → image}/png.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/palette.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/pixels.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/reel.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/sound.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/textBounds.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/tune.d.ts +0 -0
- /package/dist/types/{web/src/audio → music}/compose.d.ts +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { GameSim } from './gameSim.js';
|
|
2
|
+
export type Dir = 'left' | 'right';
|
|
3
|
+
export type Result = string | undefined;
|
|
4
|
+
/** The keys every hopping game has: arrows, and Q/E to hop sideways. */
|
|
5
|
+
interface HopKeys {
|
|
6
|
+
up: number;
|
|
7
|
+
down: number;
|
|
8
|
+
left: number;
|
|
9
|
+
right: number;
|
|
10
|
+
q: number;
|
|
11
|
+
e: number;
|
|
12
|
+
}
|
|
13
|
+
interface HopSetup<K extends HopKeys> {
|
|
14
|
+
/** The game's key scan codes (src/ids.ts SCAN). */
|
|
15
|
+
scan: K;
|
|
16
|
+
/** The level map's origin in scene blocks (src/levels/maps.ts ORIGIN). */
|
|
17
|
+
origin: number;
|
|
18
|
+
/** The meter BOT_HURT prints beside a hurt: its name and its number. */
|
|
19
|
+
meter: {
|
|
20
|
+
name: string;
|
|
21
|
+
n: number;
|
|
22
|
+
};
|
|
23
|
+
/** The scan codes BOT_TRACE lists when held (the arrows and Q/E unless said). */
|
|
24
|
+
traced?: number[];
|
|
25
|
+
}
|
|
26
|
+
export declare class HopBot<S extends GameSim = GameSim, K extends HopKeys = HopKeys> {
|
|
27
|
+
readonly sim: S;
|
|
28
|
+
log: string[];
|
|
29
|
+
readonly scan: K;
|
|
30
|
+
private readonly origin;
|
|
31
|
+
private readonly meterShown;
|
|
32
|
+
private readonly traced;
|
|
33
|
+
constructor(sim: S, setup: HopSetup<K>);
|
|
34
|
+
snapshot(): {
|
|
35
|
+
sim: import("./gameSim.js").State;
|
|
36
|
+
log: number;
|
|
37
|
+
};
|
|
38
|
+
restore(s: ReturnType<HopBot['snapshot']>): void;
|
|
39
|
+
/** The hero's position in level pixels (left/top of its bottom block). */
|
|
40
|
+
get px(): {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
};
|
|
44
|
+
/** Its block (level coordinates), rounded to the nearest. */
|
|
45
|
+
get at(): {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
};
|
|
49
|
+
say(s: string): void;
|
|
50
|
+
tick(): Promise<Result>;
|
|
51
|
+
wait(k: number): Promise<Result>;
|
|
52
|
+
/** Waits until the hero stops moving up or down (standing, or holding on to something). */
|
|
53
|
+
land(max?: number): Promise<Result>;
|
|
54
|
+
/** Before each step of a walk: a game's chance to stop for something (keys still held). */
|
|
55
|
+
protected beforeStep(_dir: Dir): Promise<Result>;
|
|
56
|
+
/** Before a hop (and before a walk hops what blocks it, `dir` still held): a game's chance to wait. */
|
|
57
|
+
protected beforeHop(_dir?: Dir): Promise<Result>;
|
|
58
|
+
/** Walks to level column `bx` (its left edge at bx * 20 px), hopping over whatever stops it. */
|
|
59
|
+
walk(bx: number, label?: string, max?: number): Promise<Result>;
|
|
60
|
+
/**
|
|
61
|
+
* A hop: Up (or Q/E sideways) held `hold` ticks; then `steer` held while it falls, until it
|
|
62
|
+
* lands or has gone `steerTo` columns (level block x).
|
|
63
|
+
*/
|
|
64
|
+
hop(dir: Dir | 'up', hold?: number, steer?: Dir, steerTo?: number): Promise<Result>;
|
|
65
|
+
/** Holds a key for `ticks` (Down to climb down, Up to climb up, Space for the game's action). */
|
|
66
|
+
hold(key: keyof K, ticks: number): Promise<Result>;
|
|
67
|
+
/** Climbs (or walks) along one axis until the hero reaches level column/row `to`. */
|
|
68
|
+
dig(dir: 'left' | 'right' | 'up' | 'down', to: number, label?: string, max?: number): Promise<Result>;
|
|
69
|
+
/** Holds `key` until `check` says so (or `max` ticks: then it fails). */
|
|
70
|
+
until(key: keyof K | undefined, check: () => boolean, label: string, max?: number): Promise<Result>;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type LaserSheet } from './laserSvg.js';
|
|
2
|
+
export interface Element {
|
|
3
|
+
name: string;
|
|
4
|
+
from: number;
|
|
5
|
+
to: number;
|
|
6
|
+
}
|
|
7
|
+
export interface Close {
|
|
8
|
+
a: string;
|
|
9
|
+
b: string;
|
|
10
|
+
mm: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Every pair of elements closer than the gap: `gap` mm, or `holeGap` when either is a hole (its name starts "hole").
|
|
14
|
+
* The coin's own outline cut is not an element; pass it as part of a "hole" if it should count.
|
|
15
|
+
*/
|
|
16
|
+
export declare function tooClose(sheet: LaserSheet, elements: Element[], gap?: number, holeGap?: number): Close[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Pt } from './laserSvg.js';
|
|
2
|
+
/** x0, y0, x1, y1 */
|
|
3
|
+
export type Rect = readonly [number, number, number, number];
|
|
4
|
+
/** The single outer boundary of (union of `base`) minus (union of `minus`), as a polygon with no collinear points. */
|
|
5
|
+
export declare function outlineFromRects(base: readonly Rect[], minus?: readonly Rect[]): Pt[];
|
|
6
|
+
/** The polygon grown by `d` mm all round (negative shrinks it): mitered, any winding. Use +kerf/2 for a part, -kerf/2 for a hole. */
|
|
7
|
+
export declare function offsetPoly(pts: readonly Pt[], d: number): Pt[];
|
|
8
|
+
export interface EdgeSpec {
|
|
9
|
+
/** Which cells are set in: 'odd' leaves this panel flush on the even cells. */
|
|
10
|
+
parity: 'even' | 'odd';
|
|
11
|
+
/** Also set in the corner cubes at the ends (a panel that does not own them). */
|
|
12
|
+
ends?: boolean;
|
|
13
|
+
/** A corner cube of size t sits at the start / end of the edge, outside the cell row. */
|
|
14
|
+
cubeStart?: boolean;
|
|
15
|
+
cubeEnd?: boolean;
|
|
16
|
+
/** Wanted cell width in mm (default 9). */
|
|
17
|
+
target?: number;
|
|
18
|
+
}
|
|
19
|
+
/** The cell row of an edge of length E: where it starts, how wide each cell is, and how many (odd). */
|
|
20
|
+
export declare function cellRow(E: number, t: number, s: Pick<EdgeSpec, 'cubeStart' | 'cubeEnd' | 'target'>): {
|
|
21
|
+
a0: number;
|
|
22
|
+
a1: number;
|
|
23
|
+
m: number;
|
|
24
|
+
cw: number;
|
|
25
|
+
};
|
|
26
|
+
/** The stretches [a, b] along an edge where the panel is set in by t, each widened by `fit` so the joint has a little play. */
|
|
27
|
+
export declare function notchSpans(E: number, t: number, s: EdgeSpec, fit?: number): [number, number][];
|
|
28
|
+
export interface Edges {
|
|
29
|
+
top?: EdgeSpec;
|
|
30
|
+
bottom?: EdgeSpec;
|
|
31
|
+
left?: EdgeSpec;
|
|
32
|
+
right?: EdgeSpec;
|
|
33
|
+
}
|
|
34
|
+
/** A w x h panel with joint notches on the edges given, minus `cuts` and plus `adds` (tabs for slots, etc.). */
|
|
35
|
+
export declare function jointOutline(w: number, h: number, t: number, edges: Edges, fit?: number, cuts?: readonly Rect[], adds?: readonly Rect[]): Pt[];
|
|
36
|
+
/** A rectangle as a polygon. */
|
|
37
|
+
export declare const rectPoly: (r: Rect) => Pt[];
|
|
38
|
+
/** A point turned about `c` by `deg` degrees (clockwise on the sheet, y down) . */
|
|
39
|
+
export declare const rotate: (p: Pt, c: Pt, deg: number) => Pt;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type FontName } from './laserPixels.js';
|
|
2
|
+
import { type Close, type Element } from './laserClearance.js';
|
|
3
|
+
import { LaserSheet, type Pt } from './laserSvg.js';
|
|
4
|
+
/** The Glowforge bed's usable area in mm, and the room left between parts on a sheet. */
|
|
5
|
+
export declare const BED: {
|
|
6
|
+
readonly w: 495;
|
|
7
|
+
readonly h: 279;
|
|
8
|
+
};
|
|
9
|
+
export declare const PART_GAP = 4;
|
|
10
|
+
export declare class Part {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly w: number;
|
|
13
|
+
readonly h: number;
|
|
14
|
+
readonly kerf: number;
|
|
15
|
+
readonly sheet: LaserSheet;
|
|
16
|
+
readonly elements: Element[];
|
|
17
|
+
readonly texts: {
|
|
18
|
+
text: string;
|
|
19
|
+
capMm: number;
|
|
20
|
+
}[];
|
|
21
|
+
constructor(name: string, w: number, h: number, kerf: number);
|
|
22
|
+
private el;
|
|
23
|
+
private shift;
|
|
24
|
+
/** The part's outline: grown by half a kerf. */
|
|
25
|
+
outline(pts: readonly Pt[]): void;
|
|
26
|
+
/** A hole or slot through the part: shrunk by half a kerf. */
|
|
27
|
+
hole(label: string, pts: readonly Pt[]): void;
|
|
28
|
+
holeRound(label: string, cx: number, cy: number, r: number): void;
|
|
29
|
+
outlineRound(cx: number, cy: number, r: number): void;
|
|
30
|
+
/** Engraving: convex polygons only (the preview and spacing check assume it). */
|
|
31
|
+
engrave(label: string, shapes: readonly (readonly Pt[])[]): void;
|
|
32
|
+
engraveRound(label: string, cx: number, cy: number, r: number): void;
|
|
33
|
+
text(s: string, font: FontName, cx: number, cy: number, px: number): void;
|
|
34
|
+
/** Pairs of elements nearer than `gap` mm (holes: `holeGap`). */
|
|
35
|
+
close(gap?: number, holeGap?: number): Close[];
|
|
36
|
+
get size(): {
|
|
37
|
+
w: number;
|
|
38
|
+
h: number;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface Placed {
|
|
42
|
+
name: string;
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
w: number;
|
|
46
|
+
h: number;
|
|
47
|
+
}
|
|
48
|
+
/** Rows of parts on one sheet (left to right, each row below the last). Throws if it does not fit the bed. */
|
|
49
|
+
export declare function packRows(title: string, rows: Part[][], w?: 495, gap?: number): {
|
|
50
|
+
sheet: LaserSheet;
|
|
51
|
+
placed: Placed[];
|
|
52
|
+
w: number;
|
|
53
|
+
h: number;
|
|
54
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { LaserSheet, type Pt } from './laserSvg.js';
|
|
2
|
+
export type Rect = readonly [x: number, y: number, w: number, h: number];
|
|
3
|
+
export interface Bitmap {
|
|
4
|
+
w: number;
|
|
5
|
+
h: number;
|
|
6
|
+
on: (x: number, y: number) => boolean;
|
|
7
|
+
}
|
|
8
|
+
export type FontName = 'pc' | 'micro';
|
|
9
|
+
/** Pixels across and down a capital letter, and the step from one letter to the next, in each font. */
|
|
10
|
+
export declare const FONTS: {
|
|
11
|
+
readonly pc: {
|
|
12
|
+
readonly cap: 7;
|
|
13
|
+
readonly adv: 8;
|
|
14
|
+
readonly gw: 7;
|
|
15
|
+
};
|
|
16
|
+
readonly micro: {
|
|
17
|
+
readonly cap: 5;
|
|
18
|
+
readonly adv: 4;
|
|
19
|
+
readonly gw: 3;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
/** Lit pixels as rectangles: a row's runs, joined by identical runs on the rows below. */
|
|
23
|
+
export declare function mergeRuns(b: Bitmap): Rect[];
|
|
24
|
+
/** Engrave every rectangle, its corners mapped from pixel space to millimeters by `map`. */
|
|
25
|
+
export declare function engraveRects(sheet: LaserSheet, rects: Rect[], map: (x: number, y: number) => Pt): void;
|
|
26
|
+
/** Only what a font can draw, in capitals (anything else is dropped, so a name never throws). */
|
|
27
|
+
export declare const drawable: (font: FontName, s: string) => string;
|
|
28
|
+
/** The width of `s` in pixels (the last letter's trailing gap left out). */
|
|
29
|
+
export declare const textPixels: (font: FontName, s: string) => number;
|
|
30
|
+
/** One line of text, centered on (cx, cy), each pixel `px` mm. Returns the text's width and height in mm. */
|
|
31
|
+
export declare function lineText(sheet: LaserSheet, s: string, font: FontName, cx: number, cy: number, px: number): {
|
|
32
|
+
w: number;
|
|
33
|
+
h: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Text set round a circle about (cx, cy): `top` reads left to right over the top with its feet at radius `r`; otherwise
|
|
37
|
+
* it runs along the bottom, left to right, with its feet at the outer radius `r` and its heads toward the middle.
|
|
38
|
+
* Each pixel is `px` mm. Returns the angle the line spans in degrees.
|
|
39
|
+
*/
|
|
40
|
+
export declare function arcText(sheet: LaserSheet, s: string, font: FontName, cx: number, cy: number, r: number, px: number, top: boolean): number;
|
|
41
|
+
export type Rgb = readonly [number, number, number];
|
|
42
|
+
/**
|
|
43
|
+
* A picture engraved by tone from its own colors (0 to 1 per channel; `rgb` gives undefined where clear): dark colors solid,
|
|
44
|
+
* mid colors (clothes, hair, hats) as a checker or lines coarse enough to read at coin size, skin and very light colors left
|
|
45
|
+
* as wood. Every edge pixel stays solid, and so does a mid pixel that touches skin or light wood, so collars, sleeves, belts
|
|
46
|
+
* and hems read as outlines and a figure never looks bare.
|
|
47
|
+
*/
|
|
48
|
+
export declare function toneBitmap(w: number, h: number, rgb: (x: number, y: number) => Rgb | undefined): Bitmap;
|
|
49
|
+
/** The angle in degrees `s` would span round a circle: what arcText returns, without drawing. */
|
|
50
|
+
export declare function arcSpanDeg(s: string, font: FontName, r: number, px: number, top: boolean): number;
|
|
51
|
+
/** The columns and rows holding lit pixels: [x0, y0, x1, y1] (end exclusive), or undefined when none. */
|
|
52
|
+
export declare function inkBox(b: Bitmap): [number, number, number, number] | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type LaserSheet } from './laserSvg.js';
|
|
2
|
+
/** RGB bytes, `pxPerMm` pixels to the millimeter, each pixel averaged from `ss` x `ss` samples. */
|
|
3
|
+
export declare function renderPreview(sheet: LaserSheet, pxPerMm: number, ss?: number): {
|
|
4
|
+
w: number;
|
|
5
|
+
h: number;
|
|
6
|
+
rgb: Uint8Array;
|
|
7
|
+
};
|
|
8
|
+
/** A truecolor PNG from RGB bytes. */
|
|
9
|
+
export declare function pngFromRgb(w: number, h: number, rgb: Uint8Array): Uint8Array;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const CUT = "#ff0000";
|
|
2
|
+
export declare const SCORE = "#ff00ff";
|
|
3
|
+
export declare const ENGRAVE = "#0000ff";
|
|
4
|
+
export declare const HAIRLINE = 0.1;
|
|
5
|
+
export type Pt = readonly [number, number];
|
|
6
|
+
export type Op = 'cut' | 'score' | 'engrave';
|
|
7
|
+
export type Item = {
|
|
8
|
+
op: Op;
|
|
9
|
+
k: 'circle';
|
|
10
|
+
cx: number;
|
|
11
|
+
cy: number;
|
|
12
|
+
r: number;
|
|
13
|
+
} | {
|
|
14
|
+
op: Op;
|
|
15
|
+
k: 'poly';
|
|
16
|
+
pts: Pt[];
|
|
17
|
+
} | {
|
|
18
|
+
op: 'engrave';
|
|
19
|
+
k: 'ring';
|
|
20
|
+
cx: number;
|
|
21
|
+
cy: number;
|
|
22
|
+
r0: number;
|
|
23
|
+
r1: number;
|
|
24
|
+
};
|
|
25
|
+
export declare class LaserSheet {
|
|
26
|
+
readonly w: number;
|
|
27
|
+
readonly h: number;
|
|
28
|
+
readonly items: Item[];
|
|
29
|
+
constructor(w: number, h: number);
|
|
30
|
+
add(item: Item): this;
|
|
31
|
+
/** Copy another sheet's items onto this one, moved by (dx, dy) millimeters. */
|
|
32
|
+
place(other: LaserSheet, dx: number, dy: number, only?: Op[]): this;
|
|
33
|
+
count(op: Op): number;
|
|
34
|
+
svg(title: string): string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Area, type Stream } from './grid.js';
|
|
2
|
+
export declare const CASTLE_MIN: {
|
|
3
|
+
w: number;
|
|
4
|
+
h: number;
|
|
5
|
+
};
|
|
6
|
+
export interface Castle {
|
|
7
|
+
area: Area;
|
|
8
|
+
/** Inside the gate. */
|
|
9
|
+
entry: number;
|
|
10
|
+
/** The far end of the keep. */
|
|
11
|
+
exit: number;
|
|
12
|
+
}
|
|
13
|
+
/** A castle filling a w by h area (at least 30 by 24). `path` draws a road from the gate to the keep door; `decorate` scatters decoration in the courtyard. */
|
|
14
|
+
export declare function castle(w: number, h: number, r: Stream, o: {
|
|
15
|
+
path: boolean;
|
|
16
|
+
decorate: boolean;
|
|
17
|
+
}): Castle;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Area, type Stream } from './grid.js';
|
|
2
|
+
export interface Dungeon {
|
|
3
|
+
area: Area;
|
|
4
|
+
entry: number;
|
|
5
|
+
exit: number;
|
|
6
|
+
rooms: number;
|
|
7
|
+
/** Whether decoration was placed (needs the role). */
|
|
8
|
+
decorated: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** A dungeon filling a w by h area (at least 12 by 12). `decorate` sprinkles decoration cells in the rooms. */
|
|
11
|
+
export declare function dungeon(w: number, h: number, r: Stream, decorate: boolean): Dungeon;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Area, type Stream } from './grid.js';
|
|
2
|
+
/** The cheapest route over per-cell costs (Dijkstra with a binary heap). */
|
|
3
|
+
export declare function route(a: Area, from: number, to: number, cost: Float32Array): number[];
|
|
4
|
+
export interface Forest {
|
|
5
|
+
area: Area;
|
|
6
|
+
entry: number;
|
|
7
|
+
exit: number;
|
|
8
|
+
open: number;
|
|
9
|
+
trail: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ForestUses {
|
|
12
|
+
path: boolean;
|
|
13
|
+
rock: boolean;
|
|
14
|
+
decor: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** A forest filling a w by h area (at least 12 by 12). The uses switch on the trail, rocks and flowers. */
|
|
17
|
+
export declare function forest(w: number, h: number, r: Stream, uses: ForestUses): Forest;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Facing, Role } from '../blockRoles.js';
|
|
2
|
+
import { type Area, type Stream } from './grid.js';
|
|
3
|
+
export declare const DIR: Record<Facing, readonly [number, number]>;
|
|
4
|
+
export interface Item {
|
|
5
|
+
cell: number;
|
|
6
|
+
role: Role;
|
|
7
|
+
/** Which way the front looks (the block with this facing is chosen). */
|
|
8
|
+
facing?: Facing;
|
|
9
|
+
/** A rug: walkable, drawn over the floor. */
|
|
10
|
+
open?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface Room {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
w: number;
|
|
16
|
+
h: number;
|
|
17
|
+
}
|
|
18
|
+
/** The facings each role has a block for (all four when a block of the role says none); a missing role has no entry. */
|
|
19
|
+
export type Avail = Partial<Record<Role, readonly Facing[]>>;
|
|
20
|
+
export declare function furnisher(area: Area, entry: number, avail: Avail, r: Stream, keep: Set<number>): {
|
|
21
|
+
items: Item[];
|
|
22
|
+
skipped: Set<string>;
|
|
23
|
+
commit: (list: Item[]) => boolean;
|
|
24
|
+
against: (room: Room, role: Role, len: number, walls?: readonly Facing[]) => boolean;
|
|
25
|
+
table: (room: Room, chairs: boolean, len: number) => number[] | undefined;
|
|
26
|
+
corner: (room: Room, role: Role) => boolean;
|
|
27
|
+
rug: (cells: number[]) => void;
|
|
28
|
+
free: (c: number) => boolean;
|
|
29
|
+
at: (x: number, y: number) => number;
|
|
30
|
+
shuffle: <T>(list: readonly T[]) => T[];
|
|
31
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Seeded random numbers (mulberry32): the same seed always gives the same stream. */
|
|
2
|
+
export declare function stream(seed: number): {
|
|
3
|
+
next: () => number;
|
|
4
|
+
/** An integer from lo to hi, both included. */
|
|
5
|
+
int: (lo: number, hi: number) => number;
|
|
6
|
+
chance: (p: number) => boolean;
|
|
7
|
+
pick: <T>(list: readonly T[]) => T;
|
|
8
|
+
};
|
|
9
|
+
export type Stream = ReturnType<typeof stream>;
|
|
10
|
+
/** What a cell of a generated area is, before blocks are chosen. */
|
|
11
|
+
export declare const WALL = 0;
|
|
12
|
+
export declare const FLOOR = 1;
|
|
13
|
+
export declare const PATH = 2;
|
|
14
|
+
export declare const TREE = 3;
|
|
15
|
+
export declare const ROCK = 4;
|
|
16
|
+
export declare const DECOR = 5;
|
|
17
|
+
/** Cells the props pass adds (open to walk on): a locked door, its key, treasure, a heart. */
|
|
18
|
+
export declare const LOCK = 6;
|
|
19
|
+
export declare const KEY = 7;
|
|
20
|
+
export declare const TREASURE = 8;
|
|
21
|
+
export declare const LIFE = 9;
|
|
22
|
+
/** Furniture a person cannot walk through (interiors); a door cell in a wall (open: the entry and exit of an interior, a gate). */
|
|
23
|
+
export declare const FURN = 10;
|
|
24
|
+
export declare const DOORC = 11;
|
|
25
|
+
/** Water (overworlds) and a house's roof row (towns); neither can be walked on. */
|
|
26
|
+
export declare const WATER = 12;
|
|
27
|
+
export declare const ROOF = 13;
|
|
28
|
+
/** Side views (platform): open air, a ladder, spikes (hurt), and a ledge that is solid on top only. */
|
|
29
|
+
export declare const SKY = 14;
|
|
30
|
+
export declare const LADDER = 15;
|
|
31
|
+
export declare const HAZARD = 16;
|
|
32
|
+
export declare const PLAT = 17;
|
|
33
|
+
/** Cells a person or monster cannot stand on. */
|
|
34
|
+
export declare const closed: (c: number) => c is 0 | 12 | 4 | 10 | 3 | 13;
|
|
35
|
+
export interface Area {
|
|
36
|
+
w: number;
|
|
37
|
+
h: number;
|
|
38
|
+
cells: Uint8Array;
|
|
39
|
+
}
|
|
40
|
+
export declare const newArea: (w: number, h: number, fill: number) => Area;
|
|
41
|
+
/** Steps from `from` to every open cell (-1 where it cannot be reached), moving along the four sides. */
|
|
42
|
+
export declare function distances(a: Area, from: number): Int32Array;
|
|
43
|
+
/** True when every one of the eight neighbors (and the cell) is open and inside the area. */
|
|
44
|
+
export declare function openAround(a: Area, x: number, y: number): boolean;
|
|
45
|
+
/** The open cell farthest from `from` by steps (the first of any tie in reading order). */
|
|
46
|
+
export declare function farthest(a: Area, from: number): number;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { type RoleMap } from '../blockRoles.js';
|
|
2
|
+
import { type GenKind } from './needs.js';
|
|
3
|
+
import { type LockInfo } from './props.js';
|
|
4
|
+
import { type SceneLink } from './town.js';
|
|
5
|
+
import { type PlatformProof } from './platform.js';
|
|
6
|
+
import type { Character } from '@lewismoten/gamemaker-sandbox-engine/formats/character';
|
|
7
|
+
import { type Item } from './furnish.js';
|
|
8
|
+
export { type Item as Furniture } from './furnish.js';
|
|
9
|
+
export { type SceneLink } from './town.js';
|
|
10
|
+
export { heroPhysics, weaker, type HeroPhysics } from './jumpModel.js';
|
|
11
|
+
export { capability, type Capability } from './platformCap.js';
|
|
12
|
+
export { reachFrom, type Step } from './platformReach.js';
|
|
13
|
+
export { LADDER as LADDER_CELL } from './grid.js';
|
|
14
|
+
export { closed as closedCell, DOORC as DOOR_CELL, FLOOR as FLOOR_CELL, LOCK as LOCK_CELL, PATH as PATH_CELL } from './grid.js';
|
|
15
|
+
export { type PlatformProof } from './platform.js';
|
|
16
|
+
export { type LockInfo } from './props.js';
|
|
17
|
+
export { KINDS, checkNeeds, kindInfo, type GenKind, type KindInfo, type NeedItem, type NeedsReport } from './needs.js';
|
|
18
|
+
export interface Rect {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
w: number;
|
|
22
|
+
h: number;
|
|
23
|
+
}
|
|
24
|
+
export interface GenParams {
|
|
25
|
+
kind: GenKind;
|
|
26
|
+
seed: number;
|
|
27
|
+
/** The part of the map to draw in (cells). */
|
|
28
|
+
rect: Rect;
|
|
29
|
+
/** Monster numbers (from the game's .mon file) that may be placed; none or left out: no monsters. */
|
|
30
|
+
monsters?: number[];
|
|
31
|
+
/** The map wraps over its edges (overworld land then lines up across the seam). */
|
|
32
|
+
wrap?: boolean;
|
|
33
|
+
/** The hero's character file: a platform layout is sized to his real jump (the other kinds ignore it). */
|
|
34
|
+
hero?: Character;
|
|
35
|
+
/** Platform: how much of the hero's most the layout asks of him, in percent (10 to 100; 80 when left out). */
|
|
36
|
+
difficulty?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare const MIN_SIDE = 10;
|
|
39
|
+
/** What the cells of a result are, for edges: which cells (area-local indexes) belong to a role's terrain. */
|
|
40
|
+
export type TerrainRole = 'wall' | 'tree' | 'path' | 'water';
|
|
41
|
+
export interface GenResult {
|
|
42
|
+
rect: Rect;
|
|
43
|
+
/** A block number per cell of the rectangle, in reading order. */
|
|
44
|
+
blocks: Uint8Array;
|
|
45
|
+
/** The same cells as a plain kind (0 wall, 1 floor, 2 path, 3 tree, 4 rock, 5 decoration). */
|
|
46
|
+
kinds: Uint8Array;
|
|
47
|
+
/** Cells (rectangle-local indexes) a terrain brush should give edges and corners to. */
|
|
48
|
+
terrainCells: Partial<Record<TerrainRole, number[]>>;
|
|
49
|
+
/** Where the hero could come in, and a far cell for an exit, as rectangle-local indexes. Proposals only. */
|
|
50
|
+
entry: number;
|
|
51
|
+
exit: number;
|
|
52
|
+
/** Locked doors with the cell of the key that opens each (rectangle-local), nearest the entry first. Dungeons only. */
|
|
53
|
+
locks: LockInfo[];
|
|
54
|
+
/** Cells of treasure, and of a heart or extra life if one was placed (rectangle-local). */
|
|
55
|
+
treasure: number[];
|
|
56
|
+
life?: number;
|
|
57
|
+
/** Monsters to place as map monsters: a monster number and a rectangle-local start cell. */
|
|
58
|
+
monsters: {
|
|
59
|
+
cell: number;
|
|
60
|
+
monnum: number;
|
|
61
|
+
}[];
|
|
62
|
+
/** Furniture (interiors): the cell, the role, which way the front looks, and the block chosen. Rugs are walkable. */
|
|
63
|
+
furniture: (Item & {
|
|
64
|
+
block: number;
|
|
65
|
+
})[];
|
|
66
|
+
/** Where the shopkeeper could stand (shops), a proposal like the entry. */
|
|
67
|
+
shopkeeper?: number;
|
|
68
|
+
/** Doors and sites a person could link to other scenes (towns and overworlds): proposals only, nothing is linked. */
|
|
69
|
+
links: SceneLink[];
|
|
70
|
+
/** Platform only: what was proven by jump math, the difficulty drawn and what the hero can do (cells). */
|
|
71
|
+
platform?: {
|
|
72
|
+
proof: PlatformProof;
|
|
73
|
+
difficulty: number;
|
|
74
|
+
can: {
|
|
75
|
+
rise: number;
|
|
76
|
+
gap: number;
|
|
77
|
+
};
|
|
78
|
+
asked: {
|
|
79
|
+
rise: number;
|
|
80
|
+
gap: number;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
/** What was left out, in plain words. */
|
|
84
|
+
notes: string[];
|
|
85
|
+
}
|
|
86
|
+
export type GenOutcome = {
|
|
87
|
+
ok: true;
|
|
88
|
+
result: GenResult;
|
|
89
|
+
} | {
|
|
90
|
+
ok: false;
|
|
91
|
+
message: string;
|
|
92
|
+
};
|
|
93
|
+
/** The seed of offer `i` (0..3) from a base seed: four different layouts that stay the same every time. */
|
|
94
|
+
export declare const offerSeed: (base: number, i: number) => number;
|
|
95
|
+
/** Draws one layout into `params.rect`. Fails with a plain message when a needed role is missing or the area is small. */
|
|
96
|
+
export declare function generate(roles: RoleMap, params: GenParams): GenOutcome;
|
|
97
|
+
/** Whether every open cell of a result can be reached from its entry (a check the generators should always pass). */
|
|
98
|
+
export declare function verifyReach(result: GenResult): {
|
|
99
|
+
ok: boolean;
|
|
100
|
+
open: number;
|
|
101
|
+
reached: number;
|
|
102
|
+
};
|
|
103
|
+
export interface Proof {
|
|
104
|
+
/** Every open cell can be reached from the entry (locks opened by their keys). */
|
|
105
|
+
reach: boolean;
|
|
106
|
+
/** Each key can be reached before its own lock (and every lock after it). */
|
|
107
|
+
keysFirst: boolean;
|
|
108
|
+
/** Every key, treasure and the exit can be collected by playing the keys out. */
|
|
109
|
+
collectable: boolean;
|
|
110
|
+
/** Furniture: every piece has a reachable open side, each chair looks at a table and the door's inside is open. True with none. */
|
|
111
|
+
furnished: boolean;
|
|
112
|
+
/** Every proposed door and site (towns, overworlds) can be reached from the entry. True with none. */
|
|
113
|
+
linked: boolean;
|
|
114
|
+
}
|
|
115
|
+
/** The generator's own proof for a result: reach, key-before-lock and that everything can be collected. */
|
|
116
|
+
export declare function proveResult(result: GenResult): Proof;
|
|
117
|
+
export declare const PROP_KINDS: {
|
|
118
|
+
LOCK: number;
|
|
119
|
+
KEY: number;
|
|
120
|
+
TREASURE: number;
|
|
121
|
+
LIFE: number;
|
|
122
|
+
};
|
|
123
|
+
export interface PlatformParams {
|
|
124
|
+
/** The block set's roles (needs wall and sky; ladder, platform, hazard, wall-top, treasure, life, a lock and key pair and decoration are used when set). */
|
|
125
|
+
roles: RoleMap;
|
|
126
|
+
/** The hero's character file (hero.chr, parsed): his walk, jump and climb size the layout. */
|
|
127
|
+
hero: Character;
|
|
128
|
+
/** The same seed always draws the same layout. */
|
|
129
|
+
seed: number;
|
|
130
|
+
/** Where in the map to draw: at least 40 by 20 cells (more than 120 by 24 is drawn in the middle). */
|
|
131
|
+
rect: Rect;
|
|
132
|
+
/** How much of the hero's most (pit width, step height) it asks, in percent: 10 to 100, 80 when left out. */
|
|
133
|
+
difficulty?: number;
|
|
134
|
+
/** Monster numbers to stand on the long stretches. */
|
|
135
|
+
monsters?: number[];
|
|
136
|
+
}
|
|
137
|
+
/** A side view layout for a game's build.ts: `generate` with the platform kind. See the tools README. */
|
|
138
|
+
export declare function generatePlatform(p: PlatformParams): GenOutcome;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Area, type Stream } from './grid.js';
|
|
2
|
+
import { type Avail, type Item } from './furnish.js';
|
|
3
|
+
export interface Interior {
|
|
4
|
+
area: Area;
|
|
5
|
+
entry: number;
|
|
6
|
+
exit: number;
|
|
7
|
+
items: Item[];
|
|
8
|
+
/** Where the shopkeeper could stand (shops, behind the counter). */
|
|
9
|
+
shopkeeper?: number;
|
|
10
|
+
/** Roles whose pieces were left out because no block faced the right way. */
|
|
11
|
+
skipped: string[];
|
|
12
|
+
}
|
|
13
|
+
export declare const INTERIOR_MIN: {
|
|
14
|
+
w: number;
|
|
15
|
+
h: number;
|
|
16
|
+
};
|
|
17
|
+
/** An interior filling at most a 24 (home) or 26 (shop) by 16 or 14 part of the middle of a w by h area. */
|
|
18
|
+
export declare function interior(w: number, h: number, r: Stream, kind: 'home' | 'shop', avail: Avail): Interior;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type Character } from '@lewismoten/gamemaker-sandbox-engine/formats/character';
|
|
2
|
+
export interface HeroPhysics {
|
|
3
|
+
/** Pixels a tick when walking (and when steering in the air). */
|
|
4
|
+
vx: number;
|
|
5
|
+
/** The jump's pushes: the upward push (negative) added to his speed on each tick it lasts, from tick 0. */
|
|
6
|
+
push: number[];
|
|
7
|
+
/** Whether he can steer in the air (the jump is not a sequence the walk key cannot interrupt). */
|
|
8
|
+
steer: boolean;
|
|
9
|
+
/** A climbing sequence exists (up key moves him up while the block holds him). */
|
|
10
|
+
climb: boolean;
|
|
11
|
+
/** The highest a jump takes him, in pixels (straight up). */
|
|
12
|
+
rise: number;
|
|
13
|
+
/** The keys (PC scan codes) of his moves, as the character file sets them. A bot presses these. */
|
|
14
|
+
keys: {
|
|
15
|
+
right: number;
|
|
16
|
+
left?: number;
|
|
17
|
+
jump: number;
|
|
18
|
+
up?: number;
|
|
19
|
+
down?: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export type PhysicsOutcome = {
|
|
23
|
+
ok: true;
|
|
24
|
+
physics: HeroPhysics;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
/** Reads the hero's walk, jump and climb from a character file; a plain message when a side view cannot be made for him. */
|
|
30
|
+
export declare function heroPhysics(chr: Character): PhysicsOutcome;
|
|
31
|
+
/** A copy of the physics made weaker (0..1 of the walk speed and of the jump push), for checking with margin. */
|
|
32
|
+
export declare function weaker(p: HeroPhysics, speed: number, push: number): HeroPhysics;
|
|
33
|
+
/** Longest arc played (ticks). */
|
|
34
|
+
export declare const ARC_TICKS = 90;
|
|
35
|
+
/**
|
|
36
|
+
* One jump (the push at once) or a fall (no push) played a tick at a time: `dir` is -1, 0 or 1, and he steers that
|
|
37
|
+
* way for `steerTicks` ticks (then lets go). `step` gives the pixels moved on a tick (x to the right, y down), before
|
|
38
|
+
* anything is in the way; `bump` is a ceiling stopping the rise.
|
|
39
|
+
*/
|
|
40
|
+
export declare class Flight {
|
|
41
|
+
private readonly p;
|
|
42
|
+
private readonly kind;
|
|
43
|
+
private readonly dir;
|
|
44
|
+
private readonly steerTicks;
|
|
45
|
+
private vy;
|
|
46
|
+
private t;
|
|
47
|
+
constructor(p: HeroPhysics, kind: 'jump' | 'fall', dir: -1 | 0 | 1, steerTicks: number);
|
|
48
|
+
step(): {
|
|
49
|
+
dx: number;
|
|
50
|
+
dy: number;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* A block with no gravity holds him (engine/character.ts onGround): the tick he reaches it his speed fades to 5/6 once; after
|
|
54
|
+
* that `slide` moves him by his speed and fades it twice a tick (the ground check runs after the sideways move and again
|
|
55
|
+
* after the vertical one), while the walk key goes on steering him for its ticks.
|
|
56
|
+
*/
|
|
57
|
+
fade(): void;
|
|
58
|
+
slide(): {
|
|
59
|
+
dx: number;
|
|
60
|
+
dy: number;
|
|
61
|
+
done: boolean;
|
|
62
|
+
};
|
|
63
|
+
/** He has landed (the ground check stopped his fall): his speed is gone, and the gravity clock runs on. */
|
|
64
|
+
land(): void;
|
|
65
|
+
bump(): void;
|
|
66
|
+
}
|
|
67
|
+
/** The pixels moved on each tick of a jump or fall in the open. */
|
|
68
|
+
export declare function arcOf(p: HeroPhysics, kind: 'jump' | 'fall', dir: -1 | 0 | 1, steerTicks: number): {
|
|
69
|
+
dx: number[];
|
|
70
|
+
dy: number[];
|
|
71
|
+
};
|
|
72
|
+
export interface ArcVariant {
|
|
73
|
+
kind: 'jump' | 'fall';
|
|
74
|
+
dir: -1 | 0 | 1;
|
|
75
|
+
steerTicks: number;
|
|
76
|
+
}
|
|
77
|
+
/** The arcs the reach search tries: a jump or a fall, either way or straight up, steering for different lengths. */
|
|
78
|
+
export declare function arcVariants(): ArcVariant[];
|