-
-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update func_vehicle for multiplayer (#792)
* Update func_vehicle for multiplayer. Added mp_legacy_vehicle_block cvar. * Update dist/game.cfg Co-authored-by: Sergey Shorokhov <[email protected]> * Update regamedll/dlls/game.cpp Co-authored-by: Sergey Shorokhov <[email protected]> * Fix default behavior * Optimization Thanks to #737 (comment) help! * Update README.md Co-authored-by: Sergey Shorokhov <[email protected]>
- Loading branch information
1 parent
86e7215
commit cf8deb9
Showing
7 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,7 +109,7 @@ void CFuncVehicle::Blocked(CBaseEntity *pOther) | |
pevOther->velocity.z += 300; | ||
pev->velocity = pev->velocity * 0.85; | ||
|
||
ALERT(at_aiconsole, "TRAIN(%s): Blocked by %s (dmg:%.2f)\n", STRING(pev->targetname), STRING(pOther->pev->classname), pev->dmg); | ||
ALERT(at_aiconsole, "TRAIN(%s): Blocked by %s (dmg:%.2f)\n", STRING(pev->targetname), STRING(pevOther->classname), pev->dmg); | ||
UTIL_MakeVectors(pev->angles); | ||
|
||
Vector forward, right, vOrigin; | ||
|
@@ -131,13 +131,42 @@ void CFuncVehicle::Blocked(CBaseEntity *pOther) | |
float maxz = pev->origin.z + (2 * Q_abs(int(pev->mins.z - pev->maxs.z))); | ||
#endif | ||
|
||
if (pOther->pev->origin.x < minx | ||
|| pOther->pev->origin.x > maxx | ||
|| pOther->pev->origin.y < miny | ||
|| pOther->pev->origin.y > maxy | ||
|| pOther->pev->origin.z < minz | ||
|| pOther->pev->origin.z > maxz) | ||
if (pevOther->origin.x < minx | ||
|| pevOther->origin.x > maxx | ||
|| pevOther->origin.y < miny | ||
|| pevOther->origin.y > maxy | ||
|| pevOther->origin.z < minz | ||
|| pevOther->origin.z > maxz) | ||
{ | ||
#ifdef REGAMEDLL_ADD | ||
if (legacy_vehicle_block.value) | ||
{ | ||
pOther->TakeDamage(pev, pev, 150, DMG_CRUSH); | ||
return; | ||
} | ||
|
||
CBasePlayer* playerDriver = static_cast<CBasePlayer*>(m_pDriver); | ||
|
||
if (pOther->Classify() == CLASS_PLAYER) | ||
{ | ||
CBasePlayer* playerOther = static_cast<CBasePlayer*>(pOther); | ||
if (!playerDriver || (!friendlyfire.value && playerDriver->m_iTeam == playerOther->m_iTeam)) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
UnrealKaraulov
Contributor
|
||
{ | ||
// Just kick player | ||
return; | ||
} | ||
else | ||
{ | ||
playerOther->TakeDamage(pev, playerDriver->pev, 150, DMG_CRUSH); | ||
return; | ||
} | ||
} | ||
else if (FClassnameIs(pevOther, "hostage_entity") && playerDriver) | ||
{ | ||
pOther->TakeDamage(playerDriver->pev, playerDriver->pev, 150, DMG_CRUSH); | ||
return; | ||
} | ||
#endif | ||
pOther->TakeDamage(pev, pev, 150, DMG_CRUSH); | ||
} | ||
} | ||
|
Don't use m_iTeam == m_iTeam check!
Use g_pGameRules->PlayerRelationship