Revert "Disable CSM at compile-time (#78)"
This reverts commit 7632cb29a566678559eedfa71ab240bf4fabd1bc.
This commit is contained in:
parent
6202a98674
commit
12016bcf8b
@ -127,11 +127,9 @@ bool Camera::successfullyCreated(std::string &error_message)
|
|||||||
error_message.clear();
|
error_message.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_CSM
|
|
||||||
if (g_settings->getBool("enable_client_modding")) {
|
if (g_settings->getBool("enable_client_modding")) {
|
||||||
m_client->getScript()->on_camera_ready(this);
|
m_client->getScript()->on_camera_ready(this);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return error_message.empty();
|
return error_message.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,19 +138,14 @@ Client::Client(
|
|||||||
m_cache_save_interval = g_settings->getU16("server_map_save_interval");
|
m_cache_save_interval = g_settings->getU16("server_map_save_interval");
|
||||||
m_inv_item_anim_enabled = g_settings->getBool("inventory_items_animations");
|
m_inv_item_anim_enabled = g_settings->getBool("inventory_items_animations");
|
||||||
|
|
||||||
#ifdef DISABLE_CSM
|
|
||||||
m_modding_enabled = false;
|
|
||||||
#else
|
|
||||||
m_modding_enabled = g_settings->getBool("enable_client_modding");
|
m_modding_enabled = g_settings->getBool("enable_client_modding");
|
||||||
m_script = new ClientScripting(this);
|
m_script = new ClientScripting(this);
|
||||||
m_env.setScript(m_script);
|
m_env.setScript(m_script);
|
||||||
m_script->setEnv(&m_env);
|
m_script->setEnv(&m_env);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::initMods()
|
void Client::initMods()
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_CSM
|
|
||||||
m_script->loadMod(getBuiltinLuaPath() + DIR_DELIM "init.lua", BUILTIN_MOD_NAME);
|
m_script->loadMod(getBuiltinLuaPath() + DIR_DELIM "init.lua", BUILTIN_MOD_NAME);
|
||||||
|
|
||||||
// If modding is not enabled, don't load mods, just builtin
|
// If modding is not enabled, don't load mods, just builtin
|
||||||
@ -188,7 +183,6 @@ void Client::initMods()
|
|||||||
<< script_path << "\"]" << std::endl;
|
<< script_path << "\"]" << std::endl;
|
||||||
m_script->loadMod(script_path, mod.name);
|
m_script->loadMod(script_path, mod.name);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &Client::getBuiltinLuaPath()
|
const std::string &Client::getBuiltinLuaPath()
|
||||||
@ -217,10 +211,8 @@ const ModSpec* Client::getModSpec(const std::string &modname) const
|
|||||||
void Client::Stop()
|
void Client::Stop()
|
||||||
{
|
{
|
||||||
m_shutdown = true;
|
m_shutdown = true;
|
||||||
#ifndef DISABLE_CSM
|
|
||||||
// Don't disable this part when modding is disabled, it's used in builtin
|
// Don't disable this part when modding is disabled, it's used in builtin
|
||||||
m_script->on_shutdown();
|
m_script->on_shutdown();
|
||||||
#endif
|
|
||||||
//request all client managed threads to stop
|
//request all client managed threads to stop
|
||||||
m_mesh_update_thread.stop();
|
m_mesh_update_thread.stop();
|
||||||
// Save local server map
|
// Save local server map
|
||||||
@ -1558,12 +1550,10 @@ void Client::typeChatMessage(const std::wstring &message)
|
|||||||
if(message == L"")
|
if(message == L"")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef DISABLE_CSM
|
|
||||||
// If message was ate by script API, don't send it to server
|
// If message was ate by script API, don't send it to server
|
||||||
if (m_script->on_sending_message(wide_to_utf8(message))) {
|
if (m_script->on_sending_message(wide_to_utf8(message))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Send to others
|
// Send to others
|
||||||
sendChatMessage(message);
|
sendChatMessage(message);
|
||||||
@ -1763,12 +1753,10 @@ void Client::afterContentReceived(IrrlichtDevice *device)
|
|||||||
m_state = LC_Ready;
|
m_state = LC_Ready;
|
||||||
sendReady();
|
sendReady();
|
||||||
|
|
||||||
#ifndef DISABLE_CSM
|
|
||||||
if (g_settings->getBool("enable_client_modding")) {
|
if (g_settings->getBool("enable_client_modding")) {
|
||||||
m_script->on_client_ready(m_env.getLocalPlayer());
|
m_script->on_client_ready(m_env.getLocalPlayer());
|
||||||
m_script->on_connect();
|
m_script->on_connect();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
text = wgettext("Done!");
|
text = wgettext("Done!");
|
||||||
draw_load_screen(text, device, guienv, m_tsrc, 0, 100);
|
draw_load_screen(text, device, guienv, m_tsrc, 0, 100);
|
||||||
|
41
src/game.cpp
41
src/game.cpp
@ -172,18 +172,6 @@ struct LocalFormspecHandler : public TextDest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DISABLE_CSM
|
|
||||||
if (m_formname == "MT_DEATH_SCREEN") {
|
|
||||||
assert(m_client);
|
|
||||||
|
|
||||||
if (fields.find("btn_respawn") != fields.end() ||
|
|
||||||
fields.find("quit") != fields.end()) {
|
|
||||||
m_client->sendRespawn();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Don't disable this part when modding is disabled, it's used in builtin
|
// Don't disable this part when modding is disabled, it's used in builtin
|
||||||
if (m_client && m_client->getScript())
|
if (m_client && m_client->getScript())
|
||||||
m_client->getScript()->on_formspec_input(m_formname, fields);
|
m_client->getScript()->on_formspec_input(m_formname, fields);
|
||||||
@ -1392,9 +1380,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void showPauseMenu();
|
void showPauseMenu();
|
||||||
#ifdef DISABLE_CSM
|
|
||||||
void showDeathScreen();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
InputHandler *input;
|
InputHandler *input;
|
||||||
|
|
||||||
@ -3253,13 +3238,8 @@ void Game::processClientEvents(CameraOrientation *cam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CE_DEATHSCREEN:
|
case CE_DEATHSCREEN:
|
||||||
#ifdef DISABLE_CSM
|
|
||||||
showDeathScreen();
|
|
||||||
chat_backend->addMessage(L"", L"You died.");
|
|
||||||
#else
|
|
||||||
// This should be enabled for death formspec in builtin
|
// This should be enabled for death formspec in builtin
|
||||||
client->getScript()->on_death();
|
client->getScript()->on_death();
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Handle visualization */
|
/* Handle visualization */
|
||||||
runData.damage_flash = 0;
|
runData.damage_flash = 0;
|
||||||
@ -4903,27 +4883,6 @@ void Game::showPauseMenu()
|
|||||||
runData.pause_game_timer = 0;
|
runData.pause_game_timer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DISABLE_CSM
|
|
||||||
void Game::showDeathScreen()
|
|
||||||
{
|
|
||||||
std::string formspec =
|
|
||||||
std::string(FORMSPEC_VERSION_STRING) +
|
|
||||||
SIZE_TAG
|
|
||||||
"bgcolor[#320000b4;true]"
|
|
||||||
"label[4.4,1.35;" + gettext("You died.") + "]"
|
|
||||||
"button_exit[3.5,3;4,0.5;btn_respawn;" + gettext("Respawn") + "]"
|
|
||||||
;
|
|
||||||
|
|
||||||
/* Create menu */
|
|
||||||
/* Note: FormspecFormSource and LocalFormspecHandler
|
|
||||||
* are deleted by guiFormSpecMenu */
|
|
||||||
FormspecFormSource *fs_src = new FormspecFormSource(formspec);
|
|
||||||
LocalFormspecHandler *txt_dst = new LocalFormspecHandler("MT_DEATH_SCREEN", client);
|
|
||||||
|
|
||||||
create_formspec_menu(¤t_formspec, client, device, &input->joystick, fs_src, txt_dst);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
extern function for launching the game
|
extern function for launching the game
|
||||||
|
@ -32,8 +32,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "lua_api/l_localplayer.h"
|
#include "lua_api/l_localplayer.h"
|
||||||
#include "lua_api/l_camera.h"
|
#include "lua_api/l_camera.h"
|
||||||
|
|
||||||
#ifndef DISABLE_CSM
|
|
||||||
|
|
||||||
ClientScripting::ClientScripting(Client *client):
|
ClientScripting::ClientScripting(Client *client):
|
||||||
ScriptApiBase()
|
ScriptApiBase()
|
||||||
{
|
{
|
||||||
@ -88,5 +86,3 @@ void ClientScripting::on_camera_ready(Camera *camera)
|
|||||||
{
|
{
|
||||||
LuaCamera::create(getStack(), camera);
|
LuaCamera::create(getStack(), camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user