diff --git a/server/gameserver/constant.h b/server/gameserver/constant.h index ecc8a0c..493882b 100644 --- a/server/gameserver/constant.h +++ b/server/gameserver/constant.h @@ -278,6 +278,7 @@ enum PropertyType_e kPropSkillCurrTimes = 25, kPropSkillMaxTimes = 26, kPropCarOil = 27, + kPropFollowTarget = 30, }; enum MapObjectType_e diff --git a/server/gameserver/creature.h b/server/gameserver/creature.h index 62312f6..f70b5ac 100644 --- a/server/gameserver/creature.h +++ b/server/gameserver/creature.h @@ -96,6 +96,7 @@ class Creature : public MoveableEntity bool need_sync_active_player = false; std::function on_loading_bullet; + CreatureWeakPtr follow_target; Creature(); virtual ~Creature() override; diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 62e39d3..809f201 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -238,6 +238,9 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data if (parachute != 0) { p->set_parachute(parachute); } + if (follow_target.Get()) { + p->set_follow_target(follow_target.Get()->GetUniId()); + } FillBodyState(p->mutable_states()); FillBuffList(hum, p->mutable_buff_list()); FillSkillList(p->mutable_skill_list()); diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index 68cdbb1..c493cf6 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -116,6 +116,9 @@ void Player::InternalUpdate(int delta_time) if (jump) { UpdateJump(); } + if (follow != -1) { + UpdateFollow(); + } if (shot_start || shot_hold) { UpdateShot(); } @@ -1153,6 +1156,9 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg) if (msg.has_jump()) { jump = true; } + if (msg.has_follow()) { + follow = msg.follow(); + } if (msg.has_use_skill()) { use_skill = msg.use_skill(); use_skill_id = msg.skill_id(); @@ -1718,6 +1724,11 @@ void Player::UpdateAiming() } } +void Player::UpdateFollow() +{ + follow = -1; +} + void Player::CheckShotHoldState(Weapon* weapon) { if (weapon->meta->buff_meta && weapon->meta->buff_meta->i->trigger_type() == kBTT_SeriesShot) { diff --git a/server/gameserver/player.h b/server/gameserver/player.h index 3a85b69..0540e2e 100644 --- a/server/gameserver/player.h +++ b/server/gameserver/player.h @@ -68,6 +68,8 @@ class Player : public Human int get_on = 0; int switch_seat = 0; + int follow = -1; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 > interaction_objids; virtual ~Player() override; @@ -90,6 +92,7 @@ class Player : public Human void UpdateSwitchSeat(); void UpdateUseSkill(); void UpdateAiming(); + void UpdateFollow(); void Shot(); void ProcInteraction(); void ObstacleInteraction(Obstacle* entity); diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index 0e15320..267e1d1 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -141,6 +141,8 @@ message MFVec2 property_type: 29 百分比属性加成 property_subtype: 属性id valule: 百分比绝对值 + property_type: 30 跟随目标id + valule: 目标id */ message MFPropertyChg { @@ -150,7 +152,6 @@ message MFPropertyChg optional float value = 4; //属性值 } - //碰撞体 message MFCollider { @@ -267,6 +268,7 @@ message MFPlayerFull repeated MFSkill skill_list = 38; //技能列表 repeated MFAttrAddition attr_addition= 61; //属性加成 + optional int32 follow_target = 62 [default = 0]; //跟随的目标id 0: 未跟随 optional int32 charid = 44; //人物id optional float speed = 45; //速度 @@ -624,6 +626,7 @@ message MFTeamData optional float max_health = 9; //最大血量 optional bool riding = 40 [default = false]; //是否倒 下 optional string user_data = 60 [default = ""]; //用户自定义数据(只同步一次) + optional int32 can_follow = 62 [default = 0]; //是否可跟随 //一下字段只在结算的时候该字段才有内容 optional string account_id = 10; //账号id @@ -974,6 +977,8 @@ message CMMove */ optional int32 get_on = 36; optional int32 switch_seat = 37; //切换座位 + + optional int32 follow = 38; //跟随0:取消跟随 其他:玩家uniid } //执行GM指令