Post your modding questions here

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Tue Feb 04, 2014 17:40

Casimir wrote:That only works when standing in the node. I haven't found any workaround.

You might use an abm to replace the air around your node with special air that does the damage. Or let the player live on :-)
A list of my mods can be found here.
 

User avatar
Novacain
Member
 
Posts: 285
Joined: Sat Aug 31, 2013 01:03

by Novacain » Fri Feb 07, 2014 03:32

is there an easy way to add a second recipe for crafting something?
I have multiple versions of the same block (different colors) and several of those blocks. what I have is this:

-W,-B,-G,-O are represtitive of colors. they craft like this;
A-W->B-W->C-W->D-W
A-W->A-B/A-O/A-G
B-W->B-B/B-O/B-G
C-W->C-B/C-O/C-G
D-W->D-B/D-O/D-G

I wanna add support so this can be included:
A-B->B-B->C-B->D-B
A-O->B-O->C-O->D-O
A-G->B-G->C-G->D-G

hope you can understand this, and help. my main question is whether I need to create another class (if that's what they are called in Lua) or whether it can be incorperated into the current class.

the reason why is cause I will have over 32 variations of this node, and I don't want to create that much additional code if it isn't neccesary
Last edited by Novacain on Fri Feb 07, 2014 03:39, edited 1 time in total.
EXTERMINATE!!!
My Tronrealm modpack
My tronblocks mod
 

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

by DeepGaze » Fri Feb 07, 2014 09:17

is there a way to write a code to:
player places block A and then block B
player hits block A
block A places block C
Block B turns into a teleport to Block C
Block C turns into a teleport to Block B
player hits block A
Block C is destroyed
Block B stops teleport function

any ideas (Stupid in the way of modding)
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Sat Feb 08, 2014 01:48

Novacain wrote:Is there an easy way to add a second recipe for crafting something?
I have multiple versions of the same block (different colors) and several of those blocks. what I have is this:

If you have diffrent colors, please try to stick to the naming schem wool uses (or, alternatively, unifieddyes) so that your mod may be supported by my colormachine mod. That might also help you with easier coloring.

Novacain wrote:I wanna add support so this can be included:
A-B->B-B->C-B->D-B
A-O->B-O->C-O->D-O
A-G->B-G->C-G->D-G

There's no direct way for that. You might create a table with all the block names (a simple list) and let a for loop iterate over it so that you basicly craft list[ i ] -> list[ i+1 ].

DeepGaze wrote:is there a way to write a code to:
player places block A and then block B
player hits block A
block A places block C

Depends a bit. If all your blocks are loaded - fine, could be made working. If the target isn't loaded - the new minetest.forceload_block might help you perhaps.
A list of my mods can be found here.
 

i1abnrk
Member
 
Posts: 19
Joined: Sat May 11, 2013 03:20
GitHub: i1abnrk
IRC: i1abnrk
In-game: mervyncoll

by i1abnrk » Sat Feb 08, 2014 17:43

Issue: lua mapgen seems to have no effect. I have tried several lua mapgen implementations (mods) but it seems the mapgen + seed in gui overrides the mod code and I'm stuck with vanilla every time. Minetest_game and the mod game both produce identical worlds. What are recommended settings or the prescribed method? I am using minetest 0.4.9 installed from deb on Ubuntu precise.
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Sat Feb 08, 2014 18:35

Depends on the mod. Paramat most of the time chooses a different hight, so the Lua mapgen actually starts at 7000 and you have to teleport your self there. Some other mods just add new regions and you might have to search for them.
Do you have papyrus and cactus in your world? When normal mapgen would revert the Lua things, those would be missing too.
 

i1abnrk
Member
 
Posts: 19
Joined: Sat May 11, 2013 03:20
GitHub: i1abnrk
IRC: i1abnrk
In-game: mervyncoll

by i1abnrk » Sun Feb 09, 2014 02:29

Yes, there are cactus, etc on the mapgenv6 ans mapgenv7 produces just default:stone and water. It seems to me from testing that minetest.on_generate is being processed but the minetest.update_map isn't pushing changes to the map on any of the lua maps. I'm going to try a full reinstall to resolve potential issues from 0.4.7 I installed over.
 

i1abnrk
Member
 
Posts: 19
Joined: Sat May 11, 2013 03:20
GitHub: i1abnrk
IRC: i1abnrk
In-game: mervyncoll

by i1abnrk » Sun Feb 09, 2014 02:49

Yeah that fixed things. I pooched the manual update. Sorry and thanks.
 

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

by DeepGaze » Sun Feb 09, 2014 17:27

[spoiler]player places block A and then block B
player hits block A
block A places block C
Block B turns into a teleport to Block C
Block C turns into a teleport to Block B
player hits block A
Block C is destroyed
Block B stops teleport function[/spoiler]
I am assuming that location for block c is loaded. this is something I am learning (modding) I haven't written any code yet for the simple reason of not knowing any.
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards
 

wcwyes
Member
 
Posts: 145
Joined: Wed Jul 31, 2013 22:42

by wcwyes » Mon Feb 10, 2014 02:18

I'm trying to connect 2 worlds that you can't go back and forth without the portals without decreasing the expansion of the main world. Preferably on the same server.
fairiestoy wrote:Question is: What are you exactly aiming at? Do you want to cross-connect several servers by portals? If you just want to give the player the imagination that hes wandering between different worlds, you could create a mod which adds unpassable borders at specific heights and generate new land above this borders. If a player gets ported to the destination, he cannot get back to the original level without the portals. Thats at least the most useable solution ( imo ) when you don't want to kick out the user from his server and force him to reconnect somewhere else ( where he might run into problems when not finding it in the server list for example ).

If you want the crossconnect stuff ( which is interesting ), you have to suggest a API facility to the devs ( like minetest.client_connect_to( <connection parameters> ) ) which holds the current connection but tries to get the user into the other server. On success, he gives free the original connection. Should be a client-only thing.
 

i1abnrk
Member
 
Posts: 19
Joined: Sat May 11, 2013 03:20
GitHub: i1abnrk
IRC: i1abnrk
In-game: mervyncoll

by i1abnrk » Wed Feb 12, 2014 07:14

So what you need is a way to run two server instances and to bounce the connected client to the second server. You'll need two configuration files on the host machine, probably two copies of the minetestserver binary, each with its own config file. (Or a fork server but that's even more complicated) and way to rewrite the configuration on the client, at least in memory, so it connects to the port address of the second server. Port redirection is something minetest doesn't do yet. You can ask dev about it, as Toy suggested before, or you'll have to write it yourself.
Your surest course of action is to go to the github site from the Development link on www.minetest.net. There make a username and submit a feature request with a title like "multiple server config file support, lua port redirection' and try to describe what you are trying to accomplish. They are interested in new ideas.
Last edited by i1abnrk on Wed Feb 12, 2014 07:35, edited 1 time in total.
 

