1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-15 15:00:34 +01:00

MinetestForFun Game : Update all (but doors)

- Everything is updated, except doors
 - Some textures are moved to other mods (removed from default, but still used by those mods)
This commit is contained in:
LeMagnesium 2016-04-09 21:56:43 +02:00
parent 9a649b77f0
commit de031dddf1
79 changed files with 1673 additions and 1348 deletions

View File

@ -1,7 +1,7 @@
## Generic ignorable patterns and files ## Generic ignorable patterns and files
*~ *~
.*.swp .*.swp
*.bak* *bak*
tags tags
*.vim *.vim

View File

@ -4,18 +4,21 @@ GitHub Repo: https://github.com/minetest/minetest_game
Introduction Introduction
------------ ------------
The Minetest Game subgame offers multiple new possibilities in addition to the Minetest engine's built-in API, The Minetest Game subgame offers multiple new possibilities in addition to the Minetest engine's built-in API,
allowing you to add new plants to farming mod, buckets for new liquids, new stairs and custom panes. allowing you to add new plants to farming mod, buckets for new liquids, new stairs and custom panes.
For information on the Minetest API, visit https://github.com/minetest/minetest/blob/master/doc/lua_api.txt For information on the Minetest API, visit https://github.com/minetest/minetest/blob/master/doc/lua_api.txt
Please note: Please note:
[XYZ] refers to a section the Minetest API
[#ABC] refers to a section in this document * [XYZ] refers to a section the Minetest API
^ Explanation for line above * [#ABC] refers to a section in this document
Bucket API Bucket API
---------- ----------
The bucket API allows registering new types of buckets for non-default liquids. The bucket API allows registering new types of buckets for non-default liquids.
bucket.register_liquid( bucket.register_liquid(
"default:lava_source", -- name of the source node "default:lava_source", -- name of the source node
"default:lava_flowing", -- name of the flowing node "default:lava_flowing", -- name of the flowing node
@ -27,34 +30,31 @@ The bucket API allows registering new types of buckets for non-default liquids.
Beds API Beds API
-------- --------
beds.register_bed( beds.register_bed(
"beds:bed", -- Bed name "beds:bed", -- Bed name
def: See [#Bed definition] -- Bed definition def -- See [#Bed definition]
) )
beds.read_spawns() -- returns a table containing players respawn positions * `beds.read_spawns() ` Returns a table containing players respawn positions
beds.kick_players() -- forces all players to leave bed * `beds.kick_players()` Forces all players to leave bed
beds.skip_night() -- sets world time to morning and saves respawn position of all players currently sleeping * `beds.skip_night()` Sets world time to morning and saves respawn position of all players currently sleeping
###Bed definition
#Bed definition
---------------
{ {
description = "Simple Bed", description = "Simple Bed",
inventory_image = "beds_bed.png", inventory_image = "beds_bed.png",
wield_image = "beds_bed.png", wield_image = "beds_bed.png",
tiles = { tiles = {
bottom = {[Tile definition], bottom = {'Tile definition'}, -- the tiles of the bottom part of the bed.
^ the tiles of the bottom part of the bed top = {Tile definition} -- the tiles of the bottom part of the bed.
},
top = {[Tile definition],
^ the tiles of the bottom part of the bed
}
}, },
nodebox = { nodebox = {
bottom = regular nodebox, see [Node boxes], -- bottm part of bed bottom = 'regular nodebox', -- bottom part of bed (see [Node boxes])
top = regular nodebox, see [Node boxes], -- top part of bed top = 'regular nodebox', -- top part of bed (see [Node boxes])
}, },
selectionbox = regular nodebox, see [Node boxes], -- for both nodeboxes selectionbox = 'regular nodebox', -- for both nodeboxes (see [Node boxes])
recipe = { -- Craft recipe recipe = { -- Craft recipe
{"group:wool", "group:wool", "group:wool"}, {"group:wool", "group:wool", "group:wool"},
{"group:wood", "group:wood", "group:wood"} {"group:wood", "group:wood", "group:wood"}
@ -63,65 +63,121 @@ Beds API
Doors API Doors API
--------- ---------
The doors mod allows modders to register custom doors and trapdoors. The doors mod allows modders to register custom doors and trapdoors.
doors.register_door(name, def) `doors.register_door(name, def)`
^ name: "Door name"
^ def: See [#Door definition]
-> Registers new door
doors.register_trapdoor(name, def) * Registers new door
^ name: "Trapdoor name" * `name` Name for door
^ def: See [#Trapdoor definition] * `def` See [#Door definition]
-> Registers new trapdoor
`doors.register_trapdoor(name, def)`
* Registers new trapdoor
* `name` Name for trapdoor
* `def` See [#Trapdoor definition]
`doors.register_fencegate(name, def)`
* Registers new fence gate
* `name` Name for fence gate
* `def` See [#Fence gate definition]
`doors.get(pos)`
* `pos` A position as a table, e.g `{x = 1, y = 1, z = 1}`
* Returns an ObjecRef to a door, or nil if the position does not contain a door
###Methods
:open(player) -- Open the door object, returns if door was opened
:close(player) -- Close the door object, returns if door was closed
:toggle(player) -- Toggle the door state, returns if state was toggled
:state() -- returns the door state, true = open, false = closed
the "player" parameter can be omitted in all methods. If passed then
the usual permission checks will be performed to make sure the player
has the permissions needed to open this door. If omitted then no
permission checks are performed.
###Door definition
#Door definition
----------------
{
description = "Door description", description = "Door description",
inventory_image = "mod_door_inv.png", inventory_image = "mod_door_inv.png",
groups = {group = 1}, groups = {choppy = 2},
tiles_bottom: [Tile definition], tiles = {"mod_door.png"}, -- UV map.
^ the tiles of the bottom part of the door {front, side} recipe = craftrecipe,
tiles_top: [Tile definition], sounds = default.node_sound_wood_defaults(), -- optional
^ the tiles of the bottom part of the door {front, side} sound_open = sound play for open door, -- optional
node_box_bottom = regular nodebox, see [Node boxes], OPTIONAL, sound_close = sound play for close door, -- optional
node_box_top = regular nodebox, see [Node boxes], OPTIONAL, protected = false, -- If true, only placer can open the door (locked for others)
selection_box_bottom = regular nodebox, see [Node boxes], OPTIONAL,
selection_box_top = regular nodebox, see [Node boxes], OPTIONAL,
sound_open_door = sound play for open door, OPTIONAL,
sound_close_door = sound play for close door, OPTIONAL,
only_placer_can_open = true/false,
^ If true, only placer can open the door (locked for others)
}
#Trapdoor definition ###Trapdoor definition
----------------
{ description = "Trapdoor description",
tile_front = "doors_trapdoor.png", inventory_image = "mod_trapdoor_inv.png",
^ the texture for the front and back of the trapdoor groups = {choppy = 2},
tile_side: "doors_trapdoor_side.png", tile_front = "doors_trapdoor.png", -- the texture for the front and back of the trapdoor
^ the tiles of the four side parts of the trapdoor tile_side = "doors_trapdoor_side.png", -- the tiles of the four side parts of the trapdoor
sound_open = sound to play when opening the trapdoor, OPTIONAL, sounds = default.node_sound_wood_defaults(), -- optional
sound_close = sound to play when closing the trapdoor, OPTIONAL, sound_open = sound play for open door, -- optional
-> You can add any other node definition properties for minetest.register_node, sound_close = sound play for close door, -- optional
such as wield_image, inventory_image, sounds, groups, description, ... protected = false, -- If true, only placer can open the door (locked for others)
Only node_box, selection_box, tiles, drop, drawtype, paramtype, paramtype2, on_rightclick
will be overwritten by the trapdoor registration function ###Fence gate definition
}
description = "Wooden Fence Gate",
texture = "default_wood.png",
material = "default:wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults(), -- optional
Fence API
---------
Allows creation of new fences with "fencelike" drawtype.
`default.register_fence(name, item definition)`
Registers a new fence. Custom fields texture and material are required, as
are name and description. The rest is optional. You can pass most normal
nodedef fields here except drawtype. The fence group will always be added
for this node.
###fence definition
name = "default:fence_wood",
description = "Wooden Fence",
texture = "default_wood.png",
material = "default:wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults(),
#Walls API
---------
The walls API allows easy addition of stone auto-connecting wall nodes.
walls.register(name, desc, texture, mat, sounds)
^ name = "walls:stone_wall". Node name.
^ desc = "A Stone wall"
^ texture = "default_stone.png"
^ mat = "default:stone". Used to auto-generate crafting recipe.
^ sounds = sounds: see [#Default sounds]
Farming API Farming API
----------- -----------
The farming API allows you to easily register plants and hoes. The farming API allows you to easily register plants and hoes.
farming.register_hoe(name, hoe definition) `farming.register_hoe(name, hoe definition)`
-> Register a new hoe, see [#hoe definition] * Register a new hoe, see [#hoe definition]
`farming.register_plant(name, Plant definition)`
* Register a new growing plant, see [#Plant definition]
###Hoe Definition
farming.register_plant(name, Plant definition)
-> Register a new growing plant, see [#Plant definition]
#Hoe Definition
---------------
{ {
description = "", -- Description for tooltip description = "", -- Description for tooltip
inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image
@ -134,90 +190,104 @@ farming.register_plant(name, Plant definition)
} }
} }
#Plant definition ###Plant definition
-----------------
{ {
description = "", -- Description of seed item description = "", -- Description of seed item
inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image
steps = 8, -- How many steps the plant has to grow, until it can be harvested steps = 8, -- How many steps the plant has to grow, until it can be harvested
^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber) -- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
minlight = 13, -- Minimum light to grow minlight = 13, -- Minimum light to grow
maxlight = default.LIGHT_MAX -- Maximum light to grow maxlight = default.LIGHT_MAX -- Maximum light to grow
} }
Fire API
--------
`on_burn(pos)`
* Called when fire attempts to remove a burning node.
* `pos` Position of the burning node.
Screwdriver API Screwdriver API
--------------- ---------------
The screwdriver API allows you to control a node's behaviour when a screwdriver is used on it. The screwdriver API allows you to control a node's behaviour when a screwdriver is used on it.
To use it, add the on_screwdriver function to the node definition. To use it, add the `on_screwdriver` function to the node definition.
on_rotate(pos, node, user, mode, new_param2)
^ pos: position of the node that the screwdriver is being used on `on_rotate(pos, node, user, mode, new_param2)`
^ node: that node
^ user: the player who used the screwdriver * `pos` Position of the node that the screwdriver is being used on
^ mode: screwdriver.ROTATE_FACE or screwdriver.ROTATE_AXIS * `node` that node
^ new_param2: the new value of param2 that would have been set if on_rotate wasn't there * `user` The player who used the screwdriver
^ return value: false to disallow rotation, nil to keep default behaviour, true to allow * `mode` screwdriver.ROTATE_FACE or screwdriver.ROTATE_AXIS
* `new_param2` the new value of param2 that would have been set if on_rotate wasn't there
* return value: false to disallow rotation, nil to keep default behaviour, true to allow
it but to indicate that changed have already been made (so the screwdriver will wear out) it but to indicate that changed have already been made (so the screwdriver will wear out)
^ use on_rotate = screwdriver.disallow to always disallow rotation * use `on_rotate = screwdriver.disallow` to always disallow rotation
^ use on_rotate = screwdriver.rotate_simple to allow only face rotation * use `on_rotate = screwdriver.rotate_simple` to allow only face rotation
Stairs API Stairs API
---------- ----------
The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those
delivered with Minetest Game, to keep them compatible with other mods. delivered with Minetest Game, to keep them compatible with other mods.
stairs.register_stair(subname, recipeitem, groups, images, description, sounds) `stairs.register_stair(subname, recipeitem, groups, images, description, sounds)`
-> Registers a stair.
-> subname: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
-> recipeitem: Item used in the craft recipe, e.g. "default:cobble"
-> groups: see [Known damage and digging time defining groups]
-> images: see [Tile definition]
-> description: used for the description field in the stair's definition
-> sounds: see [#Default sounds]
stairs.register_slab(subname, recipeitem, groups, images, description, sounds) * Registers a stair.
-> Registers a slabs * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
-> subname: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname" * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble"
-> recipeitem: Item used in the craft recipe, e.g. "default:cobble" * `groups`: see [Known damage and digging time defining groups]
-> groups: see [Known damage and digging time defining groups] * `images`: see [Tile definition]
-> images: see [Tile definition] * `description`: used for the description field in the stair's definition
-> description: used for the description field in the stair's definition * `sounds`: see [#Default sounds]
-> sounds: see [#Default sounds]
stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds) `stairs.register_slab(subname, recipeitem, groups, images, description, sounds)`
-> A wrapper for stairs.register_stair and stairs.register_slab
-> Uses almost the same arguments as stairs.register_stair * Registers a slabs
-> desc_stair: Description for stair node * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
-> desc_slab: Description for slab node * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble"
* `groups`: see [Known damage and digging time defining groups]
* `images`: see [Tile definition]
* `description`: used for the description field in the stair's definition
* `sounds`: see [#Default sounds]
`stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)`
* A wrapper for stairs.register_stair and stairs.register_slab
* Uses almost the same arguments as stairs.register_stair
* `desc_stair`: Description for stair node
* `desc_slab`: Description for slab node
Xpanes API Xpanes API
---------- ----------
Creates panes that automatically connect to each other Creates panes that automatically connect to each other
xpanes.register_pane(subname, def) `xpanes.register_pane(subname, def)`
-> subname: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}"
-> def: See [#Pane definition] * `subname`: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}"
* `def`: See [#Pane definition]
###Pane definition
#Pane definition
----------------
{ {
textures = {"texture_Bottom_top", "texture_left_right", "texture_front_back"}, textures = {"texture_Bottom_top", "texture_left_right", "texture_front_back"}, -- More tiles aren't supported
^ More tiles aren't supported groups = {group = rating}, -- Uses the known node groups, see [Known damage and digging time defining groups]
groups = {group = rating}, sounds = SoundSpec, -- See [#Default sounds]
^ Uses the known node groups, see [Known damage and digging time defining groups] recipe = {{"","","","","","","","",""}}, -- Recipe field only
sounds = SoundSpec,
^ See [#Default sounds]
recipe = {{"","","","","","","","",""}},
^ Recipe field only
} }
Raillike definitions Raillike definitions
-------------------- --------------------
The following nodes use the group `connect_to_raillike` and will only connect to The following nodes use the group `connect_to_raillike` and will only connect to
raillike nodes within this group and the same group value. raillike nodes within this group and the same group value.
Use `minetest.raillike_group(<Name>)` to get the group value. Use `minetest.raillike_group(<Name>)` to get the group value.
| Node type | Raillike group name | Node type | Raillike group name
+-----------------------+-------------------- |-----------------------|---------------------
| default:rail | "rail" | default:rail | "rail"
| tnt:gunpowder | "gunpowder" | tnt:gunpowder | "gunpowder"
| tnt:gunpowder_burning | "gunpowder" | tnt:gunpowder_burning | "gunpowder"
@ -230,57 +300,64 @@ of your node.
Default sounds Default sounds
-------------- --------------
Sounds inside the default table can be used within the sounds field of node definitions. Sounds inside the default table can be used within the sounds field of node definitions.
default.node_sound_defaults() * `default.node_sound_defaults()`
default.node_sound_stone_defaults() * `default.node_sound_stone_defaults()`
default.node_sound_dirt_defaults() * `default.node_sound_dirt_defaults()`
default.node_sound_sand_defaults() * `default.node_sound_sand_defaults()`
default.node_sound_wood_defaults() * `default.node_sound_wood_defaults()`
default.node_sound_leaves_defaults() * `default.node_sound_leaves_defaults()`
default.node_sound_glass_defaults() * `default.node_sound_glass_defaults()`
Default constants Default constants
----------------- -----------------
default.LIGHT_MAX
^ The maximum light level (see [Node definition] light_source) `default.LIGHT_MAX` The maximum light level (see [Node definition] light_source)
Player API Player API
---------- ----------
The player API can register player models and update the player's appearence The player API can register player models and update the player's appearence
default.player_register_model(name, def) `default.player_register_model(name, def)`
^ Register a new model to be used by players.
-> name: model filename such as "character.x", "foo.b3d", etc.
-> def: See [#Model definition]
default.registered_player_models[name] * Register a new model to be used by players.
^ Get a model's definition * name: model filename such as "character.x", "foo.b3d", etc.
-> see [#Model definition] * def: See [#Model definition]
default.player_set_model(player, model_name) `default.registered_player_models[name]`
^ Change a player's model
-> player: PlayerRef
-> model_name: model registered with player_register_model()
default.player_set_animation(player, anim_name [, speed]) * Get a model's definition
^ Applies an animation to a player * see [#Model definition]
-> anim_name: name of the animation.
-> speed: frames per second. If nil, default from the model is used
default.player_set_textures(player, textures) `default.player_set_model(player, model_name)`
^ Sets player textures
-> player: PlayerRef * Change a player's model
-> textures: array of textures * `player`: PlayerRef
^ If <textures> is nil, the default textures from the model def are used * `model_name`: model registered with player_register_model()
`default.player_set_animation(player, anim_name [, speed])`
* Applies an animation to a player
* anim_name: name of the animation.
* speed: frames per second. If nil, default from the model is used
`default.player_set_textures(player, textures)`
* Sets player textures
* `player`: PlayerRef
* `textures`: array of textures, If `textures` is nil, the default textures from the model def are used
default.player_get_animation(player) default.player_get_animation(player)
^ Returns a table containing fields "model", "textures" and "animation".
^ Any of the fields of the returned table may be nil.
-> player: PlayerRef
Model Definition * Returns a table containing fields `model`, `textures` and `animation`.
---------------- * Any of the fields of the returned table may be nil.
* player: PlayerRef
###Model Definition
{ {
animation_speed = 30, -- Default animation speed, in FPS. animation_speed = 30, -- Default animation speed, in FPS.
textures = {"character.png", }, -- Default array of textures. textures = {"character.png", }, -- Default array of textures.
@ -295,103 +372,116 @@ Model Definition
Leafdecay Leafdecay
--------- ---------
To enable leaf decay for a node, add it to the "leafdecay" group.
The rating of the group determines how far from a node in the group "tree" To enable leaf decay for a node, add it to the `leafdecay` group.
The rating of the group determines how far from a node in the group `tree`
the node can be without decaying. the node can be without decaying.
If param2 of the node is ~= 0, the node will always be preserved. Thus, if If `param2` of the node is ~= 0, the node will always be preserved. Thus, if
the player places a node of that kind, you will want to set param2=1 or so. the player places a node of that kind, you will want to set `param2 = 1` or so.
The function default.after_place_leaves can be set as after_place_node of a node The function `default.after_place_leaves` can be set as `after_place_node of a node`
to set param2 to 1 if the player places the node (should not be used for nodes to set param2 to 1 if the player places the node (should not be used for nodes
that use param2 otherwise (e.g. facedir)). that use param2 otherwise (e.g. facedir)).
If the node is in the leafdecay_drop group then it will always be dropped as an If the node is in the `leafdecay_drop` group then it will always be dropped as an
item. item.
Dyes Dyes
---- ----
To make recipes that will work with any dye ever made by anybody, define To make recipes that will work with any dye ever made by anybody, define
them based on groups. You can select any group of groups, based on your need for them based on groups. You can select any group of groups, based on your need for
amount of colors. amount of colors.
#Color groups ###Color groups
-------------
Base color groups:
- basecolor_white
- basecolor_grey
- basecolor_black
- basecolor_red
- basecolor_yellow
- basecolor_green
- basecolor_cyan
- basecolor_blue
- basecolor_magenta
Extended color groups (* = equal to a base color): Base color groups:
* excolor_white
- excolor_lightgrey * `basecolor_white`
* excolor_grey * `basecolor_grey`
- excolor_darkgrey * `basecolor_black`
* excolor_black * `basecolor_red`
* excolor_red * `basecolor_yellow`
- excolor_orange * `basecolor_green`
* excolor_yellow * `basecolor_cyan`
- excolor_lime * `basecolor_blue`
* excolor_green * `basecolor_magenta`
- excolor_aqua
* excolor_cyan Extended color groups ( * means also base color )
- excolor_sky_blue
* excolor_blue * `excolor_white` *
- excolor_violet * `excolor_lightgrey`
* excolor_magenta * `excolor_grey` *
- excolor_red_violet * `excolor_darkgrey`
* `excolor_black` *
* `excolor_red` *
* `excolor_orange`
* `excolor_yellow` *
* `excolor_lime`
* `excolor_green` *
* `excolor_aqua`
* `excolor_cyan` *
* `excolor_sky_blue`
* `excolor_blue` *
* `excolor_violet`
* `excolor_magenta` *
* `excolor_red_violet`
The whole unifieddyes palette as groups: The whole unifieddyes palette as groups:
- unicolor_<excolor>
* `unicolor_<excolor>`
For the following, no white/grey/black is allowed: For the following, no white/grey/black is allowed:
- unicolor_medium_<excolor>
- unicolor_dark_<excolor> * `unicolor_medium_<excolor>`
- unicolor_light_<excolor> * `unicolor_dark_<excolor>`
- unicolor_<excolor>_s50 * `unicolor_light_<excolor>`
- unicolor_medium_<excolor>_s50 * `unicolor_<excolor>_s50`
- unicolor_dark_<excolor>_s50 * `unicolor_medium_<excolor>_s50`
* `unicolor_dark_<excolor>_s50`
Example of one shapeless recipe using a color group: Example of one shapeless recipe using a color group:
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = '<mod>:item_yellow', output = '<mod>:item_yellow',
recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'}, recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
}) })
#Color lists ###Color lists
------------
dye.basecolors
^ Array containing the names of available base colors
dye.excolors * `dye.basecolors` are an array containing the names of available base colors
^ Array containing the names of the available extended colors
* `dye.excolors` are an array containing the names of the available extended colors
Trees Trees
----- -----
default.grow_tree(pos, is_apple_tree)
^ Grows a mgv6 tree or apple tree at pos
default.grow_jungle_tree(pos) * `default.grow_tree(pos, is_apple_tree)`
^ Grows a mgv6 jungletree at pos * Grows a mgv6 tree or apple tree at pos
default.grow_pine_tree(pos) * `default.grow_jungle_tree(pos)`
^ Grows a mgv6 pinetree at pos * Grows a mgv6 jungletree at pos
default.grow_new_apple_tree(pos) * `default.grow_pine_tree(pos)`
^ Grows a new design apple tree at pos * Grows a mgv6 pinetree at pos
default.grow_new_jungle_tree(pos) * `default.grow_new_apple_tree(pos)`
^ Grows a new design jungle tree at pos * Grows a new design apple tree at pos
default.grow_new_pine_tree(pos) * `default.grow_new_jungle_tree(pos)`
^ Grows a new design pine tree at pos * Grows a new design jungle tree at pos
default.grow_new_acacia_tree(pos) * `default.grow_new_pine_tree(pos)`
^ Grows a new design acacia tree at pos * Grows a new design pine tree at pos
* `default.grow_new_acacia_tree(pos)`
* Grows a new design acacia tree at pos
* `default.grow_new_aspen_tree(pos)`
* Grows a new design aspen tree at pos
* `default.grow_new_snowy_pine_tree(pos)`
* Grows a new design snowy pine tree at pos

View File

@ -9,7 +9,13 @@
# 0 to disable # 0 to disable
#share_bones_time = 1200 #share_bones_time = 1200
# Whether fire should be disabled (all fire nodes will instantly disappear) # How much earlier the bones of a dead player can be looted by
# everyone if the player dies in a protected area they don't own.
# 0 to disable. By default it is "share_bones_time" divide by four.
#share_bones_time_early = 300
# Whether standard fire should be disabled ('basic flame' nodes will disappear)
# 'permanent flame' nodes will remain with either setting
#disable_fire = false #disable_fire = false
# Whether steel tools, torches and cobblestone should be given to new players # Whether steel tools, torches and cobblestone should be given to new players

View File

@ -13,6 +13,7 @@ are added to the creative inventory.
License of source code and media files: License of source code and media files:
--------------------------------------- ---------------------------------------
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com> Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
Copyright (C) 2016 Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com>
This program is free software. It comes without any warranty, to This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it the extent permitted by applicable law. You can redistribute it

View File

@ -1,18 +1,20 @@
-- minetest/creative/init.lua -- minetest/creative/init.lua
creative_inventory = {} creative = {}
local player_inventory = {}
-- Create detached creative inventory after loading all mods -- Create detached creative inventory after loading all mods
creative_inventory.init_creative_inventory = function(player) creative.init_creative_inventory = function(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
creative_inventory[player_name] = {} player_inventory[player_name] = {}
creative_inventory[player_name].size = 0 player_inventory[player_name].size = 0
creative_inventory[player_name].filter = nil player_inventory[player_name].filter = ""
creative_inventory[player_name].start_i = 1 player_inventory[player_name].start_i = 1
player_inventory[player_name].tab_id = 2
local inv = minetest.create_detached_inventory("creative_" .. player_name, { minetest.create_detached_inventory("creative_" .. player_name, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then if minetest.setting_getbool("creative_mode") and not to_list == "main" then
return count return count
else else
return 0 return 0
@ -33,16 +35,17 @@ creative_inventory.init_creative_inventory = function(player)
on_put = function(inv, listname, index, stack, player) on_put = function(inv, listname, index, stack, player)
end, end,
on_take = function(inv, listname, index, stack, player) on_take = function(inv, listname, index, stack, player)
--print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack)) local player_name, stack_name = player:get_player_name(), stack:get_name()
--print(player_name .. " takes item from creative inventory; listname = " .. listname .. ", index = " .. index .. ", stack = " .. dump(stack:to_table()))
if stack then if stack then
minetest.log("action", player:get_player_name().." takes "..dump(stack:get_name()).." from creative inventory") minetest.log("action", player_name .. " takes " .. stack_name .. " from creative inventory")
--print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count())) --print("Stack name: " .. stack_name .. ", Stack count: " .. stack:get_count())
end end
end, end,
}) })
creative_inventory.update(player_name, nil, 2) creative.update_creative_inventory(player_name)
--print("creative inventory size: "..dump(creative_inventory[player_name].size)) --print("creative inventory size: " .. player_inventory[player_name].size)
end end
local function tab_category(tab_id) local function tab_category(tab_id)
@ -58,22 +61,24 @@ local function tab_category(tab_id)
return id_category[tab_id] or id_category[2] return id_category[tab_id] or id_category[2]
end end
function creative_inventory.update(player_name, filter, tab_id) function creative.update_creative_inventory(player_name)
local creative_list = {} local creative_list = {}
local inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name}) local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
local inv = player_inventory[player_name]
for name, def in pairs(tab_category(tab_id)) do for name, def in pairs(tab_category(inv.tab_id)) do
if not (def.groups.not_in_creative_inventory == 1) and if not (def.groups.not_in_creative_inventory == 1) and
def.description and def.description ~= "" and def.description and def.description ~= "" and
(not filter or def.name:find(filter, 1, true)) then (def.name:find(inv.filter, 1, true) or
def.description:lower():find(inv.filter, 1, true)) then
creative_list[#creative_list+1] = name creative_list[#creative_list+1] = name
end end
end end
table.sort(creative_list) table.sort(creative_list)
inv:set_size("main", #creative_list) player_inv:set_size("main", #creative_list)
inv:set_list("main", creative_list) player_inv:set_list("main", creative_list)
creative_inventory[player_name].size = #creative_list inv.size = #creative_list
end end
-- Create the trash field -- Create the trash field
@ -87,38 +92,38 @@ local trash = minetest.create_detached_inventory("creative_trash", {
return 0 return 0
end end
end, end,
on_put = function(inv, listname, index, stack, player) on_put = function(inv, listname)
inv:set_stack(listname, index, "") inv:set_list(listname, {})
end, end,
}) })
trash:set_size("main", 1) trash:set_size("main", 1)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum, tab_id) creative.set_creative_formspec = function(player, start_i)
local player_name = player:get_player_name() local player_name = player:get_player_name()
local filter = creative_inventory[player_name].filter or "" local inv = player_inventory[player_name]
pagenum = math.floor(pagenum) local pagenum = math.floor(start_i / (3*8) + 1)
local pagemax = math.floor((creative_inventory[player_name].size - 1) / (3*8) + 1) local pagemax = math.ceil(inv.size / (3*8))
tab_id = tab_id or 2
player:set_inventory_formspec([[ player:set_inventory_formspec([[
size[8,8.6] size[8,8.6]
image[4.06,3.4;0.8,0.8;trash_icon.png] image[4.06,3.4;0.8,0.8;creative_trash_icon.png]
list[current_player;main;0,4.7;8,1;] list[current_player;main;0,4.7;8,1;]
list[current_player;main;0,5.85;8,3;8] list[current_player;main;0,5.85;8,3;8]
list[detached:creative_trash;main;4,3.3;1,1;] list[detached:creative_trash;main;4,3.3;1,1;]
listring[]
tablecolumns[color;text;color;text] tablecolumns[color;text;color;text]
tableoptions[background=#00000000;highlight=#00000000;border=false] tableoptions[background=#00000000;highlight=#00000000;border=false]
button[5.4,3.2;0.8,0.9;creative_prev;<] button[5.4,3.2;0.8,0.9;creative_prev;<]
button[7.25,3.2;0.8,0.9;creative_next;>] button[7.25,3.2;0.8,0.9;creative_next;>]
button[2.1,3.4;0.8,0.5;search;?] button[2.1,3.4;0.8,0.5;creative_search;?]
button[2.75,3.4;0.8,0.5;clear;X] button[2.75,3.4;0.8,0.5;creative_clear;X]
tooltip[search;Search] tooltip[creative_search;Search]
tooltip[clear;Reset] tooltip[creative_clear;Reset]
listring[current_player;main] listring[current_player;main]
]] .. ]] ..
"field[0.3,3.5;2.2,1;filter;;".. filter .."]".. "field[0.3,3.5;2.2,1;creative_filter;;" .. inv.filter .. "]" ..
"listring[detached:creative_" .. player_name .. ";main]" .. "listring[detached:creative_" .. player_name .. ";main]" ..
"tabheader[0,0;tabs;Crafting,All,Nodes,Tools,Items;".. tostring(tab_id) ..";true;false]".. "tabheader[0,0;creative_tabs;Crafting,All,Nodes,Tools,Items;" .. tostring(inv.tab_id) .. ";true;false]" ..
"list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" .. "list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" ..
"table[6.05,3.35;1.15,0.5;pagenum;#FFFF00," .. tostring(pagenum) .. ",#FFFFFF,/ " .. tostring(pagemax) .. "]" .. "table[6.05,3.35;1.15,0.5;pagenum;#FFFF00," .. tostring(pagenum) .. ",#FFFFFF,/ " .. tostring(pagemax) .. "]" ..
default.get_hotbar_bg(0,4.7) .. default.get_hotbar_bg(0,4.7) ..
@ -126,7 +131,7 @@ creative_inventory.set_creative_formspec = function(player, start_i, pagenum, ta
) )
end end
creative_inventory.set_crafting_formspec = function(player) creative.set_crafting_formspec = function(player)
player:set_inventory_formspec([[ player:set_inventory_formspec([[
size[8,8.6] size[8,8.6]
list[current_player;craft;2,0.75;3,3;] list[current_player;craft;2,0.75;3,3;]
@ -134,9 +139,9 @@ creative_inventory.set_crafting_formspec = function(player)
list[current_player;main;0,4.7;8,1;] list[current_player;main;0,4.7;8,1;]
list[current_player;main;0,5.85;8,3;8] list[current_player;main;0,5.85;8,3;8]
list[detached:creative_trash;main;0,2.75;1,1;] list[detached:creative_trash;main;0,2.75;1,1;]
image[0.06,2.85;0.8,0.8;trash_icon.png] image[0.06,2.85;0.8,0.8;creative_trash_icon.png]
image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270] image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270]
tabheader[0,0;tabs;Crafting,All,Nodes,Tools,Items;1;true;false] tabheader[0,0;creative_tabs;Crafting,All,Nodes,Tools,Items;1;true;false]
listring[current_player;main] listring[current_player;main]
listring[current_player;craft] listring[current_player;craft]
]] .. ]] ..
@ -150,64 +155,68 @@ minetest.register_on_joinplayer(function(player)
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
return return
end end
creative_inventory.init_creative_inventory(player) creative.init_creative_inventory(player)
creative_inventory.set_creative_formspec(player, 0, 1, 2) creative.set_creative_formspec(player, 0)
end) end)
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.setting_getbool("creative_mode") then if formname ~= "" or not minetest.setting_getbool("creative_mode") then
return return
end end
-- Figure out current page from formspec
local player_name = player:get_player_name() local player_name = player:get_player_name()
local formspec = player:get_inventory_formspec() local inv = player_inventory[player_name]
local filter = formspec:match("filter;;([%w_:]+)") or ""
local start_i = formspec:match("list%[detached:creative_".. player_name ..";.*;(%d+)%]")
local tab_id = tonumber(formspec:match("tabheader%[.*;(%d+)%;.*%]"))
local inv_size = creative_inventory[player_name].size
start_i = tonumber(start_i) or 0
if fields.quit then if fields.quit then
if tab_id == 1 then if inv.tab_id == 1 then
creative_inventory.set_crafting_formspec(player) creative.set_crafting_formspec(player)
end end
elseif fields.tabs then elseif fields.creative_tabs then
if tonumber(fields.tabs) == 1 then local tab = tonumber(fields.creative_tabs)
creative_inventory.set_crafting_formspec(player) inv.tab_id = tab
if tab == 1 then
creative.set_crafting_formspec(player)
else else
creative_inventory.update(player_name, filter, tonumber(fields.tabs)) creative.update_creative_inventory(player_name)
creative_inventory.set_creative_formspec(player, 0, 1, tonumber(fields.tabs)) creative.set_creative_formspec(player, 0)
end end
elseif fields.clear then elseif fields.creative_clear then
creative_inventory[player_name].filter = "" inv.filter = ""
creative_inventory.update(player_name, nil, tab_id) creative.update_creative_inventory(player_name)
creative_inventory.set_creative_formspec(player, 0, 1, tab_id) creative.set_creative_formspec(player, 0)
elseif fields.search then elseif fields.creative_search then
creative_inventory[player_name].filter = fields.filter:lower() inv.filter = fields.creative_filter:lower()
creative_inventory.update(player_name, fields.filter:lower(), tab_id) creative.update_creative_inventory(player_name)
creative_inventory.set_creative_formspec(player, 0, 1, tab_id) creative.set_creative_formspec(player, 0)
else else
local formspec = player:get_inventory_formspec()
local start_i = formspec:match("list%[.-" .. player_name .. ";.-;(%d+)%]")
start_i = tonumber(start_i) or 0
if fields.creative_prev then if fields.creative_prev then
start_i = start_i - 3*8 start_i = start_i - 3*8
if start_i < 0 then if start_i < 0 then
start_i = inv_size - (inv_size % (3*8)) start_i = inv.size - (inv.size % (3*8))
if inv_size == start_i then if inv.size == start_i then
start_i = math.max(0, inv_size - (3*8)) start_i = math.max(0, inv.size - (3*8))
end end
end end
elseif fields.creative_next then elseif fields.creative_next then
start_i = start_i + 3*8 start_i = start_i + 3*8
if start_i >= inv_size then if start_i >= inv.size then
start_i = 0 start_i = 0
end end
end end
creative_inventory.set_creative_formspec(player, start_i, start_i / (3*8) + 1, tab_id) creative.set_creative_formspec(player, start_i)
end end
end) end)
if minetest.setting_getbool("creative_mode") then if minetest.setting_getbool("creative_mode") then
local digtime = 0.5 local digtime = 0.5
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 3}
minetest.register_item(":", { minetest.register_item(":", {
type = "none", type = "none",
wield_image = "wieldhand.png", wield_image = "wieldhand.png",
@ -217,11 +226,11 @@ if minetest.setting_getbool("creative_mode") then
full_punch_interval = 0.5, full_punch_interval = 0.5,
max_drop_level = 3, max_drop_level = 3,
groupcaps = { groupcaps = {
crumbly = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, crumbly = caps,
cracky = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, cracky = caps,
snappy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, snappy = caps,
choppy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, choppy = caps,
oddly_breakable_by_hand = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, oddly_breakable_by_hand = caps,
}, },
damage_groups = {fleshy = 10}, damage_groups = {fleshy = 10},
} }

View File

@ -27,7 +27,6 @@ Cisoun's WTFPL texture pack:
default_lava.png default_lava.png
default_leaves.png default_leaves.png
default_sapling.png default_sapling.png
default_sign_wall.png
default_stone.png default_stone.png
default_tree.png default_tree.png
default_tree_top.png default_tree_top.png
@ -59,7 +58,6 @@ VanessaE (WTFPL):
default_desert_sand.png default_desert_sand.png
default_desert_stone.png default_desert_stone.png
default_sand.png default_sand.png
default_jungletree_top.png
Calinou (CC BY-SA): Calinou (CC BY-SA):
default_brick.png default_brick.png
@ -100,28 +98,29 @@ Zeg9 (CC BY-SA 3.0):
default_gold_block.png default_gold_block.png
paramat (CC BY-SA 3.0): paramat (CC BY-SA 3.0):
wieldhand.png, derived from character.png by Jordach (CC BY-SA 3.0) wieldhand.png copied from character.png by Jordach (CC BY-SA 3.0)
default_pinetree.png default_pinetree.png
default_pinetree_top.png default_pinetree_top.png
default_pinewood.png default_pinewood.png
default_sandstone_brick.png
default_obsidian_brick.png
default_river_water.png
default_river_water_source_animated.png
default_river_water_flowing_animated.png
default_acacia_leaves.png default_acacia_leaves.png
default_acacia_sapling.png default_acacia_sapling.png
default_acacia_tree.png default_acacia_tree.png
default_acacia_tree_top.png default_acacia_tree_top.png
default_acacia_wood.png default_acacia_wood.png
default_junglewood.png
default_jungletree_top.png
default_sandstone_brick.png
default_obsidian_brick.png
default_stone_brick.png
default_desert_stone_brick.png
default_river_water.png
default_river_water_source_animated.png
default_river_water_flowing_animated.png
default_dry_grass.png default_dry_grass.png
default_dry_grass_side.png default_dry_grass_side.png
default_dry_grass_*.png default_dry_grass_*.png
default_junglewood.png, derived from a texture by BlockMen (CC BY-SA 3.0) default_grass.png
default_grass.png, derived from a texture by Philipbenr (CC BY-SA 3.0) default_grass_side.png
default_grass_side.png, derived from a texture by Philipbenr (CC BY-SA 3.0)
default_stone_brick.png, derived from a texture by Cisoun (WTFPL)
default_desert_stone_brick.png, derived from a texture by VanessaE (WTFPL)
brunob.santos (CC BY-SA 4.0): brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png default_desert_cobble.png
@ -156,6 +155,9 @@ sofar (CC BY-SA 3.0):
default_aspen_tree_top, derived from default_pine_tree_top (by paramat) default_aspen_tree_top, derived from default_pine_tree_top (by paramat)
default_aspen_wood, derived from default_pine_wood (by paramat) default_aspen_wood, derived from default_pine_wood (by paramat)
sofar (WTFPL):
default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel
Neuromancer (CC BY-SA 2.0): Neuromancer (CC BY-SA 2.0):
default_cobble.png, based on texture by Brane praefect default_cobble.png, based on texture by Brane praefect
default_mossycobble.png, based on texture by Brane praefect default_mossycobble.png, based on texture by Brane praefect
@ -174,6 +176,9 @@ Gambit (WTFPL):
default_grass_*.png default_grass_*.png
default_paper.png default_paper.png
default_diamond_block.png default_diamond_block.png
default_ladder_steel.png
default_sign_wall_wood.png
default_flint.png
asl97 (WTFPL): asl97 (WTFPL):
default_ice.png default_ice.png

View File

@ -23,7 +23,7 @@ minetest.register_alias("bookshelf", "default:bookshelf")
minetest.register_alias("glass", "default:glass") minetest.register_alias("glass", "default:glass")
minetest.register_alias("wooden_fence", "default:fence_wood") minetest.register_alias("wooden_fence", "default:fence_wood")
minetest.register_alias("rail", "default:rail") minetest.register_alias("rail", "default:rail")
minetest.register_alias("ladder", "default:ladder") minetest.register_alias("ladder", "default:ladder_wood")
minetest.register_alias("wood", "default:wood") minetest.register_alias("wood", "default:wood")
minetest.register_alias("mese", "default:mese") minetest.register_alias("mese", "default:mese")
minetest.register_alias("cloud", "default:cloud") minetest.register_alias("cloud", "default:cloud")
@ -32,7 +32,7 @@ minetest.register_alias("water_source", "default:water_source")
minetest.register_alias("lava_flowing", "default:lava_flowing") minetest.register_alias("lava_flowing", "default:lava_flowing")
minetest.register_alias("lava_source", "default:lava_source") minetest.register_alias("lava_source", "default:lava_source")
minetest.register_alias("torch", "default:torch") minetest.register_alias("torch", "default:torch")
minetest.register_alias("sign_wall", "default:sign_wall") minetest.register_alias("sign_wall", "default:sign_wall_wood")
minetest.register_alias("furnace", "default:furnace") minetest.register_alias("furnace", "default:furnace")
minetest.register_alias("chest", "default:chest") minetest.register_alias("chest", "default:chest")
minetest.register_alias("locked_chest", "default:chest_locked") minetest.register_alias("locked_chest", "default:chest_locked")
@ -68,9 +68,13 @@ minetest.register_alias("steel_ingot", "default:steel_ingot")
minetest.register_alias("clay_brick", "default:clay_brick") minetest.register_alias("clay_brick", "default:clay_brick")
minetest.register_alias("snow", "default:snow") minetest.register_alias("snow", "default:snow")
-- 'mese_block' was used for a while for the block form of mese
minetest.register_alias("default:mese_block", "default:mese")
-- Aliases for corrected pine node names -- Aliases for corrected pine node names
minetest.register_alias("default:pinetree", "default:pine_tree") minetest.register_alias("default:pinetree", "default:pine_tree")
minetest.register_alias("default:pinewood", "default:pine_wood") minetest.register_alias("default:pinewood", "default:pine_wood")
-- Mese now comes in the form of blocks, ore, crystal and fragments minetest.register_alias("default:ladder", "default:ladder_wood")
minetest.register_alias("default:mese", "default:mese_block") minetest.register_alias("default:sign_wall", "default:sign_wall_wood")

View File

@ -50,48 +50,16 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:fence_wood 2', output = 'default:sign_wall_steel 3',
recipe = { recipe = {
{'default:stick', 'default:stick', 'default:stick'}, {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:stick', 'default:stick', 'default:stick'}, {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'', 'group:stick', ''},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "default:fence_cobble 16", output = 'default:sign_wall_wood 3',
recipe = {
{"default:cobble", "default:cobble", "default:cobble"},
{"default:cobble", "default:cobble", "default:cobble"},
}
})
minetest.register_craft({
output = "default:fence_desert_cobble 16",
recipe = {
{"default:desert_cobble", "default:desert_cobble", "default:desert_cobble"},
{"default:desert_cobble", "default:desert_cobble", "default:desert_cobble"},
}
})
minetest.register_craft({
output = "default:fence_steelblock 16",
recipe = {
{"default:steelblock", "default:steelblock", "default:steelblock"},
{"default:steelblock", "default:steelblock", "default:steelblock"},
}
})
minetest.register_craft({
output = "default:fence_brick 16",
recipe = {
{"default:brick", "default:brick", "default:brick"},
{"default:brick", "default:brick", "default:brick"},
}
})
minetest.register_craft({
output = 'default:sign_wall',
recipe = { recipe = {
{'group:wood', 'group:wood', 'group:wood'}, {'group:wood', 'group:wood', 'group:wood'},
{'group:wood', 'group:wood', 'group:wood'}, {'group:wood', 'group:wood', 'group:wood'},
@ -100,7 +68,7 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:torch 5', output = 'default:torch 4',
recipe = { recipe = {
{'default:coal_lump'}, {'default:coal_lump'},
{'group:stick'}, {'group:stick'},
@ -468,20 +436,11 @@ minetest.register_craft({ -- Ultimate Warrior weapon
}) })
minetest.register_craft({ minetest.register_craft({
output = "default:sword_nyan", output = 'default:rail 24',
recipe = {
{"default:nyancat"},
{"default:nyancat"},
{"group:stick"},
}
})
minetest.register_craft({
output = 'default:rail 16',
recipe = { recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'default:steel_ingot', 'group:stick', 'default:steel_ingot'}, {'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
{'default:steel_ingot', 'group:stick', 'default:steel_ingot'}, {'default:steel_ingot', '', 'default:steel_ingot'},
{'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
} }
}) })
@ -498,7 +457,7 @@ minetest.register_craft({
output = 'default:chest_locked', output = 'default:chest_locked',
recipe = { recipe = {
{'group:wood', 'group:wood', 'group:wood'}, {'group:wood', 'group:wood', 'group:wood'},
{'group:wood', 'group:ingot', 'group:wood'}, {'group:wood', 'default:steel_ingot', 'group:wood'},
{'group:wood', 'group:wood', 'group:wood'}, {'group:wood', 'group:wood', 'group:wood'},
} }
}) })
@ -644,44 +603,9 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:sand', output = 'default:sand 4',
recipe = { recipe = {
{'default:desert_sand'}, {'default:sandstone'},
}
})
minetest.register_craft({
output = "default:desert_sand",
recipe = {
{"default:sand"},
}
})
minetest.register_craft({
output = "default:desert_stone 2",
recipe = {
{"default:desert_sand", "default:desert_sand"},
{"default:desert_sand", "default:desert_sand"},
}
})
minetest.register_craft({
output = "default:sand",
recipe = {
{"default:gravel"},
}
})
minetest.register_craft({
output = "default:dirt 4",
type = "shapeless",
recipe = {"default:gravel", "default:gravel", "default:gravel", "default:gravel"}
})
minetest.register_craft({
output = "default:gravel",
recipe = {
{"default:cobble"},
} }
}) })
@ -693,56 +617,71 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "default:clay", output = "default:desert_sand",
recipe = { recipe = {
{"default:clay_lump", "default:clay_lump", "default:clay_lump"}, {"default:sand"},
{"default:clay_lump", "default:clay_lump", "default:clay_lump"}, }
{"default:clay_lump", "default:clay_lump", "default:clay_lump"}, })
minetest.register_craft({
output = 'default:clay',
recipe = {
{'default:clay_lump', 'default:clay_lump'},
{'default:clay_lump', 'default:clay_lump'},
}
})
minetest.register_craft({
output = 'default:clay_lump 4',
recipe = {
{'default:clay'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:brick', output = 'default:brick',
recipe = { recipe = {
{"default:clay_brick", "default:clay_brick", "default:clay_brick"}, {'default:clay_brick', 'default:clay_brick'},
{"default:clay_brick", "default:clay_brick", "default:clay_brick"}, {'default:clay_brick', 'default:clay_brick'},
{"default:clay_brick", "default:clay_brick", "default:clay_brick"},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:clay_brick 9', output = 'default:clay_brick 4',
recipe = { recipe = {
{'default:brick'}, {'default:brick'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "default:clay_lump 9", output = 'default:paper',
recipe = {{"default:clay"},} recipe = {
{'default:papyrus', 'default:papyrus', 'default:papyrus'},
}
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless",
output = 'default:paper 4',
recipe = {'default:papyrus', 'default:papyrus', 'default:papyrus'},
})
minetest.register_craft({
type = "shapeless",
output = 'default:book', output = 'default:book',
recipe = {'default:paper', 'default:paper', 'default:paper'} recipe = {
{'default:paper'},
{'default:paper'},
{'default:paper'},
}
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless",
output = 'default:bookshelf', output = 'default:bookshelf',
recipe = {'group:wood', 'group:wood', 'group:wood', 'default:book', 'default:book', 'default:book', 'group:wood', 'group:wood', 'group:wood'} recipe = {
{'group:wood', 'group:wood', 'group:wood'},
{'default:book', 'default:book', 'default:book'},
{'group:wood', 'group:wood', 'group:wood'},
}
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:ladder 3', output = 'default:ladder_wood 3',
recipe = { recipe = {
{'group:stick', '', 'group:stick'}, {'group:stick', '', 'group:stick'},
{'group:stick', 'group:stick', 'group:stick'}, {'group:stick', 'group:stick', 'group:stick'},
@ -750,6 +689,15 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = 'default:ladder_steel 15',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', '', 'default:steel_ingot'},
}
})
minetest.register_craft({ minetest.register_craft({
output = 'default:mese', output = 'default:mese',
recipe = { recipe = {
@ -773,6 +721,35 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = "default:sand",
recipe = {
{"default:gravel"},
}
})
minetest.register_craft({
output = "default:dirt 4",
type = "shapeless",
recipe = {"default:gravel", "default:gravel", "default:gravel", "default:gravel"}
})
minetest.register_craft({
output = "default:gravel",
recipe = {
{"default:cobble"},
}
})
minetest.register_craft({
output = "default:desert_stone 2",
recipe = {
{"default:desert_sand", "default:desert_sand"},
{"default:desert_sand", "default:desert_sand"},
}
})
minetest.register_craft({ minetest.register_craft({
output = 'default:meselamp 1', output = 'default:meselamp 1',
recipe = { recipe = {
@ -798,7 +775,7 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:obsidianbrick 2', output = 'default:obsidianbrick 4',
recipe = { recipe = {
{'default:obsidian', 'default:obsidian'}, {'default:obsidian', 'default:obsidian'},
{'default:obsidian', 'default:obsidian'} {'default:obsidian', 'default:obsidian'}
@ -833,13 +810,14 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
output = 'default:snowblock', output = 'default:snowblock',
recipe = { recipe = {
{'default:snow', 'default:snow'}, {'default:snow', 'default:snow', 'default:snow'},
{'default:snow', 'default:snow'}, {'default:snow', 'default:snow', 'default:snow'},
{'default:snow', 'default:snow', 'default:snow'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:snow 4', output = 'default:snow 9',
recipe = { recipe = {
{'default:snowblock'}, {'default:snowblock'},
} }
@ -856,7 +834,7 @@ minetest.register_craft({
-- --
minetest.register_craft({ minetest.register_craft({
type = "toolrepair", type = "toolrepair",
additional_wear = -0.15, additional_wear = -0.02,
}) })
-- --
@ -878,13 +856,13 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "default:stone", output = "default:stone",
recipe = "default:mossycobble", recipe = "default:cobble",
}) })
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "default:stone", output = "default:stone",
recipe = "default:cobble", recipe = "default:mossycobble",
}) })
minetest.register_craft({ minetest.register_craft({
@ -978,7 +956,31 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:ladder", recipe = "default:fence_acacia_wood",
burntime = 15,
})
minetest.register_craft({
type = "fuel",
recipe = "default:fence_junglewood",
burntime = 15,
})
minetest.register_craft({
type = "fuel",
recipe = "default:fence_pine_wood",
burntime = 15,
})
minetest.register_craft({
type = "fuel",
recipe = "default:fence_aspen_wood",
burntime = 15,
})
minetest.register_craft({
type = "fuel",
recipe = "default:ladder_wood",
burntime = 3, burntime = 3,
}) })
@ -1002,7 +1004,7 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:sign_wall", recipe = "default:sign_wall_wood",
burntime = 15, burntime = 15,
}) })

View File

@ -4,26 +4,35 @@ minetest.register_craftitem("default:stick", {
description = "Stick", description = "Stick",
stack_max = 1000, stack_max = 1000,
inventory_image = "default_stick.png", inventory_image = "default_stick.png",
wield_image = "default_stick.png^[transformR90",
groups = {stick = 1}, groups = {stick = 1},
}) })
minetest.register_craftitem("default:paper", { minetest.register_craftitem("default:paper", {
description = "Paper", description = "Paper",
wield_scale = {x = 1, y = 1, z = 0.25},
inventory_image = "default_paper.png", inventory_image = "default_paper.png",
}) })
local function book_on_use(itemstack, user, pointed_thing) local function book_on_use(itemstack, user)
local player_name = user:get_player_name() local player_name = user:get_player_name()
local data = minetest.deserialize(itemstack:get_metadata()) local data = minetest.deserialize(itemstack:get_metadata())
local title, text, owner = "", "", player_name local formspec, title, text, owner = "", "", "", player_name
local page, page_max, cpp = 1, 1, 650
if data then if data then
title, text, owner = data.title, data.text, data.owner title = data.title
text = data.text
owner = data.owner
if data.page then
page = data.page
page_max = data.page_max
cpp = data.chars_per_page
end end
local formspec end
if owner == player_name then if owner == player_name then
formspec = "size[8,8]" .. default.gui_bg .. formspec = "size[8,8]" .. default.gui_bg ..
default.gui_bg_img ..
"field[0.5,1;7.5,0;title;Title:;" .. "field[0.5,1;7.5,0;title;Title:;" ..
minetest.formspec_escape(title) .. "]" .. minetest.formspec_escape(title) .. "]" ..
"textarea[0.5,1.5;7.5,7;text;Contents:;" .. "textarea[0.5,1.5;7.5,7;text;Contents:;" ..
@ -31,21 +40,27 @@ local function book_on_use(itemstack, user, pointed_thing)
"button_exit[2.5,7.5;3,1;save;Save]" "button_exit[2.5,7.5;3,1;save;Save]"
else else
formspec = "size[8,8]" .. default.gui_bg .. formspec = "size[8,8]" .. default.gui_bg ..
default.gui_bg_img ..
"label[0.5,0.5;by " .. owner .. "]" .. "label[0.5,0.5;by " .. owner .. "]" ..
"label[0.5,0;"..minetest.formspec_escape(title).."]".. "tablecolumns[color;text]" ..
"tableoptions[background=#00000000;highlight=#00000000;border=false]" .. "tableoptions[background=#00000000;highlight=#00000000;border=false]" ..
"table[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text):gsub("\n", ",")..";1]" "table[0.4,0;7,0.5;title;#FFFF00," .. minetest.formspec_escape(title) .. "]" ..
end "textarea[0.5,1.5;7.5,7;;" .. minetest.formspec_escape(text:sub(
minetest.show_formspec(user:get_player_name(), "default:book", formspec) (cpp * page) - cpp, cpp * page)) .. ";]" ..
"button[2.4,7.6;0.8,0.8;book_prev;<]" ..
"label[3.2,7.7;Page " .. page .. " of " .. page_max .. "]" ..
"button[4.9,7.6;0.8,0.8;book_next;>]"
end end
minetest.register_on_player_receive_fields(function(player, form_name, fields) minetest.show_formspec(player_name, "default:book", formspec)
if form_name ~= "default:book" or not fields.save or
fields.title == "" or fields.text == "" then
return
end end
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "default:book" then return end
local inv = player:get_inventory() local inv = player:get_inventory()
local stack = player:get_wielded_item() local stack = player:get_wielded_item()
if fields.save and fields.title ~= "" and fields.text ~= "" then
local new_stack, data local new_stack, data
if stack:get_name() ~= "default:book_written" then if stack:get_name() ~= "default:book_written" then
local count = stack:get_count() local count = stack:get_count()
@ -58,11 +73,17 @@ minetest.register_on_player_receive_fields(function(player, form_name, fields)
else else
data = minetest.deserialize(stack:get_metadata()) data = minetest.deserialize(stack:get_metadata())
end end
if not data then data = {} end if not data then data = {} end
data.title = fields.title data.title = fields.title
data.text = fields.text data.text = fields.text
data.text_len = fields.text:len()
data.page = 1
data.chars_per_page = 650
data.page_max = math.ceil(data.text_len / data.chars_per_page)
data.owner = player:get_player_name() data.owner = player:get_player_name()
local data_str = minetest.serialize(data) local data_str = minetest.serialize(data)
if new_stack then if new_stack then
new_stack:set_metadata(data_str) new_stack:set_metadata(data_str)
if inv:room_for_item("main", new_stack) then if inv:room_for_item("main", new_stack) then
@ -73,7 +94,29 @@ minetest.register_on_player_receive_fields(function(player, form_name, fields)
else else
stack:set_metadata(data_str) stack:set_metadata(data_str)
end end
player:set_wielded_item(stack) player:set_wielded_item(stack)
elseif fields.book_next or fields.book_prev then
local data = minetest.deserialize(stack:get_metadata())
if not data.page then return end
if fields.book_next then
data.page = data.page + 1
if data.page > data.page_max then
data.page = 1
end
else
data.page = data.page - 1
if data.page == 0 then
data.page = data.page_max
end
end
local data_str = minetest.serialize(data)
stack:set_metadata(data_str)
book_on_use(stack, player)
end
end) end)
minetest.register_craftitem("default:book", { minetest.register_craftitem("default:book", {
@ -123,23 +166,18 @@ end)
minetest.register_craftitem("default:coal_lump", { minetest.register_craftitem("default:coal_lump", {
description = "Coal Lump", description = "Coal Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_coal_lump.png", inventory_image = "default_coal_lump.png",
groups = {coal = 1} groups = {coal = 1}
}) })
minetest.register_craftitem("default:iron_lump", { minetest.register_craftitem("default:iron_lump", {
description = "Iron Lump", description = "Iron Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_iron_lump.png", inventory_image = "default_iron_lump.png",
groups = {ingot_lump = 1},
}) })
minetest.register_craftitem("default:copper_lump", { minetest.register_craftitem("default:copper_lump", {
description = "Copper Lump", description = "Copper Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_copper_lump.png", inventory_image = "default_copper_lump.png",
groups = {ingot_lump = 1},
}) })
minetest.register_craftitem("default:mese_crystal", { minetest.register_craftitem("default:mese_crystal", {
@ -149,9 +187,7 @@ minetest.register_craftitem("default:mese_crystal", {
minetest.register_craftitem("default:gold_lump", { minetest.register_craftitem("default:gold_lump", {
description = "Gold Lump", description = "Gold Lump",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_gold_lump.png", inventory_image = "default_gold_lump.png",
groups = {ingot_lump = 1},
}) })
minetest.register_craftitem("default:diamond", { minetest.register_craftitem("default:diamond", {
@ -162,34 +198,29 @@ minetest.register_craftitem("default:diamond", {
minetest.register_craftitem("default:clay_lump", { minetest.register_craftitem("default:clay_lump", {
description = "Clay Lump", description = "Clay Lump",
stack_max = 200, stack_max = 200,
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_clay_lump.png", inventory_image = "default_clay_lump.png",
}) })
minetest.register_craftitem("default:steel_ingot", { minetest.register_craftitem("default:steel_ingot", {
description = "Steel Ingot", description = "Steel Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_steel_ingot.png", inventory_image = "default_steel_ingot.png",
groups = {ingot = 1}, groups = {ingot = 1},
}) })
minetest.register_craftitem("default:copper_ingot", { minetest.register_craftitem("default:copper_ingot", {
description = "Copper Ingot", description = "Copper Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_copper_ingot.png", inventory_image = "default_copper_ingot.png",
groups = {ingot = 1}, groups = {ingot = 1},
}) })
minetest.register_craftitem("default:bronze_ingot", { minetest.register_craftitem("default:bronze_ingot", {
description = "Bronze Ingot", description = "Bronze Ingot",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_bronze_ingot.png", inventory_image = "default_bronze_ingot.png",
groups = {ingot = 1}, groups = {ingot = 1},
}) })
minetest.register_craftitem("default:gold_ingot", { minetest.register_craftitem("default:gold_ingot", {
description = "Gold Ingot", description = "Gold Ingot",
wield_scale = {x = 1, y = 1, z = 2},
groups = {ingot = 1}, groups = {ingot = 1},
inventory_image = "default_gold_ingot.png" inventory_image = "default_gold_ingot.png"
}) })
@ -201,7 +232,6 @@ minetest.register_craftitem("default:mese_crystal_fragment", {
minetest.register_craftitem("default:clay_brick", { minetest.register_craftitem("default:clay_brick", {
description = "Clay Brick", description = "Clay Brick",
wield_scale = {x = 1, y = 1, z = 2},
inventory_image = "default_clay_brick.png", inventory_image = "default_clay_brick.png",
}) })
@ -214,3 +244,9 @@ minetest.register_craftitem("default:obsidian_shard", {
description = "Obsidian Shard", description = "Obsidian Shard",
inventory_image = "default_obsidian_shard.png", inventory_image = "default_obsidian_shard.png",
}) })
minetest.register_craftitem("default:flint", {
description = "Flint",
inventory_image = "default_flint.png"
})

View File

@ -7,40 +7,20 @@
function default.node_sound_defaults(table) function default.node_sound_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep or table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.6} {name = "", gain = 1.0}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.7}
table.dug = table.dug or table.dug = table.dug or
{name = "default_hard_footstep", gain = 0.8} {name = "default_dug_node", gain = 0.25}
table.place = table.place or table.place = table.place or
{name = "default_hard_footstep", gain = 0.8} {name = "default_place_node_hard", gain = 1.0}
return table return table
end end
function default.node_sound_stone_defaults(table) function default.node_sound_stone_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep or table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.6} {name = "default_hard_footstep", gain = 0.5}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.7}
table.dug = table.dug or table.dug = table.dug or
{name = "default_hard_footstep", gain = 0.8} {name = "default_hard_footstep", gain = 1.0}
table.place = table.place or
{name = "default_hard_footstep", gain = 0.8}
default.node_sound_defaults(table)
return table
end
function default.node_sound_metal_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_metal_footstep", gain = 0.575}
table.dig = table.dig or
{name = "default_metal_footstep", gain = 0.65}
table.dug = table.dug or
{name = "default_metal_footstep", gain = 0.8}
table.place = table.place or
{name = "default_metal_footstep", gain = 0.8}
default.node_sound_defaults(table) default.node_sound_defaults(table)
return table return table
end end
@ -48,27 +28,11 @@ end
function default.node_sound_dirt_defaults(table) function default.node_sound_dirt_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep or table.footstep = table.footstep or
{name = "default_dirt_footstep", gain = 0.8} {name = "default_dirt_footstep", gain = 1.0}
table.dig = table.dig or
{name = "default_dirt_footstep", gain = 0.9}
table.dug = table.dug or table.dug = table.dug or
{name = "default_dirt_footstep", gain = 1.0} {name = "default_dirt_footstep", gain = 1.5}
table.place = table.place or table.place = table.place or
{name = "default_dirt_footstep", gain = 1.0} {name = "default_place_node", gain = 1.0}
default.node_sound_defaults(table)
return table
end
function default.node_sound_gravel_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_dirt_footstep", gain = 0.8}
table.dig = table.dig or
{name = "default_dirt_footstep", gain = 0.9}
table.dug = table.dug or
{name = "default_dirt_footstep", gain = 1.0}
table.place = table.place or
{name = "default_dirt_footstep", gain = 1.0}
default.node_sound_defaults(table) default.node_sound_defaults(table)
return table return table
end end
@ -76,13 +40,11 @@ end
function default.node_sound_sand_defaults(table) function default.node_sound_sand_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep or table.footstep = table.footstep or
{name = "default_sand_footstep", gain = 0.6} {name = "default_sand_footstep", gain = 0.12}
table.dig = table.dig or
{name = "default_sand_footstep", gain = 0.7}
table.dug = table.dug or table.dug = table.dug or
{name = "default_sand_footstep", gain = 0.8} {name = "default_sand_footstep", gain = 0.24}
table.place = table.place or table.place = table.place or
{name = "default_sand_footstep", gain = 0.8} {name = "default_place_node", gain = 1.0}
default.node_sound_defaults(table) default.node_sound_defaults(table)
return table return table
end end
@ -90,13 +52,9 @@ end
function default.node_sound_wood_defaults(table) function default.node_sound_wood_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep or table.footstep = table.footstep or
{name = "default_wood_footstep", gain = 0.625} {name = "default_wood_footstep", gain = 0.5}
table.dig = table.dig or
{name = "default_wood_footstep", gain = 0.7}
table.dug = table.dug or table.dug = table.dug or
{name = "default_wood_footstep", gain = 0.8} {name = "default_wood_footstep", gain = 1.0}
table.place = table.place or
{name = "default_wood_footstep", gain = 0.8}
default.node_sound_defaults(table) default.node_sound_defaults(table)
return table return table
end end
@ -104,13 +62,13 @@ end
function default.node_sound_leaves_defaults(table) function default.node_sound_leaves_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep or table.footstep = table.footstep or
{name = "default_grass_footstep", gain = 0.6} {name = "default_grass_footstep", gain = 0.35}
table.dig = table.dig or
{name = "default_grass_footstep", gain = 0.7}
table.dug = table.dug or table.dug = table.dug or
{name = "default_snow_footstep", gain = 0.8} {name = "default_grass_footstep", gain = 0.7}
table.dig = table.dig or
{name = "default_dig_crumbly", gain = 0.4}
table.place = table.place or table.place = table.place or
{name = "default_snow_footstep", gain = 0.8} {name = "default_place_node", gain = 1.0}
default.node_sound_defaults(table) default.node_sound_defaults(table)
return table return table
end end
@ -118,13 +76,9 @@ end
function default.node_sound_glass_defaults(table) function default.node_sound_glass_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep or table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.55} {name = "default_glass_footstep", gain = 0.5}
table.dig = table.dig or
{name = "default_hard_footstep", gain = 0.65}
table.dug = table.dug or table.dug = table.dug or
{name = "default_break_glass", gain = 0.8} {name = "default_break_glass", gain = 1.0}
table.place = table.place or
{name = "default_hard_footstep", gain = 0.75}
default.node_sound_defaults(table) default.node_sound_defaults(table)
return table return table
end end
@ -134,67 +88,24 @@ end
-- Lavacooling -- Lavacooling
-- --
local function cool_wf_vm(pos, node1, node2) default.cool_lava = function(pos, node)
local t1 = os.clock() if node.name == "default:lava_source" then
local minp = vector.subtract(pos, 10)
local maxp = vector.add(pos, 10)
local manip = minetest.get_voxel_manip()
local emerged_pos1, emerged_pos2 = manip:read_from_map(minp, maxp)
local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
local nodes = manip:get_data()
local stone = minetest.get_content_id(node2)
local lava = minetest.get_content_id(node1)
for i in area:iterp(minp, maxp) do
local p = area:position(i)
if nodes[i] == lava and minetest.find_node_near(p, 1, {"group:water"}) then
nodes[i] = stone
end
end
manip:set_data(nodes)
manip:write_to_map()
-- minetest.log("action", "Lava cooling happened at (" .. pos.x .. "," .. pos.y .. "," .. pos.z .. ").")
local t1 = os.clock()
manip:update_map()
-- minetest.log("action", string.format("Lava cooling updated the map after ca. %.2fs.", os.clock() - t1))
end
local del1 = 0
local count = 0
default.cool_lava_source = function(pos)
minetest.set_node(pos, {name = "default:obsidian"}) minetest.set_node(pos, {name = "default:obsidian"})
minetest.sound_play("default_cool_lava", else -- Lava flowing
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
default.cool_lava_flowing = function(pos)
minetest.set_node(pos, {name = "default:stone"}) minetest.set_node(pos, {name = "default:stone"})
end
minetest.sound_play("default_cool_lava", minetest.sound_play("default_cool_lava",
{pos = pos, max_hear_distance = 16, gain = 0.25}) {pos = pos, max_hear_distance = 16, gain = 0.25})
end end
minetest.register_abm({ minetest.register_abm({
nodenames = {"default:lava_flowing"}, nodenames = {"default:lava_source", "default:lava_flowing"},
neighbors = {"group:water"}, neighbors = {"group:water"},
interval = 1, interval = 1,
chance = 2, chance = 1,
catch_up = false, catch_up = false,
action = function(...) action = function(...)
default.cool_lava_flowing(...) default.cool_lava(...)
end,
})
minetest.register_abm({
nodenames = {"default:lava_source"},
neighbors = {"group:water"},
interval = 1,
chance = 2,
catch_up = false,
action = function(...)
default.cool_lava_source(...)
end, end,
}) })
@ -254,8 +165,8 @@ end
minetest.register_abm({ minetest.register_abm({
nodenames = {"default:cactus"}, nodenames = {"default:cactus"},
neighbors = {"group:sand", "default:dirt_with_dry_grass"}, --MFF neighbors = {"group:sand", "default:dirt_with_dry_grass"}, --MFF
interval = 60, interval = 12,
chance = 25, chance = 83,
action = function(...) action = function(...)
default.grow_cactus(...) default.grow_cactus(...)
end end
@ -264,8 +175,8 @@ minetest.register_abm({
minetest.register_abm({ minetest.register_abm({
nodenames = {"default:papyrus"}, nodenames = {"default:papyrus"},
neighbors = {"default:dirt", "default:dirt_with_grass", "default:sand", "default:desert_sand"}, --MFF neighbors = {"default:dirt", "default:dirt_with_grass", "default:sand", "default:desert_sand"}, --MFF
interval = 60, interval = 14,
chance = 25, chance = 71,
action = function(...) action = function(...)
default.grow_papyrus(...) default.grow_papyrus(...)
end end
@ -286,6 +197,62 @@ function default.dig_up(pos, node, digger)
end end
--
-- Fence registration helper
--
function default.register_fence(name, def)
minetest.register_craft({
output = name .. " 4",
recipe = {
{ def.material, 'group:stick', def.material },
{ def.material, 'group:stick', def.material },
}
})
local fence_texture = "default_fence_overlay.png^" .. def.texture ..
"^default_fence_overlay.png^[makealpha:255,126,126"
-- Allow almost everything to be overridden
local default_fields = {
paramtype = "light",
drawtype = "nodebox",
node_box = {
type = "connected",
fixed = {{-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}},
-- connect_top =
-- connect_bottom =
connect_front = {{-1/16,3/16,-1/2,1/16,5/16,-1/8},
{-1/16,-5/16,-1/2,1/16,-3/16,-1/8}},
connect_left = {{-1/2,3/16,-1/16,-1/8,5/16,1/16},
{-1/2,-5/16,-1/16,-1/8,-3/16,1/16}},
connect_back = {{-1/16,3/16,1/8,1/16,5/16,1/2},
{-1/16,-5/16,1/8,1/16,-3/16,1/2}},
connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16},
{1/8,-5/16,-1/16,1/2,-3/16,1/16}},
},
connects_to = {"group:fence", "group:wood", "group:tree"},
inventory_image = fence_texture,
wield_image = fence_texture,
tiles = {def.texture},
sunlight_propagates = true,
is_ground_content = false,
groups = {},
}
for k, v in pairs(default_fields) do
if not def[k] then
def[k] = v
end
end
-- Always add to the fence group, even if no group provided
def.groups.fence = 1
def.texture = nil
def.material = nil
minetest.register_node(name, def)
end
-- --
-- Leafdecay -- Leafdecay
-- --
@ -302,17 +269,19 @@ minetest.register_globalstep(function(dtime)
end) end)
default.after_place_leaves = function(pos, placer, itemstack, pointed_thing) default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
if placer and not placer:get_player_control().sneak then
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
node.param2 = 1 node.param2 = 1
minetest.set_node(pos, node) minetest.set_node(pos, node)
end end
end
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:leafdecay"}, nodenames = {"group:leafdecay"},
neighbors = {"air", "group:liquid"}, neighbors = {"air", "group:liquid"},
-- A low interval and a high inverse chance spreads the load -- A low interval and a high inverse chance spreads the load
interval = 1, interval = 2,
chance = 2, chance = 5,
action = function(p0, node, _, _) action = function(p0, node, _, _)
--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")") --print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
@ -399,14 +368,15 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack
end) end)
-- --
-- Grass growing -- Grass growing on well-lit dirt
-- --
minetest.register_abm({ minetest.register_abm({
nodenames = {"default:dirt"}, nodenames = {"default:dirt"},
neighbors = {"air"},
interval = 6,
chance = 67,
catch_up = false, catch_up = false,
interval = 30,
chance = 5,
action = function(pos, node) action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z} local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local name = minetest.get_node(above).name local name = minetest.get_node(above).name
@ -431,8 +401,8 @@ minetest.register_abm({
minetest.register_abm({ minetest.register_abm({
nodenames = {"default:dirt_with_grass", "default:dirt_with_dry_grass"}, nodenames = {"default:dirt_with_grass", "default:dirt_with_dry_grass"},
interval = 2, interval = 8,
chance = 20, chance = 50,
catch_up = false, catch_up = false,
action = function(pos, node) action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z} local above = {x = pos.x, y = pos.y + 1, z = pos.z}
@ -454,7 +424,7 @@ minetest.register_abm({
minetest.register_abm({ minetest.register_abm({
nodenames = {"default:cobble"}, nodenames = {"default:cobble"},
neighbors = {"group:water"}, neighbors = {"group:water"},
interval = 17, interval = 16,
chance = 200, chance = 200,
catch_up = false, catch_up = false,
action = function(pos, node) action = function(pos, node)

View File

@ -90,6 +90,137 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
return stack:get_count() return stack:get_count()
end end
local function swap_node(pos, name)
local node = minetest.get_node(pos)
if node.name == name then
return
end
node.name = name
minetest.swap_node(pos, node)
end
local function furnace_node_timer(pos, elapsed)
--
-- Inizialize metadata
--
local meta = minetest.get_meta(pos)
local fuel_time = meta:get_float("fuel_time") or 0
local src_time = meta:get_float("src_time") or 0
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
local inv = meta:get_inventory()
local srclist = inv:get_list("src")
local fuellist = inv:get_list("fuel")
local dstlist = inv:get_list("dst")
--
-- Cooking
--
-- Check if we have cookable content
local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
local cookable = true
if cooked.time == 0 then
cookable = false
end
-- Check if we have enough fuel to burn
if fuel_time < fuel_totaltime then
-- The furnace is currently active and has enough fuel
fuel_time = fuel_time + 1
-- If there is a cookable item then check if it is ready yet
if cookable then
src_time = src_time + 1
if src_time >= cooked.time then
-- Place result in dst list if possible
if inv:room_for_item("dst", cooked.item) then
inv:add_item("dst", cooked.item)
inv:set_stack("src", 1, aftercooked.items[1])
src_time = 0
end
end
end
else
-- Furnace ran out of fuel
if cookable then
-- We need to get new fuel
local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
if fuel.time == 0 then
-- No valid fuel in fuel list
fuel_totaltime = 0
fuel_time = 0
src_time = 0
else
-- Take fuel from fuel list
inv:set_stack("fuel", 1, afterfuel.items[1])
fuel_totaltime = fuel.time
fuel_time = 0
end
else
-- We don't need to get new fuel since there is no cookable item
fuel_totaltime = 0
fuel_time = 0
src_time = 0
end
end
--
-- Update formspec, infotext and node
--
local formspec = inactive_formspec
local item_state = ""
local item_percent = 0
if cookable then
item_percent = math.floor(src_time / cooked.time * 100)
item_state = item_percent .. "%"
else
if srclist[1]:is_empty() then
item_state = "Empty"
else
item_state = "Not cookable"
end
end
local fuel_state = "Empty"
local active = "inactive "
local result = false
if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then
active = "active "
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
fuel_state = fuel_percent .. "%"
formspec = active_formspec(fuel_percent, item_percent)
swap_node(pos, "default:furnace_active")
-- make sure timer restarts automatically
result = true
else
if not fuellist[1]:is_empty() then
fuel_state = "0%"
end
swap_node(pos, "default:furnace")
-- stop timer on the inactive furnace
local timer = minetest.get_node_timer(pos)
timer:stop()
end
local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")"
--
-- Set meta values
--
meta:set_float("fuel_totaltime", fuel_totaltime)
meta:set_float("fuel_time", fuel_time)
meta:set_float("src_time", src_time)
meta:set_string("formspec", formspec)
meta:set_string("infotext", infotext)
return result
end
-- --
-- Node definitions -- Node definitions
-- --
@ -109,6 +240,27 @@ minetest.register_node("default:furnace", {
can_dig = can_dig, can_dig = can_dig,
on_timer = furnace_node_timer,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", inactive_formspec)
local inv = meta:get_inventory()
inv:set_size('src', 1)
inv:set_size('fuel', 1)
inv:set_size('dst', 4)
end,
on_metadata_inventory_move = function(pos)
local timer = minetest.get_node_timer(pos)
timer:start(1.0)
end,
on_metadata_inventory_put = function(pos)
-- start timer function, it will sort out whether furnace can burn or not.
local timer = minetest.get_node_timer(pos)
timer:start(1.0)
end,
allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move, allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
@ -138,6 +290,7 @@ minetest.register_node("default:furnace_active", {
legacy_facedir_simple = true, legacy_facedir_simple = true,
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_timer = furnace_node_timer,
can_dig = can_dig, can_dig = can_dig,

View File

@ -13,7 +13,7 @@ default.LIGHT_MAX = 14
-- GUI related stuff -- GUI related stuff
default.gui_bg = "bgcolor[#080808BB;true]" default.gui_bg = "bgcolor[#080808BB;true]"
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]" default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
default.gui_slots = "listcolors[#606060AA;#808080;#101010;#202020;#FFF]" default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
function default.get_hotbar_bg(x,y) function default.get_hotbar_bg(x,y)
local out = "" local out = ""
@ -31,8 +31,10 @@ default.gui_survival_form = "size[8,8.5]"..
"list[current_player;main;0,5.5;8,3;8]".. "list[current_player;main;0,5.5;8,3;8]"..
"list[current_player;craft;1.75,0.5;3,3;]".. "list[current_player;craft;1.75,0.5;3,3;]"..
"list[current_player;craftpreview;5.75,1.5;1,1;]".. "list[current_player;craftpreview;5.75,1.5;1,1;]"..
default.get_hotbar_bg(0,4.25).. "image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
default.get_hotbar_bg(0,5.25) "listring[current_player;main]"..
"listring[current_player;craft]"..
default.get_hotbar_bg(0,4.25)
-- Load files -- Load files
dofile(minetest.get_modpath("default").."/functions.lua") dofile(minetest.get_modpath("default").."/functions.lua")

View File

@ -31,10 +31,6 @@ minetest.register_alias("mapgen_pine_needles", "default:pine_needles")
-- Dungeons -- Dungeons
minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
minetest.register_alias("mapgen_mese", "default:mese")
minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal")
minetest.register_alias("mapgen_clay", "default:clay")
minetest.register_alias("mapgen_cobble", "default:cobble") minetest.register_alias("mapgen_cobble", "default:cobble")
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble") minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
minetest.register_alias("mapgen_mossycobble", "default:mossycobble") minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
@ -61,14 +57,14 @@ function default.register_ores()
clust_size = 7, clust_size = 7,
y_min = -15, y_min = -15,
y_max = 0, y_max = 0,
noise_treshold = 0.0, noise_threshold = 0.0,
noise_params = { noise_params = {
offset = 0.35, offset = 0.5,
scale = 0.2, scale = 0.2,
spread = {x = 5, y = 5, z = 5}, spread = {x = 5, y = 5, z = 5},
seed = -316, seed = -316,
octaves = 1, octaves = 1,
persist = 0.5 persist = 0.0
}, },
}) })
@ -83,14 +79,14 @@ function default.register_ores()
clust_size = 7, clust_size = 7,
y_min = -63, y_min = -63,
y_max = 4, y_max = 4,
noise_treshold = 0, noise_threshold = 0.0,
noise_params = { noise_params = {
offset = 0.35, offset = 0.5,
scale = 0.2, scale = 0.2,
spread = {x = 5, y = 5, z = 5}, spread = {x = 5, y = 5, z = 5},
seed = 2316, seed = 2316,
octaves = 1, octaves = 1,
persist = 0.5 persist = 0.0
}, },
}) })
@ -104,14 +100,14 @@ function default.register_ores()
clust_size = 7, clust_size = 7,
y_min = -63, y_min = -63,
y_max = 31000, y_max = 31000,
noise_treshold = 0, noise_threshold = 0.0,
noise_params = { noise_params = {
offset = 0.35, offset = 0.5,
scale = 0.2, scale = 0.2,
spread = {x = 5, y = 5, z = 5}, spread = {x = 5, y = 5, z = 5},
seed = 17676, seed = 17676,
octaves = 1, octaves = 1,
persist = 0.5 persist = 0.0
}, },
}) })
@ -125,14 +121,14 @@ function default.register_ores()
clust_size = 7, clust_size = 7,
y_min = -31000, y_min = -31000,
y_max = 31000, y_max = 31000,
noise_treshold = 0, noise_threshold = 0.0,
noise_params = { noise_params = {
offset = 0.35, offset = 0.5,
scale = 0.2, scale = 0.2,
spread = {x = 5, y = 5, z = 5}, spread = {x = 5, y = 5, z = 5},
seed = 766, seed = 766,
octaves = 1, octaves = 1,
persist = 0.5 persist = 0.0
}, },
}) })
@ -216,7 +212,6 @@ function default.register_ores()
clust_size = 3, clust_size = 3,
y_min = -30000, y_min = -30000,
y_max = -64, y_max = -64,
flags = "absheight",
}) })
minetest.register_ore({ minetest.register_ore({
@ -228,7 +223,6 @@ function default.register_ores()
clust_size = 6, clust_size = 6,
y_min = -30000, y_min = -30000,
y_max = -64, y_max = -64,
flags = "absheight",
}) })
minetest.register_ore({ minetest.register_ore({
@ -253,7 +247,6 @@ function default.register_ores()
clust_size = 2, clust_size = 2,
y_min = -255, y_min = -255,
y_max = -128, y_max = -128,
flags = "absheight",
}) })
minetest.register_ore({ minetest.register_ore({
@ -265,7 +258,6 @@ function default.register_ores()
clust_size = 3, clust_size = 3,
y_min = -1024, y_min = -1024,
y_max = -256, y_max = -256,
flags = "absheight",
}) })
minetest.register_ore({ minetest.register_ore({
@ -277,7 +269,6 @@ function default.register_ores()
clust_size = 2, clust_size = 2,
y_min = -30000, y_min = -30000,
y_max = -1024, y_max = -1024,
flags = "absheight",
}) })
minetest.register_ore({ minetest.register_ore({
@ -342,7 +333,6 @@ function default.register_ores()
clust_size = 2, clust_size = 2,
y_min = -255, y_min = -255,
y_max = -64, y_max = -64,
flags = "absheight",
}) })
minetest.register_ore({ minetest.register_ore({
@ -354,7 +344,6 @@ function default.register_ores()
clust_size = 3, clust_size = 3,
y_min = -30000, y_min = -30000,
y_max = -256, y_max = -256,
flags = "absheight",
}) })
-- Diamond -- Diamond
@ -368,7 +357,6 @@ function default.register_ores()
clust_size = 3, clust_size = 3,
y_min = -512, y_min = -512,
y_max = -256, y_max = -256,
flags = "absheight",
}) })
minetest.register_ore({ minetest.register_ore({
@ -380,7 +368,6 @@ function default.register_ores()
clust_size = 3, clust_size = 3,
y_min = -30000, y_min = -30000,
y_max = -512, y_max = -512,
flags = "absheight",
}) })
minetest.register_ore({ minetest.register_ore({
@ -427,7 +414,6 @@ function default.register_ores()
clust_size = 3, clust_size = 3,
y_min = -30000, y_min = -30000,
y_max = -64, y_max = -64,
flags = "absheight",
}) })
-- Gold Coins -- Gold Coins
@ -468,44 +454,6 @@ function default.register_ores()
y_max = 64, y_max = 64,
}) })
if minetest.setting_get("mg_name") == "indev" then
-- Floatlands and high mountains springs:
minetest.register_ore({
ore_type = "scatter",
ore = "default:water_source",
ore_param2 = 128,
wherein = "default:stone",
clust_scarcity = 40 *40 *40,
clust_num_ores = 8,
clust_size = 3,
y_min = 100,
y_max = 30000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:lava_source",
ore_param2 = 128,
wherein = "default:stone",
clust_scarcity = 50 * 50 * 50,
clust_num_ores = 5,
clust_size = 2,
y_min = 10000,
y_max = 30000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:sand",
wherein = "default:stone",
clust_scarcity = 20 * 20 * 20,
clust_num_ores = 5 * 5 * 3,
clust_size = 5,
y_min = 500,
y_max = 30000,
})
end
-- Underground springs: -- Underground springs:
minetest.register_ore({ minetest.register_ore({
@ -1165,10 +1113,6 @@ function default.register_biomes()
y_max = -113, y_max = -113,
heat_point = 50, heat_point = 50,
humidity_point = 50, humidity_point = 50,
node_underwater = "default:sand",
height_shore = 3,
node_shore_filler = "default:sand",
node_shore_top = "default:sand",
}) })
end end
@ -1200,7 +1144,7 @@ function default.register_mgv6_decorations()
y_max = 1, y_max = 1,
decoration = "default:papyrus", decoration = "default:papyrus",
height = 2, height = 2,
y_max = 4, height_max = 4,
spawn_by = "default:water_source", spawn_by = "default:water_source",
num_spawn_by = 1, num_spawn_by = 1,
}) })
@ -1223,7 +1167,7 @@ function default.register_mgv6_decorations()
y_max = 30, y_max = 30,
decoration = "default:cactus", decoration = "default:cactus",
height = 3, height = 3,
y_max = 4, height_max = 4,
}) })
-- Long grasses -- Long grasses
@ -1339,8 +1283,8 @@ function default.register_decorations()
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0.04, offset = 0.036,
scale = 0.02, scale = 0.022,
spread = {x = 250, y = 250, z = 250}, spread = {x = 250, y = 250, z = 250},
seed = 2, seed = 2,
octaves = 3, octaves = 3,
@ -1358,8 +1302,8 @@ function default.register_decorations()
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0.002, offset = 0.0018,
scale = 0.001, scale = 0.0011,
spread = {x = 250, y = 250, z = 250}, spread = {x = 250, y = 250, z = 250},
seed = 2, seed = 2,
octaves = 3, octaves = 3,
@ -1392,7 +1336,7 @@ function default.register_decorations()
deco_type = "schematic", deco_type = "schematic",
place_on = {"default:dirt_with_grass", "default:dirt"}, place_on = {"default:dirt_with_grass", "default:dirt"},
sidelen = 80, sidelen = 80,
fill_ratio = 0.09, fill_ratio = 0.1,
biomes = {"rainforest", "rainforest_swamp"}, biomes = {"rainforest", "rainforest_swamp"},
y_min = 0, y_min = 0,
y_max = 31000, y_max = 31000,
@ -1405,7 +1349,7 @@ function default.register_decorations()
deco_type = "schematic", deco_type = "schematic",
place_on = {"default:dirt_with_grass", "default:dirt"}, place_on = {"default:dirt_with_grass", "default:dirt"},
sidelen = 80, sidelen = 80,
fill_ratio = 0.01, fill_ratio = 0.005,
biomes = {"rainforest", "rainforest_swamp"}, biomes = {"rainforest", "rainforest_swamp"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
@ -1434,8 +1378,8 @@ function default.register_decorations()
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"}, place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0.04, offset = 0.036,
scale = 0.02, scale = 0.022,
spread = {x = 250, y = 250, z = 250}, spread = {x = 250, y = 250, z = 250},
seed = 2, seed = 2,
octaves = 3, octaves = 3,
@ -1452,7 +1396,14 @@ function default.register_decorations()
deco_type = "schematic", deco_type = "schematic",
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"}, place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
sidelen = 80, sidelen = 80,
fill_ratio = 0.003, noise_params = {
offset = 0.0018,
scale = 0.0011,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {"taiga", "coniferous_forest"}, biomes = {"taiga", "coniferous_forest"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
@ -1533,8 +1484,8 @@ function default.register_decorations()
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0.01, offset = 0.0,
scale = -0.02, scale = -0.015,
spread = {x = 250, y = 250, z = 250}, spread = {x = 250, y = 250, z = 250},
seed = 2, seed = 2,
octaves = 3, octaves = 3,
@ -1545,7 +1496,6 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
schematic = minetest.get_modpath("default").."/schematics/aspen_tree.mts", schematic = minetest.get_modpath("default").."/schematics/aspen_tree.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random",
}) })
minetest.register_decoration({ minetest.register_decoration({
@ -1553,8 +1503,8 @@ function default.register_decorations()
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0.0005, offset = 0.0,
scale = -0.001, scale = -0.0008,
spread = {x = 250, y = 250, z = 250}, spread = {x = 250, y = 250, z = 250},
seed = 2, seed = 2,
octaves = 3, octaves = 3,
@ -1621,7 +1571,7 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
decoration = "default:cactus", decoration = "default:cactus",
height = 2, height = 2,
y_max = 5, height_max = 5,
}) })
-- Papyrus -- Papyrus

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
minetestforfun_game/mods/default/schematics/pine_tree.mts Executable file → Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 827 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -5,7 +5,6 @@ minetest.register_item(":", {
type = "none", type = "none",
wield_image = "wieldhand.png", wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5}, wield_scale = {x=1,y=1,z=2.5},
range = 5,
tool_capabilities = { tool_capabilities = {
full_punch_interval = 0.8, full_punch_interval = 0.8,
max_drop_level = 0, max_drop_level = 0,

View File

@ -1,10 +1,10 @@
local random = math.random
-- --
-- Grow trees from saplings -- Grow trees from saplings
-- --
-- 'Can grow' function -- 'can grow' function
local random = math.random
function default.can_grow(pos) function default.can_grow(pos)
local node_under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z}) local node_under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
@ -16,22 +16,55 @@ function default.can_grow(pos)
if is_soil == 0 then if is_soil == 0 then
return false return false
end end
local ll = minetest.get_node_light(pos) local light_level = minetest.get_node_light(pos)
if not ll or ll < 13 then -- Minimum light level for growth if not light_level or light_level < 13 then
return false -- matches grass, wheat and cotton return false
end end
return true return true
end end
-- 'is snow nearby' function
local function is_snow_nearby(pos)
local x, y, z = pos.x, pos.y, pos.z
local c_snow = minetest.get_content_id("default:snow")
local c_snowblock = minetest.get_content_id("default:snowblock")
local c_dirtsnow = minetest.get_content_id("default:dirt_with_snow")
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map(
{x = x - 1, y = y - 1, z = z - 1},
{x = x + 1, y = y + 1, z = z + 1}
)
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
for yy = y - 1, y + 1 do
for zz = z - 1, z + 1 do
local vi = a:index(x - 1, yy, zz)
for xx = x - 1, x + 1 do
local nodid = data[vi]
if nodid == c_snow or nodid == c_snowblock or nodid == c_dirtsnow then
return true
end
vi = vi + 1
end
end
end
return false
end
-- Sapling ABM -- Sapling ABM
minetest.register_abm({ minetest.register_abm({
nodenames = {"default:sapling", "default:junglesapling", nodenames = {"default:sapling", "default:junglesapling",
"default:pine_sapling", "default:acacia_sapling", "default:pine_sapling", "default:acacia_sapling",
"default:aspen_sapling"}, "default:aspen_sapling"},
interval = 5, interval = 10,
chance = 40, chance = 50,
action = function(pos, node) action = function(pos, node)
if not default.can_grow(pos) then if not default.can_grow(pos) then
return return
@ -57,8 +90,11 @@ minetest.register_abm({
elseif node.name == "default:pine_sapling" then elseif node.name == "default:pine_sapling" then
minetest.log("action", "A pine sapling grows into a tree at ".. minetest.log("action", "A pine sapling grows into a tree at "..
minetest.pos_to_string(pos)) minetest.pos_to_string(pos))
local snow = is_snow_nearby(pos)
if mapgen == "v6" then if mapgen == "v6" then
default.grow_pine_tree(pos) default.grow_pine_tree(pos, snow)
elseif snow then
default.grow_new_snowy_pine_tree(pos)
else else
default.grow_new_pine_tree(pos) default.grow_new_pine_tree(pos)
end end
@ -199,7 +235,8 @@ function default.grow_jungle_tree(pos, bad)
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data() local data = vm:get_data()
add_trunk_and_leaves(data, a, pos, c_jungletree, c_jungleleaves, height, 3, 30, false) add_trunk_and_leaves(data, a, pos, c_jungletree, c_jungleleaves,
height, 3, 30, false)
-- Roots -- Roots
for z_dist = -1, 1 do for z_dist = -1, 1 do
@ -240,7 +277,7 @@ local function add_snow(data, vi, c_air, c_ignore, c_snow)
end end
end end
function default.grow_pine_tree(pos) function default.grow_pine_tree(pos, snow)
local x, y, z = pos.x, pos.y, pos.z local x, y, z = pos.x, pos.y, pos.z
local maxy = y + random(9, 13) -- Trunk top local maxy = y + random(9, 13) -- Trunk top
@ -249,32 +286,15 @@ function default.grow_pine_tree(pos)
local c_pine_tree = minetest.get_content_id("default:pine_tree") local c_pine_tree = minetest.get_content_id("default:pine_tree")
local c_pine_needles = minetest.get_content_id("default:pine_needles") local c_pine_needles = minetest.get_content_id("default:pine_needles")
local c_snow = minetest.get_content_id("default:snow") local c_snow = minetest.get_content_id("default:snow")
local c_snowblock = minetest.get_content_id("default:snowblock")
local c_dirtsnow = minetest.get_content_id("default:dirt_with_snow")
local vm = minetest.get_voxel_manip() local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map( local minp, maxp = vm:read_from_map(
{x = x - 3, y = y - 1, z = z - 3}, {x = x - 3, y = y, z = z - 3},
{x = x + 3, y = maxy + 3, z = z + 3} {x = x + 3, y = maxy + 3, z = z + 3}
) )
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data() local data = vm:get_data()
-- Scan for snow nodes near sapling to enable snow on branches
local snow = false
for yy = y - 1, y + 1 do
for zz = z - 1, z + 1 do
local vi = a:index(x - 1, yy, zz)
for xx = x - 1, x + 1 do
local nodid = data[vi]
if nodid == c_snow or nodid == c_snowblock or nodid == c_dirtsnow then
snow = true
end
vi = vi + 1
end
end
end
-- Upper branches layer -- Upper branches layer
local dev = 3 local dev = 3
for yy = maxy - 1, maxy + 1 do for yy = maxy - 1, maxy + 1 do
@ -350,7 +370,8 @@ function default.grow_pine_tree(pos)
end end
-- Trunk -- Trunk
data[a:index(x, y, z)] = c_pine_tree -- Force-place lowest trunk node to replace sapling -- Force-place lowest trunk node to replace sapling
data[a:index(x, y, z)] = c_pine_tree
for yy = y + 1, maxy do for yy = y + 1, maxy do
local vi = a:index(x, yy, z) local vi = a:index(x, yy, z)
local node_id = data[vi] local node_id = data[vi]
@ -365,47 +386,63 @@ function default.grow_pine_tree(pos)
vm:update_map() vm:update_map()
end end
-- New apple tree -- New apple tree
function default.grow_new_apple_tree(pos) function default.grow_new_apple_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/apple_tree_from_sapling.mts" local path = minetest.get_modpath("default") ..
"/schematics/apple_tree_from_sapling.mts"
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
path, 0, nil, false) path, "0", nil, false)
end end
-- New jungle tree -- New jungle tree
function default.grow_new_jungle_tree(pos) function default.grow_new_jungle_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/jungle_tree_from_sapling.mts" local path = minetest.get_modpath("default") ..
"/schematics/jungle_tree_from_sapling.mts"
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
path, 0, nil, false) path, "random", nil, false)
end end
-- New pine tree -- New pine tree
function default.grow_new_pine_tree(pos) function default.grow_new_pine_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/pine_tree_from_sapling.mts" local path = minetest.get_modpath("default") ..
"/schematics/pine_tree_from_sapling.mts"
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
path, 0, nil, false) path, "0", nil, false)
end
-- New snowy pine tree
function default.grow_new_snowy_pine_tree(pos)
local path = minetest.get_modpath("default") ..
"/schematics/snowy_pine_tree_from_sapling.mts"
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
path, "random", nil, false)
end end
-- New acacia tree -- New acacia tree
function default.grow_new_acacia_tree(pos) function default.grow_new_acacia_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/acacia_tree_from_sapling.mts" local path = minetest.get_modpath("default") ..
"/schematics/acacia_tree_from_sapling.mts"
minetest.place_schematic({x = pos.x - 4, y = pos.y - 1, z = pos.z - 4}, minetest.place_schematic({x = pos.x - 4, y = pos.y - 1, z = pos.z - 4},
path, random, nil, false) path, "random", nil, false)
end end
-- New aspen tree -- New aspen tree
function default.grow_new_aspen_tree(pos) function default.grow_new_aspen_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/aspen_tree_from_sapling.mts" local path = minetest.get_modpath("default") ..
"/schematics/aspen_tree_from_sapling.mts"
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
path, 0, nil, false) path, "0", nil, false)
end end
-- From BFD: -- From BFD:

View File

@ -1,15 +1,33 @@
-- minetest/dye/init.lua
-- Other mods can use these for looping through available colors -- Other mods can use these for looping through available colors
dye = {} dye = {}
dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"} dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"}
dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"} dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow",
"lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"}
-- Local stuff -- Make dye names and descriptions available globally
local dyelocal = {}
-- This collection of colors is partly a historic thing, partly something else. dye.dyes = {
dyelocal.dyes = { {"white", "White"},
{"grey", "Grey"},
{"dark_grey", "Dark grey"},
{"black", "Black"},
{"violet", "Violet"},
{"blue", "Blue"},
{"cyan", "Cyan"},
{"dark_green", "Dark green"},
{"green", "Green"},
{"yellow", "Yellow"},
{"brown", "Brown"},
{"orange", "Orange"},
{"red", "Red"},
{"magenta", "Magenta"},
{"pink", "Pink"},
}
-- This collection of colors is partly a historic thing, partly something else
local dyes = {
{"white", "White dye", {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}, true}, {"white", "White dye", {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}, true},
{"grey", "Grey dye", {dye=1, basecolor_grey=1, excolor_grey=1, unicolor_grey=1}}, {"grey", "Grey dye", {dye=1, basecolor_grey=1, excolor_grey=1, unicolor_grey=1}},
{"dark_grey", "Dark grey dye", {dye=1, basecolor_grey=1, excolor_darkgrey=1, unicolor_darkgrey=1}}, {"dark_grey", "Dark grey dye", {dye=1, basecolor_grey=1, excolor_darkgrey=1, unicolor_darkgrey=1}},
@ -28,7 +46,8 @@ dyelocal.dyes = {
} }
-- Define items -- Define items
for _, row in ipairs(dyelocal.dyes) do
for _, row in ipairs(dyes) do
local name = row[1] local name = row[1]
local description = row[2] local description = row[2]
local groups = row[3] local groups = row[3]
@ -49,7 +68,8 @@ for _, row in ipairs(dyelocal.dyes) do
end end
end end
-- manually add coal->black dye -- Manually add coal->black dye
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "dye:black 4", output = "dye:black 4",
@ -59,30 +79,30 @@ minetest.register_craft({
-- Mix recipes -- Mix recipes
-- Just mix everything to everything somehow sanely -- Just mix everything to everything somehow sanely
dyelocal.mixbases = {"magenta", "red", "orange", "brown", "yellow", "green", "dark_green", "cyan", "blue", "violet", "black", "dark_grey", "grey", "white", "light_grey"} local mixbases = {"pink", "magenta", "red", "orange", "brown", "yellow", "green", "dark_green", "cyan", "blue", "violet", "black", "dark_grey", "grey", "white", "light_grey"}
dyelocal.mixes = { local mixes = {
-- magenta, red, orange, brown, yellow, green, dark_green, cyan, blue, violet, black, dark_grey, grey, white, light_grey -- pink, magenta, red, orange, brown, yellow, green, dark_green, cyan, blue, violet, black, dark_grey, grey, white, light_grey
white = {"pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet", "grey", "grey", "light_grey", "white", "white"}, white = {"pink", "pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet","grey", "grey", "grey","white", "white"},
grey = {"pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "pink", "dark_grey", "grey", "grey"}, grey = {"pink", "pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet","dark_grey","grey", "grey"},
dark_grey = {"brown", "brown", "brown", "brown", "brown", "dark_green", "dark_green", "blue", "blue", "violet", "black", "black"}, dark_grey = {"brown", "brown", "brown", "brown", "brown", "brown", "dark_green","dark_green","blue", "blue", "violet","black", "dark_grey"},
black = {"black", "black", "black", "black", "black", "black", "black", "black", "black", "black", "black"}, black = {"black", "black", "black", "black", "black", "black", "black", "black", "black","black", "black", "black"},
violet= {"magenta", "magenta", "red", "brown", "red", "cyan", "brown", "blue", "violet", "violet"}, violet = {"magenta","magenta","magenta","red", "brown", "red", "cyan", "brown", "blue", "violet","violet"},
blue = {"violet", "magenta", "brown", "brown", "dark_green", "cyan", "cyan", "cyan", "blue"}, blue = {"violet", "violet", "magenta","brown", "brown", "dark_green","cyan", "cyan", "cyan", "blue"},
cyan = {"blue", "brown", "dark_green", "dark_grey", "green", "cyan", "dark_green", "cyan"}, cyan = {"brown", "blue", "brown", "dark_green","dark_grey", "green", "cyan", "dark_green","cyan"},
dark_green = {"brown", "brown", "brown", "brown", "green", "green", "dark_green"}, dark_green = {"brown", "brown", "brown", "brown", "brown", "green", "green", "dark_green"},
green = {"brown", "yellow", "yellow", "dark_green", "green", "green"}, green = {"yellow", "brown", "yellow", "yellow", "dark_green","green", "green"},
yellow= {"red", "orange", "yellow", "orange", "yellow"}, yellow = {"orange", "red", "orange", "yellow", "orange", "yellow"},
brown = {"brown", "brown", "orange", "brown"}, brown = {"brown", "brown", "brown", "orange", "brown"},
orange= {"red", "orange", "orange"}, orange = {"orange", "red", "orange", "orange"},
red = {"magenta", "red"}, red = {"pink", "magenta","red"},
magenta = {"magenta"}, magenta = {"magenta","magenta"},
pink = {"pink"},
} }
minetest.after(1, function() for one, results in pairs(mixes) do
for one,results in pairs(dyelocal.mixes) do
for i, result in ipairs(results) do for i, result in ipairs(results) do
local another = dyelocal.mixbases[i] local another = mixbases[i]
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = 'dye:' .. result .. ' 2', output = 'dye:' .. result .. ' 2',
@ -90,4 +110,3 @@ minetest.after(1, function()
}) })
end end
end end
end)

View File

@ -30,3 +30,7 @@ fire_large.ogg sampled from:
fire_basic_flame_animated.png: fire_basic_flame_animated.png:
Muadtralk Muadtralk
fire_flint_steel.png
Gambit (WTFPL)

View File

@ -5,25 +5,30 @@
fire = {} fire = {}
-- Register flame node -- Register flame nodes
minetest.register_node("fire:basic_flame", { minetest.register_node("fire:basic_flame", {
description = "Fire",
drawtype = "firelike", drawtype = "firelike",
tiles = {{ tiles = {
{
name = "fire_basic_flame_animated.png", name = "fire_basic_flame_animated.png",
animation = {type = "vertical_frames", animation = {
aspect_w = 16, aspect_h = 16, length = 1}, type = "vertical_frames",
}}, aspect_w = 16,
aspect_h = 16,
length = 1
},
},
},
inventory_image = "fire_basic_flame.png", inventory_image = "fire_basic_flame.png",
paramtype = "light", paramtype = "light",
light_source = 14, light_source = 14,
groups = {igniter = 2, dig_immediate = 3, hot = 3},
drop = '',
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
sunlight_propagates = true, sunlight_propagates = true,
damage_per_second = 4, damage_per_second = 4,
groups = {igniter = 2, dig_immediate = 3, not_in_creative_inventory = 1},
drop = "",
on_construct = function(pos) on_construct = function(pos)
minetest.after(0, fire.on_flame_add_at, pos) minetest.after(0, fire.on_flame_add_at, pos)
@ -33,9 +38,70 @@ minetest.register_node("fire:basic_flame", {
minetest.after(0, fire.on_flame_remove_at, pos) minetest.after(0, fire.on_flame_remove_at, pos)
end, end,
on_blast = function() end, -- unaffected by explosions on_blast = function()
end, -- unaffected by explosions
}) })
minetest.register_node("fire:permanent_flame", {
description = "Permanent Flame",
drawtype = "firelike",
tiles = {
{
name = "fire_basic_flame_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1
},
},
},
inventory_image = "fire_basic_flame.png",
paramtype = "light",
light_source = 14,
walkable = false,
buildable_to = true,
sunlight_propagates = true,
damage_per_second = 4,
groups = {igniter = 2, dig_immediate = 3},
drop = "",
on_blast = function()
end,
})
minetest.register_tool("fire:flint_and_steel", {
description = "Flint and Steel",
inventory_image = "fire_flint_steel.png",
on_use = function(itemstack, user, pointed_thing)
local player_name = user:get_player_name()
local pt = pointed_thing
if pt.type == "node" and minetest.get_node(pt.above).name == "air" then
itemstack:add_wear(1000)
local node_under = minetest.get_node(pt.under).name
if minetest.get_item_group(node_under, "flammable") >= 1 then
if not minetest.is_protected(pt.above, player_name) then
minetest.set_node(pt.above, {name = "fire:basic_flame"})
else
minetest.chat_send_player(player_name, "This area is protected")
end
end
end
if not minetest.setting_getbool("creative_mode") then
return itemstack
end
end
})
minetest.register_craft({
output = "fire:flint_and_steel",
recipe = {
{"default:flint", "default:steel_ingot"}
}
})
-- Get sound area of position -- Get sound area of position
@ -135,7 +201,7 @@ minetest.register_abm({
nodenames = {"fire:basic_flame", "fire:permanent_flame"}, nodenames = {"fire:basic_flame", "fire:permanent_flame"},
neighbors = {"group:puts_out_fire"}, neighbors = {"group:puts_out_fire"},
interval = 3, interval = 3,
chance = 2, chance = 1,
catch_up = false, catch_up = false,
action = function(p0, node, _, _) action = function(p0, node, _, _)
minetest.remove_node(p0) minetest.remove_node(p0)
@ -149,12 +215,12 @@ minetest.register_abm({
if minetest.setting_getbool("disable_fire") then if minetest.setting_getbool("disable_fire") then
-- Extinguish flames quickly with dedicated ABM -- Remove basic flames only
minetest.register_abm({ minetest.register_abm({
nodenames = {"fire:basic_flame"}, nodenames = {"fire:basic_flame"},
interval = 3, interval = 7,
chance = 2, chance = 1,
catch_up = false, catch_up = false,
action = function(p0, node, _, _) action = function(p0, node, _, _)
minetest.remove_node(p0) minetest.remove_node(p0)
@ -177,13 +243,13 @@ else
end, end,
}) })
-- Ignite neighboring nodes -- Ignite neighboring nodes, add basic flames
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:flammable"}, nodenames = {"group:flammable"},
neighbors = {"group:igniter"}, neighbors = {"group:igniter"},
interval = 7, interval = 7,
chance = 16, chance = 12,
catch_up = false, catch_up = false,
action = function(p0, node, _, _) action = function(p0, node, _, _)
-- If there is water or stuff like that around node, don't ignite -- If there is water or stuff like that around node, don't ignite
@ -197,23 +263,27 @@ else
end, end,
}) })
-- Remove flames and flammable nodes -- Remove basic flames and flammable nodes
minetest.register_abm({ minetest.register_abm({
nodenames = {"fire:basic_flame"}, nodenames = {"fire:basic_flame"},
interval = 5, interval = 5,
chance = 16, chance = 6,
catch_up = false, catch_up = false,
action = function(p0, node, _, _) action = function(p0, node, _, _)
-- If there are no flammable nodes around flame, remove flame -- If there are no flammable nodes around flame, remove flame
if not minetest.find_node_near(p0, 1, {"group:flammable"}) then local p = minetest.find_node_near(p0, 1, {"group:flammable"})
if not p then
minetest.remove_node(p0) minetest.remove_node(p0)
return return
end end
if math.random(1, 4) == 1 then if math.random(1, 4) == 1 then
-- remove flammable nodes around flame -- remove flammable nodes around flame
local p = minetest.find_node_near(p0, 1, {"group:flammable"}) local node = minetest.get_node(p)
if p then local def = minetest.registered_nodes[node.name]
if def.on_burn then
def.on_burn(p)
else
minetest.remove_node(p) minetest.remove_node(p)
nodeupdate(p) nodeupdate(p)
end end

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -99,8 +99,8 @@ minetest.register_node("flowers:lily_pad", {
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:flora"}, nodenames = {"group:flora"},
neighbors = {"default:dirt_with_grass", "default:desert_sand"}, neighbors = {"default:dirt_with_grass", "default:desert_sand"},
interval = 2, interval = 13,
chance = 500, chance = 96,
action = function(pos, node) action = function(pos, node)
pos.y = pos.y - 1 pos.y = pos.y - 1
local under = minetest.get_node(pos) local under = minetest.get_node(pos)
@ -241,6 +241,7 @@ minetest.register_node("flowers:waterlily", {
liquids_pointable = true, liquids_pointable = true,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
sunlight_propagates = true,
groups = {snappy = 3, flower = 1}, groups = {snappy = 3, flower = 1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
node_box = { node_box = {
@ -252,14 +253,11 @@ minetest.register_node("flowers:waterlily", {
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5} fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}
}, },
after_place_node = function(pos, placer, itemstack, pointed_thing) on_place = function(_, _, pointed_thing)
local find_water = minetest.find_nodes_in_area({x = pos.x - 1, y = pos.y, z = pos.z - 1}, local pos = pointed_thing.above
{x = pos.x + 1, y = pos.y, z = pos.z + 1}, "default:water_source") local node = minetest.get_node(pointed_thing.under).name
local find_river_water = minetest.find_nodes_in_area({x = pos.x - 1, y = pos.y, z = pos.z - 1}, local def = minetest.registered_nodes[node]
{x = pos.x + 1, y = pos.y, z = pos.z + 1}, "default:river_water_source") if def and def.liquidtype == "source" and minetest.get_item_group(node, "water") > 0 then
if #find_water ~= 0 then
minetest.set_node(pos, {name = "default:water_source"})
pos.y = pos.y + 1
minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)}) minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)})
elseif #find_river_water ~= 0 then elseif #find_river_water ~= 0 then
minetest.set_node(pos, {name = "default:river_water_source"}) minetest.set_node(pos, {name = "default:river_water_source"})

View File

@ -216,7 +216,7 @@ minetest.register_decoration({
-- Mods using singlenode mapgen can call these functions to enable -- Mods using singlenode mapgen can call these functions to enable
-- the use of minetest.generate_ores or minetest.generate_decorations -- the use of minetest.generate_ores or minetest.generate_decorations
-- Enable in mapgen v6 only
local mg_params = minetest.get_mapgen_params() local mg_params = minetest.get_mapgen_params()
if mg_params.mgname == "v6" then if mg_params.mgname == "v6" then
flowers.register_mgv6_decorations() flowers.register_mgv6_decorations()

View File

@ -22,7 +22,7 @@ local USES = 200
local USES_perfect = 10000 local USES_perfect = 10000
-- Handles rotation -- Handles rotation
local function screwdriver_handler(itemstack, user, pointed_thing, mode) screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
return return
end end
@ -37,7 +37,7 @@ local function screwdriver_handler(itemstack, user, pointed_thing, mode)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local ndef = minetest.registered_nodes[node.name] local ndef = minetest.registered_nodes[node.name]
-- verify node is facedir (expected to be rotatable) -- verify node is facedir (expected to be rotatable)
if ndef.paramtype2 ~= "facedir" then if not ndef or ndef.paramtype2 ~= "facedir" then
return return
end end
-- Compute param2 -- Compute param2
@ -91,12 +91,12 @@ local function screwdriver_handler(itemstack, user, pointed_thing, mode)
return itemstack return itemstack
end end
-- Screwdriver (en steel à 200 utilisation) -- Screwdriver
minetest.register_tool("screwdriver:screwdriver", { minetest.register_tool("screwdriver:screwdriver", {
description = "Screwdriver (left-click rotates face, right-click rotates axis)", description = "Screwdriver (left-click rotates face, right-click rotates axis)",
inventory_image = "screwdriver.png", inventory_image = "screwdriver.png",
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
screwdriver_handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE) screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, 200)
return itemstack return itemstack
end, end,
on_place = function(itemstack, user, pointed_thing) on_place = function(itemstack, user, pointed_thing)
@ -110,11 +110,11 @@ minetest.register_tool("screwdriver:screwdriver_perfect", {
description = "Perfect Screwdriver (left-click rotates face, right-click rotates axis)", description = "Perfect Screwdriver (left-click rotates face, right-click rotates axis)",
inventory_image = "screwdriver_perfect.png", inventory_image = "screwdriver_perfect.png",
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
screwdriver_handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE) screwdriver_handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, 10000)
return itemstack return itemstack
end, end,
on_place = function(itemstack, user, pointed_thing) on_place = function(itemstack, user, pointed_thing)
screwdriver_handler(itemstack, user, pointed_thing, screwdriver.ROTATE_AXIS) screwdriver_handler(itemstack, user, pointed_thing, screwdriver.ROTATE_AXIS, 10000)
return itemstack return itemstack
end, end,
}) })

View File

@ -233,7 +233,7 @@ end
if replace then if replace then
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:slabs_replace"}, nodenames = {"group:slabs_replace"},
interval = 8, interval = 16,
chance = 1, chance = 1,
action = function(pos, node) action = function(pos, node)
node.name = minetest.registered_nodes[node.name].replace_name node.name = minetest.registered_nodes[node.name].replace_name

View File

@ -27,40 +27,15 @@ minetest.register_node("vessels:shelf", {
inv:set_size("vessels", 8 * 2) inv:set_size("vessels", 8 * 2)
end, end,
can_dig = function(pos,player) can_dig = function(pos,player)
local meta = minetest.get_meta(pos); local inv = minetest.get_meta(pos):get_inventory()
local inv = meta:get_inventory()
return inv:is_empty("vessels") return inv:is_empty("vessels")
end, end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) if minetest.get_item_group(stack:get_name(), "vessel") ~= 0 then
local inv = meta:get_inventory() return stack:get_count()
local to_stack = inv:get_stack(listname, index) end
if listname == "vessels" then
if minetest.get_item_group(stack:get_name(), "vessel") ~= 0
and to_stack:is_empty() then
return 1
else
return 0 return 0
end
end
end, end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
local to_stack = inv:get_stack(to_list, to_index)
if to_list == "vessels" then
if minetest.get_item_group(stack:get_name(), "vessel") ~= 0
and to_stack:is_empty() then
return 1
else
return 0
end
end
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name() ..
" moves stuff in vessels shelf at ".. minetest.pos_to_string(pos)) " moves stuff in vessels shelf at ".. minetest.pos_to_string(pos))

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1,61 @@
--[[
Walls mod for Minetest
Copyright (C) 2015 Auke Kok <sofar@foo-projects.org>
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
--]]
walls = {}
walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds)
-- inventory node, and pole-type wall start item
minetest.register_node(wall_name, {
description = wall_desc,
drawtype = "nodebox",
node_box = {
type = "connected",
fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}},
-- connect_bottom =
connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}},
connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}},
connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}},
connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}},
},
connects_to = { "group:wall", "group:stone" },
paramtype = "light",
is_ground_content = false,
tiles = { wall_texture, },
walkable = true,
groups = { cracky = 3, wall = 1, stone = 2 },
sounds = wall_sounds,
})
-- crafting recipe
minetest.register_craft({
output = wall_name .. " 6",
recipe = {
{ '', '', '' },
{ wall_mat, wall_mat, wall_mat},
{ wall_mat, wall_mat, wall_mat},
}
})
end
walls.register("walls:cobble", "Cobblestone Wall", "default_cobble.png",
"default:cobble", default.node_sound_stone_defaults())
walls.register("walls:mossycobble", "Mossy Cobblestone Wall", "default_mossycobble.png",
"default:mossycobble", default.node_sound_stone_defaults())
walls.register("walls:desertcobble", "Desert Cobblestone Wall", "default_desert_cobble.png",
"default:desert_cobble", default.node_sound_stone_defaults())

View File

Before

Width:  |  Height:  |  Size: 429 B

After

Width:  |  Height:  |  Size: 429 B

View File

Before

Width:  |  Height:  |  Size: 703 B

After

Width:  |  Height:  |  Size: 703 B