Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Dec 18, 2024
1 parent 85122f8 commit 7d16d1e
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion games/Repixture
Submodule Repixture updated from 473995 to 0187aa
2 changes: 1 addition & 1 deletion games/default
Submodule default updated 93 files
+12 −13 README.md
+1 −2 game.conf
+18 −4 game_api.txt
+2 −1 minetest.conf.example
+2 −2 mods/beds/README.txt
+1 −1 mods/beds/license.txt
+10 −0 mods/beds/locale/beds.lv.tr
+3 −0 mods/binoculars/locale/binoculars.lv.tr
+1 −1 mods/boats/README.txt
+1 −1 mods/boats/license.txt
+4 −0 mods/boats/locale/boats.lv.tr
+1 −1 mods/bones/README.txt
+27 −12 mods/bones/init.lua
+1 −1 mods/bones/license.txt
+8 −0 mods/bones/locale/bones.lv.tr
+1 −1 mods/bucket/README.txt
+1 −1 mods/bucket/init.lua
+1 −1 mods/bucket/license.txt
+5 −0 mods/bucket/locale/bucket.lv.tr
+4 −24 mods/butterflies/init.lua
+4 −0 mods/butterflies/locale/butterflies.lv.tr
+1 −1 mods/carts/license.txt
+6 −0 mods/carts/locale/carts.lv.tr
+11 −0 mods/creative/locale/creative.lv.tr
+1 −1 mods/default/README.txt
+22 −5 mods/default/functions.lua
+1 −1 mods/default/init.lua
+1 −1 mods/default/license.txt
+215 −0 mods/default/locale/default.lv.tr
+1 −1 mods/doors/README.txt
+1 −1 mods/doors/license.txt
+18 −0 mods/doors/locale/doors.lv.tr
+1 −1 mods/dye/README.txt
+1 −1 mods/dye/license.txt
+16 −0 mods/dye/locale/dye.lv.tr
+1 −1 mods/farming/README.txt
+1 −1 mods/farming/license.txt
+28 −0 mods/farming/locale/farming.lv.tr
+1 −1 mods/fire/README.txt
+1 −1 mods/fire/license.txt
+4 −0 mods/fire/locale/fire.lv.tr
+9 −45 mods/fireflies/init.lua
+5 −0 mods/fireflies/locale/fireflies.lv.tr
+1 −1 mods/flowers/README.txt
+1 −1 mods/flowers/init.lua
+1 −1 mods/flowers/license.txt
+12 −0 mods/flowers/locale/flowers.lv.tr
+4 −0 mods/game_commands/locale/game_commands.lv.tr
+1 −1 mods/give_initial_stuff/README.txt
+1 −1 mods/give_initial_stuff/license.txt
+1 −1 mods/keys/README.txt
+1 −1 mods/keys/init.lua
+1 −1 mods/keys/license.txt
+5 −0 mods/keys/locale/keys.lv.tr
+3 −0 mods/map/locale/map.lv.tr
+1 −1 mods/mobs_animal
+1 −1 mods/mobs_monster
+1 −1 mods/mobs_npc
+1 −1 mods/mobs_redo
+53 −0 mods/mtg_craftguide/locale/mtg_craftguide.lv.tr
+1 −1 mods/player_api/README.txt
+1 −1 mods/player_api/license.txt
+1 −1 mods/screwdriver/README.txt
+1 −1 mods/screwdriver/license.txt
+3 −0 mods/screwdriver/locale/screwdriver.lv.tr
+9 −0 mods/sethome/locale/sethome.lv.tr
+2 −2 mods/sfinv/README.txt
+2 −0 mods/sfinv/locale/sfinv.lv.tr
+4 −1 mods/spawn/init.lua
+1 −1 mods/stairs/README.txt
+1 −1 mods/stairs/init.lua
+1 −1 mods/stairs/license.txt
+145 −0 mods/stairs/locale/stairs.lv.tr
+2 −3 mods/tnt/README.txt
+1 −1 mods/tnt/license.txt
+4 −0 mods/tnt/locale/tnt.lv.tr
+1 −1 mods/vessels/README.txt
+1 −1 mods/vessels/init.lua
+1 −1 mods/vessels/license.txt
+8 −0 mods/vessels/locale/vessels.lv.tr
+1 −1 mods/walls/init.lua
+4 −0 mods/walls/locale/walls.lv.tr
+8 −2 mods/weather/init.lua
+1 −1 mods/wool/README.txt
+1 −1 mods/wool/license.txt
+16 −0 mods/wool/locale/wool.lv.tr
+1 −1 mods/xpanes/README.txt
+1 −1 mods/xpanes/license.txt
+6 −0 mods/xpanes/locale/xpanes.lv.tr
+1 −1 schematic_tables.txt
+2 −1 settingtypes.txt
+3 −3 utils/test/run.sh
+0 −7 utils/test/world.mt
1 change: 1 addition & 0 deletions src/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Client::Client(
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");
control.farmesh_all_changed = g_settings->getPos("farmesh_all_changed");
}

