mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 22:55:35 +00:00
get rid of some redundant code
This commit is contained in:
@@ -67,26 +67,6 @@ export default class Module {
|
||||
// Sanitise the resultant value to 4dp equivalent
|
||||
return isNaN(result) ? result : Math.round(result);
|
||||
}
|
||||
/**
|
||||
* Set a value for a given modification ID
|
||||
* @param {Number} name The name of the modification
|
||||
* @param {object} value The value of the modification. If it is a numeric value then it should be an integer scaled so that -2.34% == -234
|
||||
*/
|
||||
setModValueFromJournal(name, value, origVal) {
|
||||
if (!this.mods) {
|
||||
this.mods = {};
|
||||
}
|
||||
if (!this.origVals) {
|
||||
this.origVals = {};
|
||||
}
|
||||
|
||||
if (value == null || value == 0) {
|
||||
delete this.mods[name];
|
||||
} else {
|
||||
this.mods[name] = value;
|
||||
this.origVals[name] = origVal;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a value for a given modification ID
|
||||
@@ -139,7 +119,6 @@ export default class Module {
|
||||
_getModifiedValue(name) {
|
||||
const modification = Modifications.modifications[name];
|
||||
let result = this[name];
|
||||
// console.log(`${name} = ${this[name]}`)
|
||||
if (!result) {
|
||||
if (modification && modification.method === 'additive') {
|
||||
// Additive modifications start at 0 rather than NULL
|
||||
|
||||
@@ -231,7 +231,6 @@ export function getBlueprint(name, module) {
|
||||
return undefined;
|
||||
}
|
||||
const blueprint = JSON.parse(JSON.stringify(found));
|
||||
console.log(blueprint)
|
||||
if (module) {
|
||||
if (module.grp === 'bh' || module.grp === 'hr' || module.grp === 'sg' || module.grp === 'psg' || module.grp === 'bsg') {
|
||||
// Bulkheads, hull reinforcements and shield generators need to have their resistances altered by the base values
|
||||
|
||||
@@ -49,7 +49,6 @@ function _moduleFromFdName (fdname) {
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(fdname)
|
||||
|
||||
// Not found
|
||||
return null
|
||||
@@ -252,7 +251,6 @@ function _addModifications (module, modifiers, blueprint, grade, specialModifica
|
||||
// Look up the modifiers to find what we need to do
|
||||
const findMod = val => Object.keys(Modifications.modifierActions).find(elem => elem.toString().toLowerCase().search(val.toString().toLowerCase().replace(/(OutfittingFieldType_|persecond)/igm, '')) >= 0)
|
||||
const modifierActions = Modifications.modifierActions[findMod(modifiers[i].Label)]
|
||||
console.log(`${modifiers[i].Label}: ${findMod(modifiers[i].Label)}`)
|
||||
//TODO: Figure out how to scale this value.
|
||||
if (!!modifiers[i].LessIsGood) {
|
||||
|
||||
@@ -271,7 +269,6 @@ function _addModifications (module, modifiers, blueprint, grade, specialModifica
|
||||
|
||||
// Add the blueprint definition, grade and special
|
||||
if (blueprint) {
|
||||
console.log(blueprint);
|
||||
module.blueprint = getBlueprint(blueprint, module)
|
||||
if (grade) {
|
||||
module.blueprint.grade = Number(grade)
|
||||
|
||||
Reference in New Issue
Block a user