Author Topic: calcExplosionCoverage always returning 1, giving me an error.  (Read 500 times)

%pos and %obj are both valid.
My code snip.
Code: ("server.cs") [Select]
InitContainerRadiusSearch(%pos, 4, $TypeMasks::FxBrickAlwaysObjectType | $TypeMasks::FxBrickObjectType);
while ((%targetObject = containerSearchNext()) != 0)
{
echo("-------------------------");
echo(%targetObject);
if(%targetObject.getName() $= "_test")
echo("Test brick");
%coverage = calcExplosionCoverage(%pos, %targetobject, $TypeMasks::FxBrickAlwaysObjectType | $TypeMasks::FxBrickObjectType);
echo(%coverage);
      if (%coverage == 0 || !miniGameCanDamage(%obj,%targetobject))
        continue;
}
Here's a console log.
Code: ("console.log") [Select]
-------------------------
9074
calcExplosionCoverage: object is on the client, or not in the container system
1
-------------------------
9070
calcExplosionCoverage: object is on the client, or not in the container system
1
-------------------------
9071
calcExplosionCoverage: object is on the client, or not in the container system
1
-------------------------
9072
calcExplosionCoverage: object is on the client, or not in the container system
1
-------------------------
9073
calcExplosionCoverage: object is on the client, or not in the container system
1
-------------------------
9064
calcExplosionCoverage: object is on the client, or not in the container system
1
-------------------------
9261
Test brick
calcExplosionCoverage: object is on the client, or not in the container system
1
-------------------------
9065
calcExplosionCoverage: object is on the client, or not in the container system
1
-------------------------
9063
calcExplosionCoverage: object is on the client, or not in the container system
1

The random number in the 9000 range is the brick's ID.
1 is the coverage, which, is always 1 if calcExplosionCoverage gets an error.
"Test brick" is a brick behind other bricks, so coverage is supposed to be 0.


Why am I getting this error?

I don't need help with this anymore, as I've removed the coverage check from the code.

However, someone should still figure out what went wrong in case others run into this problem.

add a couple checks to make sure the object ID is indeed a brick:
echo(%targetObject SPC %targetObject.getClassName() SPC %targetObject.getName() );

that may help in debugging somewhat

They are bricks. Why do you think one of them shows up the text "Test Brick"?

Are the args around the right way?

I'm pretty sure they are.
calcExplosionCoverage(Point3F source, SceneObject originator, bitset coverageMask);