1
This commit is contained in:
parent
f1072cc7d1
commit
c4ec0b0a4e
@ -114,6 +114,7 @@ class Human : public Creature
|
||||
|
||||
bool shot_start = false;
|
||||
bool shot_hold = false;
|
||||
xtimer_list* shot_hold_timer = nullptr;
|
||||
int series_shot_frames = 0;
|
||||
float fly_distance = 0.0f;
|
||||
|
||||
|
@ -212,6 +212,7 @@ void Player::UpdateShot()
|
||||
}
|
||||
if (shot_hold) {
|
||||
++series_shot_frames;
|
||||
CheckShotHoldState(p_weapon);
|
||||
if (last_shot_frameno_ == 0 ||
|
||||
(
|
||||
(room->GetFrameNo() - last_shot_frameno_) * (1000 / SERVER_FRAME_RATE)) >=
|
||||
@ -1621,3 +1622,38 @@ void Player::UpdateAiming()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::CheckShotHoldState(Weapon* weapon)
|
||||
{
|
||||
if (weapon->meta->buff_meta && weapon->meta->buff_meta->i->trigger_type() == kBTT_SeriesShot) {
|
||||
if (shot_hold_timer) {
|
||||
if (weapon->meta->buff_meta->i->buff_id() !=
|
||||
room->xtimer.MutableParams(shot_hold_timer)->param1.GetInt()) {
|
||||
room->xtimer.DeleteTimer(shot_hold_timer);
|
||||
}
|
||||
}
|
||||
//second
|
||||
if (!shot_hold_timer) {
|
||||
MustBeAddBuff(this, weapon->meta->buff_meta->i->buff_id());
|
||||
shot_hold_timer = room->xtimer.AddRepeatTimerAndAttach
|
||||
(
|
||||
1,
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(weapon->meta->buff_meta->i->buff_id()),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
if (hum->dead || !hum->shot_hold) {
|
||||
hum->room->xtimer.DeleteTimer(hum->shot_hold_timer);
|
||||
}
|
||||
},
|
||||
&xtimer_attacher.timer_list_,
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->shot_hold_timer = nullptr;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +125,7 @@ private:
|
||||
void InternalAdOk();
|
||||
void InternalUpdate(int delta_time);
|
||||
std::vector<std::tuple<int, int, int>>* GetBox(int box_id);
|
||||
void CheckShotHoldState(Weapon* weapon);
|
||||
|
||||
private:
|
||||
std::map<int, std::vector<std::tuple<int, int, int>>> box_hash_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user