This commit is contained in:
aozhiwei 2023-04-07 23:07:41 +08:00
parent 2a25b7b7c3
commit 5c1d6b38df
3 changed files with 21 additions and 1 deletions

View File

@ -99,6 +99,8 @@ namespace mt
METAMGR_READ(move_step_len, 80);
METAMGR_READ(early_parachute_jump, 0);
METAMGR_READ(box_open_delay, 0);
}
#if 0
{

View File

@ -88,6 +88,8 @@ namespace mt
int revive_time = 15;
int move_step_len = 80;
int box_open_delay = 0;
};
static void StaticPostInit();
static const S& s() { return s_; };

View File

@ -21,6 +21,7 @@
#include "mt/Buff.h"
#include "mt/Hero.h"
#include "mt/Skill.h"
#include "mt/Param.h"
Obstacle::Obstacle():Entity()
{
@ -296,8 +297,23 @@ bool Obstacle::DoInteraction(Human* sender)
if (!IsDead(sender->room) && IsOpenInteraction()) {
dead_reason = 1;
Die(sender->room);
sender->DropItems(this);
BroadcastFullState(sender->room);
sender->room->xtimer.SetTimeoutEx
(mt::Param::s().box_open_delay / FRAME_RATE_MS,
[sender, obj_uniid = GetUniId()] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
Entity* entity = sender->room->GetEntityByUniId(obj_uniid);
if (entity && entity->IsEntityType(ET_Obstacle)) {
Obstacle* ob = (Obstacle*)entity;
if (ob->IsRoomObstacle()) {
sender->DropItems(ob);
}
}
return;
}
},
&sender->xtimer_attacher);
if (meta->delay_destroy() > 0) {
sender->room->xtimer.SetTimeoutEx
(meta->delay_destroy() / FRAME_RATE_MS,