Compare commits

...

14 Commits

Author SHA1 Message Date
haooy
c48282ba92
Merge bbaa205f01 into 21a7b58c82 2025-10-25 00:44:39 +00:00
haooy
bbaa205f01 Merge remote-tracking branch 'upstream/master' 2025-10-25 02:43:30 +02:00
haooy
21a7b58c82 Reset players hp when needed
Some checks failed
Compile / Build SM ${{ matrix.sm-version }} (1.12) (push) Has been cancelled
Compile / Release (push) Has been cancelled
Reset players hp when needed
2025-10-08 00:05:10 +00:00
haooy
92d9bb7f71 Revert "Fix late-loading for wr plugin"
This reverts commit 26b4e53946.
2025-09-27 00:34:29 +02:00
haooy
6dfc2a9175
Reset players hp when needed
Reset players hp when needed
2025-09-19 17:30:08 +02:00
haooy
26b4e53946
Fix late-loading for wr plugin
Players time won't count after finishing the map. Hopefully fixes issue with late loading. 

do not risk overwriting the player's data if their PB isn't loaded to cache yet in Shavit_OnFinish
2025-09-18 21:14:11 +02:00
haooy
183faae643
Let player move while inside Pause zone
Let player move while inside Pause zone
2025-08-28 11:35:48 +02:00
haooy
bcf623e588
Fix for double comma
Fix for double comma
2025-08-28 03:13:23 +02:00
haooy
e28e333818
Add Pause zone functionality
Add Pause zone functionality
2025-08-28 03:07:39 +02:00
haooy
d6f0e46756
Adjust size of array
Adjust size of array
2025-08-28 02:46:34 +02:00
haooy
02792941dc
Add Pause zone to inc
Add Pause zone to inc
2025-08-28 02:44:21 +02:00
haooy
91a31ce870
Add Pause zone to translations file
Add Pause zone to translations file
2025-08-28 02:40:20 +02:00
haooy
428f87c523
Add Pause zone to cfg
Add Pause zone to cfg
2025-08-28 02:39:22 +02:00
haooy
732a807ff9
Add new convar to spawn player inside start zone
Add new convar to spawn player inside start zone and create new function to handle that (because i does same thing as shavit_zones_teleporttostart).
2025-08-28 02:24:08 +02:00
7 changed files with 113 additions and 58 deletions

View File

@ -219,6 +219,20 @@
"width" "0.1"
}
"Pause"
{
"visible" "1"
"red" "10"
"green" "10"
"blue" "255"
"alpha" "255"
"width" "0.3"
"flat" "1"
}
"Bonus 1 Start"
{
"visible" "1"

View File

@ -47,6 +47,7 @@ enum
Zone_Speedmod, // creates a player_speedmod
Zone_NoJump, // blocks the player from jumping while inside the zone
Zone_Autobhop, // forces autobhop for the player
Zone_Pause, // pause the player's timer
ZONETYPES_SIZE
};
@ -140,6 +141,7 @@ stock void GetZoneName(int client, int zoneType, char[] output, int size)
"Zone_Speedmod",
"Zone_NoJump",
"Zone_Autobhop",
"Zone_Pause",
};
if (zoneType < 0 || zoneType >= ZONETYPES_SIZE)

View File

