From: terencehill Date: Wed, 18 Apr 2018 18:14:53 +0000 (+0200) Subject: Bot AI: implement real-time detection of revival of target frozen players so bot... X-Git-Tag: xonotic-v0.8.5~1923^2~61 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a19daa9ff9643efd139c7ef8507306478679b878;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: implement real-time detection of revival of target frozen players so bot can immediately find another goal --- diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index 7ce6efa45..9d4ef6336 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -801,10 +801,14 @@ void havocbot_movetogoal(entity this) navigation_shortenpath(this); + bool goalcurrent_can_be_removed = false; if (IS_MOVABLE(this.goalcurrent)) { - if (IS_DEAD(this.goalcurrent)) + // if is movable => not frozen + if (IS_DEAD(this.goalcurrent) || (this.goalentity_shouldbefrozen && this.goalentity == this.goalcurrent)) { + goalcurrent_can_be_removed = true; + // don't remove if not visible if (checkpvs(this.origin + this.view_ofs, this.goalcurrent)) { navigation_goalrating_timeout_force(this); @@ -832,7 +836,7 @@ void havocbot_movetogoal(entity this) { if (this.goalcurrent) { - if (IS_MOVABLE(this.goalcurrent) && IS_DEAD(this.goalcurrent)) + if (goalcurrent_can_be_removed) { // remove even if not visible navigation_goalrating_timeout_force(this); diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index c79ed40a4..3625b4693 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -731,6 +731,7 @@ void navigation_clearroute(entity this) this.goalcurrent_distance_z = FLOAT_MAX; this.goalcurrent_distance_time = 0; this.goalentity_lock_timeout = 0; + this.goalentity_shouldbefrozen = false; this.goalentity = NULL; this.goalcurrent = NULL; this.goalstack01 = NULL; @@ -1770,6 +1771,7 @@ void navigation_goalrating_end(entity this) this.aistatus |= AI_STATUS_STUCK; } } + this.goalentity_shouldbefrozen = boolean(STAT(FROZEN, this.goalentity)); } void botframe_updatedangerousobjects(float maxupdate) diff --git a/qcsrc/server/bot/default/navigation.qh b/qcsrc/server/bot/default/navigation.qh index f3103cc4f..80498b691 100644 --- a/qcsrc/server/bot/default/navigation.qh +++ b/qcsrc/server/bot/default/navigation.qh @@ -30,6 +30,7 @@ entity navigation_bestgoal; .float goalcurrent_distance_time; .float goalentity_lock_timeout; +.bool goalentity_shouldbefrozen; .entity nearestwaypoint; .float nearestwaypointtimeout;