c4 ok
This commit is contained in:
parent
b92abd1ec6
commit
a3b6a8fbbb
@ -142,6 +142,17 @@ void Bullet::ProcBomb()
|
||||
ProcMolotorCocktailBomb(delay_time);
|
||||
}
|
||||
break;
|
||||
case IS_C4:
|
||||
{
|
||||
//c4
|
||||
delay_time = gun_meta->i->missiles_time();
|
||||
ProcC4Bomb(delay_time);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
room->RemoveObjectLater(this);
|
||||
}
|
||||
@ -191,7 +202,8 @@ bool Bullet::IsBomb()
|
||||
meta->i->_inventory_slot() == IS_FRAG ||
|
||||
meta->i->_inventory_slot() == IS_SMOKE ||
|
||||
meta->i->_inventory_slot() == IS_POSION_GAS_BOMB ||
|
||||
meta->i->_inventory_slot() == IS_MOLOTOR_COCKTAIL;
|
||||
meta->i->_inventory_slot() == IS_MOLOTOR_COCKTAIL ||
|
||||
meta->i->_inventory_slot() == IS_C4;
|
||||
}
|
||||
|
||||
void Bullet::MapServiceUpdate()
|
||||
@ -241,7 +253,13 @@ void Bullet::Check(float distance)
|
||||
AabbCollider aabb_box;
|
||||
c->GetHitAabbBox(aabb_box);
|
||||
if (c != sender.Get() && !c->dead && TestCollision(room, &aabb_box)) {
|
||||
objects.insert(c);
|
||||
if (meta->i->_inventory_slot() == IS_C4) {
|
||||
if (!c->IsHuman()) {
|
||||
objects.insert(c);
|
||||
}
|
||||
} else {
|
||||
objects.insert(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -333,3 +351,32 @@ void Bullet::ProcMolotorCocktailBomb(int delay_time)
|
||||
sender.Get()->buff_vec2_param1 = old_buff_vec2_param1;
|
||||
}
|
||||
}
|
||||
|
||||
void Bullet::ProcC4Bomb(int delay_time)
|
||||
{
|
||||
if (sender.Get()) {
|
||||
FragMiTask* task = new FragMiTask();
|
||||
task->room = room;
|
||||
task->sender.Attach(sender.Get());
|
||||
task->bomb_pos = GetPos();
|
||||
task->gun_meta = gun_meta;
|
||||
task->meta = meta;
|
||||
task->atk = GetAtk();
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(std::max(1, (int)(delay_time / FRAME_RATE_MS)),
|
||||
a8::XParams()
|
||||
.SetSender(task),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
FragMiTask* task = (FragMiTask*)param.sender.GetUserData();
|
||||
task->Done();
|
||||
},
|
||||
&task->timer_attacher.timer_list_,
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
FragMiTask* task = (FragMiTask*)param.sender.GetUserData();
|
||||
delete task;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ protected:
|
||||
void ProcFragBomb(int delay_time);
|
||||
void ProcPosionGasBomb(int delay_time);
|
||||
void ProcMolotorCocktailBomb(int delay_time);
|
||||
void ProcC4Bomb(int delay_time);
|
||||
inline void MapServiceUpdate();
|
||||
void Check(float distance);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user