Модуль:Сущность/data: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| (не показаны 2 промежуточные версии этого же участника) | |||
| Строка 2: | Строка 2: | ||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
local JsonPaths = require('Module:JsonPaths') | local JsonPaths = require('Module:JsonPaths') | ||
local dp = require( "Module:GetField") | |||
local | |||
local function load_data_page(page) | local function load_data_page(page) | ||
| Строка 33: | Строка 31: | ||
end | end | ||
end | end | ||
end | end | ||
| Строка 52: | Строка 43: | ||
end | end | ||
return content | return content | ||
end | end | ||
| Строка 76: | Строка 49: | ||
return {} | return {} | ||
end | end | ||
local entity = dp.loadEntityData(entityId) | |||
if entity then | |||
return dp.collectEntityComponents(entity) | |||
end | end | ||
return {} | |||
return | |||
end | end | ||
| Строка 114: | Строка 71: | ||
end | end | ||
return dp.entityHasComponent(entity, compName) | |||
end | end | ||
| Строка 822: | Строка 769: | ||
local prototypeBlacklist = frame.args.prototypeBlacklist or frame.args.prototypeblacklist or "" | local prototypeBlacklist = frame.args.prototypeBlacklist or frame.args.prototypeblacklist or "" | ||
local prototypeStoreDefs = | local prototypeStoreDefs = dp.loadCachedData("prototype_store.json") | ||
if not prototypeStoreDefs then | if not prototypeStoreDefs then | ||
return false | return false | ||
| Строка 867: | Строка 814: | ||
local paramNames = get_template_params(tplPath, content) | local paramNames = get_template_params(tplPath, content) | ||
if dp then | if dp then | ||
local dataPage = | local dataPage = kind .. "/" .. dp.ucfirst(name) .. ".json" | ||
extra = get_selective_extra(id, dataPage, paramNames) | extra = get_selective_extra(id, dataPage, paramNames) | ||
end | end | ||
| Строка 891: | Строка 838: | ||
end | end | ||
local componentStoreDefs = | local componentStoreDefs = dp.loadCachedData("component_store.json") | ||
if type(componentStoreDefs) == "table" and (not anyEntityWhitelist or compHasWhitelist) then | if type(componentStoreDefs) == "table" and (not anyEntityWhitelist or compHasWhitelist) then | ||
local compStore = componentStoreDefs[id] | local compStore = componentStoreDefs[id] | ||