Post your modding questions here

CWz
Member
 
Posts: 185
Joined: Tue Dec 24, 2013 17:01

Re: Post your modding questions here

by CWz » Fri Jul 03, 2015 07:42

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
minetest.register_chatcommand("send_spawn", {
   params = "",
   description = "Send interactless players back to spawn.",
   privs = {basic_privs=true},
   func = function(name)
      for _,player in ipairs(minetest.get_connected_players()) do
         local player = player:get_player_name()
         local pos = minetest.setting_get_pos("static_spawnpoint")
         if not minetest.get_player_privs(player).interact then
            player:setpos(pos)
            minetest.chat_send_player(player,"Please read the rules.")
            return
         end
      end
      minetest.log("action", "player " .. name .. " Used the send_spawn command.")
   end,
})


error wrote:2015-07-03 10:39:05: ERROR[main]: UNRECOVERABLE error occurred. Stopping server. Please fix the following error:
2015-07-03 10:39:05: ERROR[main]: ...ocuments/minetest/bin/../mods/keyword_interact2/init.lua:67: attempt to call method 'setpos' (a nil value)
2015-07-03 10:39:05: ERROR[main]: stack traceback:
2015-07-03 10:39:05: ERROR[main]: ...ocuments/minetest/bin/../mods/keyword_interact2/init.lua:67: in function 'func'
2015-07-03 10:39:05: ERROR[main]: .../Documents/minetest/bin/../builtin/game/chatcommands.lua:40: in function <.../Documents/minetest/bin/../builtin/game/chatcommands.lua:29>
2015-07-03 10:39:05: ERROR[main]: ...ormz/Documents/minetest/bin/../builtin/game/register.lua:341: in function <...ormz/Documents/minetest/bin/../builtin/game/register.lua:329>


I am kind of confused to what is wrong with code
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Post your modding questions here

by rubenwardy » Fri Jul 03, 2015 07:47

As the error message says, the function setpos does not exist. Are you sure it's not set_pos
?

Edit: you overwrite the player variable the player's name, and then try to access the player object again. Change local player to local name, and the player in get player price to name.
 

matyilona
New member
 
Posts: 4
Joined: Thu Jun 25, 2015 16:07

Re: Post your modding questions here

by matyilona » Sat Jul 04, 2015 17:54

What mod is the simplest/easiest to understand example of inplementing entities? Is there some kind of tutorial on it?
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Sat Jul 04, 2015 20:15

matyilona wrote:What mod is the simplest/easiest to understand example of inplementing entities? Is there some kind of tutorial on it?

maybe that mod which adds an earthball, iceball and lightning sword, the balls are entities l think
the nuke mod also uses entities
 

Uruwi
New member
 
Posts: 7
Joined: Sat Jul 04, 2015 19:26
GitHub: bluebear94
IRC: bb94
In-game: Uruwi

Re: Post your modding questions here

by Uruwi » Sat Jul 04, 2015 21:06

How do I specify that more than one of the same block must be adjacent in an ABM?
I am trying to create a block that detects four meses around it.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Sat Jul 04, 2015 21:25

Uruwi wrote:How do I specify that more than one of the same block must be adjacent in an ABM?
I am trying to create a block that detects four meses around it.

I don't think you can. So specify that it must have at least one neighbor (as usual), and then in the actual ABM function test for your additional condition.
 

Uruwi
New member
 
Posts: 7
Joined: Sat Jul 04, 2015 19:26
GitHub: bluebear94
IRC: bb94
In-game: Uruwi

Re: Post your modding questions here

by Uruwi » Sat Jul 04, 2015 23:08

prestidigitator wrote:
Uruwi wrote:How do I specify that more than one of the same block must be adjacent in an ABM?
I am trying to create a block that detects four meses around it.

I don't think you can. So specify that it must have at least one neighbor (as usual), and then in the actual ABM function test for your additional condition.

Well, thank you.

How do you perform an action to a node only when there is an adjacent update?

Edit: and is there a way to change a node's appearance on the fly?
 

matyilona
New member
 
Posts: 4
Joined: Thu Jun 25, 2015 16:07

Re: Post your modding questions here

by matyilona » Sun Jul 05, 2015 01:53

Hybrid Dog wrote:
matyilona wrote:What mod is the simplest/easiest to understand example of inplementing entities? Is there some kind of tutorial on it?

maybe that mod which adds an earthball, iceball and lightning sword, the balls are entities l think
the nuke mod also uses entities

What is the actual name of the mod? Searching for earthball or lightning sword only gets me back here.
 

DanteLives
Member
 
Posts: 25
Joined: Fri Jul 13, 2012 06:35

Re: Post your modding questions here

by DanteLives » Sun Jul 05, 2015 02:02

Is there a way to test whether a neighbouring node is a member of a particular group? I know how to test the name of the node, but not the groups.
 

Uruwi
New member
 
Posts: 7
Joined: Sat Jul 04, 2015 19:26
GitHub: bluebear94
IRC: bb94
In-game: Uruwi

Re: Post your modding questions here

by Uruwi » Sun Jul 05, 2015 02:09

