The shipAttackedOther handler is called when this ship hits another with a laser shot. other is the identity of the ship being hit (added in test version 1.74.2).
this.shipAttackedOther = function(other)
{
// Your code here
}
No mention of missiles, just lasers. On the basis of that information I created the Type XS Ultra-Power Laser:
/* Ultra-Power Laser guarantees destruction of any target with one hit. */
this.shipAttackedOther = function(victim)
{
if (player.ship.equipmentStatus("EQ_DEATH_RAY") === "EQUIPMENT_OK")
{
victim.explode();
}
}
But now when I fire missiles at ships they (the target ships) just explode immediately. I suppose this is intended, but if so the wiki needs updating. But... when I fired a missile at a Coriolis, it didn't explode. But when the missile reached it, it did.
shipAttackedOther is called immediately after shipBeingAttacked is called on the target and the ATTACKED AI message is sent. This currently happens in the following cases:
When a ship takes energy damage.
When a ship is attacked by a member of its own group, and a decision is made to throw out the perpetrator, both events are sent as though the group’s leader attacked the defector. This is inherited from the behaviour of the ATTACKED AI message.
When the AI responds to an incoming missile by calling fightOrFleeMissile.
This last one is a bit odd, but it’s sort of entrenched; it was added in January 2008. It explains the Coriolis situation: it doesn’t react to missiles, but does take energy damage from them.
Edit: Supplementary note: energy damage occurs in the following cases:
From laser or plasma fire.
From the explode() and remove() script methods, and the legacy blowUpStation command.
From dealEnergyDamageWithinDesiredRange AI command and dealEnergyDamage() JS method – this includes missiles.
From quirium explosions (Q-mines or secondary explosions).
From energy bombs.
Essentially, energy damage is any damage other than scrape and heat damage.