void Client::migrateModStorage()
Expand Down
1 change: 0 additions & 1 deletion src/client/clientmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,

#include "clientmap.h"
#include "client.h"
#include "client/fm_far_calc.h"
#include "client/mesh.h"
#include "mapblock_mesh.h"
#include <IMaterialRenderer.h>
Expand Down
1 change: 1 addition & 0 deletions src/client/clientmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct MapDrawControl
int32_t farmesh{30000};
uint8_t farmesh_quality{};
bool farmesh_stable{};
pos_t farmesh_all_changed{};
int32_t lodmesh{4};
int cell_size{1};
uint8_t cell_size_pow{};
Expand Down
6 changes: 3 additions & 3 deletions src/client/fm_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void Client::handleCommand_BlockDataFm(NetworkPacket *pkt)
} else {
static thread_local const auto farmesh_server =
g_settings->getU16("farmesh_server");
if (!farmesh_server){
if (!farmesh_server) {
return;
}

Expand Down Expand Up @@ -341,7 +341,7 @@ void Client::handleCommand_BlockDataFm(NetworkPacket *pkt)

void Client::sendDrawControl()
{
MSGPACK_PACKET_INIT((int)TOSERVER_DRAWCONTROL, 3);
MSGPACK_PACKET_INIT((int)TOSERVER_DRAWCONTROL, 4);
const auto &draw_control = m_env.getClientMap().getControl();
PACK(TOSERVER_DRAWCONTROL_WANTED_RANGE, (int32_t)draw_control.wanted_range);
//PACK(TOSERVER_DRAWCONTROL_RANGE_ALL, draw_control.range_all);
Expand All @@ -351,7 +351,7 @@ void Client::sendDrawControl()
//PACK(TOSERVER_DRAWCONTROL_BLOCK_OVERFLOW, false /*draw_control.block_overflow*/);
//PACK(TOSERVER_DRAWCONTROL_LODMESH, draw_control.lodmesh);
PACK(TOSERVER_DRAWCONTROL_FARMESH_QUALITY, draw_control.farmesh_quality);

PACK(TOSERVER_DRAWCONTROL_FARMESH_ALL_CHANGED, draw_control.farmesh_all_changed);

NetworkPacket pkt(TOSERVER_DRAWCONTROL, buffer.size());
pkt.putLongString({buffer.data(), buffer.size()});
Expand Down
1 change: 1 addition & 0 deletions src/clientiface.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ class RemoteClient
std::atomic_bool range_all{};
std::atomic_int farmesh{};
uint8_t farmesh_quality{};
pos_t farmesh_all_changed{};
bool have_farmesh_quality{};
float fov{72};
//bool block_overflow;
Expand Down
2 changes: 1 addition & 1 deletion src/defaultsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void fm_set_default_settings(Settings *settings) {
settings->setDefault("farmesh_quality", slow ? "1" : "2"); //depends on client_mesh_chunk
settings->setDefault("farmesh_stable", "0");
settings->setDefault("farmesh_server", "1");
settings->setDefault("farmesh_all_changed", "10000");
settings->setDefault("farmesh_all_changed", slow ? "1000" : "10000");

settings->setDefault("headless_optimize", "false");
//settings->setDefault("node_highlighting", "halo");
Expand Down
16 changes: 8 additions & 8 deletions src/fm_clientiface.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "fm_far_calc.h"
#include "constants.h"
#include "server/clientiface.h"
#include "clientiface.h"
#include "irr_v3d.h"
#include "irrlichttypes.h"
#include "map.h"
Expand Down Expand Up @@ -622,20 +622,20 @@ uint32_t RemoteClient::SendFarBlocks()

const auto cell_size = 1; // FMTODO from remoteclient
const auto cell_size_pow = log(cell_size) / log(2);

thread_local static const s16 farmesh_all_changed =
thread_local static const s16 setting_farmesh_all_changed =
g_settings->getU32("farmesh_all_changed");

const auto &use_farmesh_all_changed =
std::min(setting_farmesh_all_changed, farmesh_all_changed);
runFarAll(cbpos, cell_size_pow, farmesh_quality, false,
[this, &ordered, &cbpos](
[this, &ordered, &cbpos, &use_farmesh_all_changed](
const v3bpos_t &bpos, const bpos_t &size) -> bool {
if (!size) {
return false;
};

// TODO: use block center
const auto bdist = radius_box(cbpos, bpos);
if (bdist << MAP_BLOCKP > farmesh_all_changed) {
if (bdist << MAP_BLOCKP > use_farmesh_all_changed) {
return false;
}

Expand All @@ -647,15 +647,15 @@ uint32_t RemoteClient::SendFarBlocks()
if (sent_ts < 0) { // <=
return false;
}
const auto dbase = GetFarDatabase(m_env->m_map->m_db.dbase,
const auto dbase = GetFarDatabase(m_env->m_map->dbase,
m_env->m_server->far_dbases, m_env->m_map->m_savedir,
step);
if (!dbase) {
sent_ts = -1;
return false;
}
const auto block =
loadBlockNoStore(m_env->m_map.get(), dbase, bpos);
loadBlockNoStore(m_env->m_map, dbase, bpos);
if (!block) {
sent_ts = -1;
return false;
Expand Down
8 changes: 7 additions & 1 deletion src/fm_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
#include "database/database.h"
#include "emerge.h"
#include "filesys.h"
#include "irrlichttypes.h"
#include "porting.h"
#include "fm_world_merge.h"
#include "irrTypes.h"
#include "irr_v3d.h"
Expand Down Expand Up @@ -540,7 +542,7 @@ void Server::handleCommand_Drawcontrol(NetworkPacket *pkt)
}*/

auto client = getClientNoEx(peer_id, CS_Created);
if (!client){
if (!client) {
return;
}
{
Expand All @@ -558,6 +560,10 @@ void Server::handleCommand_Drawcontrol(NetworkPacket *pkt)
packet[TOSERVER_DRAWCONTROL_FARMESH_QUALITY].as<uint8_t>();
client->have_farmesh_quality = true;
}
if (packet.contains(TOSERVER_DRAWCONTROL_FARMESH_ALL_CHANGED)) {
client->farmesh_all_changed =
packet[TOSERVER_DRAWCONTROL_FARMESH_ALL_CHANGED].as<pos_t>();
}
}
//client->block_overflow = packet[TOSERVER_DRAWCONTROL_BLOCK_OVERFLOW].as<bool>();

Expand Down
1 change: 1 addition & 0 deletions src/network/fm_networkprotocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,4 +499,5 @@ enum
TOSERVER_DRAWCONTROL_BLOCK_OVERFLOW, // not used
TOSERVER_DRAWCONTROL_LODMESH,
TOSERVER_DRAWCONTROL_FARMESH_QUALITY,
TOSERVER_DRAWCONTROL_FARMESH_ALL_CHANGED,
};

0 comments on commit 7d16d1e

Please sign in to comment.