DanteLives wrote:Is there a way to test whether a neighbouring node is a member of a particular group? I know how to test the name of the node, but not the groups.


minetest.get_item_group(item_name, group_name) returns the group value.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Sun Jul 05, 2015 03:30

Uruwi wrote:How do you perform an action to a node only when there is an adjacent update?

I guess it kind of depends on what you mean by, "an adjacent update." If you mean when anything adjacent changes, it may not be possible (or practical). You might be able to do something limited with minetest.register_on_dignode() and/or minetest.register_on_placenode(), or you might have to use some kind of timer (and possibly metadata to remember previous state?). There may be more tenable options if you only need, for example, to deal with updates of neighboring nodes of the same type or other types your mod provides. That's because you have more control of the callbacks of those adjacent nodes and can use them to wander around to neighbors and see what might need to be done.

Uruwi wrote:and is there a way to change a node's appearance on the fly?

Again, in a limited sense. Node metadata (except for hovertext) doesn't change how a node appears. Other than that, there are three things stored for each voxel: node type "name", "param1", and "param2". Some kinds of nodes use the two parameter values to change how the node looks (e.g. this is how stairs can have different orientations). If the changes in appearance you are going for do not fit into the limited options built into the engine, you may just have to register a different type of node for every possible different "appearance" you want it to have.

Entities are another possible solution/hack. They are a bit more dynamic than nodes, and can potentially be used to enhance nodes' appearance. I believe various mods that provide things like "picture frames" use entities in this way.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Sun Jul 05, 2015 03:38

Uruwi wrote:
DanteLives wrote:Is there a way to test whether a neighbouring node is a member of a particular group? I know how to test the name of the node, but not the groups.


minetest.get_item_group(item_name, group_name) returns the group value.

You can also get the node definition from the "minetest.regietered_nodes" table, keyed by node name. It holds basically the same table given to minetest.register_node(). It might also have some default properties added to it that weren't in the original registration call (can't remember, and probably not wise to depend on either possible behavior anyway).
 

Uruwi
New member
 
Posts: 7
Joined: Sat Jul 04, 2015 19:26
GitHub: bluebear94
IRC: bb94
In-game: Uruwi

Re: Post your modding questions here

by Uruwi » Sun Jul 05, 2015 03:40

prestidigitator wrote:Again, in a limited sense. Node metadata (except for hovertext) doesn't change how a node appears. Other than that, there are three things stored for each voxel: node type "name", "param1", and "param2". Some kinds of nodes use the two parameter values to change how the node looks (e.g. this is how stairs can have different orientations). If the changes in appearance you are going for do not fit into the limited options built into the engine, you may just have to register a different type of node for every possible different "appearance" you want it to have.

Entities are another possible solution/hack. They are a bit more dynamic than nodes, and can potentially be used to enhance nodes' appearance. I believe various mods that provide things like "picture frames" use entities in this way.


The problem is that in some cases there are 256 block states. I'll just have to wait until there's an API for doing what I want.

Edit: and for the block update detection, I'm fine with detecting those from my mod's nodes.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Sun Jul 05, 2015 08:05

matyilona wrote:
Hybrid Dog wrote:
matyilona wrote:What mod is the simplest/easiest to understand example of inplementing entities? Is there some kind of tutorial on it?

maybe that mod which adds an earthball, iceball and lightning sword, the balls are entities l think
the nuke mod also uses entities

What is the actual name of the mod? Searching for earthball or lightning sword only gets me back here.

fireballs viewtopic.php?id=6154
 

User avatar
mrf
Member
 
Posts: 11
Joined: Fri Aug 01, 2014 17:08

Re: Post your modding questions here

by mrf » Fri Jul 10, 2015 02:38

(it's confusing that this subtopic exists in the "Modding Discussion" board with 81 pages of the same thread but I think this is the place I'm supposed to ask this, so...)
I have an airborne object (LuaEntitySAO) that is supposed to look down at the player on the ground, and while I can set the direction correctly across the horizontal plane, there doesn't seem to be any "setpitch" for setting the direction of the entity on the vertical plane. Is there any way currently to achieve this?
(It looks like the issue has been filed on github, https://github.com/minetest/minetest/issues/2251)

(edit: er, by "direction" ... "across the horizontal plane", I mean yaw.)
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Fri Jul 10, 2015 04:52

Indeed, there's no `setpitch` (or `setroll` either). It could be done by creating a 3D model of the object in question and using `LuaEntity:set_bone_position("root bone", ...)` (don't mind the function name; it also does rotations). Note that I didn't test whether this works or not. Of course, the proper solution is to implement `setpitch` and `setroll` properly.
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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
mrf
Member
 
Posts: 11
Joined: Fri Aug 01, 2014 17:08

Re: Post your modding questions here

by mrf » Mon Jul 13, 2015 12:18

Kaeza, thanks for the response. I'll take a look at your suggestions as well as looking at the source to see if I can patch in pitch and roll.
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Post your modding questions here

by Nathan.S » Tue Jul 14, 2015 02:14

Maybe I'm just crazy, and am remembering something from when I played minecraft, but wasn't there a mod for minetest that made food spoil if it wasn't cooked or refrigerated? I've tried searching the forums, and even did a Google search but have found nothing. Any help would be appreciated.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

