mirror of
https://github.com/minetest/minetest.git
synced 2025-07-04 08:50:22 +02:00
Dehardcode the death formspec (#15155)
Co-authored-by: Paul Ouellette <oue.paul18@gmail.com>
This commit is contained in:
@ -81,7 +81,7 @@ const ToClientCommandHandler toClientCommandTable[TOCLIENT_NUM_MSG_TYPES] =
|
||||
{ "TOCLIENT_MOVE_PLAYER", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_MovePlayer }, // 0x34
|
||||
{ "TOCLIENT_ACCESS_DENIED_LEGACY", TOCLIENT_STATE_NOT_CONNECTED, &Client::handleCommand_AccessDenied }, // 0x35
|
||||
{ "TOCLIENT_FOV", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_Fov }, // 0x36
|
||||
{ "TOCLIENT_DEATHSCREEN", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_DeathScreen }, // 0x37
|
||||
{ "TOCLIENT_DEATHSCREEN_LEGACY", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_DeathScreenLegacy }, // 0x37
|
||||
{ "TOCLIENT_MEDIA", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_Media }, // 0x38
|
||||
null_command_handler,
|
||||
{ "TOCLIENT_NODEDEF", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_NodeDef }, // 0x3a
|
||||
@ -198,7 +198,7 @@ const ServerCommandFactory serverCommandFactoryTable[TOSERVER_NUM_MSG_TYPES] =
|
||||
{ "TOSERVER_DAMAGE", 0, true }, // 0x35
|
||||
null_command_factory, // 0x36
|
||||
{ "TOSERVER_PLAYERITEM", 0, true }, // 0x37
|
||||
{ "TOSERVER_RESPAWN", 0, true }, // 0x38
|
||||
{ "TOSERVER_RESPAWN_LEGACY", 0, true }, // 0x38
|
||||
{ "TOSERVER_INTERACT", 0, true }, // 0x39
|
||||
{ "TOSERVER_REMOVED_SOUNDS", 2, true }, // 0x3a
|
||||
{ "TOSERVER_NODEMETA_FIELDS", 0, true }, // 0x3b
|
||||
|
@ -653,20 +653,10 @@ void Client::handleCommand_MovePlayerRel(NetworkPacket *pkt)
|
||||
player->addPosition(added_pos);
|
||||
}
|
||||
|
||||
void Client::handleCommand_DeathScreen(NetworkPacket* pkt)
|
||||
void Client::handleCommand_DeathScreenLegacy(NetworkPacket* pkt)
|
||||
{
|
||||
bool set_camera_point_target;
|
||||
v3f camera_point_target;
|
||||
|
||||
*pkt >> set_camera_point_target;
|
||||
*pkt >> camera_point_target;
|
||||
|
||||
ClientEvent *event = new ClientEvent();
|
||||
event->type = CE_DEATHSCREEN;
|
||||
event->deathscreen.set_camera_point_target = set_camera_point_target;
|
||||
event->deathscreen.camera_point_target_x = camera_point_target.X;
|
||||
event->deathscreen.camera_point_target_y = camera_point_target.Y;
|
||||
event->deathscreen.camera_point_target_z = camera_point_target.Z;
|
||||
event->type = CE_DEATHSCREEN_LEGACY;
|
||||
m_client_event_queue.push(event);
|
||||
}
|
||||
|
||||
|
@ -231,6 +231,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
Move default hotbar from client-side C++ to server-side builtin Lua
|
||||
Add shadow tint to Lighting packets
|
||||
Add shadow color to CloudParam packets
|
||||
Move death screen to server and make it a regular formspec
|
||||
The server no longer triggers the hardcoded client-side death
|
||||
formspec, but the client still supports it for compatibility with
|
||||
old servers.
|
||||
Rename TOCLIENT_DEATHSCREEN to TOCLIENT_DEATHSCREEN_LEGACY
|
||||
Rename TOSERVER_RESPAWN to TOSERVER_RESPAWN_LEGACY
|
||||
[scheduled bump for 5.10.0]
|
||||
*/
|
||||
|
||||
@ -391,10 +397,10 @@ enum ToClientCommand : u16
|
||||
f32 transition_time
|
||||
*/
|
||||
|
||||
TOCLIENT_DEATHSCREEN = 0x37,
|
||||
TOCLIENT_DEATHSCREEN_LEGACY = 0x37,
|
||||
/*
|
||||
u8 bool set camera point target
|
||||
v3f1000 camera point target (to point the death cause or whatever)
|
||||
u8 bool unused
|
||||
v3f1000 unused
|
||||
*/
|
||||
|
||||
TOCLIENT_MEDIA = 0x38,
|
||||
@ -1002,10 +1008,7 @@ enum ToServerCommand : u16
|
||||
[2] u16 item
|
||||
*/
|
||||
|
||||
TOSERVER_RESPAWN = 0x38,
|
||||
/*
|
||||
u16 TOSERVER_RESPAWN
|
||||
*/
|
||||
TOSERVER_RESPAWN_LEGACY = 0x38,
|
||||
|
||||
TOSERVER_INTERACT = 0x39,
|
||||
/*
|
||||
|
@ -82,7 +82,7 @@ const ToServerCommandHandler toServerCommandTable[TOSERVER_NUM_MSG_TYPES] =
|
||||
{ "TOSERVER_DAMAGE", TOSERVER_STATE_INGAME, &Server::handleCommand_Damage }, // 0x35
|
||||
null_command_handler, // 0x36
|
||||
{ "TOSERVER_PLAYERITEM", TOSERVER_STATE_INGAME, &Server::handleCommand_PlayerItem }, // 0x37
|
||||
{ "TOSERVER_RESPAWN", TOSERVER_STATE_INGAME, &Server::handleCommand_Respawn }, // 0x38
|
||||
null_command_handler, // 0x38
|
||||
{ "TOSERVER_INTERACT", TOSERVER_STATE_INGAME, &Server::handleCommand_Interact }, // 0x39
|
||||
{ "TOSERVER_REMOVED_SOUNDS", TOSERVER_STATE_INGAME, &Server::handleCommand_RemovedSounds }, // 0x3a
|
||||
{ "TOSERVER_NODEMETA_FIELDS", TOSERVER_STATE_INGAME, &Server::handleCommand_NodeMetaFields }, // 0x3b
|
||||
@ -181,7 +181,7 @@ const ClientCommandFactory clientCommandFactoryTable[TOCLIENT_NUM_MSG_TYPES] =
|
||||
{ "TOCLIENT_MOVE_PLAYER", 0, true }, // 0x34
|
||||
null_command_factory, // 0x35
|
||||
{ "TOCLIENT_FOV", 0, true }, // 0x36
|
||||
{ "TOCLIENT_DEATHSCREEN", 0, true }, // 0x37
|
||||
null_command_factory, // 0x37
|
||||
{ "TOCLIENT_MEDIA", 2, true }, // 0x38
|
||||
null_command_factory, // 0x39
|
||||
{ "TOCLIENT_NODEDEF", 0, true }, // 0x3A
|
||||
|
@ -858,33 +858,6 @@ void Server::handleCommand_PlayerItem(NetworkPacket* pkt)
|
||||
playersao->getPlayer()->setWieldIndex(item);
|
||||
}
|
||||
|
||||
void Server::handleCommand_Respawn(NetworkPacket* pkt)
|
||||
{
|
||||
session_t peer_id = pkt->getPeerId();
|
||||
RemotePlayer *player = m_env->getPlayer(peer_id);
|
||||
if (player == NULL) {
|
||||
errorstream <<
|
||||
"Server::ProcessData(): Canceling: No player for peer_id=" <<
|
||||
peer_id << " disconnecting peer!" << std::endl;
|
||||
DisconnectPeer(peer_id);
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerSAO *playersao = player->getPlayerSAO();
|
||||
assert(playersao);
|
||||
|
||||
if (!playersao->isDead())
|
||||
return;
|
||||
|
||||
RespawnPlayer(peer_id);
|
||||
|
||||
actionstream << player->getName() << " respawns at "
|
||||
<< (playersao->getBasePosition() / BS) << std::endl;
|
||||
|
||||
// ActiveObject is added to environment in AsyncRunStep after
|
||||
// the previous addition has been successfully removed
|
||||
}
|
||||
|
||||
bool Server::checkInteractDistance(RemotePlayer *player, const f32 d, const std::string &what)
|
||||
{
|
||||
ItemStack selected_item, hand_item;
|
||||
|
Reference in New Issue
Block a user