From f8ff9a6a87899220bd017f986f6d78fadb9cacc8 Mon Sep 17 00:00:00 2001 From: Cmdr McDonald Date: Thu, 3 Nov 2016 11:29:41 +0000 Subject: [PATCH] Add more fillouts --- src/app/components/HardpointsSlotSection.jsx | 10 +++ src/app/components/InternalSlot.jsx | 1 + src/app/components/InternalSlotSection.jsx | 92 +++++++++++++++++++- src/app/components/SlotSection.jsx | 2 +- src/app/components/UtilitySlotSection.jsx | 12 ++- src/app/i18n/en.js | 3 + 6 files changed, 116 insertions(+), 4 deletions(-) diff --git a/src/app/components/HardpointsSlotSection.jsx b/src/app/components/HardpointsSlotSection.jsx index 378300ee..367d1279 100644 --- a/src/app/components/HardpointsSlotSection.jsx +++ b/src/app/components/HardpointsSlotSection.jsx @@ -127,6 +127,16 @@ export default class HardpointsSlotSection extends SlotSection {
  • +
    {translate('fc')}
    + +
    {translate('nc')}
    + ; } diff --git a/src/app/components/InternalSlot.jsx b/src/app/components/InternalSlot.jsx index cb813c88..cf3eb767 100644 --- a/src/app/components/InternalSlot.jsx +++ b/src/app/components/InternalSlot.jsx @@ -43,6 +43,7 @@ export default class InternalSlot extends Slot { { m.getFacingLimit() ?
    {translate('facinglimit')} {formats.f1(m.getFacingLimit())}°
    : null } { m.getRange() ?
    {translate('range')} {formats.f2(m.getRange())}{u.km}
    : null } { m.getRangeT() ?
    {translate('ranget')} {formats.f1(m.getRangeT())}{u.s}
    : null } + { m.spinup ?
    {translate('spinup')}: {formats.f1(m.spinup)}{u.s}
    : null } { m.time ?
    {translate('time')}: {formats.time(m.time)}
    : null } { m.maximum ?
    {translate('max')}: {(m.maximum)}
    : null } { m.rangeLS ?
    {translate('range')}: {m.rangeLS}{u.Ls}
    : null } diff --git a/src/app/components/InternalSlotSection.jsx b/src/app/components/InternalSlotSection.jsx index 5a59a069..70ee500f 100644 --- a/src/app/components/InternalSlotSection.jsx +++ b/src/app/components/InternalSlotSection.jsx @@ -22,6 +22,11 @@ export default class InternalSlotSection extends SlotSection { this._fillWithCargo = this._fillWithCargo.bind(this); this._fillWithCells = this._fillWithCells.bind(this); this._fillWithArmor = this._fillWithArmor.bind(this); + this._fillWithFuelTanks = this._fillWithFuelTanks.bind(this); + this._fillWithLuxuryCabins = this._fillWithLuxuryCabins.bind(this); + this._fillWithFirstClassCabins = this._fillWithFirstClassCabins.bind(this); + this._fillWithBusinessClassCabins = this._fillWithBusinessClassCabins.bind(this); + this._fillWithEconomyClassCabins = this._fillWithEconomyClassCabins.bind(this); } /** @@ -49,6 +54,86 @@ export default class InternalSlotSection extends SlotSection { this._close(); } + /** + * Fill all slots with fuel tanks + * @param {SyntheticEvent} event Event + */ + _fillWithFuelTanks(event) { + let clobber = event.getModifierState('Alt'); + let ship = this.props.ship; + ship.internal.forEach((slot) => { + if (clobber || !slot.m) { + ship.use(slot, ModuleUtils.findInternal('ft', slot.maxClass, 'C')); + } + }); + this.props.onChange(); + this._close(); + } + + /** + * Fill all slots with luxury passenger cabins + * @param {SyntheticEvent} event Event + */ + _fillWithLuxuryCabins(event) { + let clobber = event.getModifierState('Alt'); + let ship = this.props.ship; + ship.internal.forEach((slot) => { + if (clobber || !slot.m) { + ship.use(slot, ModuleUtils.findInternal('pcq', Math.min(slot.maxClass, 6), 'B')); // Passenger cabins top out at 6 + } + }); + this.props.onChange(); + this._close(); + } + + /** + * Fill all slots with first class passenger cabins + * @param {SyntheticEvent} event Event + */ + _fillWithFirstClassCabins(event) { + let clobber = event.getModifierState('Alt'); + let ship = this.props.ship; + ship.internal.forEach((slot) => { + if (clobber || !slot.m) { + ship.use(slot, ModuleUtils.findInternal('pcm', Math.min(slot.maxClass, 6), 'C')); // Passenger cabins top out at 6 + } + }); + this.props.onChange(); + this._close(); + } + + /** + * Fill all slots with business class passenger cabins + * @param {SyntheticEvent} event Event + */ + _fillWithBusinessClassCabins(event) { + let clobber = event.getModifierState('Alt'); + let ship = this.props.ship; + ship.internal.forEach((slot) => { + if (clobber || !slot.m) { + ship.use(slot, ModuleUtils.findInternal('pci', Math.min(slot.maxClass, 6), 'D')); // Passenger cabins top out at 6 + } + }); + this.props.onChange(); + this._close(); + } + + /** + * Fill all slots with economy class passenger cabins + * @param {SyntheticEvent} event Event + */ + _fillWithEconomyClassCabins(event) { + let clobber = event.getModifierState('Alt'); + let ship = this.props.ship; + ship.internal.forEach((slot) => { + if (clobber || !slot.m) { + ship.use(slot, ModuleUtils.findInternal('pce', Math.min(slot.maxClass, 6), 'E')); // Passenger cabins top out at 6 + } + }); + this.props.onChange(); + this._close(); + } + /** * Fill all slots with Shield Cell Banks * @param {SyntheticEvent} event Event @@ -133,13 +218,18 @@ export default class InternalSlotSection extends SlotSection { * @param {Function} translate Translate function * @return {React.Component} Section menu */ - _getSectionMenu(translate) { + _getSectionMenu(translate, ship) { return
    e.stopPropagation()} onContextMenu={stopCtxPropagation}>
    ; diff --git a/src/app/components/SlotSection.jsx b/src/app/components/SlotSection.jsx index 29ea806e..4a339a33 100644 --- a/src/app/components/SlotSection.jsx +++ b/src/app/components/SlotSection.jsx @@ -180,7 +180,7 @@ export default class SlotSection extends TranslatedComponent {

    {translate(this.sectionName)}

    - {sectionMenuOpened ? this._getSectionMenu(translate) : null } + {sectionMenuOpened ? this._getSectionMenu(translate, this.props.ship) : null }
    {this._getSlots()}
    diff --git a/src/app/components/UtilitySlotSection.jsx b/src/app/components/UtilitySlotSection.jsx index 7741a2c4..0351b4ab 100644 --- a/src/app/components/UtilitySlotSection.jsx +++ b/src/app/components/UtilitySlotSection.jsx @@ -105,9 +105,17 @@ export default class UtilitySlotSection extends SlotSection {
  • B
  • A
  • -
    {translate('cm')}
    +
    {translate('hs')}
    +
    {translate('ch')}
    + +
    {translate('po')}
    + ; } diff --git a/src/app/i18n/en.js b/src/app/i18n/en.js index 9f3b18f4..d59aea17 100644 --- a/src/app/i18n/en.js +++ b/src/app/i18n/en.js @@ -89,6 +89,9 @@ export const terms = { // 'ammo' was overloaded for outfitting page and modul info, so changed to ammunition for outfitting page ammunition: 'Ammo', + // Unit for seconds + secs: 's', + // Modifications ammo: 'Ammunition maximum', armourpen: 'Armour penetration',