#include <inventorymanager.h>
Public Member Functions | |
IMoveAction ()=default | |
IMoveAction (std::istream &is, bool somewhere) | |
IAction | getType () const |
void | serialize (std::ostream &os) const |
void | apply (InventoryManager *mgr, ServerActiveObject *player, IGameDef *gamedef) |
void | clientApply (InventoryManager *mgr, IGameDef *gamedef) |
void | swapDirections () |
void | onTake (const ItemStack &src_item, ServerActiveObject *player) const |
void | onPut (const ItemStack &src_item, ServerActiveObject *player) const |
void | onMove (int count, ServerActiveObject *player) const |
int | allowPut (const ItemStack &dst_item, ServerActiveObject *player) const |
int | allowTake (const ItemStack &src_item, ServerActiveObject *player) const |
int | allowMove (int try_take_count, ServerActiveObject *player) const |
Public Member Functions inherited from InventoryAction | |
virtual | ~InventoryAction ()=default |
Public Attributes | |
u16 | count = 0 |
bool | move_somewhere = false |
bool | caused_by_move_somewhere = false |
u32 | move_count = 0 |
Public Attributes inherited from MoveAction | |
InventoryLocation | from_inv |
std::string | from_list |
s16 | from_i = -1 |
InventoryLocation | to_inv |
std::string | to_list |
s16 | to_i = -1 |
Additional Inherited Members | |
Static Public Member Functions inherited from InventoryAction | |
static InventoryAction * | deSerialize (std::istream &is) |
|
default |
IMoveAction::IMoveAction | ( | std::istream & | is, |
bool | somewhere ) |
References count, InventoryLocation::deSerialize(), MoveAction::from_i, MoveAction::from_inv, MoveAction::from_list, stoi, MoveAction::to_i, MoveAction::to_inv, and MoveAction::to_list.
int IMoveAction::allowMove | ( | int | try_take_count, |
ServerActiveObject * | player ) const |
References InventoryLocation::DETACHED, ScriptApiDetached::detached_inventory_AllowMove(), MoveAction::from_inv, InventoryLocation::NODEMETA, ScriptApiNodemeta::nodemeta_inventory_AllowMove(), InventoryLocation::PLAYER, ScriptApiPlayer::player_inventory_AllowMove(), PLAYER_TO_SA, and InventoryLocation::type.
Referenced by apply().
int IMoveAction::allowPut | ( | const ItemStack & | dst_item, |
ServerActiveObject * | player ) const |
References InventoryLocation::DETACHED, ScriptApiDetached::detached_inventory_AllowPut(), InventoryLocation::NODEMETA, ScriptApiNodemeta::nodemeta_inventory_AllowPut(), InventoryLocation::PLAYER, ScriptApiPlayer::player_inventory_AllowPut(), PLAYER_TO_SA, MoveAction::to_inv, and InventoryLocation::type.
Referenced by apply().
int IMoveAction::allowTake | ( | const ItemStack & | src_item, |
ServerActiveObject * | player ) const |
References InventoryLocation::DETACHED, ScriptApiDetached::detached_inventory_AllowTake(), MoveAction::from_inv, InventoryLocation::NODEMETA, ScriptApiNodemeta::nodemeta_inventory_AllowTake(), InventoryLocation::PLAYER, ScriptApiPlayer::player_inventory_AllowTake(), PLAYER_TO_SA, and InventoryLocation::type.
Referenced by apply().
|
virtual |
Necessary for executing Lua callbacks which may manipulate the inventory, hence invalidate pointers needed by IMoveAction::apply
Implements InventoryAction.
References allowMove(), allowPut(), allowTake(), apply(), caused_by_move_somewhere, count, ItemStack::count, InventoryLocation::dump(), ItemStack::empty(), MoveAction::from_i, MoveAction::from_inv, MoveAction::from_list, InventoryManager::getInventory(), Inventory::getList(), infostream, ItemStack::itemFits(), move_count, move_somewhere, ItemStack::name, onMove(), onPut(), onTake(), InventoryLocation::PLAYER, IRollbackManager::reportAction(), InventoryList::resizeLock(), IGameDef::rollback(), InventoryLocation::serialize(), InventoryManager::setInventoryModified(), RollbackAction::setModifyInventoryStack(), swapDirections(), MoveAction::to_i, MoveAction::to_inv, MoveAction::to_list, and InventoryLocation::type.
Referenced by apply().
|
virtual |
Implements InventoryAction.
References count, MoveAction::from_i, MoveAction::from_inv, MoveAction::from_list, InventoryManager::getInventory(), Inventory::getList(), move_somewhere, InventoryList::moveItem(), InventoryList::moveItemSomewhere(), InventoryLocation::setCurrentPlayer(), InventoryManager::setInventoryModified(), MoveAction::to_i, MoveAction::to_inv, and MoveAction::to_list.
|
inlinevirtual |
Implements InventoryAction.
References Move.
void IMoveAction::onMove | ( | int | count, |
ServerActiveObject * | player ) const |
References count, InventoryLocation::DETACHED, ScriptApiDetached::detached_inventory_OnMove(), MoveAction::from_inv, InventoryLocation::NODEMETA, ScriptApiNodemeta::nodemeta_inventory_OnMove(), InventoryLocation::PLAYER, ScriptApiPlayer::player_inventory_OnMove(), PLAYER_TO_SA, and InventoryLocation::type.
Referenced by apply().
void IMoveAction::onPut | ( | const ItemStack & | src_item, |
ServerActiveObject * | player ) const |
References InventoryLocation::DETACHED, ScriptApiDetached::detached_inventory_OnPut(), InventoryLocation::NODEMETA, ScriptApiNodemeta::nodemeta_inventory_OnPut(), InventoryLocation::PLAYER, ScriptApiPlayer::player_inventory_OnPut(), PLAYER_TO_SA, MoveAction::to_inv, and InventoryLocation::type.
Referenced by apply().
void IMoveAction::onTake | ( | const ItemStack & | src_item, |
ServerActiveObject * | player ) const |
References InventoryLocation::DETACHED, ScriptApiDetached::detached_inventory_OnTake(), MoveAction::from_inv, InventoryLocation::NODEMETA, ScriptApiNodemeta::nodemeta_inventory_OnTake(), InventoryLocation::PLAYER, ScriptApiPlayer::player_inventory_OnTake(), PLAYER_TO_SA, and InventoryLocation::type.
Referenced by apply().
|
inlinevirtual |
Implements InventoryAction.
References count, InventoryLocation::dump(), MoveAction::from_i, MoveAction::from_inv, MoveAction::from_list, move_somewhere, MoveAction::to_i, MoveAction::to_inv, and MoveAction::to_list.
void IMoveAction::swapDirections | ( | ) |
References MoveAction::from_i, MoveAction::from_inv, MoveAction::from_list, MoveAction::to_i, MoveAction::to_inv, and MoveAction::to_list.
Referenced by apply().
bool IMoveAction::caused_by_move_somewhere = false |
Referenced by apply().
u16 IMoveAction::count = 0 |
Referenced by IMoveAction(), apply(), clientApply(), GUIFormSpecMenu::OnEvent(), onMove(), serialize(), and GUIFormSpecMenu::updateSelectedItem().
u32 IMoveAction::move_count = 0 |
Referenced by apply().
bool IMoveAction::move_somewhere = false |
Referenced by apply(), clientApply(), GUIFormSpecMenu::OnEvent(), serialize(), and GUIFormSpecMenu::updateSelectedItem().