merge dev

This commit is contained in:
aozhiwei 2021-04-14 09:58:14 +08:00
commit 04becd0cd6
12 changed files with 77 additions and 2 deletions

View File

@ -373,6 +373,18 @@ void Bullet::ProcFragBomb(int delay_time)
void Bullet::ProcPosionGasBomb(int delay_time)
{
if (sender.Get()) {
#if 1
a8::Vec2 old_buff_vec2_param1 = sender.Get()->buff_vec2_param1;
sender.Get()->buff_vec2_param1 = GetPos();
MetaData::Buff * buff_meta = MetaMgr::Instance()->GetBuff(gun_meta->i->buffid());
if (buff_meta) {
sender.Get()->AddBuff(sender.Get(),
buff_meta,
1
);
}
sender.Get()->buff_vec2_param1 = old_buff_vec2_param1;
#else
PosionGasMiTask* task = new PosionGasMiTask();
task->room = room;
task->sender.Attach(sender.Get());
@ -398,6 +410,7 @@ void Bullet::ProcPosionGasBomb(int delay_time)
},
&room->timer_attacher.timer_list_
);
#endif
}
}

View File

@ -383,6 +383,7 @@ enum ObstacleType_e
kObstacleSelfExplosion = 1,
kObstacleMine = 2,
kObstacleTrap = 3,
kObstaclePosionGas = 4,
};
const char* const PROJ_NAME_FMT = "game%d_gameserver";

View File

@ -21,6 +21,8 @@ void InternalShot(Creature* c,
{
if (weapon_meta->i->_inventory_slot() == IS_TRAP ||
weapon_meta->i->_inventory_slot() == IS_MINE) {
a8::Vec2 old_buff_vec2_param1 = c->buff_vec2_param1;
c->buff_vec2_param1 = c->GetPos();
MetaData::Buff * buff_meta = MetaMgr::Instance()->GetBuff(bullet_meta->i->buffid());
if (buff_meta) {
c->AddBuff(c,
@ -28,6 +30,7 @@ void InternalShot(Creature* c,
1
);
}
c->buff_vec2_param1 = old_buff_vec2_param1;
return;
}
for (auto& tuple : weapon_meta->bullet_born_offset) {
@ -500,6 +503,7 @@ void Creature::DoSkill(int skill_id,
skill_distance_ = skill_distance;
curr_skill_ = skill;
playing_skill = true;
buff_vec2_param1 = GetPos() + skill_dir_ * skill_distance_;
CurrentSkill()->last_use_frameno = room->GetFrameNo();
if (CurrentSkill()->meta->i->skill_target() == kST_Self
) {
@ -845,6 +849,7 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff)
case kBET_SummonObstacle:
{
a8::Vec2 target_pos = caster->GetPos() + caster->skill_dir_ * caster->skill_distance_;
target_pos = buff_vec2_param1;
SummonObstacle(buff->meta->param1, target_pos);
}
break;

View File

@ -47,6 +47,7 @@ class Creature : public MoveableEntity
long long poisoning_time = 0;
Weapon car_weapon;
a8::Vec2 buff_vec2_param1;
bool need_sync_active_player = false;
std::function<void ()> on_loading_bullet;

View File

@ -246,6 +246,8 @@ void Human::FillMFPlayerStats(cs::MFPlayerStats* stats_pb)
{
stats_pb->set_player_id(GetEntityUniId());
stats_pb->set_player_avatar_url(avatar_url);
stats_pb->set_charid(meta->i->id());
stats_pb->set_team_id(team_id);
if (!dead) {
stats_pb->set_time_alive(room->GetFrameNo() * 1000.0f / SERVER_FRAME_RATE);
@ -694,6 +696,8 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
msg.set_game_over(room->IsGameOver());
msg.set_victory(!dead);
msg.set_room_uuid(a8::XValue(room->GetRoomUuid()));
msg.set_total_human_num(room->GetHumanNum());
msg.set_alive_human_num(room->AliveCount());
{
for (auto& itr : *team_members) {
@ -836,6 +840,8 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
RemoveBuffByEffectId(kBET_Camouflage);
}
ClearLordMode();
room->frame_event.AddDead(this,
0);
#ifdef DEBUG
room->CheckPartObjects();
#endif

View File

@ -64,11 +64,14 @@ void MolotorCocktailMiTask::Check()
}
}
);
a8::Vec2 old_buff_vec2_param1 = sender.Get()->buff_vec2_param1;
sender.Get()->buff_vec2_param1 = sender.Get()->GetPos();
for (Creature* target : objects) {
if (!target->GetBuffById(meta->i->buffid())) {
target->MustBeAddBuff(sender.Get(), meta->i->buffid());
}
}
sender.Get()->buff_vec2_param1 = old_buff_vec2_param1;
}
}

View File

@ -64,11 +64,14 @@ void PosionGasMiTask::Check()
}
}
);
a8::Vec2 old_buff_vec2_param1 = sender.Get()->buff_vec2_param1;
sender.Get()->buff_vec2_param1 = sender.Get()->GetPos();
for (Creature* target : objects) {
if (!target->GetBuffById(meta->i->buffid())) {
target->MustBeAddBuff(sender.Get(), meta->i->buffid());
}
}
sender.Get()->buff_vec2_param1 = old_buff_vec2_param1;
}
}

