1
This commit is contained in:
parent
eaf06e616c
commit
2b872f3740
@ -162,6 +162,11 @@ enum EntitySubType_e
|
||||
EST_Android = 2,
|
||||
};
|
||||
|
||||
enum PropertyType_e
|
||||
{
|
||||
kPropTankBulletNum = 6
|
||||
};
|
||||
|
||||
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
||||
const char* const PROJ_ROOT_FMT = "/data/logs/%s";
|
||||
|
||||
|
@ -138,6 +138,13 @@ void FrameEvent::AddExplosionEx(Human* sender, int item_id, a8::Vec2 bomb_pos, i
|
||||
}
|
||||
}
|
||||
|
||||
void FrameEvent::AddTankBulletNumChg(Human* hum)
|
||||
{
|
||||
chged_tank_bullet_nums_.push_back(hum);
|
||||
int idx = chged_tank_bullet_nums_.size() - 1;
|
||||
hum->chged_tank_bullet_nums_.push_back(idx);
|
||||
}
|
||||
|
||||
void FrameEvent::AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos)
|
||||
{
|
||||
{
|
||||
@ -179,4 +186,7 @@ void FrameEvent::Clear()
|
||||
if (airdrops_.size() > 0) {
|
||||
airdrops_.Clear();
|
||||
}
|
||||
if (chged_tank_bullet_nums_.empty()) {
|
||||
chged_tank_bullet_nums_.clear();
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ public:
|
||||
void AddExplosion(Bullet* bullet, int item_id, a8::Vec2 bomb_pos);
|
||||
void AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos);
|
||||
void AddExplosionEx(Human* sender, int item_id, a8::Vec2 bomb_pos, int effect);
|
||||
void AddTankBulletNumChg(Human* hum);
|
||||
|
||||
void Clear();
|
||||
private:
|
||||
@ -23,6 +24,7 @@ private:
|
||||
std::vector<std::tuple<Human*, ::cs::MFExplosion>> explosions_;
|
||||
std::vector<std::tuple<Human*, ::cs::MFSmoke>> smokes_;
|
||||
std::vector<std::tuple<Human*, ::cs::MFEmote>> emotes_;
|
||||
std::vector<Human*> chged_tank_bullet_nums_;
|
||||
|
||||
friend class FrameMaker;
|
||||
};
|
||||
|
@ -67,6 +67,17 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t idx : hum->chged_tank_bullet_nums_) {
|
||||
if (idx < room->frame_event.chged_tank_bullet_nums_.size()) {
|
||||
Human* target = room->frame_event.chged_tank_bullet_nums_[idx];
|
||||
if (target->curr_weapon) {
|
||||
auto p = msg->add_chged_property_list();
|
||||
p->set_obj_id(target->entity_uniid);
|
||||
p->set_property_type(kPropTankBulletNum);
|
||||
p->set_value(target->tank_weapon.ammo);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (room->frame_event.airdrops_.size() > 0) {
|
||||
*msg->mutable_airdrop() = room->frame_event.airdrops_.Get(0);
|
||||
}
|
||||
|
@ -354,6 +354,7 @@ void Human::TankShot(a8::Vec2& target_dir)
|
||||
}
|
||||
--tank_weapon.ammo;
|
||||
last_shot_frameno_ = room->frame_no;
|
||||
room->frame_event.AddTankBulletNumChg(this);
|
||||
}
|
||||
|
||||
void Human::RecalcSelfCollider()
|
||||
@ -1210,6 +1211,7 @@ void Human::DoGetDown()
|
||||
tank_weapon = Weapon();
|
||||
RecalcSelfCollider();
|
||||
SyncAroundPlayers();
|
||||
room->NotifyUiUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2032,6 +2034,9 @@ void Human::ClearFrameData()
|
||||
if (!emotes_.empty()) {
|
||||
emotes_.clear();
|
||||
}
|
||||
if (!chged_tank_bullet_nums_.empty()) {
|
||||
chged_tank_bullet_nums_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void Human::GenBattleReportData(a8::MutableXObject* params)
|
||||
@ -2320,8 +2325,10 @@ void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta)
|
||||
Entity* loot_entity = room->GetEntityByUniId(entity_uniid);
|
||||
if (loot_entity && loot_entity->entity_type == ET_Loot) {
|
||||
((Loot*)loot_entity)->bullet_num = skin_tank.bullet_num;
|
||||
room->UpdateCarObject(skin_tank.tank_uniid, entity_uniid);
|
||||
}
|
||||
}
|
||||
skin_tank.tank_uniid = entity->entity_uniid;
|
||||
skin_tank.skin_id = item_meta->i->id();
|
||||
skin_tank.skin_lv = std::max(1, GetSkinConfigLv(skin_tank.skin_id));
|
||||
skin_tank.bullet_num = entity->bullet_num;
|
||||
@ -2331,13 +2338,16 @@ void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta)
|
||||
tank_weapon.weapon_idx = 100;
|
||||
tank_weapon.weapon_id = item_meta->i->use_bullet();
|
||||
tank_weapon.weapon_lv = 1;
|
||||
tank_weapon.ammo = 100;
|
||||
tank_weapon.ammo = entity->bullet_num;
|
||||
tank_weapon.meta = MetaMgr::Instance()->GetEquip(item_meta->i->use_bullet());
|
||||
tank_weapon.Recalc();
|
||||
}
|
||||
pos = entity->pos;
|
||||
RecalcSelfCollider();
|
||||
RecalcBuff();
|
||||
SyncAroundPlayers();
|
||||
room->NotifyUiUpdate();
|
||||
room->frame_event.AddTankBulletNumChg(this);
|
||||
} else {
|
||||
if (skin_jlf.skin_id != 0) {
|
||||
room->DropItem(pos, skin_jlf.skin_id, 1, skin_jlf.skin_lv);
|
||||
|
@ -247,6 +247,7 @@ protected:
|
||||
std::vector<int> smokes_;
|
||||
std::vector<int> explosions_;
|
||||
std::set<Human*> observers_;
|
||||
std::vector<int> chged_tank_bullet_nums_;
|
||||
Human* follow_target_ = nullptr;
|
||||
bool follow_synced_active_player = false;
|
||||
|
||||
|
@ -356,6 +356,7 @@ void Room::CreateThings()
|
||||
if (entity_uniid && equip_meta->i->is_luck() == 2) {
|
||||
Entity* loot_entity = GetEntityByUniId(entity_uniid);
|
||||
if (loot_entity && loot_entity->entity_type == ET_Loot) {
|
||||
((Loot*)loot_entity)->bullet_num = equip_meta->i->clip_volume();
|
||||
CarObject car;
|
||||
car.car_uniid = loot_entity->entity_uniid;
|
||||
car.car_id = equip_meta->i->id();
|
||||
@ -1401,6 +1402,10 @@ void Room::NotifyUiUpdate()
|
||||
&xtimer_attacher.timer_list_);
|
||||
}
|
||||
|
||||
void Room::UpdateCarObject(int old_uniid, int new_uniid)
|
||||
{
|
||||
}
|
||||
|
||||
void Room::NotifyWxVoip()
|
||||
{
|
||||
xtimer.AddDeadLineTimerAndAttach(0,
|
||||
|
@ -92,6 +92,8 @@ public:
|
||||
void FindLocationWithAabb(Entity* target, const a8::Vec2& aabb_pos, AabbCollider* aabb_box,
|
||||
float& new_x, float& new_y);
|
||||
void FillSMUiUpdate(cs::SMUiUpdate& msg);
|
||||
void NotifyUiUpdate();
|
||||
void UpdateCarObject(int old_uniid, int new_uniid);
|
||||
|
||||
private:
|
||||
int AllocUniid();
|
||||
@ -115,7 +117,6 @@ private:
|
||||
void AddObjectLater(Entity* entity);
|
||||
void OnGameOver();
|
||||
void RandRemoveAndroid();
|
||||
void NotifyUiUpdate();
|
||||
void NotifyWxVoip();
|
||||
|
||||
private:
|
||||
|
@ -61,6 +61,7 @@ struct Weapon
|
||||
|
||||
struct Skin
|
||||
{
|
||||
int tank_uniid = 0;
|
||||
int skin_id = 0;
|
||||
int skin_lv = 0;
|
||||
int bullet_num = 0;
|
||||
|
@ -102,6 +102,7 @@ message MFVector2D
|
||||
property_subtype: 库存数组索引
|
||||
property_type: 4 技能cd时间(剩余时间)
|
||||
property_type: 5 技能cd时间(总时间)
|
||||
property_type: 6 载具剩余子弹数
|
||||
*/
|
||||
message MFPropertyChg
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user