1
This commit is contained in:
parent
534c22990d
commit
1fdbfcbdca
@ -16,3 +16,13 @@ void BoxDrop::UnInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BoxDrop::OnHeroDeadDrop(Hero* hero)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BoxDrop::OnObstacleDeadDrop(Obstacle* ob)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
class Room;
|
||||
class Hero;
|
||||
class Obstacle;
|
||||
|
||||
class BoxDrop : public std::enable_shared_from_this<BoxDrop>
|
||||
{
|
||||
@ -9,6 +11,8 @@ class BoxDrop : public std::enable_shared_from_this<BoxDrop>
|
||||
BoxDrop(Room* room);
|
||||
void Init();
|
||||
void UnInit();
|
||||
void OnHeroDeadDrop(Hero* hero);
|
||||
void OnObstacleDeadDrop(Obstacle* ob);
|
||||
|
||||
private:
|
||||
Room* room_ = nullptr;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "movement.h"
|
||||
#include "ability.h"
|
||||
#include "skill.h"
|
||||
#include "boxdrop.h"
|
||||
|
||||
#include "f8/btmgr.h"
|
||||
|
||||
@ -332,6 +333,7 @@ void Hero::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
dead = true;
|
||||
if (meta->HasDrop() && !room->IsPveRoom()) {
|
||||
room->ScatterDrop(GetPos().ToGlmVec3(), meta->RandDrop(), false, &items);
|
||||
room->GetBoxDrop()->OnHeroDeadDrop(this);
|
||||
}
|
||||
if (!room->IsPveRoom()) {
|
||||
for (int id : meta->_drop_list) {
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "entityfactory.h"
|
||||
#include "pbutils.h"
|
||||
#include "netdata.h"
|
||||
#include "boxdrop.h"
|
||||
|
||||
#include "mt/Equip.h"
|
||||
#include "mt/MapThing.h"
|
||||
@ -174,7 +175,10 @@ void Obstacle::OnBulletHit(IBullet* bullet)
|
||||
}
|
||||
if (IsDead(bullet->GetRoom())) {
|
||||
ProcDieExplosion(bullet->GetRoom());
|
||||
bullet->GetSender().Get()->DropItems(this);
|
||||
if (meta->HasDrop()) {
|
||||
bullet->GetSender().Get()->DropItems(this);
|
||||
bullet->GetRoom()->GetBoxDrop()->OnObstacleDeadDrop(this);
|
||||
}
|
||||
if (meta->thing_type() == kObstacleOilBucket) {
|
||||
const mt::MapThing* bomb_meta = mt::MapThing::GetById(meta->_int_param1);
|
||||
if (bomb_meta) {
|
||||
@ -225,6 +229,7 @@ void Obstacle::OnExplosionHit(Explosion* e)
|
||||
for (int drop_id : drops) {
|
||||
e->GetRoom()->ScatterDrop(GetPos().ToGlmVec3(), drop_id);
|
||||
}
|
||||
e->GetRoom()->GetBoxDrop()->OnObstacleDeadDrop(this);
|
||||
}
|
||||
if (meta->thing_type() == kObstacleOilBucket) {
|
||||
const mt::MapThing* bomb_meta = mt::MapThing::GetById(meta->_int_param1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user