*
This commit is contained in:
@@ -131,6 +131,9 @@ struct DefItemInfo {
|
||||
|
||||
};
|
||||
|
||||
struct DefVoxel_t {};
|
||||
struct DefNode_t {};
|
||||
|
||||
/* Интерфейс обработчика сессии с сервером */
|
||||
class IServerSession {
|
||||
struct ArrayHasher {
|
||||
|
||||
@@ -622,24 +622,24 @@ coro<> ServerSession::rP_Definition(Net::AsyncSocket &sock) {
|
||||
}
|
||||
case ToClient::L2Definition::Node:
|
||||
{
|
||||
DefNodeId id;
|
||||
DefNode_t def;
|
||||
id = co_await sock.read<DefNodeId>();
|
||||
def.DrawType = (DefNode_t::EnumDrawType) co_await sock.read<uint8_t>();
|
||||
for(int iter = 0; iter < 6; iter++) {
|
||||
auto &pl = def.Texs[iter].Pipeline;
|
||||
pl.resize(co_await sock.read<uint16_t>());
|
||||
co_await sock.read((std::byte*) pl.data(), pl.size());
|
||||
}
|
||||
// DefNodeId id;
|
||||
// DefNode_t def;
|
||||
// id = co_await sock.read<DefNodeId>();
|
||||
// def.DrawType = (DefNode_t::EnumDrawType) co_await sock.read<uint8_t>();
|
||||
// for(int iter = 0; iter < 6; iter++) {
|
||||
// auto &pl = def.Texs[iter].Pipeline;
|
||||
// pl.resize(co_await sock.read<uint16_t>());
|
||||
// co_await sock.read((std::byte*) pl.data(), pl.size());
|
||||
// }
|
||||
|
||||
PP_Definition_Node *packet = new PP_Definition_Node(
|
||||
id,
|
||||
def
|
||||
);
|
||||
// PP_Definition_Node *packet = new PP_Definition_Node(
|
||||
// id,
|
||||
// def
|
||||
// );
|
||||
|
||||
while(!NetInputPackets.push(packet));
|
||||
// while(!NetInputPackets.push(packet));
|
||||
|
||||
co_return;
|
||||
// co_return;
|
||||
}
|
||||
case ToClient::L2Definition::FreeNode:
|
||||
{
|
||||
|
||||
@@ -2231,12 +2231,24 @@ void Vulkan::gui_ConnectedToServer() {
|
||||
std::string text = std::to_string(ImGui::GetIO().Framerate);
|
||||
ImGui::Text(text.c_str());
|
||||
if(ImGui::Button("Выйти")) {
|
||||
Game.RSession->pushStage(EnumRenderStage::Shutdown);
|
||||
Game.Session->shutdown(EnumDisconnect::ByInterface);
|
||||
try {
|
||||
if(Game.Session)
|
||||
Game.Session->shutdown(EnumDisconnect::ByInterface);
|
||||
} catch(const std::exception &exc) {
|
||||
LOG.error() << "Game.Session->shutdown: " << exc.what();
|
||||
}
|
||||
|
||||
Game.RSession = nullptr;
|
||||
Game.Session = nullptr;
|
||||
Game.ImGuiInterfaces.pop_back();
|
||||
int mode = glfwGetInputMode(Graphics.Window, GLFW_CURSOR);
|
||||
if(mode != GLFW_CURSOR_NORMAL)
|
||||
glfwSetInputMode(Graphics.Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
|
||||
if(!Game.RSession)
|
||||
return;
|
||||
}
|
||||
|
||||
if(Game.Session->isConnected())
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <boost/json.hpp>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
|
||||
|
||||
namespace LV {
|
||||
|
||||
@@ -93,7 +93,7 @@ private:
|
||||
std::vector<std::unique_ptr<TableEntry<DataEntry>>> Table[(int) EnumAssets::MAX_ENUM];
|
||||
|
||||
// Распаршенные ресурсы, для использования сервером
|
||||
std::vector<std::unique_ptr<TableEntry<DefNodeState>>> Table_NodeState;
|
||||
// std::vector<std::unique_ptr<TableEntry<DefNodeState>>> Table_NodeState;
|
||||
std::vector<std::unique_ptr<TableEntry<DefModel>>> Table_Model;
|
||||
|
||||
// Связь домены -> {ключ -> идентификатор}
|
||||
|
||||
@@ -1651,12 +1651,12 @@ void GameServer::initLuaPre() {
|
||||
Content.CM.registerBase(type, CurrentModId, *result[2], profile);
|
||||
};
|
||||
|
||||
core.set_function("register_voxel", [&](const std::string& key, const sol::table& profile) { reg(EnumDefContent::Voxel, key, profile); });
|
||||
core.set_function("register_node", [&](const std::string& key, const sol::table& profile) { reg(EnumDefContent::Node, key, profile); });
|
||||
core.set_function("register_world", [&](const std::string& key, const sol::table& profile) { reg(EnumDefContent::World, key, profile); });
|
||||
core.set_function("register_portal", [&](const std::string& key, const sol::table& profile) { reg(EnumDefContent::Portal, key, profile); });
|
||||
core.set_function("register_entity", [&](const std::string& key, const sol::table& profile) { reg(EnumDefContent::Entity, key, profile); });
|
||||
core.set_function("register_item", [&](const std::string& key, const sol::table& profile) { reg(EnumDefContent::Item, key, profile); });
|
||||
core.set_function("register_voxel", [reg](const std::string& key, const sol::table& profile) { reg(EnumDefContent::Voxel, key, profile); });
|
||||
core.set_function("register_node", [reg](const std::string& key, const sol::table& profile) { reg(EnumDefContent::Node, key, profile); });
|
||||
core.set_function("register_world", [reg](const std::string& key, const sol::table& profile) { reg(EnumDefContent::World, key, profile); });
|
||||
core.set_function("register_portal", [reg](const std::string& key, const sol::table& profile) { reg(EnumDefContent::Portal, key, profile); });
|
||||
core.set_function("register_entity", [reg](const std::string& key, const sol::table& profile) { reg(EnumDefContent::Entity, key, profile); });
|
||||
core.set_function("register_item", [reg](const std::string& key, const sol::table& profile) { reg(EnumDefContent::Item, key, profile); });
|
||||
}
|
||||
|
||||
void GameServer::initLua() {
|
||||
@@ -2364,9 +2364,11 @@ void GameServer::stepSyncContent() {
|
||||
Pos::bvec4u cPos = (node >> 4) & 0x3;
|
||||
Pos::bvec16u nPos = node & 0xf;
|
||||
|
||||
auto ®ion = Expanse.Worlds[0]->Regions[rPos];
|
||||
region->Nodes[cPos.pack()][nPos.pack()].NodeId = 4;
|
||||
region->IsChunkChanged_Nodes |= 1ull << cPos.pack();
|
||||
auto region = Expanse.Worlds[0]->Regions.find(rPos);
|
||||
if(region != Expanse.Worlds[0]->Regions.end()) {
|
||||
region->second->Nodes[cPos.pack()][nPos.pack()].NodeId = 4;
|
||||
region->second->IsChunkChanged_Nodes |= 1ull << cPos.pack();
|
||||
}
|
||||
}
|
||||
|
||||
while(!remoteClient->Break.empty()) {
|
||||
@@ -2377,9 +2379,11 @@ void GameServer::stepSyncContent() {
|
||||
Pos::bvec4u cPos = (node >> 4) & 0x3;
|
||||
Pos::bvec16u nPos = node & 0xf;
|
||||
|
||||
auto ®ion = Expanse.Worlds[0]->Regions[rPos];
|
||||
region->Nodes[cPos.pack()][nPos.pack()].NodeId = 0;
|
||||
region->IsChunkChanged_Nodes |= 1ull << cPos.pack();
|
||||
auto region = Expanse.Worlds[0]->Regions.find(rPos);
|
||||
if(region != Expanse.Worlds[0]->Regions.end()) {
|
||||
region->second->Nodes[cPos.pack()][nPos.pack()].NodeId = 0;
|
||||
region->second->IsChunkChanged_Nodes |= 1ull << cPos.pack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user