#include "profiler.h"
#include "raycast.h"
#include "remoteplayer.h"
-#include "scripting_game.h"
+#include "serverscripting.h"
#include "server.h"
#include "voxelalgorithms.h"
#include "util/serialize.h"
*/
ServerEnvironment::ServerEnvironment(ServerMap *map,
- GameScripting *scriptIface, Server *server,
- const std::string &path_world) :
+ ServerScripting *scriptIface, Server *server,
+ const std::string &path_world):
+ Environment(server),
m_map(map),
m_script(scriptIface),
m_server(server),
for (std::vector<RemotePlayer *>::iterator it = m_players.begin();
it != m_players.end();
++it) {
- if ((*it)->checkModified()) {
+ if ((*it)->checkModified() ||
+ ((*it)->getPlayerSAO() && (*it)->getPlayerSAO()->extendedAttributesModified())) {
(*it)->save(players_path, m_server);
}
}
if (objectpos_over_limit(object->getBasePosition())) {
v3f p = object->getBasePosition();
- errorstream << "ServerEnvironment::addActiveObjectRaw(): "
+ warningstream << "ServerEnvironment::addActiveObjectRaw(): "
<< "object position (" << p.X << "," << p.Y << "," << p.Z
<< ") outside maximum range" << std::endl;
if (object->environmentDeletes())
{
// Add static object to active static list of the block
v3f objectpos = object->getBasePosition();
- std::string staticdata = object->getStaticData();
+ std::string staticdata = "";
+ object->getStaticData(&staticdata);
StaticObject s_obj(object->getType(), objectpos, staticdata);
// Add to the block where the object is located in
v3s16 blockpos = getNodeBlockPos(floatToInt(objectpos, BS));
If block wasn't generated (not in memory or on disk),
*/
-void ServerEnvironment::deactivateFarObjects(bool force_delete)
+void ServerEnvironment::deactivateFarObjects(bool _force_delete)
{
std::vector<u16> objects_to_remove;
for(ActiveObjectMap::iterator i = m_active_objects.begin();
i != m_active_objects.end(); ++i) {
+ // force_delete might be overriden per object
+ bool force_delete = _force_delete;
+
ServerActiveObject* obj = i->second;
assert(obj);
<<std::endl;
continue;
}
- std::string staticdata_new = obj->getStaticData();
+ std::string staticdata_new = "";
+ obj->getStaticData(&staticdata_new);
StaticObject s_obj(obj->getType(), objectpos, staticdata_new);
block->m_static_objects.insert(id, s_obj);
obj->m_static_block = blockpos_o;
if(obj->isStaticAllowed())
{
// Create new static object
- std::string staticdata_new = obj->getStaticData();
+ std::string staticdata_new = "";
+ obj->getStaticData(&staticdata_new);
StaticObject s_obj(obj->getType(), objectpos, staticdata_new);
bool stays_in_same_block = false;