]> git.lizzy.rs Git - minetest.git/blob - src/content_nodemeta.h
Random Lua tweaks/fixes
[minetest.git] / src / content_nodemeta.h
1 /*
2 Minetest-c55
3 Copyright (C) 2010-2011 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 General Public License as published by
7 the Free Software Foundation; either version 2 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 General Public License for more details.
14
15 You should have received a copy of the GNU 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 #ifndef CONTENT_NODEMETA_HEADER
21 #define CONTENT_NODEMETA_HEADER
22
23 #include "nodemetadata.h"
24
25 class Inventory;
26
27 class SignNodeMetadata : public NodeMetadata
28 {
29 public:
30         SignNodeMetadata(IGameDef *gamedef, std::string text);
31         //~SignNodeMetadata();
32         
33         virtual u16 typeId() const;
34         static NodeMetadata* create(std::istream &is, IGameDef *gamedef);
35         virtual NodeMetadata* clone(IGameDef *gamedef);
36         virtual void serializeBody(std::ostream &os);
37         virtual std::string infoText();
38
39         virtual bool allowsTextInput(){ return true; }
40         virtual std::string getText(){ return m_text; }
41         virtual void setText(const std::string &t){ m_text = t; }
42
43 private:
44         std::string m_text;
45 };
46
47 class ChestNodeMetadata : public NodeMetadata
48 {
49 public:
50         ChestNodeMetadata(IGameDef *gamedef);
51         ~ChestNodeMetadata();
52         
53         virtual u16 typeId() const;
54         static NodeMetadata* create(std::istream &is, IGameDef *gamedef);
55         virtual NodeMetadata* clone(IGameDef *gamedef);
56         virtual void serializeBody(std::ostream &os);
57         virtual std::string infoText();
58         virtual Inventory* getInventory() {return m_inventory;}
59         virtual bool nodeRemovalDisabled();
60         virtual std::string getInventoryDrawSpecString();
61         
62 private:
63         Inventory *m_inventory;
64 };
65
66 class LockingChestNodeMetadata : public NodeMetadata
67 {
68 public:
69         LockingChestNodeMetadata(IGameDef *gamedef);
70         ~LockingChestNodeMetadata();
71
72         virtual u16 typeId() const;
73         static NodeMetadata* create(std::istream &is, IGameDef *gamedef);
74         virtual NodeMetadata* clone(IGameDef *gamedef);
75         virtual void serializeBody(std::ostream &os);
76         virtual std::string infoText();
77         virtual Inventory* getInventory() {return m_inventory;}
78         virtual bool nodeRemovalDisabled();
79         virtual std::string getInventoryDrawSpecString();
80
81         virtual std::string getOwner(){ return m_text; }
82         virtual void setOwner(std::string t){ m_text = t; }
83
84 private:
85         Inventory *m_inventory;
86         std::string m_text;
87 };
88
89 class FurnaceNodeMetadata : public NodeMetadata
90 {
91 public:
92         FurnaceNodeMetadata(IGameDef *gamedef);
93         ~FurnaceNodeMetadata();
94         
95         virtual u16 typeId() const;
96         virtual NodeMetadata* clone(IGameDef *gamedef);
97         static NodeMetadata* create(std::istream &is, IGameDef *gamedef);
98         virtual void serializeBody(std::ostream &os);
99         virtual std::string infoText();
100         virtual Inventory* getInventory() {return m_inventory;}
101         virtual void inventoryModified();
102         virtual bool step(float dtime);
103         virtual bool nodeRemovalDisabled();
104         virtual std::string getInventoryDrawSpecString();
105
106 private:
107         Inventory *m_inventory;
108         float m_step_accumulator;
109         float m_fuel_totaltime;
110         float m_fuel_time;
111         float m_src_totaltime;
112         float m_src_time;
113 };
114
115
116 #endif
117