Skip to content
Permalink
Browse files

reduce impact of close humans on evolution (#1130)

* reduce impact of close humans on evolution
  • Loading branch information
Gireen committed Dec 2, 2019
1 parent 18803c9 commit 430414ebcc35db2c0bc746c908fc9cb3477f6ebd
Showing with 24 additions and 3 deletions.
  1. +20 −3 src/sgame/sg_cmds.cpp
  2. +2 −0 src/sgame/sg_extern.h
  3. +2 −0 src/sgame/sg_main.cpp
@@ -2345,6 +2345,10 @@ static bool Cmd_Class_internal( gentity_t *ent, const char *s, bool report )

num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );

int alienBuildingsInRange = 0;
int humansInRange = 0;
bool visibleToHumans = false;

for ( i = 0; i < num; i++ )
{
other = &g_entities[ entityList[ i ] ];
@@ -2353,13 +2357,26 @@ static bool Cmd_Class_internal( gentity_t *ent, const char *s, bool report )
( other->s.eType == entityType_t::ET_BUILDABLE && other->buildableTeam == TEAM_HUMANS &&
other->powered ) )
{
if ( report )
humansInRange++;
if( !visibleToHumans && G_LineOfSight( ent, other ) )
{
G_TriggerMenu( clientNum, MN_A_TOOCLOSE );
visibleToHumans = true;
}
return false;

}
else if ( ( other->s.eType == entityType_t::ET_BUILDABLE && other->buildableTeam == TEAM_ALIENS ) )
{
alienBuildingsInRange++;
}
}
if ( visibleToHumans && alienBuildingsInRange < ( humansInRange * g_evolveAroundHumans.Get() ) ) {
if ( report )
{
G_TriggerMenu( clientNum, MN_A_TOOCLOSE );
}
return false;
}


//check that we are not wallwalking
if ( ent->client->ps.eFlags & EF_WALLCLIMB )
@@ -169,6 +169,8 @@ extern vmCvar_t g_debugEntities;

extern vmCvar_t g_instantBuilding;

extern Cvar::Cvar<float> g_evolveAroundHumans;

// bot buy cvars
extern vmCvar_t g_bot_buy;
extern vmCvar_t g_bot_rifle;
@@ -207,6 +207,8 @@ vmCvar_t g_emptyTeamsSkipMapTime;

Cvar::Cvar<bool> g_neverEnd("g_neverEnd", "cheat to never end a game, helpful to load a map without spawn for testing purpose", Cvar::NONE, false);

Cvar::Cvar<float> g_evolveAroundHumans("g_evolveAroundHumans", "Ratio of alien buildings to human entities that always allow evolution", Cvar::NONE, 1.5f);

// <bot stuff>

// bot buy cvars

0 comments on commit 430414e

Please sign in to comment.
You can’t perform that action at this time.