Deprecated: ScribuntoContent overrides fillParserOutput which was deprecated in MediaWiki 1.38. [Called from MediaWiki\Content\Renderer\ContentRenderer::getParserOutput in /var/www/html/includes/content/Renderer/ContentRenderer.php at line 47] in /var/www/html/includes/debug/MWDebug.php on line 381

Deprecated: Use of AbstractContent::getParserOutput was deprecated in MediaWiki 1.38. [Called from ContentHandler::callDeprecatedContentGPO in /var/www/html/includes/content/ContentHandler.php at line 1883] in /var/www/html/includes/debug/MWDebug.php on line 381

Deprecated: Use of ParserOutput::addModules with non-array argument was deprecated in MediaWiki 1.38. [Called from ScribuntoHooks::invokeHook in /var/www/html/extensions/Scribunto/includes/common/Hooks.php at line 164] in /var/www/html/includes/debug/MWDebug.php on line 381
Module:Ships: Difference between revisions - ΔV: Wiki

Module:Ships: Difference between revisions

From ΔV: Wiki
m (Trim positional arguments to Ships|list)
m (Use keys as title, should fix link to K37)
Line 7: Line 7:
p.view = {}
p.view = {}


p.view['Name'] = dv.title{'name'}
p.view['Name'] = dv.title{'key', text='name'}
p.view['Make'] = dv.text{'make'}
p.view['Make'] = dv.text{'make'}



Revision as of 03:13, 8 March 2023

This ship module exists to present the data from Module:Ships/Data in tables of ships, ship variants, and ship info boxes.


Infobox

Script error: The function "infobox" does not exist.

Usage

{{#invoke:Ships|infobox|K37
|image=[[File:K37-tntrl.png|200px]]
|caption=Top-down view of the K37}}

The image and its caption are optional.

The infobox floats to the side of other content. Example output is to the right. The float is cleared here to keep it from being confused with the next section of the documentation.


Ship list

Usage

