Is it possible to add the power function without removing the container aspect of the spaceship?
I took a quick look through your code, and it appears that you are completely nuking the original spaceship entity and creating a new custom one elsewhere; is there a way to instead modify the existing entity?
EDIT: Poked around for a bit, and it does indeed look like this is not possible, at least without creating a custom entity type.