c4 ok
This commit is contained in:
parent
68119fdc01
commit
12c1e08a72
@ -139,6 +139,28 @@ void Bullet::ProcBomb()
|
|||||||
sender.Get()->GetAbility()->GetAttrAbs(kHAT_WeaponExplosionDealyTime);
|
sender.Get()->GetAbility()->GetAttrAbs(kHAT_WeaponExplosionDealyTime);
|
||||||
delay_time = std::max(0, delay_time);
|
delay_time = std::max(0, delay_time);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
room->xtimer.AddDeadLineTimerAndAttach
|
||||||
|
(delay_time / FRAME_RATE_MS,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(GetPos().x)
|
||||||
|
.SetParam1(GetPos().y)
|
||||||
|
.SetParam2(GetUniId())
|
||||||
|
.SetParam3(room),
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
Room* room = (Room*)param.param3.GetUserData();
|
||||||
|
float x = param.sender.GetDouble();
|
||||||
|
float y = param.param1.GetDouble();
|
||||||
|
int bullet_uniid = param.param2;
|
||||||
|
room->frame_event.RemoveBullet(a8::Vec2(x, y), bullet_uniid);
|
||||||
|
},
|
||||||
|
&room->timer_attacher.timer_list_,
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
switch (meta->i->_inventory_slot()) {
|
switch (meta->i->_inventory_slot()) {
|
||||||
case IS_RPG:
|
case IS_RPG:
|
||||||
{
|
{
|
||||||
|
@ -64,15 +64,16 @@ void InternalShot(Creature* c,
|
|||||||
if (c->room->BattleStarted() ||
|
if (c->room->BattleStarted() ||
|
||||||
(c->room->GetGasData().gas_mode == GasJump &&
|
(c->room->GetGasData().gas_mode == GasJump &&
|
||||||
!c->HasBuffEffect(kBET_Jump))) {
|
!c->HasBuffEffect(kBET_Jump))) {
|
||||||
c->room->CreateBullet(c,
|
bullet_uniid = c->room->CreateBullet
|
||||||
c->shot_passenger,
|
(c,
|
||||||
weapon_meta,
|
c->shot_passenger,
|
||||||
weapon_upgrade_meta,
|
weapon_meta,
|
||||||
bullet_meta,
|
weapon_upgrade_meta,
|
||||||
bullet_born_pos,
|
bullet_meta,
|
||||||
bullet_dir,
|
bullet_born_pos,
|
||||||
fly_distance,
|
bullet_dir,
|
||||||
is_tank_skin);
|
fly_distance,
|
||||||
|
is_tank_skin);
|
||||||
}
|
}
|
||||||
if (bullet_uniid == 0) {
|
if (bullet_uniid == 0) {
|
||||||
bullet_uniid = c->room->AllocUniid();
|
bullet_uniid = c->room->AllocUniid();
|
||||||
|
@ -111,13 +111,24 @@ void FrameEvent::AddBullet(int bullet_uniid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameEvent::RemoveBullet(Bullet* bullet)
|
void FrameEvent::RemoveBullet(a8::Vec2 pos, int bullet_uniid)
|
||||||
{
|
{
|
||||||
if (bullet->sender.Get()) {
|
del_bullets_.push_back(bullet_uniid);
|
||||||
del_bullets_.push_back(bullet->GetUniId());
|
{
|
||||||
int bullet_idx = del_bullets_.size() - 1;
|
std::set<GridCell*> grid_list;
|
||||||
bullet->sender.Get()->TraverseAllLayerHumanList
|
room->grid_service->GetAllCellsByXy
|
||||||
(
|
(
|
||||||
|
room,
|
||||||
|
pos.x,
|
||||||
|
pos.y,
|
||||||
|
grid_list
|
||||||
|
);
|
||||||
|
|
||||||
|
int bullet_idx = del_bullets_.size() - 1;
|
||||||
|
room->grid_service->TraverseAllLayerHumanList
|
||||||
|
(
|
||||||
|
room->GetRoomIdx(),
|
||||||
|
grid_list,
|
||||||
[bullet_idx] (Human* hum, bool& stop)
|
[bullet_idx] (Human* hum, bool& stop)
|
||||||
{
|
{
|
||||||
hum->del_bullets_.push_back(bullet_idx);
|
hum->del_bullets_.push_back(bullet_idx);
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
a8::Vec2 born_pos,
|
a8::Vec2 born_pos,
|
||||||
a8::Vec2 dir,
|
a8::Vec2 dir,
|
||||||
float fly_distance);
|
float fly_distance);
|
||||||
void RemoveBullet(Bullet* bullet);
|
void RemoveBullet(a8::Vec2 pos, int bullet_uniid);
|
||||||
void AddExplosion(Bullet* bullet, int item_id, a8::Vec2 bomb_pos);
|
void AddExplosion(Bullet* bullet, int item_id, a8::Vec2 bomb_pos);
|
||||||
void AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos);
|
void AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos);
|
||||||
void AddPlaySkill(CreatureWeakPtr& sender, int skill_id);
|
void AddPlaySkill(CreatureWeakPtr& sender, int skill_id);
|
||||||
|
@ -117,7 +117,7 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(Human* hum)
|
|||||||
for (size_t idx : hum->del_bullets_) {
|
for (size_t idx : hum->del_bullets_) {
|
||||||
if (idx < room->frame_event.del_bullets_.size()) {
|
if (idx < room->frame_event.del_bullets_.size()) {
|
||||||
int bullet_uniid = room->frame_event.del_bullets_[idx];
|
int bullet_uniid = room->frame_event.del_bullets_[idx];
|
||||||
msg->add_del_objids(bullet_uniid);
|
msg->add_del_bullets(bullet_uniid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t idx : hum->explosions_) {
|
for (size_t idx : hum->explosions_) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user