#include <string>
#include "common_irrlicht.h"
#include "debug.h"
-#include "mapblockobject.h"
#include "main.h" // For g_materials
#include "mapnode.h" // For content_t
class ServerActiveObject;
class ServerEnvironment;
-class Player;
class InventoryItem
{
// Called when item is right-clicked when lying on ground.
// If returns true, item shall be deleted.
virtual bool use(ServerEnvironment *env,
- Player *player){return false;}
+ ServerActiveObject *user){return false;}
protected:
u16 m_count;
return new MaterialItem(m_content, m_count);
}
#ifndef SERVER
- video::ITexture * getImage() const
- {
- return content_features(m_content).inventory_texture;
- }
+ video::ITexture * getImage() const;
#endif
std::string getText()
{
content_t m_content;
};
-//TODO: Remove
-class MapBlockObjectItem : public InventoryItem
-{
-public:
- MapBlockObjectItem(std::string inventorystring):
- InventoryItem(1)
- {
- m_inventorystring = inventorystring;
- }
-
- /*
- Implementation interface
- */
- virtual const char* getName() const
- {
- return "MBOItem";
- }
- virtual void serialize(std::ostream &os) const
- {
- std::string sane_string(m_inventorystring);
- str_replace_char(sane_string, '|', '?');
- os<<getName();
- os<<" ";
- os<<sane_string;
- os<<"|";
- }
- virtual InventoryItem* clone()
- {
- return new MapBlockObjectItem(m_inventorystring);
- }
-
-#ifndef SERVER
- video::ITexture * getImage() const;
-#endif
- std::string getText();
-
- /*
- Special methods
- */
- std::string getInventoryString()
- {
- return m_inventorystring;
- }
-
- MapBlockObject * createObject(v3f pos, f32 player_yaw, f32 player_pitch);
-
-private:
- std::string m_inventorystring;
-};
-
/*
An item that is used as a mid-product when crafting.
Subnames:
bool isCookable() const;
InventoryItem *createCookResult() const;
- bool use(ServerEnvironment *env, Player *player);
+ bool use(ServerEnvironment *env, ServerActiveObject *user);
/*
Special methods