添加坦克压人处理
This commit is contained in:
parent
f7d50f25f1
commit
559eec5146
@ -112,6 +112,7 @@ enum VirtualWeapon_e
|
|||||||
VW_Spectate = 9000001,
|
VW_Spectate = 9000001,
|
||||||
VW_SelfDetonate = 9000002,
|
VW_SelfDetonate = 9000002,
|
||||||
VW_Mine = 9000003,
|
VW_Mine = 9000003,
|
||||||
|
VW_Tank = 9000004,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum VirtualPlayer_e
|
enum VirtualPlayer_e
|
||||||
|
@ -762,15 +762,25 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
|||||||
((Human*)hum)->stats.kills++;
|
((Human*)hum)->stats.kills++;
|
||||||
((Human*)hum)->kill_humans.insert(this);
|
((Human*)hum)->kill_humans.insert(this);
|
||||||
((Human*)hum)->SyncAroundPlayers();
|
((Human*)hum)->SyncAroundPlayers();
|
||||||
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(weapon_id);
|
if (weapon_id == VW_Tank) {
|
||||||
if (equip_meta) {
|
|
||||||
std::string msg = a8::Format("%s 使用 %s 干掉了 %s",
|
std::string msg = a8::Format("%s 使用 %s 干掉了 %s",
|
||||||
{
|
{
|
||||||
killer_name,
|
killer_name,
|
||||||
equip_meta->i->name(),
|
"载具",
|
||||||
name
|
name
|
||||||
});
|
});
|
||||||
SendRollMsg(msg);
|
SendRollMsg(msg);
|
||||||
|
} else {
|
||||||
|
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(weapon_id);
|
||||||
|
if (equip_meta) {
|
||||||
|
std::string msg = a8::Format("%s 使用 %s 干掉了 %s",
|
||||||
|
{
|
||||||
|
killer_name,
|
||||||
|
equip_meta->i->name(),
|
||||||
|
name
|
||||||
|
});
|
||||||
|
SendRollMsg(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1986,6 +1996,26 @@ int Human::SkinLv()
|
|||||||
return skin.skin_lv;
|
return skin.skin_lv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::CheckSkinTank()
|
||||||
|
{
|
||||||
|
if (tank_weapon.meta) {
|
||||||
|
std::set<Human*> objects;
|
||||||
|
for (auto& grid : grid_list) {
|
||||||
|
for (Human* hum: grid->human_list) {
|
||||||
|
if (hum != this && !hum->dead &&
|
||||||
|
(hum->team_id == 0 || team_id != hum->team_id)) {
|
||||||
|
if (TestCollision(hum)) {
|
||||||
|
objects.insert(hum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//end for
|
||||||
|
for (Human* hum : objects) {
|
||||||
|
hum->BeKill(entity_uniid, name, VW_Tank);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Human::_UpdateMove(int speed)
|
void Human::_UpdateMove(int speed)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < speed; ++i) {
|
for (int i = 0; i < speed; ++i) {
|
||||||
|
@ -208,6 +208,7 @@ class Human : public Entity
|
|||||||
const Skin& GetSkin();
|
const Skin& GetSkin();
|
||||||
int SkinId();
|
int SkinId();
|
||||||
int SkinLv();
|
int SkinLv();
|
||||||
|
void CheckSkinTank();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _UpdateMove(int speed);
|
void _UpdateMove(int speed);
|
||||||
|
@ -123,6 +123,9 @@ void Player::UpdateMove()
|
|||||||
if (last_collision_door && !TestCollision(last_collision_door)) {
|
if (last_collision_door && !TestCollision(last_collision_door)) {
|
||||||
last_collision_door = nullptr;
|
last_collision_door = nullptr;
|
||||||
}
|
}
|
||||||
|
if (tank_weapon.meta) {
|
||||||
|
CheckSkinTank();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::UpdateShot()
|
void Player::UpdateShot()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user