Post your modding questions here

User avatar
Krock
Developer
 
Posts: 4469
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: Post your modding questions here

by Krock » Wed Jun 18, 2014 15:22

Kilarin wrote:Lua syntax question.
I want to register a new type of door in a mod. So, I figured I'd just need to make my mod depend on doors and then call doors:register_door
But when I do I get:
Code: Select all
09:43:49: ERROR[main]: /usr/share/minetest/builtin/game/register.lua:60: Name doors:door_secret does not follow naming conventions: "modname:" or ":" prefix required

Which means I'm doing something STUPID. Any help here?

If you want to add a node to a diffrent mod, you need to use:
minetest.register_node(":testmod:testnode",def)


EDIT: Whoops. Saw your 2nd post too late.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

Kilarin
Member
 
Posts: 778
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Wed Jun 18, 2014 17:12

Krock wrote:If you want to add a node to a diffrent mod, you need to use:
minetest.register_node(":testmod:testnode",def)

Useful info anyway!

Ok, next question, hopefully not so stupid.

I'm playing with making secret doors that look like background material. I'm sure someone has already done it, but the only mod I could find made panels you could walk through instead of actual doors that look like stone or wood etc.

As proof of concept, I can make a wooden door that looks like default_wood, or a cobble door that looks like default_cobble. Works.

BUT, what I'd like to do is enable a recipe in the form of:
group:wood,group:wood,
group:wood,group:wood,
group:wood,group:wood,special_item

where the item would use the default texture for whatever kind of wood you used in the recipe. Is that even possible?

If not, then how could I loop through whatever group:wood or group:stone (or any other groups) are available for a particular world, and build a recipe (and corresponding node) for each using the correct texture for the item?
 

User avatar
kaeza
Moderator
 
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
Location: Montevideo, Uruguay
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Wed Jun 18, 2014 17:19

Something like this should do:

