1
This commit is contained in:
parent
43f1b0d5d9
commit
02bee0a615
@ -1408,6 +1408,37 @@ void Human::DoSkill()
|
||||
use_skill = false;
|
||||
}
|
||||
|
||||
void Human::DoGetOn(int obj_uniid)
|
||||
{
|
||||
if (room->GetGasData().gas_mode == GasInactive) {
|
||||
return;
|
||||
}
|
||||
Entity* entity = room->GetEntityByUniId(obj_uniid);
|
||||
if (!entity) {
|
||||
return;
|
||||
}
|
||||
if (GetPos().Distance(entity->GetPos()) > MetaMgr::Instance()->max_mount_horse_distance) {
|
||||
return;
|
||||
}
|
||||
if (downed) {
|
||||
return;
|
||||
}
|
||||
switch (entity->GetEntityType()) {
|
||||
case ET_Loot:
|
||||
{
|
||||
DoGetOnWithLoot((Loot*)entity);
|
||||
}
|
||||
break;
|
||||
case ET_Player:
|
||||
{
|
||||
DoGetOnWithTeammate((Human*)entity);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Human::DoGetDown()
|
||||
{
|
||||
if (car_.car_id != 0) {
|
||||
@ -2724,44 +2755,7 @@ void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta)
|
||||
|
||||
void Human::ProcLootCar(Loot* entity, MetaData::Equip* item_meta)
|
||||
{
|
||||
if (room->GetGasData().gas_mode == GasInactive) {
|
||||
return;
|
||||
}
|
||||
if (GetPos().Distance(entity->GetPos()) > MetaMgr::Instance()->max_mount_horse_distance) {
|
||||
return;
|
||||
}
|
||||
if (downed) {
|
||||
return;
|
||||
}
|
||||
if (car_.car_id != 0) {
|
||||
int loot_uniid = room->CreateLoot(car_.car_id, GetPos(), 1, 1);
|
||||
Entity* loot_entity = room->GetEntityByUniId(loot_uniid);
|
||||
if (loot_entity && loot_entity->IsEntityType(ET_Loot)) {
|
||||
((Loot*)loot_entity)->bullet_num = 0;
|
||||
((Loot*)loot_entity)->param1 = 0;
|
||||
((Loot*)loot_entity)->param2 = 0;
|
||||
room->UpdateCarObject(car_.car_uniid,
|
||||
loot_entity->GetEntityUniId(),
|
||||
loot_entity->GetPos());
|
||||
}
|
||||
room->TakeOffCarObject(loot_uniid, GetPos());
|
||||
if (car_.meta->i->buffid()) {
|
||||
RemoveBuffById(car_.meta->i->buffid());
|
||||
}
|
||||
car_weapon = Weapon();
|
||||
}
|
||||
car_.car_uniid = entity->GetEntityUniId();
|
||||
car_.car_id = item_meta->i->id();
|
||||
car_.meta = item_meta;
|
||||
SetPos(entity->GetPos());
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(car_.meta->i->buffid());
|
||||
if (buff_meta) {
|
||||
AddBuff(this, buff_meta, 1);
|
||||
}
|
||||
CancelAction();
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
room->TakeOnCarObject(car_.car_uniid);
|
||||
room->NotifyUiUpdate();
|
||||
DoGetOn(entity->GetEntityUniId());
|
||||
}
|
||||
|
||||
void Human::ProcCamoutflage(Loot* entity, MetaData::Equip* item_meta)
|
||||
@ -4308,3 +4302,45 @@ void Human::NextReload(int prev_weapon_id, int prev_weapon_idx)
|
||||
AutoLoadingBullet(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Human::DoGetOnWithLoot(Loot* loot_entity)
|
||||
{
|
||||
MetaData::Equip* item_meta = MetaMgr::Instance()->GetEquip(loot_entity->item_id);
|
||||
if (!item_meta) {
|
||||
return;
|
||||
}
|
||||
if (car_.car_id != 0) {
|
||||
int loot_uniid = room->CreateLoot(car_.car_id, GetPos(), 1, 1);
|
||||
Entity* loot_entity = room->GetEntityByUniId(loot_uniid);
|
||||
if (loot_entity && loot_entity->IsEntityType(ET_Loot)) {
|
||||
((Loot*)loot_entity)->bullet_num = 0;
|
||||
((Loot*)loot_entity)->param1 = 0;
|
||||
((Loot*)loot_entity)->param2 = 0;
|
||||
room->UpdateCarObject(car_.car_uniid,
|
||||
loot_entity->GetEntityUniId(),
|
||||
loot_entity->GetPos());
|
||||
}
|
||||
room->TakeOffCarObject(loot_uniid, GetPos());
|
||||
if (car_.meta->i->buffid()) {
|
||||
RemoveBuffById(car_.meta->i->buffid());
|
||||
}
|
||||
car_weapon = Weapon();
|
||||
}
|
||||
car_.car_uniid = loot_entity->GetEntityUniId();
|
||||
car_.car_id = item_meta->i->id();
|
||||
car_.meta = item_meta;
|
||||
SetPos(loot_entity->GetPos());
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(car_.meta->i->buffid());
|
||||
if (buff_meta) {
|
||||
AddBuff(this, buff_meta, 1);
|
||||
}
|
||||
CancelAction();
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
room->TakeOnCarObject(car_.car_uniid);
|
||||
room->NotifyUiUpdate();
|
||||
}
|
||||
|
||||
void Human::DoGetOnWithTeammate(Human* teammate)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -207,6 +207,7 @@ class Human : public MoveableEntity
|
||||
bool CanUseSkill();
|
||||
void DoJump();
|
||||
void DoSkill();
|
||||
void DoGetOn(int obj_uniid);
|
||||
void DoGetDown();
|
||||
void FindLocation();
|
||||
void RefreshView();
|
||||
@ -348,6 +349,8 @@ private:
|
||||
void OnBuffRemove(const Buff& buff);
|
||||
void OnLand();
|
||||
void NextReload(int prev_weapon_id, int prev_weapon_idx);
|
||||
void DoGetOnWithLoot(Loot* loot_entity);
|
||||
void DoGetOnWithTeammate(Human* teammate);
|
||||
|
||||
protected:
|
||||
int level_ = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user