]> git.lizzy.rs Git - minetest.git/blob - src/content_nodemeta.h
8888d6f1fb50105ea00d81e0304cfa1ed973ca6d
[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         virtual const char* typeName() const
35         { return "sign"; }
36         static NodeMetadata* create(std::istream &is, IGameDef *gamedef);
37         static NodeMetadata* create(IGameDef *gamedef);
38         virtual NodeMetadata* clone(IGameDef *gamedef);
39         virtual void serializeBody(std::ostream &os);
40         virtual std::string infoText();
41
42         virtual bool allowsTextInput(){ return true; }
43         virtual std::string getText(){ return m_text; }
44         virtual void setText(const std::string &t){ m_text = t; }
45
46 private:
47         std::string m_text;
48 };
49
50 class ChestNodeMetadata : public NodeMetadata
51 {
52 public:
53         ChestNodeMetadata(IGameDef *gamedef);
54         ~ChestNodeMetadata();
55         
56         virtual u16 typeId() const;
57         virtual const char* typeName() const
58         { return "chest"; }
59         static NodeMetadata* create(std::istream &is, IGameDef *gamedef);
60         static NodeMetadata* create(IGameDef *gamedef);
61         virtual NodeMetadata* clone(IGameDef *gamedef);
62         virtual void serializeBody(std::ostream &os);
63         virtual std::string infoText();
64         virtual Inventory* getInventory() {return m_inventory;}
65         virtual bool nodeRemovalDisabled();
66         virtual std::string getInventoryDrawSpecString();
67         
68 private:
69         Inventory *m_inventory;
70 };
71
72 class LockingChestNodeMetadata : public NodeMetadata
73 {
74 public:
75         LockingChestNodeMetadata(IGameDef *gamedef);
76         ~LockingChestNodeMetadata();
77
78         virtual u16 typeId() const;
79         virtual const char* typeName() const
80         { return "locked_chest"; }
81         static NodeMetadata* create(std::istream &is, IGameDef *gamedef);
82         static NodeMetadata* create(IGameDef *gamedef);
83         virtual NodeMetadata* clone(IGameDef *gamedef);
84         virtual void serializeBody(std::ostream &os);
85         virtual std::string infoText();
86         virtual Inventory* getInventory() {return m_inventory;}
87         virtual bool nodeRemovalDisabled();
88         virtual std::string getInventoryDrawSpecString();
89
90         virtual std::string getOwner(){ return m_text; }
91         virtual void setOwner(std::string t){ m_text = t; }
92
93 private:
94         Inventory *m_inventory;
95         std::string m_text;
96 };
97
98 class FurnaceNodeMetadata : public NodeMetadata
99 {
100 public:
101         FurnaceNodeMetadata(IGameDef *gamedef);
102         ~FurnaceNodeMetadata();
103         
104         virtual u16 typeId() const;
105         virtual const char* typeName() const
106         { return "furnace"; }
107         virtual NodeMetadata* clone(IGameDef *gamedef);
108         static NodeMetadata* create(std::istream &is, IGameDef *gamedef);
109         static NodeMetadata* create(IGameDef *gamedef);
110         virtual void serializeBody(std::ostream &os);
111         virtual std::string infoText();
112         virtual Inventory* getInventory() {return m_inventory;}
113         virtual void inventoryModified();
114         virtual bool step(float dtime);
115         virtual bool nodeRemovalDisabled();
116         virtual std::string getInventoryDrawSpecString();
117
118 private:
119         Inventory *m_inventory;
120         float m_step_accumulator;
121         float m_fuel_totaltime;
122         float m_fuel_time;
123         float m_src_totaltime;
124         float m_src_time;
125 };
126
127
128 #endif
129