mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 06:43:24 +00:00
Added jitter for hardpoints
This commit is contained in:
@@ -7,7 +7,7 @@ import NumberEditor from 'react-number-editor';
|
||||
/**
|
||||
* Modification
|
||||
*/
|
||||
export default class ModificationsMenu extends TranslatedComponent {
|
||||
export default class Modification extends TranslatedComponent {
|
||||
|
||||
static propTypes = {
|
||||
ship: React.PropTypes.object.isRequired,
|
||||
@@ -24,7 +24,7 @@ export default class ModificationsMenu extends TranslatedComponent {
|
||||
constructor(props, context) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
this.state.value = this.props.m.getModValue(this.props.name) / 100 || 0;
|
||||
this.state.value = this.props.name === 'jitter' ? this.props.m.getModValue(this.props.name) / 10000 : this.props.m.getModValue(this.props.name) / 100 || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,9 @@ export default class ModificationsMenu extends TranslatedComponent {
|
||||
* @param {Number} value The value to set
|
||||
*/
|
||||
_updateValue(value) {
|
||||
let scaledValue = Math.floor(Number(value) * 100);
|
||||
const name = this.props.name;
|
||||
|
||||
let scaledValue = name === 'jitter' ? Math.floor(Number(value) * 10000) : Math.floor(Number(value) * 100);
|
||||
// Limit to +1000% / -100%
|
||||
if (scaledValue > 100000) {
|
||||
scaledValue = 100000;
|
||||
@@ -44,7 +46,6 @@ export default class ModificationsMenu extends TranslatedComponent {
|
||||
}
|
||||
|
||||
let m = this.props.m;
|
||||
let name = this.props.name;
|
||||
let ship = this.props.ship;
|
||||
ship.setModification(m, name, scaledValue);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user