Blockland Forums > Modification Help
calcExplosionCoverage always returning 1, giving me an error.
Chrono:
%pos and %obj are both valid.
My code snip.
--- Code: ("server.cs") --- 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;
}
--- End code ---
Here's a console log.
--- Code: ("console.log") ----------------------------
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
--- End code ---
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?
Chrono:
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.
Red_Guy:
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
Chrono:
They are bricks. Why do you think one of them shows up the text "Test Brick"?
Destiny/Zack0Wack0:
Are the args around the right way?