}
};
-struct ServerSoundParams
+// Combines the pure sound (SimpleSoundSpec) with positional information
+struct ServerPlayingSound
{
- enum Type {
- SSP_LOCAL,
- SSP_POSITIONAL,
- SSP_OBJECT
- } type = SSP_LOCAL;
- float gain = 1.0f;
- float fade = 0.0f;
- float pitch = 1.0f;
- bool loop = false;
+ SoundLocation type = SoundLocation::Local;
+
+ float gain = 1.0f; // for amplification of the base sound
float max_hear_distance = 32 * BS;
v3f pos;
u16 object = 0;
- std::string to_player = "";
- std::string exclude_player = "";
+ std::string to_player;
+ std::string exclude_player;
v3f getPos(ServerEnvironment *env, bool *pos_exists) const;
-};
-struct ServerPlayingSound
-{
- ServerSoundParams params;
SimpleSoundSpec spec;
+
std::unordered_set<session_t> clients; // peer ids
};
void start();
void stop();
// This is mainly a way to pass the time to the server.
- // Actual processing is done in an another thread.
+ // Actual processing is done in another thread.
void step(float dtime);
// This is run by ServerThread and does the actual processing
void AsyncRunStep(bool initial_step=false);
// Returns -1 if failed, sound handle on success
// Envlock
- s32 playSound(const SimpleSoundSpec &spec, const ServerSoundParams ¶ms,
- bool ephemeral=false);
+ s32 playSound(ServerPlayingSound ¶ms, bool ephemeral=false);
void stopSound(s32 handle);
void fadeSound(s32 handle, float step, float gain);
virtual u16 allocateUnknownNodeId(const std::string &name);
IRollbackManager *getRollbackManager() { return m_rollback; }
virtual EmergeManager *getEmergeManager() { return m_emerge; }
- virtual ModMetadataDatabase *getModStorageDatabase() { return m_mod_storage_database; }
+ virtual ModStorageDatabase *getModStorageDatabase() { return m_mod_storage_database; }
IWritableItemDefManager* getWritableItemDefManager();
NodeDefManager* getWritableNodeDefManager();
virtual const std::vector<ModSpec> &getMods() const;
virtual const ModSpec* getModSpec(const std::string &modname) const;
+ virtual const SubgameSpec* getGameSpec() const { return &m_gamespec; }
static std::string getBuiltinLuaPath();
virtual std::string getWorldPath() const { return m_path_world; }
void sendDetachedInventories(session_t peer_id, bool incremental);
- virtual bool registerModStorage(ModMetadata *storage);
- virtual void unregisterModStorage(const std::string &name);
-
bool joinModChannel(const std::string &channel);
bool leaveModChannel(const std::string &channel);
bool sendModChannelMessage(const std::string &channel, const std::string &message);
// Get or load translations for a language
Translations *getTranslationLanguage(const std::string &lang_code);
- static ModMetadataDatabase *openModStorageDatabase(const std::string &world_path);
+ static ModStorageDatabase *openModStorageDatabase(const std::string &world_path);
- static ModMetadataDatabase *openModStorageDatabase(const std::string &backend,
+ static ModStorageDatabase *openModStorageDatabase(const std::string &backend,
const std::string &world_path, const Settings &world_mt);
static bool migrateModStorageDatabase(const GameParams &game_params,
void SendNodeDef(session_t peer_id, const NodeDefManager *nodedef,
u16 protocol_version);
- /* mark blocks not sent for all clients */
- void SetBlocksNotSent(std::map<v3s16, MapBlock *>& block);
-
virtual void SendChatMessage(session_t peer_id, const ChatMessage &message);
void SendTimeOfDay(session_t peer_id, u16 time, f32 time_speed);
void sendAddNode(v3s16 p, MapNode n,
std::unordered_set<u16> *far_players = nullptr,
float far_d_nodes = 100, bool remove_metadata = true);
+ void sendNodeChangePkt(NetworkPacket &pkt, v3s16 block_pos,
+ v3f p, float far_d_nodes, std::unordered_set<u16> *far_players);
void sendMetadataChanged(const std::unordered_set<v3s16> &positions,
float far_d_nodes = 100);
s32 m_next_sound_id = 0; // positive values only
s32 nextSoundId();
- std::unordered_map<std::string, ModMetadata *> m_mod_storages;
- ModMetadataDatabase *m_mod_storage_database = nullptr;
+ ModStorageDatabase *m_mod_storage_database = nullptr;
float m_mod_storage_save_timer = 10.0f;
// CSM restrictions byteflag