Corrected thurster selection and warnings

This commit is contained in:
Colin McLeod
2015-08-13 23:21:40 -07:00
parent 3d6d210563
commit 1edacf3eba
3 changed files with 17 additions and 11 deletions

View File

@@ -22,13 +22,13 @@ angular.module('app').directive('componentSelect', function() {
list.push(' warning'); list.push(' warning');
} }
list.push((o.maxmass && mass > o.maxmass) ? ' disabled"' : '" cpid="', id, '">'); list.push((o.maxmass && (mass + (o.mass ? o.mass : 0)) > o.maxmass) ? ' disabled"' : '" cpid="', id, '">');
if (o.mode) { if (o.mode) {
list.push('<svg cpid="', id, '" class="icon lg"><use cpid="', id, '" xlink:href="#mount-', o.mode, '"></use></svg> '); list.push('<svg class="icon lg"><use xlink:href="#mount-', o.mode, '"></use></svg> ');
} }
list.push('<span cpid="', id, '">', o.class, o.rating); list.push('<span>', o.class, o.rating);
if (o.missile) { if (o.missile) {
list.push('/' + o.missile); list.push('/' + o.missile);
@@ -50,7 +50,7 @@ angular.module('app').directive('componentSelect', function() {
scope: { scope: {
opts: '=', // Component Options object opts: '=', // Component Options object
groups: '=', // Groups of Component Options groups: '=', // Groups of Component Options
mass: '=', // Current ship unladen mass mass: '=', // Current ship mass
s: '=', // Current Slot s: '=', // Current Slot
warning: '=' // Check warning function warning: '=' // Check warning function
}, },
@@ -60,7 +60,7 @@ angular.module('app').directive('componentSelect', function() {
var component = scope.s.c; // Slot's Current Component (may be null/undefined) var component = scope.s.c; // Slot's Current Component (may be null/undefined)
var opts = scope.opts; var opts = scope.opts;
var groups = scope.groups; var groups = scope.groups;
var mass = scope.mass || 0; var mass = (scope.mass ? scope.mass : 0) - (component && component.mass ? component.mass : 0); // Mass minus the currently selected component
if (groups) { if (groups) {
// At present time slots with grouped options (Hardpoints and Internal) can be empty // At present time slots with grouped options (Hardpoints and Internal) can be empty

View File

@@ -101,6 +101,7 @@ select {
} }
&.disabled { &.disabled {
cursor: not-allowed;
border-color: @disabled; border-color: @disabled;
color: @disabled; color: @disabled;
stroke: @disabled; stroke: @disabled;

View File

@@ -34,8 +34,8 @@
<tr class="main"> <tr class="main">
<th rowspan="2">Size</th> <th rowspan="2">Size</th>
<th rowspan="2">Agility</th> <th rowspan="2">Agility</th>
<th rowspan="2">Speed</th> <th rowspan="2" ng-class="{'bg-warning-disabled': th.c.maxmass < ship.ladenMass}">Speed</th>
<th rowspan="2" ng-class="{'bg-warning-disabled': pd.c.enginecapacity < ship.boostEnergy}">Boost</th> <th rowspan="2" ng-class="{'bg-warning-disabled': (pd.c.enginecapacity < ship.boostEnergy || th.c.maxmass < ship.ladenMass)}">Boost</th>
<th rowspan="2">DPS</th> <th rowspan="2">DPS</th>
<th rowspan="2">Armour</th> <th rowspan="2">Armour</th>
<th rowspan="2">Shields</th> <th rowspan="2">Shields</th>
@@ -62,10 +62,15 @@
<tr> <tr>
<td ng-bind="SZ[ship.class]"></td> <td ng-bind="SZ[ship.class]"></td>
<td>{{ship.agility}}/10</td> <td>{{ship.agility}}/10</td>
<td>{{fRound(ship.speed)}} <u>m/s</u></td>
<td> <td>
<span ng-if="pd.c.enginecapacity >= ship.boostEnergy">{{fRound(ship.boost)}} <u>m/s</u></span> <span ng-if="th.c.maxmass >= ship.ladenMass">{{fRound(ship.speed)}} <u>m/s</u></span>
<span class="warning" ng-if="pd.c.enginecapacity < ship.boostEnergy">0 <svg class="icon"><use xlink:href="#warning"></use></svg></span> <span class="warning" ng-if="th.c.maxmass < ship.ladenMass">0 <svg class="icon"><use xlink:href="#warning"></use></svg></span>
</td>
<td>
<span ng-if="pd.c.enginecapacity >= ship.boostEnergy && th.c.maxmass >= ship.ladenMass">{{fRound(ship.boost)}} <u>m/s</u></span>
<span class="warning" ng-if="pd.c.enginecapacity < ship.boostEnergy || th.c.maxmass < ship.ladenMass">0
<svg class="icon"><use xlink:href="#warning"></use></svg>
</span>
</td> </td>
<td>{{fRound(ship.totalDps)}}</td> <td>{{fRound(ship.totalDps)}}</td>
<td> <td>
@@ -122,7 +127,7 @@
<div component-select class="select" s="pp" opts="availCS.common[0]" ng-if="selectedSlot==pp" ng-click="select('c',pp,$event)"></div> <div component-select class="select" s="pp" opts="availCS.common[0]" ng-if="selectedSlot==pp" ng-click="select('c',pp,$event)"></div>
</div> </div>
<div class="slot" ng-click="selectSlot($event, th)" ng-class="{selected: selectedSlot==th}"> <div class="slot" ng-click="selectSlot($event, th)" ng-class="{selected: selectedSlot==th}">
<div class="details"> <div class="details" ng-class="{'warning': th.c.maxmass < ship.ladenMass}">
<div class="sz">{{::th.maxClass}}</div> <div class="sz">{{::th.maxClass}}</div>
<div class="l">{{th.id}} Thrusters</div> <div class="l">{{th.id}} Thrusters</div>
<div class="r">{{th.c.mass}} <u>T</u></div> <div class="r">{{th.c.mass}} <u>T</u></div>