Page 1 of 1

Monitor attacks more detailed than shipTakingDamage/shipBeingAttacked

Posted: Thu Feb 09, 2017 3:22 pm
by QCS
Hi,

I am tinkering around with an equipment/mechanics idea (not decided yet). For that I ideally would need to know not only who attacked me (which ship), but also with which weapon, and on which shield (if there was a shield, that is :-D).

For this, the event handlers I found in the reference (shipTakingDamage and shipBeingAttacked) is not detailed enough. Is there a way to do that which I didn't see, or is my "idea" bound to fail?

Thanks in advance!

Re: Monitor attacks more detailed than shipTakingDamage/shipBeingAttacked

Posted: Thu Feb 09, 2017 6:27 pm
by Norby
These are up to you to solve in js. For example the following code in Combat MFD determine which shield of the target facing to player ship:

Code: Select all

this.$AftShieldFacing = function(ship) {
        if(ship.vectorForward.angleTo(ship.position.subtract(player.ship.position)) <= Math.PI/2)
                return(true);
        return(false);
}
If you improve this to handle 4 sides then you can assume the laser hit arrived from that side, so you can look into ship.forwardWeapon or ship.aftWeapon or port or starboard.

The inverse of the above logic is usable to determine that which shield of the player ship facing to the attacker.

Re: Monitor attacks more detailed than shipTakingDamage/shipBeingAttacked

Posted: Thu Feb 09, 2017 6:58 pm
by QCS
Thanks Norby,

that answer gives me the general idea how to do it, and opens my mind for a class of solutions I did not think about before.