pithy wrote:What in the world are "special_tiles" in the node def?
on_punch = function(pos, node, puncher)
local name = puncher:get_player_name()
local inv = meta:get_inventory()
if inv:is_empty("src") then
minetest.chat_send_player(name,"It is empty!")
return true
elseif not inv:is_empty("dst") then
minetest.chat_send_player(name,"It is full!")
return true
end
return true
end
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",formspec)
meta:set_string("infotext", "It!")
local inv = meta:get_inventory()
inv:set_size("src", 9)
inv:set_size("dst", 9)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") then
return false
elseif not inv:is_empty("dst") then
return false
end
return true
end,
})
KCoombes wrote:pithy wrote:What in the world are "special_tiles" in the node def?
http://dev.minetest.net/minetest.register_node
special_tiles — Specifies certain textures used in things like texture animations. (like flowing liquids)
everamzah wrote:minetest.env is deprecated --changed to minetest.
on_construct is not where to do node metadata manipulation, only to initialize. Use on_place or after_place_node instead.
rubenwardy wrote:After exporting an obj from NBE, you should take it to a UV wrapping program such as Blender. If you don't need to UV wrap it, just export it as a node box
TumeniNodes wrote:rubenwardy wrote:After exporting an obj from NBE, you should take it to a UV wrapping program such as Blender. If you don't need to UV wrap it, just export it as a node box
I just created a 3x5 node..., ummm,node using NBE, and it works just fine without even using the .obj models anywhere... just the dimensions which NBE produced.
The only issue I am having at the moment, is figuring out why I fall through it when I walk over it... yet I cannot pass through it if it is placed upright, or from the sides either upright or laying down?
Other than that issue, everything else works fine, just a simple 16x16px texture repeats on it well.
I wonder if I add the .obj models if that will solve my falling through problem when walking over the large node?
TumeniNodes wrote:rubenwardy wrote:After exporting an obj from NBE, you should take it to a UV wrapping program such as Blender. If you don't need to UV wrap it, just export it as a node box
I just created a 3x5 node..., ummm,node using NBE, and it works just fine without even using the .obj models anywhere... just the dimensions which NBE produced.
The only issue I am having at the moment, is figuring out why I fall through it when I walk over it... yet I cannot pass through it if it is placed upright, or from the sides either upright or laying down?
Other than that issue, everything else works fine, just a simple 16x16px texture repeats on it well.
I wonder if I add the .obj models if that will solve my falling through problem when walking over the large node?
rubenwardy wrote:By dimension it produced, do you mean the node box export? You don't have to copy the co-ords manually, you could use file > export > standalone lua file
pithy wrote:KCoombes wrote:pithy wrote:What in the world are "special_tiles" in the node def?
http://dev.minetest.net/minetest.register_node
special_tiles — Specifies certain textures used in things like texture animations. (like flowing liquids)
all that link says about special_tiles is "This text needs further expansion"
pithy wrote:A .obj does not have a collision_box.
TumeniNodes wrote:pithy wrote:A .obj does not have a collision_box.
right so... is it possible to then activate the .obj "drawtype = mesh
and then, set the entire object dimensions as "collision_box"
and then set the selection_box dimension in a small convenient location on the object?
Would that work so I can finally walk across this danged thing without falling through it?
ozkur wrote:Topic: Can you build high enough to have your blocks not cast shadows??
Krock wrote:ozkur wrote:Topic: Can you build high enough to have your blocks not cast shadows??
You must teleport yourself about 1000 nodes up or down and build there (try using WorldEdit, it really helps). This distance is to make sure that the mapblocks in between are not generated/loaded so the light can not be updated there.
KCoombes wrote:Iwhat exactly does 'returns the items that were actually removed' mean? Gives the items back?
local stack = "default:stick 3"
-- OR: stack = ItemStack("default:stick 3")
-- Try to remove the items specified in "stack" from the list "main"
local removed_items = inv:remove_item("main", stack)
if removed_items:get_count() < stack:get_count() then
-- Failed to remove all items: Removed only "removed_items:get_count()" of them
end
KCoombes wrote:InvRef question:
remove_item("listname", stack)
take as many items as specified from the list, returns the items that were actually removed (as an ItemStack)
Ok, so this means 'take as many (items = stack) as specified from the (list = listname) - what is the 'as specified' part?
and what exactly does 'returns the items that were actually removed' mean? Gives the items back? Seems counter to the process of removing the item in the first place!
if inv:is_empty("src") then
minetest.chat_send_player(name,"It is empty!")
elseif not inv:is_empty("dst") then
minetest.chat_send_player(name,"It is full!")
end
for _, v in pairs(inv:get_list("src")) do
print(v)
end
local def = {
name = "grenade:explosion",
description = "Grenade Explosion (you hacker you!)",
radius = 3,
tiles = {
side = "default_dirt.png",
top = "default_dirt.png",
bottom = "default_dirt.png",
burning = "default_dirt.png"
},
}
tnt.register_tnt(def)
minetest.register_craftitem("grenade:grenade", {
description = "Grenade",
inventory_image = "default_coal_lump.png",
on_use = function(itemstack, user, pointed_thing)
local v = user:get_look_dir()
local pos = user:getpos()
pos.y = pos.y + 1.2
local obj = minetest.add_entity(pos, "grenade:grenade")
obj:setvelocity({x = v.x * 4, y = v.y * 2 + 4, z = v.z * 4})
obj:setacceleration({x = v.x / 4, y = v.y / 2 - 4, z = v.z / 4})
itemstack:take_item()
return itemstack
end,
})
minetest.register_entity("grenade:grenade", {
physical = true,
collide_with_objects = true,
weight = 5,
textures = {"default_coal_lump.png"},
on_activate = function(self, staticdata)
self.timer = 0
end,
on_step = function(self, dtime)
local acc = self.object:getacceleration()
self.object:setacceleration({x = acc.x * 2 / 4, y = acc.y, z = acc.z * 2 / 4})
self.timer = self.timer + dtime
if self.timer > 4 then
tnt.boom(self.object:getpos(), def)
end
end,
})
everamzah wrote:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
for _, v in pairs(inv:get_list("src")) do
print(v)
end
That might not actually work, I'm terrible with for loops.
Myself, I'm trying to throw a ball. I'm cheating a bit because I haven't looked anything up yet, but if anyone wants to clue me in on how to adjust velocity/acceleration to mimic a small heavy object, please do!Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local def = {
name = "grenade:explosion",
description = "Grenade Explosion (you hacker you!)",
radius = 3,
tiles = {
side = "default_dirt.png",
top = "default_dirt.png",
bottom = "default_dirt.png",
burning = "default_dirt.png"
},
}
tnt.register_tnt(def)
minetest.register_craftitem("grenade:grenade", {
description = "Grenade",
inventory_image = "default_coal_lump.png",
on_use = function(itemstack, user, pointed_thing)
local v = user:get_look_dir()
local pos = user:getpos()
pos.y = pos.y + 1.2
local obj = minetest.add_entity(pos, "grenade:grenade")
obj:setvelocity({x = v.x * 4, y = v.y * 2 + 4, z = v.z * 4})
obj:setacceleration({x = v.x / 4, y = v.y / 2 - 4, z = v.z / 4})
itemstack:take_item()
return itemstack
end,
})
minetest.register_entity("grenade:grenade", {
physical = true,
collide_with_objects = true,
weight = 5,
textures = {"default_coal_lump.png"},
on_activate = function(self, staticdata)
self.timer = 0
end,
on_step = function(self, dtime)
local acc = self.object:getacceleration()
self.object:setacceleration({x = acc.x * 2 / 4, y = acc.y, z = acc.z * 2 / 4})
self.timer = self.timer + dtime
if self.timer > 4 then
tnt.boom(self.object:getpos(), def)
end
end,
})
https://github.com/everamzah/grenade
Users browsing this forum: No registered users and 71 guests