|
|
| Строка 1: |
Строка 1: |
| local p = {} | | local p = {} |
|
| |
| -- Таблица для иконок исследований в зависимости от их ID
| |
| local iconMapping = {
| |
| -- CivilianServices
| |
| ["Hydroponics"] = "SeedExtractor",
| |
| ["CritterMechs"] = "MechHamtr",
| |
| ["AudioVisualCommunication"] = "SurveillanceCameraConstructed",
| |
| ["AdvancedEntertainment"] = "ComputerTelevision",
| |
| ["RoboticCleanliness"] = "BorgChassisJanitor",
| |
| ["FauxAstroTiles"] = "FauxTileAstroIce",
| |
| ["MeatManipulation"] = "FatExtractor",
| |
| ["BiochemicalStasis"] = "StasisBed",
| |
| ["MechanizedTreatment"] = "BorgChassisMedical",
| |
| ["AdvancedCleaning"] = "AdvMopItem",
| |
| ["HONKMech"] = "MechHonker",
| |
| ["AdvancedSpray"] = "WeaponSprayNozzle",
| |
| ["BluespaceCargoTransport"] = "CargoTelepad",
| |
| ["QuantumFiberWeaving"] = "ClothingShoesBootsSpeed",
| |
| ["BluespaceChemistry"] = "BluespaceBeaker",
| |
| -- Arsenal
| |
| ["SalvageWeapons"] = "WeaponProtoKineticAccelerator",
| |
| ["DraconicMunitions"] = "MagazineBoxPistolIncendiary",
| |
| ["WeaponizedLaserManipulation"] = "WeaponLaserCarbine",
| |
| ["NonlethalAmmunition"] = "ShellShotgunBeanbag",
| |
| ["UraniumMunitions"] = "SheetUranium1",
| |
| ["AdvancedRiotControl"] = "Truncheon",
| |
| ["ExplosiveTechnology"] = "ExplosivePayload",
| |
| ["SpecialMeans"] = "ClothingBackpackElectropack",
| |
| ["ConcentratedLaserWeaponry"] = "WeaponLaserCannon",
| |
| ["WaveParticleHarnessing"] = "WeaponXrayCannon",
| |
| ["BasicShuttleArmament"] = "PowerCageRecharger",
| |
| ["PortableMicrofusionWeaponry"] = "WeaponAdvancedLaser",
| |
| ["ExperimentalBatteryAmmo"] = "WeaponLaserSvalinn",
| |
| ["AdvancedShuttleWeapon"] = "MagazineGrenadeEmpty",
| |
| ["BasicRobotics"] = "ExosuitFabricator",
| |
| -- Experimental
| |
| ["BasicRobotics"] = "ExosuitFabricator",
| |
| ["BasicAnomalousResearch"] = "AnomalyScanner",
| |
| ["BasicXenoArcheology"] = "MachineArtifactAnalyzer",
| |
| ["AlternativeResearch"] = "ComputerTechnologyDiskTerminal",
| |
| ["MagnetsTech"] = "ClothingShoesBootsMagSci",
| |
| ["AnomalyCoreHarnessing"] = "WeaponGauntletGorilla",
| |
| ["AbnormalArtifactManipulation"] = "MachineArtifactCrusher",
| |
| ["AdvancedAnomalyResearch"] = "MachineAnomalySynchronizer",
| |
| ["DeterrenceTechnologies"] = "WeaponParticleDecelerator",
| |
| ["GravityManipulation"] = "WeaponForceGun",
| |
| ["QuantumLeaping"] = "DeviceQuantumSpinInverter",
| |
| -- Industrial
| |
| ["SalvageEquipment"] = "MiningDrill",
| |
| ["SpaceScanning"] = "HandHeldMassScanner",
| |
| ["AdvancedPowercells"] = "TurboItemRecharger",
| |
| ["MechanicalCompression"] = "MachineFlatpacker",
| |
| ["IndustrialEngineering"] = "AutolatheHyperConvection",
| |
| ["PowerGeneration"] = "PortableGeneratorPacman",
| |
| ["AtmosphericTech"] = "GasThermoMachineFreezer",
| |
| ["RipleyAPLU"] = "MechRipley",
| |
| ["Shuttlecraft"] = "Gyroscope",
| |
| ["AdvancedAtmospherics"] = "GasThermoMachineHellfireFreezer",
| |
| ["AdvancedToolsTechnology"] = "WelderExperimental",
| |
| ["MassExcavation"] = "MiningDrillDiamond",
| |
| ["BluespaceStorage"] = "ClothingBackpackHolding",
| |
| ["PortableFission"] = "PowerCellMicroreactor",
| |
| }
| |
|
| |
|
| -- Функция для перевода ID плат в ID машин | | -- Функция для перевода ID плат в ID машин |
| Строка 113: |
Строка 50: |
| }) | | }) |
|
| |
|
| local discipline = frame.args.discipline or "" | | local id = frame.args.id or "" |
| | | local icon = frame.args.icon or "" |
| -- Названия технологий
| |
| local disciplineName = ({ | |
| Arsenal = "Арсенал",
| |
| Industrial = "Промышленность",
| |
| Experimental = "Экспериментальное",
| |
| CivilianServices = "Обслуживание персонала"
| |
| })[discipline]
| |
|
| |
|
| -- Загрузка данных из JSON | | -- Загрузка данных из JSON |
| Строка 128: |
Строка 58: |
| local out = cssLink | | local out = cssLink |
| local found = false -- Флаг для отслеживания наличия элементов | | local found = false -- Флаг для отслеживания наличия элементов |
| | local disciplineName = "" |
|
| |
|
| -- Обработка данных | | -- Определяем дисциплину на основе переданного id |
| if data[discipline] then -- Проверяем, существует ли ключ для discipline | | for discipline, technologies in pairs(data) do |
| for _, tech in ipairs(data[discipline]) do | | for _, tech in ipairs(technologies) do |
| found = true | | if tech.id == id then |
| | found = true |
| | disciplineName = ({ |
| | Arsenal = "Арсенал", |
| | Industrial = "Промышленность", |
| | Experimental = "Экспериментальное", |
| | CivilianServices = "Обслуживание персонала" |
| | })[discipline] |
|
| |
|
| -- Цвета для номеров уровней
| | -- Цвета для номеров уровней |
| local tierColor = ({
| | local tierColor = ({ |
| [1] = "#54d554", -- зеленый
| | [1] = "#54d554", -- зеленый |
| [2] = "#ed9000", -- оранжевый
| | [2] = "#ed9000", -- оранжевый |
| [3] = "#d72a2a" -- красный
| | [3] = "#d72a2a" -- красный |
| })[tech.tier]
| | })[tech.tier] |
|
| |
|
| -- Формирование HTML для каждой технологии
| | -- Формирование HTML для технологии |
| out = out .. '<div class="research" id="' .. discipline .. '">'
| | out = out .. '<div class="research" id="' .. discipline .. '">' |
| local iconId = iconMapping[tech.id] or tech.id -- Получаем iconId на основе tech.id
| | out = out .. '<div class="research__images">[[Файл:' .. icon .. '.png|64x64px|центр|link=]]</div>' -- Используем переданный icon |
| out = out .. '<div class="research__images">[[Файл:' .. iconId .. '.png|64x64px|центр|link=]]</div>'
| | out = out .. '<div class="research__name">' .. tech.name .. '[[Файл:' .. discipline .. '.png|16px|link=]]</div>' |
| out = out .. '<div class="research__name">' .. tech.name .. '[[Файл:' .. discipline .. '.png|16px|link=]]</div>'
| | out = out .. '<div class="research__type">' |
| out = out .. '<div class="research__type">'
| | out = out .. '<div>Уровень: <span style="color:' .. tierColor .. ';">' .. tech.tier .. '</span></div>' |
| out = out .. '<div>Уровень: <span style="color:' .. tierColor .. ';">' .. tech.tier .. '</span></div>'
| | out = out .. '<div class="research__technology">' .. disciplineName .. '</div>' |
| out = out .. '<div class="research__technology">' .. disciplineName .. '</div>'
| | out = out .. '<div>Стоимость: <span style="color:#DA70D6;">' .. tech.cost .. '</span></div>' |
| out = out .. '<div>Стоимость: <span style="color:#DA70D6;">' .. tech.cost .. '</span></div>'
| | out = out .. '</div>' |
| out = out .. '</div>'
| | out = out .. '<div class="research__unblocks">Разблокирует:' |
| out = out .. '<div class="research__unblocks">Разблокирует:'
| | out = out .. '<ul>' |
| out = out .. '<ul>'
| |
|
| |
|
| -- Проверка каждого ID в recipeUnlocks
| | -- Проверка каждого ID в recipeUnlocks |
| for _, recipe in ipairs(tech.recipeUnlocks) do
| | for _, recipe in ipairs(tech.recipeUnlocks) do |
| local machineID = translateBoardIDToMachineID(recipe) or recipe -- Переводим только платы, остальные оставляем как есть
| | local machineID = translateBoardIDToMachineID(recipe) or recipe -- Переводим только платы, остальные оставляем как есть |
|
| |
|
| out = out .. frame:preprocess('<li>{{#invoke:Entity Lookup|createimagetooltip|Файл:' .. machineID .. '.png|' .. machineID .. '|Мета=32x32px,link=}} {{#invoke:Entity Lookup|getname|' .. machineID .. '}}</li>')
| | out = out .. frame:preprocess('<li>{{#invoke:Entity Lookup|createimagetooltip|Файл:' .. machineID .. '.png|' .. machineID .. '|Мета=32x32px,link=}} {{#invoke:Entity Lookup|getname|' .. machineID .. '}}</li>') |
| | end |
| | |
| | out = out .. '</ul>' |
| | out = out .. '</div>' |
| | out = out .. '</div>' |
| end | | end |
|
| |
| out = out .. '</ul>'
| |
| out = out .. '</div>'
| |
| out = out .. '</div>'
| |
| end | | end |
| end | | end |