diff --git a/src/Item/Item.lua b/src/Item/Item.lua index f774457..35938ba 100644 --- a/src/Item/Item.lua +++ b/src/Item/Item.lua @@ -171,18 +171,21 @@ function Item:Usable() end -- Set a script to check if the Item is Usable +---@param func fun(self:Item):boolean function Item:UsableIf(func) self.UsableIfFunc = func return self end -- Set a script to run before the Item has been Use +---@param func fun(self:Item) function Item:PreUse(func) self.PreUseFunc = func return self end -- Set a script to run after the Item has been Use +---@param func fun(self:Item) function Item:OnUse(func) self.OnUseFunc = func return self diff --git a/src/ItemBook/ItemBook.lua b/src/ItemBook/ItemBook.lua index 32fadb5..34282c3 100644 --- a/src/ItemBook/ItemBook.lua +++ b/src/ItemBook/ItemBook.lua @@ -13,6 +13,7 @@ function ItemBook:New() end -- Get a spell from the ItemBook +---@return Item function ItemBook:GetItem(id) if self.items[id] == nil then self.items[id] = Bastion.Item:New(id) diff --git a/src/Spell/Spell.lua b/src/Spell/Spell.lua index 1831e46..285e34a 100644 --- a/src/Spell/Spell.lua +++ b/src/Spell/Spell.lua @@ -51,6 +51,7 @@ function Spell:GetID() end -- Add post cast func +---@param func fun(self:Spell) function Spell:PostCast(func) self.PostCastFunc = func return self @@ -174,18 +175,21 @@ function Spell:Castable() end -- Set a script to check if the spell is castable +---@param func fun(spell:Spell):boolean function Spell:CastableIf(func) self.CastableIfFunc = func return self end -- Set a script to run before the spell has been cast +---@param func fun(spell:Spell) function Spell:PreCast(func) self.PreCastFunc = func return self end -- Set a script to run after the spell has been cast +---@param func fun(spell:Spell) function Spell:OnCast(func) self.OnCastFunc = func return self diff --git a/src/UnitManager/UnitManager.lua b/src/UnitManager/UnitManager.lua index b7fa7e1..c6a3ea0 100644 --- a/src/UnitManager/UnitManager.lua +++ b/src/UnitManager/UnitManager.lua @@ -147,6 +147,9 @@ function UnitManager:SetObject(unit) end -- Create a custom unit and cache it for .5 seconds +---@param token string +---@param cb fun():Unit +---@return Unit function UnitManager:CreateCustomUnit(token, cb) local unit = cb() local cachedUnit = Bastion.Cacheable:New(unit, cb) @@ -177,6 +180,7 @@ function UnitManager:EnumFriends(cb) end -- Enum Enemies (object manager) +---@param cb fun(unit: Unit):boolean function UnitManager:EnumEnemies(cb) Bastion.ObjectManager.activeEnemies:each(function(unit) if cb(unit) then