{{#invoke:Ships|list}}

Example output

Name High-Stress Low-Stress Drone hardpoints Docking bays Crew Dry mass Processed cargo Engines EMP shielding New price Variant
ND-LIS Kitsune 0 1 0 0 3 4,000 kg 18,000 kg (combined) 0
Cothon-212 0 4 0 0 3 83,700 kg 27,000 kg 1 100 MJ
Cothon-213 "Triplet" 0 4 0 0 3 84,700 kg 27,000 kg 3 Triple main engines
Cothon-211 "Chonker" 0 4 0 0 3 83,700 kg 27,000 kg 1 100 MJ Larger excavator
Cothon-217 "Bender" 0 4 0 0 3 103,700 kg 108,000 kg (combined) 1 100 MJ Variable processed cargo storage
K37 TNTRL 1 2 0 0 4 33,200 kg 7,000 kg 1 365,999 E$
KTA24 TNTRL 1 2 0 0 4 27,970 kg 3,000 kg 1 Tug with angled reverse thrust
KX37 TNTRL 1 2 0 0 4 37,970 kg 10,000 kg 1 Extended cargo hold
Runasimi KR37 TNTRL 1 2 0 0 6 47,500 kg 4,000 kg 1 200 MJ EMP shielded
K44 MHFTR Prototype 0 4 0 0 4 54,600 kg 14,000 kg 1 Abandoned prototype
Eagle Prospector 0 2 2 0 6 27,500 kg 14,000 kg 2 2,539,999 E$
Bald Eagle 0 2 2 0 6 29,500 kg 14,000 kg 4 10,000,000 E$ Racing
Peacock Prospector 0 2 2 0 4 27,500 kg 14,000 kg 2 Luxury interior influences crew morale towards happy
Vulture Prospector 1 2 0 0 6 37,500 kg 14,000 kg 2 Drone hardpoints replaced with a high-stress hardpoint
Pelican Prospector 0 2 2 0 6 62,000 kg 14,000 kg 2 Larger cargo bay, grinders replaced with excavator
OCP-209 2 2 0 0 8 184,500 kg 50,000 kg (combined) 1
Antonoff-Titan K225 0 2 0 6 12 220,100 kg 7,000 kg 3 3,999,999 E$
Antonoff-Titan K225-BB 0 2 0 2 12 190,100 kg 7,000 kg 3 4 docking bays removed to fit a much larger cargo bay
Antonoff-Titan K225 (modified) 0 2 0 0 12 250,100 kg 7,000 kg 9 100 MJ Custom research retrofit, replaced docking bays with torch fittings and a Faraday cage fitted to give EMP resistance
Elon Interstellar Model E 1 2 0 0 5 27,000 kg 11,000 kg 2 8,999,999 E$

A list of columns to display can be specified as additional arguments

{{#invoke:Ships|list|Name
|Make
|Cargo bay
|Thrusters}}


Name Make Cargo bay Thrusters View Stripped hull price is not defined
ND-LIS Kitsune Nakamura Dynamics 75 m^3 7
Cothon-212 Conlido RVM 260 m^3 4
Cothon-213 "Triplet" Conlido RVM 260 m^3 4
Cothon-211 "Chonker" Conlido RVM 270 m^3 4
Cothon-217 "Bender" Conlido RVM 260 m^3 4
K37 TNTRL Rusatom-Antonoff 96 m^3 8
KTA24 TNTRL Rusatom-Antonoff / Triskellion-Armstrong 58 m^3 8
KX37 TNTRL Rusatom-Antonoff 110 m^3 8
Runasimi KR37 TNTRL Rusatom-Antonoff / Runasimi 100 m^3 8
K44 MHFTR Prototype Rusatom-Antonoff 136 m^3 8
Eagle Prospector Mitsudaya-Starbus 125 m^3 8
Bald Eagle Custom-built 40 m^3 4
Peacock Prospector Mitsudaya-Starbus 125 m^3 8
Vulture Prospector Mitsudaya-Starbus / Conlido RVM 90 m^3 8
Pelican Prospector Mitsudaya-Starbus / Titan Heavy Industries 240 m^3 8
OCP-209 Obonto Microengineering 610 m^3 8
Antonoff-Titan K225 Antonoff-Titan Heavy Industries 280 m^3 10
Antonoff-Titan K225-BB Antonoff-Titan Heavy Industries 710 m^3 10
Antonoff-Titan K225 (modified) Antonoff-Titan Heavy Industries, Custom Modification 280 m^3 10
Elon Interstellar Model E Elon Interstellar 140 m^3 6

Ship variants

Usage

{{#invoke:Ships|variants|K37}}

Example output

Script error: The function "variants" does not exist.


A list of columns to display can be specified as additional arguments

{{#invoke:Ships|variants|K37
|Name|Make
|Crew|Dry mass|Cargo|Processed cargo|EMP shielding
|Variant}}

Script error: The function "variants" does not exist.


local p = {}
local d = require('Module:Data')
local dv = require('Module:Data/View')

local processedCargoTypes = 6

p.view = {}

p.view['Name'] = dv.title{'key', text='name'}
p.view['Make'] = dv.text{'make'}

local nonZero = function(n)
    return n and n ~= 0
end

p.view['Processed cargo'] = {
    format = function(ship)
        local pc  = dv.formatNum(ship.processedCargo, 'kg')
        local pcc = dv.formatNum(ship.processedCargoCombined, 'kg (combined)')
        if nonZero(ship.processedCargo) and nonZero(ship.processedCargoCombined) then
            return pc .. ' + ' .. pcc
        elseif nonZero(ship.processedCargoCombined) then
            return pcc
        elseif nonZero(ship.processedCargo) then
            return pc
        end
    end,
    sortType = 'number',
    sortValue = function(ship)
         return ship.processedCargo * processedCargoTypes + ship.processedCargoCombined
    end
}

p.view['High-Stress'] = dv.number{'highStress'}
p.view['Low-Stress'] = dv.number{'lowStress'}
p.view['Drone hardpoints'] = dv.number{'droneHardpoints'}
p.view['Docking bays'] = dv.number{'dockingBays'}
p.view['Crew'] = dv.number{'crew'}
p.view['Engines'] = dv.number{'engines'}
p.view['Thrusters'] = dv.number{'thrusters'}

p.view['Dry mass'] = dv.number{'dryMass', unit='kg'}
p.view['Cargo bay'] = dv.number{'cargoBay', unit='m^3'}
p.view['EMP shielding'] = dv.number{'empShielding', unit='MJ', omitZero=true}
p.view['New price'] = dv.number{'priceNew', unit='E$'}

p.view['Variant'] = dv.text{'variant'}

for k,v in pairs(p.view) do
    v.heading = v.heading or k
end

p.defaultColumns = {
    'Name',
    'High-Stress', 'Low-Stress', 'Drone hardpoints', 'Docking bays', 'Crew',
    'Dry mass', 'Processed cargo',
    'Engines', 'EMP shielding', 'New price', 'Variant'
}

p.list = function(f)
    local columns = {}
    for i,col in ipairs(f.args) do
        -- positional arguments don't get trimmed
        col = string.match(col, '^%s*(.-)%s*$')
        table.insert(columns, col)
    end

    if table.getn(columns) == 0 then
        columns = p.defaultColumns
    end

    local data = mw.loadData('Module:Ships/Data')

    data = d.sort(data, {
        d.on(d.path{'baseModelData', 'hullValue'}, d.asc),
        d.on(d.path{'baseModelData', 'name'}, d.asc),
        d.on(d.path{'isVariant'}, d.asc),
        d.on(d.path{'hullValue'}, d.asc),
        d.on(d.path{'name'}, d.asc),
    })

    return dv.displayTable(data, p.view, columns)
end

return p