Add croplike drawtype and use it for wheat
This commit is contained in:
parent
4597f069b2
commit
f506ca672a
@ -1,7 +1,5 @@
|
||||
Minetest Lua Modding API Reference 0.4.13
|
||||
=========================================
|
||||
* More information at <http://www.minetest.net/>
|
||||
* Developer Wiki: <http://dev.minetest.net/>
|
||||
BlockPlanet Lua Modding API Reference - Version 0.1.0 alpha
|
||||
===========================================================
|
||||
|
||||
Introduction
|
||||
------------
|
||||
@ -584,6 +582,7 @@ Look for examples in `games/minimal` or `games/minetest_game`.
|
||||
* `raillike`
|
||||
* `nodebox` -- See below. (**Experimental!**)
|
||||
* `mesh` -- use models for nodes
|
||||
* `croplike`
|
||||
|
||||
`*_optional` drawtypes need less rendering time if deactivated (always client side).
|
||||
|
||||
|
@ -276,7 +276,7 @@ farming.register_plant = function(name, def)
|
||||
local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1}
|
||||
nodegroups[pname] = i
|
||||
minetest.register_node(":" .. mname .. ":" .. pname .. "_" .. i, {
|
||||
drawtype = "plantlike",
|
||||
drawtype = def.drawtype or "plantlike",
|
||||
waving = 1,
|
||||
tiles = {mname .. "_" .. pname .. "_" .. i .. ".png"},
|
||||
paramtype = "light",
|
||||
|
@ -1,6 +1,7 @@
|
||||
-- Wheat
|
||||
farming.register_plant("farming:wheat", {
|
||||
description = "Wheat seed",
|
||||
drawtype = "croplike",
|
||||
inventory_image = "farming_wheat_seed.png",
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
@ -27,5 +28,5 @@ farming.register_plant("farming:potato", {
|
||||
minlight = 13,
|
||||
maxlight = default.LIGHT_MAX,
|
||||
fertility = {"grassland"},
|
||||
on_use = minetest.item_eat(1)
|
||||
on_use = minetest.item_eat(1)
|
||||
})
|
||||
|
@ -76,7 +76,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// results. (negative coordinates, values between nodes, ...)
|
||||
// Use floatToInt(p, BS) and intToFloat(p, BS).
|
||||
#define BS (10.0)
|
||||
#define HBS (BS/2)
|
||||
|
||||
// Dimension of a MapBlock
|
||||
#define MAP_BLOCKSIZE 16
|
||||
|
@ -34,6 +34,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "noise.h"
|
||||
|
||||
|
||||
static const f32 HBS = BS/2;
|
||||
static const f32 HBB = HBS/2;
|
||||
|
||||
|
||||
// Create a cuboid.
|
||||
// collector - the MeshCollector for the resulting polygons
|
||||
// box - the position and size of the box
|
||||
@ -1191,6 +1195,51 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
||||
collector.append(tile, vertices, 4, indices, 6);
|
||||
}
|
||||
break;}
|
||||
case NDT_CROPLIKE:
|
||||
{
|
||||
TileSpec tile = getNodeTileN(n, p, 0, data);
|
||||
tile.material_flags |= MATERIAL_FLAG_CRACK_OVERLAY;
|
||||
|
||||
u16 l = getInteriorLight(n, 1, nodedef);
|
||||
video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
|
||||
|
||||
video::S3DVertex vertices[4][4] =
|
||||
{
|
||||
{// right
|
||||
video::S3DVertex(HBB, HBS,-HBS, 1,0,0, c, 0,0),
|
||||
video::S3DVertex(HBB, HBS, HBS, 1,0,0, c, 1,0),
|
||||
video::S3DVertex(HBB,-HBS, HBS, 1,0,0, c, 1,1),
|
||||
video::S3DVertex(HBB,-HBS,-HBS, 1,0,0, c, 0,1)
|
||||
},
|
||||
{// left
|
||||
video::S3DVertex(-HBB, HBS, HBS, -1,0,0, c, 0,0),
|
||||
video::S3DVertex(-HBB, HBS,-HBS, -1,0,0, c, 1,0),
|
||||
video::S3DVertex(-HBB,-HBS,-HBS, -1,0,0, c, 1,1),
|
||||
video::S3DVertex(-HBB,-HBS, HBS, -1,0,0, c, 0,1)
|
||||
},
|
||||
{
|
||||
video::S3DVertex(HBS, HBS, HBB, 0,0,0, c, 0,0),
|
||||
video::S3DVertex(-HBS, HBS,HBB, 0,0,0, c, 1,0),
|
||||
video::S3DVertex(-HBS,-HBS,HBB, 0,0,0, c, 1,1),
|
||||
video::S3DVertex(HBS, -HBS,HBB, 0,0,0, c, 0,1),
|
||||
},
|
||||
{
|
||||
video::S3DVertex(-HBS, HBS,-HBB, 0,0,0, c, 0,0),
|
||||
video::S3DVertex(HBS, HBS, -HBB, 0,0,0, c, 1,0),
|
||||
video::S3DVertex(HBS, -HBS,-HBB, 0,0,0, c, 1,1),
|
||||
video::S3DVertex(-HBS,-HBS,-HBB, 0,0,0, c, 0,1),
|
||||
}
|
||||
};
|
||||
|
||||
for(u16 j = 0; j < 4; j++) {
|
||||
for(u16 i = 0; i < 4; i++)
|
||||
vertices[j][i].Pos += intToFloat(p, BS);
|
||||
|
||||
u16 indices[] = {0, 1, 2, 2, 3, 0};
|
||||
// Add to mesh collector
|
||||
collector.append(tile, vertices[j], 4, indices, 6);
|
||||
}
|
||||
break;}
|
||||
case NDT_FIRELIKE:
|
||||
{
|
||||
TileSpec tile = getNodeTileN(n, p, 0, data);
|
||||
|
@ -897,6 +897,7 @@ void CNodeDefManager::updateTextures(IGameDef *gamedef,
|
||||
material_type = TILE_MATERIAL_WAVING_LEAVES;
|
||||
break;
|
||||
case NDT_PLANTLIKE:
|
||||
case NDT_CROPLIKE:
|
||||
f->solidness = 0;
|
||||
f->backface_culling = false;
|
||||
if (f->waving == 1)
|
||||
|
@ -165,6 +165,7 @@ enum NodeDrawType
|
||||
NDT_GLASSLIKE_FRAMED_OPTIONAL, // enabled -> connected, disabled -> Glass-like
|
||||
// uses 2 textures, one for frames, second for faces
|
||||
NDT_MESH, // Uses static meshes
|
||||
NDT_CROPLIKE,
|
||||
};
|
||||
|
||||
#define CF_SPECIAL_COUNT 6
|
||||
|
@ -49,6 +49,7 @@ struct EnumString ScriptApiNode::es_DrawType[] =
|
||||
{NDT_RAILLIKE, "raillike"},
|
||||
{NDT_NODEBOX, "nodebox"},
|
||||
{NDT_MESH, "mesh"},
|
||||
{NDT_CROPLIKE, "croplike"},
|
||||
{0, NULL},
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user