@ -3353,7 +3353,9 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
int flags = GetEntityFlags(client);
if (gA_Timers[client].bClientPaused && IsPlayerAlive(client) && !gCV_PauseMovement.BoolValue)
int track = Shavit_GetClientTrack(client);
if (gA_Timers[client].bClientPaused && IsPlayerAlive(client) && !gCV_PauseMovement.BoolValue && !Shavit_InsideZone(client, Zone_Pause, track))
{
buttons = 0;
vel = view_as<float>({0.0, 0.0, 0.0});

View File

@ -2454,7 +2454,7 @@ public void Shavit_OnRestart(int client, int track)
{
SetEntPropFloat(client, Prop_Send, "m_flStamina", 0.0);
if (gCV_RestartWithFullHP.BoolValue)
if (gCV_RestartWithFullHP.BoolValue && GetClientHealth(client) <= 100)
{
SetEntityHealth(client, 100);
SetEntProp(client, Prop_Send, "m_ArmorValue", 100);

View File

@ -53,7 +53,8 @@ static char gS_ZoneTypes[ZONETYPES_SIZE][18] = {
"gravity",
"speedmod",
"nojump",
"autobhop"
"autobhop",
"pause"
};
static char gS_ZoneForms[5][26] = {

View File

@ -131,6 +131,7 @@ Convar gCV_PrebuiltZones = null;
Convar gCV_ClimbButtons = null;
Convar gCV_Interval = null;
Convar gCV_TeleportToStart = null;
Convar gCV_TeleportToStartOnSpawn = null;
Convar gCV_TeleportToEnd = null;
Convar gCV_AllowDrawAllZones = null;
Convar gCV_UseCustomSprite = null;
@ -334,6 +335,7 @@ public void OnPluginStart()
gCV_ClimbButtons = new Convar("shavit_zones_usebuttons", "1", "Whether to automatically hook climb_* buttons.", 0, true, 0.0, true, 1.0);
gCV_Interval = new Convar("shavit_zones_interval", "1.0", "Interval between each time a mapzone is being drawn to the players.", 0, true, 0.25, true, 5.0);
gCV_TeleportToStart = new Convar("shavit_zones_teleporttostart", "1", "Teleport players to the start zone on timer restart?\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
gCV_TeleportToStartOnSpawn = new Convar("shavit_zones_teleporttostart_onspawn", "1", "Teleport players to the start zone on player spawn?\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
gCV_TeleportToEnd = new Convar("shavit_zones_teleporttoend", "1", "Teleport players to the end zone on sm_end?\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
gCV_AllowDrawAllZones = new Convar("shavit_zones_allowdrawallzones", "1", "Allow players to use !drawallzones to see all zones regardless of zone visibility settings.\n0 - nobody can use !drawallzones\n1 - admins (sm_zones access) can use !drawallzones\n2 - anyone can use !drawallzones", 0, true, 0.0, true, 2.0);
gCV_UseCustomSprite = new Convar("shavit_zones_usecustomsprite", "1", "Use custom sprite for zone drawing?\nSee `configs/shavit-zones.cfg`.\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
@ -1013,6 +1015,7 @@ bool JumpToZoneType(KeyValues kv, int type, int track)
{"Speedmod", ""},
{"No Jump", ""},
{"Autobhop", ""},
{"Pause", ""},
};
char key[4][50];
@ -2822,6 +2825,7 @@ public int MenuHandler_HookZone_Editor(Menu menu, MenuAction action, int param1,
| (1 << Zone_Speedmod)
| (1 << Zone_NoJump)
| (1 << Zone_Autobhop)
| (1 << Zone_Pause)
// ZoneForm_trigger_teleport
, (1 << Zone_End)
| (1 << Zone_Respawn)
@ -5071,60 +5075,7 @@ public void Shavit_OnRestart(int client, int track)
if(gCV_TeleportToStart.BoolValue)
{
bool bCustomStart = gB_HasSetStart[client][track] && !gB_StartAnglesOnly[client][track];
bool use_CustomStart_over_CustomSpawn = (iIndex != -1) && bCustomStart;
// custom spawns
if (!use_CustomStart_over_CustomSpawn && !EmptyVector(gF_CustomSpawn[track]))
{
float pos[3]; pos = gF_CustomSpawn[track]; pos[2] += 1.0;
TeleportEntity(client, pos, NULL_VECTOR, ZERO_VECTOR);
}
// standard zoning
else if (bCustomStart || iIndex != -1)
{
float fCenter[3];
if (bCustomStart)
{
fCenter = gF_StartPos[client][track];
}
else
{
fCenter[0] = gV_ZoneCenter[iIndex][0];
fCenter[1] = gV_ZoneCenter[iIndex][1];
fCenter[2] = gA_ZoneCache[iIndex].fCorner1[2] + gCV_ExtraSpawnHeight.FloatValue;
}
fCenter[2] += 1.0;
TeleportEntity(client, fCenter, gB_HasSetStart[client][track] ? gF_StartAng[client][track] : NULL_VECTOR, view_as<float>({0.0, 0.0, 0.0}));
if (gB_ReplayRecorder && gB_HasSetStart[client][track])
{
Shavit_HijackAngles(client, gF_StartAng[client][track][0], gF_StartAng[client][track][1], -1, true);
}
if (!gB_HasSetStart[client][track] || gB_StartAnglesOnly[client][track])
{
ResetClientTargetNameAndClassName(client, track);
// normally StartTimer will happen on zone-touch BUT we have this here for zones that are in the air
bool skipGroundCheck = true;
Shavit_StartTimer(client, track, skipGroundCheck);
}
}
// kz buttons
else if (Shavit_IsKZMap(track))
{
if (EmptyVector(gF_ClimbButtonCache[client][track][0]) || EmptyVector(gF_ClimbButtonCache[client][track][1]))
{
return;
}
TeleportEntity(client, gF_ClimbButtonCache[client][track][0], gF_ClimbButtonCache[client][track][1], view_as<float>({0.0, 0.0, 0.0}));
return;
}
TeleportToStart(client, iIndex, track);
}
if (iIndex != -1)
@ -5214,7 +5165,74 @@ int GetZoneIndex(int type, int track, int start = 0)
public void Player_Spawn(Event event, const char[] name, bool dontBroadcast)
{
Reset(GetClientOfUserId(event.GetInt("userid")));
int client = GetClientOfUserId(event.GetInt("userid"));
int track = Shavit_GetClientTrack(client);
int iIndex = GetZoneIndex(Zone_Start, track);
Reset(client);
if(GetConVarBool(gCV_TeleportToStartOnSpawn) && (Shavit_ZoneExists(Zone_Start, track) || Shavit_IsKZMap(track)))
{
TeleportToStart(client, iIndex, track);
}
}
public void TeleportToStart(int client, int iIndex, int track)
{
bool bCustomStart = gB_HasSetStart[client][track] && !gB_StartAnglesOnly[client][track];
bool use_CustomStart_over_CustomSpawn = (iIndex != -1) && bCustomStart;
// custom spawns
if (!use_CustomStart_over_CustomSpawn && !EmptyVector(gF_CustomSpawn[track]))
{
float pos[3]; pos = gF_CustomSpawn[track]; pos[2] += 1.0;
TeleportEntity(client, pos, NULL_VECTOR, ZERO_VECTOR);
}
// standard zoning
else if (bCustomStart || iIndex != -1)
{
float fCenter[3];
if (bCustomStart)
{
fCenter = gF_StartPos[client][track];
}
else
{
fCenter[0] = gV_ZoneCenter[iIndex][0];
fCenter[1] = gV_ZoneCenter[iIndex][1];
fCenter[2] = gA_ZoneCache[iIndex].fCorner1[2] + gCV_ExtraSpawnHeight.FloatValue;
}
fCenter[2] += 1.0;
TeleportEntity(client, fCenter, gB_HasSetStart[client][track] ? gF_StartAng[client][track] : NULL_VECTOR, view_as<float>({0.0, 0.0, 0.0}));
if (gB_ReplayRecorder && gB_HasSetStart[client][track])
{
Shavit_HijackAngles(client, gF_StartAng[client][track][0], gF_StartAng[client][track][1], -1, true);
}
if (!gB_HasSetStart[client][track] || gB_StartAnglesOnly[client][track])
{
ResetClientTargetNameAndClassName(client, track);
// normally StartTimer will happen on zone-touch BUT we have this here for zones that are in the air
bool skipGroundCheck = true;
Shavit_StartTimer(client, track, skipGroundCheck);
}
}
// kz buttons
else if (Shavit_IsKZMap(track))
{
if (EmptyVector(gF_ClimbButtonCache[client][track][0]) || EmptyVector(gF_ClimbButtonCache[client][track][1]))
{
return;
}
TeleportEntity(client, gF_ClimbButtonCache[client][track][0], gF_ClimbButtonCache[client][track][1], view_as<float>({0.0, 0.0, 0.0}));
return;
}
}
public void Round_Start(Event event, const char[] name, bool dontBroadcast)
@ -5409,6 +5427,15 @@ public void StartTouchPost(int entity, int other)
SetVariantString(s);
AcceptEntityInput(entity, "ModifySpeed", other, entity, 0);
}
case Zone_Pause:
{
if(Shavit_GetTimerStatus(other) != Timer_Stopped)
{
Shavit_PauseTimer(other);
//Should we print?
}
}
}
gI_InsideZone[other][track] |= (1 << type);
@ -5464,6 +5491,11 @@ public void EndTouchPost(int entity, int other)
AcceptEntityInput(entity, "ModifySpeed", other, entity, 0);
}
if (type == Zone_Pause)
{
Shavit_ResumeTimer(other);
}
Call_StartForward(gH_Forwards_LeaveZone);
Call_PushCell(other);
Call_PushCell(type);

View File

@ -533,6 +533,10 @@
{
"en" "Autobhop Zone"
}
"Zone_Pause"
{
"en" "Pause Zone"
}
"Zone_Unknown"
{
"en" "UNKNOWN ZONE"