MeshUpdateQueue();
~MeshUpdateQueue();
-
+
/*
peer_id=0 adds with nobody to send to
*/
JMutexAutoLock lock(m_mutex);
return m_queue.size();
}
-
+
private:
core::list<QueuedMeshUpdate*> m_queue;
JMutex m_mutex;
IWritableItemDefManager *itemdef,
IWritableNodeDefManager *nodedef
);
-
+
~Client();
/*
The name of the local player should already be set when
const std::wstring newpassword);
void sendDamage(u8 damage);
void sendRespawn();
-
+
// locks envlock
void removeNode(v3s16 p);
// locks envlock
void addNode(v3s16 p, MapNode n);
-
+
void updateCamera(v3f pos, v3f dir, f32 fov);
-
+
void renderPostFx();
-
+
// Returns InvalidPositionException if not found
MapNode getNode(v3s16 p);
// Wrapper to Map
bool getLocalInventoryUpdated();
// Copies the inventory of the local player to parameter
void getLocalInventory(Inventory &dst);
-
+
/* InventoryManager interface */
Inventory* getInventory(const InventoryLocation &loc);
void inventoryAction(InventoryAction *a);
{
try{
return m_con.GetPeerAvgRTT(PEER_ID_SERVER);
- } catch(con::PeerNotFoundException){
+ } catch(con::PeerNotFoundException &){
return 1337;
}
}
// Get event from queue. CE_NONE is returned if queue is empty.
ClientEvent getClientEvent();
-
+
bool accessDenied()
{ return m_access_denied; }
{ return m_itemdef_received; }
bool nodedefReceived()
{ return m_nodedef_received; }
-
+
void afterContentReceived();
float getRTT(void);
virtual u16 allocateUnknownNodeId(const std::string &name);
private:
-
+
// Virtual methods from con::PeerHandler
void peerAdded(con::Peer *peer);
void deletingPeer(con::Peer *peer, bool timeout);
-
+
void ReceiveAll();
void Receive();
-
+
void sendPlayerPos();
// This sends the player's current name etc to the server
void sendPlayerInfo();
// Send the item number 'item' as player item to the server
void sendPlayerItem(u16 item);
-
+
float m_packetcounter_timer;
float m_connection_reinit_timer;
float m_avg_rtt_timer;
{
// Chunk packets, containing the TYPE_SPLIT header
core::list<SharedBuffer<u8> > chunks;
-
+
u32 chunk_header_size = 7;
u32 maximum_data_size = chunksize_max - chunk_header_size;
u32 start = 0;
end = start + maximum_data_size - 1;
if(end > data.getSize() - 1)
end = data.getSize() - 1;
-
+
u32 payload_size = end - start + 1;
u32 packet_size = chunk_header_size + payload_size;
SharedBuffer<u8> chunk(packet_size);
-
+
writeU8(&chunk[0], TYPE_SPLIT);
writeU16(&chunk[1], seqnum);
// [3] u16 chunk_count is written at next stage
memcpy(&chunk[chunk_header_size], &data[start], payload_size);
chunks.push_back(chunk);
-
+
start = end + 1;
chunk_num++;
}
sp->reliable = reliable;
m_buf[seqnum] = sp;
}
-
+
IncomingSplitPacket *sp = m_buf[seqnum];
-
+
// TODO: These errors should be thrown or something? Dunno.
if(chunk_count != sp->chunk_count)
derr_con<<"Connection: WARNING: chunk_count="<<chunk_count
// If chunk already exists, cancel
if(sp->chunks.find(chunk_num) != NULL)
throw AlreadyExistsException("Chunk already in buffer");
-
+
// Cut chunk data out of packet
u32 chunkdatasize = p.data.getSize() - headersize;
SharedBuffer<u8> chunkdata(chunkdatasize);
memcpy(*chunkdata, &(p.data[headersize]), chunkdatasize);
-
+
// Set chunk data in buffer
sp->chunks[chunk_num] = chunkdata;
-
+
// If not all chunks are received, return empty buffer
if(sp->allReceived() == false)
return SharedBuffer<u8>();
{
totalsize += i.getNode()->getValue().getSize();
}
-
+
SharedBuffer<u8> fulldata(totalsize);
// Copy chunks to data buffer
avg_rtt = rtt;
else
avg_rtt = rtt * 0.1 + avg_rtt * 0.9;
-
+
// Calculate resend_timeout
/*int reliable_count = 0;
}
float timeout = avg_rtt * RESEND_TIMEOUT_FACTOR
* ((float)reliable_count * 1);*/
-
+
float timeout = avg_rtt * RESEND_TIMEOUT_FACTOR;
if(timeout < RESEND_TIMEOUT_MIN)
timeout = RESEND_TIMEOUT_MIN;
timeout = RESEND_TIMEOUT_MAX;
resend_timeout = timeout;
}
-
+
/*
Connection
*/
log_register_thread("Connection");
dout_con<<"Connection thread started"<<std::endl;
-
+
u32 curtime = porting::getTimeMs();
u32 lasttime = curtime;
while(getRun())
{
BEGIN_DEBUG_EXCEPTION_HANDLER
-
+
lasttime = curtime;
curtime = porting::getTimeMs();
float dtime = (float)(curtime - lasttime) / 1000.;
dtime = 0.1;
if(dtime < 0.0)
dtime = 0.0;
-
+
runTimeouts(dtime);
while(m_command_queue.size() != 0){
send(dtime);
receive();
-
+
END_DEBUG_EXCEPTION_HANDLER(derr_con);
}
SharedBuffer<u8> packetdata(packet_maxsize);
bool single_wait_done = false;
-
+
for(;;)
{
try{
continue;
}
}
-
+
if(single_wait_done){
if(m_socket.WaitData(0) == false)
break;
}
-
+
single_wait_done = true;
Address sender;
continue;
if(readU32(&packetdata[0]) != m_protocol_id)
continue;
-
+
u16 peer_id = readPeerId(*packetdata);
u8 channelnum = readChannel(*packetdata);
if(channelnum > CHANNEL_COUNT-1){
{
/*
Somebody is trying to send stuff to us with no peer id.
-
+
Check if the same address and port was added to our peer
list before.
Allow only entries that have has_sent_with_id==false.
if(peer->address == sender)
break;
}
-
+
/*
If no peer was found with the same address and port,
we shall assume it is a new peer and create an entry.
<<"peer_id="<<peer_id<<std::endl;
}
}
-
+
/*
The peer was not found in our lists. Add it.
*/
// Create a peer
Peer *peer = new Peer(peer_id_new, sender);
m_peers.insert(peer->id, peer);
-
+
// Create peer addition event
ConnectionEvent e;
e.peerAdded(peer_id_new, sender);
putEvent(e);
-
+
// Create CONTROL packet to tell the peer id to the new peer.
SharedBuffer<u8> reply(4);
writeU8(&reply[0], TYPE_CONTROL);
writeU8(&reply[1], CONTROLTYPE_SET_PEER_ID);
writeU16(&reply[2], peer_id_new);
sendAsPacket(peer_id_new, 0, reply, true);
-
+
// We're now talking to a valid peer_id
peer_id = peer_id_new;
" Ignoring."<<std::endl;
continue;
}
-
+
peer->timeout_counter = 0.0;
Channel *channel = &(peer->channels[channelnum]);
-
+
// Throw the received packet to channel->processPacket()
// Make a new SharedBuffer from the data without the base headers
SharedBuffer<u8> strippeddata(received_size - BASE_HEADER_SIZE);
memcpy(*strippeddata, &packetdata[BASE_HEADER_SIZE],
strippeddata.getSize());
-
+
try{
// Process it (the result is some data with no headers made by us)
SharedBuffer<u8> resultdata = processPacket
(channel, strippeddata, peer_id, channelnum, false);
-
+
PrintInfo();
dout_con<<"ProcessPacket returned data of size "
<<resultdata.getSize()<<std::endl;
-
+
ConnectionEvent e;
e.dataReceived(peer_id, resultdata);
putEvent(e);
for(; j.atEnd() == false; j++)
{
Peer *peer = j.getNode()->getValue();
-
+
/*
Check peer timeout
*/
{
core::list<BufferedPacket> timed_outs;
core::list<BufferedPacket>::Iterator j;
-
+
Channel *channel = &peer->channels[i];
// Remove timed out incomplete unreliable split packets
channel->incoming_splits.removeUnreliableTimedOuts(dtime, m_timeout);
-
+
// Increment reliable packet times
channel->outgoing_reliables.incrementTimeouts(dtime);
}
// Re-send timed out outgoing reliables
-
+
timed_outs = channel->
outgoing_reliables.getTimedOuts(resend_timeout);
peer->reportRTT(resend_timeout);
}
}
-
+
/*
Send pings
*/
peer->ping_timer = 0.0;
}
-
+
nextpeer:
continue;
}
ConnectionEvent e;
e.peerAdded(peer->id, peer->address);
putEvent(e);
-
+
m_socket.Bind(0);
-
+
// Send a dummy packet to server with peer_id = PEER_ID_INEXISTENT
m_peer_id = PEER_ID_INEXISTENT;
SharedBuffer<u8> data(0);
SharedBuffer<u8> data(2);
writeU8(&data[0], TYPE_CONTROL);
writeU8(&data[1], CONTROLTYPE_DISCO);
-
+
// Send to all
core::map<u16, Peer*>::Iterator j;
j = m_peers.getIterator();
dout_con<<getDesc()<<" sending to peer_id="<<peer_id<<std::endl;
assert(channelnum < CHANNEL_COUNT);
-
+
Peer *peer = getPeerNoEx(peer_id);
if(peer == NULL)
return;
core::list<SharedBuffer<u8> > originals;
originals = makeAutoSplitPacket(data, chunksize_max,
channel->next_outgoing_split_seqnum);
-
+
core::list<SharedBuffer<u8> >::Iterator i;
i = originals.begin();
for(; i != originals.end(); i++)
{
SharedBuffer<u8> original = *i;
-
+
sendAsPacket(peer_id, channelnum, original, reliable);
}
}
// Add base headers and make a packet
BufferedPacket p = makePacket(peer->address, reliable,
m_protocol_id, m_peer_id, channelnum);
-
+
try{
// Buffer the packet
channel->outgoing_reliables.insert(p);
"in outgoing buffer"<<std::endl;
//assert(0);
}
-
+
// Send the packet
rawSend(p);
}
break;
}
// This happens if all packets are old
- }catch(con::NotFoundException)
+ }catch(con::NotFoundException &)
{}
-
+
if(channel->incoming_reliables.empty() == false)
{
if(firstseqnum == channel->next_incoming_seqnum)
{
BufferedPacket p = channel->incoming_reliables.popFirst();
-
+
peer_id = readPeerId(*p.data);
u8 channelnum = readChannel(*p.data);
u16 seqnum = readU16(&p.data[BASE_HEADER_SIZE+1]);
<<std::endl;
channel->next_incoming_seqnum++;
-
+
u32 headers_size = BASE_HEADER_SIZE + RELIABLE_HEADER_SIZE;
// Get out the inside packet and re-process it
SharedBuffer<u8> payload(p.data.getSize() - headers_size);
throw InvalidIncomingDataException("packetdata.getSize() < 1");
u8 type = readU8(&packetdata[0]);
-
+
if(type == TYPE_CONTROL)
{
if(packetdata.getSize() < 2)
// the timeout counter
PrintInfo();
dout_con<<"DISCO: Removing peer "<<(peer_id)<<std::endl;
-
+
if(deletePeer(peer_id, false) == false)
{
PrintInfo(derr_con);
bool is_future_packet = seqnum_higher(seqnum, channel->next_incoming_seqnum);
bool is_old_packet = seqnum_higher(channel->next_incoming_seqnum, seqnum);
-
+
PrintInfo();
if(is_future_packet)
dout_con<<"BUFFERING";
dout_con<<" [sending CONTROLTYPE_ACK"
" to peer_id="<<peer_id<<"]";
dout_con<<std::endl;
-
+
//DEBUG
//assert(channel->incoming_reliables.size() < 100);
/*PrintInfo();
dout_con<<"Buffering reliable packet (seqnum="
<<seqnum<<")"<<std::endl;*/
-
+
// This one comes later, buffer it.
// Actually we have to make a packet to buffer one.
// Well, we have all the ingredients, so just do it.
channelnum);
try{
channel->incoming_reliables.insert(packet);
-
+
/*PrintInfo();
dout_con<<"INCOMING: ";
channel->incoming_reliables.print();
derr_con<<"Got invalid type="<<((int)type&0xff)<<std::endl;
throw InvalidIncomingDataException("Invalid packet type");
}
-
+
// We should never get here.
// If you get here, add an exception or a return to some of the
// above conditionals.
{
if(m_peers.find(peer_id) == NULL)
return false;
-
+
Peer *peer = m_peers[peer_id];
// Create event
if(m_peers.size() != 1)
return false;
-
+
core::map<u16, Peer*>::Node *node = m_peers.find(PEER_ID_SERVER);
if(node == NULL)
return false;
-
+
if(m_peer_id == PEER_ID_INEXISTENT)
return false;
-
+
return true;
}
// Get a dependency-sorted list of ModSpecs
core::list<ModSpec> getMods(core::list<std::string> &modspaths)
- throw(ModError)
{
std::queue<ModSpec> mods_satisfied;
core::list<ModSpec> mods_unsorted;
};
// Get a dependency-sorted list of ModSpecs
-core::list<ModSpec> getMods(core::list<std::string> &modspaths)
- throw(ModError);
+core::list<ModSpec> getMods(core::list<std::string> &modspaths);
#endif
return server;
}
-static ServerEnvironment* get_env(lua_State *L)
+/*static ServerEnvironment* get_env(lua_State *L)
{
// Get environment from registry
lua_getfield(L, LUA_REGISTRYINDEX, "minetest_env");
ServerEnvironment *env = (ServerEnvironment*)lua_touserdata(L, -1);
lua_pop(L, 1);
return env;
-}
+}*/
static void objectref_get(lua_State *L, u16 id)
{
f.alpha = getintfield_default(L, index, "alpha", 255);
/* Other stuff */
-
+
lua_getfield(L, index, "post_effect_color");
if(!lua_isnil(L, -1))
f.post_effect_color = readARGB8(L, -1);
"deprecated: use 'drop' field");
warn_if_field_exists(L, index, "extra_dug_item_rarity",
"deprecated: use 'drop' field");
-
+
// True for all ground-like things like stone and mud, false for eg. trees
getboolfield(L, index, "is_ground_content", f.is_ground_content);
f.light_propagates = (f.param_type == CPT_LIGHT);
"light_source", f.light_source);
f.damage_per_second = getintfield_default(L, index,
"damage_per_second", f.damage_per_second);
-
+
lua_getfield(L, index, "selection_box");
if(lua_istable(L, -1)){
f.selection_box.type = (NodeBoxType)getenumfield(L, -1, "type",
static const luaL_reg methods[];
// Exported functions
-
+
// garbage collector
static int gc_object(lua_State *L)
{
{
return m_stack;
}
-
+
// LuaItemStack(itemstack or itemstring or table or nil)
// Creates an LuaItemStack and leaves it on top of stack
static int create_object(lua_State *L)
if(!ud) luaL_typerror(L, narg, className);
return *(InvRef**)ud; // unbox pointer
}
-
+
static Inventory* getinv(lua_State *L, InvRef *ref)
{
return get_server(L)->getInventory(ref->m_loc);
// Inform other things that the inventory has changed
get_server(L)->setInventoryModified(ref->m_loc);
}
-
+
// Exported functions
-
+
// garbage collector
static int gc_object(lua_State *L) {
InvRef *o = *(InvRef **)(lua_touserdata(L, 1));
if(!ud) luaL_typerror(L, narg, className);
return *(NodeMetaRef**)ud; // unbox pointer
}
-
+
static NodeMetadata* getmeta(NodeMetaRef *ref)
{
NodeMetadata *meta = ref->m_env->getMap().getNodeMetadata(ref->m_p);
block->raiseModified(MOD_STATE_WRITE_NEEDED,
"NodeMetaRef::reportMetadataChange");
}
-
+
// Exported functions
-
+
// garbage collector
static int gc_object(lua_State *L) {
NodeMetaRef *o = *(NodeMetaRef **)(lua_touserdata(L, 1));
}
/* IGenericNodeMetadata interface */
-
+
// set_infotext(self, text)
static int l_set_infotext(lua_State *L)
{
if(!ud) luaL_typerror(L, narg, className);
return *(ObjectRef**)ud; // unbox pointer
}
-
+
static ServerActiveObject* getobject(ObjectRef *ref)
{
ServerActiveObject *co = ref->m_object;
return co;
}
-
+
static LuaEntitySAO* getluaobject(ObjectRef *ref)
{
ServerActiveObject *obj = getobject(ref);
return NULL;
return (LuaEntitySAO*)obj;
}
-
+
static ServerRemotePlayer* getplayer(ObjectRef *ref)
{
ServerActiveObject *obj = getobject(ref);
return NULL;
return static_cast<ServerRemotePlayer*>(obj);
}
-
+
// Exported functions
-
+
// garbage collector
static int gc_object(lua_State *L) {
ObjectRef *o = *(ObjectRef **)(lua_touserdata(L, 1));
co->m_removed = true;
return 0;
}
-
+
// getpos(self)
// returns: {x=num, y=num, z=num}
static int l_getpos(lua_State *L)
lua_setfield(L, -2, "z");
return 1;
}
-
+
// setpos(self, pos)
static int l_setpos(lua_State *L)
{
get_server(L)->SendMovePlayer(player);
return 0;
}
-
+
// moveto(self, pos, continuous=false)
static int l_moveto(lua_State *L)
{
co->setVelocity(pos);
return 0;
}
-
+
// getvelocity(self)
static int l_getvelocity(lua_State *L)
{
pushFloatPos(L, v);
return 1;
}
-
+
// setacceleration(self, {x=num, y=num, z=num})
static int l_setacceleration(lua_State *L)
{
co->setAcceleration(pos);
return 0;
}
-
+
// getacceleration(self)
static int l_getacceleration(lua_State *L)
{
pushFloatPos(L, v);
return 1;
}
-
+
// setyaw(self, radians)
static int l_setyaw(lua_State *L)
{
co->setYaw(yaw);
return 0;
}
-
+
// getyaw(self)
static int l_getyaw(lua_State *L)
{
lua_pushnumber(L, yaw);
return 1;
}
-
+
// settexturemod(self, mod)
static int l_settexturemod(lua_State *L)
{
co->setTextureMod(mod);
return 0;
}
-
+
// setsprite(self, p={x=0,y=0}, num_frames=1, framelength=0.2,
// select_horiz_by_yawpitch=false)
static int l_setsprite(lua_State *L)
lua_pushstring(L, name.c_str());
return 1;
}
-
+
// get_luaentity(self)
static int l_get_luaentity(lua_State *L)
{
luaentity_get(L, co->getId());
return 1;
}
-
+
/* Player-only */
-
+
// get_player_name(self)
static int l_get_player_name(lua_State *L)
{
lua_pushstring(L, player->getName());
return 1;
}
-
+
// get_look_dir(self)
static int l_get_look_dir(lua_State *L)
{
ObjectRef *o = checkobject(L, -1);
o->m_object = NULL;
}
-
+
static void Register(lua_State *L)
{
lua_newtable(L);
if(!ud) luaL_typerror(L, narg, className);
return *(EnvRef**)ud; // unbox pointer
}
-
+
// Exported functions
// EnvRef:add_node(pos, node)
EnvRef *o = checkobject(L, -1);
o->m_env = NULL;
}
-
+
static void Register(lua_State *L)
{
lua_newtable(L);
u32 active_object_count, u32 active_object_count_wider)
{
lua_State *L = m_lua;
-
+
realitycheck(L);
assert(lua_checkstack(L, 20));
StackUnroller stack_unroller(L);
lua_gettable(L, registered_abms);
if(lua_isnil(L, -1))
assert(0);
-
+
// Call action
luaL_checktype(L, -1, LUA_TTABLE);
lua_getfield(L, -1, "action");
// Get the writable item definition manager from the server
IWritableItemDefManager *idef =
get_server(L)->getWritableItemDefManager();
-
+
idef->registerAlias(name, convert_to);
-
+
return 0; /* number of results */
}
// Get the writable craft definition manager from the server
IWritableCraftDefManager *craftdef =
get_server(L)->getWritableCraftDefManager();
-
+
std::string type = getstringfield_default(L, table, "type", "shaped");
/*
v3s16 pos = check_v3s16(L, -1);
loc.setNodeMeta(pos);
}
-
+
if(get_server(L)->getInventory(loc) != NULL)
InvRef::create(L, loc);
else
lua_newtable(L);
luaL_register(L, NULL, minetest_f);
lua_setglobal(L, "minetest");
-
+
// Get the main minetest table
lua_getglobal(L, "minetest");
// Add tables to minetest
-
+
lua_newtable(L);
lua_setfield(L, -2, "object_refs");
lua_newtable(L);
<<"Only chararacters [a-z0-9_] are allowed."<<std::endl;
return false;
}
-
+
bool success = false;
try{
lua_getfield(L, -1, "registered_abms");
luaL_checktype(L, -1, LUA_TTABLE);
int registered_abms = lua_gettop(L);
-
+
if(lua_istable(L, registered_abms)){
int table = lua_gettop(L);
lua_pushnil(L);
LuaABM *abm = new LuaABM(L, id, trigger_contents,
required_neighbors, trigger_interval, trigger_chance);
-
+
env->addActiveBlockModifier(abm);
// removes value, keeps key for next iteration
lua_getfield(L, -1, "object_refs");
luaL_checktype(L, -1, LUA_TTABLE);
int objectstable = lua_gettop(L);
-
+
// object_refs[id] = object
lua_pushnumber(L, cobj->getId()); // Push id
lua_pushvalue(L, object); // Copy object to top of stack
lua_getfield(L, -1, "object_refs");
luaL_checktype(L, -1, LUA_TTABLE);
int objectstable = lua_gettop(L);
-
+
// Get object_refs[id]
lua_pushnumber(L, cobj->getId()); // Push id
lua_gettable(L, objectstable);
realitycheck(L);
assert(lua_checkstack(L, 20));
StackUnroller stack_unroller(L);
-
+
// Get minetest.registered_on_dieplayers
lua_getglobal(L, "minetest");
lua_getfield(L, -1, "registered_on_dieplayers");
infostream<<"scriptapi_luaentity_add: id="<<id<<" name=\""
<<name<<"\""<<std::endl;
StackUnroller stack_unroller(L);
-
+
// Get minetest.registered_entities[name]
lua_getglobal(L, "minetest");
lua_getfield(L, -1, "registered_entities");
}
int prototype_table = lua_gettop(L);
//dump2(L, "prototype_table");
-
+
// Create entity object
lua_newtable(L);
int object = lua_gettop(L);
// Set object metatable
lua_pushvalue(L, prototype_table);
lua_setmetatable(L, -2);
-
+
// Add object reference
// This should be userdata with metatable ObjectRef
objectref_get(L, id);
lua_pushnumber(L, id); // Push id
lua_pushvalue(L, object); // Copy object to top of stack
lua_settable(L, -3);
-
+
// Get on_activate function
lua_pushvalue(L, object);
lua_getfield(L, -1, "on_activate");
script_error(L, "error running function %s:on_activate: %s\n",
name, lua_tostring(L, -1));
}
-
+
return true;
}
lua_getfield(L, -1, "luaentities");
luaL_checktype(L, -1, LUA_TTABLE);
int objectstable = lua_gettop(L);
-
+
// Set luaentities[id] = nil
lua_pushnumber(L, id); // Push id
lua_pushnil(L);
lua_settable(L, objectstable);
-
+
lua_pop(L, 2); // pop luaentities, minetest
}
// Get minetest.luaentities[id]
luaentity_get(L, id);
int object = lua_gettop(L);
-
+
// Get get_staticdata function
lua_pushvalue(L, object);
lua_getfield(L, -1, "get_staticdata");
if(lua_isnil(L, -1))
return "";
-
+
luaL_checktype(L, -1, LUA_TFUNCTION);
lua_pushvalue(L, object); // self
// Call with 1 arguments, 1 results
if(lua_pcall(L, 1, 1, 0))
script_error(L, "error running function get_staticdata: %s\n",
lua_tostring(L, -1));
-
+
size_t len=0;
const char *s = lua_tolstring(L, -1, &len);
return std::string(s, len);
//int object = lua_gettop(L);
/* Read stuff */
-
+
getboolfield(L, -1, "physical", prop->physical);
getfloatfield(L, -1, "weight", prop->weight);
lua_pop(L, 1);
getstringfield(L, -1, "visual", prop->visual);
-
+
lua_getfield(L, -1, "visual_size");
if(lua_istable(L, -1))
prop->visual_size = read_v2f(L, -1);
}
}
lua_pop(L, 1);
-
+
lua_getfield(L, -1, "spritediv");
if(lua_istable(L, -1))
prop->spritediv = read_v2s16(L, -1);
os<<L"-!- You don't have permission to do that";
return;
}
-
+
Player *tp = ctx->env->getPlayer(wide_to_narrow(ctx->parms[1]).c_str());
if(tp == NULL)
{
os<<L"-!- No such player";
return;
}
-
+
os<<L"-!- " + narrow_to_wide(privsToString(ctx->server->getPlayerAuthPrivs(tp->getName())));
}
os<<L"-!- No such player";
return;
}
-
+
std::string playername = wide_to_narrow(ctx->parms[1]);
u64 privs = ctx->server->getPlayerAuthPrivs(playername);
msg += L"\"";
ctx->server->notifyPlayer(playername.c_str(), msg);
}
-
+
ctx->server->setPlayerAuthPrivs(playername, privs);
-
+
os<<L"-!- Privileges change to ";
os<<narrow_to_wide(privsToString(privs));
}
<<" shuts down server"<<std::endl;
ctx->server->requestShutdown();
-
+
os<<L"*** Server shutting down (operator request)";
ctx->flags |= SEND_TO_OTHERS;
}
ctx->parms[1] + L" = " + ctx->params[2]);*/
std::string confline = wide_to_narrow(ctx->paramstring);
-
+
actionstream<<ctx->player->getName()
<<" sets: "<<confline<<std::endl;
g_settings->parseConfigLine(confline);
-
+
ctx->server->saveConfig();
os<< L"-!- Setting changed and configuration saved.";
os<<L"-!- No such player";
return;
}
-
+
try{
Address address = ctx->server->getPeerAddress(player->peer_id);
std::string ip_string = address.serializeString();
actionstream<<ctx->player->getName()<<" bans "
<<player->getName()<<" / "<<ip_string<<std::endl;
- } catch(con::PeerNotFoundException){
+ } catch(con::PeerNotFoundException &){
dstream<<__FUNCTION_NAME<<": peer was not found"<<std::endl;
}
}
actionstream<<ctx->player->getName()
<<" clears all objects"<<std::endl;
-
+
{
std::wstring msg;
msg += L"Clearing all objects. This may take long.";
}
ctx->env->clearAllObjects();
-
+
actionstream<<"object clearing done"<<std::endl;
-
+
os<<L"*** cleared all objects";
ctx->flags |= SEND_TO_OTHERS;
}
cmd_clearobjects(os, ctx);
else
os<<L"-!- Invalid command: " + ctx->parms[0];
-
+
return os.str();
}