detach hook-calling to make prototype function able to run anytime.
This commit is contained in:
parent
6aa4e18982
commit
08de74b1ab
12
game/game.js
12
game/game.js
|
@ -33426,13 +33426,15 @@
|
||||||
addNature:(nature,translation,config)=>{
|
addNature:(nature,translation,config)=>{
|
||||||
if(!nature) throw new TypeError();
|
if(!nature) throw new TypeError();
|
||||||
if(translation&&translation.length) lib.translate['nature_'+nature]=translation;
|
if(translation&&translation.length) lib.translate['nature_'+nature]=translation;
|
||||||
lib.onload.add(()=>{
|
var hookCall=()=>{
|
||||||
for(const hook of lib.hooks.addNature){
|
for(const hook of lib.hooks.addNature){
|
||||||
if(hook!=null&&typeof hook=="function"){
|
if(hook!=null&&typeof hook=="function"){
|
||||||
hook(nature,translation,config);
|
hook(nature,translation,config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
};
|
||||||
|
if ("onload" in lib) lib.onload.add(hookCall);
|
||||||
|
else hookCall();
|
||||||
return nature;
|
return nature;
|
||||||
},
|
},
|
||||||
//设置卡牌信息/事件的属性
|
//设置卡牌信息/事件的属性
|
||||||
|
@ -33500,13 +33502,15 @@
|
||||||
lib.group.add(id);
|
lib.group.add(id);
|
||||||
if(short)lib.translate[id] = short;
|
if(short)lib.translate[id] = short;
|
||||||
if(name)lib.translate[`${id}2`] = name;
|
if(name)lib.translate[`${id}2`] = name;
|
||||||
lib.onload.add(()=>{
|
var hookCall=()=>{
|
||||||
for(const hook of lib.hooks.addGroup){
|
for(const hook of lib.hooks.addGroup){
|
||||||
if(hook!=null&&typeof hook=="function"){
|
if(hook!=null&&typeof hook=="function"){
|
||||||
hook(id,short,name,config);
|
hook(id,short,name,config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
};
|
||||||
|
if ("onload" in lib) lib.onload.add(hookCall);
|
||||||
|
else hookCall();
|
||||||
return id;
|
return id;
|
||||||
},
|
},
|
||||||
//Yingbian
|
//Yingbian
|
||||||
|
|
Loading…
Reference in New Issue