Skip to content

Commit

Permalink
## Ship Panel
Browse files Browse the repository at this point in the history
* Added toggle switches (currently read only) for Ship Lights, Night Vision, Hardpoints and Landing Gear.
* Added warning lights for Overheating, Interdictions, Low Fuel and Danger ship states.
* Added information / state lights for Mass Lock, FSD Cooldown, FSD Charging and FSD Jumping, Docked/Landed, Supercruise, Fuel Scooping and Flight Assist states.
* Added total count for consumables and total counts with usage bar for each type of item in storage.
* Updated copy on Ship Locker/Item Storage and used the name "Assets" where appropriate (consistent with the in-game UI).

## Engineering Panel

* Improved rendering of information about engineers in Blueprints view.
* Improved logic on Blueprint page to fix issues with sometimes not displaying distance to an engineer's system from your current location.

## Navigation Panel

* Improved Navigation Route handling when in a system that is not in the currently plotted route.
* Copy/text improvements in Navigation Route view.
* Minor copy changes to faction state text.
  • Loading branch information
iaincollins committed Apr 20, 2022
1 parent 8677474 commit 240f31d
Show file tree
Hide file tree
Showing 13 changed files with 385 additions and 92 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "icarus",
"version": "0.10.0",
"version": "0.11.0",
"description": "ICARUS Terminal for Elite Dangerous",
"scripts": {
"build": "npm run build:web && npm run build:app && npm run build:service && npm run build:package",
Expand Down
35 changes: 24 additions & 11 deletions src/service/lib/event-handlers/inventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class Inventory {
const shipLocker = (await this.eliteJson.json()).ShipLocker
if (!shipLocker) return []

const inventory = []
const inventoryItems = []

shipLocker.Consumables.forEach(item => {
let itemInInventory = inventory.filter(i => i.name === (item?.Name_Localised ?? item.Name))[0]
let itemInInventory = inventoryItems.filter(i => i.name === (item?.Name_Localised ?? item.Name))[0]
if (!itemInInventory) {
itemInInventory = {
name: item?.Name_Localised ?? item.Name,
Expand All @@ -22,7 +22,7 @@ class Inventory {
stolen: 0,
count: 0
}
inventory.push(itemInInventory)
inventoryItems.push(itemInInventory)
}

itemInInventory.count += item.Count
Expand All @@ -31,7 +31,7 @@ class Inventory {
})

shipLocker.Items.forEach(item => {
let itemInInventory = inventory.filter(i => i.name === (item?.Name_Localised ?? item.Name))[0]
let itemInInventory = inventoryItems.filter(i => i.name === (item?.Name_Localised ?? item.Name))[0]
if (!itemInInventory) {
itemInInventory = {
name: item?.Name_Localised ?? item.Name,
Expand All @@ -40,7 +40,7 @@ class Inventory {
stolen: 0,
count: 0
}
inventory.push(itemInInventory)
inventoryItems.push(itemInInventory)
}

itemInInventory.count += item.Count
Expand All @@ -49,7 +49,7 @@ class Inventory {
})

shipLocker.Components.forEach(item => {
let itemInInventory = inventory.filter(i => i.name === (item?.Name_Localised ?? item.Name))[0]
let itemInInventory = inventoryItems.filter(i => i.name === (item?.Name_Localised ?? item.Name))[0]
if (!itemInInventory) {
itemInInventory = {
name: item?.Name_Localised ?? item.Name,
Expand All @@ -58,7 +58,7 @@ class Inventory {
stolen: 0,
count: 0
}
inventory.push(itemInInventory)
inventoryItems.push(itemInInventory)
}

itemInInventory.count += item.Count
Expand All @@ -67,7 +67,7 @@ class Inventory {
})

shipLocker.Data.forEach(item => {
let itemInInventory = inventory.filter(i => i.name === (item?.Name_Localised ?? item.Name))[0]
let itemInInventory = inventoryItems.filter(i => i.name === (item?.Name_Localised ?? item.Name))[0]
if (!itemInInventory) {
itemInInventory = {
name: item?.Name_Localised ?? item.Name,
Expand All @@ -76,17 +76,30 @@ class Inventory {
stolen: 0,
count: 0
}
inventory.push(itemInInventory)
inventoryItems.push(itemInInventory)
}

itemInInventory.count += item.Count
if (item.MissionID) itemInInventory.mission += item.Count
if (item.OwnerID > 0) itemInInventory.stolen += item.Count
})

inventory.sort((a, b) => a.name.localeCompare(b.name))
inventoryItems.sort((a, b) => a.name.localeCompare(b.name))

return inventory
const counts = {
goods: 0,
components: 0,
data: 0,
}

inventoryItems.filter(i => i.type === 'Goods').forEach(item => counts.goods += item.count)
inventoryItems.filter(i => i.type === 'Component').forEach(item => counts.components += item.count)
inventoryItems.filter(i => i.type === 'Data').forEach(item => counts.data += item.count)

return {
counts,
items: inventoryItems
}
}
}

Expand Down
8 changes: 7 additions & 1 deletion src/service/lib/event-handlers/nav-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class NavRoute {

async getNavRoute () {
const currentSystem = await this.system.getSystem()

let inSystemOnRoute = false
let jumpsToDestination = null

const route = ((await this.eliteJson.json())?.NavRoute?.Route ?? []).map(system => {
Expand All @@ -22,6 +24,9 @@ class NavRoute {
//const isCurrentSystem = (distanceToHop === 0)
const isCurrentSystem = (system?.StarSystem?.toLowerCase() === currentSystem?.name?.toLowerCase())

if (isCurrentSystem)
inSystemOnRoute = true

if (isCurrentSystem) {
jumpsToDestination = 0
} else {
Expand All @@ -42,7 +47,8 @@ class NavRoute {
currentSystem,
destination: route?.[route.length - 1] ?? [],
jumpsToDestination,
route
route,
inSystemOnRoute
}

return navRoute
Expand Down
10 changes: 5 additions & 5 deletions src/web/components/panels/nav/system-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CopyOnClick from 'components/copy-on-click'

const factionStates = {
expansion: {
description: 'Controlling faction expanding influence'
description: 'Faction expanding influence'
},
investment: {
description: 'Ongoing investment, expansion anticipated'
Expand All @@ -24,7 +24,7 @@ const factionStates = {
description: 'Economy bust'
},
civilUnrest: {
description: 'Civil Unrest ,support & bounty missions'
description: 'Civil Unrest, support & bounty missions'
},
famine: {
description: 'Famine, demand for food, support missions'
Expand All @@ -36,7 +36,7 @@ const factionStates = {
description: 'Lockdown, services restricted, support missions'
},
retreat: {
description: 'Controlling faction retreating from system'
description: 'Faction retreating from system'
},
naturalDisaster: {
description: 'Natural disaster, support missions available'
Expand Down Expand Up @@ -65,9 +65,9 @@ export default function SystemMap ({ system, setSystemObject }) {
<div className='system-map'>
<div className='system-map__title'>
<h1>
<span className='fx-animated-text' data-fx-order='1'>
<span className='fx-animated-text' data-fx-order='1' style={{paddingRight: '1rem'}}>
<i className='icon icarus-terminal-system-orbits' />
<CopyOnClick>{system.name}</CopyOnClick>&nbsp;
<CopyOnClick>{system.name}</CopyOnClick>
</span>
</h1>
{system.detail && system.detail.bodies && system.detail.bodies.length > 0 &&
Expand Down
175 changes: 142 additions & 33 deletions src/web/components/panels/ship/ship-modules-panel.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { UNKNOWN_VALUE } from '../../../../shared/consts'
import ShipModules from './ship-modules'

export default function ShipModulesPanel ({ ship, selectedModule, setSelectedModule }) {
export default function ShipModulesPanel ({ ship, selectedModule, setSelectedModule, cmdrStatus }) {
if (!ship) return null

if (ship.type === UNKNOWN_VALUE && ship.name === UNKNOWN_VALUE && ship.ident === UNKNOWN_VALUE) {
Expand Down Expand Up @@ -39,38 +39,147 @@ export default function ShipModulesPanel ({ ship, selectedModule, setSelectedMod
<label className={(ship.onBoard && ship?.pips?.weapons > 0) ? 'text-primary' : 'text-primary text-muted'}>Weapons</label>
</div>
</div>
<table className='ship-panel__ship-stats'>
<tbody className='text-info'>
<tr>
<td>
<span className='text-muted'>Max jump range</span>
<span className='value'>{ship.maxJumpRange || '-'} Ly</span>
</td>
<td>
<span className='text-muted'>Fuel (curr/max)</span>
<span className='value'>{typeof ship?.fuelLevel === 'number' ? ship.fuelLevel : '-'}/{ship.fuelCapacity} T</span>
</td>
<td>
<span className='text-muted'>Cargo (curr/max)</span>
<span className='value'>{typeof ship?.cargo?.count === 'number' ? ship.cargo.count : '-'}/{ship.cargo.capacity} T</span>
</td>
</tr>
<tr>
<td>
<span className='text-muted'>Insurance Rebuy</span>
<span className='value'>{ship.rebuy ? ship.rebuy.toLocaleString() : '-'} CR</span>
</td>
<td>
<span className='text-muted'>Fuel Reservoir</span>
<span className='value'>{typeof ship?.fuelReservoir === 'number' ? ship.fuelReservoir : '-'}</span>
</td>
<td>
<span className='text-muted'>Total mass</span>
<span className='value'>{ship.mass} T</span>
</td>
</tr>
</tbody>
</table>

<div className='ship-panel--status'>
<table className='ship-panel__ship-stats'>
<tbody className='text-info'>
<tr>
<td>
<span className='text-muted'>Max jump range</span>
<span className='value'>{ship.maxJumpRange || '-'} Ly</span>
</td>
<td>
<span className='text-muted'>Fuel (curr/max)</span>
<span className='value'>{typeof ship?.fuelLevel === 'number' ? ship.fuelLevel : '-'}/{ship.fuelCapacity} T</span>
</td>
<td>
<span className='text-muted'>Cargo (curr/max)</span>
<span className='value'>{typeof ship?.cargo?.count === 'number' ? ship.cargo.count : '-'}/{ship.cargo.capacity} T</span>
</td>
</tr>
<tr>
<td>
<span className='text-muted'>Insurance Rebuy</span>
<span className='value'>{ship.rebuy ? ship.rebuy.toLocaleString() : '-'} CR</span>
</td>
<td>
<span className='text-muted'>Fuel Reservoir</span>
<span className='value'>{typeof ship?.fuelReservoir === 'number' ? ship.fuelReservoir : '-'}</span>
</td>
<td>
<span className='text-muted'>Total mass</span>
<span className='value'>{ship.mass} T</span>
</td>
</tr>
</tbody>
</table>

<table className='table--layout'>
<tbody>
<tr>
<td>
<label className='checkbox'>
<span className='checkbox__text'>Ship Lights</span>
<input type='checkbox' checked={ship.onBoard && cmdrStatus?.flags?.lightsOn} />
<span class='checkbox__control'/>
</label>
</td>
<td>
<label className='checkbox'>
<span className='checkbox__text'>Night Vision</span>
<input type='checkbox' checked={ship.onBoard && cmdrStatus?.flags?.nightVision} />
<span class='checkbox__control'/>
</label>
</td>
<td>
<label className='checkbox'>
<span className='checkbox__text'>Hardpoints</span>
<input type='checkbox' checked={ship.onBoard && cmdrStatus?.flags?.hardpointsDeployed} />
<span class='checkbox__control'/>
</label>
</td>
<td>
<label className='checkbox'>
<span className='checkbox__text'>Landing Gear</span>
<input type='checkbox' checked={ship.onBoard && cmdrStatus?.flags?.landingGearDown} />
<span class='checkbox__control'/>
</label>
</td>
</tr>
</tbody>
</table>
<table className='table--layout'>
<tbody>
<tr>
<td>
<span className={ship.onBoard && cmdrStatus?.flags?.overHeating ? 'ship-panel__light--danger' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Overheating</span>
</span>
</td>
<td>
<span className={ship.onBoard && cmdrStatus?.flags?.beingInterdicted ? 'ship-panel__light--danger' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Interdiction Detected</span>
</span>
</td>
<td>
<span className={ship.onBoard && cmdrStatus?.flags?.lowFuel ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Fuel Low</span>
</span>
</td>
<td>
<span className={ship.onBoard && cmdrStatus?.flags?.inDanger ? 'ship-panel__light--danger' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Danger</span>
</span>
</td>
</tr>
<tr>
<td>
<span className={ship.onBoard && cmdrStatus?.flags?.fsdMassLocked ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Mass Locked</span>
</span>
</td>
<td>
<span className={ship.onBoard && cmdrStatus?.flags?.fsdCooldown ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Frame Shift Cooldown</span>
</span>
</td>
<td>
<span className={ship.onBoard && cmdrStatus?.flags?.fsdCharging ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Frame Shift Charging</span>
</span>
</td>
<td>
<span className={ship.onBoard && cmdrStatus?.flags?.fsdJump ? 'ship-panel__light--danger' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Frame Shift Jumping</span>
</span>
</td>
</tr>
<tr>
<td>
<span className={ship.onBoard && (cmdrStatus?.flags?.docked || cmdrStatus?.flags?.landed) ? 'ship-panel__light--info' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Docked</span>
</span>
</td>
<td>
<span className={ship.onBoard && cmdrStatus?.flags?.supercruise ? 'ship-panel__light--info' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Supercruise</span>
</span>
</td>
<td>
<span className={ship.onBoard && cmdrStatus?.flags?.scoopingFuel ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Fuel Scooping</span>
</span>
</td>
<td>
<span className={ship.onBoard && cmdrStatus?.flags?.flightAssistOff ? 'ship-panel__light--secondary' : 'ship-panel__light--off'}>
<span className='ship-panel__light-text'>Flight Assist Off</span>
</span>
</td>
</tr>
</tbody>
</table>
</div>

<ShipModules
name='Hardpoints'
modules={
Expand Down
Loading

0 comments on commit 240f31d

Please sign in to comment.