fix:plugin引入类型检查

This commit is contained in:
ShakeFlower 2025-04-25 09:04:32 +08:00
parent a76b68ef87
commit 2ef2b89985
3 changed files with 14 additions and 5 deletions

View File

@ -1101,7 +1101,7 @@ editor_file = function (editor, callback) {
for (var id_ in plmap) {
plraw = plraw.replace('"' + id_ + '"', plmap[id_])
}
var datastr = '/// <reference path="../runtime.d.ts" />\nvar plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = \n';
var datastr = '// @ts-check\n/// <reference path="../runtime.d.ts" />\nvar plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = \n';
datastr += plraw;
fs.writeFile('project/plugins.js', encode(datastr), 'base64', function (err, data) {
callback(err);

View File

@ -1,3 +1,4 @@
// @ts-check
/// <reference path="../runtime.d.ts" />
var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
{

14
runtime.d.ts vendored
View File

@ -11,6 +11,7 @@ type rgbarray = [number, number, number, number]
type Events = MotaAction[] | string
type Block = {
disable: boolean,
x: number,
y: number,
id: number,
@ -281,11 +282,11 @@ type gameStatus = {
// event事件
shops: {}
event: {
id: string
id?: string | null
data: any
selection: any
ui: any
interval: number
interval?: number | null
}
autoEvents: Events
textAttribute: {
@ -325,6 +326,11 @@ type gameStatus = {
/** @file control.js 主要用来进行游戏控制,比如行走控制、自动寻路、存读档等等游戏核心内容。 */
interface control {
_updateDamage_damage(floorId: string, onMap: boolean): void
_updateDamage_extraDamage(floorId: string, onMap: boolean): void
/** 物品数据显示 */
getItemDetail(floorId: string): void
/**
* , Ctrl键进行穿墙,
*
@ -2243,6 +2249,7 @@ interface items {
/** @file ui.js 主要用来进行UI窗口的绘制如对话框、怪物手册、楼传器、存读档界面等等。*/
interface ui {
_buildFont(fontSize?: number | string, bold?: boolean, italic?: boolean, font?: string): string
/**
* contextnull
@ -3006,7 +3013,8 @@ type CoreMixin = {
favorite: []
readonly favoriteName: {}
}
readonly initStatus: gameStatus;
readonly initStatus: gameStatus
readonly canvas: { [key: string]: CanvasRenderingContext2D }
readonly dymCanvas: { [key: string]: CanvasRenderingContext2D }
/** 游戏状态 */
readonly status: gameStatus