Editing Module:Infobox Plant
From Eco - English Wiki
Your changes will be displayed to readers once an authorized user accepts them. (help)
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 67: | Line 67: | ||
-- string used to build the infobox | -- string used to build the infobox | ||
local infobox = '{| class=\"infobox\"\n' | local infobox = '{| class=\"infobox\"\n' | ||
-- name of the plant/tree | -- name of the plant/tree | ||
infobox = infobox .. '|- style=\"color: white; background-color: | infobox = infobox .. '|- style=\"color: white; background-color: darkred; text-align: center;\"\n| colspan=\"2\" | \'\'\'<big>' .. species .. '</big>\'\'\'\n' | ||
-- the sub heading plant or tree | -- the sub heading plant or tree | ||
infobox = infobox .. '|- style=\"text-align: center; color: white; background-color: ' | infobox = infobox .. '|- style=\"text-align: center; color: white; background-color: ' | ||
if check == 'plant' then | if check == 'plant' then | ||
infobox = infobox .. ' | infobox = infobox .. '#37b53e\"\n| colspan=\"2\" | \'\'\'Plant\'\'\'[[Category:Plants]]\n' | ||
else | else | ||
infobox = infobox .. ' | infobox = infobox .. '#bf8c3a;\"\n| colspan=\"2\" | \'\'\'Tree\'\'\'[[Category:Trees]]\n' | ||
end | end | ||
Line 82: | Line 82: | ||
local checkImage = {'_Plant.png','_Plant.jpg','_Plant.jpeg','_Tree.png','_Tree.jpg','_Tree.jpeg'} | local checkImage = {'_Plant.png','_Plant.jpg','_Plant.jpeg','_Tree.png','_Tree.jpg','_Tree.jpeg'} | ||
local image = '' | local image = '' | ||
local speciesimagename = string.gsub(species, ' ', '') | |||
local speciesimagename = string.gsub( | |||
for i,v in ipairs(checkImage) do | for i,v in ipairs(checkImage) do | ||
Line 92: | Line 91: | ||
if table.getn(checkImage) == i then | if table.getn(checkImage) == i then | ||
image = 'NoImage.png' | image = 'NoImage.png' | ||
if check == ' | if check == 'Plant' then | ||
image = image .. '|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. speciesimagename .. '_Plant.png|[[Category:Pages_with_missing_plant]]' | image = image .. '|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. speciesimagename .. '_Plant.png|[[Category:Pages_with_missing_plant]]' | ||
end | end | ||
if check == ' | if check == 'Tree' then | ||
image = image .. '|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. speciesimagename .. '_Tree.png|[[Category:Pages_with_missing_tree]]' | image = image .. '|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. speciesimagename .. '_Tree.png|[[Category:Pages_with_missing_tree]]' | ||
end | end | ||
end | end | ||
end | end | ||
infobox = infobox .. '|-\n| colspan=\"2\" style=\"padding: 10px;\" | [[File:' .. image .. '|center|border|240px]]\n' | |||
infobox = infobox .. '|-\n| colspan=\"2\" style=\"padding: 10px;\" | [[File:' .. image .. '|center|border| | |||
-- 'General' section header | -- 'General' section header | ||
infobox = infobox .. '|- style=\"background-color: # | infobox = infobox .. '|- style=\"background-color: #4B9130; text-align: center;\"\n| colspan=\"2\" | \'\'\'General\'\'\'\n' | ||
--Harvestable plant | --Harvestable plant | ||
if | if speciesTable.seedDrop ~= nil or speciesTable.resourceItem ~= nil then | ||
infobox = infobox .. '|- valign=\"center\"\n| Harvestable:\n| style=\"text-align: right;\" | Yes \n' | |||
end | |||
end | |||
--Underwater plant | --Underwater plant | ||
if speciesTable.isWater ~= nil then | if speciesTable.isWater ~= nil then | ||
infobox = infobox .. '|- valign=\"center\"\n| Underwater Plant:\n| style=\"text-align: right | infobox = infobox .. '|- valign=\"center\"\n| Underwater Plant:\n| style=\"text-align: right;\" | Yes \n' | ||
end | end | ||
--Decorative Plant | --Decorative Plant | ||
if speciesTable.isDecorative ~= nil then | if speciesTable.isDecorative ~= nil then | ||
infobox = infobox .. '|- valign=\"center\"\n| Decorative Plant:\n| style=\"text-align: right | infobox = infobox .. '|- valign=\"center\"\n| Decorative Plant:\n| style=\"text-align: right;\" | Yes \n' | ||
end | end | ||
-- 'Agriculture' section header | -- 'Agriculture' section header | ||
if | if speciesTable.seedDrop ~= nil or speciesTable.resourceItem ~= nil then | ||
infobox = infobox .. '|- style=\"background-color: #4B9130; text-align: center;\"\n| colspan=\"2\" | \'\'\'Agriculture\'\'\'\n' | |||
infobox = infobox .. '|- style=\"background-color: # | |||
-- Harvested Seed | -- Harvested Seed | ||
if speciesTable.seedDrop ~= nil and speciesTable.seedMax ~= '0.0' then | |||
infobox = infobox .. '|- valign=\"center\"\n| Harvested Seed:\n| style=\"text-align: right;\" | ' .. speciesTable.seedDrop .. '\n' | |||
end | |||
-- Harvested Item | -- Harvested Item | ||
if speciesTable.resourceItem ~= nil then | if speciesTable.resourceItem ~= nil then | ||
infobox = infobox .. '|- valign=\"center\"\n| Harvested Item:\n| style=\"text-align: right | infobox = infobox .. '|- valign=\"center\"\n| Harvested Item:\n| style=\"text-align: right;\" | ' .. speciesTable.resourceItem .. '\n' | ||
end | end | ||
-- Ideal Temp | -- Ideal Temp | ||
if speciesTable.idealTempMin ~= nil then | if speciesTable.idealTempMin ~= nil then | ||
infobox = infobox .. '|- valign=\"center\"\n| Ideal Temperature Range:\n| style=\"text-align: right;\" | ' .. speciesTable.idealTempMin .. ' - ' .. speciesTable.idealTempMax .. '\n' | |||
infobox = infobox .. '|- valign=\"center\"\n| Ideal Temperature Range:\n| style=\"text-align: right | |||
end | end | ||
-- Ideal Moisture | -- Ideal Moisture | ||
if speciesTable.idealMoistureMin ~= nil then | if speciesTable.idealMoistureMin ~= nil then | ||
infobox = infobox .. '|- valign=\"center\"\n| Ideal Moisture Range:\n| style=\"text-align: right;\" | ' .. speciesTable.idealMoistureMin .. ' - ' .. speciesTable.idealMoistureMax .. '\n' | |||
infobox = infobox .. '|- valign=\"center\"\n| Ideal Moisture Range:\n| style=\"text-align: right | |||
end | end | ||
-- Ground nutrients | -- Ground nutrients | ||
if speciesTable.nitrogenHalfSpeed ~= nil or speciesTable.phosphorusHalfSpeed ~= nil or speciesTable.potassiumHalfSpeed ~= nil or speciesTable.soilMoistureHalfSpeed ~= nil then | if speciesTable.nitrogenHalfSpeed ~= nil or speciesTable.phosphorusHalfSpeed ~= nil or speciesTable.potassiumHalfSpeed ~= nil or speciesTable.soilMoistureHalfSpeed ~= nil then | ||
infobox = infobox .. '|-\n| Minimum Soil Nutrients:\n| style=\"text-align: right;\" | \n' | |||
infobox = infobox .. '|- style=\"text-align: | |||
if speciesTable.nitrogenHalfSpeed ~= nil then | if speciesTable.nitrogenHalfSpeed ~= nil then | ||
infobox = infobox .. '|- style=\"color: red; valign: center;\"\n| Nitrogen:\n| style=\"text-align: right;\" | ' .. speciesTable.nitrogenHalfSpeed .. '\n' | |||
end | end | ||
if speciesTable.phosphorusHalfSpeed ~= nil then | if speciesTable.phosphorusHalfSpeed ~= nil then | ||
infobox = infobox .. '|- style=\"color: orange; valign: center;\"\n| Phosphorous:\n| style=\"text-align: right;\" | ' .. speciesTable.phosphorusHalfSpeed .. '\n' | |||
end | end | ||
if speciesTable.potassiumHalfSpeed ~= nil then | if speciesTable.potassiumHalfSpeed ~= nil then | ||
infobox = infobox .. '|- style=\"color: yellow; valign: center;\"\n| Potassium:\n| style=\"text-align: right;\" | ' .. speciesTable.potassiumHalfSpeed .. '\n' | |||
end | end | ||
if speciesTable.soilMoistureHalfSpeed ~= nil then | if speciesTable.soilMoistureHalfSpeed ~= nil then | ||
infobox = infobox .. '|- style=\"color: lightblue; valign: center;\"\n| Soil Moisture:\n| style=\"text-align: right;\" | ' .. speciesTable.soilMoistureHalfSpeed .. '\n' | |||
end | end | ||
end | end | ||
end | end | ||
-- ' | -- 'Other' section header | ||
infobox = infobox .. '|- style=\"background-color: # | infobox = infobox .. '|- style=\"background-color: #4B9130; text-align: center;\"\n| colspan=\"2\" | \'\'\'Other\'\'\'\n' | ||
--Carbon release | |||
if speciesTable.carbonRelease ~= nil then | if speciesTable.carbonRelease ~= nil then | ||
local absoluteCarbon = string.sub(speciesTable.carbonRelease , 2) | local absoluteCarbon = string.sub(speciesTable.carbonRelease , 2) | ||
infobox = infobox .. '|- valign=\"center\"\n| Carbon Absorbed:\n| style=\"text-align: right | infobox = infobox .. '|- valign=\"center\"\n| Carbon Absorbed:\n| style=\"text-align: right;\" | ' .. absoluteCarbon .. ' ppm \n' | ||
end | end | ||