Added terrible support for transferring objects
parent
efc626fb84
commit
ff79fe8779
|
@ -1226,9 +1226,33 @@ minetest.register_node("default:chest_locked", {
|
|||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_entity("default:furnace", {
|
||||
minetest.register_entity("default:cone_mob_entity", {
|
||||
description = "The Evil Cone",
|
||||
textures = {"default_chest_top.png"},
|
||||
visual = "file",
|
||||
meshfile = "cone.obj",
|
||||
--meshfile = "/home/lkjoel/untitled.obj",
|
||||
physical = "true",
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("default:cone_mob", {
|
||||
description = "The Evil Cone",
|
||||
tile_images = {"default_chest_top.png"},
|
||||
})
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer)
|
||||
if newnode.name == "default:cone_mob" then
|
||||
minetest.env:remove_node(pos)
|
||||
nodeupdate(pos)
|
||||
minetest.env:add_entity(pos, "default:cone_mob_entity")
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_node("default:furnace", {
|
||||
description = "Furnace",
|
||||
textures = {"default_furnace_side.png", "default_furnace_side.png", "default_furnace_side.png",
|
||||
tile_images = {"default_furnace_side.png", "default_furnace_side.png", "default_furnace_side.png",
|
||||
"default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
metadata_name = "furnace",
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
# Blender v2.63 (sub 2) OBJ File: 'quit.blend'
|
||||
# www.blender.org
|
||||
mtllib untitled.mtl
|
||||
o Cone
|
||||
v -0.028237 0.043555 -1.039088
|
||||
v -0.028237 2.043555 -0.039088
|
||||
v 0.166854 0.043555 -1.019873
|
||||
v 0.354447 0.043555 -0.962967
|
||||
v 0.527333 0.043555 -0.870557
|
||||
v 0.678870 0.043555 -0.746195
|
||||
v 0.803233 0.043555 -0.594658
|
||||
v 0.895643 0.043555 -0.421771
|
||||
v 0.952549 0.043555 -0.234178
|
||||
v 0.971763 0.043555 -0.039088
|
||||
v 0.952549 0.043555 0.156002
|
||||
v 0.895643 0.043555 0.343596
|
||||
v 0.803233 0.043555 0.516482
|
||||
v 0.678870 0.043555 0.668019
|
||||
v 0.527333 0.043555 0.792382
|
||||
v 0.354447 0.043555 0.884792
|
||||
v 0.166853 0.043555 0.941698
|
||||
v -0.028237 0.043555 0.960912
|
||||
v -0.223327 0.043555 0.941697
|
||||
v -0.410921 0.043555 0.884792
|
||||
v -0.583807 0.043555 0.792382
|
||||
v -0.735344 0.043555 0.668019
|
||||
v -0.859707 0.043555 0.516482
|
||||
v -0.952117 0.043555 0.343595
|
||||
v -1.009022 0.043555 0.156002
|
||||
v -1.028237 0.043555 -0.039089
|
||||
v -1.009022 0.043555 -0.234179
|
||||
v -0.952116 0.043555 -0.421772
|
||||
v -0.859706 0.043555 -0.594659
|
||||
v -0.735343 0.043555 -0.746195
|
||||
v -0.583806 0.043555 -0.870558
|
||||
v -0.410919 0.043555 -0.962968
|
||||
v -0.223326 0.043555 -1.019873
|
||||
usemtl
|
||||
s off
|
||||
f 32 2 33
|
||||
f 1 2 3
|
||||
f 2 1 33
|
||||
f 3 2 4
|
||||
f 31 2 32
|
||||
f 30 2 31
|
||||
f 29 2 30
|
||||
f 28 2 29
|
||||
f 27 2 28
|
||||
f 26 2 27
|
||||
f 25 2 26
|
||||
f 24 2 25
|
||||
f 23 2 24
|
||||
f 22 2 23
|
||||
f 21 2 22
|
||||
f 20 2 21
|
||||
f 19 2 20
|
||||
f 18 2 19
|
||||
f 17 2 18
|
||||
f 16 2 17
|
||||
f 15 2 16
|
||||
f 14 2 15
|
||||
f 13 2 14
|
||||
f 12 2 13
|
||||
f 11 2 12
|
||||
f 10 2 11
|
||||
f 9 2 10
|
||||
f 8 2 9
|
||||
f 7 2 8
|
||||
f 6 2 7
|
||||
f 5 2 6
|
||||
f 4 2 5
|
||||
f 1 3 33
|
||||
f 3 32 33
|
||||
f 3 4 32
|
||||
f 4 31 32
|
||||
f 4 5 31
|
||||
f 5 30 31
|
||||
f 5 6 30
|
||||
f 6 29 30
|
||||
f 6 7 29
|
||||
f 7 28 29
|
||||
f 7 8 28
|
||||
f 8 27 28
|
||||
f 8 9 27
|
||||
f 9 26 27
|
||||
f 9 10 26
|
||||
f 10 25 26
|
||||
f 10 11 25
|
||||
f 11 24 25
|
||||
f 11 12 24
|
||||
f 12 23 24
|
||||
f 12 13 23
|
||||
f 13 22 23
|
||||
f 13 14 22
|
||||
f 14 21 22
|
||||
f 14 15 21
|
||||
f 15 20 21
|
||||
f 15 16 20
|
||||
f 16 19 20
|
||||
f 16 17 19
|
||||
f 17 18 19
|
|
@ -851,6 +851,25 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
|
|||
m_sound->loadSoundData(name, data);
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *mesh_ext[] = {
|
||||
".3ds", ".obj", ".md2", ".md3", ".b3d",
|
||||
".ply", ".stl", NULL
|
||||
};
|
||||
name = removeStringEnd(filename, mesh_ext);
|
||||
if(name != "")
|
||||
{
|
||||
verbosestream<<"Client: Attempting to load mesh "
|
||||
<<"file \""<<filename<<"\""<<std::endl;
|
||||
std::string basepath = porting::path_user + DIR_DELIM + "cache" +
|
||||
DIR_DELIM + "media";
|
||||
std::string path = basepath + DIR_DELIM + filename;
|
||||
fs::CreateAllDirs(basepath);
|
||||
std::ofstream of(path.c_str(), std::ios::binary);
|
||||
of.write(data.c_str(), data.size());
|
||||
of.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
errorstream<<"Client: Don't know how to load file \""
|
||||
<<filename<<"\""<<std::endl;
|
||||
|
|
|
@ -1372,13 +1372,14 @@ public:
|
|||
}
|
||||
else if(m_prop.visual == "file")
|
||||
{
|
||||
assert(m_prop.meshfile.c_str() != NULL);
|
||||
scene::IMesh *mesh = createMeshFromFile(m_prop.meshfile, v3f(BS,BS,BS), smgr);
|
||||
m_meshnode = smgr->addMeshSceneNode(mesh, NULL);
|
||||
mesh->drop();
|
||||
|
||||
m_meshnode->setScale(v3f(m_prop.visual_size.X,
|
||||
m_prop.visual_size.Y,
|
||||
m_prop.visual_size.X));
|
||||
m_meshnode->setScale(v3f(m_prop.visual_size.X/2,
|
||||
m_prop.visual_size.Y/2,
|
||||
m_prop.visual_size.X/2));
|
||||
u8 li = m_last_light;
|
||||
setMeshColor(m_meshnode->getMesh(), video::SColor(255,li,li,li));
|
||||
}
|
||||
|
@ -1803,6 +1804,27 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
if(m_prop.visual == "file")
|
||||
{
|
||||
std::string texturestring = "unknown_block.png";
|
||||
if(m_prop.textures.size() > 0)
|
||||
texturestring = m_prop.textures[0];
|
||||
texturestring += mod;
|
||||
AtlasPointer ap = tsrc->getTexture(texturestring);
|
||||
|
||||
// Get the tile texture and atlas transformation
|
||||
video::ITexture* atlas = ap.atlas;
|
||||
v2f pos = ap.pos;
|
||||
v2f size = ap.size;
|
||||
|
||||
// Set material flags and texture
|
||||
video::SMaterial& material = m_meshnode->getMaterial(0);
|
||||
material.setFlag(video::EMF_LIGHTING, false);
|
||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
material.setTexture(0, atlas);
|
||||
material.getTextureMatrix(0).setTextureTranslate(pos.X, pos.Y);
|
||||
material.getTextureMatrix(0).setTextureScale(size.X, size.Y);
|
||||
}
|
||||
}
|
||||
|
||||
void processMessage(const std::string &data)
|
||||
|
|
|
@ -19,11 +19,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
#include "mesh.h"
|
||||
#include "log.h"
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <IAnimatedMesh.h>
|
||||
#include <SAnimatedMesh.h>
|
||||
#include <ICameraSceneNode.h>
|
||||
#include "porting.h"
|
||||
#include "filesys.h"
|
||||
|
||||
// In Irrlicht 1.8 the signature of ITexture::lock was changed from
|
||||
// (bool, u32) to (E_TEXTURE_LOCK_MODE, u32).
|
||||
|
@ -94,7 +95,9 @@ scene::IAnimatedMesh* createCubeMesh(v3f scale)
|
|||
|
||||
scene::IAnimatedMesh* createMeshFromFile(std::string filename, v3f scale, scene::ISceneManager* smgr)
|
||||
{
|
||||
scene::SAnimatedMesh *anim_mesh = new scene::SAnimatedMesh(smgr->getMesh(filename.c_str()));
|
||||
scene::SAnimatedMesh *anim_mesh = new scene::SAnimatedMesh(
|
||||
smgr->getMesh(std::string(porting::path_user + DIR_DELIM + "cache" +
|
||||
DIR_DELIM + "media" + DIR_DELIM + filename).c_str()));
|
||||
scaleMesh(anim_mesh, scale); // also recalculates bounding box
|
||||
return anim_mesh;
|
||||
}
|
||||
|
|
|
@ -4117,7 +4117,8 @@ void Server::fillMediaCache()
|
|||
const char *supported_ext[] = {
|
||||
".png", ".jpg", ".bmp", ".tga",
|
||||
".pcx", ".ppm", ".psd", ".wal", ".rgb",
|
||||
".ogg",
|
||||
".ogg", ".obj", ".3ds", ".md2", ".md3",
|
||||
".b3d", ".ply", ".stl",
|
||||
NULL
|
||||
};
|
||||
if(removeStringEnd(filename, supported_ext) == ""){
|
||||
|
|
Loading…
Reference in New Issue