Custom System Event

This commit is contained in:
ckcz123 2019-03-28 15:58:01 +08:00
parent bf20f9ce92
commit d7fb0a2f3f
2 changed files with 8 additions and 3 deletions

View File

@ -227,8 +227,8 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"openDoor",
"passNet",
"changeLight",
"ski",
"pushBox"
"pushBox",
"custom"
]
},
"_data": "该图块的默认触发器"

View File

@ -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);
}
// ------ 自定义事件的处理 ------ //
////// 注册一个自定义事件 //////