Added slide zones (#558)

This commit is contained in:
shavit 2017-12-16 10:27:02 +02:00
parent 225dd2fadf
commit 990bbb802d
5 changed files with 55 additions and 9 deletions

View File

@ -126,6 +126,18 @@
"width" "2.5" "width" "2.5"
} }
"Slide"
{
"visible" "1"
"red" "244"
"green" "66"
"blue" "92"
"alpha" "255"
"width" "1.5"
}
"Bonus Start" "Bonus Start"
{ {
"visible" "1" "visible" "1"
@ -239,5 +251,17 @@
"alpha" "175" "alpha" "175"
"width" "1.75" "width" "1.75"
} }
"Bonus Slide"
{
"visible" "1"
"red" "244"
"green" "66"
"blue" "92"
"alpha" "255"
"width" "1.0"
}
} }
} }

View File

@ -207,6 +207,7 @@ enum(+=1)
Zone_Teleport, Zone_Teleport,
Zone_CustomSpawn, Zone_CustomSpawn,
Zone_Easybhop, Zone_Easybhop,
Zone_Slide,
ZONETYPES_SIZE ZONETYPES_SIZE
}; };

View File

@ -1070,7 +1070,6 @@ public int Native_ResumeTimer(Handle handler, int numParams)
public int Native_StopChatSound(Handle handler, int numParams) public int Native_StopChatSound(Handle handler, int numParams)
{ {
gB_StopChatSound = true; gB_StopChatSound = true;
RequestFrame(RevertChatSound);
} }
public int Native_PrintToChat(Handle handler, int numParams) public int Native_PrintToChat(Handle handler, int numParams)
@ -1100,6 +1099,8 @@ public int Native_PrintToChat(Handle handler, int numParams)
{ {
PrintToChat(client, " %s", buffer); PrintToChat(client, " %s", buffer);
} }
gB_StopChatSound = false;
} }
public int Native_RestartTimer(Handle handler, int numParams) public int Native_RestartTimer(Handle handler, int numParams)
@ -1236,11 +1237,6 @@ int GetTimerStatus(int client)
return view_as<int>(Timer_Running); return view_as<int>(Timer_Running);
} }
public void RevertChatSound(any data)
{
gB_StopChatSound = false;
}
void StartTimer(int client, int track) void StartTimer(int client, int track)
{ {
if(!IsValidClient(client, true) || GetClientTeam(client) < 2 || IsFakeClient(client)) if(!IsValidClient(client, true) || GetClientTeam(client) < 2 || IsFakeClient(client))

View File

@ -308,7 +308,7 @@ public int Native_ReloadReplay(Handle handler, int numParams)
{ {
if(gI_ReplayBotClient[style] == 0) if(gI_ReplayBotClient[style] == 0)
{ {
ServerCommand("bot_add"); ServerCommand((gEV_Type != Engine_TF2)? "bot_add":"tf_bot_add");
gI_ExpectedBots++; gI_ExpectedBots++;
} }

View File

@ -52,7 +52,8 @@ char gS_ZoneNames[][] =
"No Speed Limit", // ignores velocity limit in that zone "No Speed Limit", // ignores velocity limit in that zone
"Teleport Zone", // teleports to a defined point "Teleport Zone", // teleports to a defined point
"SPAWN POINT", // << unused "SPAWN POINT", // << unused
"Easybhop Zone" // forces easybhop whether if the player is in non-easy styles or if the server has different settings "Easybhop Zone", // forces easybhop whether if the player is in non-easy styles or if the server has different settings
"Slide Zone" // allows players to slide, in order to fix parts like the 5th stage of bhop_arcane
}; };
enum enum
@ -1503,7 +1504,7 @@ public bool TraceFilter_World(int entity, int contentsMask)
return (entity == 0); return (entity == 0);
} }
public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status) public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status, int track, int style, any stylesettings[STYLESETTINGS_SIZE])
{ {
if(gI_MapStep[client] > 0 && gI_MapStep[client] != 3) if(gI_MapStep[client] > 0 && gI_MapStep[client] != 3)
{ {
@ -1564,9 +1565,33 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
} }
} }
if(InsideZone(client, Zone_Slide, (gB_EnforceTracks)? track:-1) && GetEntPropEnt(client, Prop_Send, "m_hGroundEntity") == -1)
{
// raytrace down, see if there's 5 distance or less to ground
float fPosition[3];
GetClientAbsOrigin(client, fPosition);
TR_TraceRayFilter(fPosition, view_as<float>({90.0, 0.0, 0.0}), MASK_PLAYERSOLID, RayType_Infinite, TRFilter_NoPlayers, client);
float fGroundPosition[3];
if(TR_DidHit() && TR_GetEndPosition(fGroundPosition) && GetVectorDistance(fPosition, fGroundPosition) <= 5.0)
{
float fSpeed[3];
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
fSpeed[2] = 5.0;
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fSpeed);
}
}
return Plugin_Continue; return Plugin_Continue;
} }
public bool TRFilter_NoPlayers(int entity, int mask, any data)
{
return (entity != view_as<int>(data) || (entity < 1 || entity > MaxClients));
}
public int CreateZoneConfirm_Handler(Menu menu, MenuAction action, int param1, int param2) public int CreateZoneConfirm_Handler(Menu menu, MenuAction action, int param1, int param2)
{ {
if(action == MenuAction_Select) if(action == MenuAction_Select)