View File

@ -171,6 +171,11 @@ int Room::GetPlayerNum()
return accountid_hash_.size();
}
int Room::GetHumanNum()
{
return human_hash_.size();
}
Player* Room::GetPlayerByAccountId(const std::string& accountid)
{
auto itr = accountid_hash_.find(accountid);
@ -2246,7 +2251,7 @@ ObstacleData* Room::GetPermanentObstacleData(int obstacle_uniid)
long long Room::GetGasInactiveTime()
{
#if DEBUG
#ifdef DEBUG
return 5;
#endif
if (room_mode_ == kZombieMode) {

View File

@ -74,6 +74,7 @@ public:
#endif
int GetPlayerNum();
int GetHumanNum();
int AliveCount();
long long AliveCountChgFrameNo() { return alive_count_chged_frameno_; };
inline int RealAliveCount() { return alive_human_hash_.size(); }

View File

@ -330,6 +330,11 @@ void RoomObstacle::Active()
ActiveTrap();
}
break;
case kObstaclePosionGas:
{
ActivePosionGas();
}
break;
default:
break;
}
@ -393,3 +398,30 @@ void RoomObstacle::ActiveTrap()
&xtimer_attacher.timer_list_
);
}
void RoomObstacle::ActivePosionGas()
{
room->xtimer.AddDeadLineTimerAndAttach
(
meta->i->time() / FRAME_RATE_MS,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->room->xtimer.AddRepeatTimerAndAttach
(
obstacle->meta->i->explosion_interval() / FRAME_RATE_MS,
a8::XParams()
.SetSender(obstacle),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->SpecExplosion();
},
&obstacle->xtimer_attacher.timer_list_
);
},
&xtimer_attacher.timer_list_
);
}

View File

@ -28,6 +28,7 @@ private:
void ActiveSelfExplosion();
void ActiveMine();
void ActiveTrap();
void ActivePosionGas();
protected:
bool temp_through_ = false;

View File

@ -667,6 +667,8 @@ message MFPlayerStats
optional int32 vip_lv = 35 [default = 0]; //
optional int32 head = 36 [default = 0]; //
optional int32 sex = 37 [default = 0]; //
optional int32 charid = 38; //id
optional int32 team_id = 39; //tamid
}
//
@ -1038,8 +1040,8 @@ message SMUpdate
repeated MFPropertyChg chged_property_list = 31; //property变更列表
repeated MFPlaySkill play_skill_list = 32; //
//
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; //(, )
}
@ -1064,6 +1066,8 @@ message SMGameOver
optional int32 team_allcnt = 3;
optional bool game_over = 4; //
optional bool victory = 5; //
optional int32 total_human_num = 12; //
optional int32 alive_human_num = 13; //
repeated MFPlayerStats player_stats = 6; //
optional string room_uuid = 7; //id