1
This commit is contained in:
parent
7dda3bffb3
commit
1436e0ae7e
@ -3864,3 +3864,28 @@ void Human::ProcUseItem(int item_id)
|
||||
DecItem(item_id, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Weapon* Human::TakeWeapon(MetaData::Equip* equip_meta)
|
||||
{
|
||||
Weapon* weapon = nullptr;
|
||||
if (equip_meta->i->equip_type() == EQUIP_TYPE_WEAPON) {
|
||||
if (equip_meta->i->equip_subtype() == 1) {
|
||||
} else {
|
||||
for (int i = GUN_SLOT1; i <= GUN_SLOT2; ++i) {
|
||||
if (weapons[i].weapon_id == 0) {
|
||||
weapon = &weapons[i];
|
||||
weapon->weapon_idx = i;
|
||||
} else if (weapons[i].meta->i->equip_subtype() ==
|
||||
equip_meta->i->equip_subtype()){
|
||||
if (equip_meta->i->quality() > weapons[i].meta->i->quality()) {
|
||||
weapon = &weapons[i];
|
||||
weapon->weapon_idx = i;
|
||||
} else {
|
||||
weapon = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return weapon;
|
||||
}
|
||||
|
@ -275,6 +275,7 @@ private:
|
||||
virtual void OnBuffRemove(Buff& buff) override;
|
||||
virtual void DoSkillPreProc(int skill_id, int target_id, const a8::Vec2& target_pos) override;
|
||||
virtual void DoSkillPostProc(bool used, int skill_id, int target_id, const a8::Vec2& target_pos) override;
|
||||
Weapon* TakeWeapon(MetaData::Equip* equip_meta);
|
||||
|
||||
protected:
|
||||
int level_ = 0;
|
||||
|
@ -546,8 +546,13 @@ void Player::LootInteraction(Loot* entity)
|
||||
need_sync_active_player = true;
|
||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||
} else {
|
||||
if (FreezeOperate()) {
|
||||
return;
|
||||
}
|
||||
Weapon* weapon = nullptr;
|
||||
bool switch_gun = false;
|
||||
#if 0
|
||||
#else
|
||||
if (weapons[GUN_SLOT1].weapon_id == 0) {
|
||||
weapon = &weapons[GUN_SLOT1];
|
||||
weapon->weapon_idx = GUN_SLOT1;
|
||||
@ -561,6 +566,7 @@ void Player::LootInteraction(Loot* entity)
|
||||
switch_gun = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!weapon) {
|
||||
/*
|
||||
cs::SMPickup notifymsg;
|
||||
|
@ -1755,6 +1755,7 @@ void Room::AirDrop(int appear_time, int box_id, int airdrop_id)
|
||||
param.param2.GetDouble(),
|
||||
param.param3.GetDouble()
|
||||
);
|
||||
obstacle->PushCollisionObjects();
|
||||
obstacle->is_treasure_box = true;
|
||||
if (room->GetRoomMode() == kZombieMode) {
|
||||
obstacle->is_terminator_airdrop_box =
|
||||
|
@ -488,7 +488,9 @@ void RoomObstacle::SummonAirDropBox(int box_id)
|
||||
GetPos().x,
|
||||
GetPos().y
|
||||
);
|
||||
|
||||
if (obstacle) {
|
||||
obstacle->PushCollisionObjects();
|
||||
}
|
||||
}
|
||||
|
||||
Entity* RoomObstacle::GetRealObject(Room* room)
|
||||
@ -606,3 +608,19 @@ void RoomObstacle::Destory()
|
||||
#endif
|
||||
DetachFromMaster();
|
||||
}
|
||||
|
||||
void RoomObstacle::PushCollisionObjects()
|
||||
{
|
||||
std::set<GridCell*> grid_list;
|
||||
room->grid_service->GetAllCellsByXy(room, GetPos().x, GetPos().y, grid_list);
|
||||
room->grid_service->TraverseCreatures
|
||||
(
|
||||
room->GetRoomIdx(),
|
||||
grid_list,
|
||||
[this] (Creature* c, bool& stop)
|
||||
{
|
||||
if (TestCollision(room, c)) {
|
||||
c->MustBeAddBuff(c, 8003);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ class RoomObstacle : public Obstacle
|
||||
RoomObstacleWeakPtr AllocWeakPtr();
|
||||
RoomObstacleWeakPtr& GetWeakPtrRef();
|
||||
void Destory();
|
||||
void PushCollisionObjects();
|
||||
|
||||
private:
|
||||
void SpecExplosion();
|
||||
|
Loading…
x
Reference in New Issue
Block a user