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