1
This commit is contained in:
parent
b6403811e2
commit
1ef895af0b
@ -383,6 +383,9 @@ void InternalShot(Creature* c,
|
||||
if (c->HasBuffEffect(kBET_Hide)) {
|
||||
c->RemoveBuffByEffectId(kBET_Hide);
|
||||
}
|
||||
if (trace_target_uniid) {
|
||||
c->LockAttackDir(1000);
|
||||
}
|
||||
if (c->aiming) {
|
||||
c->aiming = false;
|
||||
c->aiming_frameno = 0;
|
||||
@ -3612,3 +3615,24 @@ void Creature::AddTraceBullet(int bullet_uniid, int target_uniid, int gun_id)
|
||||
},
|
||||
&xtimer_attacher.timer_list_);
|
||||
}
|
||||
|
||||
void Creature::LockAttackDir(int time)
|
||||
{
|
||||
IncDisableAttackDirTimes();
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(
|
||||
time / FRAME_RATE_MS,
|
||||
a8::XParams()
|
||||
.SetSender(this),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Creature* c = (Creature*)param.sender.GetUserData();
|
||||
},
|
||||
&xtimer_attacher.timer_list_,
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Creature* c = (Creature*)param.sender.GetUserData();
|
||||
c->DecDisableAttackDirTimes();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -277,6 +277,7 @@ class Creature : public MoveableEntity
|
||||
void RecalcDtoAttr();
|
||||
void AutoNavigation(a8::Vec2 target_pos, float speed);
|
||||
void AddTraceBullet(int bullet_uniid, int target_uniid, int gun_id);
|
||||
void LockAttackDir(int time);
|
||||
|
||||
protected:
|
||||
virtual void OnBuffRemove(Buff& buff);
|
||||
|
@ -547,6 +547,10 @@ void Player::Shot()
|
||||
GetPos().Distance(target->GetPos()) < GetCurrWeapon()->meta->i->trace_range()
|
||||
) {
|
||||
target_uniid = trace_target_uniid;
|
||||
a8::Vec2 attack_dir = target->GetPos() - GetPos();
|
||||
attack_dir.Normalize();
|
||||
SetAttackDir(attack_dir);
|
||||
target_dir = attack_dir;
|
||||
}
|
||||
}
|
||||
Creature::Shot(target_dir, shot_ok, fly_distance, target_uniid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user