1
This commit is contained in:
parent
716bc32f24
commit
0cf71b1d25
@ -11,12 +11,13 @@ class Compose
|
|||||||
~Compose();
|
~Compose();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
void IncNum();
|
||||||
|
int GetNum() { return num_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
void TakeOnWeapon(Weapon* weapon);
|
void TakeOnWeapon(Weapon* weapon);
|
||||||
void IncNum();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Creature* owner_ = nullptr;
|
Creature* owner_ = nullptr;
|
||||||
|
@ -353,6 +353,7 @@ class Creature : public MoveableEntity
|
|||||||
bool CanShot(bool try_reload);
|
bool CanShot(bool try_reload);
|
||||||
void AdjustPos();
|
void AdjustPos();
|
||||||
void OnLand();
|
void OnLand();
|
||||||
|
std::shared_ptr<Compose> GetCompose() { return compose_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void OnBuffRemove(Buff& buff);
|
virtual void OnBuffRemove(Buff& buff);
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "hero.h"
|
#include "hero.h"
|
||||||
#include "guide.h"
|
#include "guide.h"
|
||||||
|
#include "compose.h"
|
||||||
|
|
||||||
#include "buff/sprint.h"
|
#include "buff/sprint.h"
|
||||||
|
|
||||||
@ -2636,9 +2637,27 @@ void Human::ProcLootWeaponNew(AddItemDTO& dto)
|
|||||||
if (GetCurrWeapon()->weapon_idx == GUN_SLOT1 ||
|
if (GetCurrWeapon()->weapon_idx == GUN_SLOT1 ||
|
||||||
GetCurrWeapon()->weapon_idx == GUN_SLOT2) {
|
GetCurrWeapon()->weapon_idx == GUN_SLOT2) {
|
||||||
if (GetCurrWeapon()->weapon_id == dto.item_meta->id()) {
|
if (GetCurrWeapon()->weapon_id == dto.item_meta->id()) {
|
||||||
|
if (GetCompose()->GetNum() >= 9) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GetCompose()->IncNum();
|
||||||
|
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||||
|
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||||
|
dto.handled = true;
|
||||||
} else {
|
} else {
|
||||||
|
int old_weapon_idx = GetCurrWeapon()->weapon_idx;
|
||||||
|
DropWeapon(GetCurrWeapon()->weapon_idx, 1);
|
||||||
|
Weapon* weapon = &weapons[old_weapon_idx];
|
||||||
|
weapon->weapon_id = dto.item_id;
|
||||||
|
weapon->meta = dto.item_meta;
|
||||||
|
weapon->ammo = 0;
|
||||||
|
weapon->Recalc();
|
||||||
|
weapon->ammo = weapon->GetClipVolume(this);
|
||||||
|
AutoLoadingBullet();
|
||||||
|
SetCurrWeapon(weapon);
|
||||||
|
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||||
|
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||||
|
dto.handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user