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
Module:Equipment - ΔV: Wiki

Module:Equipment

From ΔV: Wiki

Documentation for this module may be created at Module:Equipment/doc

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


p.view = {}

p.view['Name'] = dv.text{'name'}
p.view['Title'] = dv.title{function(item) return item.title or item.name end, heading='Name', text='name'}
p.view['Price'] = dv.number{'price', unit='E$'}
p.view['Mass'] = dv.number{'mass', unit='kg'}
p.view['Manufacturer'] = dv.text{'manufacturer'}
p.view['Other'] = dv.text{'other'}

-- Hardpoints
p.view['High-Stress'] = dv.flag{'highStress'}
p.view['Low-Stress'] = dv.flag{'lowStress'}
p.view['Docking bay'] = dv.flag{'dockingBay'}
p.view['Drone hardpoint'] = dv.flag{'droneHardpoint'}

p.view['Effective range'] = dv.number{'effectiveRange', unit='m'}
p.view['Power draw'] = dv.number{'powerDraw', unit='MW'}

-- Drones
p.view['Drones per second'] = dv.number{'droneLaunchCapability'}
p.view['Drone wet mass'] = dv.number{'droneWetMass', unit='kg'}
p.view['Drone thrust'] = dv.number{'droneThrust', unit='kN'}

-- Projectile magazines, nanodrone components, and propellant tanks
p.view['Storage'] = dv.number{'storage', unit='kg'}
p.view['Delivery'] = dv.number{'delivery', unit='kg/s'}
p.view['Exclusive to'] = dv.list{'exclusiveTo', itemView=dv.title{nil}}

-- Ultracapacitors
p.view['Energy capacity'] = dv.number{'energyCapacity', unit='MJ'}
p.view['Peak power'] = dv.number{'peakPower', unit='GW'}

-- Autopilots
p.view['AAT'] = dv.flag{'aat', heading='[[Autopilot#AAT|AAT]]'}
p.view['ARL'] = dv.flag{'arl', heading='[[Autopilot#ARL|ARL]]'}
p.view['RTC'] = dv.flag{'rtc', heading='[[Autopilot#RTC|RTC]]'}
p.view['FBW'] = dv.flag{'fbw', heading='[[Autopilot#FBW|FBW]]'}
p.view['Autopilot capabilities'] = dv.list{'autopilotCapabilities', heading='Capabilities', itemView=dv.text{nil}}

-- Gimbals/Vectored
p.view['Vectored Thrust Angle'] = dv.number{'vectoredThrustAngle', unit='deg'}
p.view['Gimbal Angle'] = dv.number{'gimbalAngle', unit='deg'}
p.view['Gimbal Speed'] = dv.number{'gimbalSpeed', unit='deg/s'}

-- Main Propulsion and RCS
p.view['Thrust'] = dv.number{'thrust', unit='kN'}
p.view['Exhaust Velocity'] = dv.number{'exhaustVelocity', unit='km/s'}
p.view['Propellant Consumption'] = dv.number{'propellantConsumption', unit='kg/s'}
p.view['Power Consumption'] = dv.number{'powerConsumption', unit='MW'}
p.view['Thermal Consumption'] = dv.number{'thermalConsumption', unit='GW'}
p.view['Response Time'] = dv.number{'responseTime', unit='s'}
p.view['Operation Mode'] = dv.text{'operationMode'}
p.view['Propellant'] = dv.text{'propellant'}

-- Auxiliary Power System (& Turbines)
p.view['Power (nominal)'] = dv.number{'power', unit='MW'}
p.view['Charge power draw'] = dv.number{'chargePower', unit='MW'}
p.view['Discharge power (peak)'] = dv.number{'dischargePower', unit='MW'}
p.view['APU type'] = dv.number{'apsType', unit='MW'}
p.view['Category'] = dv.list{'categories', itemView=dv.title{nil}}

-- Reactor Cores
p.view['Operating Temperature'] = dv.number{'operatingTemperature', unit='K'}
p.view['Failure Point'] = dv.number{'failureTemperature', unit='K'}
p.view['Thermal Power'] = dv.number{'thermalPower', unit='GW'}



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

p.defaultColumns = {
    'Name', 'Price', 'Mass'
}

p.positionalArgs = function(f)
    local posArgs = {}
    for i,posArg in ipairs(f.args) do
        -- positional arguments don't get trimmed
        table.insert(posArgs, mw.text.trim(posArg))
    end
    return posArgs
end

p.list = function(f)
    local posArgs = p.positionalArgs (f)
    local slot = table.remove(posArgs, 1)
    local columns = posArgs
    if table.getn(columns) == 0 then
        columns = p.defaultColumns
    end

    local data = mw.loadData('Module:Equipment/Data')
    data = data[slot]

    data = d.sort(data, {
        d.on(d.path{'price'}, d.asc),
        d.on(d.path{'name'}, d.asc),
    })

    local options = {
        caption = f.args['caption']
    }

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

return p