Jump to content

Bunnyman has redundant randomloot


Bumber64
  • Fixed

bunnyman.lua has the following code:

inst:AddComponent("lootdropper")
inst.components.lootdropper:SetLootSetupFn(LootSetupFunction)
LootSetupFunction(inst.components.lootdropper)

Calling "LootSetupFunction" here adds carrot (weight 3), meat (weight 3), and bunny puff (weight 2, total = 8) to the lootdropper's randomloot table. It is called again when the bunnyman dies via "LootDropper:GenerateLoot". If the bunnyman's killer was sane, it adds another set of randomloot without clearing the first one, resulting in a total weight of 16.

While this ordinarily has no effect since the weights are proportional, any mod that adds loot has their odds of dropping halved if they don't account for it. Also, in one of my mods I convert the randomloot into chanceloot so they can drop multiple loot, and this results in a chance to drop two of each item if I don't filter out the duplicate entries.

The way to fix this is either to clear the randomloot first when it dies (as happens when it dies as beardlord), or just avoid calling "LootSetupFunction" during init and leave the loot empty until it dies.


Steps to Reproduce

Add "print(lootdropper.totalrandomweight)" to the end of "LootSetupFunction" and verify it prints "8" during init and "16" on death.

  • Like 1



User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

There are no comments to display.



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...