User avatar
pandaro
Member
 
Posts: 266
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro

by pandaro » Wed Feb 12, 2014 22:34

I tried to add a feature to the player's hand.
However, I have some problem:
if I call the function: "on_use (itemstack, user, pointed_thing)" everything works perfectly.
but if I call: "on_place (itemstack, user, pointed_thing)"
the function on_place is not called, does not work

here the code:
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
on_place=function(itemstack,placer,pointed_thing)
print(tostring("on place hand"))
end
end,
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level = 0,
groupcaps = {
fleshy = {times={[2]=2.00, [3]=1.00}, uses=0, maxlevel=1},
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40}, uses=0, maxlevel=3},
}
}
})


There is a reason why "on_place" can not be defined by the hand?
or I'm wrong something?
sorry for bad english
Linux debian 7 wheezy 64
kde
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Wed Feb 12, 2014 23:02

print(tostring("on place hand"))
You turn a string into a string.

This works for me.
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
    on_place = function(itemstack,placer,pointed_thing)
        print("on place hand")
    end,
 

User avatar
pandaro
Member
 
Posts: 266
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro

by pandaro » Thu Feb 13, 2014 10:51

casimir thanks for trying to answer, but you did not understand the question.
The problem is in the
"on_place"
, but only within the definition of the item
":"
that is, the player's hand.
The function as I posted above works in any other tool, item, node; But it does not work in the definition of the hand.
sorry for bad english
Linux debian 7 wheezy 64
kde
 

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

