Removed flat zone cvar, added shavit-zones config instead.

Removed custom spawn from cfg to prevent confusions.
This commit is contained in:
shavit 2018-05-13 21:13:13 +03:00
parent 8a98fe96b9
commit 1ba79fcc09
2 changed files with 18 additions and 19 deletions

View File

@ -1,6 +1,6 @@
// Absolutely DON'T delete subkeys from this file.
//
// Visible defaults to 1.
// 'visible' defaults to 1, 'flat' defaults to 0.
// Other values default to 255, except for width which is 0.5.
"Zones"
{
@ -22,6 +22,8 @@
"alpha" "255"
"width" "0.5"
"flat" "0"
}
"End"
@ -108,12 +110,6 @@
"width" "4.0"
}
// This is unused, ignore it.
"SPAWN POINT"
{
}
"Easybhop"
{
"visible" "1"
@ -234,12 +230,6 @@
"width" "2.0"
}
// This is unused, ignore it.
"Bonus SPAWN POINT"
{
}
"Bonus Easybhop"
{
"visible" "1"

View File

@ -64,6 +64,7 @@ enum
iBlue,
iAlpha,
fWidth,
bFlatZone,
ZONESETTINGS_SIZE
}
@ -116,7 +117,6 @@ bool gB_Late = false;
ConVar sv_gravity = null;
// cvars
ConVar gCV_FlatZones = null;
ConVar gCV_Interval = null;
ConVar gCV_TeleportToStart = null;
ConVar gCV_TeleportToEnd = null;
@ -126,7 +126,6 @@ ConVar gCV_Offset = null;
ConVar gCV_EnforceTracks = null;
// cached cvars
bool gB_FlatZones = false;
float gF_Interval = 1.0;
bool gB_TeleportToStart = true;
bool gB_TeleportToEnd = true;
@ -228,7 +227,6 @@ public void OnPluginStart()
gH_Forwards_LeaveZone = CreateGlobalForward("Shavit_OnLeaveZone", ET_Event, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
// cvars and stuff
gCV_FlatZones = CreateConVar("shavit_zones_flat", "0", "Should zones be drawn as flat instead of a 3D box?", 0, true, 0.0, true, 1.0);
gCV_Interval = CreateConVar("shavit_zones_interval", "1.0", "Interval between each time a mapzone is being drawn to the players.", 0, true, 0.5, true, 5.0);
gCV_TeleportToStart = CreateConVar("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_TeleportToEnd = CreateConVar("shavit_zones_teleporttoend", "1", "Teleport players to the end zone on sm_end?\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
@ -237,7 +235,6 @@ public void OnPluginStart()
gCV_Offset = CreateConVar("shavit_zones_offset", "0.5", "When calculating a zone's *VISUAL* box, by how many units, should we scale it to the center?\n0.0 - no downscaling. Values above 0 will scale it inward and negative numbers will scale it outwards.\nAdjust this value if the zones clip into walls.");
gCV_EnforceTracks = CreateConVar("shavit_zones_enforcetracks", "1", "Enforce zone tracks upon entry?\n0 - allow every zone except for start/end to affect users on every zone.\n1- require the user's track to match the zone's track.", 0, true, 0.0, true, 1.0);
gCV_FlatZones.AddChangeHook(OnConVarChanged);
gCV_Interval.AddChangeHook(OnConVarChanged);
gCV_TeleportToStart.AddChangeHook(OnConVarChanged);
gCV_TeleportToEnd.AddChangeHook(OnConVarChanged);
@ -267,6 +264,7 @@ public void OnPluginStart()
gA_ZoneSettings[i][j][iBlue] = 255;
gA_ZoneSettings[i][j][iAlpha] = 255;
gA_ZoneSettings[i][j][fWidth] = 2.0;
gA_ZoneSettings[i][j][bFlatZone] = false;
}
}
@ -283,7 +281,6 @@ public void OnPluginStart()
public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
gB_FlatZones = gCV_FlatZones.BoolValue;
gF_Interval = gCV_Interval.FloatValue;
gB_TeleportToStart = gCV_TeleportToStart.BoolValue;
gB_UseCustomSprite = gCV_UseCustomSprite.BoolValue;
@ -500,12 +497,19 @@ bool LoadZonesConfig()
int track = (i / ZONETYPES_SIZE);
int index = (i % ZONETYPES_SIZE);
// don't count custom spawns
if(index == Zone_CustomSpawn)
{
i++;
}
gA_ZoneSettings[index][track][bVisible] = view_as<bool>(kv.GetNum("visible", 1));
gA_ZoneSettings[index][track][iRed] = kv.GetNum("red", 255);
gA_ZoneSettings[index][track][iGreen] = kv.GetNum("green", 255);
gA_ZoneSettings[index][track][iBlue] = kv.GetNum("blue", 255);
gA_ZoneSettings[index][track][iAlpha] = kv.GetNum("alpha", 255);
gA_ZoneSettings[index][track][fWidth] = kv.GetFloat("width", 2.0);
gA_ZoneSettings[index][track][bFlatZone] = view_as<bool>(kv.GetNum("flat", false));
i++;
}
@ -2017,7 +2021,12 @@ public Action Timer_DrawEverything(Handle Timer)
if(gA_ZoneSettings[type][track][bVisible])
{
DrawZone(gV_MapZones_Visual[i], GetZoneColors(type, track), RoundToCeil(float(gI_MapZones) / iMaxZonesPerFrame) * gF_Interval, gA_ZoneSettings[type][track][fWidth], gB_FlatZones, gV_ZoneCenter[i]);
DrawZone(gV_MapZones_Visual[i],
GetZoneColors(type, track),
RoundToCeil(float(gI_MapZones) / iMaxZonesPerFrame) * gF_Interval,
gA_ZoneSettings[type][track][fWidth],
gA_ZoneSettings[type][track][bFlatZone],
gV_ZoneCenter[i]);
}
}