1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Improve core.sound_play with ephemeral sounds and player exclusion

This commit is contained in:
sfan5 2020-01-25 21:19:29 +01:00
parent ea5e231959
commit ace3c76112
9 changed files with 78 additions and 29 deletions

View file

@ -98,6 +98,7 @@ struct ServerSoundParams
v3f pos;
u16 object = 0;
std::string to_player = "";
std::string exclude_player = "";
v3f getPos(ServerEnvironment *env, bool *pos_exists) const;
};
@ -209,7 +210,8 @@ public:
// Returns -1 if failed, sound handle on success
// Envlock
s32 playSound(const SimpleSoundSpec &spec, const ServerSoundParams &params);
s32 playSound(const SimpleSoundSpec &spec, const ServerSoundParams &params,
bool ephemeral=false);
void stopSound(s32 handle);
void fadeSound(s32 handle, float step, float gain);
@ -646,7 +648,8 @@ private:
Sounds
*/
std::unordered_map<s32, ServerPlayingSound> m_playing_sounds;
s32 m_next_sound_id = 0;
s32 m_next_sound_id = 0; // positive values only
s32 nextSoundId();
/*
Detached inventories (behind m_env_mutex)