]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: implement real-time detection of revival of target frozen players so bot...
authorterencehill <piuntn@gmail.com>
Wed, 18 Apr 2018 18:14:53 +0000 (20:14 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 19 Apr 2018 13:33:51 +0000 (15:33 +0200)
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/navigation.qh

index 7ce6efa45fc63af8e3bd50991b1bdac3dcf1336c..9d4ef6336104b2d3c6006ddc07b66ad08b5c91e5 100644 (file)
@@ -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);
index c79ed40a4304cac996f80b84b2917d94ec44ee0e..3625b4693ed5701a2c7079794b070aed01abdbd0 100644 (file)
@@ -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)
index f3103cc4fcd39d875708a0612e83c59addd03095..80498b691f8f2ddc4efcf7f4be0af0aeb4e7988e 100644 (file)
@@ -30,6 +30,7 @@ entity navigation_bestgoal;
 .float goalcurrent_distance_time;
 
 .float goalentity_lock_timeout;
+.bool goalentity_shouldbefrozen;
 
 .entity nearestwaypoint;
 .float nearestwaypointtimeout;