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"
13
15{
16private:
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
31
36
37 void setWearBarParams(const WearBarParams &params)
38 {
40 }
41
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);
50public:
51 // takes a reference
54
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};
#define DISABLE_CLASS_COPY(C)
Definition basic_macros.h:26
Definition metadata.h:14
Definition l_itemstackmeta.h:15
static const char className[]
Definition l_itemstackmeta.h:63
static const luaL_Reg methods[]
Definition l_itemstackmeta.h:88
~ItemStackMetaRef()
Definition l_itemstackmeta.cpp:67
virtual IMetadata * getmeta(bool auto_create)
Definition l_itemstackmeta.cpp:17
ItemStackMetaRef(LuaItemStack *istack)
Definition l_itemstackmeta.cpp:62
void clearToolCapabilities()
Definition l_itemstackmeta.h:32
LuaItemStack * istack
Definition l_itemstackmeta.h:17
static int l_set_tool_capabilities(lua_State *L)
Definition l_itemstackmeta.cpp:33
static void create(lua_State *L, LuaItemStack *istack)
Definition l_itemstackmeta.cpp:74
void clearWearBarParams()
Definition l_itemstackmeta.h:42
void setToolCapabilities(const ToolCapabilities &caps)
Definition l_itemstackmeta.h:27
static int l_set_wear_bar_params(lua_State *L)
Definition l_itemstackmeta.cpp:48
virtual void clearMeta()
Definition l_itemstackmeta.cpp:22
void setWearBarParams(const WearBarParams &params)
Definition l_itemstackmeta.h:37
virtual void reportMetadataChange(const std::string *name=nullptr)
Definition l_itemstackmeta.cpp:27
void clearToolCapabilities()
Definition itemstackmetadata.cpp:107
void clearWearBarParams()
Definition itemstackmetadata.cpp:129
void setToolCapabilities(const ToolCapabilities &caps)
Definition itemstackmetadata.cpp:100
void setWearBarParams(const WearBarParams &params)
Definition itemstackmetadata.cpp:122
Definition l_item.h:11
const ItemStack & getItem() const
Definition l_item.h:139
Definition l_metadata.h:18
ItemStackMetadata metadata
Definition inventory.h:190
Definition tool.h:46
Definition tool.h:78