Jump to content

[IWBUMS 41.53] Player Helmets fall when they shouldn't, and stay on when they should fall


PseudonymousEd

Recommended Posts

IsoGameCharacter class

public boolean helmetFall(boolean bl, String string)

 

                if (((Clothing)inventoryItem3).getChanceToFall() <= 0 || Rand.Next((int)100) < n) continue;

 

should probably be 

                if (((Clothing)inventoryItem3).getChanceToFall() <= 0 || Rand.Next((int)100) >= n) continue;

 

in this decompiled snippet.  You are getting the chance to fall, and then continuing if you roll under that chance, and having the item fall if you roll above or equal to it.  Should be the other way around.  The similar way that zombie helmet falls are calculated in the code above this code is correct.


                int n = ((Clothing)inventoryItem3).getChanceToFall();
                if (bl) {
                    n += 40;
                }
                if (inventoryItem3.getType().equals(string)) {
                    n = 100;
                }
                if (((Clothing)inventoryItem3).getChanceToFall() <= 0 || Rand.Next((int)100) < n) continue;
                IsoFallingClothing isoFallingClothing = new IsoFallingClothing(this.getCell(), this.getX(), this.getY(), PZMath.min((float)(this.getZ() + 0.4f), (float)((float)((int)this.getZ()) + 0.95f)), Rand.Next((float)-0.2f, (float)0.2f), Rand.Next((float)-0.2f, (float)0.2f), inventoryItem3);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...