forked from Mirrors/openclonk
Quick Switch slot is now selectable using Q + number key.
This makes a very fundamental change with quick switch: The switching action is now performed on the key release instead of the key press. Let's see if this performs badly for players.qteditor
parent
2713462cd2
commit
faf3add7e7
|
@ -9,6 +9,7 @@
|
|||
used properties:
|
||||
this.inventory.last_slot: last inventory-slot that has been selected. Used for QuickSwitching
|
||||
this.inventory.is_picking_up: whether currently picking up
|
||||
this.inventory.quick_switch_hotkey: true if a quick switch hotkey (0-9) has been pressed, the next release of CON_QuickSwitch will do nothing
|
||||
|
||||
other used properties of "this.inventory" might have been declared in Inventory.ocd
|
||||
*/
|
||||
|
@ -57,16 +58,26 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
|
|||
return inherited(plr, ctrl, x, y, strength, repeat, release, ...);
|
||||
|
||||
// Quickswitch changes the active slot to the last selected one
|
||||
if (ctrl == CON_QuickSwitch)
|
||||
if (ctrl == CON_QuickSwitch && release)
|
||||
{
|
||||
// but ignore quickswitch if we have more than 1 hand-slot
|
||||
if(this.HandObjects > 1)
|
||||
return inherited(plr, ctrl, x, y, strength, repeat, release, ...);;
|
||||
|
||||
// Quick switch slot has been changed while CON_QuickSwitch was pressed, do not change
|
||||
if (this.inventory.quick_switch_hotkey)
|
||||
{
|
||||
this.inventory.quick_switch_hotkey = false;
|
||||
return true;
|
||||
}
|
||||
// select last slot
|
||||
SetHandItemPos(0, this.inventory.last_slot); // last_slot is updated in SetHandItemPos
|
||||
return true;
|
||||
}
|
||||
if (ctrl == CON_QuickSwitch && !release)
|
||||
// Clean up for safety reasons
|
||||
if (this.inventory.quick_switch_hotkey)
|
||||
this.inventory.quick_switch_hotkey = false;
|
||||
|
||||
// Collection and dropping is only allowed when the Clonk is not contained.
|
||||
if (!Contained())
|
||||
|
@ -191,7 +202,26 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
|
|||
this->~DropInventoryItem(hot-1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Selecting the quick switch slot
|
||||
hot = 0;
|
||||
if (ctrl == CON_QuickSwitchHotkey0) hot = 10;
|
||||
if (ctrl == CON_QuickSwitchHotkey1) hot = 1;
|
||||
if (ctrl == CON_QuickSwitchHotkey2) hot = 2;
|
||||
if (ctrl == CON_QuickSwitchHotkey3) hot = 3;
|
||||
if (ctrl == CON_QuickSwitchHotkey4) hot = 4;
|
||||
if (ctrl == CON_QuickSwitchHotkey5) hot = 5;
|
||||
if (ctrl == CON_QuickSwitchHotkey6) hot = 6;
|
||||
if (ctrl == CON_QuickSwitchHotkey7) hot = 7;
|
||||
if (ctrl == CON_QuickSwitchHotkey8) hot = 8;
|
||||
if (ctrl == CON_QuickSwitchHotkey9) hot = 9;
|
||||
|
||||
if (hot > 0 && hot <= this.MaxContentsCount)
|
||||
{
|
||||
SetQuickSwitchSlot(hot-1);
|
||||
return true;
|
||||
}
|
||||
|
||||
// inventory
|
||||
hot = 0;
|
||||
if (ctrl == CON_Hotkey0) hot = 10;
|
||||
|
@ -430,6 +460,21 @@ public func SetHandItemPos(int hand, int inv)
|
|||
return _inherited(hand, inv, ...);
|
||||
}
|
||||
|
||||
public func SetQuickSwitchSlot(int slot)
|
||||
{
|
||||
// Do not set if the quick switch slot doesn't change
|
||||
if (slot == this.inventory.last_slot) return false;
|
||||
// Do not set if slot is currently selected
|
||||
if (slot == this->GetHandItemPos(0)) return false;
|
||||
this.inventory.last_slot = slot;
|
||||
// Notify HUD
|
||||
this->~OnInventoryChange();
|
||||
// Supress release function of quick switch key
|
||||
this.inventory.quick_switch_hotkey = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Backpack control */
|
||||
func Selected(object mnu, object mnu_item)
|
||||
{
|
||||
|
|
|
@ -144,6 +144,7 @@
|
|||
Identifier=QuickSwitch
|
||||
GUIName=$CON_QuickSwitch$
|
||||
GUIDesc=$CON_QuickSwitch_Desc$
|
||||
Hold=1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=InventoryShiftForward
|
||||
|
@ -265,6 +266,36 @@
|
|||
[ControlDef]
|
||||
Identifier=DropHotkey0
|
||||
|
||||
[ControlDef]
|
||||
Identifier=QuickSwitchHotkey1
|
||||
|
||||
[ControlDef]
|
||||
Identifier=QuickSwitchHotkey2
|
||||
|
||||
[ControlDef]
|
||||
Identifier=QuickSwitchHotkey3
|
||||
|
||||
[ControlDef]
|
||||
Identifier=QuickSwitchHotkey4
|
||||
|
||||
[ControlDef]
|
||||
Identifier=QuickSwitchHotkey5
|
||||
|
||||
[ControlDef]
|
||||
Identifier=QuickSwitchHotkey6
|
||||
|
||||
[ControlDef]
|
||||
Identifier=QuickSwitchHotkey7
|
||||
|
||||
[ControlDef]
|
||||
Identifier=QuickSwitchHotkey8
|
||||
|
||||
[ControlDef]
|
||||
Identifier=QuickSwitchHotkey9
|
||||
|
||||
[ControlDef]
|
||||
Identifier=QuickSwitchHotkey0
|
||||
|
||||
# Controlling (contents, vehicles, structures)
|
||||
|
||||
[ControlDef]
|
||||
|
@ -410,7 +441,6 @@
|
|||
[ControlDef]
|
||||
Identifier=PlayerHotkey0
|
||||
|
||||
|
||||
# Menu control
|
||||
|
||||
[ControlDef]
|
||||
|
@ -573,9 +603,9 @@
|
|||
# Down S
|
||||
#
|
||||
# Hotkey0-9 (0-9)
|
||||
# InteractionHotkey0-0 Shift+(0-9)
|
||||
# DropHotkey0-9 Shift+(0-9)
|
||||
#
|
||||
# Use Left mouse button
|
||||
# Use Left mouse button
|
||||
# Drop S+Left mouse button
|
||||
# Throw Right mouse button
|
||||
# UseAlt Right mouse button (low priority)
|
||||
|
@ -583,8 +613,9 @@
|
|||
# Interact Space
|
||||
#
|
||||
# QuickSwitch Q
|
||||
# InventoryShiftForward MouseWheelUp
|
||||
# InventoryShiftBackward MouseWheelDown
|
||||
# QuickSwitchHotkey0-9 Q+(0-9)
|
||||
# InventoryShiftForward MouseWheelUp
|
||||
# InventoryShiftBackward MouseWheelDown
|
||||
# Contents E
|
||||
#
|
||||
# NextCrew T
|
||||
|
@ -1198,6 +1229,56 @@
|
|||
Key=Shift+CON_Hotkey0
|
||||
Control=DropHotkey0
|
||||
|
||||
[Assignment]
|
||||
Key=CON_QuickSwitch,CON_Hotkey1
|
||||
Control=QuickSwitchHotkey1
|
||||
Priority=75
|
||||
|
||||
[Assignment]
|
||||
Key=CON_QuickSwitch,CON_Hotkey2
|
||||
Control=QuickSwitchHotkey2
|
||||
Priority=75
|
||||
|
||||
[Assignment]
|
||||
Key=CON_QuickSwitch,CON_Hotkey3
|
||||
Control=QuickSwitchHotkey3
|
||||
Priority=75
|
||||
|
||||
[Assignment]
|
||||
Key=CON_QuickSwitch,CON_Hotkey4
|
||||
Control=QuickSwitchHotkey4
|
||||
Priority=75
|
||||
|
||||
[Assignment]
|
||||
Key=CON_QuickSwitch,CON_Hotkey5
|
||||
Control=QuickSwitchHotkey5
|
||||
Priority=75
|
||||
|
||||
[Assignment]
|
||||
Key=CON_QuickSwitch,CON_Hotkey6
|
||||
Control=QuickSwitchHotkey6
|
||||
Priority=75
|
||||
|
||||
[Assignment]
|
||||
Key=CON_QuickSwitch,CON_Hotkey7
|
||||
Control=QuickSwitchHotkey7
|
||||
Priority=75
|
||||
|
||||
[Assignment]
|
||||
Key=CON_QuickSwitch,CON_Hotkey8
|
||||
Control=QuickSwitchHotkey8
|
||||
Priority=75
|
||||
|
||||
[Assignment]
|
||||
Key=CON_QuickSwitch,CON_Hotkey9
|
||||
Control=QuickSwitchHotkey9
|
||||
Priority=75
|
||||
|
||||
[Assignment]
|
||||
Key=CON_QuickSwitch,CON_Hotkey0
|
||||
Control=QuickSwitchHotkey0
|
||||
Priority=75
|
||||
|
||||
# Hotkeys for choosing clonk
|
||||
|
||||
[Assignment]
|
||||
|
|
Loading…
Reference in New Issue