Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Nash on May 21, 2011, 08:02:26 pm
-
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
-
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" )
-
Weird, and good to know. We should document that on the wiki (i should do it right now but i :effort:)
-
I can see exactly why that's the case just looking at the code.
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.
-
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.
-
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.
-
That's kind of what I said, but backwards, and unnecessarily restrictive.
-
Reported as Mantis #2442 and fixed.
-
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
-
NO U