aucun résumé des modifications
Will130 (discussion | contributions) Aucun résumé des modifications |
Aucun résumé des modifications |
||
local Utility = require('Module:Utility')
local p = {}
function copyClipboard( contents )
return '<span class="copy-clipboard"><span class="copy-content" style="font-family:Courier,monospace;">' .. contents .. '</span></span>'
end
function getExampleShortCommand( isEntity, identifier )
end
end
function getExampleBPCommand( isEntity, identifier, short )
end
end
function getTekgramUnlockCommand( bp )
return 'cheat giveitemnum ' .. identifier .. ' 1 0 0'
end
function makeCommandSet (isEntity, blueprintPath, entityClassName, shortItemName, tekgramBP, itemId)
if tekgramBP then
commands = commands .. '<br/><b>
.. copyClipboard(getTekgramUnlockCommand(tekgramBP))
end
return commands
end
function guardStringArgument( args, name )
return v
end
function p.spawnCommand( f )
-- Check if type is specified
if args.type == nil then
return 'error: "type"
end
entityClassName = f:preprocess('{{#var:entityId}}')
end
-- Reduce to null if empty.
if blueprintPath == '' then
blueprintPath = nil
end
if entityClassName == '' then
entityClassName = nil
end
end
-- Remove object descriptor elements from the blueprint path if one is valid.
if blueprintPath ~= nil then
blueprintPath = Utility.getUnqualifiedBlueprintPath(blueprintPath)
end
-- Auto-generate class name for entities
if isEntity and entityClassName == nil and blueprintPath ~= nil then
entityClassName = Utility.getBlueprintClassName(blueprintPath, true)
end
-- Initialize variants from variantOrderList
-- We use an external list provided by the template to retain order of the variants.
local variants = {}
local variantOrder = {}
-- Save the value.
if isBP then
if tempVariantBP ~= nil then
-- Remove object descriptor from the blueprint path.
tempVariantBP = Utility.getUnqualifiedBlueprintPath(tempVariantBP)
end
variants[variantName]['bp'] = tempVariantBP
else
variants[variantName]['short'] = mw.text.trim(argValue)
for _, variantName in ipairs(variantOrder) do
local spawnInfo = variants[variantName]
-- Auto-generate class name for entities
if spawnInfo['bp'] or spawnInfo['short'] then▼
if isEntity and spawnInfo.bp and not spawnInfo.short then
spawnInfo.short = Utility.getBlueprintClassName(spawnInfo.bp, true)
end
commands = commands .. '<br/><span style="font-size:1.1em;font-weight:bold;">Variante ' .. variantName .. '</span><br/>'
commands = commands .. makeCommandSet(isEntity, spawnInfo
end
end
return f:preprocess(out)
end
return p
|