3 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef CONTENT_SAO_HEADER
21 #define CONTENT_SAO_HEADER
23 #include "serverobject.h"
24 #include "content_object.h"
26 class TestSAO : public ServerActiveObject
29 TestSAO(ServerEnvironment *env, u16 id, v3f pos);
31 {return ACTIVEOBJECT_TYPE_TEST;}
32 static ServerActiveObject* create(ServerEnvironment *env, u16 id, v3f pos,
33 const std::string &data);
34 void step(float dtime, bool send_recommended);
40 class ItemSAO : public ServerActiveObject
43 ItemSAO(ServerEnvironment *env, u16 id, v3f pos,
44 const std::string inventorystring);
46 {return ACTIVEOBJECT_TYPE_ITEM;}
47 static ServerActiveObject* create(ServerEnvironment *env, u16 id, v3f pos,
48 const std::string &data);
49 void step(float dtime, bool send_recommended);
50 std::string getClientInitializationData();
51 std::string getStaticData();
52 InventoryItem* createInventoryItem();
53 InventoryItem* createPickedUpItem(){return createInventoryItem();}
54 void rightClick(Player *player);
56 std::string m_inventorystring;
58 v3f m_last_sent_position;
59 IntervalLimiter m_move_interval;
62 class RatSAO : public ServerActiveObject
65 RatSAO(ServerEnvironment *env, u16 id, v3f pos);
67 {return ACTIVEOBJECT_TYPE_RAT;}
68 static ServerActiveObject* create(ServerEnvironment *env, u16 id, v3f pos,
69 const std::string &data);
70 void step(float dtime, bool send_recommended);
71 std::string getClientInitializationData();
72 std::string getStaticData();
73 InventoryItem* createPickedUpItem();
76 IntervalLimiter m_inactive_interval;
79 v3f m_last_sent_position;
84 bool m_touching_ground;
87 class Oerkki1SAO : public ServerActiveObject
90 Oerkki1SAO(ServerEnvironment *env, u16 id, v3f pos);
92 {return ACTIVEOBJECT_TYPE_OERKKI1;}
93 static ServerActiveObject* create(ServerEnvironment *env, u16 id, v3f pos,
94 const std::string &data);
95 void step(float dtime, bool send_recommended);
96 std::string getClientInitializationData();
97 std::string getStaticData();
98 InventoryItem* createPickedUpItem(){return NULL;}
99 u16 punch(const std::string &toolname, v3f dir);
101 void doDamage(u16 d);
104 IntervalLimiter m_inactive_interval;
107 v3f m_last_sent_position;
112 bool m_touching_ground;
114 float m_after_jump_timer;
117 class FireflySAO : public ServerActiveObject
120 FireflySAO(ServerEnvironment *env, u16 id, v3f pos);
122 {return ACTIVEOBJECT_TYPE_FIREFLY;}
123 static ServerActiveObject* create(ServerEnvironment *env, u16 id, v3f pos,
124 const std::string &data);
125 void step(float dtime, bool send_recommended);
126 std::string getClientInitializationData();
127 std::string getStaticData();
128 InventoryItem* createPickedUpItem();
131 IntervalLimiter m_inactive_interval;
134 v3f m_last_sent_position;
139 bool m_touching_ground;
144 class MobV2SAO : public ServerActiveObject
147 MobV2SAO(ServerEnvironment *env, u16 id, v3f pos,
148 Settings *init_properties);
151 {return ACTIVEOBJECT_TYPE_MOBV2;}
152 static ServerActiveObject* create(ServerEnvironment *env, u16 id, v3f pos,
153 const std::string &data);
154 std::string getStaticData();
155 std::string getClientInitializationData();
156 void step(float dtime, bool send_recommended);
157 InventoryItem* createPickedUpItem(){return NULL;}
158 u16 punch(const std::string &toolname, v3f dir);
160 void setPropertyDefaults();
161 void readProperties();
162 void updateProperties();
163 void doDamage(u16 d);
165 std::string m_move_type;
167 v3f m_last_sent_position;
173 bool m_touching_ground;
176 float m_walk_around_timer;
177 bool m_next_pos_exists;
179 float m_shoot_reload_timer;
181 float m_shooting_timer;
186 Settings *m_properties;