Module:CampsData

From Against the Storm Official Wiki
Revision as of 22:33, 4 November 2024 by Aeredor (talk | contribs) (Refactoring to better inherit BaseDataModel; improving Luadoc)

Documentation for this module may be created at Module:CampsData/doc

---@class CampsData
---`extends BaseDataModel`
local CampsData = {}



--region Dependencies

---@type BaseDataModel
local BaseDataModel = require("Module:BaseDataModel")

local INDEX = BaseDataModel.INDEX

--endregion




--region Private constants
local DATA_FILE = "Module:CampsData/Camps.json"
--endregion



--region Private member variables
---@type BaseDataModel
local campsDataModel = BaseDataModel.new(DATA_FILE)
--endregion



--region Public building interface

---@protected
---@function
---Initializes the specified record with special information related to this data model.
---
---@param id string building ID
---@overload BaseDataModel
function CampsData:initializeRecord(id)
    local record = self.dataTable[id]
    record[INDEX.CATEGORY2] = "Gathering Camp"
end

---@public
---@function
---Checks whether the specified ID is a service-type building from this instance's data.
---
---@param id string building ID
---@return boolean _true_ if a service building, _false_ if not, or nil if not found
---@overload BaseDataModel
function CampsData:isServiceBuilding(id)
    -- Ignores the parameter; nothing in this data is a service building
    id = id
    return false
end

--endregion


return campsDataModel