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 ).
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!
Monitor attacks more detailed than shipTakingDamage/shipBeingAttacked
Moderators: winston, another_commander
- Norby
- ---- E L I T E ----
- Posts: 2577
- Joined: Mon May 20, 2013 9:53 pm
- Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
- Contact:
Re: Monitor attacks more detailed than shipTakingDamage/shipBeingAttacked
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:
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.
Code: Select all
this.$AftShieldFacing = function(ship) {
if(ship.vectorForward.angleTo(ship.position.subtract(player.ship.position)) <= Math.PI/2)
return(true);
return(false);
}
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
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.
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.