2019-07-31 14:05:36 +03:00
|
|
|
//
|
2023-05-24 23:41:23 +03:00
|
|
|
// YaPB, based on PODBot by Markus Klinge ("CountFloyd").
|
|
|
|
|
// Copyright © YaPB Project Developers <yapb@jeefo.net>.
|
2019-07-31 14:05:36 +03:00
|
|
|
//
|
2020-11-03 08:57:12 +03:00
|
|
|
// SPDX-License-Identifier: MIT
|
2019-07-31 14:05:36 +03:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include <yapb.h>
|
|
|
|
|
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
// on other than win32/linux platforms i.e. arm we're using xash3d engine to run which exposes
|
2021-09-30 16:37:40 +03:00
|
|
|
// nice interface to handle with linkents. if ever rehlds or hlds engine will ever run on ARM or
|
2023-05-12 20:00:06 +03:00
|
|
|
// other platforms, and you want to run bot on it without metamod, consider enabling LINKENT_STATIC_THUNKS
|
2021-09-30 16:37:40 +03:00
|
|
|
// when compiling the bot, to get it supported.
|
|
|
|
|
#if defined(LINKENT_STATIC_THUNKS)
|
2024-01-19 00:03:45 +03:00
|
|
|
void forwardEntity_helper (EntityProto &addr, const char *name, entvars_t *pev) {
|
2019-07-31 14:05:36 +03:00
|
|
|
if (!addr) {
|
2024-01-19 00:03:45 +03:00
|
|
|
addr = game.lib ().resolve <EntityProto> (name);
|
2019-07-31 14:05:36 +03:00
|
|
|
}
|
|
|
|
|
if (!addr) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
addr (pev);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-30 16:37:40 +03:00
|
|
|
#define LINK_ENTITY(entityName) \
|
|
|
|
|
CR_EXPORT void entityName (entvars_t *pev) { \
|
2024-01-19 00:03:45 +03:00
|
|
|
static EntityProto addr; \
|
2020-11-23 00:06:18 +03:00
|
|
|
forwardEntity_helper (addr, __FUNCTION__, pev); \
|
2019-07-31 14:05:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// entities in counter-strike...
|
|
|
|
|
LINK_ENTITY (DelayedUse)
|
|
|
|
|
LINK_ENTITY (ambient_generic)
|
|
|
|
|
LINK_ENTITY (ammo_338magnum)
|
|
|
|
|
LINK_ENTITY (ammo_357sig)
|
|
|
|
|
LINK_ENTITY (ammo_45acp)
|
|
|
|
|
LINK_ENTITY (ammo_50ae)
|
|
|
|
|
LINK_ENTITY (ammo_556nato)
|
|
|
|
|
LINK_ENTITY (ammo_556natobox)
|
|
|
|
|
LINK_ENTITY (ammo_57mm)
|
|
|
|
|
LINK_ENTITY (ammo_762nato)
|
|
|
|
|
LINK_ENTITY (ammo_9mm)
|
|
|
|
|
LINK_ENTITY (ammo_buckshot)
|
|
|
|
|
LINK_ENTITY (armoury_entity)
|
|
|
|
|
LINK_ENTITY (beam)
|
|
|
|
|
LINK_ENTITY (bodyque)
|
|
|
|
|
LINK_ENTITY (button_target)
|
|
|
|
|
LINK_ENTITY (cycler)
|
|
|
|
|
LINK_ENTITY (cycler_prdroid)
|
|
|
|
|
LINK_ENTITY (cycler_sprite)
|
|
|
|
|
LINK_ENTITY (cycler_weapon)
|
|
|
|
|
LINK_ENTITY (cycler_wreckage)
|
|
|
|
|
LINK_ENTITY (env_beam)
|
|
|
|
|
LINK_ENTITY (env_beverage)
|
|
|
|
|
LINK_ENTITY (env_blood)
|
|
|
|
|
LINK_ENTITY (env_bombglow)
|
|
|
|
|
LINK_ENTITY (env_bubbles)
|
|
|
|
|
LINK_ENTITY (env_debris)
|
|
|
|
|
LINK_ENTITY (env_explosion)
|
|
|
|
|
LINK_ENTITY (env_fade)
|
|
|
|
|
LINK_ENTITY (env_funnel)
|
|
|
|
|
LINK_ENTITY (env_global)
|
|
|
|
|
LINK_ENTITY (env_glow)
|
|
|
|
|
LINK_ENTITY (env_laser)
|
|
|
|
|
LINK_ENTITY (env_lightning)
|
|
|
|
|
LINK_ENTITY (env_message)
|
|
|
|
|
LINK_ENTITY (env_rain)
|
|
|
|
|
LINK_ENTITY (env_render)
|
|
|
|
|
LINK_ENTITY (env_shake)
|
|
|
|
|
LINK_ENTITY (env_shooter)
|
|
|
|
|
LINK_ENTITY (env_snow)
|
|
|
|
|
LINK_ENTITY (env_sound)
|
|
|
|
|
LINK_ENTITY (env_spark)
|
|
|
|
|
LINK_ENTITY (env_sprite)
|
|
|
|
|
LINK_ENTITY (fireanddie)
|
|
|
|
|
LINK_ENTITY (func_bomb_target)
|
|
|
|
|
LINK_ENTITY (func_breakable)
|
|
|
|
|
LINK_ENTITY (func_button)
|
|
|
|
|
LINK_ENTITY (func_buyzone)
|
|
|
|
|
LINK_ENTITY (func_conveyor)
|
|
|
|
|
LINK_ENTITY (func_door)
|
|
|
|
|
LINK_ENTITY (func_door_rotating)
|
|
|
|
|
LINK_ENTITY (func_escapezone)
|
|
|
|
|
LINK_ENTITY (func_friction)
|
|
|
|
|
LINK_ENTITY (func_grencatch)
|
|
|
|
|
LINK_ENTITY (func_guntarget)
|
|
|
|
|
LINK_ENTITY (func_healthcharger)
|
|
|
|
|
LINK_ENTITY (func_hostage_rescue)
|
|
|
|
|
LINK_ENTITY (func_illusionary)
|
|
|
|
|
LINK_ENTITY (func_ladder)
|
|
|
|
|
LINK_ENTITY (func_monsterclip)
|
|
|
|
|
LINK_ENTITY (func_mortar_field)
|
|
|
|
|
LINK_ENTITY (func_pendulum)
|
|
|
|
|
LINK_ENTITY (func_plat)
|
|
|
|
|
LINK_ENTITY (func_platrot)
|
|
|
|
|
LINK_ENTITY (func_pushable)
|
|
|
|
|
LINK_ENTITY (func_rain)
|
|
|
|
|
LINK_ENTITY (func_recharge)
|
|
|
|
|
LINK_ENTITY (func_rot_button)
|
|
|
|
|
LINK_ENTITY (func_rotating)
|
|
|
|
|
LINK_ENTITY (func_snow)
|
|
|
|
|
LINK_ENTITY (func_tank)
|
|
|
|
|
LINK_ENTITY (func_tankcontrols)
|
|
|
|
|
LINK_ENTITY (func_tanklaser)
|
|
|
|
|
LINK_ENTITY (func_tankmortar)
|
|
|
|
|
LINK_ENTITY (func_tankrocket)
|
|
|
|
|
LINK_ENTITY (func_trackautochange)
|
|
|
|
|
LINK_ENTITY (func_trackchange)
|
|
|
|
|
LINK_ENTITY (func_tracktrain)
|
|
|
|
|
LINK_ENTITY (func_train)
|
|
|
|
|
LINK_ENTITY (func_traincontrols)
|
|
|
|
|
LINK_ENTITY (func_vehicle)
|
|
|
|
|
LINK_ENTITY (func_vehiclecontrols)
|
|
|
|
|
LINK_ENTITY (func_vip_safetyzone)
|
|
|
|
|
LINK_ENTITY (func_wall)
|
|
|
|
|
LINK_ENTITY (func_wall_toggle)
|
|
|
|
|
LINK_ENTITY (func_water)
|
|
|
|
|
LINK_ENTITY (func_weaponcheck)
|
|
|
|
|
LINK_ENTITY (game_counter)
|
|
|
|
|
LINK_ENTITY (game_counter_set)
|
|
|
|
|
LINK_ENTITY (game_end)
|
|
|
|
|
LINK_ENTITY (game_player_equip)
|
|
|
|
|
LINK_ENTITY (game_player_hurt)
|
|
|
|
|
LINK_ENTITY (game_player_team)
|
|
|
|
|
LINK_ENTITY (game_score)
|
|
|
|
|
LINK_ENTITY (game_team_master)
|
|
|
|
|
LINK_ENTITY (game_team_set)
|
|
|
|
|
LINK_ENTITY (game_text)
|
|
|
|
|
LINK_ENTITY (game_zone_player)
|
2020-11-23 00:06:18 +03:00
|
|
|
LINK_ENTITY (gib)
|
2019-07-31 14:05:36 +03:00
|
|
|
LINK_ENTITY (gibshooter)
|
|
|
|
|
LINK_ENTITY (grenade)
|
|
|
|
|
LINK_ENTITY (hostage_entity)
|
|
|
|
|
LINK_ENTITY (info_bomb_target)
|
|
|
|
|
LINK_ENTITY (info_hostage_rescue)
|
|
|
|
|
LINK_ENTITY (info_intermission)
|
|
|
|
|
LINK_ENTITY (info_landmark)
|
|
|
|
|
LINK_ENTITY (info_map_parameters)
|
|
|
|
|
LINK_ENTITY (info_null)
|
|
|
|
|
LINK_ENTITY (info_player_deathmatch)
|
|
|
|
|
LINK_ENTITY (info_player_start)
|
|
|
|
|
LINK_ENTITY (info_target)
|
|
|
|
|
LINK_ENTITY (info_teleport_destination)
|
|
|
|
|
LINK_ENTITY (info_vip_start)
|
|
|
|
|
LINK_ENTITY (infodecal)
|
|
|
|
|
LINK_ENTITY (item_airtank)
|
|
|
|
|
LINK_ENTITY (item_airbox)
|
|
|
|
|
LINK_ENTITY (item_antidote)
|
|
|
|
|
LINK_ENTITY (item_assaultsuit)
|
|
|
|
|
LINK_ENTITY (item_battery)
|
|
|
|
|
LINK_ENTITY (item_healthkit)
|
|
|
|
|
LINK_ENTITY (item_kevlar)
|
|
|
|
|
LINK_ENTITY (item_longjump)
|
|
|
|
|
LINK_ENTITY (item_security)
|
|
|
|
|
LINK_ENTITY (item_sodacan)
|
|
|
|
|
LINK_ENTITY (item_suit)
|
|
|
|
|
LINK_ENTITY (item_thighpack)
|
|
|
|
|
LINK_ENTITY (light)
|
|
|
|
|
LINK_ENTITY (light_environment)
|
|
|
|
|
LINK_ENTITY (light_spot)
|
|
|
|
|
LINK_ENTITY (momentary_door)
|
|
|
|
|
LINK_ENTITY (momentary_rot_button)
|
|
|
|
|
LINK_ENTITY (monster_hevsuit_dead)
|
|
|
|
|
LINK_ENTITY (monster_mortar)
|
|
|
|
|
LINK_ENTITY (monster_scientist)
|
|
|
|
|
LINK_ENTITY (multi_manager)
|
|
|
|
|
LINK_ENTITY (multisource)
|
|
|
|
|
LINK_ENTITY (path_corner)
|
|
|
|
|
LINK_ENTITY (path_track)
|
|
|
|
|
LINK_ENTITY (player)
|
|
|
|
|
LINK_ENTITY (player_loadsaved)
|
|
|
|
|
LINK_ENTITY (player_weaponstrip)
|
|
|
|
|
LINK_ENTITY (point_clientcommand)
|
|
|
|
|
LINK_ENTITY (point_servercommand)
|
|
|
|
|
LINK_ENTITY (soundent)
|
|
|
|
|
LINK_ENTITY (spark_shower)
|
|
|
|
|
LINK_ENTITY (speaker)
|
|
|
|
|
LINK_ENTITY (target_cdaudio)
|
|
|
|
|
LINK_ENTITY (test_effect)
|
|
|
|
|
LINK_ENTITY (trigger)
|
|
|
|
|
LINK_ENTITY (trigger_auto)
|
|
|
|
|
LINK_ENTITY (trigger_autosave)
|
2023-01-28 19:04:11 +03:00
|
|
|
LINK_ENTITY (trigger_bomb_reset)
|
2019-07-31 14:05:36 +03:00
|
|
|
LINK_ENTITY (trigger_camera)
|
|
|
|
|
LINK_ENTITY (trigger_cdaudio)
|
|
|
|
|
LINK_ENTITY (trigger_changelevel)
|
|
|
|
|
LINK_ENTITY (trigger_changetarget)
|
|
|
|
|
LINK_ENTITY (trigger_counter)
|
|
|
|
|
LINK_ENTITY (trigger_endsection)
|
|
|
|
|
LINK_ENTITY (trigger_gravity)
|
|
|
|
|
LINK_ENTITY (trigger_hurt)
|
|
|
|
|
LINK_ENTITY (trigger_monsterjump)
|
|
|
|
|
LINK_ENTITY (trigger_multiple)
|
|
|
|
|
LINK_ENTITY (trigger_once)
|
|
|
|
|
LINK_ENTITY (trigger_push)
|
|
|
|
|
LINK_ENTITY (trigger_random)
|
|
|
|
|
LINK_ENTITY (trigger_random_time)
|
|
|
|
|
LINK_ENTITY (trigger_random_unique)
|
|
|
|
|
LINK_ENTITY (trigger_relay)
|
|
|
|
|
LINK_ENTITY (trigger_setorigin)
|
|
|
|
|
LINK_ENTITY (trigger_teleport)
|
|
|
|
|
LINK_ENTITY (trigger_transition)
|
|
|
|
|
LINK_ENTITY (weapon_ak47)
|
|
|
|
|
LINK_ENTITY (weapon_aug)
|
|
|
|
|
LINK_ENTITY (weapon_awp)
|
|
|
|
|
LINK_ENTITY (weapon_c4)
|
|
|
|
|
LINK_ENTITY (weapon_deagle)
|
|
|
|
|
LINK_ENTITY (weapon_elite)
|
|
|
|
|
LINK_ENTITY (weapon_famas)
|
|
|
|
|
LINK_ENTITY (weapon_fiveseven)
|
|
|
|
|
LINK_ENTITY (weapon_flashbang)
|
|
|
|
|
LINK_ENTITY (weapon_g3sg1)
|
|
|
|
|
LINK_ENTITY (weapon_galil)
|
|
|
|
|
LINK_ENTITY (weapon_glock18)
|
|
|
|
|
LINK_ENTITY (weapon_hegrenade)
|
|
|
|
|
LINK_ENTITY (weapon_knife)
|
|
|
|
|
LINK_ENTITY (weapon_m249)
|
|
|
|
|
LINK_ENTITY (weapon_m3)
|
|
|
|
|
LINK_ENTITY (weapon_m4a1)
|
|
|
|
|
LINK_ENTITY (weapon_mac10)
|
|
|
|
|
LINK_ENTITY (weapon_mp5navy)
|
|
|
|
|
LINK_ENTITY (weapon_p228)
|
|
|
|
|
LINK_ENTITY (weapon_p90)
|
|
|
|
|
LINK_ENTITY (weapon_scout)
|
|
|
|
|
LINK_ENTITY (weapon_sg550)
|
|
|
|
|
LINK_ENTITY (weapon_sg552)
|
|
|
|
|
LINK_ENTITY (weapon_shield)
|
|
|
|
|
LINK_ENTITY (weapon_shieldgun)
|
|
|
|
|
LINK_ENTITY (weapon_smokegrenade)
|
|
|
|
|
LINK_ENTITY (weapon_tmp)
|
|
|
|
|
LINK_ENTITY (weapon_ump45)
|
|
|
|
|
LINK_ENTITY (weapon_usp)
|
|
|
|
|
LINK_ENTITY (weapon_xm1014)
|
|
|
|
|
LINK_ENTITY (weaponbox)
|
|
|
|
|
LINK_ENTITY (world_items)
|
|
|
|
|
LINK_ENTITY (worldspawn)
|
2021-09-30 16:37:40 +03:00
|
|
|
|
|
|
|
|
#endif
|