From d7fb0a2f3f742d48dc86ee5476dc7b1aac237560 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Thu, 28 Mar 2019 15:58:01 +0800 Subject: [PATCH] Custom System Event --- _server/comment.js | 4 ++-- libs/events.js | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/_server/comment.js b/_server/comment.js index cdf576e4..d4c1ac53 100644 --- a/_server/comment.js +++ b/_server/comment.js @@ -227,8 +227,8 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = "openDoor", "passNet", "changeLight", - "ski", - "pushBox" + "pushBox", + "custom" ] }, "_data": "该图块的默认触发器" diff --git a/libs/events.js b/libs/events.js index a79963ff..7a0bef05 100644 --- a/libs/events.js +++ b/libs/events.js @@ -251,7 +251,7 @@ events.prototype.unregisterSystemEvent = function (type) { events.prototype.doSystemEvent = function (type, data, callback) { if (this.systemEvents[type]) { try { - return core.doFunc(this.systemEvents[type], this, data, data, callback); + return core.doFunc(this.systemEvents[type], this, data, callback); } catch (e) { main.log(e); @@ -688,6 +688,11 @@ events.prototype._sys_action = function (data, callback) { this.insertAction(ev, ex, ey, callback); } +events.prototype._sys_custom = function (data, callback) { + core.insertAction(["请使用\r[yellow]core.registerSystemEvent('custom', func)\r来处理自己添加的系统触发器!"], + data.x, data.y, callback); +} + // ------ 自定义事件的处理 ------ // ////// 注册一个自定义事件 //////