Disable mset for now
This commit is contained in:
parent
7b04080e9e
commit
a6d093d728
13
builtins.ts
13
builtins.ts
@ -127,12 +127,13 @@ const faux = {
|
||||
}
|
||||
return getMapSheet(mapSheet).get(x, y)[1];
|
||||
},
|
||||
mset: (mapSheet: number, x: number, y: number, sprSheet: number, spr: number) => {
|
||||
if (x < 0 || x >= 64 || y < 0 || y >= 64) {
|
||||
return;
|
||||
}
|
||||
getMapSheet(mapSheet).set(x, y, [sprSheet, spr]);
|
||||
},
|
||||
// Temporarily removing mset, since it would overwrite static cart data
|
||||
// mset: (mapSheet: number, x: number, y: number, sprSheet: number, spr: number) => {
|
||||
// if (x < 0 || x >= 64 || y < 0 || y >= 64) {
|
||||
// return;
|
||||
// }
|
||||
// getMapSheet(mapSheet).set(x, y, [sprSheet, spr]);
|
||||
// },
|
||||
// Input
|
||||
[CHAR.UP]: K.ARROW_UP,
|
||||
[CHAR.DOWN]: K.ARROW_DOWN,
|
||||
|
7
cart.ts
7
cart.ts
@ -2,7 +2,8 @@ import { path } from "./deps.ts";
|
||||
import initialCart from "./initialCart.json" assert { type: "json" };
|
||||
import { Sheet } from "./sheet.ts";
|
||||
|
||||
let cart = initialCart as Array<Sheet>;
|
||||
let staticCart = initialCart as Array<Sheet>;
|
||||
let cart: Array<Sheet> = JSON.parse(JSON.stringify(staticCart));
|
||||
|
||||
const virtualPathToRealPath = (virtualFname: string) => {
|
||||
const realPath = path.join(".", "carts", ...virtualFname.split("/"));
|
||||
@ -14,7 +15,9 @@ export const saveCart = async (fname: string) => {
|
||||
}
|
||||
|
||||
export const loadCart = async (fname: string) => {
|
||||
cart = JSON.parse(await Deno.readTextFile(virtualPathToRealPath(fname+".fx")));
|
||||
const json = await Deno.readTextFile(virtualPathToRealPath(fname+".fx"));
|
||||
staticCart = JSON.parse(json);
|
||||
cart = JSON.parse(json);
|
||||
}
|
||||
|
||||
export const getCart = () => {
|
||||
|
@ -51,7 +51,7 @@ And math symbols:
|
||||
|
||||
- `mgetsht(mapSheet: number, x: number, y: number)` returns the sheet number of the sprite at tile (x,y) in the given map
|
||||
- `mgetspr(mapSheet: number, x: number, y: number)` returns the sprite number within it's sheet of the sprite at tile (x,y) in the given map
|
||||
- `mset(mapSheet: number, x: number, y: number, sprSheet: number, spr: number)` sets the sprite at tile (x,y) in the given map to the given sprite of the given spritesheet.
|
||||
- `mset(mapSheet: number, x: number, y: number, sprSheet: number, spr: number)` sets the sprite at tile (x,y) in the given map to the given sprite of the given spritesheet. **(THIS FUNCTION IS TEMPORARILY UNAVAILABLE.)**
|
||||
|
||||
### Input
|
||||
|
||||
|
3
sheet.ts
3
sheet.ts
@ -18,7 +18,7 @@ export type Sheet = {
|
||||
}
|
||||
export type SheetType = Sheet["sheet_type"];
|
||||
|
||||
export const getSheet = (n: number) => {
|
||||
export const getSheet = (n: number): Sheet => {
|
||||
return getCart()[n];
|
||||
}
|
||||
|
||||
@ -51,5 +51,6 @@ export const getMapSheet = (sheet: number) => {
|
||||
if (sheet_type !== "map") {
|
||||
throw "Trying to use a non-map sheet as a map."
|
||||
}
|
||||
sheet_type
|
||||
return LinearGrid(value, 64);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user