[HL2MP] Finish bot health charger support
HL2MP bots have unfinished support for using item_healthcharger and func_healthcharger entities to heal themselves. This pull request allows them to be supported to the same extent as regular health kits.
Specific changes made:
- Chargers with no juice are not considered when searching for health kits.
- Bots navigate to a point in front of the chargers, rather than directly into the chargers.
- Positions can be displayed using
hl2mp_bot_debug_health_scavenging, which was previously unused.
- Positions can be displayed using
- Chargers are now identified by finding
item_health*/func_health*and then searching for "charger" in the classname directly, rather than through leading wildcards with*charger*/*_health*, which Source does not support by default.- Previously, this was causing the health entity filter to evaluate all entities, and for all health kits to be considered chargers. The latter was not noticeable due to the health kits being consumed before any charger-related actions could take place.
- Range increased from
50to the actual player use radius, which is80by default. - Bots drop any prop they're holding with the gravity gun before interacting with a charger.
- Bots now look at the charger while using it.
- Bots now press the +USE button rather than invoking the chargers'
Use()functions directly, as the latter had issues. - Critical health now uses the correct comparison operator when deciding whether to abandon a charger.
- Bots will only abandon a charger they're currently using due to a threat if there is a clear path between them and the threat.
- Chargers are not considered when the bot has a visible enemy and is not at critical health. If the bot is currently moving to a charger, it will abandon it.
- This is partially based on the existing check for when a bot is already using the charger, and this prevents the bot from getting caught in a loop.
- Bots on "Expert" difficulty will now move left and right while using a charger to avoid standing still. This behavior can be toggled with
hl2mp_bot_health_charger_weave.
Here's a video of how health scavenging behavior worked prior to this pull request:
https://github.com/user-attachments/assets/a6b1c5f7-1155-4cd7-8f54-e08359c45396
Here's a video showing how it works with the changes included:
https://github.com/user-attachments/assets/aa6121f5-396e-4246-96fa-a3f0cdcb8b4d
Here's a video showing a bot on "Expert" difficulty using the aforementioned "weaving" behavior:
https://github.com/user-attachments/assets/96617a09-b412-400a-86d1-d195ece47bb1
I made additional changes for bots considering threats and reflected that in the change log.