This commit is contained in:
aozhiwei 2023-05-29 15:17:52 +08:00
parent fb3bf9c79a
commit e1ad6de453
4 changed files with 21 additions and 1 deletions

View File

@ -1604,6 +1604,13 @@ void Human::DropItems(Obstacle* obstacle)
}
}
void Human::DropItems(const glm::vec3& center, std::vector<int>& drops)
{
for (int drop_id : drops) {
room->ScatterDrop(center, drop_id);
}
}
void Human::Revive()
{
{

View File

@ -232,6 +232,7 @@ class Human : public Creature
void AddItem(int item_id, int item_num);
void DecItem(int item_id, int item_num);
virtual void DropItems(Obstacle* obstacle) override;
void DropItems(const glm::vec3& center, std::vector<int>& drops);
void OnEnable();
void OnDisable();
virtual void UpdateMove() override;

View File

@ -298,11 +298,16 @@ bool Obstacle::DoInteraction(Human* sender)
dead_reason = 1;
Die(sender->room);
BroadcastFullState(sender->room);
std::vector<int> drops = meta->RandDrop();
glm::vec3 center = GetPos().ToGlmVec3();
sender->room->xtimer.SetTimeoutEx
(mt::Param::s().box_open_delay / FRAME_RATE_MS,
[sender, obj_uniid = GetUniId()] (int event, const a8::Args* args)
[sender, obj_uniid = GetUniId(), drops, center] (int event, const a8::Args* args) mutable
{
if (a8::TIMER_EXEC_EVENT == event) {
#if 1
sender->DropItems(center, drops);
#else
Entity* entity = sender->room->GetEntityByUniId(obj_uniid);
if (entity && entity->IsEntityType(ET_Obstacle)) {
Obstacle* ob = (Obstacle*)entity;
@ -310,6 +315,7 @@ bool Obstacle::DoInteraction(Human* sender)
sender->DropItems(ob);
}
}
#endif
return;
}
},

View File

@ -1383,7 +1383,13 @@ void Player::PushJoinRoomMsg()
notifymsg.set_error_code(0);
notifymsg.set_server_info(JsonDataMgr::Instance()->server_info);
room->FillSMJoinedNotify(this, notifymsg);
#ifdef DEBUG
if (App::Instance()->instance_id == 6) {
notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot);
}
#else
notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot);
#endif
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
}
{