add option to turn off 'noclip is disabled' etc messages

This commit is contained in:
UnknownShadow200 2018-12-17 11:54:04 +11:00
parent 09ad246cde
commit 6fb446f8f0
5 changed files with 12 additions and 7 deletions

View File

@ -29,6 +29,7 @@ namespace ClassicalSharp.Entities {
internal SoundComponent sound; internal SoundComponent sound;
internal LocalInterpComponent interp; internal LocalInterpComponent interp;
internal TiltComponent tilt; internal TiltComponent tilt;
bool hackPermMsgs;
bool warnedRespawn, warnedFly, warnedNoclip; bool warnedRespawn, warnedFly, warnedNoclip;
public LocalPlayer(Game game) : base(game) { public LocalPlayer(Game game) : base(game) {
@ -146,6 +147,7 @@ namespace ClassicalSharp.Entities {
Hacks.FullBlockStep = Options.GetBool(OptionsKey.FullBlockStep, false); Hacks.FullBlockStep = Options.GetBool(OptionsKey.FullBlockStep, false);
physics.userJumpVel = Options.GetFloat(OptionsKey.JumpVelocity, 0.0f, 52.0f, 0.42f); physics.userJumpVel = Options.GetFloat(OptionsKey.JumpVelocity, 0.0f, 52.0f, 0.42f);
physics.jumpVel = physics.userJumpVel; physics.jumpVel = physics.userJumpVel;
hackPermMsgs = Options.GetBool(OptionsKey.HackPermMsgs, true);
} }
void IGameComponent.Ready(Game game) { } void IGameComponent.Ready(Game game) { }
@ -209,7 +211,7 @@ namespace ClassicalSharp.Entities {
return true; return true;
} else if (!warnedRespawn) { } else if (!warnedRespawn) {
warnedRespawn = true; warnedRespawn = true;
if (!game.ClassicMode) game.Chat.Add("&cRespawning is currently disabled"); if (!hackPermMsgs) game.Chat.Add("&cRespawning is currently disabled");
} }
return false; return false;
} }
@ -231,7 +233,7 @@ namespace ClassicalSharp.Entities {
return true; return true;
} else if (!warnedFly) { } else if (!warnedFly) {
warnedFly = true; warnedFly = true;
if (!game.ClassicMode) game.Chat.Add("&cFlying is currently disabled"); if (!hackPermMsgs) game.Chat.Add("&cFlying is currently disabled");
} }
return false; return false;
} }
@ -245,7 +247,7 @@ namespace ClassicalSharp.Entities {
return true; return true;
} else if (!warnedNoclip) { } else if (!warnedNoclip) {
warnedNoclip = true; warnedNoclip = true;
if (!game.ClassicMode) game.Chat.Add("&cNoclip is currently disabled"); if (!hackPermMsgs) game.Chat.Add("&cNoclip is currently disabled");
} }
return false; return false;
} }

View File

