This commit is contained in:
aozhiwei 2023-05-22 15:22:30 +08:00
parent 424d3cf3b6
commit 5f981ad7ca
4 changed files with 29 additions and 9 deletions

View File

@ -1259,7 +1259,7 @@ void Human::DeadDrop()
0, 0,
false); false);
const mt::Equip* gem_stone_meta = mt::Equip::GetGemStone(); const mt::Equip* gem_stone_meta = mt::Equip::GetYellowStone();
if (gem_stone_meta) { if (gem_stone_meta) {
Position drop_pos = GetPos(); Position drop_pos = GetPos();
room->DropItem(drop_pos.ToGlmVec3(), gem_stone_meta->id(), gemstone, 1); room->DropItem(drop_pos.ToGlmVec3(), gem_stone_meta->id(), gemstone, 1);

View File

@ -5,7 +5,9 @@
IMPL_TABLE(mt::Equip) IMPL_TABLE(mt::Equip)
std::map<int, const mt::Equip*> mt::Equip::slot_hash_; std::map<int, const mt::Equip*> mt::Equip::slot_hash_;
const mt::Equip* mt::Equip::gem_stone_ = nullptr; const mt::Equip* mt::Equip::yellow_stone_ = nullptr;
const mt::Equip* mt::Equip::blue_stone_ = nullptr;
const mt::Equip* mt::Equip::purple_stone_ = nullptr;
namespace mt namespace mt
{ {
@ -327,12 +329,24 @@ namespace mt
void Equip::StaticPostInit() void Equip::StaticPostInit()
{ {
gem_stone_ = GetById(GEMSTONE_ID); yellow_stone_ = GetById(YELLOW_STONE_ID);
blue_stone_ = GetById(BLUE_STONE_ID);
purple_stone_ = GetById(PURPLE_STONE_ID);
} }
const Equip* Equip::GetGemStone() const Equip* Equip::GetYellowStone()
{ {
return gem_stone_; return yellow_stone_;
}
const Equip* Equip::GetBlueStone()
{
return blue_stone_;
}
const Equip* Equip::GetPurpleStone()
{
return purple_stone_;
} }
} }

View File

@ -10,7 +10,9 @@ namespace mt
"equip@equip.json", "equip@equip.json",
"id") "id")
public: public:
static const int GEMSTONE_ID = 31001; static const int YELLOW_STONE_ID = 31001;
static const int BLUE_STONE_ID = 31003;
static const int PURPLE_STONE_ID = 31004;
int lock_time = 0; int lock_time = 0;
//0,0,0,0,后座力,是否取消定身 //0,0,0,0,后座力,是否取消定身
@ -44,11 +46,15 @@ namespace mt
bool Match(EventAddBuff_e event, int val, int val2) const; bool Match(EventAddBuff_e event, int val, int val2) const;
static const Equip* GetByIdBySlotId(int slot_id); static const Equip* GetByIdBySlotId(int slot_id);
static void AdjustMuzzlePos(); static void AdjustMuzzlePos();
static const Equip* GetGemStone(); static const Equip* GetYellowStone();
static const Equip* GetBlueStone();
static const Equip* GetPurpleStone();
static void StaticPostInit(); static void StaticPostInit();
private: private:
static const mt::Equip* gem_stone_; static const mt::Equip* yellow_stone_;
static const mt::Equip* blue_stone_;
static const mt::Equip* purple_stone_;
static std::map<int, const mt::Equip*> slot_hash_; static std::map<int, const mt::Equip*> slot_hash_;
std::map<int, std::shared_ptr<std::tuple<float, float, float>>> _gun_muzzle_position_hash_; std::map<int, std::shared_ptr<std::tuple<float, float, float>>> _gun_muzzle_position_hash_;
}; };

View File

@ -525,7 +525,7 @@ void Room::DropItemEx(const glm::vec3& born_pos, const glm::vec3& pos, int item_
{ {
const mt::Equip* equip_meta = mt::Equip::GetById(item_id); const mt::Equip* equip_meta = mt::Equip::GetById(item_id);
int group_num = equip_meta->group_num(); int group_num = equip_meta->group_num();
if (item_id == mt::Equip::GEMSTONE_ID && group_num <= 0) { if (item_id == mt::Equip::YELLOW_STONE_ID && group_num <= 0) {
group_num = 1; group_num = 1;
} }
if (equip_meta && group_num > 0 && item_count > 0) { if (equip_meta && group_num > 0 && item_count > 0) {