Fix hotkeys past five not being added properly, and reshuffling when unncessary (Thanks MrGoober), also fix custom liquid blocks being able to 'pick up' the player when they shouldn't. (Thanks Empy)

This commit is contained in:
UnknownShadow200 2016-01-19 20:35:24 +11:00
parent bcd9d665cd
commit c39b58bbd0
2 changed files with 9 additions and 8 deletions

View File

@ -122,14 +122,14 @@ namespace ClassicalSharp {
}
ButtonWidget MakeHotkey( int x, int y, int index ) {
string text = Get( index );
string text = Get( index + currentIndex );
ButtonWidget button = ButtonWidget.Create(
game, x, y, 240, 30, text, Anchor.Centre, Anchor.Centre,
textFont, TextButtonClick );
button.Metadata = default( Hotkey );
if( text != "-----" )
button.Metadata = hotkeys.Hotkeys[index];
button.Metadata = hotkeys.Hotkeys[index + currentIndex];
return button;
}
@ -146,7 +146,7 @@ namespace ClassicalSharp {
button.SetText( text );
button.Metadata = default( Hotkey );
if( text != "-----" )
button.Metadata = hotkeys.Hotkeys[index];
button.Metadata = hotkeys.Hotkeys[index + currentIndex];
}
string MakeFlagsString( byte flags ) {
@ -179,6 +179,7 @@ namespace ClassicalSharp {
}
#region Modifying hotkeys
Hotkey curHotkey, origHotkey;
MenuInputWidget currentAction;
TextWidget currentMoreInputLabel;
@ -231,11 +232,6 @@ namespace ClassicalSharp {
}
void SaveChangesClick( Game game, Widget widget ) {
if( origHotkey.BaseKey != Key.Unknown ) {
hotkeys.RemoveHotkey( origHotkey.BaseKey, origHotkey.Flags );
hotkeys.UserRemovedHotkey( origHotkey.BaseKey, origHotkey.Flags );
}
if( curHotkey.BaseKey != Key.Unknown ) {
hotkeys.AddHotkey( curHotkey.BaseKey, curHotkey.Flags,
currentAction.GetText(), curHotkey.MoreInput );

View File

@ -210,6 +210,11 @@ namespace ClassicalSharp {
if( type == BlockCollideType.Solid && !checkSolid )
continue;
Vector3 min = new Vector3( x, y, z ) + info.MinBB[block];
Vector3 max = new Vector3( x, y, z ) + info.MaxBB[block];
BoundingBox blockBB = new BoundingBox( min, max );
if( !blockBB.Intersects( bounds ) ) continue;
modifier = Math.Min( modifier, info.SpeedMultiplier[block] );
if( block >= BlockInfo.CpeBlocksCount && type == BlockCollideType.SwimThrough )
useLiquidGravity = true;