Compare commits
47 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c47167c2c9 | ||
![]() |
eabd540021 | ||
![]() |
4f822967d4 | ||
![]() |
12feeffafb | ||
![]() |
c3c0bc5d29 | ||
![]() |
d0f9a9b30e | ||
![]() |
9fa4062b82 | ||
![]() |
b68a232135 | ||
![]() |
8ef59c6030 | ||
![]() |
9c00a80f3d | ||
![]() |
681697d647 | ||
![]() |
976712c9d4 | ||
![]() |
bf283f2ac9 | ||
![]() |
5214bc056e | ||
![]() |
4f5b8d0d9b | ||
![]() |
3226878c93 | ||
![]() |
b2bb8cc9e9 | ||
![]() |
8315b155d6 | ||
![]() |
d6a684dd10 | ||
![]() |
cb37f0db76 | ||
![]() |
c79b8453a9 | ||
![]() |
f6f0e5a6bf | ||
![]() |
55516aee64 | ||
![]() |
943fd1415c | ||
![]() |
c66ce54497 | ||
![]() |
4c775a46a9 | ||
![]() |
0481a7d088 | ||
![]() |
a5400d027f | ||
![]() |
13cd59f9a8 | ||
![]() |
7ad03facd1 | ||
![]() |
8c3ecf7a26 | ||
![]() |
9b7c7a0f9b | ||
![]() |
f7678c47fd | ||
![]() |
301df577f1 | ||
![]() |
f93847711d | ||
![]() |
d348de32fb | ||
![]() |
c9ab65044e | ||
![]() |
07ed1c345d | ||
![]() |
e1ef898c0f | ||
![]() |
01b4969583 | ||
![]() |
b1e980950a | ||
![]() |
afa835f36d | ||
![]() |
08f442aa9c | ||
![]() |
35f73b8344 | ||
![]() |
385d95c248 | ||
![]() |
ae1ab3b1ee | ||
![]() |
95d4c99416 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -29,4 +29,5 @@ x64
|
||||
*.settings/
|
||||
server/gameserver/.gitignore
|
||||
gameserver.cbp
|
||||
behaviac_generated
|
||||
behaviac_generated
|
||||
node_modules/
|
@ -28,5 +28,6 @@ void FragMiTask::Done()
|
||||
center,
|
||||
explosion_range,
|
||||
gun_meta->explosion_effect(),
|
||||
GetAtk());
|
||||
GetAtk()
|
||||
);
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "glmhelper.h"
|
||||
#include "mapinstance.h"
|
||||
#include "bornpoint.h"
|
||||
#include "killmgr.h"
|
||||
#include "movement.h"
|
||||
|
||||
#include "mt/Param.h"
|
||||
@ -253,7 +254,7 @@ void Incubator::AutoAllocAndroid()
|
||||
{
|
||||
if (!hold_humans_.empty() && hold_humans_.size() > 6) {
|
||||
Human* hum = hold_humans_[0];
|
||||
if (room->GetGasData().GetGasMode() == GasWaiting &&
|
||||
if (room->GetGasData().GetGasMode() == GasMoving &&
|
||||
hold_humans_.size() > 1 &&
|
||||
((rand() % 100) > 70)) {
|
||||
Human* killer = nullptr;
|
||||
@ -274,8 +275,10 @@ void Incubator::AutoAllocAndroid()
|
||||
VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"));
|
||||
} else {
|
||||
KillMgr::Instance()->UnSetAutoDie();
|
||||
return;
|
||||
}
|
||||
KillMgr::Instance()->UnSetAutoDie();
|
||||
hold_humans_.erase(hold_humans_.begin());
|
||||
room->xtimer.ModifyTime(alloc_timer_, SERVER_FRAME_RATE * (30 + rand() % 5));
|
||||
}
|
||||
|
@ -70,6 +70,9 @@ void KillMgr::UnInit()
|
||||
|
||||
void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hint_info)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::string dbg_str;
|
||||
#endif
|
||||
hint_info.dead_name = dead_hum->GetName();
|
||||
|
||||
switch (info->killer_id) {
|
||||
@ -78,6 +81,14 @@ void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hin
|
||||
hint_info.killer_name = "";
|
||||
hint_info.hint_template = mt::Text::GetTextElements
|
||||
("battle_server_dead_text_gas");
|
||||
#ifdef DEBUG
|
||||
dbg_str = a8::Format("死者:%s(%s) 凶手:%s",
|
||||
{
|
||||
dead_hum->name,
|
||||
dead_hum->IsAndroid() ? "机器人" : "玩家",
|
||||
"毒圈"
|
||||
});
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case VP_Buff:
|
||||
@ -89,6 +100,14 @@ void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hin
|
||||
hint_info.hint_template = mt::Text::GetTextElements
|
||||
("battle_server_dead_text_buff_default");
|
||||
}
|
||||
#ifdef DEBUG
|
||||
dbg_str = a8::Format("死者:%s(%s) 凶手:%s",
|
||||
{
|
||||
dead_hum->name,
|
||||
dead_hum->IsAndroid() ? "机器人" : "玩家",
|
||||
"buff"
|
||||
});
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case VP_Explosion:
|
||||
@ -100,6 +119,14 @@ void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hin
|
||||
hint_info.hint_template = mt::Text::GetTextElements
|
||||
("battle_server_dead_text_explosion_default");
|
||||
}
|
||||
#ifdef DEBUG
|
||||
dbg_str = a8::Format("死者:%s(%s) 凶手:%s",
|
||||
{
|
||||
dead_hum->name,
|
||||
dead_hum->IsAndroid() ? "机器人" : "玩家",
|
||||
"炸弹"
|
||||
});
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case VP_Water:
|
||||
@ -107,6 +134,14 @@ void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hin
|
||||
hint_info.killer_name = "";
|
||||
hint_info.hint_template = mt::Text::GetTextElements
|
||||
("battle_server_dead_text_drown");
|
||||
#ifdef DEBUG
|
||||
dbg_str = a8::Format("死者:%s(%s) 凶手:%s",
|
||||
{
|
||||
dead_hum->name,
|
||||
dead_hum->IsAndroid() ? "机器人" : "玩家",
|
||||
"水"
|
||||
});
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -124,14 +159,38 @@ void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hin
|
||||
//${dead.name} 自杀
|
||||
hint_info.hint_template = mt::Text::GetTextElements
|
||||
("battle_server_dead_text_specate");
|
||||
#ifdef DEBUG
|
||||
dbg_str = a8::Format("死者:%s(%s) 凶手:%s(%s)",
|
||||
{
|
||||
dead_hum->name,
|
||||
dead_hum->IsAndroid() ? "机器人" : "玩家",
|
||||
dead_hum->name,
|
||||
dead_hum->IsAndroid() ? "机器人" : "玩家"
|
||||
});
|
||||
#endif
|
||||
} else {
|
||||
//${killer.name} 使用 ${weapon.text_icon} 干掉了 ${dead.name}
|
||||
hint_info.hint_template = mt::Text::GetTextElements
|
||||
("battle_server_dead_text_weapon");
|
||||
#ifdef DEBUG
|
||||
if (killer->IsCreature(dead_hum->room)) {
|
||||
dbg_str = a8::Format("死者:%s(%s) 凶手:%s(%s)",
|
||||
{
|
||||
dead_hum->name,
|
||||
dead_hum->IsAndroid() ? "机器人" : "玩家",
|
||||
((Creature*)killer)->GetName(),
|
||||
((Creature*)killer)->IsAndroid() ? "机器人" : "玩家"
|
||||
});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
dbg_str = a8::Format("是否自动死亡:%d ", {is_auto_die_ ? 1 : 0}) + dbg_str;
|
||||
dead_hum->room->BroadcastDebugMsg(dbg_str);
|
||||
#endif
|
||||
}
|
||||
|
@ -45,6 +45,8 @@ class KillMgr : public a8::Singleton<KillMgr>
|
||||
void Init();
|
||||
void UnInit();
|
||||
void OnHumanDead(Human* dead_hum, KillInfo* info);
|
||||
void SetAutoDie() { is_auto_die_ = true; };
|
||||
void UnSetAutoDie() { is_auto_die_ = false; };
|
||||
|
||||
private:
|
||||
void FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hint_info);
|
||||
@ -61,5 +63,8 @@ private:
|
||||
std::shared_ptr<cs::SMRollMsg> pb_msg);
|
||||
|
||||
|
||||
private:
|
||||
bool is_auto_die_ = false;
|
||||
|
||||
friend class PBUtils;
|
||||
};
|
||||
|
@ -126,7 +126,7 @@ namespace mc
|
||||
{
|
||||
node->name
|
||||
});
|
||||
childs[node->name] = node;
|
||||
childs[a8::Format("%s_%d", {node->name, i + 1})] = node;
|
||||
#else
|
||||
A8_ABORT();
|
||||
#endif
|
||||
@ -155,8 +155,19 @@ namespace mc
|
||||
dirs.push_back(glm::vec3(-extends.x, -extends.y, -extends.z));
|
||||
dirs.push_back(glm::vec3(-extends.x, -extends.y, extends.z));
|
||||
for (const glm::vec3& dir : dirs) {
|
||||
points.push_back(center + dir);
|
||||
points.push_back(center + quat * dir);
|
||||
}
|
||||
}
|
||||
|
||||
std::string ColliderNode::GetPath()
|
||||
{
|
||||
std::string path = name;
|
||||
ColliderNode* node = this;
|
||||
while (node && node->parent) {
|
||||
path = node->parent->name + "/" + path;
|
||||
node = node->parent;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -104,6 +104,7 @@ namespace mc
|
||||
std::map<std::string, std::shared_ptr<ColliderNode>> childs;
|
||||
|
||||
void Read(std::shared_ptr<a8::XObject> xobj);
|
||||
std::string GetPath();
|
||||
};
|
||||
|
||||
void RotateBounds(const glm::vec3& center,
|
||||
|
@ -1125,10 +1125,10 @@ bool MapInstance::SceneRaycast(const glm::vec3& orig,
|
||||
} while (!end);
|
||||
|
||||
if (result) {
|
||||
#ifdef DEBUG1
|
||||
#ifdef DEBUG
|
||||
if (DebugCmd::Enable()) {
|
||||
a8::XPrintf("nearest_node:%s tri_count:%d nearest_distance:%f\n",
|
||||
{nearest_node->tri->node->name,
|
||||
{nearest_node->tri->node->GetPath(),
|
||||
tri_count,
|
||||
nearest_distance});
|
||||
}
|
||||
|
@ -88,6 +88,11 @@ bool MapService::CanAdd(const glm::vec3& pos, int rad)
|
||||
|
||||
void MapService::AddTriangle(mc::Triangle* tri)
|
||||
{
|
||||
#if 0
|
||||
if (tri->node->name == "water03") {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
glm::vec3* verts[3] = {&tri->vert0, &tri->vert1, &tri->vert2};
|
||||
float min_x = verts[0]->x;
|
||||
float max_x = verts[0]->x;
|
||||
@ -112,6 +117,9 @@ void MapService::AddTriangle(mc::Triangle* tri)
|
||||
max_x += 1.0f;
|
||||
min_y -= 1.0f;
|
||||
max_y += 1.0f;
|
||||
|
||||
min_x = std::max(min_x, 0.0f);
|
||||
min_y = std::max(min_y, 0.0f);
|
||||
}
|
||||
|
||||
{
|
||||
@ -119,22 +127,83 @@ void MapService::AddTriangle(mc::Triangle* tri)
|
||||
int min_grid_y = floor(min_y / cell_width_);
|
||||
int max_grid_x = ceil(max_x / cell_width_);
|
||||
int max_grid_y = ceil(max_y / cell_width_);
|
||||
#if 1
|
||||
if (min_grid_x < 0) {
|
||||
a8::XPrintf("error1 name:%s tri:%f,%f,%f %f,%f,%f\n",
|
||||
{
|
||||
tri->node->GetPath(),
|
||||
tri->vert0.x,
|
||||
tri->vert0.y,
|
||||
tri->vert0.z,
|
||||
|
||||
tri->vert1.x,
|
||||
tri->vert1.y,
|
||||
tri->vert1.z,
|
||||
|
||||
tri->vert2.x,
|
||||
tri->vert2.y,
|
||||
tri->vert2.z,
|
||||
}
|
||||
);
|
||||
return;
|
||||
min_grid_x = 0;
|
||||
}
|
||||
#endif
|
||||
if (min_grid_x < 0) {
|
||||
A8_ABORT();
|
||||
}
|
||||
if (max_grid_x >= map_width_) {
|
||||
#if 1
|
||||
a8::XPrintf("error4 name:%s tri:%f,%f,%f %f,%f,%f\n",
|
||||
{
|
||||
tri->node->GetPath(),
|
||||
tri->vert0.x,
|
||||
tri->vert0.y,
|
||||
tri->vert0.z,
|
||||
|
||||
tri->vert1.x,
|
||||
tri->vert1.y,
|
||||
tri->vert1.z,
|
||||
|
||||
tri->vert2.x,
|
||||
tri->vert2.y,
|
||||
tri->vert2.z,
|
||||
}
|
||||
);
|
||||
#endif
|
||||
return;
|
||||
A8_ABORT();
|
||||
max_grid_x = map_width_ - 1;
|
||||
}
|
||||
#if 1
|
||||
if (min_grid_y < 0) {
|
||||
a8::XPrintf("error2 name:%s tri:%f,%f,%f %f,%f,%f\n",
|
||||
{
|
||||
tri->node->GetPath(),
|
||||
tri->vert0.x,
|
||||
tri->vert0.y,
|
||||
tri->vert0.z,
|
||||
|
||||
tri->vert1.x,
|
||||
tri->vert1.y,
|
||||
tri->vert1.z,
|
||||
|
||||
tri->vert2.x,
|
||||
tri->vert2.y,
|
||||
tri->vert2.z,
|
||||
}
|
||||
);
|
||||
return;
|
||||
min_grid_y = 0;
|
||||
}
|
||||
#endif
|
||||
if (min_grid_y < 0) {
|
||||
A8_ABORT();
|
||||
//A8_ABORT();
|
||||
}
|
||||
if (max_grid_y >= map_height_) {
|
||||
#if 0
|
||||
A8_ABORT();
|
||||
#endif
|
||||
max_grid_y = map_height_ - 1;
|
||||
}
|
||||
float tri_verts[3 * 3];
|
||||
@ -196,7 +265,7 @@ void MapService::AddTriangle(mc::Triangle* tri)
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
#if 1
|
||||
if (dtOverlapPolyPoly2D(tri_verts, 3, aabb_verts, 4)) {
|
||||
int grid_id = x + y * map_width_;
|
||||
list_head* head = &map_cells_[grid_id];
|
||||
@ -209,9 +278,28 @@ void MapService::AddTriangle(mc::Triangle* tri)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
#if 1
|
||||
if (!found) {
|
||||
a8::XPrintf("error3 name:%s tri:%f,%f,%f %f,%f,%f\n",
|
||||
{
|
||||
tri->node->GetPath(),
|
||||
tri->vert0.x,
|
||||
tri->vert0.y,
|
||||
tri->vert0.z,
|
||||
|
||||
tri->vert1.x,
|
||||
tri->vert1.y,
|
||||
tri->vert1.z,
|
||||
|
||||
tri->vert2.x,
|
||||
tri->vert2.y,
|
||||
tri->vert2.z,
|
||||
}
|
||||
);
|
||||
#if 0
|
||||
AddTriangle(tri);
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -30,14 +30,22 @@ namespace mt
|
||||
{
|
||||
#if 0
|
||||
std::vector<std::string> files = {
|
||||
#ifdef DEBUG
|
||||
"main3d_map.colliders.new.json"
|
||||
#else
|
||||
"main3d_map.colliders.json"
|
||||
#endif
|
||||
};
|
||||
for (auto& filename : files) {
|
||||
auto p = std::make_shared<MapCollider>();
|
||||
p->Load(filename);
|
||||
p->LoadTerrain("map4_terrain.bin");
|
||||
raw_list.push_back(p);
|
||||
#ifdef DEBUG
|
||||
name_hash["main3d_map.colliders.json"] = p;
|
||||
#else
|
||||
name_hash[filename] = p;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user