1
This commit is contained in:
commit
528f211ef0
@ -13,6 +13,7 @@
|
||||
#include "collider.h"
|
||||
#include "bullet.h"
|
||||
#include "explosion.h"
|
||||
#include "roomobstacle.h"
|
||||
|
||||
Hero::Hero():Creature()
|
||||
{
|
||||
@ -381,3 +382,16 @@ std::string Hero::GetName()
|
||||
{
|
||||
return meta->i->name();
|
||||
}
|
||||
|
||||
void Hero::DropItems(Obstacle* obstacle)
|
||||
{
|
||||
bool is_treasure_box = false;
|
||||
if (obstacle->IsEntitySubType(EST_RoomObstacle)) {
|
||||
is_treasure_box = ((RoomObstacle*)obstacle)->is_treasure_box;
|
||||
}
|
||||
int drop_id = obstacle->meta->i->drop();
|
||||
if (drop_id == 0) {
|
||||
return;
|
||||
}
|
||||
room->ScatterDrop(obstacle->GetPos(), drop_id);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ public:
|
||||
virtual void Update(int delta_time) override;
|
||||
virtual void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) override;
|
||||
virtual std::string GetName() override;
|
||||
virtual void DropItems(Obstacle* obstacle) override;
|
||||
|
||||
virtual float GetSpeed() override;
|
||||
virtual float GetRadius() override;
|
||||
|
@ -3480,8 +3480,14 @@ void Human::ProcLootWeapon(AddItemDTO& dto)
|
||||
|
||||
void Human::LootInteraction(Loot* entity)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("LootInteraction start %d:%d\n", {entity->GetUniId(), entity->item_id});
|
||||
#endif
|
||||
if (entity->pickuped ||
|
||||
entity->count <= 0) {
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("LootInteraction error1 %d:%d\n", {entity->GetUniId(), entity->item_id});
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
AddItemDTO dto;
|
||||
@ -3515,6 +3521,9 @@ void Human::LootInteraction(Loot* entity)
|
||||
void Human::ProcAddItemDto(AddItemDTO& dto)
|
||||
{
|
||||
if (!dto.item_meta) {
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("LootInteraction error20 %d:%d\n", {dto.uniid, dto.item_id});
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
switch (dto.item_meta->i->equip_type()) {
|
||||
|
@ -479,8 +479,14 @@ void Player::ProcInteraction()
|
||||
}
|
||||
for (auto obj_id : interaction_objids) {
|
||||
Entity* entity = room->GetEntityByUniId(obj_id);
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("LootInteraction %d\n", {obj_id});
|
||||
#endif
|
||||
if (entity) {
|
||||
if (entity->GetPos().Distance(GetPos()) > 600) {
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("LootInteraction error3 %d\n", {entity->GetUniId()});
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
switch (entity->GetEntityType()) {
|
||||
@ -507,6 +513,10 @@ void Player::ProcInteraction()
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("LootInteraction error4 %d\n", {obj_id});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
interaction_objids.Clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user