Nuwbertron

modinfo.lua

Jun 16th, 2025
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.66 KB | Source Code | 0 0
  1. local is_local = false
  2. local append = (is_local and "(Local)") or "(Client)"
  3. name = "Hide Armor/Hats "..append
  4. author = "Crimeraaa"
  5. description =
  6. [[
  7. Client-only mod that lets you choose which hats/armors/clothing you want to hide.
  8. This should be helpful if you get annoyed that various items cover up neat art details.
  9. ]]
  10.  
  11. version = "1.0.5"
  12. api_version = 10
  13.  
  14. dst_compatible = true
  15. dont_starve_compatible = false
  16.  
  17. client_only_mod = true
  18. server_only_mod = false
  19. all_clients_require_mod = false
  20.  
  21. -- icon_atlas = "modicon.xml"
  22. -- icon = "modicon.tex"
  23.  
  24. local function FormatOption(description, data, hover)
  25.     return {
  26.         description = description,
  27.         data = data,
  28.         hover = hover
  29.     }
  30. end
  31.  
  32. local function AddTitle(title)
  33.     return {
  34.         name = "",
  35.         label = title,
  36.         hover = "",
  37.         options = {
  38.             { description = "", data = 0 }
  39.         },
  40.         default = 0,
  41.     }
  42. end
  43.  
  44. local function AddOption(name, label, hover, options, default)
  45.     return {
  46.         name = name,
  47.         label = label,
  48.         hover = hover,
  49.         options = options,
  50.         default = default,
  51.     }
  52. end
  53.  
  54. local item_opts = {
  55.     FormatOption("Hide", true, "This item will be invisible when equipped."),
  56.     FormatOption("Show", false, "This item will be visible when equipped."),
  57. }
  58.  
  59. local item_fx_opts = {
  60.     FormatOption("Disable", true, "This item's visual effects will be disabled."),
  61.     FormatOption("Enable", false, "This item's visual effects will stay enabled."),
  62. }
  63.  
  64. -- TODO: Find a way to actually hide the Polly Roger's Hat
  65.  
  66.  
  67. -- Keep this in sync with the table in `scripts/equip_list`.
  68. -- All built-in Lua 5.1 functions/libraries aren't available in modinfo, like `require`.
  69. local items_list = {
  70.     {
  71.         name = "Backpacks",
  72.         data = {
  73.             { prefab = "backpack",              display = "Backpack"              },
  74.             { prefab = "candybag",              display = "Candy Bag"             },
  75.             { prefab = "spicepack",             display = "Chef Pouch"            },
  76.             { prefab = "icepack",               display = "Insulated Pack"        },
  77.             { prefab = "krampus_sack",          display = "Krampus Sack"          },
  78.             { prefab = "piggyback",             display = "Piggyback"             },
  79.             { prefab = "seedpouch",             display = "Seed Pack-It"          },
  80.         },
  81.     },
  82.     {
  83.         name = "Headslot Armors",
  84.         data = {
  85.             { prefab = "wathgrithrhat",         display = "Battle Helm"           },
  86.             { prefab = "beehat",                display = "Beekeeper Hat"         },
  87.             {
  88.                 prefab = "lunarplanthat",
  89.                 display = "Brightshade Helm",
  90.                 fx = {
  91.                     prefab  = "lunarplanthat_fx",
  92.                     display = "Brightshade Helm FX",
  93.                     hover   = "Disable this to actually hide the helmet.",
  94.                 },
  95.             },
  96.             { prefab = "skeletonhat",           display = "Bone Helm"             },
  97.             { prefab = "cookiecutterhat",       display = "Cookie Cutter Cap"     },
  98.             { prefab = "dreadstonehat",         display = "Dreadstone Helm"       },
  99.             { prefab = "eyemaskhat",            display = "Eye Mask"              },
  100.             { prefab = "footballhat",           display = "Football Helmet"       },
  101.             { prefab = "slurtlehat",            display = "Shelmet"               },
  102.             { prefab = "armorruins",            display = "Thulecite Helm"        },
  103.             {
  104.                 prefab = "voidclothhat",
  105.                 display = "Void Cowl",
  106.                 fx = {
  107.                     prefab  = "voidclothhat_fx",
  108.                     display = "Void Cowl FX",
  109.                     hover   = "Disable this to actually hide the helmet.",
  110.                 },
  111.             },
  112.         },
  113.     },
  114.     {
  115.         name = "Bodyslot Armors",
  116.         data = {
  117.             { prefab = "armor_bramble",         display = "Bramble Husk"          },
  118.             { prefab = "armor_lunarplant",      display = "Brightshade Armor"     },
  119.             { prefab = "armorskeleton",         display = "Bone Armor"            },
  120.             { prefab = "armordreadstone",       display = "Dreadstone Armor"      },
  121.             { prefab = "armorgrass",            display = "Grass Suit"            },
  122.             { prefab = "armorwood",             display = "Log Suit"              },
  123.             { prefab = "armormarble",           display = "Marble Suit"           },
  124.             { prefab = "armor_sanity",          display = "Night Armor"           },
  125.             { prefab = "armordragonfly",        display = "Scalemail"             },
  126.             --[[ Originally used "armorbramble" instead of "armor_bramble" LMAO ]]
  127.             { prefab = "armorsnurtleshell",     display = "Snurtle Shell Armor"   },
  128.             { prefab = "armorruins",            display = "Thulecite Suit"        },
  129.         },
  130.     },
  131.     {
  132.         name = "Headslot Clothing (DS)",
  133.         data = {
  134.             { prefab = "catcoonhat",            display = "Cat Cap"               },
  135.             { prefab = "beefalohat",            display = "Beefalo Hat"           },
  136.             { prefab = "bushhat",               display = "Bush Hat"              },
  137.             { prefab = "eyebrellahat",          display = "Eyebrella"             },
  138.             { prefab = "watermelonhat",         display = "Fashion Melon"         },
  139.             { prefab = "featherhat",            display = "Feather Hat"           },
  140.             { prefab = "flowerhat",             display = "Garland"               },
  141.             { prefab = "icehat",                display = "Ice Cube"              },
  142.             { prefab = "minerhat",              display = "Miner Hat"             },
  143.             { prefab = "molehat",               display = "Moggles"               },
  144.             { prefab = "earmuffshat",           display = "Rabbit Earmuffs"       },
  145.             { prefab = "rainhat",               display = "Rain Hat"              },
  146.             { prefab = "strawhat",              display = "Straw Hat"             },
  147.             { prefab = "spiderhat",             display = "Spiderhat"             },
  148.             { prefab = "walrushat",             display = "Tam o' Shanter"        },
  149.             {
  150.                 prefab = "tophat",
  151.                 display = "Top Hat",
  152.                 fx = {
  153.                     prefab  = "tophat_shadow_fx",
  154.                     display = "Magician's Top Hat FX",
  155.                     hover   = "Disable this if you want to remove the shadows.",
  156.                 }
  157.             },
  158.             { prefab = "winterhat",             display = "Winter Hat"            },
  159.         },
  160.     },
  161.     {
  162.         name = "Headslot Clothing (DST)",
  163.         data = {
  164.             { prefab = "moonstorm_goggleshat",  display = "Astroggles"            },
  165.             { prefab = "balloonhat",            display = "Balloon Hat"           },
  166.             { prefab = "blue_mushroomhat",      display = "Blue Funcap"           },
  167.             { prefab = "monkey_mediumhat",      display = "Captain's Tricorn"     },
  168.             { prefab = "alterguardianhat",      display = "Celestial Crown"       },
  169.             { prefab = "mermhat",               display = "Clever Disguise"       },
  170.             { prefab = "deserthat",             display = "Desert Goggles"        },
  171.             { prefab = "goggleshat",            display = "Fashion Goggles"       },
  172.             { prefab = "plantregistryhat",      display = "Gardeneer Hat"         },
  173.             { prefab = "green_mushroomhat",     display = "Green Funcap"          },
  174.             { prefab = "batnosehat",            display = "Milkmade Hat"          },
  175.             { prefab = "nightcaphat",           display = "Nightcap"              },
  176.             { prefab = "nutrientsgoggleshat",   display = "Premier Gardeneer Hat" },
  177.             { prefab = "monkey_smallhat",       display = "Pirate's Bandana"      },
  178.             { prefab = "walterhat",             display = "Pinetree Pioneer Hat"  },
  179.             -- This hat is so stubborn, it refuses to be hidden via the mod
  180.             -- Yet hiding it via the ingame console it perfectly fine? >:(
  181.             -- { prefab = "polly_rogershat",       display = "Polly Roger's Hat"     },
  182.             { prefab = "red_mushroomhat",       display = "Red Funcap"            },
  183.             { prefab = "kelphat",               display = "Seawreath"             },
  184.             { prefab = "antlionhat",            display = "Turf-Raiser Helm"      },
  185.         },
  186.     },
  187.     {
  188.         name = "Bodyslot Clothing",
  189.         data = {
  190.             --[[ Originally missed a space between "armor" and "slurper" smh ]]
  191.             { prefab = "armor_slurper",         display = "Belt of Hunger"        },
  192.             { prefab = "trunkvest_summer",      display = "Breezy Vest"           },
  193.             { prefab = "sweatervest",           display = "Dapper Vest"           },
  194.             { prefab = "hawaiianshirt",         display = "Floral Shirt"          },
  195.             { prefab = "beargervest",           display = "Hibearnation Vest"     },
  196.             { prefab = "balloonvest",           display = "Inflatable Vest"       },
  197.             { prefab = "onemanband",            display = "One Man Band"          },
  198.             { prefab = "raincoat",              display = "Rain Coat"             },
  199.             { prefab = "reflectivevest",        display = "Summer Frest"          },
  200.             { prefab = "trunkvest_winter",      display = "Puffy Vest"            },
  201.         },
  202.     },
  203.     {
  204.         name = "Amulets",
  205.         data = {
  206.             { prefab ="blueamulet",             display = "Chilled Amulet"        },
  207.             { prefab ="greenamulet",            display = "Construction Amulet"   },
  208.             { prefab ="orangeamulet",           display = "The Lazy Forager"      },
  209.             { prefab ="amulet",                 display = "Life Giving Amulet"    },
  210.             { prefab ="yellowamulet",           display = "Magiluminescence"      },
  211.             { prefab ="purpleamulet",           display = "Nightmare Amulet"      },
  212.         },
  213.     },
  214. }
  215.  
  216. local STATIC_I = 1
  217. local item_hover = "Show or Hide '"
  218. local item_hover_default = "\n(Default: Show)"
  219. local fx_hover_default = "\n(Default: Enable)"
  220. local function CategoryConfigs(configs, data)
  221.     for i=1, #data do
  222.         STATIC_I = STATIC_I + 1
  223.         configs[STATIC_I] = AddOption(
  224.             data[i].prefab,     --[[ name ]]
  225.             data[i].display,    --[[ label ]]
  226.             item_hover .. data[i].display .."'?".. item_hover_default, --[[ hover ]]
  227.             item_opts,  --[[ options ]]
  228.             false       --[[ default ]]
  229.         )
  230.  
  231.         if data[i].fx then
  232.             STATIC_I = STATIC_I + 1
  233.             configs[STATIC_I] = AddOption(
  234.                 data[i].fx.prefab,  --[[ name ]]
  235.                 data[i].fx.display, --[[ label ]]
  236.                 data[i].fx.hover .. fx_hover_default,   --[[ hover ]]
  237.                 item_fx_opts,       --[[ options ]]
  238.                 false               --[[ default ]]
  239.             )
  240.         end
  241.     end
  242. end
  243.  
  244. local function CreateConfigs(tbl)
  245.     local configs = {}
  246.     configs[STATIC_I] = AddTitle("Hide or Show?")
  247.     for i=1, #tbl do
  248.         local category = tbl[i]
  249.         STATIC_I = STATIC_I + 1
  250.         configs[STATIC_I] = AddTitle(category.name)
  251.         CategoryConfigs(configs, category.data)
  252.     end
  253.     return configs
  254. end
  255.  
  256. -- at the very least, i don't have to type AddOption over and over again myself and can just update the table to update the configs :)
  257. configuration_options = CreateConfigs(items_list)
Tags: Dst Mod
Advertisement
Add Comment
Please, Sign In to add comment