Custom.cfg (#213)

Added custom configs.

These are used for replacing some hardcoded strings inside bot code, currently custom cvar for parachute detection is available, as well as custom c4 model names.

Added editorconfig, and fixed CRLF for files (was a mix between LF & CRLF).
Fixed use-after-free sanitizer error with chatlib.
Fixed configs files loaded with memory-loader does not process last line in config files.
This commit is contained in:
jeefo 2020-12-15 15:28:58 +03:00 committed by GitHub
commit 075bff2988
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 533 additions and 404 deletions

View file

@ -572,7 +572,7 @@ void Bot::updatePickups () {
allowPickup = true;
pickupType = Pickup::DefusalKit;
}
else if (strncmp ("grenade", classname, 7) == 0 && strcmp (model, "c4.mdl") == 0) {
else if (strncmp ("grenade", classname, 7) == 0 && conf.getBombModelName () == model) {
allowPickup = true;
pickupType = Pickup::PlantedC4;
}
@ -2888,7 +2888,7 @@ void Bot::checkDarkness () {
}
void Bot::checkParachute () {
static auto parachute = engfuncs.pfnCVarGetPointer ("sv_parachute");
static auto parachute = engfuncs.pfnCVarGetPointer (conf.fetchCustom ("AMXParachuteCvar").chars ());
// if no cvar or it's not enabled do not bother
if (parachute && parachute->value > 0.0f) {
@ -5460,7 +5460,7 @@ edict_t *Bot::correctGrenadeVelocity (const char *model) {
edict_t *result = nullptr;
game.searchEntities ("classname", "grenade", [&] (edict_t *ent) {
if (ent->v.owner == this->ent () && strcmp (ent->v.model.chars (9), model) == 0) {
if (ent->v.owner == this->ent () && util.isModel (ent, model)) {
result = ent;
// set the correct velocity for the grenade