Something went wrong. Try again.
Starship Simulator Controls thoriumsim.com
Something went wrong. Try again.
604 B · 17 lines
TypeScript
at develop
123456789101112131415161718import { type Entity, System } from "@thorium/utils/ecs";
export class ReactorPowerUpSystem extends System { static flightMode = ["nova"]; test(entity: Entity) { return !!entity.components.isReactor; } update(entity: Entity, elapsed: number) { if (!entity.components.isReactor) return; const { desiredOutput, currentOutput, powerUpSpeed } = entity.components.isReactor; if (desiredOutput === currentOutput) return; const elapsedTime = elapsed / 1000; entity.updateComponent("isReactor", { currentOutput: Math.min(desiredOutput, currentOutput + powerUpSpeed * elapsedTime), }); }}