Mine issue.


(jaybird) #1

I’m trying to set a custom shader and colors to armed mines for spectators (as in Shoutcaster capability), but not having much luck. I tried the code I’m using with active players (i.e. I’m on axis and the mines display correctly when armed), but spectators cannot view them. The problem is that CG_Missle is not called for armed mines when a player is a spectator. It is called when the mine is unarmed (having just been placed on the ground).

My question is where is the client is controlling this, and/or how to ‘fix’ it.


(KillerWhale) #2

I believe the cause of this is serverside, CG_missile isn’t called because (in that case) the landmine entity isn’t send over to the client in a snapshot.
I haven’t tested this but just looking at the code it seems the team check in the function G_LandmineSnapshotCallback (G_missle.c) is the cause of this:


qboolean G_LandmineSnapshotCallback( int entityNum, int clientNum ) {
	gentity_t* ent		= &g_entities[ entityNum ];
	gentity_t* clEnt	= &g_entities[ clientNum ];
	team_t team;

	if( clEnt->client->sess.skill[ SK_BATTLE_SENSE ] >= 4 ) {
		return qtrue;
	}

	if( !G_LandmineArmed( ent ) ) {
		return qtrue;
	}

	if( G_LandmineSpotted( ent ) ) {
		return qtrue;
	}

	team = G_LandmineTeam( ent );
	if( team == clEnt->client->sess.sessionTeam ) {
		return qtrue;
	}

	//bani - fix for covops spotting
	if( clEnt->client->sess.playerType == PC_COVERTOPS && clEnt->client->ps.eFlags & EF_ZOOMING && ( clEnt->client->ps.stats[STAT_KEYS] & ( 1 << INV_BINOCS ) ) ) {
		return qtrue;
	}

	return qfalse;
}


(jaybird) #3

Ah right, that makes sense. I’ll give this a try later, thanks for the tip!