Code: Select all
for name, def in pairs(minetest.registered_nodes) do
  if def.groups and ((def.groups.stone or 0) > 0) and def.tiles and def.tiles[1] then
    local basename = name:match("[^:]+:(.*)") -- Base name of item without `modname:' prefix.
    register_my_door(basename, def.tiles[1])
  end
end
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
 

Kilarin
Member
 
Posts: 778
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Wed Jun 18, 2014 17:50

That looks perfect kaeza, thanks!
 

video28
New member
 
Posts: 2
Joined: Wed Jun 18, 2014 17:59
In-game: video28

Re: Post your modding questions here

by video28 » Wed Jun 18, 2014 18:02

I have the android version, will mods work for me
 

Kilarin
Member
 
Posts: 778
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Wed Jun 18, 2014 21:52

So, I've got a two sample "secret doors", one plain wood and one cobble. defined like this:
Code: Select all
doors:register_door("secretdoor:door_secret_wood", {
   description = "Secret Door Wood",
   inventory_image = "door_wood.png",
   groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
   tiles_bottom = {"default_wood.png", "default_wood.png"},
   tiles_top = {"default_wood.png", "default_wood.png"},
})


My problem is shading/lighting:

Image

As you can see, the doors appear slightly darker than their surroundings. Is this because Doors:register_door sets drawtype = "nodebox" ???
 

User avatar
Casimir
Member
 
Posts: 1163
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Post your modding questions here

by Casimir » Wed Jun 18, 2014 21:59

Yes this is because of the drawtype. Smooth lighting is not working for nodeboxes.
 

Kilarin
Member
 
Posts: 778
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Wed Jun 18, 2014 22:16

Casimir wrote:Yes this is because of the drawtype. Smooth lighting is not working for nodeboxes.

So, I am assuming then that there is NOT a solution right now? Changing the drawtype would not let it be thin as a door. Correct?

I mean, I can live with this, but it's not quite what I had been trying for. :)
 

User avatar
spootonium
Member
 
Posts: 94
Joined: Fri May 02, 2014 01:38
Location: Down the mine.

Re: Post your modding questions here

by spootonium » Fri Jun 20, 2014 06:21

The Project: Attempting to implement a "co-operative hardcore mode", in which the death of all players triggers the deletion and re-generation of the map.
The Problem: In order to delete the map files (without causing errors and additional problems) the server will need to cease reading and writing actions and "close" those files, preferably without needing to shut down itself.
The Question: Is there a way, within the Lua API, to force-close the map, without shutting down the server?

EDIT - Bonus Question: Alternatively, is there a simple way to purge the map data?
I write code. Sometimes, it even works.
 

User avatar
Casimir
Member
 
Posts: 1163
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Post your modding questions here

by Casimir » Fri Jun 20, 2014 09:08

I don't know about deleting, but there are some alternatives:
* Random respawn anywhere on the map. When you respawn 30000 nodes away from your first spawn, you probably won't find your old world again.
* ABM to replace air with some other node, containing an check if the player died. That way the player would be stuck where he respawns.
* Use a protector mod to protect the whole world. You can still look at what you have build and save it with worldedit, but the game is over. I like this way the best. Together with some details it would also feel very smooth. Like, respawn exactly where you died, changing the skin to ghost (like BlockMens creature mod), grant fly and fast, and so on.
 

video28
New member
 
Posts: 2
Joined: Wed Jun 18, 2014 17:59
In-game: video28

Re: Post your modding questions here

by video28 » Fri Jun 20, 2014 17:07

I have the android version: how do I use mods
 

User avatar
spootonium
Member
 
Posts: 94
Joined: Fri May 02, 2014 01:38
Location: Down the mine.

Re: Post your modding questions here

by spootonium » Sat Jun 21, 2014 13:48

Casimir wrote:I don't know about deleting, but there are some alternatives:
* Random respawn anywhere on the map. When you respawn 30000 nodes away from your first spawn, you probably won't find your old world again.
* ABM to replace air with some other node, containing an check if the player died. That way the player would be stuck where he respawns.
* Use a protector mod to protect the whole world. You can still look at what you have build and save it with worldedit, but the game is over. I like this way the best. Together with some details it would also feel very smooth. Like, respawn exactly where you died, changing the skin to ghost (like BlockMens creature mod), grant fly and fast, and so on.


Hmm. None of those options really satisfy the purpose of what I want to accomplish. If actually deleting the map isn't possible without killing the server altogether, I suspect the best thing to do would be to purge map.db, and force a new mapgen with a new seed. Sadly, I don't know nearly enough about MySQL to do that safely.
I write code. Sometimes, it even works.
 

User avatar
DeepGaze
Member
 
Posts: 332
Joined: Fri May 10, 2013 00:49
Location: Take your best guess
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze

Re: Post your modding questions here

by DeepGaze » Mon Jun 23, 2014 18:33

is there a tutorial on map gen- wanting to populate a world with a single node (air above the nodes though)
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards
 

User avatar
Casimir
Member
 
Posts: 1163
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Post your modding questions here

by Casimir » Mon Jun 23, 2014 18:35

Only one node and everything flat? Than this might be what you want: https://github.com/CasimirKaPazi/untern ... r/init.lua
Last edited by Casimir on Mon Jun 23, 2014 18:53, edited 2 times in total.
 

User avatar
DeepGaze
Member
 
Posts: 332
Joined: Fri May 10, 2013 00:49
Location: Take your best guess
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze

Re: Post your modding questions here

by DeepGaze » Mon Jun 23, 2014 18:41

Thank you Casmir one more question: How can you fix the sky to night but keep the map lit, I have seen it on a server but can't remember witch?
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards
 

User avatar
pandaro
Member
 
Posts: 320
Joined: Sun Jan 08, 2012 21:34
Location: behind
GitHub: pandaro

Re: Post your modding questions here

by pandaro » Tue Jun 24, 2014 11:29

someone here has already used minetest.find_path ()?
are not able to make it work.
I post something, tell me if I'm wrong thanks!
Code: Select all
ant.find_food=function(pos)
   local food=minetest.find_node_near(pos, 10, "default:apple")
   if food==nil then
      print(tostring("no"))
      
   else
      print(tostring("yes"))
      if dist>1 then
         local path=minetest.find_path(pos,food,2,1,1,"A*_noprefetch")
         print(tostring("path ")..dump(path))
      else
         minetest.remove_node(food)
      end
   end
   return food
end
 

Daven
Member
 
Posts: 26
Joined: Mon Jan 20, 2014 21:51
Location: Inside the white whale

Re: Post your modding questions here

by Daven » Wed Jun 25, 2014 01:57

Can someone post a link to the inventory_plus mod?
 

User avatar
kaeza
Moderator
 
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
Location: Montevideo, Uruguay
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Wed Jun 25, 2014 02:28

Daven wrote:Can someone post a link to the inventory_plus mod?

Have you tried using a web search engine?
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
 

drkwv
Member
 
Posts: 87
Joined: Thu Jun 28, 2012 13:48
GitHub: aa6

Re: Post your modding questions here

by drkwv » Wed Jun 25, 2014 02:50

RHR wrote:You do not need an own group for that:

1. is diggable by bare hands
oddly_breakable_by_hand = 3

2. but sounds like a stone upon digging (like a stone that is being digged by axe)
has nothing to do with tool, just use the stone sound:
sounds = default.node_sound_stone_defaults()

3. and has some custom crack pattern (if that possible)
change the crack_anylength.png texture to your custom crack pattern.

Code: Select all
minetest.register_node("YourModName:YourBlockName", {
   tiles = {"YourTexture.png"},
   groups = {oddly_breakable_by_hand = 3}, -- or: groups = {oddly_breakable_by_hand = 3, choppy = 3},
   sounds = default.node_sound_stone_defaults(),
})


Please post your future modding questions here:
viewtopic.php?f=9&t=4668&p=146064#p146064


Thank you for the answer.
1. I set groups = {oddly_breakable_by_hand = 3} for node and now it's breaking with more situable sound, but I must admit that digging sound is not still the same as for groups = { cracky = 1, stone = 1 }. Any other thing I could do to fix the sound?
2. I changed crack_anylength.png, put it in my mods/mod/textures folder and cracking texture has changed for all blocks, not only from my mod. Is there a way to define custom cracking pattern only for a particular node?
 

User avatar
Topywo
Member
 
Posts: 1721
Joined: Fri May 18, 2012 20:27

Re: Post your modding questions here

by Topywo » Wed Jun 25, 2014 12:35

Daven wrote:Can someone post a link to the inventory_plus mod?


viewtopic.php?f=11&t=3100
 

drkwv
Member
 
Posts: 87
Joined: Thu Jun 28, 2012 13:48
GitHub: aa6

Re: Post your modding questions here

by drkwv » Wed Jun 25, 2014 15:27

Do minetest.get_node_light(pos) working? I'm getting 0 all the time.
 

User avatar
BlockMen
Developer
 
Posts: 768
Joined: Fri Mar 01, 2013 17:24
Location: Germany
GitHub: BlockMen

Re: Post your modding questions here

by BlockMen » Wed Jun 25, 2014 17:02

drkwv wrote:Do minetest.get_node_light(pos) working? I'm getting 0 all the time.


Yes, it works. I guess you are using a wrong pos. Imagine that the function returns the light value "inside" of the node at given position. So if you want to get the light value ontop your node you need to get the light value above.
Example:
Image

If you want get the light value ontop of this dirt block you need to add
Code: Select all
pos.y = pos.y+1
to your code to get the correct value
 

User avatar
pandaro
Member
 
Posts: 320
Joined: Sun Jan 08, 2012 21:34
Location: behind
GitHub: pandaro

Re: Post your modding questions here

by pandaro » Wed Jun 25, 2014 21:09

Someone here can, at least, ensure me that minetest.find_path() work properly?
I begin to suspect a bug. In which case I will report it on github.
But if someone tells me, at least, that he work, then I'm wrong!
thanks
 

User avatar
BrunoMine
Member
 
Posts: 1070
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

Comand for suicide

by BrunoMine » Thu Jun 26, 2014 15:58

there is a command for suicide? Can you show me?
 

User avatar
Krock
Developer
 
Posts: 4469
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: Comand for suicide

by Krock » Thu Jun 26, 2014 16:08

brunob.santos wrote:there is a command for suicide? Can you show me?

Code: Select all
minetest.register_chatcommand("killme", {
   description = "Kills you",
   func = function(name, param)
      local player = minetest.get_player_by_name(name)
      player:set_hp(0)
   end
})
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 2 guests