* Make a small history check to transformLiquids to detect and log\r
continuous oscillations, in such detail that they can be fixed.\r
\r
-TODO: When player dies, throw items on map\r
+TODO: Player health points\r
+ - When player dies, throw items on map\r
\r
Objects:\r
--------\r
\r
-TODO: There has to be some better way to handle static objects than to\r
- send them all the time. This affects signs and item objects.\r
-SUGG: Signs could be done in the same way as torches. For this, blocks\r
- need an additional metadata field for the texts\r
- - This is also needed for item container chests\r
-\r
-Block object server side:\r
- - A "near blocks" buffer, in which some nearby blocks are stored.\r
- - For all blocks in the buffer, objects are stepped(). This\r
- means they are active.\r
- - A global active buffer is needed for the server\r
- - A timestamp to blocks\r
- - All blocks going in and out of the buffer are recorded.\r
- - For outgoing blocks, timestamp is written.\r
- - For incoming blocks, time difference is calculated and\r
- objects are stepped according to it.\r
-\r
-- When an active object goes far from a player, either delete\r
- it or store it statically.\r
-- When a statically stored active object comes near a player,\r
- recreate the active object\r
-\r
-* Continue making the scripting system:\r
- * Make updateNodeMesh for a less verbose mesh update on add/removenode\r
- * Switch to using a safe way for the self and env pointers\r
- * Make some global environment hooks, like node placed and general\r
- on_step()\r
-* Add a global Lua spawn handler and such\r
-* Get rid of MapBlockObjects\r
-* Other players could be sent to clients as LuaCAOs\r
+TODO: Get rid of MapBlockObjects\r
\r
Map:\r
----\r
f->wall_mounted = true;
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
- i = CONTENT_FURNACE;
- f = &g_content_features[i];
- f->setAllTextures("furnace_side.png");
- f->setTexture(2, "furnace_front.png");
- f->setInventoryTexture("furnace_front.png");
- f->param_type = CPT_NONE;
- f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
-
i = CONTENT_SIGN_WALL;
f = &g_content_features[i];
f->setInventoryTexture("sign_wall.png");
if(f->initial_metadata == NULL)
f->initial_metadata = new SignNodeMetadata("Some sign");
+ i = CONTENT_CHEST;
+ f = &g_content_features[i];
+ f->param_type = CPT_FACEDIR_SIMPLE;
+ f->setAllTextures("chest_side.png");
+ f->setTexture(0, "chest_top.png");
+ f->setTexture(1, "chest_top.png");
+ f->setTexture(5, "chest_front.png"); // Z-
+ f->setInventoryTexture("chest_top.png");
+ //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
+ f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+ if(f->initial_metadata == NULL)
+ f->initial_metadata = new ChestNodeMetadata();
+
+ i = CONTENT_FURNACE;
+ f = &g_content_features[i];
+ f->param_type = CPT_FACEDIR_SIMPLE;
+ f->setAllTextures("furnace_side.png");
+ f->setTexture(5, "furnace_front.png"); // Z-
+ f->setInventoryTexture("furnace_front.png");
+ f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+
+}
+
+v3s16 facedir_rotate(u8 facedir, v3s16 dir)
+{
+ /*
+ Face 2 (normally Z-) direction:
+ facedir=0: Z-
+ facedir=1: X-
+ facedir=2: Z+
+ facedir=3: X+
+ */
+ v3s16 newdir;
+ if(facedir==0) // Same
+ newdir = v3s16(dir.X, dir.Y, dir.Z);
+ else if(facedir == 1) // Face is taken from rotXZccv(-90)
+ newdir = v3s16(-dir.Z, dir.Y, dir.X);
+ else if(facedir == 2) // Face is taken from rotXZccv(180)
+ newdir = v3s16(-dir.X, dir.Y, -dir.Z);
+ else if(facedir == 3) // Face is taken from rotXZccv(90)
+ newdir = v3s16(dir.Z, dir.Y, -dir.X);
+ else
+ newdir = dir;
+ return newdir;
}
TileSpec MapNode::getTile(v3s16 dir)
{
+ if(content_features(d).param_type == CPT_FACEDIR_SIMPLE)
+ dir = facedir_rotate(param1, dir);
+
TileSpec spec;
s32 dir_i = -1;
#define CONTENT_COALSTONE 11
#define CONTENT_WOOD 12
#define CONTENT_SAND 13
-#define CONTENT_FURNACE 14
-#define CONTENT_SIGN_WALL 15
+#define CONTENT_SIGN_WALL 14
+#define CONTENT_CHEST 15
+#define CONTENT_FURNACE 16
/*
Content feature list
{
CPT_NONE,
CPT_LIGHT,
- CPT_MINERAL
+ CPT_MINERAL,
+ // Direction for chests and furnaces and such
+ CPT_FACEDIR_SIMPLE
};
enum LiquidType
*/
TileSpec tiles[6];
- // TODO: Somehow specify inventory image
- //std::string inventory_image_path;
- //TextureSpec inventory_texture;
- //u32 inventory_texture_id;
video::ITexture *inventory_texture;
- bool is_ground_content; //TODO: Remove, use walkable instead
+ bool is_ground_content;
bool light_propagates;
bool sunlight_propagates;
u8 solidness; // Used when choosing which face is drawn
return d;
}
+/*
+ facedir: CPT_FACEDIR_SIMPLE param1 value
+ dir: The face for which stuff is wanted
+ return value: The face from which the stuff is actually found
+*/
+v3s16 facedir_rotate(u8 facedir, v3s16 dir);
+
enum LightBank
{
LIGHTBANK_DAY,
Sunlight is LIGHT_SUN, which is LIGHT_MAX+1.
- Contains 2 values, day- and night lighting. Each takes 4 bits.
*/
- s8 param;
+ union
+ {
+ s8 param;
+ u8 param1;
+ };
+ /*
+ The second parameter. Initialized to 0.
+ E.g. direction for torches and flowing water.
+ */
union
{
- /*
- The second parameter. Initialized to 0.
- Direction for torches and flowing water.
- */
u8 param2;
u8 dir;
};
g_material_properties[CONTENT_SAND].setDiggingProperties("",
DiggingProperties(true, 0.4, 0));
+ g_material_properties[CONTENT_CHEST].setDiggingProperties("",
+ DiggingProperties(true, 1.0, 0));
+
setStoneLikeDiggingProperties(CONTENT_FURNACE, 1.0);
+ g_material_properties[CONTENT_SIGN_WALL].setDiggingProperties("",
+ DiggingProperties(true, 0.0, 0));
+
/*
Add MesePick to everything
*/
return std::string("\"")+m_text+"\"";
}
+/*
+ ChestNodeMetadata
+*/
+
+ChestNodeMetadata::ChestNodeMetadata()
+{
+ NodeMetadata::registerType(typeId(), create);
+}
+u16 ChestNodeMetadata::typeId() const
+{
+ return CONTENT_CHEST;
+}
+NodeMetadata* ChestNodeMetadata::create(std::istream &is)
+{
+ return new ChestNodeMetadata();
+}
+NodeMetadata* ChestNodeMetadata::clone()
+{
+ return new ChestNodeMetadata();
+}
+void ChestNodeMetadata::serializeBody(std::ostream &os)
+{
+}
+std::string ChestNodeMetadata::infoText()
+{
+ return "Chest";
+}
+
/*
NodeMetadatalist
*/
std::string m_text;
};
+class ChestNodeMetadata : public NodeMetadata
+{
+public:
+ ChestNodeMetadata();
+
+ virtual u16 typeId() const;
+ static NodeMetadata* create(std::istream &is);
+ virtual NodeMetadata* clone();
+ virtual void serializeBody(std::ostream &os);
+ virtual std::string infoText();
+
+private:
+};
+
class NodeMetadataList
{
public:
CONTENT_MESE,
CONTENT_WATERSOURCE,
CONTENT_CLOUD,
+ CONTENT_CHEST,
CONTENT_FURNACE,
CONTENT_SIGN_WALL,
CONTENT_IGNORE