This commit is contained in:
aozhiwei 2023-11-16 21:58:59 +08:00
parent 593e6baa29
commit 2c243936dd
3 changed files with 25 additions and 3 deletions

View File

@ -3788,3 +3788,10 @@ void Creature::CheckShotHold()
}
}
}
void Creature::Throw(int throw_uniid, int slot,
const glm::vec3& pos, const glm::vec3& dir,
float fly_distance, int estimated_time)
{
}

View File

@ -370,7 +370,8 @@ class Creature : public MoveableEntity
virtual void NetInitOk();
bool IsNearGas(float distance);
float GetSafeAreaRaidus();
std::shared_ptr<std::set<int>> CalcReporterList(bool is_trace_bullet,
std::shared_ptr<std::set<int>> CalcReporterList
(bool is_trace_bullet,
const mt::Equip* weapon_meta,
const mt::Equip* bullet_meta);
bool CanShot(bool try_reload);
@ -394,6 +395,9 @@ class Creature : public MoveableEntity
float GetSkillLocalVar(int skill_id, int idx);
void SetSkillLocalVar(int skill_id, int idx, float val);
void CheckShotHold();
void Throw(int throw_uniid, int slot,
const glm::vec3& pos, const glm::vec3& dir,
float fly_distance, int estimated_time);
protected:
virtual void OnBuffRemove(Buff& buff);

View File

@ -1489,6 +1489,17 @@ behaviac::EBTStatus HeroAgent::ThrowItem(int slot)
if (!CanThrowItem(slot)) {
return behaviac::BT_FAILURE;
}
if (!current_target_agent->IsValid()) {
return behaviac::BT_FAILURE;
}
if (slot > 0 && slot < owner_->weapons.size()) {
Weapon& weapon = owner_->weapons[slot];
if (weapon.weapon_idx != 0 &&
weapon.meta &&
weapon.ammo > 0) {
//return true;
}
}
return behaviac::BT_FAILURE;
}