]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/serverobject.h
still a missing file
[dragonfireclient.git] / src / serverobject.h
index d0866b4c33826d1ac935c9e8bc27107edf49274a..1d1888580331fc1bc485d176f23a136a531c531a 100644 (file)
@@ -38,10 +38,12 @@ Some planning
 
 */
 
+class ServerEnvironment;
+
 class ServerActiveObject : public ActiveObject
 {
 public:
-       ServerActiveObject(u16 id, v3f pos=v3f(0,0,0));
+       ServerActiveObject(ServerEnvironment *env, u16 id, v3f pos=v3f(0,0,0));
        virtual ~ServerActiveObject();
 
        v3f getBasePosition()
@@ -49,13 +51,40 @@ class ServerActiveObject : public ActiveObject
                return m_base_position;
        }
        
+       void setBasePosition(v3f pos)
+       {
+               m_base_position = pos;
+       }
+
+       ServerEnvironment* getEnv()
+       {
+               return m_env;
+       }
+       
        /*
                Step object in time.
                Messages added to messages are sent to client over network.
        */
        virtual void step(float dtime, Queue<ActiveObjectMessage> &messages){}
        
-       // Number of players which know about this one
+       /*
+               The return value of this is passed to the client-side object
+               when it is created
+       */
+       virtual std::string getClientInitializationData(){return "";}
+       
+       /*
+               The return value of this is passed to the server-side object
+               when it is loaded from disk or from a static object
+       */
+       virtual std::string getServerInitializationData(){return "";}
+       
+       /*
+               This takes the return value of getServerInitializationData
+       */
+       virtual void initialize(const std::string &data){}
+       
+       // Number of players which know about this object
        u16 m_known_by_count;
        /*
                Whether this object is to be removed when nobody knows about
@@ -66,13 +95,14 @@ class ServerActiveObject : public ActiveObject
        bool m_removed;
        
 protected:
+       ServerEnvironment *m_env;
        v3f m_base_position;
 };
 
 class TestSAO : public ServerActiveObject
 {
 public:
-       TestSAO(u16 id, v3f pos);
+       TestSAO(ServerEnvironment *env, u16 id, v3f pos);
        u8 getType() const
        {
                return ACTIVEOBJECT_TYPE_TEST;