添加2个接口
- setPlayerUIItem - getPlayerUIItem
This commit is contained in:
Vendored
+14
@@ -1043,6 +1043,20 @@ interface Player {
|
||||
|
||||
/** (GMLIB)获取玩家盔甲值 */
|
||||
getArmorValue(): number;
|
||||
|
||||
/** (GMLIB)设置玩家UI栏物品 */
|
||||
setPlayerUIItem(
|
||||
/** 槽位 */
|
||||
slot: number,
|
||||
/** 物品 */
|
||||
item: Item
|
||||
): void;
|
||||
|
||||
/** (GMLIB)获取玩家UI栏物品 */
|
||||
setPlayerUIItem(
|
||||
/** 槽位 */
|
||||
slot: number
|
||||
): Item;
|
||||
}
|
||||
|
||||
interface Entity {
|
||||
|
||||
+25
-1
@@ -327,7 +327,11 @@ const GMLIB_API = {
|
||||
/** 获取物品BUFF效果名称 @type {function(Item):string} */
|
||||
getItemEffecName: ll.import("GMLIB_API", "getItemEffecName"),
|
||||
/** 物品是否为食物 @type {function(Item):boolean} */
|
||||
itemIsFood: ll.import("GMLIB_API", "itemIsFood")
|
||||
itemIsFood: ll.import("GMLIB_API", "itemIsFood"),
|
||||
/** 设置玩家UI栏物品 @type {function(Player,number,Item):void} */
|
||||
setPlayerUIItem: ll.import("GMLIB_API", "setPlayerUIItem"),
|
||||
/** 获取玩家UI栏物品 @type {function(Player,number):Item} */
|
||||
getPlayerUIItem: ll.import("GMLIB_API", "getPlayerUIItem")
|
||||
}
|
||||
|
||||
/** 静态悬浮字类列表 @type {Map<number,StaticFloatingText>} */
|
||||
@@ -2434,6 +2438,26 @@ LLSE_Item.prototype.isFood =
|
||||
return GMLIB_API.itemIsFood(this);
|
||||
}
|
||||
|
||||
LLSE_Player.prototype.setPlayerUIItem =
|
||||
/**
|
||||
* 设置玩家UI栏物品
|
||||
* @param {number} slot 格子槽位
|
||||
* @param {Item} item 要设置的物品
|
||||
*/
|
||||
function (slot, item) {
|
||||
return GMLIB_API.setPlayerUIItem(this, slot, item);
|
||||
}
|
||||
|
||||
LLSE_Player.prototype.setPlayerUIItem =
|
||||
/**
|
||||
* 获取玩家UI栏物品
|
||||
* @param {number} slot 格子槽位
|
||||
* @returns {Item} 物品对象
|
||||
*/
|
||||
function (slot) {
|
||||
return GMLIB_API.getPlayerUIItem(this, slot);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
StaticFloatingText,
|
||||
DynamicFloatingText,
|
||||
|
||||
@@ -862,4 +862,10 @@ void Export_Compatibility_API() {
|
||||
}
|
||||
return false;
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "setPlayerUIItem", [](Player* player, int slot, ItemStack const* item) -> void {
|
||||
player->setPlayerUIItem((PlayerUISlot)slot, *item);
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "getPlayerUIItem", [](Player* player, int slot) -> void {
|
||||
player->getPlayerUIItem((PlayerUISlot)slot);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user