*/
+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()
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
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;