Author Topic: no pierce shields  (Read 2344 times)

0 Members and 1 Guest are viewing this topic.

Offline Nash

  • 24
The "no pierce shields" flag when added to beam weapons in weapons table file is not working properly. Beam hits shield causing shield to glow but always continues through shield and hits hull anyway doing no damage to shield along the way.

Has anybody else had this problem?
Solution to make flag work properly?

Tried flag fsopen 3.6.10 and 3.6.12

Thanks in advance! Nash

 

Offline Nash

  • 24
Found Problem with "no pierce shields" !!!

The "no pierce shields" flag must be placed last after "beam" as shown below. Works properly now. (Example given below.)


$Flags: ("in tech database" "player allowed" "beam" "no pierce shields" )

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Weird, and good to know. We should document that on the wiki (i should do it right now but i :effort:)

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
I can see exactly why that's the case just looking at the code.

Code: [Select]
else if (!stricmp(NOX("beam"), weapon_strings[i]))
{
weaponp->wi_flags |= WIF_BEAM;

// IMPORTANT: beams pierce shields by default :rolleyes: :p - Goober5000
weaponp->wi_flags2 |= WIF2_PIERCE_SHIELDS;
}

......


else if (!stricmp(NOX("pierce shields"), weapon_strings[i]))
weaponp->wi_flags2 |= WIF2_PIERCE_SHIELDS;
else if (!stricmp(NOX("no pierce shields"), weapon_strings[i])) // only for beams
weaponp->wi_flags2 &= ~WIF2_PIERCE_SHIELDS;

In simple terms, the beam flag resets the pierce shields flag ignoring whatever was set before. Theoretically you could just swap the internal logic around and make the WIF2_PIERCE_SHIELDS flag into WIF2_DON'T_PIERCE_SHIELDS and then remove the line after Goober's comment but the code is probably peppered with assumptions that beams do pierce by default and you'd probably screw up a bunch of stuff.

Which may mean that simply putting a note in the wiki is the simplest solution.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Actually I'm pretty sure I put that there when the shield piercing logic was changed to check for the WIF2_PIERCE_SHIELDS constant rather than the WIF_BEAM constant.  Whoever made that change in the code forgot to initially set that internal flag when the weapon was actually parsed.

So the solution would be to either always make sure the "no pierce shields" string appears last in the tbl, or to add some sort of code logic that applies pierce/no-pierce after all flags have been parsed.

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
A better solution might be to check during parse if the beam flag is set or not.  If not store to a temp variable.  When you hit the beam one and the temp variable is already set turn it on and set the temp variable to false.  Get to the end of parsing and the temp variable is still true toss a "hey idiot your trying to set a beam flag on a non beam weapon" warning in debug builds.
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
That's kind of what I said, but backwards, and unnecessarily restrictive.

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Reported as Mantis #2442 and fixed.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Tomorrow on Mantis: beams deal no damage, shield meshes are inverted and block only shots from the inside, all briefing icons are rendered as GTNB Pharos

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
NO U