Module:RainCollectorsData: Difference between revisions
From Against the Storm Official Wiki
(Created to separate rain collectors from other collectors (mine, huts, etc.)) |
(Now an instance override of BaseDataModel; functional change) |
||
Line 1: | Line 1: | ||
---@module RainCollectorsData | ---@module RainCollectorsData | ||
--- | |||
---This module does not define an _actual_ derived class, but it creates an instance of one via prototyping patterns. Understand this file as a big procedure, top-to-bottom, rather than a class definition. | |||
--- | |||
---Initializes a BaseDataModel with the data file associated with this module. Makes necessary modifications to the basic data, including schema and method overrides, to permit the exceptions associated with data in this model. | |||
--Create instance | |||
local BaseDataModel = require("Module:BaseDataModel") | local BaseDataModel = require("Module:BaseDataModel") | ||
local DATA_FILE = "Module:RainCollectorsData/RainCatchers.json" | local DATA_FILE = "Module:RainCollectorsData/RainCatchers.json" | ||
---@type BaseDataModel | |||
local rainCollectorsDataModel = BaseDataModel.new(DATA_FILE) | |||
--Begin instance overrides | |||
for _, building in pairs(rainCollectorsDataModel.dataTable) do | |||
building[rainCollectorsDataModel.schema.CATEGORY2] = "Extraction Building" | |||
building[rainCollectorsDataModel.schema.IS_PROVIDING_SERVICES] = false | |||
end | |||
rainCollectorsDataModel.schema.RECIPE.PRODUCTION_TIME = "gatheringTime" | |||
--/** Function definitions follow. **/ | |||
--Collapse the regions in the IDE to see the procedure pick up with the assignments of these functions to override the associated member methods of BaseDataModel. | |||
--region Public building interface | |||
--no overrides! | |||
--endregion | |||
--region Public building recipe query interface | |||
--no overrides! | |||
--endregion | |||
--region Public recipe data retrieval interface | |||
--no overrides! | |||
--endregion | |||
--/** End Function definitions. Procedure resumes. **/ | |||
return rainCollectorsDataModel | return rainCollectorsDataModel |
Latest revision as of 22:29, 8 November 2024
Documentation for this module may be created at Module:RainCollectorsData/doc
---@module RainCollectorsData --- ---This module does not define an _actual_ derived class, but it creates an instance of one via prototyping patterns. Understand this file as a big procedure, top-to-bottom, rather than a class definition. --- ---Initializes a BaseDataModel with the data file associated with this module. Makes necessary modifications to the basic data, including schema and method overrides, to permit the exceptions associated with data in this model. --Create instance local BaseDataModel = require("Module:BaseDataModel") local DATA_FILE = "Module:RainCollectorsData/RainCatchers.json" ---@type BaseDataModel local rainCollectorsDataModel = BaseDataModel.new(DATA_FILE) --Begin instance overrides for _, building in pairs(rainCollectorsDataModel.dataTable) do building[rainCollectorsDataModel.schema.CATEGORY2] = "Extraction Building" building[rainCollectorsDataModel.schema.IS_PROVIDING_SERVICES] = false end rainCollectorsDataModel.schema.RECIPE.PRODUCTION_TIME = "gatheringTime" --/** Function definitions follow. **/ --Collapse the regions in the IDE to see the procedure pick up with the assignments of these functions to override the associated member methods of BaseDataModel. --region Public building interface --no overrides! --endregion --region Public building recipe query interface --no overrides! --endregion --region Public recipe data retrieval interface --no overrides! --endregion --/** End Function definitions. Procedure resumes. **/ return rainCollectorsDataModel