Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/wip5.8.0' into wip5.8.0-32
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Oct 14, 2024
2 parents 48633d6 + 3a8a804 commit 8797a69
Show file tree
Hide file tree
Showing 77 changed files with 3,575 additions and 1,974 deletions.
1 change: 1 addition & 0 deletions builtin/game/stat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ end
dig = "Digged",
drop = "Dropped",
join = "Join",
online = "Online",
move = "Traveled",
place = "Placed",
punch = "Punches",
Expand Down
2 changes: 1 addition & 1 deletion games/Repixture
Submodule Repixture updated from ee527c to 473995
22 changes: 13 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ if(NOT MSVC)
message(STATUS "Build with tcmalloc ${TCMALLOC_LIBRARY} ${PROFILER_LIBRARY}")
endif()

option(ENABLE_UNWIND "Enable unwind" 1)
# too noisy
option(ENABLE_UNWIND "Enable unwind" 0)
if(ENABLE_UNWIND)

if(USE_STATIC_LIBRARIES AND UNWIND_STATIC)
Expand Down Expand Up @@ -790,22 +791,25 @@ if (USE_DEBUG_HELPERS)
endif ()

set(FMcommon_SRCS ${FMcommon_SRCS}
circuit.cpp
circuit_element.cpp
circuit_element_virtual.cpp
key_value_storage.cpp
circuit_element.cpp
circuit.cpp
fm_abm_world.cpp
fm_bitset.cpp
fm_liquid.cpp
fm_map.cpp
fm_server.cpp
fm_world_merge.cpp
key_value_storage.cpp
log_types.cpp
profiler.cpp
stat.cpp
fm_liquid.cpp
fm_map.cpp
content_abm_grow_tree.cpp
content_abm.cpp
fm_abm.cpp
fm_clientiface.cpp
content_abm.cpp
content_abm_grow_tree.cpp
fm_serverenvironment.cpp
)
)


