添加驹马处理
This commit is contained in:
parent
7e36000453
commit
0841282bf7
@ -181,6 +181,12 @@ enum EquipAttr_e
|
|||||||
EA_End
|
EA_End
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EquipType_e
|
||||||
|
{
|
||||||
|
EQUIP_TYPE_CAR = 9,
|
||||||
|
EQUIP_TYPE_End
|
||||||
|
};
|
||||||
|
|
||||||
enum EntityType_e
|
enum EntityType_e
|
||||||
{
|
{
|
||||||
ET_None = 0,
|
ET_None = 0,
|
||||||
|
@ -74,17 +74,9 @@ void Human::Initialize()
|
|||||||
float Human::GetSpeed()
|
float Human::GetSpeed()
|
||||||
{
|
{
|
||||||
if (a8::HasBitFlag(status, HS_Jump)) {
|
if (a8::HasBitFlag(status, HS_Jump)) {
|
||||||
#if 1
|
|
||||||
return meta->i->jump_speed();
|
return meta->i->jump_speed();
|
||||||
#else
|
|
||||||
return meta->i->jump_speed() + buff.speed;
|
|
||||||
#endif
|
|
||||||
} if (downed) {
|
} if (downed) {
|
||||||
#if 1
|
|
||||||
return meta->i->move_speed3();
|
return meta->i->move_speed3();
|
||||||
#else
|
|
||||||
return meta->i->move_speed3() + buff.speed;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
if (shot_hold) {
|
if (shot_hold) {
|
||||||
if (curr_weapon->weapon_idx == GUN_SLOT1 ||
|
if (curr_weapon->weapon_idx == GUN_SLOT1 ||
|
||||||
@ -96,11 +88,9 @@ float Human::GetSpeed()
|
|||||||
} else if (aiming) {
|
} else if (aiming) {
|
||||||
return meta->i->aiming_speed();
|
return meta->i->aiming_speed();
|
||||||
}
|
}
|
||||||
#if 1
|
float speed = meta->i->move_speed();
|
||||||
return meta->i->move_speed();
|
speed = (speed + buff_attr_abs_[kHAT_Speed]) * (1 + buff_attr_rate_[kHAT_Speed]);
|
||||||
#else
|
return std::max(speed, 1.0f);
|
||||||
return meta->i->move_speed() + buff.speed;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1081,20 +1071,22 @@ void Human::DoSkill()
|
|||||||
|
|
||||||
void Human::DoGetDown()
|
void Human::DoGetDown()
|
||||||
{
|
{
|
||||||
if (skin_tank.skin_id != 0) {
|
if (car_.car_id != 0) {
|
||||||
int entity_uniid = room->CreateLoot(skin_tank.skin_id, GetPos(), 1, 1);
|
int entity_uniid = room->CreateLoot(car_.car_id, GetPos(), 1, 1);
|
||||||
Entity* loot_entity = room->GetEntityByUniId(entity_uniid);
|
Entity* loot_entity = room->GetEntityByUniId(entity_uniid);
|
||||||
if (loot_entity && loot_entity->entity_type == ET_Loot) {
|
if (loot_entity && loot_entity->entity_type == ET_Loot) {
|
||||||
((Loot*)loot_entity)->bullet_num = tank_weapon.ammo;
|
((Loot*)loot_entity)->bullet_num = 0;
|
||||||
((Loot*)loot_entity)->param1 = tank_oil_value;
|
((Loot*)loot_entity)->param1 = 0;
|
||||||
((Loot*)loot_entity)->param2 = tank_oil_max;
|
((Loot*)loot_entity)->param2 = 0;
|
||||||
|
room->UpdateCarObject(car_.car_uniid, loot_entity->entity_uniid, loot_entity->GetPos());
|
||||||
}
|
}
|
||||||
room->UpdateCarObject(skin_tank.tank_uniid, entity_uniid, GetPos());
|
|
||||||
room->TakeOffCarObject(entity_uniid, GetPos());
|
room->TakeOffCarObject(entity_uniid, GetPos());
|
||||||
ResetTankSkin();
|
if (car_.meta->i->buffid()) {
|
||||||
|
RemoveBuffById(car_.meta->i->buffid());
|
||||||
|
}
|
||||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||||
room->NotifyUiUpdate();
|
room->NotifyUiUpdate();
|
||||||
need_sync_active_player = true;
|
car_ = HumanCar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2250,6 +2242,32 @@ void Human::ProcLootSkin(Loot* entity, MetaData::Equip* item_meta)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::ProcLootCar(Loot* entity, MetaData::Equip* item_meta)
|
||||||
|
{
|
||||||
|
if (car_.car_id != 0) {
|
||||||
|
int entity_uniid = room->CreateLoot(car_.car_id, GetPos(), 1, 1);
|
||||||
|
Entity* loot_entity = room->GetEntityByUniId(entity_uniid);
|
||||||
|
if (loot_entity && loot_entity->entity_type == 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->entity_uniid, loot_entity->GetPos());
|
||||||
|
}
|
||||||
|
RemoveBuffById(item_meta->i->buffid());
|
||||||
|
}
|
||||||
|
car_.car_uniid = entity->entity_uniid;
|
||||||
|
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(buff_meta, 1);
|
||||||
|
}
|
||||||
|
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||||
|
room->TakeOnCarObject(car_.car_uniid);
|
||||||
|
room->NotifyUiUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
void Human::FindLocationWithTarget(Entity* target)
|
void Human::FindLocationWithTarget(Entity* target)
|
||||||
{
|
{
|
||||||
a8::Vec2 old_pos = GetPos();
|
a8::Vec2 old_pos = GetPos();
|
||||||
@ -2316,6 +2334,7 @@ void Human::FindLocationWithTarget(Entity* target)
|
|||||||
void Human::OnDie()
|
void Human::OnDie()
|
||||||
{
|
{
|
||||||
room->OnHumanDie(this);
|
room->OnHumanDie(this);
|
||||||
|
DoGetDown();
|
||||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||||
if (team_members) {
|
if (team_members) {
|
||||||
for (auto& hum : *team_members) {
|
for (auto& hum : *team_members) {
|
||||||
|
@ -241,6 +241,7 @@ class Human : public Entity
|
|||||||
protected:
|
protected:
|
||||||
void _UpdateMove(int speed);
|
void _UpdateMove(int speed);
|
||||||
void ProcLootSkin(Loot* entity, MetaData::Equip* item_meta);
|
void ProcLootSkin(Loot* entity, MetaData::Equip* item_meta);
|
||||||
|
void ProcLootCar(Loot* entity, MetaData::Equip* item_meta);
|
||||||
void ResetTankSkin();
|
void ResetTankSkin();
|
||||||
void SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list);
|
void SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& target_list);
|
||||||
Buff* GetBuffById(int buff_id);
|
Buff* GetBuffById(int buff_id);
|
||||||
@ -292,6 +293,7 @@ protected:
|
|||||||
std::vector<int> chged_skillcds_;
|
std::vector<int> chged_skillcds_;
|
||||||
Human* follow_target_ = nullptr;
|
Human* follow_target_ = nullptr;
|
||||||
bool follow_synced_active_player = false;
|
bool follow_synced_active_player = false;
|
||||||
|
HumanCar car_;
|
||||||
|
|
||||||
MetaData::Skill* skill_meta_ = nullptr;
|
MetaData::Skill* skill_meta_ = nullptr;
|
||||||
|
|
||||||
|
@ -571,6 +571,11 @@ void Player::LootInteraction(Loot* entity)
|
|||||||
ProcLootSkin(entity, item_meta);
|
ProcLootSkin(entity, item_meta);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case EQUIP_TYPE_CAR:
|
||||||
|
{
|
||||||
|
ProcLootCar(entity, item_meta);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (item_meta->i->_inventory_slot() >= 0 &&
|
if (item_meta->i->_inventory_slot() >= 0 &&
|
||||||
|
@ -1570,7 +1570,7 @@ void Room::CreateMapObject(MetaData::MapTplThing& thing_tpl)
|
|||||||
1,
|
1,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
if (entity_uniid && equip_meta->i->is_luck() == 2) {
|
if (entity_uniid && equip_meta->i->equip_type() == EQUIP_TYPE_CAR) {
|
||||||
Entity* loot_entity = GetEntityByUniId(entity_uniid);
|
Entity* loot_entity = GetEntityByUniId(entity_uniid);
|
||||||
if (loot_entity && loot_entity->entity_type == ET_Loot) {
|
if (loot_entity && loot_entity->entity_type == ET_Loot) {
|
||||||
((Loot*)loot_entity)->bullet_num = equip_meta->i->clip_volume();
|
((Loot*)loot_entity)->bullet_num = equip_meta->i->clip_volume();
|
||||||
|
@ -111,6 +111,14 @@ struct CarObject
|
|||||||
bool taken = false;
|
bool taken = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct HumanCar
|
||||||
|
{
|
||||||
|
int car_id = 0;
|
||||||
|
int car_uniid = 0;
|
||||||
|
|
||||||
|
MetaData::Equip* meta = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
struct BornPoint
|
struct BornPoint
|
||||||
{
|
{
|
||||||
MetaData::MapTplThing* thing_tpl = nullptr;
|
MetaData::MapTplThing* thing_tpl = nullptr;
|
||||||
|
@ -88,6 +88,7 @@ message Equip
|
|||||||
optional string name = 35; //装备名字
|
optional string name = 35; //装备名字
|
||||||
optional float rad = 36; //半径
|
optional float rad = 36; //半径
|
||||||
optional float rad2 = 37;
|
optional float rad2 = 37;
|
||||||
|
optional int32 buffid = 38;
|
||||||
|
|
||||||
optional string inventory_slot = 31; //库存槽位
|
optional string inventory_slot = 31; //库存槽位
|
||||||
optional int32 _inventory_slot = 32; //库存槽位
|
optional int32 _inventory_slot = 32; //库存槽位
|
||||||
|
Loading…
x
Reference in New Issue
Block a user