Module:Model path
Documentation for Model path
Fancy description heer.
Adding more models
- Edit Module:Model path/data.
Usage
{{model path|Tough Stuff Muffs|Montreal Style}}
produces:models/workshop/player/items/all_class/all_earmuffs_style1/all_earmuffs_style1_[class].mdl
{{model path|Tough Stuff Muffs|Boston Style}}
produces:models/workshop/player/items/all_class/all_earmuffs_style2/all_earmuffs_style2_[class].mdl
{{model path|Dr. Whoa}}
produces:models/player/items/[class]/bowtie.mdl
{{model path|Dr. Whoa|Style 2}}
produces:Error: invalid style (style 2) and/or item name (dr. whoa). Is the model path set correctly?
{{model path|Hatsune Miku}}
produces:Error: invalid item name (hatsune miku). Is the model path set correctly?
Syntax
{{model path|<item name>|<style name>}}
- <item name> unnamed parameter 1
- Item name, exactly as it is written in-game.
- <style name> unnamed parameter 2
- Style name, exactly as it is written in-game.
local p = {} local function findModel(data, cosmetic) return data[cosmetic] or nil end function p.main(frame) local modelData = mw.loadData("Module:Model path/data") local cosmeticParam = (frame.args[1] or ""):lower() assert(cosmeticParam and cosmeticParam ~= "", "Error: arg1 (item name) cannot be empty") local styleParam = (frame.args[2] or ""):lower() local searchTerm = styleParam ~= "" and (cosmeticParam .. ' ' .. styleParam) or cosmeticParam local cosmeticData = findModel(modelData, searchTerm) if not cosmeticData then if styleParam ~= "" then return '[[Category:Invalid or missing model path]]<b>Invalid style and/or item name (' .. searchTerm .. '): is the model path in the database page?</b>' end return '[[Category:Invalid or missing model path]]<b>Invalid item name (' .. cosmeticParam .. '): is the model path in the database page?</b>' end return tostring(cosmeticData) end return p