1
This commit is contained in:
commit
bdfebc11dd
@ -80,7 +80,10 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
||||
if (IsFlyHook()) {
|
||||
if (sender.Get() && !sender.Get()->dead) {
|
||||
for (auto& target : objects) {
|
||||
ProcFlyHook(target);
|
||||
if (target->IsCreature(room) &&
|
||||
!((Creature*)target)->IsCar()) {
|
||||
ProcFlyHook(target);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -611,7 +614,19 @@ void Bullet::Check(float distance)
|
||||
sender.Get()->IncDisableAttackDirTimes();
|
||||
sender.Get()->room->xtimer.AddDeadLineTimerAndAttach
|
||||
(
|
||||
(0.2 + distance / gun_meta->i->bullet_speed() / 2) * SERVER_FRAME_RATE,
|
||||
(distance / gun_meta->i->bullet_speed() / 2) * SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(sender.Get()),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Creature* c = (Creature*)param.sender.GetUserData();
|
||||
c->RemoveBuffById(kKeepShotAnimiBuffId);
|
||||
},
|
||||
&sender.Get()->xtimer_attacher.timer_list_
|
||||
);
|
||||
sender.Get()->room->xtimer.AddDeadLineTimerAndAttach
|
||||
(
|
||||
(0.75 + distance / gun_meta->i->bullet_speed() / 2) * SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(sender.Get()),
|
||||
[] (const a8::XParams& param)
|
||||
@ -619,7 +634,6 @@ void Bullet::Check(float distance)
|
||||
Creature* c = (Creature*)param.sender.GetUserData();
|
||||
c->DecDisableMoveTimes();
|
||||
c->DecDisableAttackDirTimes();
|
||||
c->RemoveBuffById(kKeepShotAnimiBuffId);
|
||||
},
|
||||
&sender.Get()->xtimer_attacher.timer_list_
|
||||
);
|
||||
@ -806,15 +820,25 @@ void Bullet::ProcFlyHook(Entity* target)
|
||||
if (target->IsCreature(room)) {
|
||||
Creature* c = (Creature*)target;
|
||||
room->frame_event.AddPropChg(c->GetWeakPtrRef(), kPropBeHook, 0, sender.Get()->GetUniId());
|
||||
c->AutoNavigation(born_pos, gun_meta->i->bullet_speed() * 2);
|
||||
int buff_uniid = c->TryAddBuff(c, gun_meta->i->buffid());
|
||||
c->AutoNavigation(born_pos, gun_meta->i->bullet_speed() * 2,
|
||||
[buff_uniid] (Creature* c)
|
||||
{
|
||||
c->RemoveBuffByUniId(buff_uniid);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
sender.Get()->AutoNavigation(GetPos(), gun_meta->i->bullet_speed() * 2);
|
||||
sender.Get()->AutoNavigation(GetPos(), gun_meta->i->bullet_speed() * 2,
|
||||
[] (Creature* c)
|
||||
{
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
sender.Get()->IncDisableMoveTimes();
|
||||
sender.Get()->room->xtimer.AddDeadLineTimerAndAttach
|
||||
(
|
||||
(distance / gun_meta->i->bullet_speed() / 2) * SERVER_FRAME_RATE,
|
||||
(distance / gun_meta->i->bullet_speed() / 2 + 0.75) * SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(sender.Get()),
|
||||
[] (const a8::XParams& param)
|
||||
|
@ -3616,7 +3616,8 @@ void Creature::_UpdateSpecMove()
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::AutoNavigation(a8::Vec2 target_pos, float speed)
|
||||
void Creature::AutoNavigation(a8::Vec2 target_pos, float speed,
|
||||
std::function<void (Creature*)> cb)
|
||||
{
|
||||
float distance = GetPos().Distance(target_pos);
|
||||
if (distance < 0.001f) {
|
||||
|
@ -278,7 +278,8 @@ class Creature : public MoveableEntity
|
||||
float GetAttrAbs(int attr_id);
|
||||
float GetAttrRate(int attr_id);
|
||||
void RecalcDtoAttr();
|
||||
void AutoNavigation(a8::Vec2 target_pos, float speed);
|
||||
void AutoNavigation(a8::Vec2 target_pos, float speed,
|
||||
std::function<void (Creature*)> cb);
|
||||
void AddTraceBullet(int bullet_uniid, int target_uniid, int gun_id);
|
||||
void LockAttackDir(int time);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user