@@ -177,8 +177,13 @@ struct LocalFormspecHandler : public TextDest
177177 }
178178 }
179179
180- // Don't disable this part when modding is disabled, it's used in builtin
181- if (m_client && m_client->getScript ())
180+ if (m_formname == " MT_DEATH_SCREEN" ) {
181+ assert (m_client != 0 );
182+ m_client->sendRespawn ();
183+ return ;
184+ }
185+
186+ if (m_client && m_client->moddingEnabled ())
182187 m_client->getScript ()->on_formspec_input (m_formname, fields);
183188 }
184189
@@ -775,6 +780,7 @@ class Game {
775780 bool disable_camera_update = false ;
776781 };
777782
783+ void showDeathFormspec ();
778784 void showPauseMenu ();
779785
780786 // ClientEvent handlers
@@ -1496,8 +1502,6 @@ bool Game::connectToServer(const std::string &playername,
14961502
14971503 fps_control.last_time = RenderingEngine::get_timer_time ();
14981504
1499- client->loadBuiltin ();
1500-
15011505 while (RenderingEngine::run ()) {
15021506
15031507 limitFps (&fps_control, &dtime);
@@ -1882,7 +1886,10 @@ void Game::processKeyInput()
18821886 } else if (wasKeyDown (KeyType::CMD)) {
18831887 openConsole (0.2 , L" /" );
18841888 } else if (wasKeyDown (KeyType::CMD_LOCAL)) {
1885- openConsole (0.2 , L" ." );
1889+ if (client->moddingEnabled ())
1890+ openConsole (0.2 , L" ." );
1891+ else
1892+ m_game_ui->showStatusText (wgettext (" CSM is disabled" ));
18861893 } else if (wasKeyDown (KeyType::CONSOLE)) {
18871894 openConsole (core::clamp (g_settings->getFloat (" console_height" ), 0 .1f , 1 .0f ));
18881895 } else if (wasKeyDown (KeyType::FREEMOVE)) {
@@ -2532,12 +2539,15 @@ void Game::handleClientEvent_PlayerForceMove(ClientEvent *event, CameraOrientati
25322539
25332540void Game::handleClientEvent_Deathscreen (ClientEvent *event, CameraOrientation *cam)
25342541{
2535- // This should be enabled for death formspec in builtin
2536- client->getScript ()->on_death ();
2537-
2538- LocalPlayer *player = client->getEnv ().getLocalPlayer ();
2542+ // If CSM enabled, deathscreen is handled by CSM code in
2543+ // builtin/client/init.lua
2544+ if (client->moddingEnabled ())
2545+ client->getScript ()->on_death ();
2546+ else
2547+ showDeathFormspec ();
25392548
25402549 /* Handle visualization */
2550+ LocalPlayer *player = client->getEnv ().getLocalPlayer ();
25412551 runData.damage_flash = 0 ;
25422552 player->hurt_tilt_timer = 0 ;
25432553 player->hurt_tilt_strength = 0 ;
@@ -4006,6 +4016,27 @@ void Game::extendedResourceCleanup()
40064016 << " (note: irrlicht doesn't support removing renderers)" << std::endl;
40074017}
40084018
4019+ void Game::showDeathFormspec ()
4020+ {
4021+ static std::string formspec =
4022+ std::string (FORMSPEC_VERSION_STRING) +
4023+ SIZE_TAG
4024+ " bgcolor[#320000b4;true]"
4025+ " label[4.85,1.35;" + gettext (" You died" ) + " ]"
4026+ " button_exit[4,3;3,0.5;btn_respawn;" + gettext (" Respawn" ) + " ]"
4027+ ;
4028+
4029+ /* Create menu */
4030+ /* Note: FormspecFormSource and LocalFormspecHandler *
4031+ * are deleted by guiFormSpecMenu */
4032+ FormspecFormSource *fs_src = new FormspecFormSource (formspec);
4033+ LocalFormspecHandler *txt_dst = new LocalFormspecHandler (" MT_DEATH_SCREEN" , client);
4034+
4035+ GUIFormSpecMenu::create (current_formspec, client, &input->joystick , fs_src,
4036+ txt_dst, client->getFormspecPrepend ());
4037+ current_formspec->setFocus (" btn_respawn" );
4038+ }
4039+
40094040#define GET_KEY_NAME (KEY ) gettext(getKeySetting(#KEY).name())
40104041void Game::showPauseMenu ()
40114042{
0 commit comments