Make getting into AT-ST easier

This commit is contained in:
Petr Bartos 2023-04-09 19:38:32 +02:00
parent d121206f83
commit b9d0314a6a
2 changed files with 34 additions and 14 deletions

View file

@ -1669,6 +1669,14 @@ qboolean CanUseInfrontOf(gentity_t *ent)
return qfalse;
}
// Check if player is standing on drivable AT-ST
if (ent->client->ps.groundEntityNum < ENTITYNUM_WORLD) {
target = &g_entities[ent->client->ps.groundEntityNum];
if (target && target->e_UseFunc == useF_misc_atst_use) {
return qtrue;
}
}
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
if (thirdPersonActive) {
VectorCopy(ent->currentOrigin, src);
@ -1712,13 +1720,6 @@ qboolean CanUseInfrontOf(gentity_t *ent)
return qfalse;
}
}
else if ( target->e_UseFunc == useF_misc_atst_use )
{//drivable AT-ST from JK2
if ( ent->client->ps.groundEntityNum != target->s.number )
{//must be standing on it to use it
return qfalse;
}
}
else if ( target->NPC!=NULL && target->health<=0 )
{
return qfalse;
@ -1771,6 +1772,15 @@ void TryUse_Internal( bool offHand, gentity_t *ent, vec3_t src, vec3_t vf )
trace_t trace;
vec3_t dest;
// Drivable AT-ST can be used if player stands on it
if (ent->client->ps.groundEntityNum < ENTITYNUM_WORLD) {
target = &g_entities[ent->client->ps.groundEntityNum];
if (target && target->e_UseFunc == useF_misc_atst_use) {
GEntity_UseFunc( target, ent, ent );
return;
}
}
//extend to find end of use trace
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h

View file

@ -1442,6 +1442,14 @@ qboolean CanUseInfrontOf(gentity_t *ent)
return qfalse;
}
// Check if player is standing on drivable AT-ST
if (ent->client->ps.groundEntityNum < ENTITYNUM_WORLD) {
target = &g_entities[ent->client->ps.groundEntityNum];
if (target && target->e_UseFunc == useF_misc_atst_use) {
return qtrue;
}
}
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
if (thirdPersonActive) {
VectorCopy(ent->currentOrigin, src);
@ -1485,13 +1493,6 @@ qboolean CanUseInfrontOf(gentity_t *ent)
return qfalse;
}
}
else if ( target->e_UseFunc == useF_misc_atst_use )
{//drivable AT-ST from JK2
if ( ent->client->ps.groundEntityNum != target->s.number )
{//must be standing on it to use it
return qfalse;
}
}
else if ( target->NPC!=NULL && target->health<=0 )
{
return qfalse;
@ -1536,6 +1537,15 @@ void TryUse_Internal( bool offHand, gentity_t *ent, vec3_t src, vec3_t vf ) {
trace_t trace;
vec3_t dest;
// Drivable AT-ST can be used if player stands on it
if (ent->client->ps.groundEntityNum < ENTITYNUM_WORLD) {
target = &g_entities[ent->client->ps.groundEntityNum];
if (target && target->e_UseFunc == useF_misc_atst_use) {
GEntity_UseFunc( target, ent, ent );
return;
}
}
//extend to find end of use trace
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h