diff --git a/client/app/cores/StarmapCore/StarmapCoreContextMenu.tsx b/client/app/cores/StarmapCore/StarmapCoreContextMenu.tsx
index 032336fb..ccfb77ee 100644
--- a/client/app/cores/StarmapCore/StarmapCoreContextMenu.tsx
+++ b/client/app/cores/StarmapCore/StarmapCoreContextMenu.tsx
@@ -99,31 +99,56 @@ export const StarmapCoreContextMenu = ({
{/* TODO March 11, 2024: Add commands for when right clicking on another object, such as following or attacking the target */}
{selectedShips.length > 0 ? (
!object ? (
-
+ >
) : object.type === "planet" ? (
) : object.type === "ship" ? (
- {
- if (selectedShips.length > 0) {
- q.starmapCore.setFollowShip.netSend({
- ships: useStarmapStore.getState()
- .selectedObjectIds as number[],
- objectId: object.id,
- // TODO: March 15, 2024 - This should change based on the current objective of the ship
- objective: "defend",
- });
- setOpen(false);
- }
- }}
- >
- Follow Ship
-
+ <>
+ {
+ if (selectedShips.length > 0) {
+ q.starmapCore.setFollowShip.netSend({
+ ships: useStarmapStore.getState()
+ .selectedObjectIds as number[],
+ objectId: object.id,
+ // TODO: March 15, 2024 - This should change based on the current objective of the ship
+ objective: "defend",
+ });
+ setOpen(false);
+ }
+ }}
+ >
+ Follow Ship
+
+ >
) : null
) : null}
;
@@ -503,6 +504,57 @@ export const starmapCore = t.router({
pubsub.publish.starmapCore.autopilot({ systemId: id });
});
}),
+ fireTorpedo: t.procedure
+ .input(
+ z.object({
+ objectId: z.number(),
+ position: z.object({
+ x: z.number(),
+ y: z.number(),
+ z: z.number(),
+ parentId: z.number(),
+ }),
+ }),
+ )
+ .send(({ ctx, input }) => {
+ const torpedoEntity = new Entity();
+
+ torpedoEntity.addComponent("position", {
+ x: input.position.x,
+ y: input.position.y,
+ z: input.position.z,
+ parentId: input.position.parentId,
+ type: "solar",
+ });
+ const directionVector = new Vector3(0, 0, 1)
+ .normalize()
+ .multiplyScalar(50);
+
+ torpedoEntity.addComponent("velocity", {
+ x: directionVector.x,
+ y: directionVector.y,
+ z: directionVector.z,
+ });
+ torpedoEntity.addComponent("isTorpedo", {
+ launcherId: -1,
+ targetId: input.objectId,
+ yield: 1,
+ damageType: null,
+ color: "white",
+ guidanceMode: "visual",
+ guidanceRange: 5000,
+ speed: 50,
+ maxForce: 10,
+ maxRange: 25000,
+ });
+ torpedoEntity.addComponent("mass", { mass: 1500 });
+
+ ctx.flight?.ecs.addEntity(torpedoEntity);
+
+ pubsub.publish.starmapCore.torpedos({
+ systemId: torpedoEntity.components.position?.parentId || null,
+ });
+ }),
setShipsBehavior: t.procedure
.meta({ action: true })
.input(
diff --git a/server/src/spawners/ship.ts b/server/src/spawners/ship.ts
index e79a69be..581dbb02 100644
--- a/server/src/spawners/ship.ts
+++ b/server/src/spawners/ship.ts
@@ -71,6 +71,7 @@ export async function spawnShip(
...params.assets,
},
});
+ entity.addComponent("hull", { hull: 1 });
if (params.position) {
entity.addComponent("position", params.position);
}
diff --git a/server/src/systems/ShieldsSystem.ts b/server/src/systems/ShieldsSystem.ts
index 56faa479..a6c001c3 100644
--- a/server/src/systems/ShieldsSystem.ts
+++ b/server/src/systems/ShieldsSystem.ts
@@ -11,7 +11,7 @@ export class ShieldsSystem extends System {
if (entity.components.power && entity.components.isShields) {
const { currentPower } = entity.components.power;
const { state, maxStrength, strength } = entity.components.isShields;
- let strengthToRecharge = currentPower * elapsedTimeHours * 100;
+ let strengthToRecharge = currentPower * elapsedTimeHours * 10;
if (state === "down") {
// Quickly drain shields when they are down
strengthToRecharge = (-maxStrength / SHIELD_DISCHARGE_TIME) * elapsed;