Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
IMoveAction Struct Reference

#include <inventorymanager.h>

+ Inheritance diagram for IMoveAction:
+ Collaboration diagram for IMoveAction:

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 InventoryActiondeSerialize (std::istream &is)
 

Constructor & Destructor Documentation

◆ IMoveAction() [1/2]

IMoveAction::IMoveAction ( )
default

◆ IMoveAction() [2/2]

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.

+ Here is the call graph for this function:

Member Function Documentation

◆ allowMove()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ allowPut()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ allowTake()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apply()

void IMoveAction::apply ( InventoryManager * mgr,
ServerActiveObject * player,
IGameDef * gamedef )
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clientApply()

void IMoveAction::clientApply ( InventoryManager * mgr,
IGameDef * gamedef )
virtual

◆ getType()

IAction IMoveAction::getType ( ) const
inlinevirtual

Implements InventoryAction.

References Move.

◆ onMove()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onPut()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onTake()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

void IMoveAction::serialize ( std::ostream & os) const
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.

+ Here is the call graph for this function:

◆ swapDirections()

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().

+ Here is the caller graph for this function:

Member Data Documentation

◆ caused_by_move_somewhere

bool IMoveAction::caused_by_move_somewhere = false

Referenced by apply().

◆ count

◆ move_count

u32 IMoveAction::move_count = 0

Referenced by apply().

◆ move_somewhere

bool IMoveAction::move_somewhere = false

The documentation for this struct was generated from the following files: