Post your modding questions here

John_Constructor
Member
 
Posts: 76
Joined: Thu Jun 01, 2017 20:06
Location: On Minetest 24/7
GitHub: John-Constructor
In-game: Nooberton

Re: Post your modding questions here

by John_Constructor » Sat Oct 14, 2017 01:36

Topic: Moreblocks conflicts with my Construction mod, how can I fix this?

Reason: I want Construction to be fully compatible with Moreblocks.

Extra Information: My code is legitimately correct, but it throws up an error message when I run Construction and Moreblocks in combination while "construction_compatibility_issue" is active.

Code: Select all
-- Compatibility Issue Solver
if minetest.settings:get_bool("construction_compatibility_issue") then

   minetest.clear_craft({
      output = ("moreblocks:wood_tile"),
   })
   
minetest.register_craft({
   output = "moreblocks:wood_tile 4",
   recipe = {
      {'', '', ''},
      {'', 'default:wood', 'default:junglewood'},
      {'', 'default:junglewood', 'default:wood'},
   }
})

end


Image

I am running Minetest 0.4.16.
Attachments
Incompatibility.PNG
Incompatibility issue solver.
(16.52 KiB) Not downloaded yet
Constructing mechs and wingless aircraft since 2016.
 

User avatar
Napiophelios
Member
 
Posts: 908
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: Post your modding questions here

by Napiophelios » Sat Oct 14, 2017 02:16

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"},
   }
})
 

FaceDeer
Member
 
Posts: 220
Joined: Sat Aug 29, 2015 19:01

Re: Post your modding questions here

by FaceDeer » Sat Oct 14, 2017 05:35

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.
 

User avatar
Lone_Wolf
Member
 
Posts: 1630
Joined: Sun Apr 09, 2017 05:50
Location: You wouldn't believe me
GitHub: LoneWolfHT
IRC: Lone_Wolf
In-game: Lone_Wolf or Somebody
 

User avatar
ManElevation
Member
 
Posts: 745
Joined: Tue Aug 02, 2016 22:04
Location: Madrid,Spain
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation

Re: Post your modding questions here

by ManElevation » Sat Oct 28, 2017 15:41

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
})
 

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

Re: Post your modding questions here

by Krock » Sat Oct 28, 2017 16:49

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
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

Byakuren
Member
 
Posts: 657
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo

Re: Post your modding questions here

by Byakuren » Sat Oct 28, 2017 18:05

Just a warning, that implementation would be exploitable in case a mod adds a way to block damage through register_on_player_hpchange.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
burli
Member
 
Posts: 1555
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Mon Oct 30, 2017 06:43

What does "fertility" in the farming mod means?

Edit: got it.
 

User avatar
fishyWET
Member
 
Posts: 151
Joined: Tue Jan 01, 2013 07:43
Location: Nowhere
GitHub: fishyWET
IRC: neinwhal

Re: Post your modding questions here

by fishyWET » Mon Oct 30, 2017 17:57

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"?
 

User avatar
Lejo
Member
 
Posts: 230
Joined: Mon Oct 19, 2015 16:32
GitHub: Lejo1
In-game: Lejo

Re: Post your modding questions here

by Lejo » Thu Nov 02, 2017 14:23

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?
 

ShallowDweller
New member
 
Posts: 2
Joined: Thu Nov 02, 2017 22:23

Re: Post your modding questions here

by ShallowDweller » Thu Nov 02, 2017 22:56

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.
 

Sires
Member
 
Posts: 82
Joined: Mon Jan 02, 2017 21:00
Location: Hue knows...
IRC: Sires
In-game: Sires

Re: Post your modding questions here

by Sires » Thu Nov 02, 2017 23:52

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
Working in a new mod

Also, Sires is not pronouncied like Siri, it's from Sir, use he not she(also not it, I'm not a thing :P).

**SORY MAY BADDY ANGLISH**
 

User avatar
orwell
Member
 
Posts: 560
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Fri Nov 03, 2017 09:38

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}.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
Lejo
Member
 
Posts: 230
Joined: Mon Oct 19, 2015 16:32
GitHub: Lejo1
In-game: Lejo

Re: Post your modding questions here

by Lejo » Fri Nov 03, 2017 11:09

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
 

ShallowDweller
New member
 
Posts: 2
Joined: Thu Nov 02, 2017 22:23

Re: Post your modding questions here

by ShallowDweller » Fri Nov 03, 2017 15:05

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!
 

User avatar
burli
Member
 
Posts: 1555
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Fri Nov 03, 2017 16:17

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
 

User avatar
burli
Member
 
Posts: 1555
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Fri Nov 03, 2017 16:37

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

Image

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?
Attachments
screenshot_20171103_173243.png
(769.79 KiB) Not downloaded yet
 

User avatar
burli
Member
 
Posts: 1555
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Fri Nov 03, 2017 17:13

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

Image

In the front you can see a straight cut where the decoration just ends. This can't be correct
Attachments
screenshot_20171103_180920.jpg
(141.85 KiB) Not downloaded yet
 

User avatar
TumeniNodes
Member
 
Posts: 2137
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: Post your modding questions here

by TumeniNodes » Fri Nov 03, 2017 23:09

it seems to be being affected by above ground biome paramters?
Reckless disregard for the truth -- will not be protected by a qualified privilege.
 

User avatar
christoferlevich
Member
 
Posts: 284
Joined: Thu Dec 01, 2016 23:44
Location: Athol, Massachusetts
GitHub: ChristoferL

Re: Post your modding questions here

by christoferlevich » Fri Nov 03, 2017 23:18

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.
everything can be a learning experience...
 

Vansius
New member
 
Posts: 1
Joined: Mon Nov 06, 2017 01:23

Re: Post your modding questions here

by Vansius » Mon Nov 06, 2017 01:49

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.
 

User avatar
cx384
Member
 
Posts: 395
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Mon Nov 06, 2017 16:44

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
Last edited by cx384 on Mon Nov 06, 2017 17:44, edited 1 time in total.
Can your read this?
 

User avatar
azekill_DIABLO
Member
 
Posts: 6743
Joined: Wed Oct 29, 2014 20:05
Location: Inside the Box
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: Post your modding questions here

by azekill_DIABLO » Mon Nov 06, 2017 17:02

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.
 

User avatar
burli
Member
 
Posts: 1555
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Mon Nov 06, 2017 19:41

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.
 

User avatar
orwell
Member
 
Posts: 560
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Tue Nov 07, 2017 09:50

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.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: Bing [Bot] and 1 guest