Jump to content

Some entities play looping sounds even when unloaded


hoxi
  • Pending

From what I was able to find at least:

  • deerclopseyeball_sentryward (only when an eye is placed on it)
  • lightflier
  • batcave

 

 

deerclopseyeball_sentryward simply lacks OnEntityWake and OnEntitySleep functions to handle its ambience sound (as well as a not asleep check for OnEyeballGiven before playing the sound).

 

In lightflier.lua:

    inst.SoundEmitter:PlaySound("grotto/creatures/light_bug/fly_LP", "loop")

This is playing on entity creation.

The EnableBuzz function has a sleep check (though it might need to account for being called to enable the sound while inst.buzzing is already set to true, if allowed), but on OnEntityWake and OnEntitySleep don't have code to handle playing or stopping the sound.

All in all, the file might need to be revised a bunch to address the issue and make sure the sound plays or not when intended. Keep inst.buzzing behavior as usual, check for this flag in relevant cases, but always check with SoundEmitter:PlayingSound to see if the sound needs to be played or stopped.

 

In batcave.lua:

local function onaddchild( inst, count )
    if inst.components.childspawner.childreninside == inst.components.childspawner.maxchildren then
        inst.AnimState:PlayAnimation("eyes",true)
        inst.SoundEmitter:PlaySound("dontstarve/cave/bat_cave_warning", "full")
    end
end

A not asleep check needs to be added to it, to prevent both the animation and sound from playing.

Since OnEntityWake will do it automatically, as shown below:

local function OnEntityWake(inst)
    if inst.components.childspawner.childreninside == inst.components.childspawner.maxchildren then
        inst.AnimState:PlayAnimation("eyes",true)
        inst.SoundEmitter:PlaySound("dontstarve/cave/bat_cave_warning", "full")
    end
end

 


Steps to Reproduce

For deerclopseyeball_sentryward:

  • Place a deerclops eye on it.
  • Walk away enough for it to go asleep, notice how the sound will continue to play if you check it.
  • Loading a game with one of these far away enough to be asleep, with an eye already placed, will also play the sound.

For lightflier and batcave:

  • You can simply start a world and go down into the caves, or load a world while you were in the caves, and both of these will be playing their sounds, if you check them. When I reproduced this and printed the amount through the console, I think I logged around 30-40 playing their loop sounds? I didn't type it down and I forgot (it may vary due to world gen anyway), but it was a pretty significant amount.



User Feedback


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