TeTpaAka
Member
 
Posts: 131
Joined: Sat Dec 28, 2013 21:54

Re: Post your modding questions here

by TeTpaAka » Wed Jul 15, 2015 17:19

My problem is, that the engine complains about deprecated usage:
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
Deprecated usage of statbar without size!

According to lua_api.txt, the size is:
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
* `size`: If used, will force full-image size to this value (override texture pack image size)

But setting the size to the dimensions of the image also affects the position of the statbar. The problem is, that the statbar fits exactly in a background image. At least, that is in the deprecated behaviour. What should I do to have the same result with the current engine?
 

User avatar
Rui
Member
 
Posts: 255
Joined: Wed Oct 01, 2014 12:59
GitHub: Rui-Minetest

[DELETED]

by Rui » Fri Jul 17, 2015 06:33

[DELETED]
Last edited by Rui on Fri Nov 04, 2016 13:16, edited 2 times in total.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Fri Jul 17, 2015 18:11

Rui wrote:How I create block preview image?
Image
This like.

http://dev.minetest.net/minetest.inventorycube#Example
 

User avatar
Rui
Member
 
Posts: 255
Joined: Wed Oct 01, 2014 12:59
GitHub: Rui-Minetest

[DELETED]

by Rui » Sat Jul 18, 2015 04:48

[DELETED]
Last edited by Rui on Fri Nov 04, 2016 13:15, edited 1 time in total.
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: Post your modding questions here

by Calinou » Sat Jul 18, 2015 05:33

Rui wrote:@Hybrid Dog
How save it as png image?


Get Blender and open this .blend file using it.

Set texture paths appropriately, then press F12 to make a Blender render, then F3 to export it to PNG format.
 

User avatar
Rui
Member
 
Posts: 255
Joined: Wed Oct 01, 2014 12:59
GitHub: Rui-Minetest

[DELETED]

by Rui » Sat Jul 18, 2015 07:01

[DELETED]
Last edited by Rui on Fri Nov 04, 2016 13:15, edited 1 time in total.
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: Post your modding questions here

by Calinou » Sat Jul 18, 2015 07:35

Rui wrote:@Calinou
Thanks.
But, my pc has low performance...

Is there such thing as a shell script (.sh)?


The rendering of the cube takes about 0.10 seconds here. Even if your computer was 10 times as slow as mine, it would take only 1 second to render it.

There is no Shell script for making renders. Blender is more suited for this purpose.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Sat Jul 18, 2015 08:08

Calinou wrote:There is no Shell script for making renders. Blender is more suited for this purpose.

but Zeg9's skins mod uses a shell script which makes blender render images and save them
https://github.com/Zeg9/minetest-skins/ ... reviews.sh
 

bobomb
Member
 
Posts: 101
Joined: Sat May 23, 2015 20:28
GitHub: bobombolo
IRC: bobomb

Re: Post your modding questions here

by bobomb » Tue Jul 21, 2015 01:36

formspec issue

I have a few "popup" forms that open from a main form, but the popups only show once in a dozen clicks. the exit button on these popup forms should reopen the main form, this rarely happens. If I dump a table to print(), all these form flows work perfectly. what is up with that!?

the code, working is at https://github.com/bobombolo/automata/blob/development/init.lua#L780 which shows the line where the print(dump()) statement is. it would sure be nice not to have to do that statement.

any ideas what is causing this issue? is it a question of things happening too quickly? simply printing "here" doesn't solve the issue.
update: actually even with that dump it is still about once in 6 that it works ...
if I dump another table a few lines above then everything works...
 

Anonymous_moose
Member
 
Posts: 38
Joined: Tue Aug 27, 2013 20:25

Re: Post your modding questions here

by Anonymous_moose » Tue Jul 21, 2015 19:30

I am trying to make a wearable spacesuit that works with 3darmor and moontest. I have figured out how to get the breath to restore, but only cannot find out how to get the game to know if the space suit is being worn. any help would be much appreciated.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Wed Jul 22, 2015 08:42

bobomb wrote:formspec issue

I have a few "popup" forms that open from a main form, but the popups only show once in a dozen clicks. the exit button on these popup forms should reopen the main form, this rarely happens. If I dump a table to print(), all these form flows work perfectly. what is up with that!?

the code, working is at https://github.com/bobombolo/automata/blob/development/init.lua#L780 which shows the line where the print(dump()) statement is. it would sure be nice not to have to do that statement.

any ideas what is causing this issue? is it a question of things happening too quickly? simply printing "here" doesn't solve the issue.
update: actually even with that dump it is still about once in 6 that it works ...
if I dump another table a few lines above then everything works...

maybe using minetest.after(0, […] could work
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Wed Jul 22, 2015 08:44

Anonymous_moose wrote:I am trying to make a wearable spacesuit that works with 3darmor and moontest. I have figured out how to get the breath to restore, but only cannot find out how to get the game to know if the space suit is being worn. any help would be much appreciated.

l guess you would need to search in the armour inventory slots.
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 15 guests