mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Implement mod communication channels (#6351)
Implement network communication for channels * Implement ModChannel manager server side to route incoming messages from clients to other clients * Add signal handler switch on client & ModChannelMgr on client to handle channels * Add Lua API bindings + client packet sending + unittests * Implement server message sending * Add callback from received message handler to Lua API using registration method
This commit is contained in:
parent
6df312a608
commit
6f1c907204
37 changed files with 1206 additions and 39 deletions
18
src/server.h
18
src/server.h
|
@ -50,6 +50,7 @@ class IWritableCraftDefManager;
|
|||
class BanManager;
|
||||
class EventManager;
|
||||
class Inventory;
|
||||
class ModChannelMgr;
|
||||
class RemotePlayer;
|
||||
class PlayerSAO;
|
||||
class IRollbackManager;
|
||||
|
@ -144,6 +145,9 @@ public:
|
|||
void handleCommand_Deprecated(NetworkPacket* pkt);
|
||||
void handleCommand_Init(NetworkPacket* pkt);
|
||||
void handleCommand_Init2(NetworkPacket* pkt);
|
||||
void handleCommand_ModChannelJoin(NetworkPacket *pkt);
|
||||
void handleCommand_ModChannelLeave(NetworkPacket *pkt);
|
||||
void handleCommand_ModChannelMsg(NetworkPacket *pkt);
|
||||
void handleCommand_RequestMedia(NetworkPacket* pkt);
|
||||
void handleCommand_ClientReady(NetworkPacket* pkt);
|
||||
void handleCommand_GotBlocks(NetworkPacket* pkt);
|
||||
|
@ -165,7 +169,8 @@ public:
|
|||
|
||||
void ProcessData(NetworkPacket *pkt);
|
||||
|
||||
void Send(NetworkPacket* pkt);
|
||||
void Send(NetworkPacket *pkt);
|
||||
void Send(u16 peer_id, NetworkPacket *pkt);
|
||||
|
||||
// Helper for handleCommand_PlayerPos and handleCommand_Interact
|
||||
void process_PlayerPos(RemotePlayer *player, PlayerSAO *playersao,
|
||||
|
@ -319,6 +324,7 @@ public:
|
|||
void DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason="");
|
||||
void acceptAuth(u16 peer_id, bool forSudoMode);
|
||||
void DenyAccess_Legacy(u16 peer_id, const std::wstring &reason);
|
||||
void DisconnectPeer(u16 peer_id);
|
||||
bool getClientConInfo(u16 peer_id, con::rtt_stat_type type, float* retval);
|
||||
bool getClientInfo(u16 peer_id,ClientState* state, u32* uptime,
|
||||
u8* ser_vers, u16* prot_vers, u8* major, u8* minor, u8* patch,
|
||||
|
@ -334,6 +340,11 @@ public:
|
|||
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);
|
||||
ModChannel *getModChannel(const std::string &channel);
|
||||
|
||||
// Bind address
|
||||
Address m_bind_addr;
|
||||
|
||||
|
@ -383,6 +394,8 @@ private:
|
|||
float thickness,
|
||||
const v2f &speed);
|
||||
void SendOverrideDayNightRatio(u16 peer_id, bool do_override, float ratio);
|
||||
void broadcastModChannelMessage(const std::string &channel,
|
||||
const std::string &message, u16 from_peer);
|
||||
|
||||
/*
|
||||
Send a node removal/addition event to all clients except ignore_id.
|
||||
|
@ -640,6 +653,9 @@ private:
|
|||
// CSM flavour limits byteflag
|
||||
u64 m_csm_flavour_limits = CSMFlavourLimit::CSM_FL_NONE;
|
||||
u32 m_csm_noderange_limit = 8;
|
||||
|
||||
// ModChannel manager
|
||||
std::unique_ptr<ModChannelMgr> m_modchannel_mgr;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue