landsandboat/scripts/items/astral_cube.lua
claywar 6e4fa2af25
[type] Add type annotations to Item scripts
rename to reflect type definition

Annotate xi.itemUtils.foodOnItemCheck

Make TItemFood functions optional, since the definition does not include types
2024-08-24 18:25:26 -04:00

24 lines
583 B
Lua

-----------------------------------
-- ID: 6413
-- Item: Astral Cube
-- Item Effect: Grant Astral cube key item
-----------------------------------
---@type TItem
local itemObject = {}
local keyItemId = xi.ki.ASTRAL_CUBE
itemObject.onItemCheck = function(target, item, param, caster)
if target:hasKeyItem(keyItemId) then
return xi.msg.basic.ALREADY_HAVE_KEY_ITEM, 0, keyItemId
end
return 0
end
itemObject.onItemUse = function(target)
target:addKeyItem(keyItemId)
target:messageBasic(xi.basic.OBTAINED_KEY_ITEM, 6413, keyItemId)
end
return itemObject