Find like here may be useful )ulla wrote:some help?ulla wrote:... now i need a little help for add simple function sit or lay on_rightclick ,
but I found nothing on internet,
Post your modding questions here
Re: Post your modding questions here
I am a noob. still yet. Not so noob ) [vml] WIP and a little proof for fun PlantedTorch )))
MT Strike 78a36b468554d101e0be3b0d1f587a555f396452 Great! Somebody have found it )
"My english isn't well" I know. I'm sorry )
MT Strike 78a36b468554d101e0be3b0d1f587a555f396452 Great! Somebody have found it )
"My english isn't well" I know. I'm sorry )
- orwell
- Member
- Posts: 958
- Joined: Wed Jun 24, 2015 18:45
- GitHub: orwell96
- IRC: orwell96_mt
- In-game: orwell
- Location: Raxacoricofallapatorius
Re: Post your modding questions here
ulla wrote:some help?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
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
- orwell
- Member
- Posts: 958
- Joined: Wed Jun 24, 2015 18:45
- GitHub: orwell96
- IRC: orwell96_mt
- In-game: orwell
- Location: Raxacoricofallapatorius
Re: Post your modding questions here
read that post:pithy wrote:You can only post in the WIP mods section.ManElevation wrote:how do you make a mod topic
viewtopic.php?f=11&t=1271
Re: Post your modding questions here
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?
- kaeza
- Moderator
- Posts: 2162
- Joined: Thu Oct 18, 2012 05:00
- GitHub: kaeza
- IRC: kaeza diemartin blaaaaargh
- In-game: kaeza
- Location: Montevideo, Uruguay
- Contact:
Re: Post your modding questions here
If you want that kind of "complex" shape, you will need to create a model for it using e.g. Blender, and use the "mesh" drawtype.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?
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!
Check out my stuff! | Donations greatly appreciated! PayPal
Check out my stuff! | Donations greatly appreciated! PayPal
- Desour
- Member
- Posts: 1473
- Joined: Thu Jun 19, 2014 19:49
- GitHub: Desour
- IRC: Desour
- In-game: DS
- Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
Re: Post your modding questions here
you could make something likeulla wrote:some help?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
Code: Select all
on_right_click = function(clicker)
if sitter then
sitter:set_animation(stand)
else
sitter = clicker
sitter:set_animation(sit)
end
end
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)
- ulla
- Member
- Posts: 143
- Joined: Wed Feb 04, 2015 09:22
- GitHub: IIIullaIII
- IRC: ulla
- In-game: ulla
Re: Post your modding questions here
TY but how i use whit on_rightclick?orwell wrote:ulla wrote:some help?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 englishThese are the relevant lines from beds mod. You need to add some stuff yourself.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
X4cna2d4UqsiawIzUumDgPoYNx3JLGII
- ulla
- Member
- Posts: 143
- Joined: Wed Feb 04, 2015 09:22
- GitHub: IIIullaIII
- IRC: ulla
- In-game: ulla
Re: Post your modding questions here
TYNyarg wrote:Find like here may be useful )ulla wrote:some help?ulla wrote:... now i need a little help for add simple function sit or lay on_rightclick ,
but I found nothing on internet,Spoiler
on_rightclick is used only in entity? i have a node ,need register entity?
X4cna2d4UqsiawIzUumDgPoYNx3JLGII
Re: Post your modding questions here
Sokomine's Cottages mod, viewtopic.php?id=5120, has a bench and a couple of beds that allow sitting or laying on right click.ulla wrote:some help?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
Re: Post your modding questions here
Well I'm starting to get the hang of things (decided to leave meshwork for later and go a different style route for the node), but I hit a snag
Can nodeboxes have animated textures? Because I tried, with this being the intended result
Instead I got this jar of nope (which I am definitely going to recreate - Planning on two focuses that would split into mod packs, one being a magic and potions mod pack)
Trying to figure out where I went horribly, horribly wrong. Can somebody look at it and see where things are glitching out, please?
Can nodeboxes have animated textures? Because I tried, with this being the intended result
Instead I got this jar of nope (which I am definitely going to recreate - Planning on two focuses that would split into mod packs, one being a magic and potions mod pack)
Trying to figure out where I went horribly, horribly wrong. Can somebody look at it and see where things are glitching out, please?
Code: Select all
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},
}
})
- Desour
- Member
- Posts: 1473
- Joined: Thu Jun 19, 2014 19:49
- GitHub: Desour
- IRC: Desour
- In-game: DS
- Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
Re: Post your modding questions here
@Icalasari:
you have to do it like this:
ps: nice texture!
you have to do it like this:
Code: Select all
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},
}
})
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)
Re: Post your modding questions here
@DS-mintest
Thanks - Still wondering how it screwed up the texture to that degree. Glad to also find out I can cut repeating that three additional times for the same texture
And also thanks on the compliment - I used to do a lot of sprite art, and got a lot of practice when I did the Harvestmooncraft texture pack. Trying a cel shaded style to go with these mods I'm making
Thanks - Still wondering how it screwed up the texture to that degree. Glad to also find out I can cut repeating that three additional times for the same texture
And also thanks on the compliment - I used to do a lot of sprite art, and got a lot of practice when I did the Harvestmooncraft texture pack. Trying a cel shaded style to go with these mods I'm making
Re: Post your modding questions here
Is there a way to include more information in the tooltip? Looking it up seems to point to no, but I could be missing something
- AccidentallyRhine
- Member
- Posts: 252
- Joined: Sun Aug 02, 2015 05:43
Re: Post your modding questions here
How do you register a tool (sword) and give it an on_use function without overriding it's original function as a sword?
- D00Med
- Member
- Posts: 949
- Joined: Sat Feb 07, 2015 22:49
- GitHub: D00Med
- Location: Australia...somewhere
Re: Post your modding questions here
^I'm interested to learn that too
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242
My subgame: viewtopic.php?f=15&t=14051#p207242
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: Post your modding questions here
look at farming mod: the hoe does same.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
- BirgitLachner
- Member
- Posts: 393
- Joined: Thu May 05, 2016 10:18
- In-game: Bibs
Re: Post your modding questions here
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.
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.
Re: Post your modding questions here
1. default object?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.
2. take a look at https://github.com/minetest/minetest_ga ... t/init.lua
My mods: Mute, Extra TNT blast effectsnyancats_plus and More charcommands
Example CSM mods:Chatlog and Formspec editor
Example CSM mods:Chatlog and Formspec editor
- BirgitLachner
- Member
- Posts: 393
- Joined: Thu May 05, 2016 10:18
- In-game: Bibs
Re: Post your modding questions here
Ah, yes ... a "s" is missing. I mean default-objects, like stone, sand ...
-
- Member
- Posts: 14
- Joined: Mon Nov 23, 2015 22:50
Re: Post your modding questions here
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. Haven't packaged it into a mod because I'm working on a modpack with scripts for specific things. I'm sure you guys are smart enough to either use it, or learn from it.
Questions:
I have a node that gives copper lumps when right-clicked, unless you are holding copper lumps. What would cause that to happen?
How would I drop an item stack entity that could be picked up?
Code: Select all
--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.
})
Questions:
I have a node that gives copper lumps when right-clicked, unless you are holding copper lumps. What would cause that to happen?
How would I drop an item stack entity that could be picked up?
([noun].. " tried to " ..[verb]..[noun].. " at protected position "..[noun].. " with a bucket")
Re: Post your modding questions here
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?
-
- Member
- Posts: 14
- Joined: Mon Nov 23, 2015 22:50
Re: Post your modding questions here
use get_wielded_item()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?
if it = a specific item, drop one item
else, drop another.
Not sure how it would exactly work, but that's the best I can find with my skill.
Trying it, but getting errors.
Code: Select all
on_dig = function(pos, node, digger)
print(digger)
print(digger.get_wielded_item(digger).name)
end
Tried using .name and .get_name and several crashy variations.
(the block keeps reloading when I break it, but I'm missing a drop so...)
([noun].. " tried to " ..[verb]..[noun].. " at protected position "..[noun].. " with a bucket")
- taikedz
- Member
- Posts: 698
- Joined: Sun May 15, 2016 11:11
- GitHub: taikedz
- IRC: DuCake
- In-game: DuCake
- Location: Scotland, UK
- Contact:
Re: Post your modding questions here
I know I am late to this.... but I think you might have just wanted one of the default minetest functions 'minetest.get_nodes_in_area": http://dev.minetest.net/minetest.find_nodes_in_areaPlanetKiller 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.
I actually made a similar tool which I use for clearing large swathes... and it's very useful for putting out fires that have spread over a forest area for a while....
https://github.com/taikedz/vivarium/blob/master/staffmagic/init.lua#L335-L351
- everamzah
- Member
- Posts: 490
- Joined: Thu Jan 29, 2015 00:47
- GitHub: everamzah
- IRC: everamzah
- In-game: everamzah
Re: Post your modding questions here
minetest.handle_node_dropsHavocado 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?
If the node is what you want, parse the drops and give to player appropriate item per currently wielded item? (get_wielded_item)
- everamzah
- Member
- Posts: 490
- Joined: Thu Jan 29, 2015 00:47
- GitHub: everamzah
- IRC: everamzah
- In-game: everamzah
Re: Post your modding questions here
If I remember correctly, this is not possible. I only say that because I tried it myself first, before giving up and using minetest.register_on_dignode instead. In my mind, I would think it possible, but cannot imagine how.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?
Edit: I think I meant minetest.register_on_punchnode!
Edit2: I assume only defining on_use would be a problem, and that on_secondary_use, or on_rightclick can be used instead, if that would suit your needs.
Who is online
Users browsing this forum: No registered users and 7 guests