Difficult game logi with Entity systems?

I have used Entity systems a bit now and quite like them. I have found them fast and useful and fairly easy to integrate with GUIs and multiplier.

However i have only done fairly simple game logic type games. For example platforms or something similar. I keep one simple rule, a system or behavior can only change the entity it is operating on. To change parameters of other entities i use a message which gets actioned next tick. This really has made for very easy to write up games and over all been a big improvement over POJOs.

But now I am working on something more complicated. I will use a concrete example from an existing game since that is often an easier way to understand things.

Say i have a space ship, and i want to activate my gun. Note the gun is a “module” and can be replaced by different guns so it is an entity. The gun uses power, and if the ship (another entity) does not have the power it won’t activate. If it activates it could apply damage to the target. But if the target is say not shootable, then the gun should also fail to activate. Thus i have 3 entities and all their states matter on what can be done.

I can’t see a nice way to implement this with my current implementation with messages between entities easily. Any ideas? Has anyone implemented quite complicated game logic into an entity system?