by DeepGaze » Thu Feb 13, 2014 16:04

1)is it possible to make an action repeat on a player after they eat something?
2)is there a tutorial on teleporting?
3)how do you make a dialogue(menu for a block)
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Thu Feb 13, 2014 17:04

@ pandora
Don't know if I understand you. I tried it with the hand, and it worked. All the other tools worked just as usual. If you want the function for all tools you would have to overwrite minetest.tooldef_default in /builtin/item.lua

@ DeepGaze
1) It is possible, but not the easy way. E.g. you could override the function eat_item, but you would have to load it before all other mods that use it. That means before "default".
 

User avatar
AMMOnym
Member
 
Posts: 682
Joined: Tue Sep 10, 2013 14:18
IRC: AMMOnym
In-game: AMMOnym

by AMMOnym » Fri Feb 14, 2014 09:23

is possible with minetest make code for this : i destroy (Dirt) and i dont get dirt but (wool) ?
 

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

by DeepGaze » Fri Feb 14, 2014 11:25

Where is my error and what is it?
[spoiler]--this is Block-A
minetest.register_node("tardis:console", {
tile_images = {"tardis1.png"},
description = "Tardis Console",
groups={unbreakable=1},
after_place_node = function(pos, placer, itemstack)
local meta = minetest.env:get_meta(pos);
meta:set_string("infotext", "tardis (unconfigured)");
meta:set_string("tardis_name", "");
meta:set_string("tardis_arch","");
meta:set_string("owner", placer:get_player_name() );
-- request initinal data
meta:set_string("formspec",
"size[12,10]"..
"field[0.3,5.6;6,0.7;tardis_name;Name this tardis:;]"..
"field[0.3,6.6;6,0.7;tardis_arch;where is the arch:;]"..
"field[0.3,7.6;6,0.7;owner_name;(optional) owned by:;]"..
"button_exit[6.3,6.2;1.7,0.7;station_set;Store]")
})
--this is Block-B
minetest.register_node("tardis:door", {
tile_images = {"tardis2.png"},
description = "Tardis arch",
groups={unbreakable=1},
})
--this is Block-C
minetest.register_node("tardis:dest", {
tile_images = {"tardis3.png"},
groups={immortal},
})

--tardis key
minetest.register_chatcommand("keys", {
params = "<tardis> <x>,<y>,<z>",
description = "tardis to player",
privs = {tardis=true},
})
--privs
minetest.register_privilege("tardis", "Can use /tardis command")

minetest.register_node("tardis:heart", {
tile_images = {"2heart.png"},
walkable = false,
pointable = true,
on_use = minetest.item_eat(20),

})


--planned to make player immortal, unless the dammage is over 40hp[/spoiler]
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards
 

User avatar
Novacain
Member
 
Posts: 285
Joined: Sat Aug 31, 2013 01:03

by Novacain » Fri Feb 14, 2014 14:26

there is something wrong in the syntax of it. I put it into eclipse and got this error:
Description Resource Path Location Type
unexpected symbol near '}' main.lua /Test/src line 19 DLTK Problem


"test" is simply what I called the project.

you also spelled initial wrong in your comment.

PS, eclipse is your friend. it helps you realize you made an API error before you waould otherwise have noticed.
Last edited by Novacain on Fri Feb 14, 2014 14:29, edited 1 time in total.
EXTERMINATE!!!
My Tronrealm modpack
My tronblocks mod
 

User avatar
pandaro
Member
 
Posts: 266
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro

by pandaro » Fri Feb 14, 2014 20:03

I go back to my little problem.
I understand that: The function "on place" work if it is called within the definition of the player's hand. However, she only works if "pointed_thing" is not a player.
If the target of the "right_click" is a player, then minetest returns:
"20:34:49: ACTION [ServerThread]: john right-clicks the object 1: player Pandarus"

and the function "on_place" does not work.

I want to be able to bring up a "formspec" if I click with the right mouse button on another player.

Can someone explain to me how to get around this problem?
sorry for bad english
Linux debian 7 wheezy 64
kde
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Fri Feb 14, 2014 20:05

pandaro wrote: want to be able to bring up a "formspec" if I click with the right mouse button on another player.

Can someone explain to me how to get around this problem?

