mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
Update DPS/HPS/EPS in real-time as modifiers change
This commit is contained in:
5
ChangeLog.md
Normal file
5
ChangeLog.md
Normal file
@@ -0,0 +1,5 @@
|
||||
#2.2.x
|
||||
* Update DPS/HPS/EPS in real-time as modifiers change
|
||||
* Use coriolis-data 2.2.2:
|
||||
* Add distributor draw modifier to shield generators
|
||||
* Remove modifiers for sensors
|
||||
@@ -437,6 +437,11 @@ export default class Ship {
|
||||
} else if (name == 'hullboost') {
|
||||
m.setModValue(name, value);
|
||||
this.updateArmour();
|
||||
} else if (name == 'burst' || name == 'clip' || name == 'damage' || name == 'distdraw' || name == 'jitter' || name == 'piercing' || name == 'range' || name == 'reload' || name == 'rof' || name == 'thermload') {
|
||||
m.setModValue(name, value);
|
||||
this.recalculateDps();
|
||||
this.recalculateHps();
|
||||
this.recalculateEps();
|
||||
} else {
|
||||
// Generic
|
||||
m.setModValue(name, value);
|
||||
@@ -820,6 +825,54 @@ export default class Ship {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate damage per second for weapons
|
||||
* @return {this} The ship instance (for chaining operations)
|
||||
*/
|
||||
recalculateDps() {
|
||||
let totalDps = 0;
|
||||
|
||||
for (let slotNum in this.hardpoints) {
|
||||
const slot = this.hardpoints[slotNum];
|
||||
if (slot.m && slot.enabled && slot.m.getDps()) {
|
||||
totalDps += slot.m.getDps();
|
||||
}
|
||||
}
|
||||
this.totalDps = totalDps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate heat per second for weapons
|
||||
* @return {this} The ship instance (for chaining operations)
|
||||
*/
|
||||
recalculateHps() {
|
||||
let totalHps = 0;
|
||||
|
||||
for (let slotNum in this.hardpoints) {
|
||||
const slot = this.hardpoints[slotNum];
|
||||
if (slot.m && slot.enabled && slot.m.getHps()) {
|
||||
totalHps += slot.m.getHps();
|
||||
}
|
||||
}
|
||||
this.totalHps = totalHps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate energy per second for weapons
|
||||
* @return {this} The ship instance (for chaining operations)
|
||||
*/
|
||||
recalculateEps() {
|
||||
let totalEps = 0;
|
||||
|
||||
for (let slotNum in this.hardpoints) {
|
||||
const slot = this.hardpoints[slotNum];
|
||||
if (slot.m && slot.enabled && slot.m.getEps()) {
|
||||
totalEps += slot.m.getEps();
|
||||
}
|
||||
}
|
||||
this.totalEps = totalEps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update power calculations when amount generated changes
|
||||
* @return {this} The ship instance (for chaining operations)
|
||||
|
||||
Reference in New Issue
Block a user