diff --git a/server/gameserver/collider.cc b/server/gameserver/collider.cc index 338717c..8f78081 100644 --- a/server/gameserver/collider.cc +++ b/server/gameserver/collider.cc @@ -304,6 +304,14 @@ bool ColliderComponent::CalcSafePointEx(const a8::Vec2& a_pos, ColliderComponent return false; } +void AabbCollider::MoveCenter(float x, float y) +{ + _min.x += x; + _min.y += y; + _max.x += x; + _max.y += y; +} + void DestoryCollider(ColliderComponent* collider) { switch (collider->type) { diff --git a/server/gameserver/collider.h b/server/gameserver/collider.h index ea9b0ee..5a389f1 100644 --- a/server/gameserver/collider.h +++ b/server/gameserver/collider.h @@ -32,6 +32,7 @@ public: a8::Vec2 _max; AabbCollider() { type = CT_Aabb; }; + void MoveCenter(float x, float y); }; class CircleCollider : public ColliderComponent diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 25eb92c..fb73d47 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -258,9 +258,7 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data p->set_revive_countdown(countdown); } } - if (room->GetRoomMode() == kZombieMode) { - p->set_charid(meta->i->id()); - } + p->set_charid(meta->i->id()); if (GetCar()) { p->set_car_uniid(GetCar()->car_uniid); p->set_car_seat(GetSeat()); @@ -357,11 +355,14 @@ void Human::GetAabbBox(AabbCollider& aabb_box) aabb_box._min.y = -GetCar()->meta->i->rad(); aabb_box._max.x = GetCar()->meta->i->rad(); aabb_box._max.y = GetCar()->meta->i->rad(); + aabb_box.MoveCenter(GetCar()->hero_meta_->i->move_offset_x(), + GetCar()->hero_meta_->i->move_offset_y()); } else { aabb_box._min.x = -meta->i->radius(); aabb_box._min.y = -meta->i->radius(); aabb_box._max.x = meta->i->radius(); aabb_box._max.y = meta->i->radius(); + aabb_box.MoveCenter(meta->i->hit_offset_x(), meta->i->hit_offset_y()); } } @@ -3353,11 +3354,14 @@ void Human::GetHitAabbBox(AabbCollider& aabb_box) aabb_box._min.y = -GetCar()->meta->i->rad(); aabb_box._max.x = GetCar()->meta->i->rad(); aabb_box._max.y = GetCar()->meta->i->rad(); + aabb_box.MoveCenter(GetCar()->hero_meta_->i->move_offset_x(), + GetCar()->hero_meta_->i->move_offset_y()); } else { aabb_box._min.x = -GetHitRadius(); aabb_box._min.y = -GetHitRadius(); aabb_box._max.x = GetHitRadius(); aabb_box._max.y = GetHitRadius(); + aabb_box.MoveCenter(meta->i->hit_offset_x(), meta->i->hit_offset_y()); } } diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index 3559b8b..1cbd0b7 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -268,7 +268,6 @@ message MFPlayerFull repeated MFAttrAddition attr_addition= 61; //属性加成 - //一下字段只有僵尸模式才有效 optional int32 charid = 44; //人物id optional float speed = 45; //速度 diff --git a/server/tools/protobuild/metatable.proto b/server/tools/protobuild/metatable.proto index 57b6140..ea2a748 100755 --- a/server/tools/protobuild/metatable.proto +++ b/server/tools/protobuild/metatable.proto @@ -152,6 +152,8 @@ message EquipUpgrade message Player { optional int32 id = 1; //唯一id + optional float move_offset_x = 40; + optional float move_offset_y = 41; optional float radius = 2; //半径 optional int32 health = 3; //初始血量 optional int32 move_speed = 4; //移动速度 @@ -175,6 +177,8 @@ message Player optional int32 revive_time = 22; optional string name = 23; optional int32 normal_skill = 24; + optional float hit_offset_x = 42; + optional float hit_offset_y = 43; optional float hit_radius = 25; optional string ai_script = 26; optional string init_buffs = 27;