This commit is contained in:
aozhiwei 2023-11-16 22:20:07 +08:00
parent c91d2ea249
commit fe5244c52d
2 changed files with 9 additions and 49 deletions

View File

@ -3841,7 +3841,9 @@ void Creature::Throw(int throw_uniid, int slot,
0, 0,
1, 1,
nullptr); nullptr);
//pending_throw_bomb[throw_uniid] = throw_bomb; if (IsPlayer()) {
AsPlayer()->pending_throw_bomb[throw_uniid] = AsPlayer()->throw_bomb;
}
room->xtimer.SetTimeoutEx room->xtimer.SetTimeoutEx
( (
SERVER_FRAME_RATE * 15, SERVER_FRAME_RATE * 15,

View File

@ -1725,29 +1725,6 @@ void Player::UpdateThrowBomb()
if (weapon.weapon_idx != 0 && if (weapon.weapon_idx != 0 &&
weapon.meta && weapon.meta &&
weapon.ammo > 0) { weapon.ammo > 0) {
if (HasBuffEffect(kBET_Hide)) {
RemoveHideEffect(kShotReason);
}
if (!nature_recover_hp_idle_timer.expired()) {
room->xtimer.FireEvent
(
nature_recover_hp_idle_timer,
kRemoveNatureRecoverTimerEvent,
nullptr);
}
--weapon.ammo;
room->frame_event.AddPropChgEx
(
GetWeakPtrRef(),
kPropWeaponAmmo,
weapon.weapon_idx,
weapon.ammo,
weapon.GetClipVolume(this),
0,
true
);
DecInventory(equip_meta->_inventory_slot(), 1);
SyncVolume(equip_meta->_inventory_slot());
glm::vec3 bomb_pos = glm::vec3( glm::vec3 bomb_pos = glm::vec3(
throw_bomb->pos().x(), throw_bomb->pos().x(),
throw_bomb->pos().y(), throw_bomb->pos().y(),
@ -1758,31 +1735,12 @@ void Player::UpdateThrowBomb()
throw_bomb->dir().y(), throw_bomb->dir().y(),
throw_bomb->dir().z() throw_bomb->dir().z()
); );
SetAttackDir(bomb_dir); Throw(0,
int throw_uniid = room->AllocUniid(); slot_id,
room->frame_event.AddBullet bomb_pos,
( bomb_dir,
throw_uniid, throw_bomb->fly_distance(),
GetWeakPtrRef(), 0);
equip_meta,
1,
bomb_pos,
bomb_dir,
throw_bomb->fly_distance(),
0,
1,
nullptr);
pending_throw_bomb[throw_uniid] = throw_bomb;
room->xtimer.SetTimeoutEx
(
SERVER_FRAME_RATE * 15,
[this, throw_uniid] (int event, const a8::Args* args)
{
if (a8::TIMER_DELETE_EVENT == event) {
ProcThrowDmg(throw_uniid);
}
},
&room->xtimer_attacher_);
} }
} }
} }