mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-14 15:48:01 +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)
|
void CBaseTrigger::TeleportTouch(CBaseEntity *pOther)
|
||||||
{
|
{
|
||||||
entvars_t *pevToucher = pOther->pev;
|
entvars_t *pevToucher = pOther->pev;
|
||||||
@ -1766,6 +1770,10 @@ void CBaseTrigger::TeleportTouch(CBaseEntity *pOther)
|
|||||||
|
|
||||||
UTIL_SetOrigin(pevToucher, tmp);
|
UTIL_SetOrigin(pevToucher, tmp);
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_ADD
|
||||||
|
if (!(pev->spawnflags & SF_TELEPORT_KEEP_ANGLES))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
pevToucher->angles = pentTarget->v.angles;
|
pevToucher->angles = pentTarget->v.angles;
|
||||||
|
|
||||||
if (pOther->IsPlayer())
|
if (pOther->IsPlayer())
|
||||||
@ -1774,9 +1782,30 @@ void CBaseTrigger::TeleportTouch(CBaseEntity *pOther)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pevToucher->fixangle = 1;
|
pevToucher->fixangle = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_ADD
|
||||||
|
if (!(pev->spawnflags & SF_TELEPORT_KEEP_VELOCITY))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
pevToucher->velocity = pevToucher->basevelocity = g_vecZero;
|
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)
|
LINK_ENTITY_TO_CLASS(trigger_teleport, CTriggerTeleport, CCSTriggerTeleport)
|
||||||
|
|
||||||
void CTriggerTeleport::Spawn()
|
void CTriggerTeleport::Spawn()
|
||||||
|
@ -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
|
// Function entities
|
||||||
@SolidClass = func_bomb_target : "Bomb target zone"
|
@SolidClass = func_bomb_target : "Bomb target zone"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user