Skip to content

Commit

Permalink
fix: Fix issues with shield power.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderson1993 committed Oct 19, 2024
1 parent 928e24d commit d7c2864
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/src/systems/ShieldsSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ export class ShieldsSystem extends System {
const elapsedTimeHours = elapsed / 1000 / 60 / 60;

if (entity.components.power && entity.components.isShields) {
const { currentPower } = entity.components.power;
const { currentPower, requiredPower } = entity.components.power;
const { state, maxStrength, strength } = entity.components.isShields;
// Some space magic to make the shields more powerful.
let strengthToRecharge = currentPower * elapsedTimeHours * 10;
if (state === "down") {
if (state === "down" || currentPower < requiredPower) {
// Quickly drain shields when they are down
strengthToRecharge = (-maxStrength / SHIELD_DISCHARGE_TIME) * elapsed;
}
Expand Down

0 comments on commit d7c2864

Please sign in to comment.