]> git.lizzy.rs Git - minetest.git/blob - src/script/cpp_api/s_nodemeta.h
Modernize source code: last part (#6285)
[minetest.git] / src / script / cpp_api / s_nodemeta.h
1 /*
2 Minetest
3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #pragma once
21
22 #include "cpp_api/s_base.h"
23 #include "cpp_api/s_item.h"
24 #include "irr_v3d.h"
25
26 struct ItemStack;
27
28 class ScriptApiNodemeta
29                 : virtual public ScriptApiBase,
30                   public ScriptApiItem
31 {
32 public:
33         ScriptApiNodemeta() = default;
34         virtual ~ScriptApiNodemeta() = default;
35
36         // Return number of accepted items to be moved
37         int nodemeta_inventory_AllowMove(v3s16 p,
38                         const std::string &from_list, int from_index,
39                         const std::string &to_list, int to_index,
40                         int count, ServerActiveObject *player);
41         // Return number of accepted items to be put
42         int nodemeta_inventory_AllowPut(v3s16 p,
43                         const std::string &listname, int index, ItemStack &stack,
44                         ServerActiveObject *player);
45         // Return number of accepted items to be taken
46         int nodemeta_inventory_AllowTake(v3s16 p,
47                         const std::string &listname, int index, ItemStack &stack,
48                         ServerActiveObject *player);
49         // Report moved items
50         void nodemeta_inventory_OnMove(v3s16 p,
51                         const std::string &from_list, int from_index,
52                         const std::string &to_list, int to_index,
53                         int count, ServerActiveObject *player);
54         // Report put items
55         void nodemeta_inventory_OnPut(v3s16 p,
56                         const std::string &listname, int index, ItemStack &stack,
57                         ServerActiveObject *player);
58         // Report taken items
59         void nodemeta_inventory_OnTake(v3s16 p,
60                         const std::string &listname, int index, ItemStack &stack,
61                         ServerActiveObject *player);
62 private:
63
64 };