1
This commit is contained in:
parent
fb3bf9c79a
commit
e1ad6de453
@ -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()
|
void Human::Revive()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@ -232,6 +232,7 @@ class Human : public Creature
|
|||||||
void AddItem(int item_id, int item_num);
|
void AddItem(int item_id, int item_num);
|
||||||
void DecItem(int item_id, int item_num);
|
void DecItem(int item_id, int item_num);
|
||||||
virtual void DropItems(Obstacle* obstacle) override;
|
virtual void DropItems(Obstacle* obstacle) override;
|
||||||
|
void DropItems(const glm::vec3& center, std::vector<int>& drops);
|
||||||
void OnEnable();
|
void OnEnable();
|
||||||
void OnDisable();
|
void OnDisable();
|
||||||
virtual void UpdateMove() override;
|
virtual void UpdateMove() override;
|
||||||
|
@ -298,11 +298,16 @@ bool Obstacle::DoInteraction(Human* sender)
|
|||||||
dead_reason = 1;
|
dead_reason = 1;
|
||||||
Die(sender->room);
|
Die(sender->room);
|
||||||
BroadcastFullState(sender->room);
|
BroadcastFullState(sender->room);
|
||||||
|
std::vector<int> drops = meta->RandDrop();
|
||||||
|
glm::vec3 center = GetPos().ToGlmVec3();
|
||||||
sender->room->xtimer.SetTimeoutEx
|
sender->room->xtimer.SetTimeoutEx
|
||||||
(mt::Param::s().box_open_delay / FRAME_RATE_MS,
|
(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 (a8::TIMER_EXEC_EVENT == event) {
|
||||||
|
#if 1
|
||||||
|
sender->DropItems(center, drops);
|
||||||
|
#else
|
||||||
Entity* entity = sender->room->GetEntityByUniId(obj_uniid);
|
Entity* entity = sender->room->GetEntityByUniId(obj_uniid);
|
||||||
if (entity && entity->IsEntityType(ET_Obstacle)) {
|
if (entity && entity->IsEntityType(ET_Obstacle)) {
|
||||||
Obstacle* ob = (Obstacle*)entity;
|
Obstacle* ob = (Obstacle*)entity;
|
||||||
@ -310,6 +315,7 @@ bool Obstacle::DoInteraction(Human* sender)
|
|||||||
sender->DropItems(ob);
|
sender->DropItems(ob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1383,7 +1383,13 @@ void Player::PushJoinRoomMsg()
|
|||||||
notifymsg.set_error_code(0);
|
notifymsg.set_error_code(0);
|
||||||
notifymsg.set_server_info(JsonDataMgr::Instance()->server_info);
|
notifymsg.set_server_info(JsonDataMgr::Instance()->server_info);
|
||||||
room->FillSMJoinedNotify(this, notifymsg);
|
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);
|
notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot);
|
||||||
|
#endif
|
||||||
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
|
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user