1
This commit is contained in:
parent
78399a1199
commit
cc72a3feca
@ -37,6 +37,17 @@ void Building::RecalcSelfCollider()
|
||||
AddCollider(collider);
|
||||
room->map_service.AddCollider(collider);
|
||||
}
|
||||
for (auto& obj : meta->i->grassobj()) {
|
||||
AabbCollider* collider = new AabbCollider();
|
||||
collider->owner = this;
|
||||
collider->tag = ColliderTag_Grass;
|
||||
collider->_min = a8::Vec2(obj.x() - obj.width()/2.0 - meta->i->tilewidth()/2.0,
|
||||
obj.y() - obj.height()/2.0 - meta->i->tileheight()/2.0);
|
||||
collider->_max = a8::Vec2(obj.x() + obj.width()/2.0 - meta->i->tilewidth()/2.0,
|
||||
obj.y() + obj.height()/2.0 - meta->i->tileheight()/2.0);
|
||||
AddCollider(collider);
|
||||
room->map_service.AddCollider(collider);
|
||||
}
|
||||
}
|
||||
|
||||
void Building::FillMFObjectPart(cs::MFObjectPart* part_data)
|
||||
|
@ -15,6 +15,7 @@ class ColliderComponent
|
||||
Entity* owner = nullptr;
|
||||
ColliderType_e type = CT_None;
|
||||
bool active = true;
|
||||
int tag = 0;
|
||||
|
||||
bool Intersect(ColliderComponent* b);
|
||||
bool IntersectSegment(a8::Vec2& p0, a8::Vec2& p1);
|
||||
|
@ -234,6 +234,11 @@ enum BulletType_e
|
||||
BulletType_FireBomb = 3, //燃烧弹
|
||||
};
|
||||
|
||||
enum ColliderTag_e
|
||||
{
|
||||
ColliderTag_Grass = 1, //草丛
|
||||
};
|
||||
|
||||
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
||||
const char* const PROJ_ROOT_FMT = "/data/logs/%s";
|
||||
|
||||
|
@ -312,6 +312,13 @@ bool Human::IsCollisionInMapService()
|
||||
case ET_Obstacle:
|
||||
case ET_Building:
|
||||
{
|
||||
if (collider->tag == ColliderTag_Grass) {
|
||||
if (TestCollision((ColliderComponent*)collider)) {
|
||||
if (!a8::HasBitFlag(status, HS_InGrass)) {
|
||||
OnEnterGrass();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!collider->owner->dead && TestCollision((ColliderComponent*)collider)) {
|
||||
if (last_collision_door != collider->owner) {
|
||||
return true;
|
||||
@ -1510,6 +1517,7 @@ void Human::ProcBuffEffect(Buff* buff)
|
||||
|
||||
void Human::OnAttack()
|
||||
{
|
||||
#if 0
|
||||
if (a8::HasBitFlag(status, HS_InGrass)) {
|
||||
if (HasBuffEffect(BET_Hide)) {
|
||||
RemoveBuff(buff_effect_[BET_Hide]->meta->i->buff_id());
|
||||
@ -1536,10 +1544,12 @@ void Human::OnAttack()
|
||||
&xtimer_attacher.timer_list_);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Human::OnEnterGrass()
|
||||
{
|
||||
#if 0
|
||||
if (a8::HasBitFlag(status, HS_InGrass)) {
|
||||
return;
|
||||
}
|
||||
@ -1568,10 +1578,12 @@ void Human::OnEnterGrass()
|
||||
.SetSender(this),
|
||||
hide_func,
|
||||
&xtimer_attacher.timer_list_);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Human::OnLeaveGrass()
|
||||
{
|
||||
#if 0
|
||||
a8::UnSetBitFlag(status, HS_InGrass);
|
||||
if (grass_hide_timer_list_) {
|
||||
room->xtimer.DeleteTimer(grass_hide_timer_list_);
|
||||
@ -1591,6 +1603,7 @@ void Human::OnLeaveGrass()
|
||||
},
|
||||
&xtimer_attacher.timer_list_);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Human::_UpdateMove(int speed)
|
||||
|
@ -97,8 +97,8 @@ namespace MetaData
|
||||
a8::Split(str, strings2, ':');
|
||||
assert(strings2.size() == 2);
|
||||
if (strings2.size() >= 2) {
|
||||
int slot = a8::XValue(strings2[0]);
|
||||
int num = a8::XValue(strings2[1]);
|
||||
size_t slot = a8::XValue(strings2[0]);
|
||||
size_t num = a8::XValue(strings2[1]);
|
||||
if (slot >= 0 && slot < volume.size()){
|
||||
volume[slot] = num;
|
||||
}
|
||||
@ -385,7 +385,7 @@ namespace MetaData
|
||||
|
||||
void Dress::Init()
|
||||
{
|
||||
for (size_t j = 0; j < i->max_lv(); ++j) {
|
||||
for (int j = 0; j < i->max_lv(); ++j) {
|
||||
std::array<float, EA_End>& attrs = a8::FastAppend(level_attrs);
|
||||
for (size_t k = 0; k < EA_End; ++k) {
|
||||
attrs[k] = 0;
|
||||
@ -405,7 +405,7 @@ namespace MetaData
|
||||
float attr_value = a8::XValue(strings2[2]).GetDouble();
|
||||
if (attr_type < EA_End) {
|
||||
if (attr_level >= 0 && attr_level < i->max_lv()) {
|
||||
for (size_t j = 1; j < i->max_lv(); ++j) {
|
||||
for (int j = 1; j < i->max_lv(); ++j) {
|
||||
if (j % attr_type == 0) {
|
||||
level_attrs[j][attr_type] = attr_value * (j / attr_level);
|
||||
}
|
||||
@ -421,7 +421,7 @@ namespace MetaData
|
||||
if (level < 1) {
|
||||
return 0;
|
||||
}
|
||||
if (level > level_attrs.size()) {
|
||||
if (level > (int)level_attrs.size()) {
|
||||
return 0;
|
||||
}
|
||||
if (attr_type < EA_End) {
|
||||
|
@ -121,7 +121,6 @@ message Skill
|
||||
{
|
||||
required int32 skill_id = 1;
|
||||
required int32 skill_type = 2;
|
||||
required int32 skill_effect_id = 3;
|
||||
required string value = 4;
|
||||
required string value_up = 6;
|
||||
required int32 skill_cd = 7;
|
||||
|
Loading…
x
Reference in New Issue
Block a user