@ -45,6 +45,7 @@ namespace ClassicalSharp {
public const string CameraClipping = "hacks-cameraclipping"; public const string CameraClipping = "hacks-cameraclipping";
public const string WOMStyleHacks = "hacks-womstylehacks"; public const string WOMStyleHacks = "hacks-womstylehacks";
public const string FullBlockStep = "hacks-fullblockstep"; public const string FullBlockStep = "hacks-fullblockstep";
public const string HackPermMsgs = "hacks-perm-msgs";
public const string TabAutocomplete = "gui-tab-autocomplete"; public const string TabAutocomplete = "gui-tab-autocomplete";
public const string ShowBlockInHand = "gui-blockinhand"; public const string ShowBlockInHand = "gui-blockinhand";

View File

@ -766,6 +766,7 @@ static void Player_Init(struct Entity* e) {
*------------------------------------------------------LocalPlayer--------------------------------------------------------* *------------------------------------------------------LocalPlayer--------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
struct LocalPlayer LocalPlayer_Instance; struct LocalPlayer LocalPlayer_Instance;
static bool hackPermMsgs;
float LocalPlayer_JumpHeight(void) { float LocalPlayer_JumpHeight(void) {
struct LocalPlayer* p = &LocalPlayer_Instance; struct LocalPlayer* p = &LocalPlayer_Instance;
return (float)PhysicsComp_GetMaxHeight(p->Physics.JumpVel); return (float)PhysicsComp_GetMaxHeight(p->Physics.JumpVel);
@ -901,6 +902,7 @@ static void LocalPlayer_Init(void) {
hacks->FullBlockStep = Options_GetBool(OPT_FULL_BLOCK_STEP, false); hacks->FullBlockStep = Options_GetBool(OPT_FULL_BLOCK_STEP, false);
p->Physics.UserJumpVel = Options_GetFloat(OPT_JUMP_VELOCITY, 0.0f, 52.0f, 0.42f); p->Physics.UserJumpVel = Options_GetFloat(OPT_JUMP_VELOCITY, 0.0f, 52.0f, 0.42f);
p->Physics.JumpVel = p->Physics.UserJumpVel; p->Physics.JumpVel = p->Physics.UserJumpVel;
hackPermMsgs = Options_GetBool(OPT_HACK_PERM_MSGS, true);
} }
static void LocalPlayer_Reset(void) { static void LocalPlayer_Reset(void) {
@ -970,7 +972,7 @@ static bool LocalPlayer_HandleRespawn(void) {
return true; return true;
} else if (!p->_WarnedRespawn) { } else if (!p->_WarnedRespawn) {
p->_WarnedRespawn = true; p->_WarnedRespawn = true;
if (!Game_ClassicMode) Chat_AddRaw("&cRespawning is currently disabled"); if (hackPermMsgs) Chat_AddRaw("&cRespawning is currently disabled");
} }
return false; return false;
} }
@ -994,7 +996,7 @@ static bool LocalPlayer_HandleFly(void) {
return true; return true;
} else if (!p->_WarnedFly) { } else if (!p->_WarnedFly) {
p->_WarnedFly = true; p->_WarnedFly = true;
if (!Game_ClassicMode) Chat_AddRaw("&cFlying is currently disabled"); if (hackPermMsgs) Chat_AddRaw("&cFlying is currently disabled");
} }
return false; return false;
} }
@ -1009,7 +1011,7 @@ static bool LocalPlayer_HandleNoClip(void) {
return true; return true;
} else if (!p->_WarnedNoclip) { } else if (!p->_WarnedNoclip) {
p->_WarnedNoclip = true; p->_WarnedNoclip = true;
if (!Game_ClassicMode) Chat_AddRaw("&cNoclip is currently disabled"); if (hackPermMsgs) Chat_AddRaw("&cNoclip is currently disabled");
} }
return false; return false;
} }

View File

@ -606,7 +606,6 @@ static void Launcher_ApplyUpdate(void) {
if (res) Launcher_ShowError(res, "making update script executable"); if (res) Launcher_ShowError(res, "making update script executable");
/* TODO: (open -a Terminal ", '"' + path + '"'); on OSX */ /* TODO: (open -a Terminal ", '"' + path + '"'); on OSX */
/* TODO: chmod +x on non-windows */
res = Platform_StartProcess(&scriptName, &scriptArgs); res = Platform_StartProcess(&scriptName, &scriptArgs);
if (res) { Launcher_ShowError(res, "starting update script"); return; } if (res) { Launcher_ShowError(res, "starting update script"); return; }
} }

View File

@ -45,6 +45,7 @@ extern const char* FpsLimit_Names[FPS_LIMIT_COUNT];
#define OPT_CAMERA_CLIPPING "hacks-cameraclipping" #define OPT_CAMERA_CLIPPING "hacks-cameraclipping"
#define OPT_WOM_STYLE_HACKS "hacks-womstylehacks" #define OPT_WOM_STYLE_HACKS "hacks-womstylehacks"
#define OPT_FULL_BLOCK_STEP "hacks-fullblockstep" #define OPT_FULL_BLOCK_STEP "hacks-fullblockstep"
#define OPT_HACK_PERM_MSGS "hacks-perm-msgs"
#define OPT_TAB_AUTOCOMPLETE "gui-tab-autocomplete" #define OPT_TAB_AUTOCOMPLETE "gui-tab-autocomplete"
#define OPT_SHOW_BLOCK_IN_HAND "gui-blockinhand" #define OPT_SHOW_BLOCK_IN_HAND "gui-blockinhand"