1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Add formspec theming using prepended strings

This commit is contained in:
Andrew Ward 2018-03-28 16:04:41 +01:00 committed by GitHub
parent 040b878cd5
commit 2323842dd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 150 additions and 18 deletions

View file

@ -121,6 +121,7 @@ const ToClientCommandHandler toClientCommandTable[TOCLIENT_NUM_MSG_TYPES] =
null_command_handler,
null_command_handler,
{ "TOCLIENT_SRP_BYTES_S_B", TOCLIENT_STATE_NOT_CONNECTED, &Client::handleCommand_SrpBytesSandB }, // 0x60
{ "TOCLIENT_FORMSPEC_PREPEND", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_FormspecPrepend }, // 0x61,
};
const static ServerCommandFactory null_command_factory = { "TOSERVER_NULL", 0, false };

View file

@ -1324,6 +1324,15 @@ void Client::handleCommand_SrpBytesSandB(NetworkPacket* pkt)
Send(&resp_pkt);
}
void Client::handleCommand_FormspecPrepend(NetworkPacket *pkt)
{
LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
// Store formspec in LocalPlayer
*pkt >> player->formspec_prepend;
}
void Client::handleCommand_CSMFlavourLimits(NetworkPacket *pkt)
{
*pkt >> m_csm_flavour_limits >> m_csm_noderange_limit;

View file

@ -187,6 +187,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
'zoom_fov'.
Nodebox version 5
Add disconnected nodeboxes
Add TOCLIENT_FORMSPEC_PREPEND
*/
#define LATEST_PROTOCOL_VERSION 36
@ -644,7 +645,13 @@ enum ToClientCommand
std::string bytes_B
*/
TOCLIENT_NUM_MSG_TYPES = 0x61,
TOCLIENT_FORMSPEC_PREPEND = 0x61,
/*
u16 len
u8[len] formspec
*/
TOCLIENT_NUM_MSG_TYPES = 0x62,
};
enum ToServerCommand
@ -930,4 +937,3 @@ enum CSMFlavourLimit : u64 {
CSM_FL_LOOKUP_NODES = 0x00000010, // Limit node lookups
CSM_FL_ALL = 0xFFFFFFFF,
};

View file

@ -210,4 +210,5 @@ const ClientCommandFactory clientCommandFactoryTable[TOCLIENT_NUM_MSG_TYPES] =
null_command_factory,
null_command_factory,
{ "TOSERVER_SRP_BYTES_S_B", 0, true }, // 0x60
{ "TOCLIENT_FORMSPEC_PREPEND", 0, true }, // 0x61
};