I have an entity that is derived from constant combinator. It shows up as having a "close gui sound" in the prototype gui:
in my code, I am overwriting "entity.opened" with my own GUI.
When opening the GUI, the game plays the "open gui sound". However, when closing it (calling player.opened.destroy()), the gui closes but no sound is played.
closing the modified gui of a combinator plays no sound
Re: closing the modified gui of a combinator plays no sound
Is it possible you're not noticing because the gui is closed during your explicit overwrite? I would expect writing player.opened = something else would play the close sound then, as that would be when the entity gui is closed. And that destroying a LuaGuiElement or a LuaEntity would not play a sound (the former because destroying a gui plays no sound, and that a destroying an entity wouldn't be "closing" the entity).
From how you wrote it, was it:
1) opened entity (opened sound played)
2) player.opened is written with created LuaGuiElement (I might expect a close sound to play here, overlapping entity open)
3) Player triggers close (no sound)
4) LuaGuiElement is .destroyed()? (no sound)
From how you wrote it, was it:
1) opened entity (opened sound played)
2) player.opened is written with created LuaGuiElement (I might expect a close sound to play here, overlapping entity open)
3) Player triggers close (no sound)
4) LuaGuiElement is .destroyed()? (no sound)
I have mods! I guess!
Link
Link
Re: closing the modified gui of a combinator plays no sound
Hi,
Thanks for the quick response.
Basically, when the gui opens (fires on_gui_opened), I overwrite player.opened with my own GUI (in this case to replace a constant combinator gui with my own). It does play the "open sound", it does not play the "close sound here" (or maybe it does and it is not audible). The sound is not different from opening the "vanilla" GUI.
The player now interacts with the custom GUI and at some point, they press the "close" icon to close the GUI:
- assign 'nil' to player.opened
- call destroy on the custom GUI root element.
The GUI closes silently (no close sound).
Of course I can play the sound myself there but it seems wrong.
Thanks for the quick response.
Basically, when the gui opens (fires on_gui_opened), I overwrite player.opened with my own GUI (in this case to replace a constant combinator gui with my own). It does play the "open sound", it does not play the "close sound here" (or maybe it does and it is not audible). The sound is not different from opening the "vanilla" GUI.
The player now interacts with the custom GUI and at some point, they press the "close" icon to close the GUI:
- assign 'nil' to player.opened
- call destroy on the custom GUI root element.
The GUI closes silently (no close sound).
Of course I can play the sound myself there but it seems wrong.