af3374124b79f39784804bcaae7e250dbaf6e95d
[oweals/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(std::string text);
31         //~SignNodeMetadata();
32         
33         virtual u16 typeId() const;
34         static NodeMetadata* create(std::istream &is);
35         virtual NodeMetadata* clone();
36         virtual void serializeBody(std::ostream &os);
37         virtual std::string infoText();
38
39         std::string getText(){ return m_text; }
40         void setText(std::string t){ m_text = t; }
41
42 private:
43         std::string m_text;
44 };
45
46 class ChestNodeMetadata : public NodeMetadata
47 {
48 public:
49         ChestNodeMetadata();
50         ~ChestNodeMetadata();
51         
52         virtual u16 typeId() const;
53         static NodeMetadata* create(std::istream &is);
54         virtual NodeMetadata* clone();
55         virtual void serializeBody(std::ostream &os);
56         virtual std::string infoText();
57         virtual Inventory* getInventory() {return m_inventory;}
58         virtual bool nodeRemovalDisabled();
59         virtual std::string getInventoryDrawSpecString();
60         
61 private:
62         Inventory *m_inventory;
63 };
64
65 class LockingChestNodeMetadata : public NodeMetadata
66 {
67 public:
68         LockingChestNodeMetadata();
69         ~LockingChestNodeMetadata();
70
71         virtual u16 typeId() const;
72         static NodeMetadata* create(std::istream &is);
73         virtual NodeMetadata* clone();
74         virtual void serializeBody(std::ostream &os);
75         virtual std::string infoText();
76         virtual Inventory* getInventory() {return m_inventory;}
77         virtual bool nodeRemovalDisabled();
78         virtual std::string getInventoryDrawSpecString();
79
80         std::string getOwner(){ return m_text; }
81         void setOwner(std::string t){ m_text = t; }
82
83 private:
84         Inventory *m_inventory;
85         std::string m_text;
86 };
87
88 class FurnaceNodeMetadata : public NodeMetadata
89 {
90 public:
91         FurnaceNodeMetadata();
92         ~FurnaceNodeMetadata();
93         
94         virtual u16 typeId() const;
95         virtual NodeMetadata* clone();
96         static NodeMetadata* create(std::istream &is);
97         virtual void serializeBody(std::ostream &os);
98         virtual std::string infoText();
99         virtual Inventory* getInventory() {return m_inventory;}
100         virtual void inventoryModified();
101         virtual bool step(float dtime);
102         virtual bool nodeRemovalDisabled();
103         virtual std::string getInventoryDrawSpecString();
104
105 private:
106         Inventory *m_inventory;
107         float m_step_accumulator;
108         float m_fuel_totaltime;
109         float m_fuel_time;
110         float m_src_totaltime;
111         float m_src_time;
112 };
113
114
115 #endif
116