Page 168 of 169
Re: Post your modding questions here
Posted: Sat Oct 14, 2017 02:16
by Napiophelios
shouldn't it be:
Code: Select all
minetest.clear_craft({
output = "moreblocks:wood_tile 9",
recipe = {
{"default:wood", "default:wood", "default:wood"},
{"default:wood", "default:wood", "default:wood"},
{"default:wood", "default:wood", "default:wood"},
}
})
Re: Post your modding questions here
Posted: Sat Oct 14, 2017 05:35
by FaceDeer
I actually just filed an issue over this behaviour of clear_craft, it's rather user-unfriendly of it to throw an exception when the craft you're trying to clear doesn't exist rather than just returning false. You can follow the issue here:
https://github.com/minetest/minetest/issues/6513
As for a solution, you can wrap the call to clear_craft in a pcall() function like so:
Code: Select all
local success, err = pcall(function() minetest.clear_craft(parameter_recipe) end)
"success" will be a true/false success indicator and "err" will be an error string in the event that an exception is thrown.
Re: Post your modding questions here
Posted: Tue Oct 17, 2017 04:12
by Lone_Wolf
Re: Post your modding questions here
Posted: Sat Oct 28, 2017 15:41
by ManElevation
Need help, can someone one make this code work?
on kill give player gold.
Code: Select all
minetest.register_on_killplayer(
function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
local player_name = hitter:get_player_name()
local inventory = hitter:get_inventory()
inventory:add_item("main",{name="default:gold_ingot"})
minetest.chat_send_player(player_name, '**You got gold!**')
end
})
Re: Post your modding questions here
Posted: Sat Oct 28, 2017 16:49
by Krock
ManElevation wrote:Need help, can someone one make this code work?
on kill give player gold.
First of all,
register_on_killplayer does not exist. Instead, we've got a more generic callback register functions:
minetest.register_on_player_hpchange and
minetest.register_on_punchplayer. Whereas the latter one is interesting in his case, as it provides the puncher's name.
Here's how you could use it:
Code: Select all
minetest.register_on_punchplayer(function(player, hitter, _, _, _, damage)
if not (hitter and hitter:is_player()) then
return -- Punched by non-player
end
local hp = player:get_hp()
if hp - damage > 0 or hp <= 0 then
return -- Player is not dead yet or still dead
end
-- Player got killed by player 'hitter'
local hitter_name = hitter:get_player_name()
local player_name = player:get_player_name()
local inv = hitter:get_inventory()
inv:add_item("main", {name="default:gold_ingot"})
minetest.chat_send_player(hitter_name, "** You killed " .. player_name
.. ". Here, have a free gold ingot! **")
end)
Untested but will most likely work
Re: Post your modding questions here
Posted: Sat Oct 28, 2017 18:05
by Byakuren
Just a warning, that implementation would be exploitable in case a mod adds a way to block damage through register_on_player_hpchange.
Re: Post your modding questions here
Posted: Mon Oct 30, 2017 06:43
by burli
What does "fertility" in the farming mod means?
Edit: got it.
Re: Post your modding questions here
Posted: Mon Oct 30, 2017 17:57
by fishyWET
EDIT: managed to fix first two issues, was a sily goof, removed them.
Is it possible to stop a minetest.after timer rather than countering it with another minetest.after timer that gives the opposite value?
Or perhaps a different method that isn't so "hacky"?
Re: Post your modding questions here
Posted: Thu Nov 02, 2017 14:23
by Lejo
I tried to generate a trial of smoke from a player to another position.
Code: Select all
local pos = player:getpos() ; pos.y = pos.y +1
local goal = {x=0, y=0, z=0}
local dir = vector.direction(pos, goal)
local dis = vector.distance(pos, goal)
minetest.add_particlespawner({
amount = 15*dis,
time = 1,
minpos = pos,
maxpos = pos,
minvel = dis,
maxvel = dis,
minacc = dir,
maxacc = dir,
minexptime = 1,
maxexptime = 1,
minsize = 15,
maxsize = 20,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png"
})
The smoke should spawn at the player and disappears at position, but I don't know how to set
minvel and
maxvel.
Can someone help me?
Re: Post your modding questions here
Posted: Thu Nov 02, 2017 22:56
by ShallowDweller
sorry if this is the wrong place to ask, but i couldn't find this information anywhere (i googled, browsed github, checked the wiki...).
some mods have other dependencies than "default", but i can't figure out where to download some of said dependencies and there are many mods with similar names, so it is hard to tell if i found the right one. and i don't know if the uploaders are active in the forums (nor if necrobumping is forbiden).
the dependencies i need are the following:
"wool", "flowers", "stairs", "dye", "bucket" and "farming"*
*i belive i may have THIS one, but i'm not sure and i'd like to confirm.
the mods requesting them are:
carpet3d,
compost bin and
inventorybags.
Re: Post your modding questions here
Posted: Thu Nov 02, 2017 23:52
by Sires
ShallowDweller wrote:sorry if this is the wrong place to ask, but i couldn't find this information anywhere (i googled, browsed github, checked the wiki...).
some mods have other dependencies than "default", but i can't figure out where to download some of said dependencies and there are many mods with similar names, so it is hard to tell if i found the right one. and i don't know if the uploaders are active in the forums (nor if necrobumping is forbiden).
the dependencies i need are the following:
"wool", "flowers", "stairs", "dye", "bucket" and "farming"*
*i belive i may have THIS one, but i'm not sure and i'd like to confirm.
the mods requesting them are:
carpet3d,
compost bin and
inventorybags.
All this dependencies are included in the default Minetest Game subgame, if you are using another subgame that doesn't have them maybe the subgame was not made to have this mods or you would have to get this mods from the Minetest Game subgame
Re: Post your modding questions here
Posted: Fri Nov 03, 2017 09:38
by orwell
Lejo wrote:I tried to generate a trial of smoke from a player to another position.
Code: Select all
local pos = player:getpos() ; pos.y = pos.y +1
local goal = {x=0, y=0, z=0}
local dir = vector.direction(pos, goal)
local dis = vector.distance(pos, goal)
minetest.add_particlespawner({
amount = 15*dis,
time = 1,
minpos = pos,
maxpos = pos,
minvel = dis,
maxvel = dis,
minacc = dir,
maxacc = dir,
minexptime = 1,
maxexptime = 1,
minsize = 15,
maxsize = 20,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png"
})
The smoke should spawn at the player and disappears at position, but I don't know how to set
minvel and
maxvel.
Can someone help me?
These are velocity vectors. As far as I can tell from your code, the particles need to make the distance dis (which is a scalar) within 1 second. Because minvel and maxvel are vectors, they tell the velocity and the movement direction at the same time.
You can think of this as follows:
In one second, the particle moves exactly one time the vector's length along the velocity vector, so it's position is then vector.add(pos, vel) (in Minetest semantics)
After 2 seconds, it's vector.add(pos, vector.multiply(vel, 2)) a.s.o.
Because your particles have to move along the vector vector.subtract(goal, pos) in exactly 1 second, your velocity vector (minvel and maxvel) is simply vector.subtract(goal, pos) (which is equal to vector.multiply(dir, dis))
(if you change the expiry time to something different (lets name it 'time'), it will be vector.multiply(vector.subtract(goal, pos), 1/time) )
Acceleration is a vector as well. The procedure is the same like for the position and velocity.
new_velocity = vector.add(old_velocity, vector.multiply(acc, delta_time))
You probably don't want your particles to change their velocity at all, so you should set minacc and maxacc to {x=0,y=0,z=0}.
Re: Post your modding questions here
Posted: Fri Nov 03, 2017 11:09
by Lejo
Thanks!
The first: vector.subtract(goal, pos) works fine.
But the second: vector.multiply(vector.subtract(goal, pos), 1/time) not. I tested it with time = 5
Re: Post your modding questions here
Posted: Fri Nov 03, 2017 15:05
by ShallowDweller
Sires wrote:
All this dependencies are included in the default Minetest Game subgame, if you are using another subgame that doesn't have them maybe the subgame was not made to have this mods or you would have to get this mods from the Minetest Game subgame
thanks! as far as i know, Minetest Game subgame is the only one i have. two of the mods are working. i'll check the rules for necrobumping and report the crash caused by the 3rd one to its autor. thanks for the aid!
Re: Post your modding questions here
Posted: Fri Nov 03, 2017 16:17
by burli
Do any of you have an example for the new underground decoration? I don't really understand how it works to place something on the floor or the ceiling or both
I was able to place something on the floor, but it was pure luck to find some decoratios
Re: Post your modding questions here
Posted: Fri Nov 03, 2017 16:37
by burli
I found some decoration with this values
Code: Select all
minetest.register_decoration({
deco_type = "simple",
place_on = "default:stone",
sidelen = 16,
--~ fill_ratio = 0.5,
noise_params = {
offset = 2,
scale = 0.01,
spread = {x = 200, y = 200, z = 200},
seed = 23454,
octaves = 5,
persist = 0.9
},
biomes = {"underground",},
decoration = "mapgen:cavefern1",
height = 1,
flags = {"all_floors","all_ceilings"},
})
And it looks like this
All decoration is only on this height and in this area. Also it is only placed on the floor, not on the ceilings.
What's wrong? How can I get decoration on any height?
Re: Post your modding questions here
Posted: Fri Nov 03, 2017 17:13
by burli
I set fill_ratio to 5, just to get everything filled. I found that cave, filled with grass. But hundreds of nodes around, below or above is nothing
In the front you can see a straight cut where the decoration just ends. This can't be correct
Re: Post your modding questions here
Posted: Fri Nov 03, 2017 23:09
by TumeniNodes
it seems to be being affected by above ground biome paramters?
Re: Post your modding questions here
Posted: Fri Nov 03, 2017 23:18
by christoferlevich
Does anyone think its possible to enlarge the squares in the inventory formspec, even if it means making the quantity of the inventory smaller? The idea would be to make it easier for students to distinguish denominations of cash in the game. If I could enlarge the bills it would go a long way.
Re: Post your modding questions here
Posted: Mon Nov 06, 2017 01:49
by Vansius
Topic: How do I manage players and such?
Reason: I want to make a team manager that has a gui where users can join teams.
More Info: I believe not much of this is mentioned in the tutorial book.
Re: Post your modding questions here
Posted: Mon Nov 06, 2017 16:44
by cx384
Vansius wrote:Topic: How do I manage players and such?
Reason: I want to make a team manager that has a gui where users can join teams.
More Info: I believe not much of this is mentioned in the tutorial book.
You can find everything there:
https://github.com/minetest/minetest/bl ... ua_api.txt
Re: Post your modding questions here
Posted: Mon Nov 06, 2017 17:02
by azekill_DIABLO
christoferlevich wrote:Does anyone think its possible to enlarge the squares in the inventory formspec, even if it means making the quantity of the inventory smaller? The idea would be to make it easier for students to distinguish denominations of cash in the game. If I could enlarge the bills it would go a long way.
The place where the items are? i don't think it's possible, howver you can change gui_size to something bigger, it should maybe work. Or maybe it only works for menu.
Re: Post your modding questions here
Posted: Mon Nov 06, 2017 19:41
by burli
TumeniNodes wrote:it seems to be being affected by above ground biome paramters?
Not really. I made a video and opened an issue
https://www.youtube.com/watch?v=f-6g16ahCIs
Doesn't look like an effect from other biomes.
Re: Post your modding questions here
Posted: Tue Nov 07, 2017 09:50
by orwell
azekill_DIABLO wrote:christoferlevich wrote:Does anyone think its possible to enlarge the squares in the inventory formspec, even if it means making the quantity of the inventory smaller? The idea would be to make it easier for students to distinguish denominations of cash in the game. If I could enlarge the bills it would go a long way.
The place where the items are? i don't think it's possible, howver you can change gui_size to something bigger, it should maybe work. Or maybe it only works for menu.
You might implement a workaround using image buttons. This would no longer be a real inventory but if I understand you right your student's task is to give money change.
Click on button: add this coin/bill to a bar at the bottom
Click on some button on that bar on the bottom: put money back.
Re: Post your modding questions here
Posted: Wed Nov 08, 2017 12:53
by burli
How can I get the version of the engine in Lua? I want to know if the engine is 0.4 or 0.5