set(common_SRCS
Expand Down
2 changes: 2 additions & 0 deletions src/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ endif()
set(client_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/fm_far_calc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fm_farmesh.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fm_client.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fm_far_container.cpp

${sound_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/meshgen/collector.cpp
Expand Down
29 changes: 8 additions & 21 deletions src/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
#include <IFileSystem.h>
#include <json/json.h>
#include "client.h"
#include "client/fm_far_container.h"
#include "irr_v3d.h"
#include "network/clientopcodes.h"
#include "network/connection.h"
Expand Down Expand Up @@ -131,6 +132,8 @@ Client::Client(
GameUI *game_ui,
ELoginRegister allow_login_or_register
):
far_container{this},

m_simple_singleplayer_mode(is_simple_singleplayer_game),
m_tsrc(tsrc),
m_shsrc(shsrc),
Expand Down Expand Up @@ -174,6 +177,7 @@ Client::Client(
control.cell_size = m_mesh_grid.cell_size;
control.cell_size_pow = log(control.cell_size) / log(2);
control.farmesh_quality = g_settings->getU16("farmesh_quality");
control.farmesh_quality_pow = log(control.farmesh_quality) / log(2);
control.farmesh_stable = g_settings->getU16("farmesh_stable");
}

Expand Down Expand Up @@ -471,6 +475,8 @@ void Client::step(float dtime)
FATAL_ERROR_IF(myplayer == NULL, "Local player not found in environment.");

sendInit(myplayer->getName());

sendInitFm();
}

// Not connected, return
Expand Down Expand Up @@ -637,7 +643,7 @@ void Client::step(float dtime)

MapBlock *block = m_env.getMap().getBlockNoCreateNoEx(r.p);
if (!block && r.mesh)
block = m_env.getMap().createBlankBlock(r.p);
block = m_env.getMap().createBlankBlock(r.p).get();

if (block) {
// Delete the old mesh
Expand Down Expand Up @@ -1160,7 +1166,7 @@ void Client::ProcessData(NetworkPacket *pkt)
<< toClientCommandTable[command].name
<< "] state=" << (int)toClientCommandTable[command].state
<< " size=" << pkt->getSize()
<< std::endl;
<< "\n";
#endif

/*
Expand Down Expand Up @@ -2002,25 +2008,6 @@ void Client::addUpdateMeshTaskForNode(v3pos_t nodepos, bool ack_to_server, bool
addUpdateMeshTask(blockpos + v3bpos_t(0, 0, -1), false, urgent);
}

void Client::updateMeshTimestampWithEdge(v3bpos_t blockpos) {
for (const auto & dir : g_7dirs_b) {
auto *block = m_env.getMap().getBlockNoCreateNoEx(blockpos + dir);
if(!block)
continue;
block->setTimestampNoChangedFlag(m_uptime);
}

/*int to = FARMESH_STEP_MAX;
for (int step = 1; step <= to; ++step) {
v3pos_t actualpos = getFarmeshActual(blockpos, step);
auto *block = m_env.getMap().getBlockNoCreateNoEx(actualpos); // todo maybe update bp1 too if differ
if(!block)
continue;
block->setTimestampNoChangedFlag(m_uptime);
}*/

}

void Client::updateCameraOffset(v3pos_t camera_offset)
{
m_mesh_update_manager->m_camera_offset = camera_offset;
Expand Down
62 changes: 35 additions & 27 deletions src/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
#pragma once

//fm:
#include "client/fm_far_container.h"
#include "map_settings_manager.h"
#include "msgpack_fix.h"
#include "network/fm_connection_use.h"
Expand All @@ -31,6 +32,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
#include "clientenvironment.h"
#include "irr_v3d.h"
#include "irrlichttypes_extrabloated.h"
#include <atomic>
#include <ostream>
#include <map>
#include <memory>
Expand Down Expand Up @@ -127,6 +129,39 @@ class GameUI;

class Client : public con::PeerHandler, public InventoryManager, public IGameDef
{

private:
//fm:
bool is_simple_singleplayer_game {};
float m_timelapse_timer {-1};

public:
std::atomic<double> m_uptime {};
bool use_weather {};
unsigned int overload {};

void handleCommand_FreeminerInit(NetworkPacket *pkt);
void handleCommand_BlockDataFm(NetworkPacket *pkt);
void sendInitFm();
void sendDrawControl();
void sendGetBlocks();
void updateMeshTimestampWithEdge(const v3bpos_t &blockpos);
void createFarMesh(MapBlockP &block);

std::unique_ptr<Server> m_localserver;
std::string m_world_path;
std::unique_ptr<EmergeManager> m_emerge;
std::unique_ptr<MapgenParams> m_mapgen_params;
std::unique_ptr<MapSettingsManager> m_settings_mgr;
//concurrent_unordered_map<v3bpos_t, bool> farmesh_remake;
f32 fog_range {};
std::atomic_size_t m_new_meshes {};
size_t m_new_farmeshes {};
ChatBackend *chat_backend {};
FarContainer far_container;

// ==

public:
/*
NOTE: Nothing is thread-safe here.
Expand Down Expand Up @@ -422,8 +457,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef

void makeScreenshot(const std::string & name = "screenshot_");

ChatBackend *chat_backend;

inline void pushToChatQueue(ChatMessage *cec)
{
m_chat_queue.push(cec);
Expand Down Expand Up @@ -605,31 +638,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
// key = name
std::unordered_map<std::string, Inventory*> m_detached_inventories;


//fm:
bool is_simple_singleplayer_game = 0;
float m_timelapse_timer = -1;
public:
double m_uptime = 0;
bool use_weather = false;
unsigned int overload = 0;

void updateMeshTimestampWithEdge(v3bpos_t blockpos);
void handleCommand_FreeminerInit(NetworkPacket* pkt);
void sendDrawControl();

std::unique_ptr<Server> m_localserver;
std::string m_world_path;
std::unique_ptr<EmergeManager> m_emerge;
std::unique_ptr<MapgenParams> m_mapgen_params;
std::unique_ptr<MapSettingsManager> m_settings_mgr;
//concurrent_unordered_map<v3bpos_t, bool> farmesh_remake;
f32 fog_range = 0;
size_t m_new_meshes = 0;

private:


// Storage for mesh data for creating multiple instances of the same mesh
StringMap m_mesh_data;

Expand Down
Loading

0 comments on commit 8797a69

Please sign in to comment.