tool player damage and mining speed(how to change them in a LUA file)?

User avatar
durtective6
Member
 
Posts: 167
Joined: Sun Aug 12, 2012 14:19
In-game: derplez

tool player damage and mining speed(how to change them in a LUA file)?

by durtective6 » Wed Aug 28, 2013 15:31

How do i make it so different swords do more damage and different tools mine faster when making my mod (in the init.LUA file)?<-still needs answering

Also another question, how do i set the rarity and size of ore clusters? <- pretty much solved just need to know about cluster scarcity
Last edited by durtective6 on Thu Aug 29, 2013 07:23, edited 1 time in total.
 

User avatar
CraigyDavi
Member
 
Posts: 565
Joined: Sat Aug 10, 2013 13:08
GitHub: davisonio
IRC: davisonio or CraigyDavi
In-game: davisonio or CraigyDavi

by CraigyDavi » Wed Aug 28, 2013 19:17

Evergreen answered your second question in great detail here: https://forum.minetest.net/viewtopic.php?id=7013

Evergreen wrote:Okay, here is some example code for an ore.

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_ore({
    ore_type       = "scatter",
    ore            = "mod:stone_with_ore",
    wherein        = "default:stone",
    clust_scarcity = 8*8*8,
    clust_num_ores = 8,
    clust_size     = 3,
    height_min     = -31000,
    height_max     = 64,
})


To quote the dev wiki:

ore_type: See Ore types
ore: The name of the ore node
wherein: The node that the ore will generate inside of
clust_scarcity: Ore has a 1 out of clust_scarcity chance of spawning in a node.
clust_num_ores: Number of ores in a cluster
clust_size: Size of the bounding box of the cluster
height_min: The lowest level that the ore will generate at
height_max: The highest level that the ore will generate at
noise_threshhold: If noise is above this threshold, ore is placed. Not needed for a uniform distribution
noise_params: NoiseParams structure describing the perlin noise used for ore distribution


Also, the possible ore types are:

scatter

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
Randomly chooses a location and generates a cluster of ore.
If noise_params is specified, the ore will be placed if the 3d perlin noise at
that point is greater than the noise_threshhold, giving the ability to create a non-equal
distribution of ore.


sheet

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
Creates a sheet of ore in a blob shape according to the 2d perlin noise described by noise_params.
The relative height of the sheet can be controlled by the same perlin noise as well, by specifying
a non-zero 'scale' parameter in noise_params.  IMPORTANT: The noise is not transformed by offset or
scale when comparing against the noise threshhold, but scale is used to determine relative height.
The height of the blob is randomly scattered, with a maximum height of clust_size.
clust_scarcity and clust_num_ores are ignored.
This is essentially an improved version of the so-called "stratus" ore seen in some unofficial mods.



EDIT:

Remember to register the ore as a node first.

Like so:

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_node("yourmod:stone_with_yourore", {
    description = "Your Ore",
    tiles = {"default_stone.png^yourmod_mineral_yourore.png"},
    groups = {cracky=3},
    drop = 'yourmod:yourore_lump',
    sounds = default.node_sound_stone_defaults(),
})

Also remember to change "yourmod" with your mod name, and "youore" with the name of your ore.
 

User avatar
durtective6
Member
 
Posts: 167
Joined: Sun Aug 12, 2012 14:19
In-game: derplez

by durtective6 » Wed Aug 28, 2013 21:33

K thanks,
I dont really get the cluster scarcity (why does it have 3 numbers)
Also do u know anything about my first question
Many thanks
 

User avatar
CraigyDavi
Member
 
Posts: 565
Joined: Sat Aug 10, 2013 13:08
GitHub: davisonio
IRC: davisonio or CraigyDavi
In-game: davisonio or CraigyDavi

by CraigyDavi » Thu Aug 29, 2013 08:01

Here is some code used for a tool:
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_tool("default:pick_wood", {
    description = "Wooden Pickaxe",
    inventory_image = "default_tool_woodpick.png",
    tool_capabilities = {
        max_drop_level=0,
        groupcaps={
            cracky={times={[2]=2.00, [3]=1.20}, uses=10, maxlevel=1}

Go here to see more tools: https://github.com/minetest/minetest/blob/7b13d119ed917c137fc375eff790a7754fd93386/games/minimal/mods/default/init.lua

I think the cluster scarcity is... The 3 numbers mean that you can find a cluster in a 8x8x8 square.
 


Return to WIP Mods

Who is online

Users browsing this forum: Google [Bot] and 6 guests

cron