Something went wrong. Try again.
Starship Simulator Controls thoriumsim.com
Something went wrong. Try again.
1.3 kB · 46 lines
TypeScript
at develop
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647import { type ECS, Entity } from "@thorium/utils/ecs";
export const defaultIcon = "/plugins/Thorium Default/assets/Sensor Contacts/Icons/dot.svg";export const defaultPicture = "/plugins/Thorium Default/assets/Sensor Contacts/Pictures/Astra Battleship.avif";
export function getArmyContacts(ecs: ECS, shipId: number) { const contacts: Entity[] = []; for (const contact of ecs.componentCache.get("isArmyContact") || []) { if (contact.components.isSensorContact?.shipId === shipId) { contacts.push(contact); } }
return contacts;}export function createContact(shipId: number, sensorsId: number, lastContact?: Entity) { const contact = new Entity();
contact.addComponent("isSensorContact", { shipId, sensorsId, type: "contact", icon: defaultIcon, picture: defaultPicture, autoFire: false, cloaked: false, disabled: false, hitpoints: 5, hostile: false, infrared: false, miss: false, particle: "AntiMatter", ...lastContact?.components.isSensorContact, }); contact.addComponent("identity", { name: lastContact?.components.identity?.name || "Contact", }); contact.addComponent("rotation", lastContact?.components.rotation); contact.addComponent("size", { length: lastContact?.components.size?.length || 1, }); contact.addComponent("color", lastContact?.components.color);
return contact;}