Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)
ulla wrote:ulla wrote:... now i need a little help for add simple function sit or lay on_rightclick ,
but I found nothing on internet,
some help?
ulla wrote:ulla wrote:Hi all and thanks advance , i make my new mod named summer i have put :
big umrella open and closed ,deckshair, lobster, big ballon ,air mattress etc...
now i need a little help for add simple function sit or lay on_rightclick ,
but but I found nothing on internet,
i have see beds but can only sleep, and boat are mixed with driver function , i have registered a node and i want the player can lay on the node with right click pls Help
sorry for my bad english
some help?
--state=true: lay, state=false: stand up
local function lay_down(player, pos, state)
local name = player:get_player_name()
if not player or not name then
return
end
-- stand up
if state ~= nil and not state then
-- physics, eye_offset, etc
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
player:set_look_yaw(math.random(1, 180) / 100)
default.player_attached[name] = false
player:set_physics_override(1, 1, 1)
default.player_set_animation(player, "stand" , 30)
-- lay down
else
player:set_eye_offset({x = 0, y = -13, z = 0}, {x = 0, y = 0, z = 0})
local yaw, param2 = get_look_yaw(bed_pos)
player:set_look_yaw(yaw) <you still need to implement that function that tells you in which direction the player should look when laying>
local dir = minetest.facedir_to_dir(param2)
local p = <position where the lay-thing is>
player:set_physics_override(0, 0, 0)
player:setpos(p)
default.player_attached[name] = true
default.player_set_animation(player, "lay" , 0) --that does the trick with laying the player down
end
end
pithy wrote:ManElevation wrote:how do you make a mod topic
You can only post in the WIP mods section.
Icalasari wrote:Is it possible to have a node that consists of two blocks each referencing their own textures? e.g. a jar that is x1=-4,y1=-8,z1=-4,x2=4,y2=2,z2=4 and is like the drawtype glasslike, with an inside that is x1=-3,y1=-7,z1=-3,x2=3,y2=1,z2=3 and is like the drawtype liquid (using NodeBoxEditor hence the 16x16x16 coords)? Or would the inherent nature of NodeBox make it not work?
ulla wrote:ulla wrote:Hi all and thanks advance , i make my new mod named summer i have put :
big umrella open and closed ,deckshair, lobster, big ballon ,air mattress etc...
now i need a little help for add simple function sit or lay on_rightclick ,
but but I found nothing on internet,
i have see beds but can only sleep, and boat are mixed with driver function , i have registered a node and i want the player can lay on the node with right click pls Help
sorry for my bad english
some help?
on_right_click = function(clicker)
if sitter then
sitter:set_animation(stand)
else
sitter = clicker
sitter:set_animation(sit)
end
end
TY but how i use whit on_rightclick?orwell wrote:ulla wrote:ulla wrote:Hi all and thanks advance , i make my new mod named summer i have put :
big umrella open and closed ,deckshair, lobster, big ballon ,air mattress etc...
now i need a little help for add simple function sit or lay on_rightclick ,
but but I found nothing on internet,
i have see beds but can only sleep, and boat are mixed with driver function , i have registered a node and i want the player can lay on the node with right click pls Help
sorry for my bad english
some help?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
--state=true: lay, state=false: stand up
local function lay_down(player, pos, state)
local name = player:get_player_name()
if not player or not name then
return
end
-- stand up
if state ~= nil and not state then
-- physics, eye_offset, etc
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
player:set_look_yaw(math.random(1, 180) / 100)
default.player_attached[name] = false
player:set_physics_override(1, 1, 1)
default.player_set_animation(player, "stand" , 30)
-- lay down
else
player:set_eye_offset({x = 0, y = -13, z = 0}, {x = 0, y = 0, z = 0})
local yaw, param2 = get_look_yaw(bed_pos)
player:set_look_yaw(yaw) <you still need to implement that function that tells you in which direction the player should look when laying>
local dir = minetest.facedir_to_dir(param2)
local p = <position where the lay-thing is>
player:set_physics_override(0, 0, 0)
player:setpos(p)
default.player_attached[name] = true
default.player_set_animation(player, "lay" , 0) --that does the trick with laying the player down
end
end
These are the relevant lines from beds mod. You need to add some stuff yourself.
Nyarg wrote:ulla wrote:ulla wrote:... now i need a little help for add simple function sit or lay on_rightclick ,
but I found nothing on internet,
some help?
Find like here may be useful )
+ Spoiler
ulla wrote:ulla wrote:Hi all and thanks advance , i make my new mod named summer i have put :
big umrella open and closed ,deckshair, lobster, big ballon ,air mattress etc...
now i need a little help for add simple function sit or lay on_rightclick ,
but but I found nothing on internet,
i have see beds but can only sleep, and boat are mixed with driver function , i have registered a node and i want the player can lay on the node with right click pls Help
sorry for my bad english
some help?
minetest.register_node("mindeca_bugs:firefly_jar", {
description = "Firefly in a Jar",
light_source = 5,
tiles = {
{
name = {"mindeca_firefly_top.png",
"mindeca_firefly_bottom.png",
"mindeca_firefly_side_animated.png",
"mindeca_firefly_side_animated.png",
"mindeca_firefly_side_animated.png",
"mindeca_firefly_side_animated.png"},
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
drawtype = "nodebox",
paramtype = "light",
sunlight_propogates = true,
groups = {dig_immediate = 3, falling_node = 1},
node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.1875, 0.1875, 0.4375, 0.1875}, -- Central
{-0.25, -0.4375, -0.25, 0.25, 0.0625, 0.25}, -- Middle
{-0.3125, -0.375, -0.3125, 0.3125, -0.0625, 0.3125}, -- Edge
{-0.25, 0.25, -0.25, 0.25, 0.375, 0.25}, -- Cork
}
},
selection_box = {
type = "fixed",
fixed = {-0.3125, -0.5, -0.3125, 0.3125, 0.4375, 0.3125},
}
})
minetest.register_node("mindeca_bugs:firefly_jar", {
description = "Firefly in a Jar",
light_source = 5,
tiles = {
"mindeca_firefly_top.png",
"mindeca_firefly_bottom.png",
{
name = "mindeca_firefly_side_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
drawtype = "nodebox",
paramtype = "light",
sunlight_propogates = true,
groups = {dig_immediate = 3, falling_node = 1},
node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.1875, 0.1875, 0.4375, 0.1875}, -- Central
{-0.25, -0.4375, -0.25, 0.25, 0.0625, 0.25}, -- Middle
{-0.3125, -0.375, -0.3125, 0.3125, -0.0625, 0.3125}, -- Edge
{-0.25, 0.25, -0.25, 0.25, 0.375, 0.25}, -- Cork
}
},
selection_box = {
type = "fixed",
fixed = {-0.3125, -0.5, -0.3125, 0.3125, 0.4375, 0.3125},
}
})
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)
BirgitLachner wrote:I have two questions:
1.) Where do I get all the name of the default object from? Where do I have to look?
2.) Any hint how to use an object like a bucket? I only found a group for a filled bucket.
--matblox tools
-- should clear out nodes without crashing
-- no guarantee
-- use as you see fit.
minetest.register_tool("matblox:air_rod", {
description = "Air Rosin",
inventory_image = "matblox_air_rod.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.under then -- check if it is a node/exists (needed)
-- keep this low, the bigger the # the longer the loop
local final = 3 -- size of area to delete (+-3 in all directions)
local target = minetest.get_node(pointed_thing.under) -- target node to delete
local pos = pointed_thing.under -- position of pointed node, centralizes the love
-- triple direction pos/neg loop
for a=-final,final,1 do
for b=-final,final,1 do
for c=-final,final,1 do
-- target node to delete
local newnode = minetest.get_node({x = pos.x+a, y = pos.y+b, z = pos.z+c})
-- I only want this to delete target nodes
if target.name == newnode.name then
-- swaps the node with air
minetest.remove_node({x = pos.x+a, y = pos.y+b, z = pos.z+c})
end
end
end
end
end
end-- so many ends, the plot thickens.
})
Havocado wrote:Is there a way to make an item that drops itself when broken by hand, but drops a different item when broken with the proper tool?
on_dig = function(pos, node, digger)
print(digger)
print(digger.get_wielded_item(digger).name)
end
PlanetKiller wrote:Since I got help here with my air rosin, I thought I'd post the finished code for everyone; as a thanks.
I've tested that it works, just need an image and a mod folder. It clears out nodes nicely, great for deleting forests.
Havocado wrote:Is there a way to make an item that drops itself when broken by hand, but drops a different item when broken with the proper tool?
AnxiousInfusion wrote:How do you register a tool (sword) and give it an on_use function without overriding it's original function as a sword?
AnxiousInfusion wrote:Thanks, even though that is sad news. I got 90% of the way through making a sword with dynamic sound effects only to get snagged on the on_use override. Maybe I can have it set_hp() if pointed_thing is an object ... object.is_player() ... ?
I really wish the engine had some sort of register-damage function.
AnxiousInfusion wrote:How do you register a tool (sword) and give it an on_use function without overriding it's original function as a sword?
taikedz wrote:AnxiousInfusion wrote:How do you register a tool (sword) and give it an on_use function without overriding it's original function as a sword?
I've been trying to do this too; unfortunately it does not look possible.
What are you trying to achieve, maybe we can look into that?
Users browsing this forum: No registered users and 8 guests