添加救援时间

This commit is contained in:
aozhiwei 2019-05-13 17:08:44 +08:00
parent b666fee0ee
commit f3e54250fd
5 changed files with 19 additions and 17 deletions

View File

@ -64,6 +64,7 @@ enum ActionType_e
AT_Reload = 1,
AT_UseItem = 2,
AT_Relive = 3,
AT_Rescue = 4
};
enum InventorySlot_e

View File

@ -425,8 +425,9 @@ void Human::CancelAction()
Entity* entity = room->GetEntityByUniId(action_target_id);
if (entity->entity_type != ET_Player) {
Human* hum = (Human*)entity;
a8::UnSetBitFlag(hum->status, HS_Rescue);
hum->SyncAroundPlayers();
if (hum->action_type == AT_Rescue) {
hum->CancelAction();
}
}
}
ResetAction();
@ -1286,12 +1287,6 @@ void Human::FillBodyState(::google::protobuf::RepeatedPtrField<::cs::MFBodyState
state->set_left_time(std::max(0, skill_meta->i->last_time() * 1000 - passed_time));
state->set_lasting_time(skill_meta->i->last_time() * 1000);
}
if (a8::HasBitFlag(status, HS_Rescue)) {
cs::MFBodyState* state = states->Add();
state->set_state_type(HS_Rescue);
state->set_left_time(0);
state->set_lasting_time(0);
}
}
void Human::SummonHero()

View File

@ -24,7 +24,6 @@ enum HumanStatus
HS_RecoverHP = 8,
HS_ReflectDamage = 9,
HS_SummonHero = 10,
HS_Rescue = 20,
HS_End
};
@ -75,7 +74,6 @@ class Human : public Entity
long long dead_frameno = 0;
long long join_frameno = 0;
int status = 0;
long long rescue_frameno = 0;
Weapon default_weapon;
std::vector<Weapon> weapons;

View File

@ -301,7 +301,10 @@ void Player::UpdateAction()
return;
}
Human* hum = (Human*)entity;
a8::UnSetBitFlag(hum->status, HS_Rescue);
if (hum->action_type == AT_Rescue) {
hum->CancelAction();
return;
}
if (!hum->dead && hum->downed) {
hum->health = MetaMgr::Instance()->GetSysParamAsInt("downed_relive_recover_hp");
hum->downed = false;
@ -783,8 +786,15 @@ void Player::HumanInteraction(Human* hum)
if (!hum->downed) {
return;
}
a8::SetBitFlag(hum->status, HS_Rescue);
hum->rescue_frameno = room->frame_no;
if (hum->action_type == AT_Rescue) {
return;
}
hum->StartAction(
AT_Rescue,
MetaMgr::Instance()->GetSysParamAsInt("rescue_time") * 1000,
room->frame_no,
entity_uniid
);
StartAction(
AT_Relive,
MetaMgr::Instance()->GetSysParamAsInt("downed_relive_time") * 1000,

View File

@ -147,7 +147,7 @@ message MFPlayerFull
optional bool disconnected = 9; //
optional int32 anim_type = 10; //
optional int32 anim_seq = 11; //
//optional int32 action_type = 12; //0: none 1:reload 2:useitem 3:relive
//optional int32 action_type = 12; //0: none 1:reload 2:useitem 3:relive 4: rescue
//optional int32 action_duration = 22; //
optional int32 skin = 13; //id
optional int32 backpack = 14; //
@ -374,7 +374,7 @@ message MFObjectFull
//()
message MFActivePlayerData
{
optional int32 action_type = 3; //0: none 1:reload 2:useitem 3:relive
optional int32 action_type = 3; //0: none 1:reload 2:useitem 3:relive 4: rescue
optional int32 action_duration = 5; //
optional int32 action_item_id = 6;
optional int32 action_target_id = 7;
@ -554,8 +554,6 @@ message MFBodyState
8:
9:
10:
20:
*/
optional int32 state_type = 1;
optional float left_time = 2; //()