1
This commit is contained in:
parent
6acf3a2fb5
commit
66665de562
@ -312,20 +312,21 @@ void FrameEvent::AddZombieIdChg(Human* hum)
|
||||
void FrameEvent::AddDead(Human* sender, int revive_time)
|
||||
{
|
||||
{
|
||||
dead_objs_.push_back(
|
||||
dead_alive_objs_.push_back(
|
||||
std::make_tuple(
|
||||
sender->GetEntityUniId(),
|
||||
revive_time
|
||||
revive_time,
|
||||
0
|
||||
)
|
||||
);
|
||||
}
|
||||
{
|
||||
int dead_idx = dead_objs_.size() - 1;
|
||||
int dead_idx = dead_alive_objs_.size() - 1;
|
||||
sender->TouchAllLayerHumanList
|
||||
(
|
||||
[dead_idx] (Human* hum, bool& stop)
|
||||
{
|
||||
hum->dead_objs_.push_back(dead_idx);
|
||||
hum->dead_alive_objs_.push_back(dead_idx);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -333,15 +334,21 @@ void FrameEvent::AddDead(Human* sender, int revive_time)
|
||||
void FrameEvent::AddRevive(Human* sender)
|
||||
{
|
||||
{
|
||||
revive_objs_.push_back(sender->GetEntityUniId());
|
||||
dead_alive_objs_.push_back(
|
||||
std::make_tuple(
|
||||
sender->GetEntityUniId(),
|
||||
0,
|
||||
1
|
||||
)
|
||||
);
|
||||
}
|
||||
{
|
||||
int revive_idx = revive_objs_.size() - 1;
|
||||
int revive_idx = dead_alive_objs_.size() - 1;
|
||||
sender->TouchAllLayerHumanList
|
||||
(
|
||||
[revive_idx] (Human* hum, bool& stop)
|
||||
{
|
||||
hum->revive_objs_.push_back(revive_idx);
|
||||
hum->dead_alive_objs_.push_back(revive_idx);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -405,10 +412,7 @@ void FrameEvent::Clear()
|
||||
if (!chged_zombieids_.empty()) {
|
||||
chged_zombieids_.clear();
|
||||
}
|
||||
if (!revive_objs_.empty()) {
|
||||
revive_objs_.clear();
|
||||
}
|
||||
if (!dead_objs_.empty()) {
|
||||
dead_objs_.clear();
|
||||
if (!dead_alive_objs_.empty()) {
|
||||
dead_alive_objs_.clear();
|
||||
}
|
||||
}
|
||||
|
@ -54,8 +54,7 @@ private:
|
||||
std::vector<Human*> chged_exps_;
|
||||
std::vector<Human*> chged_races_;
|
||||
std::vector<Human*> chged_zombieids_;
|
||||
std::vector<int> revive_objs_;
|
||||
std::vector<std::tuple<int, int>> dead_objs_;
|
||||
std::vector<std::tuple<int, int, int>> dead_alive_objs_;
|
||||
|
||||
friend class FrameMaker;
|
||||
};
|
||||
|
@ -235,16 +235,12 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t idx : hum->revive_objs_) {
|
||||
if (idx < room->frame_event.revive_objs_.size()) {
|
||||
msg->add_revive_objids(room->frame_event.revive_objs_[idx]);
|
||||
}
|
||||
}
|
||||
for (size_t idx : hum->dead_objs_) {
|
||||
if (idx < room->frame_event.dead_objs_.size()) {
|
||||
auto p = msg->add_dead_objs();
|
||||
p->add_values(std::get<0>(room->frame_event.dead_objs_[idx]));
|
||||
p->add_values(std::get<1>(room->frame_event.dead_objs_[idx]));
|
||||
for (size_t idx : hum->dead_alive_objs_) {
|
||||
if (idx < room->frame_event.dead_alive_objs_.size()) {
|
||||
auto p = msg->add_dead_alive_objs();
|
||||
p->add_values(std::get<0>(room->frame_event.dead_alive_objs_[idx]));
|
||||
p->add_values(std::get<1>(room->frame_event.dead_alive_objs_[idx]));
|
||||
p->add_values(std::get<2>(room->frame_event.dead_alive_objs_[idx]));
|
||||
}
|
||||
}
|
||||
if (room->GetRoomMode() == kZombieMode && room->BattleStarted()) {
|
||||
|
@ -997,10 +997,10 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
ClearLordMode();
|
||||
ClearBuffList();
|
||||
room->frame_event.AddDead(this,
|
||||
MetaMgr::Instance()->zbmode_revive_time * 1000);
|
||||
meta->i->revive_time() * 1000);
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(MetaMgr::Instance()->zbmode_revive_time * SERVER_FRAME_RATE,
|
||||
(meta->i->revive_time() * SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
[] (const a8::XParams& param)
|
||||
@ -1010,6 +1010,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
},
|
||||
&xtimer_attacher.timer_list_
|
||||
);
|
||||
room->OnHumanDie(this);
|
||||
} else {
|
||||
dead = true;
|
||||
downed = false;
|
||||
@ -2033,11 +2034,8 @@ void Human::ClearFrameData()
|
||||
if (!chged_zombieid_.empty()) {
|
||||
chged_zombieid_.clear();
|
||||
}
|
||||
if (!revive_objs_.empty()) {
|
||||
revive_objs_.clear();
|
||||
}
|
||||
if (!dead_objs_.empty()) {
|
||||
dead_objs_.clear();
|
||||
if (!dead_alive_objs_.empty()) {
|
||||
dead_alive_objs_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3012,6 +3010,9 @@ void Human::RecalcBuffAttr()
|
||||
void Human::Revive()
|
||||
{
|
||||
if (room->GetRoomMode() == kZombieMode) {
|
||||
if (GetRace() == kHumanRace) {
|
||||
ChangeToRaceAndNotify(kZombieRace, 1);
|
||||
}
|
||||
dead = false;
|
||||
downed = false;
|
||||
real_dead = false;
|
||||
|
@ -360,8 +360,7 @@ protected:
|
||||
std::vector<int> chged_exp_;
|
||||
std::vector<int> chged_race_;
|
||||
std::vector<int> chged_zombieid_;
|
||||
std::vector<int> revive_objs_;
|
||||
std::vector<int> dead_objs_;
|
||||
std::vector<int> dead_alive_objs_;
|
||||
Human* follow_target_ = nullptr;
|
||||
bool follow_synced_active_player = false;
|
||||
HumanCar car_;
|
||||
|
@ -48,7 +48,6 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
MetaData::Robot* RandRobot(std::set<int>& refreshed_robot_set);
|
||||
MetaData::AI* GetAI(int ai_level);
|
||||
|
||||
int zbmode_revive_time = 3;
|
||||
int gas_inactive_time = 10;
|
||||
int newbie_gas_inactive_time = 5;
|
||||
int midbrid_gas_inactive_time = 15;
|
||||
|
@ -561,6 +561,12 @@ void Room::RemoveObjectLater(RoomEntity* entity)
|
||||
void Room::OnHumanDie(Human* hum)
|
||||
{
|
||||
if (GetRoomMode() == kZombieMode) {
|
||||
if (hum->GetRace() == kHumanRace) {
|
||||
|
||||
} else if (hum->GetRace() == kZombieRace) {
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
NotifyUiUpdate();
|
||||
} else {
|
||||
--alive_count_;
|
||||
|
@ -911,8 +911,7 @@ message SMUpdate
|
||||
repeated MFPropertyChg chged_property_list = 31; //property变更列表
|
||||
|
||||
//一下字段只有僵尸模式才有效
|
||||
repeated int32 revive_objids = 41; //复活的玩家
|
||||
repeated MFTuple dead_objs = 42; //死亡的玩家values[0]:objid values[1]:多少毫秒后复活
|
||||
repeated MFTuple dead_alive_objs = 42; //玩家values[0]:objid values[1]:多少毫秒后复活 values[2]: 0:死亡 1:复活
|
||||
repeated MFPosition object_positions = 43; //对象坐标信息,如果对象已经在part_objects则可能不发,这时客户端可以读取part_objects里的左边更新小地图
|
||||
optional int32 game_left_time = 45; //游戏剩余时间(毫秒, 战斗开始后字段才有意义)
|
||||
}
|
||||
|
@ -126,6 +126,7 @@ message Player
|
||||
optional int32 killer_exp = 19;
|
||||
optional int32 zbmode_weapon_id = 20;
|
||||
optional int32 zbmode_weapon_lv = 21;
|
||||
optional int32 revive_time = 22;
|
||||
}
|
||||
|
||||
message Robot
|
||||
|
Loading…
x
Reference in New Issue
Block a user