Fixed teleporting to ducked CPs in both CS:S/CS:GO.

This commit is contained in:
shavit 2018-04-06 01:35:34 +03:00
parent 29df19b1b3
commit 7ff9f4e2a8
2 changed files with 14 additions and 24 deletions

View File

@ -45,8 +45,8 @@ enum CheckpointsCache
Float:fCPStamina,
bool:bCPDucked,
bool:bCPDucking,
Float:fCPDucktime,
bool:bCPDuckButton,
Float:fCPDucktime, // m_flDuckAmount in csgo
Float:fCPDuckSpeed, // m_flDuckSpeed in csgo, doesn't exist in css
iCPFlags,
any:aCPSnapshot[TIMERSNAPSHOT_SIZE],
String:sCPTargetname[32],
@ -1680,10 +1680,8 @@ bool SaveCheckpoint(int client, int index)
cpcache[fCPGravity] = GetEntityGravity(target);
cpcache[fCPSpeed] = GetEntPropFloat(target, Prop_Send, "m_flLaggedMovementValue");
cpcache[fCPStamina] = (gEV_Type != Engine_TF2)? GetEntPropFloat(target, Prop_Send, "m_flStamina"):0.0;
cpcache[bCPDuckButton] = (GetClientButtons(target) & IN_DUCK) > 0;
cpcache[iCPFlags] = GetEntityFlags(target);
// TODO: CS:GO version of this
if(gEV_Type == Engine_CSS)
{
cpcache[bCPDucked] = view_as<bool>(GetEntProp(target, Prop_Send, "m_bDucked"));
@ -1691,6 +1689,12 @@ bool SaveCheckpoint(int client, int index)
cpcache[fCPDucktime] = GetEntPropFloat(target, Prop_Send, "m_flDucktime");
}
else if(gEV_Type == Engine_CSGO)
{
cpcache[fCPDucktime] = GetEntPropFloat(target, Prop_Send, "m_flDuckAmount");
cpcache[fCPDuckSpeed] = GetEntPropFloat(target, Prop_Send, "m_flDuckSpeed");
}
any snapshot[TIMERSNAPSHOT_SIZE];
if(IsFakeClient(target))
@ -1761,15 +1765,6 @@ void TeleportToCheckpoint(int client, int index, bool suppressMessage)
return;
}
bool bDucking = (GetClientButtons(client) & IN_DUCK) > 0;
if(cpcache[bCPDuckButton] != bDucking)
{
Shavit_PrintToChat(client, "%T", (bDucking)? "MiscCheckpointsCrouchOff":"MiscCheckpointsCrouchOn", client, gS_ChatStrings[sMessageWarning], gS_ChatStrings[sMessageText]);
return;
}
bool bInStart = Shavit_InsideZone(client, Zone_Start, -1);
if(bInStart)
@ -1811,13 +1806,18 @@ void TeleportToCheckpoint(int client, int index, bool suppressMessage)
SetEntPropFloat(client, Prop_Send, "m_flStamina", cpcache[fCPStamina]);
}
// TODO: CS:GO version of this
if(gEV_Type == Engine_CSS)
{
SetEntProp(client, Prop_Send, "m_bDucked", cpcache[bCPDucked]);
SetEntProp(client, Prop_Send, "m_bDucking", cpcache[bCPDucking]);
SetEntPropFloat(client, Prop_Send, "m_flDucktime", cpcache[fCPDucktime]);
}
else if(gEV_Type == Engine_CSGO)
{
SetEntPropFloat(client, Prop_Send, "m_flDuckAmount", cpcache[fCPDucktime]);
SetEntPropFloat(client, Prop_Send, "m_flDuckSpeed", cpcache[fCPDuckSpeed]);
}
if(!suppressMessage)
{

View File

@ -83,16 +83,6 @@
"#format" "{1:d},{2:s},{3:s}"
"en" "Checkpoint {1} is {2}empty{3}."
}
"MiscCheckpointsCrouchOn"
{
"#format" "{1:s},{2:s}"
"en" "You must {1}duck{2} while teleporting to this checkpoint."
}
"MiscCheckpointsCrouchOff"
{
"#format" "{1:s},{2:s}"
"en" "You must {1}stop ducking{2} while teleporting to this checkpoint."
}
// ---------- Menus ---------- //
"TeleportMenuTitle"
{