mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-26 22:55:41 +03:00
Added spawnflags for keep player angles & velocity in trigger_teleport (#747)
* Added spawnflags for keep player angles & velocity in trigger_teleport Co-authored-by: etojuice <etojuice@yandex.ru>
This commit is contained in:
parent
6c47f96998
commit
21dab90571
@ -1712,6 +1712,10 @@ void CTriggerPush::Touch(CBaseEntity *pOther)
|
||||
}
|
||||
}
|
||||
|
||||
#define SF_TELEPORT_KEEP_ANGLES 256
|
||||
#define SF_TELEPORT_KEEP_VELOCITY 512
|
||||
#define SF_TELEPORT_REDIRECT_VELOCITY_WITH_YAW_DESTINATION 1024
|
||||
|
||||
void CBaseTrigger::TeleportTouch(CBaseEntity *pOther)
|
||||
{
|
||||
entvars_t *pevToucher = pOther->pev;
|
||||
@ -1766,15 +1770,40 @@ void CBaseTrigger::TeleportTouch(CBaseEntity *pOther)
|
||||
|
||||
UTIL_SetOrigin(pevToucher, tmp);
|
||||
|
||||
pevToucher->angles = pentTarget->v.angles;
|
||||
|
||||
if (pOther->IsPlayer())
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (!(pev->spawnflags & SF_TELEPORT_KEEP_ANGLES))
|
||||
#endif
|
||||
{
|
||||
pevToucher->v_angle = pentTarget->v.angles;
|
||||
pevToucher->angles = pentTarget->v.angles;
|
||||
|
||||
if (pOther->IsPlayer())
|
||||
{
|
||||
pevToucher->v_angle = pentTarget->v.angles;
|
||||
}
|
||||
|
||||
pevToucher->fixangle = 1;
|
||||
}
|
||||
|
||||
pevToucher->fixangle = 1;
|
||||
pevToucher->velocity = pevToucher->basevelocity = g_vecZero;
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (!(pev->spawnflags & SF_TELEPORT_KEEP_VELOCITY))
|
||||
#endif
|
||||
{
|
||||
pevToucher->velocity = pevToucher->basevelocity = g_vecZero;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if ((pev->spawnflags & SF_TELEPORT_REDIRECT_VELOCITY_WITH_YAW_DESTINATION) && (pev->spawnflags & SF_TELEPORT_KEEP_VELOCITY))
|
||||
{
|
||||
float xy_vel = pevToucher->velocity.Length2D();
|
||||
|
||||
Vector vecAngles = Vector(0, pentTarget->v.angles.y, 0);
|
||||
Vector vecForward;
|
||||
AngleVectors(vecAngles, vecForward, nullptr, nullptr);
|
||||
|
||||
pevToucher->velocity.x = vecForward.x * xy_vel;
|
||||
pevToucher->velocity.y = vecForward.y * xy_vel;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
LINK_ENTITY_TO_CLASS(trigger_teleport, CTriggerTeleport, CCSTriggerTeleport)
|
||||
|
@ -2262,7 +2262,15 @@
|
||||
]
|
||||
]
|
||||
|
||||
@SolidClass base(Trigger) = trigger_teleport : "Trigger teleport" []
|
||||
@SolidClass base(Trigger) = trigger_teleport : "Trigger teleport"
|
||||
[
|
||||
spawnflags(flags) =
|
||||
[
|
||||
256: "Keep angles" : 0
|
||||
512: "Keep velocity" : 0
|
||||
1024: "Redirect velocity with yaw from destination" : 0
|
||||
]
|
||||
]
|
||||
|
||||
// Function entities
|
||||
@SolidClass = func_bomb_target : "Bomb target zone"
|
||||
|
Loading…
Reference in New Issue
Block a user