add follow

This commit is contained in:
aozhiwei 2021-09-06 11:32:53 +00:00
parent 9d14513bd1
commit 8ab2306565
6 changed files with 25 additions and 1 deletions

View File

@ -278,6 +278,7 @@ enum PropertyType_e
kPropSkillCurrTimes = 25, kPropSkillCurrTimes = 25,
kPropSkillMaxTimes = 26, kPropSkillMaxTimes = 26,
kPropCarOil = 27, kPropCarOil = 27,
kPropFollowTarget = 30,
}; };
enum MapObjectType_e enum MapObjectType_e

View File

@ -96,6 +96,7 @@ class Creature : public MoveableEntity
bool need_sync_active_player = false; bool need_sync_active_player = false;
std::function<void ()> on_loading_bullet; std::function<void ()> on_loading_bullet;
CreatureWeakPtr follow_target;
Creature(); Creature();
virtual ~Creature() override; virtual ~Creature() override;

View File

@ -238,6 +238,9 @@ void Human::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data
if (parachute != 0) { if (parachute != 0) {
p->set_parachute(parachute); p->set_parachute(parachute);
} }
if (follow_target.Get()) {
p->set_follow_target(follow_target.Get()->GetUniId());
}
FillBodyState(p->mutable_states()); FillBodyState(p->mutable_states());
FillBuffList(hum, p->mutable_buff_list()); FillBuffList(hum, p->mutable_buff_list());
FillSkillList(p->mutable_skill_list()); FillSkillList(p->mutable_skill_list());

View File

@ -116,6 +116,9 @@ void Player::InternalUpdate(int delta_time)
if (jump) { if (jump) {
UpdateJump(); UpdateJump();
} }
if (follow != -1) {
UpdateFollow();
}
if (shot_start || shot_hold) { if (shot_start || shot_hold) {
UpdateShot(); UpdateShot();
} }
@ -1153,6 +1156,9 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
if (msg.has_jump()) { if (msg.has_jump()) {
jump = true; jump = true;
} }
if (msg.has_follow()) {
follow = msg.follow();
}
if (msg.has_use_skill()) { if (msg.has_use_skill()) {
use_skill = msg.use_skill(); use_skill = msg.use_skill();
use_skill_id = msg.skill_id(); use_skill_id = msg.skill_id();
@ -1718,6 +1724,11 @@ void Player::UpdateAiming()
} }
} }
void Player::UpdateFollow()
{
follow = -1;
}
void Player::CheckShotHoldState(Weapon* weapon) void Player::CheckShotHoldState(Weapon* weapon)
{ {
if (weapon->meta->buff_meta && weapon->meta->buff_meta->i->trigger_type() == kBTT_SeriesShot) { if (weapon->meta->buff_meta && weapon->meta->buff_meta->i->trigger_type() == kBTT_SeriesShot) {

View File

@ -68,6 +68,8 @@ class Player : public Human
int get_on = 0; int get_on = 0;
int switch_seat = 0; int switch_seat = 0;
int follow = -1;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > interaction_objids; ::google::protobuf::RepeatedField< ::google::protobuf::int32 > interaction_objids;
virtual ~Player() override; virtual ~Player() override;
@ -90,6 +92,7 @@ class Player : public Human
void UpdateSwitchSeat(); void UpdateSwitchSeat();
void UpdateUseSkill(); void UpdateUseSkill();
void UpdateAiming(); void UpdateAiming();
void UpdateFollow();
void Shot(); void Shot();
void ProcInteraction(); void ProcInteraction();
void ObstacleInteraction(Obstacle* entity); void ObstacleInteraction(Obstacle* entity);

View File

@ -141,6 +141,8 @@ message MFVec2
property_type: 29 property_type: 29
property_subtype: id property_subtype: id
valule: valule:
property_type: 30 id
valule: id
*/ */
message MFPropertyChg message MFPropertyChg
{ {
@ -150,7 +152,6 @@ message MFPropertyChg
optional float value = 4; // optional float value = 4; //
} }
// //
message MFCollider message MFCollider
{ {
@ -267,6 +268,7 @@ message MFPlayerFull
repeated MFSkill skill_list = 38; // repeated MFSkill skill_list = 38; //
repeated MFAttrAddition attr_addition= 61; // repeated MFAttrAddition attr_addition= 61; //
optional int32 follow_target = 62 [default = 0]; //id 0:
optional int32 charid = 44; //id optional int32 charid = 44; //id
optional float speed = 45; // optional float speed = 45; //
@ -624,6 +626,7 @@ message MFTeamData
optional float max_health = 9; // optional float max_health = 9; //
optional bool riding = 40 [default = false]; // optional bool riding = 40 [default = false]; //
optional string user_data = 60 [default = ""]; // optional string user_data = 60 [default = ""]; //
optional int32 can_follow = 62 [default = 0]; //
// //
optional string account_id = 10; //id optional string account_id = 10; //id
@ -974,6 +977,8 @@ message CMMove
*/ */
optional int32 get_on = 36; optional int32 get_on = 36;
optional int32 switch_seat = 37; // optional int32 switch_seat = 37; //
optional int32 follow = 38; //0: uniid
} }
//GM指令 //GM指令