void Client::removeNode(v3s16 p)
{
- //JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
-
core::map<v3s16, MapBlock*> modified_blocks;
try
void Client::addNode(v3s16 p, MapNode n)
{
- //JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
-
TimeTaker timer1("Client::addNode()");
core::map<v3s16, MapBlock*> modified_blocks;
catch(InvalidPositionException &e)
{}
- //TimeTaker timer2("Client::addNode(): addUpdateMeshTaskWithEdge");
-
for(core::map<v3s16, MapBlock * >::Iterator
i = modified_blocks.getIterator();
i.atEnd() == false; i++)
}
}
-void Client::updateCamera(v3f pos, v3f dir, f32 fov)
-{
- m_env.getClientMap().updateCamera(pos, dir, fov);
-}
-
-void Client::renderPostFx()
-{
- m_env.getClientMap().renderPostFx();
-}
-
-MapNode Client::getNode(v3s16 p)
-{
- //JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
- return m_env.getMap().getNode(p);
-}
-
-NodeMetadata* Client::getNodeMetadata(v3s16 p)
-{
- return m_env.getMap().getNodeMetadata(p);
-}
-
-LocalPlayer* Client::getLocalPlayer()
-{
- return m_env.getLocalPlayer();
-}
-
void Client::setPlayerControl(PlayerControl &control)
{
//JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
class IWritableItemDefManager;
class IWritableNodeDefManager;
//class IWritableCraftDefManager;
+class ClientEnvironment;
class ClientNotReadyException : public BaseException
{
*/
void step(float dtime);
- // Called from updater thread
- // Returns dtime
- //float asyncStep();
-
void ProcessData(u8 *data, u32 datasize, u16 sender_peer_id);
// Returns true if something was received
bool AsyncProcessPacket();
bool AsyncProcessData();
void Send(u16 channelnum, SharedBuffer<u8> data, bool reliable);
- // Pops out a packet from the packet queue
- //IncomingPacket getPacket();
-
void interact(u8 action, const PointedThing& pointed);
void sendSignNodeText(v3s16 p, std::string text);
const std::wstring newpassword);
void sendDamage(u8 damage);
void sendRespawn();
+
+ ClientEnvironment& getEnv()
+ { return m_env; }
- // locks envlock
+ // Causes urgent mesh updates (unlike Map::add/removeNodeWithEvent)
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
- NodeMetadata* getNodeMetadata(v3s16 p);
-
- LocalPlayer* getLocalPlayer();
-
void setPlayerControl(PlayerControl &control);
void selectPlayerItem(u16 item);
selected_object = NULL;
INodeDefManager *nodedef = client->getNodeDefManager();
+ ClientMap &map = client->getEnv().getClientMap();
// First try to find a pointed at active object
if(look_for_object)
MapNode n;
try
{
- n = client->getNode(v3s16(x,y,z));
+ n = map.getNode(v3s16(x,y,z));
}
catch(InvalidPositionException &e)
{
Update camera
*/
- LocalPlayer* player = client.getLocalPlayer();
+ LocalPlayer* player = client.getEnv().getLocalPlayer();
float full_punch_interval = playeritem_toolcap.full_punch_interval;
float tool_reload_ratio = time_from_last_punch / full_punch_interval;
tool_reload_ratio = MYMIN(tool_reload_ratio, 1.0);
f32 camera_fov = camera.getFovMax();
if(!disable_camera_update){
- client.updateCamera(camera_position,
+ client.getEnv().getClientMap().updateCamera(camera_position,
camera_direction, camera_fov);
}
/*
Check information text of node
*/
-
- NodeMetadata *meta = client.getNodeMetadata(nodepos);
- if(meta)
- {
+
+ ClientMap &map = client.getEnv().getClientMap();
+ NodeMetadata *meta = map.getNodeMetadata(nodepos);
+ if(meta){
infotext = narrow_to_wide(meta->infoText());
- }
- else
- {
- MapNode n = client.getNode(nodepos);
+ } else {
+ MapNode n = map.getNode(nodepos);
if(nodedef->get(n).tname_tiles[0] == "unknown_block.png"){
infotext = L"Unknown node: ";
infotext += narrow_to_wide(nodedef->get(n).name);
Handle digging
*/
-
if(nodig_delay_timer <= 0.0 && input->getLeftState())
{
if(!digging)
digging = true;
ldown_for_dig = true;
}
- MapNode n = client.getNode(nodepos);
+ MapNode n = client.getEnv().getClientMap().getNode(nodepos);
// Get digging parameters
DigParams params = getDigParams(nodedef->get(n).groups,
Post effects
*/
{
- client.renderPostFx();
+ client.getEnv().getClientMap().renderPostFx();
}
/*