Jump to content

batbat, add check if components.sanity~=nil


Serpens
  • Fixed

Within the batbat.lua within onattack you do:

    if owner.components.health ~= nil and owner.components.health:GetPercent() < 1 and not (target:HasTag("wall") or target:HasTag("engineering")) then
        owner.components.health:DoDelta(TUNING.BATBAT_DRAIN, false, "batbat")
        owner.components.sanity:DoDelta(-.5 * TUNING.BATBAT_DRAIN)
    end

So you are checking if health~=nil , but you forgot to check if sanity~=nil.
Mods which allow mobs or other things without sanity to carry a batbat, the game will crash on attack.

Please let me know if this is a kind of bugreport you would like to receive, or if you want the modders itself to implement some kind of security checks/workarounds, although this would mean alot of unnecessary code and overwrites.

Similar problems apply to some other files, eg. chest_random_good.lua where you should add security checks for all the mentioned components (although this is not that important, since it is not used in default DST as far as I know)


Steps to Reproduce
see above



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.

This has been fixed in the Return of Them beta. This will also be fixed in the non-beta the next time we update it.

Changed Status to Fixed

  • Thanks 1

Share this comment


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