diff --git a/server/gameserver/mt/MetaMgr.cc b/server/gameserver/mt/MetaMgr.cc index 5af8eaf4..882261f2 100644 --- a/server/gameserver/mt/MetaMgr.cc +++ b/server/gameserver/mt/MetaMgr.cc @@ -37,6 +37,7 @@ #include "mt/MapCollider.h" #include "mt/Grasp.h" #include "mt/GraspBuff.h" +#include "mt/WorldObject.h" #include "app.h" @@ -103,6 +104,7 @@ namespace mt RegMetaTable(res_path_); RegMetaTable(res_path_); RegMetaTable(res_path_); + RegMetaTable(res_path_); } void MetaMgr::Load() diff --git a/server/gameserver/mt/WorldObject.cc b/server/gameserver/mt/WorldObject.cc new file mode 100644 index 00000000..7b869c5b --- /dev/null +++ b/server/gameserver/mt/WorldObject.cc @@ -0,0 +1,18 @@ +#include "precompile.h" + +#include "mt/WorldObject.h" + +IMPL_TABLE(mt::WorldObject) + +namespace mt +{ + + void WorldObject::Init1() + { + } + + void WorldObject::Init2() + { + } + +} diff --git a/server/gameserver/mt/WorldObject.h b/server/gameserver/mt/WorldObject.h new file mode 100644 index 00000000..dbb90554 --- /dev/null +++ b/server/gameserver/mt/WorldObject.h @@ -0,0 +1,19 @@ +#pragma once + +#include "mt/macro.h" +#include "mtb/WorldObject.h" + +namespace mt +{ + + DECLARE_AUTO_ID_TABLE(WorldObject, mtb::WorldObject, + "world_object@world_object.json" + ) + public: + + void Init1(); + void Init2(); + + }; + +} diff --git a/server/gameserver/mtb/WorldObject.h b/server/gameserver/mtb/WorldObject.h new file mode 100644 index 00000000..95c20509 --- /dev/null +++ b/server/gameserver/mtb/WorldObject.h @@ -0,0 +1,37 @@ +#pragma once + +#include + +namespace mtb +{ + + class WorldObject + { + public: + + a8::reflect::Class* GetClass() const; + int object_id() const { return object_id_; }; + int object_type() const { return object_type_; }; + float x() const { return x_; }; + float y() const { return y_; }; + float z() const { return z_; }; + + bool has_object_id() const { return __flags__.test(0);}; + bool has_object_type() const { return __flags__.test(1);}; + bool has_x() const { return __flags__.test(2);}; + bool has_y() const { return __flags__.test(3);}; + bool has_z() const { return __flags__.test(4);}; + + protected: + + int object_id_ = 0; + int object_type_ = 0; + float x_ = 0.0f; + float y_ = 0.0f; + float z_ = 0.0f; + +public: + std::bitset<5> __flags__; + }; + +}; diff --git a/server/gameserver/mtb/mtb.all.cc b/server/gameserver/mtb/mtb.all.cc index 0f5344a9..bf83bc5b 100644 --- a/server/gameserver/mtb/mtb.all.cc +++ b/server/gameserver/mtb/mtb.all.cc @@ -36,6 +36,7 @@ #include "mtb/RankRoom.h" #include "mtb/Grasp.h" #include "mtb/GraspBuff.h" +#include "mtb/WorldObject.h" namespace mtb { @@ -772,4 +773,18 @@ namespace mtb return meta_class; } + a8::reflect::Class* WorldObject::GetClass() const + { + a8::reflect::Class* meta_class = nullptr; + if (!meta_class) { + meta_class = new a8::reflect::Class("WorldObject", 5, 0); + meta_class->SetSimpleField(0, "object_id", a8::reflect::ET_INT32, my_offsetof2(WorldObject, object_id_)); + meta_class->SetSimpleField(1, "object_type", a8::reflect::ET_INT32, my_offsetof2(WorldObject, object_type_)); + meta_class->SetSimpleField(2, "x", a8::reflect::ET_FLOAT, my_offsetof2(WorldObject, x_)); + meta_class->SetSimpleField(3, "y", a8::reflect::ET_FLOAT, my_offsetof2(WorldObject, y_)); + meta_class->SetSimpleField(4, "z", a8::reflect::ET_FLOAT, my_offsetof2(WorldObject, z_)); + } + return meta_class; + } + } diff --git a/server/tools/protobuild/mt.proto b/server/tools/protobuild/mt.proto index e6d8b89a..6ee9b44f 100755 --- a/server/tools/protobuild/mt.proto +++ b/server/tools/protobuild/mt.proto @@ -573,3 +573,12 @@ message GraspBuff optional string attr_num = 10; optional string effect_list = 11; } + +message WorldObject +{ + optional int32 object_id= 1; + optional int32 object_type = 2; + optional float x = 3; + optional float y = 4; + optional float z = 5; +}