Luanti
5.10.0-dev
Loading...
Searching...
No Matches
l_itemstackmeta.h
Go to the documentation of this file.
1
// Luanti
2
// SPDX-License-Identifier: LGPL-2.1-or-later
3
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
// Copyright (C) 2017-8 rubenwardy <rw@rubenwardy.com>
5
// Copyright (C) 2017 raymoo
6
7
#pragma once
8
9
#include "
lua_api/l_base.h
"
10
#include "
lua_api/l_metadata.h
"
11
#include "
lua_api/l_item.h
"
12
#include "
irrlichttypes_bloated.h
"
13
14
class
ItemStackMetaRef
:
public
MetaDataRef
15
{
16
private
:
17
LuaItemStack
*
istack
;
18
19
static
const
luaL_Reg
methods
[];
20
21
virtual
IMetadata
*
getmeta
(
bool
auto_create);
22
23
virtual
void
clearMeta
();
24
25
virtual
void
reportMetadataChange
(
const
std::string *name =
nullptr
);
26
27
void
setToolCapabilities
(
const
ToolCapabilities
&caps)
28
{
29
istack
->
getItem
().
metadata
.
setToolCapabilities
(caps);
30
}
31
32
void
clearToolCapabilities
()
33
{
34
istack
->
getItem
().
metadata
.
clearToolCapabilities
();
35
}
36
37
void
setWearBarParams
(
const
WearBarParams
¶ms)
38
{
39
istack
->
getItem
().
metadata
.
setWearBarParams
(params);
40
}
41
42
void
clearWearBarParams
()
43
{
44
istack
->
getItem
().
metadata
.
clearWearBarParams
();
45
}
46
47
// Exported functions
48
static
int
l_set_tool_capabilities
(lua_State *L);
49
static
int
l_set_wear_bar_params
(lua_State *L);
50
public
:
51
// takes a reference
52
ItemStackMetaRef
(
LuaItemStack
*
istack
);
53
~ItemStackMetaRef
();
54
55
DISABLE_CLASS_COPY
(
ItemStackMetaRef
)
56
57
// Creates an ItemStackMetaRef and leaves it on top of stack
58
// Not callable from Lua; all references are created on the C side.
59
static
void
create
(lua_State *L,
LuaItemStack
*
istack
);
60
61
static
void
Register
(lua_State *L);
62
63
static
const
char
className
[];
64
};
DISABLE_CLASS_COPY
#define DISABLE_CLASS_COPY(C)
Definition
basic_macros.h:26
IMetadata
Definition
metadata.h:14
ItemStackMetaRef
Definition
l_itemstackmeta.h:15
ItemStackMetaRef::className
static const char className[]
Definition
l_itemstackmeta.h:63
ItemStackMetaRef::methods
static const luaL_Reg methods[]
Definition
l_itemstackmeta.h:88
ItemStackMetaRef::~ItemStackMetaRef
~ItemStackMetaRef()
Definition
l_itemstackmeta.cpp:67
ItemStackMetaRef::getmeta
virtual IMetadata * getmeta(bool auto_create)
Definition
l_itemstackmeta.cpp:17
ItemStackMetaRef::ItemStackMetaRef
ItemStackMetaRef(LuaItemStack *istack)
Definition
l_itemstackmeta.cpp:62
ItemStackMetaRef::clearToolCapabilities
void clearToolCapabilities()
Definition
l_itemstackmeta.h:32
ItemStackMetaRef::istack
LuaItemStack * istack
Definition
l_itemstackmeta.h:17
ItemStackMetaRef::l_set_tool_capabilities
static int l_set_tool_capabilities(lua_State *L)
Definition
l_itemstackmeta.cpp:33
ItemStackMetaRef::create
static void create(lua_State *L, LuaItemStack *istack)
Definition
l_itemstackmeta.cpp:74
ItemStackMetaRef::clearWearBarParams
void clearWearBarParams()
Definition
l_itemstackmeta.h:42
ItemStackMetaRef::setToolCapabilities
void setToolCapabilities(const ToolCapabilities &caps)
Definition
l_itemstackmeta.h:27
ItemStackMetaRef::l_set_wear_bar_params
static int l_set_wear_bar_params(lua_State *L)
Definition
l_itemstackmeta.cpp:48
ItemStackMetaRef::clearMeta
virtual void clearMeta()
Definition
l_itemstackmeta.cpp:22
ItemStackMetaRef::setWearBarParams
void setWearBarParams(const WearBarParams ¶ms)
Definition
l_itemstackmeta.h:37
ItemStackMetaRef::reportMetadataChange
virtual void reportMetadataChange(const std::string *name=nullptr)
Definition
l_itemstackmeta.cpp:27
ItemStackMetadata::clearToolCapabilities
void clearToolCapabilities()
Definition
itemstackmetadata.cpp:107
ItemStackMetadata::clearWearBarParams
void clearWearBarParams()
Definition
itemstackmetadata.cpp:129
ItemStackMetadata::setToolCapabilities
void setToolCapabilities(const ToolCapabilities &caps)
Definition
itemstackmetadata.cpp:100
ItemStackMetadata::setWearBarParams
void setWearBarParams(const WearBarParams ¶ms)
Definition
itemstackmetadata.cpp:122
LuaItemStack
Definition
l_item.h:11
LuaItemStack::getItem
const ItemStack & getItem() const
Definition
l_item.h:139
MetaDataRef
Definition
l_metadata.h:18
ELoginRegister::Register
@ Register
irrlichttypes_bloated.h
l_base.h
l_item.h
l_metadata.h
ItemStack::metadata
ItemStackMetadata metadata
Definition
inventory.h:190
ToolCapabilities
Definition
tool.h:46
WearBarParams
Definition
tool.h:78
script
lua_api
l_itemstackmeta.h
Generated on Fri Nov 1 2024 10:49:00 for Luanti by
1.11.0