Perhaps it might work if you use a tool for the pointing?
A list of my mods can be found here.
 

User avatar
pandaro
Member
 
Posts: 266
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro

by pandaro » Fri Feb 14, 2014 20:13

Sokomine wrote:Perhaps it might work if you use a tool for the pointing?


yes, I know. However, my goal is to allow the exchange of objects between two players, without being forced to throw objects on the ground, and without having to build a chest to make the trade-off. To do this I was thinking of integrating a small menu of exchange that appears when a player is clicked by another player.

What I find frustrating is that by using "on_use" I can do what I want, but with "on_place" I can not
sorry for bad english
Linux debian 7 wheezy 64
kde
 

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

by Topywo » Fri Feb 14, 2014 20:30

AMMOnym wrote:is possible with minetest make code for this : i destroy (Dirt) and i dont get dirt but (wool) ?


Maybe this mod is useful for what you're looking for

https://forum.minetest.net/viewtopic.php?id=3675
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Fri Feb 14, 2014 21:02

pandaro wrote:yes, I know. However, my goal is to allow the exchange of objects between two players, without being forced to throw objects on the ground, and without having to build a chest to make the trade-off.

Sounds like a very good idea. There was a thread about that here which did not make it into a mod so far.
A list of my mods can be found here.
 

User avatar
pandaro
Member
 
Posts: 266
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro

by pandaro » Fri Feb 14, 2014 21:14

Ah! I think if that works, try it yourself, it goes mod "default", look for the definition of the item ":" and add:
on_use=function(itemstack,user,pointed_thing)

print(dump(user:get_player_control().RMB))
print("on place hand")
if pointed_thing.ref and pointed_thing.ref:is_player() and then
local usr_name=user:get_player_name()
local target_name=pointed_thing.ref:get_player_name()
local swap = minetest.create_detached_inventory(usr_name..target_name,{})
swap:set_size("main",8*4)

minetest.show_formspec(usr_name,"trade-off","size[8,9]"..
"list[current_player;main;0,5;8,4;]"..
"list[detached:"..usr_name..target_name..";main;0,0;8,4;]")

minetest.show_formspec(target_name,"trade-off","size[8,9]"..
"list[current_player;main;0,5;8,4;]"..
"list[detached:"..usr_name..target_name..";main;0,0;8,4;]")
end
end,


that anger
sorry for bad english
Linux debian 7 wheezy 64
kde
 

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

by BrunoMine » Sat Feb 15, 2014 13:18

how to shine node?
I'm creating a mod.
My small square universe under construction ... Minemacro
Comunidade Minetest Brasil
www.minetestbrasil.com
 

User avatar
fishyWET
Member
 
Posts: 145
Joined: Tue Jan 01, 2013 07:43
GitHub: fishyWET

by fishyWET » Sat Feb 15, 2014 13:42

brunob.santos wrote:how to shine node?
I'm creating a mod.

I think you meant how to make a node light up?

Add this to the node's code
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
light_source = 14,

14 is the strongest light, and it decreases as the number decreases.
Edit: Made a mistake at the max light source
Last edited by fishyWET on Sat Feb 15, 2014 15:26, edited 1 time in total.
LOTR Subgame
Some days you flip the table, (ノಥ益ಥ)ノ ︵┻━┻,
Other days, the table flip you, ┳━┳︵(ₒ⁻ₒ).
 

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

by Topywo » Sat Feb 15, 2014 13:57

fishyWET wrote:
brunob.santos wrote:how to shine node?
I'm creating a mod.

I think you meant how to make a node light up?

Add this to the node's code
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
light_source = 8,

8 is the strongest light, and it decreases as the number decreases.


I thought 15 is daylight, but I'm not sure if the max is 14 or 15.
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Sat Feb 15, 2014 14:08

Topywo wrote:
fishyWET wrote:
brunob.santos wrote:how to shine node?
I'm creating a mod.

I think you meant how to make a node light up?

Add this to the node's code
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
light_source = 8,

8 is the strongest light, and it decreases as the number decreases.


I thought 15 is daylight, but I'm not sure if the max is 14 or 15.
Maximum light is 14.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

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

by DeepGaze » Sun Feb 16, 2014 21:19

how do you animate a brick (do you have a code example I could steal)
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 11 guests

cron