How does the bomb script work?

Here is the code

void Add2DExplosionForce(Rigidbody2D body, float explosionForce, float explosionRadius, Vector3 explosionPos)
    {
        var dir = body.transform.position - explosionPos;
        float wearoff = 1 - (dir.magnitude / explosionRadius);
        Vector3 baseForce = dir.normalized * explosionForce * wearoff;
        baseForce.z = 0;
        body.AddForce(baseForce, ForceMode2D.Impulse);
    }

Basically, i was trying adding an expplosion force to a 2D bomb. So i searched around and found these lines of code on the Internet. Despite having the bomb works perfectly, i can’t wrap my head around it. Can someone explain to me what this does? It 's hard to remember the concept when you don’t understand it. Thank you for reading this.

The first line of code is to check in what direction the force should be applied on the body(simply subtract positions and you get the direction vector).

The second line of code is a measure of the power of the force , so what is intended here is that the more distance there is between the bomb and the body, the less force is applied on the body. (If the value of direction magnitude is equal to the radius, the bomb here will not make any force on the body since wearoff will have the value zero)

the third line of code is just a simple calculation of the vector to be applied as a force. the direction vector is normalized(which means the x,y and z values are scaled to values between 0 and 1) and then multiplied by the explosion force, then by the wearoff to make sure the force depends on the distance between the 2 objects.

forth line of code is to make sure the force does,t apply on the z-axis

last line of code is simply applying the force on the body.

Hope that helps