mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-24 05:10:42 -04:00
Implement pressing G to replace selected block in inventory with air. Partially addresses #465. (Thanks hellosammu / goodlyay)
This commit is contained in:
parent
91d33a9136
commit
8f0ba399cd
@ -120,11 +120,13 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
|
||||
public override void Init() {
|
||||
base.Init();
|
||||
left = new KeyBind[4];
|
||||
left[0] = KeyBind.ExtInput; left[1] = KeyBind.HideFps; left[2] = KeyBind.HideGui; left[3] = KeyBind.HotbarSwitching;
|
||||
left = new KeyBind[5];
|
||||
left[0] = KeyBind.ExtInput; left[1] = KeyBind.HideFps; left[2] = KeyBind.HideGui;
|
||||
left[3] = KeyBind.HotbarSwitching; left[4] = KeyBind.DropBlock;
|
||||
right = new KeyBind[5];
|
||||
right[0] = KeyBind.Screenshot; right[1] = KeyBind.Fullscreen; right[2] = KeyBind.AxisLines; right[3] = KeyBind.Autorotate; right[4] = KeyBind.SmoothCamera;
|
||||
leftDesc = new string[] { "Show ext input", "Hide FPS", "Hide gui", "Hotbar switching" };
|
||||
right[0] = KeyBind.Screenshot; right[1] = KeyBind.Fullscreen; right[2] = KeyBind.AxisLines;
|
||||
right[3] = KeyBind.Autorotate; right[4] = KeyBind.SmoothCamera;
|
||||
leftDesc = new string[] { "Show ext input", "Hide FPS", "Hide gui", "Hotbar switching", "Drop block" };
|
||||
rightDesc = new string[] { "Screenshot", "Fullscreen", "Show axis lines", "Auto-rotate", "Smooth camera" };
|
||||
|
||||
title = "Other controls";
|
||||
|
@ -12,7 +12,7 @@ namespace ClassicalSharp {
|
||||
Speed, NoClip, Fly, FlyUp, FlyDown, ExtInput, HideFps,
|
||||
Screenshot, Fullscreen, ThirdPerson, HideGui, AxisLines,
|
||||
ZoomScrolling, HalfSpeed, MouseLeft, MouseMiddle, MouseRight,
|
||||
Autorotate, HotbarSwitching, SmoothCamera
|
||||
Autorotate, HotbarSwitching, SmoothCamera, DropBlock
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ namespace ClassicalSharp {
|
||||
public KeyMap() {
|
||||
// We can't use enum array initaliser because this causes problems when building with mono
|
||||
// and running on default .NET (https://bugzilla.xamarin.com/show_bug.cgi?id=572)
|
||||
keys = new Key[33];
|
||||
keys = new Key[34];
|
||||
keys[0] = Key.W; keys[1] = Key.S; keys[2] = Key.A; keys[3] = Key.D;
|
||||
keys[4] = Key.Space; keys[5] = Key.R; keys[6] = Key.Enter; keys[7] = Key.T;
|
||||
keys[8] = Key.B; keys[9] = Key.F; keys[10] = Key.Enter;
|
||||
@ -46,7 +46,7 @@ namespace ClassicalSharp {
|
||||
keys[23] = Key.F1; keys[24] = Key.F7; keys[25] = Key.C;
|
||||
keys[26] = Key.ControlLeft;
|
||||
keys[27] = Key.Unknown; keys[28] = Key.Unknown; keys[29] = Key.Unknown;
|
||||
keys[30] = Key.F6; keys[31] = Key.AltLeft; keys[32] = Key.F8;
|
||||
keys[30] = Key.F6; keys[31] = Key.AltLeft; keys[32] = Key.F8; keys[33] = Key.G;
|
||||
|
||||
defaultKeys = new Key[keys.Length];
|
||||
for (int i = 0; i < defaultKeys.Length; i++)
|
||||
|
@ -20,6 +20,15 @@ namespace ClassicalSharp.Mode {
|
||||
if (key == game.Input.Keys[KeyBind.Inventory] && game.Gui.ActiveScreen == game.Gui.hudScreen) {
|
||||
game.Gui.SetNewScreen(new InventoryScreen(game));
|
||||
return true;
|
||||
} else if (key == game.Input.Keys[KeyBind.DropBlock] && !game.ClassicMode) {
|
||||
Inventory inv = game.Inventory;
|
||||
if (inv.CanChangeSelected()) {
|
||||
// Don't assign Selected directly, because we don't want held block
|
||||
// switching positions if they already have air in their inventory hotbar.
|
||||
inv[inv.SelectedIndex] = Block.Air;
|
||||
game.Events.RaiseHeldBlockChanged();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user