**Looong story short:**

(modulo -20 360) does not return 340 in Transcendence, but instead returns -20.

Google search reveals: -20 mod 360.

**Long story:**

So yeah, I was thinking about Visible Damage and realized three things:

1. It is not possible to get the position of an armor segment on the ship in terms of a vector postion

2. the angle system feels odd when 0 is to the right of the ship

3. The angle system and the way that armorsegments are laid out are contradictory.

Ok, think about this problem: how can you create weaponfire at a certain armorsegment on a ship?

Since there is no function for finding the location of a specific armorsegment and that itmGetArmorInstalledLocation returns the segment # and

*NOT*the location on the ship, I was forced to improvise.

Given that, I turned to this equation: (multiply i (divide 360 (shpGetArmorCount gSource))).

It basically multiplied i (which is the armorsegment #) by the value of a single armor segment when there are (shpGetArmorCount gSource) armorsegments and 360 degrees in a circle.

Now, I expected that to work, but then I had to factor in the facing of the ship as well.

This resulted in some more research.

I then incorporated (shpGetDirection gSource) to create (modulo (add (shpGetDirection gSource) (multiply i (divide 360 (shpGetArmorCount gSource)))) 360) so that I would take into account the playership's direction.

This was when it became apparent that 0 is to the right of the playership when at facing 0 (for the sapphire at least), making very awkward to approximate the angle of each armorsegment, after I had already given up on using sysVectorPolarOffset to approximate the distance of a specific armorsegment from the center of the ship. This resulted in a couple of problems:

1. My system and the angle system are not aligned, nor are they oriented similarly (my approximation using the armorsegment is clockwise, the Transcendence system is counterclockwise)

2. I had also realized that it was not possible (or at least, really,

*really*hard) to use the armorsegment number to get the angle, as they are

*also*numbered clockwise and against the counterclockwise nature of the angle system in T.

I then constructed a way to convert from my clockwise system to Transcendence's counterclockwise system, resulting in:

Code: Select all

`(modulo (subtract 360 (multiply i (divide 360 (shpGetArmorCount gSource)))) 360)`

However, I still had to account for the ship direction.

After lots of testing, and furious sleepless nights, I came up with this monstrosity for approximating the angle of a specific armorsegment using its number:

Code: Select all

`(modulo (add (subtract (modulo (subtract (shpGetDirection gSource) 90) 360) (multiply i (divide 360 (shpGetArmorCount gSource)))) 90) 360)`

*then*converts it back to the counterclockwise angle system.

Then after further testing, it seems apparent that for armorsegment values such as 2-3 for when the ship is facing 0-90 in the counterclockwise system, my formula still wasn't right. It was then that I tested using

Code: Select all

```
(block Nil
(dbglog(modulo -20 360))
)
```

and now, instead if returning 340, Transcendence returns -20. :/