: null }
-
- _showModificationsMenu(m, e) {
- let validMods = m == null ? [] : (Modifications.validity[m.grp] || []);
- // TODO set up the modifications
- e.stopPropagation();
- }
-
- /**
- * Update power usage modification given a slider value.
- * Note that this is a temporary function until we have a slider section
- * @param {Number} value The value of the slider
- */
- _updateSliderValue(value) {
- let m = this.props.slot.m;
- if (m) {
- m.setModValue(2, value * 2 - 1);
- }
- this.props.onChange();
- }
-
- /**
- * Obtain slider value from a power usage modification.
- * Note that this is a temporary function until we have a slider section
- * @return {Number} value The value of the slider
- */
- _getSliderValue() {
- let m = this.props.slot.m;
- if (m && m.getModValue(2)) {
- return (m.getModValue(2) + 1) / 2;
- }
- return 0;
- }
-
}
diff --git a/src/app/pages/OutfittingPage.jsx b/src/app/pages/OutfittingPage.jsx
index e4ee5633..839c6b00 100644
--- a/src/app/pages/OutfittingPage.jsx
+++ b/src/app/pages/OutfittingPage.jsx
@@ -284,9 +284,9 @@ export default class OutfittingPage extends Page {
canSave = (newBuildName || buildName) && code !== savedCode,
canRename = buildName && newBuildName && buildName != newBuildName,
canReload = savedCode && canSave,
- hStr = ship.getHardpointsString(),
- sStr = ship.getStandardString(),
- iStr = ship.getInternalString();
+ hStr = ship.getHardpointsString() + '.' + ship.getModificationsString(),
+ sStr = ship.getStandardString() + '.' + ship.getModificationsString(),
+ iStr = ship.getInternalString() + '.' + ship.getModificationsString();
return (
diff --git a/src/app/shipyard/Module.js b/src/app/shipyard/Module.js
index d3377e6b..3af7768a 100755
--- a/src/app/shipyard/Module.js
+++ b/src/app/shipyard/Module.js
@@ -82,13 +82,13 @@ export default class Module {
}
/**
- * Get the mass of this module, taking in to account modifications
- * @return {Number} the mass of this module
+ * Get the integrity of this module, taking in to account modifications
+ * @return {Number} the integrity of this module
*/
- getMass() {
+ getIntegrity() {
let result = 0;
- if (this.mass) {
- result = this.mass;
+ if (this.health) {
+ result = this.health;
if (result) {
let mult = this.getModValue(3);
if (mult) { result = result * (1 + mult); }
@@ -98,13 +98,13 @@ export default class Module {
}
/**
- * Get the integrity of this module, taking in to account modifications
- * @return {Number} the integrity of this module
+ * Get the mass of this module, taking in to account modifications
+ * @return {Number} the mass of this module
*/
- getIntegrity() {
+ getMass() {
let result = 0;
- if (this.health) {
- result = this.health;
+ if (this.mass) {
+ result = this.mass;
if (result) {
let mult = this.getModValue(4);
if (mult) { result = result * (1 + mult); }
diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js
index 5123f087..50d4018f 100755
--- a/src/app/shipyard/Ship.js
+++ b/src/app/shipyard/Ship.js
@@ -347,7 +347,6 @@ export default class Ship {
return this.serialized.hardpoints;
}
-
/**
* Serializes the modifications to a string
* @return {String} Serialized modifications 'code'
@@ -403,6 +402,37 @@ export default class Ship {
return this;
}
+ /**
+ * Set a modification value
+ * @param {Object} m The module to change
+ * @param {Object} mId The ID of the modification to change
+ * @param {Number} value The new value of the modification
+ */
+ setModification(m, mId, value) {
+ // Handle special cases
+ if (mId == 1) {
+ // Power generation
+ m.setModValue(mId, value);
+ this.updatePower();
+ } else if (mId == 2) {
+ // Power usage
+ m.setModValue(mId, value);
+ this.updatePower();
+ } else if (mId == 4) {
+ // Mass
+ let oldMass = m.getMass();
+ m.setModValue(mId, value);
+ let newMass = m.getMass();
+ this.unladenMass = this.unladenMass - oldMass + newMass;
+ this.ladenMass = this.ladenMass - oldMass + newMass;
+ this.updateTopSpeed();
+ this.updateJumpStats();
+ } else {
+ // Generic
+ m.setModValue(mId, value);
+ }
+ }
+
/**
* Builds/Updates the ship instance with the ModuleUtils[comps] passed in.
* @param {Object} comps Collection of ModuleUtils used to build the ship
diff --git a/src/less/app.less b/src/less/app.less
index b4a5443f..7f4564ec 100755
--- a/src/less/app.less
+++ b/src/less/app.less
@@ -163,4 +163,4 @@ footer {
float: right;
text-align: right;
}
-}
\ No newline at end of file
+}