mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Allow using stack splitting into or out of a trade.
This commit is contained in:
parent
dd2097ac75
commit
0472956b5c
@ -2825,6 +2825,28 @@ impl Hud {
|
|||||||
} else if let (Hotbar(a), Hotbar(b)) = (a, b) {
|
} else if let (Hotbar(a), Hotbar(b)) = (a, b) {
|
||||||
self.hotbar.swap(a, b);
|
self.hotbar.swap(a, b);
|
||||||
events.push(Event::ChangeHotbarState(Box::new(self.hotbar.to_owned())));
|
events.push(Event::ChangeHotbarState(Box::new(self.hotbar.to_owned())));
|
||||||
|
} else if let (Inventory(i), Trade(t)) = (a, b) {
|
||||||
|
if i.ours == t.ours {
|
||||||
|
if let Some(inventory) = inventories.get(t.entity) {
|
||||||
|
events.push(Event::TradeAction(TradeAction::AddItem {
|
||||||
|
item: i.slot,
|
||||||
|
quantity: i.amount(inventory).unwrap_or(1) / 2,
|
||||||
|
ours: i.ours,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if let (Trade(t), Inventory(i)) = (a, b) {
|
||||||
|
if i.ours == t.ours {
|
||||||
|
if let Some(inventory) = inventories.get(t.entity) {
|
||||||
|
if let Some(invslot) = t.invslot {
|
||||||
|
events.push(Event::TradeAction(TradeAction::RemoveItem {
|
||||||
|
item: invslot,
|
||||||
|
quantity: t.amount(inventory).unwrap_or(1) / 2,
|
||||||
|
ours: t.ours,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
slot::Event::Used(from) => {
|
slot::Event::Used(from) => {
|
||||||
|
@ -186,69 +186,8 @@ impl Default for ControlSettings {
|
|||||||
keybindings: HashMap::new(),
|
keybindings: HashMap::new(),
|
||||||
inverse_keybindings: HashMap::new(),
|
inverse_keybindings: HashMap::new(),
|
||||||
};
|
};
|
||||||
// Sets the initial keybindings for those GameInputs. If a new one is created in
|
// Sets the initial keybindings for those GameInputs.
|
||||||
// future, you'll have to update default_binding, and you should update this vec
|
for game_input in GameInput::iterator() {
|
||||||
// too.
|
|
||||||
let game_inputs = vec![
|
|
||||||
GameInput::Primary,
|
|
||||||
GameInput::Secondary,
|
|
||||||
GameInput::ToggleCursor,
|
|
||||||
GameInput::MoveForward,
|
|
||||||
GameInput::MoveBack,
|
|
||||||
GameInput::MoveLeft,
|
|
||||||
GameInput::MoveRight,
|
|
||||||
GameInput::Jump,
|
|
||||||
GameInput::Sit,
|
|
||||||
GameInput::Dance,
|
|
||||||
GameInput::Glide,
|
|
||||||
GameInput::Climb,
|
|
||||||
GameInput::ClimbDown,
|
|
||||||
GameInput::SwimUp,
|
|
||||||
GameInput::SwimDown,
|
|
||||||
GameInput::Fly,
|
|
||||||
GameInput::Sneak,
|
|
||||||
//GameInput::WallLeap,
|
|
||||||
GameInput::ToggleLantern,
|
|
||||||
GameInput::Mount,
|
|
||||||
GameInput::Chat,
|
|
||||||
GameInput::Command,
|
|
||||||
GameInput::Escape,
|
|
||||||
GameInput::Map,
|
|
||||||
GameInput::Bag,
|
|
||||||
GameInput::Social,
|
|
||||||
GameInput::Crafting,
|
|
||||||
GameInput::Spellbook,
|
|
||||||
GameInput::Settings,
|
|
||||||
GameInput::ToggleInterface,
|
|
||||||
GameInput::Help,
|
|
||||||
GameInput::ToggleDebug,
|
|
||||||
GameInput::Fullscreen,
|
|
||||||
GameInput::Screenshot,
|
|
||||||
GameInput::ToggleIngameUi,
|
|
||||||
GameInput::Roll,
|
|
||||||
GameInput::Respawn,
|
|
||||||
GameInput::Interact,
|
|
||||||
GameInput::ToggleWield,
|
|
||||||
//GameInput::Charge,
|
|
||||||
GameInput::FreeLook,
|
|
||||||
GameInput::AutoWalk,
|
|
||||||
GameInput::CycleCamera,
|
|
||||||
GameInput::Slot1,
|
|
||||||
GameInput::Slot2,
|
|
||||||
GameInput::Slot3,
|
|
||||||
GameInput::Slot4,
|
|
||||||
GameInput::Slot5,
|
|
||||||
GameInput::Slot6,
|
|
||||||
GameInput::Slot7,
|
|
||||||
GameInput::Slot8,
|
|
||||||
GameInput::Slot9,
|
|
||||||
GameInput::Slot10,
|
|
||||||
GameInput::SwapLoadout,
|
|
||||||
GameInput::Select,
|
|
||||||
GameInput::AcceptGroupInvite,
|
|
||||||
GameInput::DeclineGroupInvite,
|
|
||||||
];
|
|
||||||
for game_input in game_inputs {
|
|
||||||
new_settings.insert_binding(game_input, ControlSettings::default_binding(game_input));
|
new_settings.insert_binding(game_input, ControlSettings::default_binding(game_input));
|
||||||
}
|
}
|
||||||
new_settings
|
new_settings
|
||||||
|
Loading…
Reference in New Issue
Block a user