aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_areastore.cpp
Commit message (Expand)AuthorAge
* Fix AreaStore's IDs persistence (#8888)SmallJoker2019-09-21
* Modernize lua read (part 2 & 3): C++ templating assurance (#7410)Loïc Blot2018-06-30
* C++11 cleanup on constructors (#6000)Vincent Glize2017-06-19
* Replace luaL_reg with luaL_Reg as recent LuaJIT dropped the Lua 5.0 compat (#...Loïc Blot2017-04-08
* Mod security: Allow read-only access to all mod pathsShadowNinja2016-12-20
* Return nil on empty get_area() (#4508)James Stevenson2016-09-10
* Add AreaStore custom ID APIShadowNinja2016-03-07
* Implement AreaStore serializationShadowNinja2016-03-07
* Move AreaStore container selection logic into getOptimalImplementationShadowNinja2016-03-07
* Move AreaStore to utilShadowNinja2016-03-07
* Simplify AreaStore ID managementShadowNinja2016-03-07
* v2d & aabbox3d<f32> & sky cleanupsnerzhul2016-02-11
* Areastore: fix "attempt to index a number value"est312015-09-03
* Add AreaStore data structureest312015-07-27
e Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef CLIENTOBJECT_HEADER #define CLIENTOBJECT_HEADER #include "irrlichttypes_extrabloated.h" #include "activeobject.h" #include <map> /* Some planning ------------- * Client receives a network packet with information of added objects in it * Client supplies the information to its ClientEnvironment * The environment adds the specified objects to itself */ class ClientEnvironment; class ITextureSource; class IGameDef; class LocalPlayer; struct ItemStack; class ClientActiveObject : public ActiveObject { public: ClientActiveObject(u16 id, IGameDef *gamedef, ClientEnvironment *env); virtual ~ClientActiveObject(); virtual void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc, IrrlichtDevice *irr){} virtual void removeFromScene(bool permanent){} // 0 <= light_at_pos <= LIGHT_SUN virtual void updateLight(u8 light_at_pos){} virtual v3s16 getLightPosition(){return v3s16(0,0,0);} virtual core::aabbox3d<f32>* getSelectionBox(){return NULL;} virtual core::aabbox3d<f32>* getCollisionBox(){return NULL;} virtual bool collideWithObjects(){return false;} virtual v3f getPosition(){return v3f(0,0,0);} virtual scene::IMeshSceneNode *getMeshSceneNode(){return NULL;} virtual scene::IAnimatedMeshSceneNode *getAnimatedMeshSceneNode(){return NULL;} virtual scene::IBillboardSceneNode *getSpriteSceneNode(){return NULL;} virtual bool isPlayer(){return false;} virtual bool isLocalPlayer(){return false;} virtual void setAttachments(){} virtual bool doShowSelectionBox(){return true;} // Step object in time virtual void step(float dtime, ClientEnvironment *env){} // Process a message sent by the server side object virtual void processMessage(const std::string &data){} virtual std::string infoText() {return "";} virtual std::string debugInfoText() {return "";} /* This takes the return value of ServerActiveObject::getClientInitializationData */ virtual void initialize(const std::string &data){} // Create a certain type of ClientActiveObject static ClientActiveObject* create(u8 type, IGameDef *gamedef, ClientEnvironment *env); // If returns true, punch will not be sent to the server virtual bool directReportPunch(v3f dir, const ItemStack *punchitem=NULL, float time_from_last_punch=1000000) { return false; } protected: // Used for creating objects based on type typedef ClientActiveObject* (*Factory)(IGameDef *gamedef, ClientEnvironment *env); static void registerType(u16 type, Factory f); IGameDef *m_gamedef; ClientEnvironment *m_env; private: // Used for creating objects based on type static std::map<u16, Factory> m_types; }; struct DistanceSortedActiveObject { ClientActiveObject *obj; f32 d; DistanceSortedActiveObject(ClientActiveObject *a_obj, f32 a_d) { obj = a_obj; d = a_d; } bool operator < (const DistanceSortedActiveObject &other) const { return d < other.d; } }; #endif