And here's a video of a player in 3d armor: http://youtu.be/98rZ1P8PdF0
I named this prototype of a mod "capes". Don't ask why, though, 'cause I don't know either ;)
What type of help do I need:
- a piece of code to synchronize the armour mesh with it's "wearer" (maybe get_player_at_pos would do to find which one is wearer);
- an Idea how to take off that armour (I have an idea of wardrobe node, but I don't like the idea of using additional nodes)
Here is how I done what I have:
- Code: Select all
local ar = {
physical = true,
collisionbox = {-0.5,-1,-0.5, 0.5,1,0.6},
visual = "mesh",
mesh = "test2.x",
textures = {"ar.png"},
visual_size = {x=1.3, y=1.1, z = 1.3},
driver = nil,
v = 0,
}
function ar:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
elseif not self.driver then
self.driver = clicker
self.object:set_attach(clicker, "", {x=0,y=0,z=0}, {x=0,y=0,z=0})
self.object:setyaw(clicker:get_look_yaw())
end
end
minetest.register_entity("capes:ar", ar)
minetest.register_craftitem("capes:ar", {
description = "Cape",
inventory_image = "ar.png",
wield_image = "ar.png",
wield_scale = {x=2, y=2, z=1},
liquids_pointable = true,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
minetest.env:add_entity(pointed_thing.above, "capes:ar")
itemstack:take_item()
return itemstack
end,
})
How to "put on" that "armor":
- Press "T"
input "/giveme capes:ar" - place that on the ground using the right click
- right click on the "armor" entity.