1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Add MoveSomewhere inventory action

Improve shift+click experience
This commit is contained in:
est31 2015-06-20 12:55:48 +02:00
parent bc55ef337c
commit 2c1fd29884
6 changed files with 180 additions and 60 deletions

View file

@ -143,15 +143,24 @@ struct IMoveAction : public InventoryAction
InventoryLocation to_inv;
std::string to_list;
s16 to_i;
bool move_somewhere;
// treat these as private
// related to movement to somewhere
bool caused_by_move_somewhere;
u32 move_count;
IMoveAction()
{
count = 0;
from_i = -1;
to_i = -1;
move_somewhere = false;
caused_by_move_somewhere = false;
move_count = 0;
}
IMoveAction(std::istream &is);
IMoveAction(std::istream &is, bool somewhere);
u16 getType() const
{
@ -160,14 +169,18 @@ struct IMoveAction : public InventoryAction
void serialize(std::ostream &os) const
{
os<<"Move ";
os<<count<<" ";
os<<from_inv.dump()<<" ";
os<<from_list<<" ";
os<<from_i<<" ";
os<<to_inv.dump()<<" ";
os<<to_list<<" ";
os<<to_i;
if (!move_somewhere)
os << "Move ";
else
os << "MoveSomewhere ";
os << count << " ";
os << from_inv.dump() << " ";
os << from_list << " ";
os << from_i << " ";
os << to_inv.dump() << " ";
os << to_list;
if (!move_somewhere)
os << " " << to_i;
}
void apply(InventoryManager *mgr, ServerActiveObject *player, IGameDef *gamedef);