Lightning rod LightningRodRadius* Properties are not respected in block check

Merii shared this bug 3 years ago
Reported

So as one does, to gain understanding of how the game works I'm investigating the lightning code for the game. I found a bug in it.

In Sandbox.Game.SessionComponents.MySectorWeatherComponent in Sandbox.Game.dll, the lightning rod radius is hardcoded to 50 in the block check portion (after the entity checks have failed), for decoys, but not antennas. I've attached a screenshot of the disassembly and circled the incorrect check.


/d3c3c535e5b6472e7822a18dc9191989

Replies (4)

photo
1

Hello, Merii,

thanks for sharing this issue with us. It was reported into our internal system. I will let you know about any progress on this.

Kind Regards

Keen Software House: QA Department

photo
1

Hello, Merii,

can you please tell me if you are still experiencing this problem on your end?

Can this somehow be observed in the actual game as well?

Can you please try to describe, what exactly is wrong? With what blocks? How is it affecting the game?

Our programmers tried to take a look on this, but did not find any problem there. So if you can provide more information, that are more detailed, that would be great!

Thank you in advance.

Kind Regards

Keen Software House: QA Department

photo
1

Sure! It's not super easy to reproduce because it's lightning and no vanilla blocks set this property related but:


"Lightning rod" blocks are any blocks that have a LightningRodRadiusLarge/LightningRodRadiusSmall property. This would be the "Decoy" and "Antenna" blocks (all decoys, all antennas - it's a property on the definition for that block type.)

This radius property is used to try to detect if lightning should hit a decoy block instead of whatever other target was selected, based on what I can see from the code above.


For antennas, this is properly used. For decoys, the property exists on the block def, which would let you create a modded block with a very large lightning rod radius, but this radius will not work, because of the problem I reported. Decoys do not get their radius checked.


What needs to happen is a tiny bit of code needs to be changed from what I can see.

  • In the screenshot, "GetRodRadius()" is called for "myRadioAntenna" as part of the final "if" statement.
  • Instead of the literal "50.0" for decoys (the circled part), it should read something like "(double)myDecoy.GetSafetyRodRadius()". The method already exists, it is just not used here - it is however used in AreDecoysWithinRadius, which does this check correctly.

photo
1

Hello, Merii,

thank you for providing the additional information.

I have passed it to the responsible people and hopefully this will be enough.

I will reach here if still something is needed.

Thank you for you time and understanding.

Kind Regards

Keen Software House: QA Department

Leave a Comment
 
Attach a file