Changez
This commit is contained in:
@@ -152,8 +152,8 @@ public void OnPluginStart()
|
|||||||
g_cvPushScale = CreateConVar("sm_couch_push_scale", "6.0", "Multiplier on the force bullets apply to the couch. 1.0 is the engine's own push.", FCVAR_NOTIFY, true, 0.0, true, 100.0);
|
g_cvPushScale = CreateConVar("sm_couch_push_scale", "6.0", "Multiplier on the force bullets apply to the couch. 1.0 is the engine's own push.", FCVAR_NOTIFY, true, 0.0, true, 100.0);
|
||||||
g_cvPistolOnly = CreateConVar("sm_couch_pistol_only", "0", "Only pistols and knives move the couch; other guns and grenades are ignored.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
|
g_cvPistolOnly = CreateConVar("sm_couch_pistol_only", "0", "Only pistols and knives move the couch; other guns and grenades are ignored.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
|
||||||
g_cvAllowUse = CreateConVar("sm_allow_couch_use", "1", "Players may push the couch by holding +use on it. 0 means it can only be moved by shooting it.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
|
g_cvAllowUse = CreateConVar("sm_allow_couch_use", "1", "Players may push the couch by holding +use on it. 0 means it can only be moved by shooting it.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
|
||||||
g_cvEffect = CreateConVar("sm_couch_effect", "0", "Colour cycle and pulsing light on the couch.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
|
g_cvEffect = CreateConVar("sm_couch_effect", "1", "Colour cycle and pulsing light on the couch.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
|
||||||
g_cvEffectIntensity = CreateConVar("sm_couch_effect_intensity", "3", "Brightness of the couch effect light. 0 is off, 3 is the default, 8 is very bright. Applies immediately.", FCVAR_NOTIFY, true, 0.0, true, 10.0);
|
g_cvEffectIntensity = CreateConVar("sm_couch_effect_intensity", "2", "Brightness of the couch effect light. 0 is off, 2 is the default, 8 is very bright. Applies immediately.", FCVAR_NOTIFY, true, 0.0, true, 10.0);
|
||||||
g_cvIgnoreClip = CreateConVar("sm_couch_ignore_clip", "1", "Let the couch pass through func_clip_vphysics brushes.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
|
g_cvIgnoreClip = CreateConVar("sm_couch_ignore_clip", "1", "Let the couch pass through func_clip_vphysics brushes.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
|
||||||
g_cvMoveTier = CreateConVar("sm_couch_move_tier", "0", "Minimum playtime tier needed to shoot or +use the couch.", FCVAR_NOTIFY, true, 0.0);
|
g_cvMoveTier = CreateConVar("sm_couch_move_tier", "0", "Minimum playtime tier needed to shoot or +use the couch.", FCVAR_NOTIFY, true, 0.0);
|
||||||
g_cvButtonTier = CreateConVar("sm_couch_button_tier", "0", "Minimum playtime tier needed to press or shoot map buttons (func_button).", FCVAR_NOTIFY, true, 0.0);
|
g_cvButtonTier = CreateConVar("sm_couch_button_tier", "0", "Minimum playtime tier needed to press or shoot map buttons (func_button).", FCVAR_NOTIFY, true, 0.0);
|
||||||
|
|||||||
@@ -551,10 +551,21 @@ public int MenuHandler_Tier(Menu menu, MenuAction action, int param1, int param2
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The core plugin's default for sm_couch_push_scale, so the reset button follows it.
|
||||||
|
float GetPushScaleDefault(ConVar cvar)
|
||||||
|
{
|
||||||
|
if (cvar == null)
|
||||||
|
return 6.0;
|
||||||
|
|
||||||
|
char sDefault[16];
|
||||||
|
cvar.GetDefault(sDefault, sizeof(sDefault));
|
||||||
|
return StringToFloat(sDefault);
|
||||||
|
}
|
||||||
|
|
||||||
void ShowPushScaleMenu(int client)
|
void ShowPushScaleMenu(int client)
|
||||||
{
|
{
|
||||||
ConVar cvar = FindConVar("sm_couch_push_scale");
|
ConVar cvar = FindConVar("sm_couch_push_scale");
|
||||||
float fScale = (cvar == null) ? 1.0 : cvar.FloatValue;
|
float fScale = (cvar == null) ? 6.0 : cvar.FloatValue;
|
||||||
|
|
||||||
Menu menu = new Menu(MenuHandler_PushScale);
|
Menu menu = new Menu(MenuHandler_PushScale);
|
||||||
menu.SetTitle("Couch - Push scale");
|
menu.SetTitle("Couch - Push scale");
|
||||||
@@ -569,7 +580,9 @@ void ShowPushScaleMenu(int client)
|
|||||||
FormatEx(sItem, sizeof(sItem), "Decrease push scale (-%.2f)", PUSH_SCALE_STEP);
|
FormatEx(sItem, sizeof(sItem), "Decrease push scale (-%.2f)", PUSH_SCALE_STEP);
|
||||||
menu.AddItem("-", sItem, (cvar != null && fScale > 0.0) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
|
menu.AddItem("-", sItem, (cvar != null && fScale > 0.0) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
|
||||||
|
|
||||||
menu.AddItem("reset", "Reset push scale (1.00x)", (cvar != null && fScale != 1.0) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
|
float fDefault = GetPushScaleDefault(cvar);
|
||||||
|
FormatEx(sItem, sizeof(sItem), "Reset push scale (%.2fx)", fDefault);
|
||||||
|
menu.AddItem("reset", sItem, (cvar != null && fScale != fDefault) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);
|
||||||
|
|
||||||
menu.ExitBackButton = true;
|
menu.ExitBackButton = true;
|
||||||
menu.ExitButton = true;
|
menu.ExitButton = true;
|
||||||
@@ -595,7 +608,7 @@ public int MenuHandler_PushScale(Menu menu, MenuAction action, int param1, int p
|
|||||||
else if (StrEqual(sInfo, "-"))
|
else if (StrEqual(sInfo, "-"))
|
||||||
DoSetPushScale(client, cvar.FloatValue - PUSH_SCALE_STEP);
|
DoSetPushScale(client, cvar.FloatValue - PUSH_SCALE_STEP);
|
||||||
else if (StrEqual(sInfo, "reset"))
|
else if (StrEqual(sInfo, "reset"))
|
||||||
DoSetPushScale(client, 1.0);
|
DoSetPushScale(client, GetPushScaleDefault(cvar));
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowPushScaleMenu(client);
|
ShowPushScaleMenu(client);
|
||||||
|
|||||||
Reference in New Issue
Block a user