summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-07-25 14:07:45 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-07-25 14:07:45 +0300
commit0a18dda158e8f256de121ed2cf7a7a161a083b1c (patch)
tree35aaf6111a3694661e5d602481809830fbc7176f /src
parent9eaf93d41d6745b877f8f52cf54b21050abefda1 (diff)
downloadminetest-0a18dda158e8f256de121ed2cf7a7a161a083b1c.tar.gz
minetest-0a18dda158e8f256de121ed2cf7a7a161a083b1c.tar.bz2
minetest-0a18dda158e8f256de121ed2cf7a7a161a083b1c.zip
Remove special handling of creative mode
Diffstat (limited to 'src')
-rw-r--r--src/content_sao.cpp17
-rw-r--r--src/content_sao.h2
-rw-r--r--src/inventorymanager.cpp20
-rw-r--r--src/player.h1
-rw-r--r--src/scriptapi.cpp15
-rw-r--r--src/scriptapi.h1
-rw-r--r--src/server.cpp14
7 files changed, 10 insertions, 60 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index 0488c8023..843ab29f7 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -292,13 +292,6 @@ public:
ServerActiveObject *puncher,
float time_from_last_punch)
{
- // Directly delete item in creative mode
- if(g_settings->getBool("creative_mode") == true)
- {
- m_removed = true;
- return 0;
- }
-
// Take item into inventory
ItemStack item = createItemStack();
Inventory *inv = puncher->getInventory();
@@ -1143,16 +1136,6 @@ void PlayerSAO::disconnected()
}
}
-void PlayerSAO::createCreativeInventory()
-{
- if(m_inventory != &m_player->inventory)
- delete m_inventory;
-
- m_inventory = new Inventory(m_player->inventory);
- m_inventory->clearContents();
- scriptapi_get_creative_inventory(m_env->getLua(), this);
-}
-
std::string PlayerSAO::getPropertyPacket()
{
m_prop.is_visible = (getHP() != 0);
diff --git a/src/content_sao.h b/src/content_sao.h
index fac16ca99..ff427bac6 100644
--- a/src/content_sao.h
+++ b/src/content_sao.h
@@ -163,8 +163,6 @@ public:
void disconnected();
- void createCreativeInventory();
-
Player* getPlayer()
{
return m_player;
diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp
index 5412a5dca..35e986b56 100644
--- a/src/inventorymanager.cpp
+++ b/src/inventorymanager.cpp
@@ -514,19 +514,13 @@ void IDropAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
return;
}
- // Don't remove from inventory in creative mode
- if(g_settings->getBool("creative_mode") == true
- && from_inv.type == InventoryLocation::PLAYER){
- }
- else{
- // Take item from source list
- ItemStack item2 = list_from->takeItem(from_i, actually_dropped_count);
-
- if(item2.count != actually_dropped_count)
- errorstream<<"Could not take dropped count of items"<<std::endl;
-
- mgr->setInventoryModified(from_inv);
- }
+ // Take item from source list
+ ItemStack item2 = list_from->takeItem(from_i, actually_dropped_count);
+
+ if(item2.count != actually_dropped_count)
+ errorstream<<"Could not take dropped count of items"<<std::endl;
+
+ mgr->setInventoryModified(from_inv);
}
infostream<<"IDropAction::apply(): dropped "
diff --git a/src/player.h b/src/player.h
index 352b93e88..47f34c178 100644
--- a/src/player.h
+++ b/src/player.h
@@ -150,7 +150,6 @@ public:
u8 light;
- // In creative mode, this is the invisible backup inventory
Inventory inventory;
u16 hp;
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp
index d28f8c7c1..18a7c6a27 100644
--- a/src/scriptapi.cpp
+++ b/src/scriptapi.cpp
@@ -5326,21 +5326,6 @@ void scriptapi_on_leaveplayer(lua_State *L, ServerActiveObject *player)
scriptapi_run_callbacks(L, 1, RUN_CALLBACKS_MODE_FIRST);
}
-void scriptapi_get_creative_inventory(lua_State *L, ServerActiveObject *player)
-{
- realitycheck(L);
- assert(lua_checkstack(L, 20));
- StackUnroller stack_unroller(L);
-
- Inventory *inv = player->getInventory();
- assert(inv);
-
- lua_getglobal(L, "minetest");
- lua_getfield(L, -1, "creative_inventory");
- luaL_checktype(L, -1, LUA_TTABLE);
- inventory_set_list_from_lua(inv, "main", L, -1, PLAYER_INVENTORY_SIZE);
-}
-
static void get_auth_handler(lua_State *L)
{
lua_getglobal(L, "minetest");
diff --git a/src/scriptapi.h b/src/scriptapi.h
index baaf061a9..f695e5263 100644
--- a/src/scriptapi.h
+++ b/src/scriptapi.h
@@ -61,7 +61,6 @@ void scriptapi_on_dieplayer(lua_State *L, ServerActiveObject *player);
bool scriptapi_on_respawnplayer(lua_State *L, ServerActiveObject *player);
void scriptapi_on_joinplayer(lua_State *L, ServerActiveObject *player);
void scriptapi_on_leaveplayer(lua_State *L, ServerActiveObject *player);
-void scriptapi_get_creative_inventory(lua_State *L, ServerActiveObject *player);
bool scriptapi_get_auth(lua_State *L, const std::string &playername,
std::string *dst_password, std::set<std::string> *dst_privs);
void scriptapi_create_auth(lua_State *L, const std::string &playername,
diff --git a/src/server.cpp b/src/server.cpp
index c7698a106..21c936e69 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -3131,8 +3131,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
// Placement was handled in lua
// Apply returned ItemStack
- if(g_settings->getBool("creative_mode") == false)
- playersao->setWieldedItem(item);
+ playersao->setWieldedItem(item);
}
// If item has node placement prediction, always send the above
@@ -3158,8 +3157,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
item, playersao, pointed))
{
// Apply returned ItemStack
- if(g_settings->getBool("creative_mode") == false)
- playersao->setWieldedItem(item);
+ playersao->setWieldedItem(item);
}
} // action == 4
@@ -4380,9 +4378,7 @@ void Server::UpdateCrafting(u16 peer_id)
// Get a preview for crafting
ItemStack preview;
- // No crafting in creative mode
- if(g_settings->getBool("creative_mode") == false)
- getCraftingResult(&player->inventory, preview, false, this);
+ getCraftingResult(&player->inventory, preview, false, this);
// Put the new preview in
InventoryList *plist = player->inventory.getList("craftpreview");
@@ -4717,10 +4713,6 @@ PlayerSAO* Server::emergePlayer(const char *name, u16 peer_id)
scriptapi_on_joinplayer(m_lua, playersao);
- /* Creative mode */
- if(g_settings->getBool("creative_mode"))
- playersao->createCreativeInventory();
-
return playersao;
}