Armor Segment

Freeform discussion about anything related to modding Transcendence.
Post Reply
Alex_
Anarchist
Anarchist
Posts: 14
Joined: Wed Dec 23, 2009 7:26 pm

Is there any way of getting the armor segment that is being damaged from events on the ship (player or otherwise)
I'd prefer if I didn't have to use the direction of the shot to work it out, as this would be messy, and especially annoying because I intended to use this on ships with many armor segments.

EDIT: unfinished post

had a look through the changelog for something I thought I saw earlier... I am hoping there is something like aArmorSeg that works for <OnDamage>

Thanks anyway.
User avatar
Ttech
Fleet Admiral
Fleet Admiral
Posts: 2767
Joined: Tue Nov 06, 2007 12:03 am
Location: Traveling in the TARDIS
Contact:

So yo ufigured it out ?
Image
Image
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5510
Joined: Tue Feb 05, 2008 1:10 am
Location: At the VSS Shipyards in the frontier, designing new ships.

Do you want this from the weapon side or the armor side?
(shpOrder gPlayership 'barrelRoll)

<New tutorials, modding resources, and official extension stuff coming to this space soon!>
Alex_
Anarchist
Anarchist
Posts: 14
Joined: Wed Dec 23, 2009 7:26 pm

The armor side. For the weapon side there is apparently aArmorSeg.
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5510
Joined: Tue Feb 05, 2008 1:10 am
Location: At the VSS Shipyards in the frontier, designing new ships.

Then it should be there for the armor; unless it got renamed to gSource or something like that. If neither of those are the case, it's a bug.
(shpOrder gPlayership 'barrelRoll)

<New tutorials, modding resources, and official extension stuff coming to this space soon!>
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

gSource is always a space object. It could possibly be renamed to gItem I suppose.
Alex_
Anarchist
Anarchist
Posts: 14
Joined: Wed Dec 23, 2009 7:26 pm

I've tried gItem and lots of other variants along the lines of aArmorSeg, within an <OnDamage> event. Can anyone think of a workaround which will let me get the segment of the ship that has been hit?

Would calculating it with angles cause problems in combat when the ship is hit very often? I don't want things to freeze up when you get hit with an ares lightning turret.
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5510
Joined: Tue Feb 05, 2008 1:10 am
Location: At the VSS Shipyards in the frontier, designing new ships.

Well, if the variable is missing, than its a bug.
(shpOrder gPlayership 'barrelRoll)

<New tutorials, modding resources, and official extension stuff coming to this space soon!>
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

I agree that the armor segment should be added to <OnDamage>.

Until then, here's how you can work around it:

Code: Select all

(setq CalcArmorSegment (lambda ()
   (block (theAngle theArmorAngle)
      ; First we need to compute the angle that the
      ; shot hit the ship (compensating for the 
      ; rotation of the ship)

      (setq theAngle (mod (subtract (add aHitDir 360) (shpGetDirection gSource)) 360))

      ; Next we need to figure out the angle for armor
      ; segment. For now we assume that all armor 
      ; segments are the same size. (We don't have
      ; enough data to make any other assumption.)

      (setq theArmorAngle (divide 360 (shpGetArmorCount gSource)))

      ; Now we just return the armor segment. We 
      ; adjust by half an armor segment because the 
      ; front armor has its center at 0 degrees.

      (divide (add theAngle (divide theArmorAngle 2)) theArmorAngle)
      )
   ))
Note: I haven't tested the above, so it might have bugs.

The calculation is not very expensive, so I wouldn't worry about it taking too long.
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5510
Joined: Tue Feb 05, 2008 1:10 am
Location: At the VSS Shipyards in the frontier, designing new ships.

:) Thanks for the workaround george!
Should I make a ticket simply for the sake of tracking its progress?
(shpOrder gPlayership 'barrelRoll)

<New tutorials, modding resources, and official extension stuff coming to this space soon!>
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Wolfy wrote::) Thanks for the workaround george!
Should I make a ticket simply for the sake of tracking its progress?
Yes, if you don't mind. Tickets are always good.
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5510
Joined: Tue Feb 05, 2008 1:10 am
Location: At the VSS Shipyards in the frontier, designing new ships.

Ok, sure!
(shpOrder gPlayership 'barrelRoll)

<New tutorials, modding resources, and official extension stuff coming to this space soon!>
Alex_
Anarchist
Anarchist
Posts: 14
Joined: Wed Dec 23, 2009 7:26 pm

Thanks George! Seems pretty much perfect for what I need. Even if it does have bugs, I should be able to work it out from there.
thankyou everybody!
Post Reply