Skip to content

Fix bots not being able to see ghoster behind smoke#1998

Open
sunzenshen wants to merge 1 commit into
NeotokyoRebuild:masterfrom
sunzenshen:bot-fix-visiblity-of-ghoster-behind-smoke
Open

Fix bots not being able to see ghoster behind smoke#1998
sunzenshen wants to merge 1 commit into
NeotokyoRebuild:masterfrom
sunzenshen:bot-fix-visiblity-of-ghoster-behind-smoke

Conversation

@sunzenshen

Copy link
Copy Markdown
Contributor

Description

Fixes bots not being able to see a ghost carrier from behind smoke despite the apparent glowing beacon visible by human players.

Toolchain

  • Windows MSVC VS2022

@sunzenshen

Copy link
Copy Markdown
Contributor Author

To test,

  • set bots to a non-support class using bot_class 1
  • use sv_neo_infinite_smoke_grenades 1 to create a smoke screen while holding the ghost
  • before this patch, bots would not see you, after the patch they will see you if you are carrying the ghost.

@sunzenshen sunzenshen added the Bots Related to bot players label Jun 19, 2026
@sunzenshen sunzenshen requested a review from a team June 19, 2026 23:22
@AdamTadeusz AdamTadeusz requested a review from a team June 26, 2026 08:02
return assert_cast<CNEO_Player*>(pEntity);
}

inline const CNEO_Player *ToNEOPlayer(const CBaseEntity *pEntity)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have ToNEOPlayer in c_neo_player.h, maybe keep the declaration here and move both definitions to neo_player_shared.cpp?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I looked into this, and I'm not exactly sure what you mean by the relation with c_neo_player.h

I just needed the const for const CNEO_Player *, so that I can get a const pointer for my use case here.

I also wasn't sure how moving both definitions to neo_player_shared.cpp actually made things clearer, because with how I understand this, it would involve defining branches around #ifdef CLIENT_DLL, which I'm not sure is actually more readable, e.g.:

In neo_player_shared.h:

#ifdef CLIENT_DLL
class C_BaseEntity;
class C_NEO_Player;
C_NEO_Player *ToNEOPlayer(C_BaseEntity *pEntity);
#else
class CBaseEntity;
class CNEO_Player;
CNEO_Player *ToNEOPlayer(CBaseEntity *pEntity);
const CNEO_Player *ToNEOPlayer(const CBaseEntity *pEntity);
#endif

and in neo_player_shared.cpp:

#ifdef CLIENT_DLL
C_NEO_Player *ToNEOPlayer(C_BaseEntity *pEntity)
{
	if (!pEntity || !pEntity->IsPlayer())
	{
		return nullptr;
	}
#if _DEBUG
	Assert(dynamic_cast<C_NEO_Player*>(pEntity));
#endif
	return static_cast<C_NEO_Player*>(pEntity);
}
#else
CNEO_Player *ToNEOPlayer(CBaseEntity *pEntity)
{
	if (!pEntity || !pEntity->IsPlayer())
	{
		return nullptr;
	}
	return assert_cast<CNEO_Player*>(pEntity);
}

const CNEO_Player *ToNEOPlayer(const CBaseEntity *pEntity)
{
	if (!pEntity || !pEntity->IsPlayer())
	{
		return nullptr;
	}
	return assert_cast<const CNEO_Player*>(pEntity);
}
#endif

... if it's okay, maybe we can go with the original PR approach?

@AdamTadeusz AdamTadeusz requested a review from a team June 26, 2026 11:43
@sunzenshen sunzenshen force-pushed the bot-fix-visiblity-of-ghoster-behind-smoke branch from b3a0335 to d06e900 Compare June 27, 2026 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bots Related to bot players

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants