Skip to content

Commit

Permalink
Merge pull request #647 from Thorium-Sim/shield-power
Browse files Browse the repository at this point in the history
Fix issues with shield power.
  • Loading branch information
alexanderson1993 authored Oct 5, 2024
2 parents 7c884a4 + 5f936c2 commit ccb5fee
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 ccb5fee

Please sign in to comment.