2,875
edits
m (Changed Ship Table header from 'Survey Time Decrease' to 'Cartography Interval'; This modifier effects more than survey intervals) |
No edit summary |
||
Line 19: | Line 19: | ||
return GameData.getEntityByID('shopPurchases', id) | return GameData.getEntityByID('shopPurchases', id) | ||
end | end | ||
-- Accepts a function(purchase, name) and a category. | |||
-- Prevents external modules from having to make GameData and Common calls. | |||
function p.getCategoryPurchases(checkFunc, category) | |||
local cat = GameData.getEntityByName('shopCategories', category) | |||
if shopCat == nil then | |||
return Shared.printError('Invalid category ' .. cat) | |||
end | |||
-- We make a nested func to resolve the item name first, if required. | |||
local func = | |||
function(purchase) | |||
local name = Common.getPurchaseName(purchase) | |||
return checkFunc(purchase, name) | |||
end | |||
return GameData.getEntities('shopPurchases', func) | |||
end | |||
function p.getPurchases(checkFunc) | function p.getPurchases(checkFunc) |
edits