import { Entity } from "../utils/ecs" ; import type ShipPlugin from "../classes/Plugins/Ship" ; interface Coordinates { x : number ; y : number ; z : number ; } export function spawnShip ( template , params ) { const entity = new Entity ( ) ; entity . addComponent ( "identity" , { name : params . name || template . name , description : template . description , } ) ; entity . addComponent ( "tags" , { tags : ( template . tags ?? [ ] ) . concat ( params . tags ?? [ ] ) , } ) ; entity . addComponent ( "isShip" , { category : template . category , registry : params . registry || "" , shipClass : template . name , assets : { ... ( template . toJSON ?. ( ) . assets || template . assets ) , ... params . assets , } , } ) ; entity . addComponent ( "position" , params . position ) ; entity . addComponent ( "rotation" ) ; entity . addComponent ( "velocity" ) ; entity . addComponent ( "rotationVelocity" ) ; entity . addComponent ( "size" ) ; return entity ; }