Compare commits
5 Commits
d01eaae9fc
...
09d86db9a3
Author | SHA1 | Date |
---|---|---|
Ciaran Gultnieks | 09d86db9a3 | |
Ciaran Gultnieks | 7d8079885d | |
Ciaran Gultnieks | 36d0152f6c | |
Ciaran Gultnieks | 99f17c9047 | |
Ciaran Gultnieks | 538d575391 |
|
@ -1997,7 +1997,7 @@ and `minetest.auth_reload` call the authetification handler.
|
|||
or `nil` if no recipe was found
|
||||
* recipe entry table:
|
||||
{
|
||||
method = 'normal' or 'cooking' or 'fuel'
|
||||
type = 'normal' or 'cooking' or 'fuel'
|
||||
width = 0-3, 0 means shapeless recipe
|
||||
items = indexed [1-9] table with recipe items
|
||||
output = string with item name and quantity
|
||||
|
|
|
@ -617,6 +617,26 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
|
|||
}
|
||||
}
|
||||
|
||||
bool LuaEntitySAO::unlimitedTransferDistance() const
|
||||
{
|
||||
|
||||
// If a player is attached to this object, we want to always send its
|
||||
// position to clients, regardless of range. Otherwise, the player
|
||||
// position is reported wrongly on the clients.
|
||||
if(!g_settings->getBool("unlimited_player_transfer_distance"))
|
||||
return false;
|
||||
std::list<Player*> players = m_env->getPlayers();
|
||||
for(std::list<Player*>::iterator
|
||||
i = players.begin();
|
||||
i != players.end(); ++i) {
|
||||
Player *player = *i;
|
||||
PlayerSAO* sao = player->getPlayerSAO();
|
||||
if(sao != NULL && sao->isAttachedTo(m_id))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version)
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
|
@ -1125,6 +1145,11 @@ bool PlayerSAO::isAttached()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PlayerSAO::isAttachedTo(u16 id)
|
||||
{
|
||||
return m_attachment_parent_id == id;
|
||||
}
|
||||
|
||||
void PlayerSAO::step(float dtime, bool send_recommended)
|
||||
{
|
||||
if(!m_properties_sent)
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
{ return ACTIVEOBJECT_TYPE_GENERIC; }
|
||||
virtual void addedToEnvironment(u32 dtime_s);
|
||||
void removingFromEnvironment();
|
||||
bool unlimitedTransferDistance() const;
|
||||
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
|
||||
const std::string &data);
|
||||
bool isAttached();
|
||||
|
@ -183,6 +184,7 @@ public:
|
|||
std::string getClientInitializationData(u16 protocol_version);
|
||||
std::string getStaticData();
|
||||
bool isAttached();
|
||||
bool isAttachedTo(u16 id);
|
||||
void step(float dtime, bool send_recommended);
|
||||
void setBasePosition(const v3f &position);
|
||||
void setPos(v3f pos);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <set>
|
||||
#include <climits>
|
||||
#include <algorithm>
|
||||
|
||||
#define PPOS(pos) "(" << pos.X << "," << pos.Y << "," << pos.Z << ")"
|
||||
|
||||
|
@ -141,6 +142,11 @@ std::vector<v3s16> PathFinder::getPath(ServerEnvironment* env,
|
|||
std::vector<v3s16> path;
|
||||
buildPath(path, source, destination);
|
||||
|
||||
// Support bug of previous pathfinder
|
||||
if(path.size() == 1) {
|
||||
path.push_back(path[path.size() - 1]);
|
||||
}
|
||||
|
||||
#ifdef PATHFINDER_CALC_TIME
|
||||
timespec ts2;
|
||||
clock_gettime(CLOCK_REALTIME, &ts2);
|
||||
|
@ -282,7 +288,7 @@ bool PathFinder::findPathHeuristic(v3s16 pos, std::vector <v3s16>& directions,
|
|||
++test_pos.Y;
|
||||
node_at_test_pos = m_env->getMap().getNodeNoEx(test_pos);
|
||||
}
|
||||
|
||||
|
||||
// Did we find surface?
|
||||
if((test_pos.Y <= m_limits.Y.max) &&
|
||||
(node_at_test_pos.param0 == CONTENT_AIR) &&
|
||||
|
@ -317,6 +323,6 @@ void PathFinder::buildPath(std::vector<v3s16>& path, v3s16 start_pos, v3s16 end_
|
|||
path.push_back(current_pos);
|
||||
current_pos = used[current_pos].first;
|
||||
}
|
||||
path.push_back(start_pos);
|
||||
path.push_back(start_pos);
|
||||
std::reverse(path.begin(), path.end());
|
||||
}
|
||||
|
||||
|
|
|
@ -1024,7 +1024,7 @@ void Server::AsyncRunStep(bool initial_step)
|
|||
}
|
||||
else if(event->type == MEET_BLOCK_NODE_METADATA_CHANGED)
|
||||
{
|
||||
infostream<<"Server: MEET_BLOCK_NODE_METADATA_CHANGED"<<std::endl;
|
||||
//infostream<<"Server: MEET_BLOCK_NODE_METADATA_CHANGED"<<PP(event->p)<<std::endl;
|
||||
prof.add("MEET_BLOCK_NODE_METADATA_CHANGED", 1);
|
||||
setBlockNotSent(event->p);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue