This commit is contained in:
aozhiwei 2021-09-28 16:36:38 +00:00
parent 5e3b8e2774
commit ee22da622e
3 changed files with 7 additions and 4 deletions

View File

@ -2825,7 +2825,7 @@ void Creature::OnBattleStart(Room* room)
bool Creature::CanFollow(Creature* follower)
{
#ifdef DEBUG
#ifdef DEBUG1
return false;
#endif
if (follower->GetUniId() == GetUniId()) {

View File

@ -171,6 +171,7 @@ class Creature : public MoveableEntity
bool IsHuman() const;
bool IsCar() const;
Human* AsHuman() { return IsHuman() ? (Human*)this : nullptr; };
Player* AsPlayer() { return IsPlayer() ? (Player*)this : nullptr; };
Car* AsCar() { return IsCar() ? (Car*)this : nullptr; };
virtual void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) {};
void AddHp(float hp);

View File

@ -3721,10 +3721,12 @@ void Human::DoFollow(int target_id)
.SetSender(this),
[] (const a8::XParams& param)
{
Player* hum = (Player*)param.sender.GetUserData();
Human* hum = (Human*)param.sender.GetUserData();
if (!hum->follow_target.Get()) {
hum->moving = false;
hum->moved_frames = 0;
if (hum->IsPlayer()) {
hum->AsPlayer()->moving = false;
hum->AsPlayer()->moved_frames = 0;
}
hum->room->xtimer.DeleteTimer(hum->room->xtimer.GetRunningTimer());
return;
}