This commit is contained in:
tchncs 2016-03-14 10:00:08 +01:00
commit e14809616d
76 changed files with 1987 additions and 1201 deletions

View File

@ -4,18 +4,21 @@ GitHub Repo: https://github.com/minetest/minetest_game
Introduction
------------
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.
For information on the Minetest API, visit https://github.com/minetest/minetest/blob/master/doc/lua_api.txt
Please note:
[XYZ] refers to a section the Minetest API
[#ABC] refers to a section in this document
^ Explanation for line above
* [XYZ] refers to a section the Minetest API
* [#ABC] refers to a section in this document
Bucket API
----------
The bucket API allows registering new types of buckets for non-default liquids.
bucket.register_liquid(
"default:lava_source", -- name of the source node
"default:lava_flowing", -- name of the flowing node
@ -27,215 +30,250 @@ The bucket API allows registering new types of buckets for non-default liquids.
Beds API
--------
beds.register_bed(
"beds:bed", -- Bed name
def: See [#Bed definition] -- Bed definition
"beds:bed", -- Bed name
def -- See [#Bed definition]
)
beds.read_spawns() -- returns a table containing players respawn positions
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.read_spawns() ` Returns a table containing players respawn positions
* `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
###Bed definition
#Bed definition
---------------
{
description = "Simple Bed",
inventory_image = "beds_bed.png",
wield_image = "beds_bed.png",
tiles = {
bottom = {[Tile definition],
^ the tiles of the bottom part of the bed
},
top = {[Tile definition],
^ the tiles of the bottom part of the bed
}
},
nodebox = {
bottom = regular nodebox, see [Node boxes], -- bottm part of bed
top = regular nodebox, see [Node boxes], -- top part of bed
},
selectionbox = regular nodebox, see [Node boxes], -- for both nodeboxes
recipe = { -- Craft recipe
{"group:wool", "group:wool", "group:wool"},
{"group:wood", "group:wood", "group:wood"}
{
description = "Simple Bed",
inventory_image = "beds_bed.png",
wield_image = "beds_bed.png",
tiles = {
bottom = {'Tile definition'}, -- the tiles of the bottom part of the bed.
top = {Tile definition} -- the tiles of the bottom part of the bed.
},
nodebox = {
bottom = 'regular nodebox', -- bottom part of bed (see [Node boxes])
top = 'regular nodebox', -- top part of bed (see [Node boxes])
},
selectionbox = 'regular nodebox', -- for both nodeboxes (see [Node boxes])
recipe = { -- Craft recipe
{"group:wool", "group:wool", "group:wool"},
{"group:wood", "group:wood", "group:wood"}
}
}
}
Doors API
---------
The doors mod allows modders to register custom doors and trapdoors.
doors.register_door(name, def)
^ name: "Door name"
^ def: See [#Door definition]
-> Registers new door
`doors.register_door(name, def)`
doors.register_trapdoor(name, def)
^ name: "Trapdoor name"
^ def: See [#Trapdoor definition]
-> Registers new trapdoor
* Registers new door
* `name` Name for door
* `def` See [#Door definition]
`doors.register_trapdoor(name, def)`
* Registers new trapdoor
* `name` Name for trapdoor
* `def` See [#Trapdoor 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",
inventory_image = "mod_door_inv.png",
groups = {group = 1},
tiles_bottom: [Tile definition],
^ the tiles of the bottom part of the door {front, side}
tiles_top: [Tile definition],
^ the tiles of the bottom part of the door {front, side}
node_box_bottom = regular nodebox, see [Node boxes], OPTIONAL,
node_box_top = regular nodebox, see [Node boxes], OPTIONAL,
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)
}
groups = {choppy = 2},
tiles = {"mod_door.png"}, -- UV map.
recipe = craftrecipe,
sounds = default.node_sound_wood_defaults(), -- optional
sound_open = sound play for open door, -- optional
sound_close = sound play for close door, -- optional
protected = false, -- If true, only placer can open the door (locked for others)
#Trapdoor definition
----------------
{
tile_front = "doors_trapdoor.png",
^ the texture for the front and back 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,
sound_close = sound to play when closing the trapdoor, OPTIONAL,
-> You can add any other node definition properties for minetest.register_node,
such as wield_image, inventory_image, sounds, groups, description, ...
Only node_box, selection_box, tiles, drop, drawtype, paramtype, paramtype2, on_rightclick
will be overwritten by the trapdoor registration function
}
###Trapdoor definition
description = "Trapdoor description",
inventory_image = "mod_trapdoor_inv.png",
groups = {choppy = 2},
tile_front = "doors_trapdoor.png", -- the texture for the front and back of the trapdoor
tile_side = "doors_trapdoor_side.png", -- the tiles of the four side parts of the trapdoor
sounds = default.node_sound_wood_defaults(), -- optional
sound_open = sound play for open door, -- optional
sound_close = sound play for close door, -- optional
protected = false, -- If true, only placer can open the door (locked for others)
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.
`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
#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},
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
-----------
The farming API allows you to easily register plants and hoes.
farming.register_hoe(name, hoe definition)
-> Register a new hoe, see [#hoe definition]
`farming.register_hoe(name, hoe definition)`
* Register a new hoe, see [#hoe definition]
farming.register_plant(name, Plant definition)
-> Register a new growing plant, see [#Plant definition]
`farming.register_plant(name, Plant definition)`
* Register a new growing plant, see [#Plant definition]
#Hoe Definition
---------------
{
description = "", -- Description for tooltip
inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image
max_uses = 30, -- Uses until destroyed
material = "", -- Material for recipes
recipe = { -- Craft recipe, if material isn't used
{"air", "air", "air"},
{"", "group:stick"},
{"", "group:stick"},
###Hoe Definition
{
description = "", -- Description for tooltip
inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image
max_uses = 30, -- Uses until destroyed
material = "", -- Material for recipes
recipe = { -- Craft recipe, if material isn't used
{"air", "air", "air"},
{"", "group:stick"},
{"", "group:stick"},
}
}
}
#Plant definition
-----------------
{
description = "", -- Description of seed item
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
^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
minlight = 13, -- Minimum light to grow
maxlight = default.LIGHT_MAX -- Maximum light to grow
}
###Plant definition
{
description = "", -- Description of seed item
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
-- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
minlight = 13, -- Minimum 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
---------------
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.
on_rotate(pos, node, user, mode, new_param2)
^ pos: position of the node that the screwdriver is being used on
^ node: that node
^ user: the player who used the screwdriver
^ 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
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
* `node` that node
* `user` The player who used the screwdriver
* `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)
^ use on_rotate = screwdriver.disallow to always disallow rotation
^ use on_rotate = screwdriver.rotate_simple to allow only face rotation
* use `on_rotate = screwdriver.disallow` to always disallow rotation
* use `on_rotate = screwdriver.rotate_simple` to allow only face rotation
Stairs API
----------
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.
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_stair(subname, recipeitem, groups, images, description, sounds)`
stairs.register_slab(subname, recipeitem, groups, images, description, sounds)
-> Registers a slabs
-> 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]
* 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_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
`stairs.register_slab(subname, recipeitem, groups, images, description, sounds)`
* Registers a slabs
* `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_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
----------
Creates panes that automatically connect to each other
xpanes.register_pane(subname, def)
-> subname: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}"
-> def: See [#Pane definition]
`xpanes.register_pane(subname, def)`
#Pane definition
----------------
{
textures = {"texture_Bottom_top", "texture_left_right", "texture_front_back"},
^ More tiles aren't supported
groups = {group = rating},
^ Uses the known node groups, see [Known damage and digging time defining groups]
sounds = SoundSpec,
^ See [#Default sounds]
recipe = {{"","","","","","","","",""}},
^ Recipe field only
}
* `subname`: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}"
* `def`: See [#Pane definition]
###Pane definition
{
textures = {"texture_Bottom_top", "texture_left_right", "texture_front_back"}, -- More tiles aren't supported
groups = {group = rating}, -- Uses the known node groups, see [Known damage and digging time defining groups]
sounds = SoundSpec, -- See [#Default sounds]
recipe = {{"","","","","","","","",""}}, -- Recipe field only
}
Raillike definitions
--------------------
The following nodes use the group `connect_to_raillike` and will only connect to
raillike nodes within this group and the same group value.
Use `minetest.raillike_group(<Name>)` to get the group value.
| Node type | Raillike group name
+-----------------------+--------------------
|-----------------------|---------------------
| default:rail | "rail"
| tnt:gunpowder | "gunpowder"
| tnt:gunpowder_burning | "gunpowder"
@ -248,168 +286,188 @@ of your node.
Default sounds
--------------
Sounds inside the default table can be used within the sounds field of node definitions.
default.node_sound_defaults()
default.node_sound_stone_defaults()
default.node_sound_dirt_defaults()
default.node_sound_sand_defaults()
default.node_sound_wood_defaults()
default.node_sound_leaves_defaults()
default.node_sound_glass_defaults()
* `default.node_sound_defaults()`
* `default.node_sound_stone_defaults()`
* `default.node_sound_dirt_defaults()`
* `default.node_sound_sand_defaults()`
* `default.node_sound_wood_defaults()`
* `default.node_sound_leaves_defaults()`
* `default.node_sound_glass_defaults()`
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
----------
The player API can register player models and update the player's appearence
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.player_register_model(name, def)`
default.registered_player_models[name]
^ Get a model's definition
-> see [#Model definition]
* Register a new model to be used by players.
* name: model filename such as "character.x", "foo.b3d", etc.
* def: See [#Model definition]
default.player_set_model(player, model_name)
^ Change a player's model
-> player: PlayerRef
-> model_name: model registered with player_register_model()
`default.registered_player_models[name]`
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
* Get a model's definition
* see [#Model definition]
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_set_model(player, model_name)`
* Change a player's model
* `player`: PlayerRef
* `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)
^ 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.
textures = {"character.png", }, -- Default array of textures.
visual_size = {x = 1, y = 1}, -- Used to scale the model.
animations = {
-- <anim_name> = {x = <start_frame>, y = <end_frame>},
foo = {x = 0, y = 19},
bar = {x = 20, y = 39},
* 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.
textures = {"character.png", }, -- Default array of textures.
visual_size = {x = 1, y = 1}, -- Used to scale the model.
animations = {
-- <anim_name> = {x = <start_frame>, y = <end_frame>},
foo = {x = 0, y = 19},
bar = {x = 20, y = 39},
-- ...
},
}
},
}
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.
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.
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 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
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.
Dyes
----
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
amount of colors.
#Color groups
-------------
Base color groups:
- basecolor_white
- basecolor_grey
- basecolor_black
- basecolor_red
- basecolor_yellow
- basecolor_green
- basecolor_cyan
- basecolor_blue
- basecolor_magenta
###Color groups
Extended color groups (* = equal to a base color):
* excolor_white
- excolor_lightgrey
* excolor_grey
- 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
Base color groups:
* `basecolor_white`
* `basecolor_grey`
* `basecolor_black`
* `basecolor_red`
* `basecolor_yellow`
* `basecolor_green`
* `basecolor_cyan`
* `basecolor_blue`
* `basecolor_magenta`
Extended color groups ( * means also base color )
* `excolor_white` *
* `excolor_lightgrey`
* `excolor_grey` *
* `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:
- unicolor_<excolor>
* `unicolor_<excolor>`
For the following, no white/grey/black is allowed:
- unicolor_medium_<excolor>
- unicolor_dark_<excolor>
- unicolor_light_<excolor>
- unicolor_<excolor>_s50
- unicolor_medium_<excolor>_s50
- unicolor_dark_<excolor>_s50
* `unicolor_medium_<excolor>`
* `unicolor_dark_<excolor>`
* `unicolor_light_<excolor>`
* `unicolor_<excolor>_s50`
* `unicolor_medium_<excolor>_s50`
* `unicolor_dark_<excolor>_s50`
Example of one shapeless recipe using a color group:
minetest.register_craft({
type = "shapeless",
output = '<mod>:item_yellow',
recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
})
#Color lists
------------
dye.basecolors
^ Array containing the names of available base colors
minetest.register_craft({
type = "shapeless",
output = '<mod>:item_yellow',
recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
})
dye.excolors
^ Array containing the names of the available extended colors
###Color lists
* `dye.basecolors` are an array containing the names of available base colors
* `dye.excolors` are an array containing the names of the available extended colors
Trees
-----
default.grow_tree(pos, is_apple_tree)
^ Grows a mgv6 tree or apple tree at pos
default.grow_jungle_tree(pos)
^ Grows a mgv6 jungletree at pos
* `default.grow_tree(pos, is_apple_tree)`
* Grows a mgv6 tree or apple tree at pos
default.grow_pine_tree(pos)
^ Grows a mgv6 pinetree at pos
* `default.grow_jungle_tree(pos)`
* Grows a mgv6 jungletree at pos
default.grow_new_apple_tree(pos)
^ Grows a new design apple tree at pos
* `default.grow_pine_tree(pos)`
* Grows a mgv6 pinetree at pos
default.grow_new_jungle_tree(pos)
^ Grows a new design jungle tree at pos
* `default.grow_new_apple_tree(pos)`
* Grows a new design apple tree at pos
default.grow_new_pine_tree(pos)
^ Grows a new design pine tree at pos
* `default.grow_new_jungle_tree(pos)`
* Grows a new design jungle tree at pos
default.grow_new_acacia_tree(pos)
^ Grows a new design acacia tree at pos
* `default.grow_new_pine_tree(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,6 +9,11 @@
# 0 to disable
#share_bones_time = 1200
# 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

View File

@ -19,6 +19,7 @@ function beds.register_bed(name, def)
type = "fixed",
fixed = def.selectionbox,
},
after_place_node = function(pos, placer, itemstack)
local n = minetest.get_node_or_nil(pos)
if not n or not n.param2 then
@ -36,6 +37,7 @@ function beds.register_bed(name, def)
minetest.set_node(p, {name = n.name:gsub("%_bottom", "_top"), param2 = n.param2})
return false
end,
on_destruct = function(pos)
local n = minetest.get_node_or_nil(pos)
if not n then return end
@ -46,9 +48,11 @@ function beds.register_bed(name, def)
minetest.remove_node(p)
end
end,
on_rightclick = function(pos, node, clicker)
beds.on_rightclick(pos, clicker)
end,
on_rotate = function(pos, node, user, mode, new_param2)
local dir = minetest.facedir_to_dir(node.param2)
local p = vector.add(pos, dir)
@ -99,7 +103,6 @@ function beds.register_bed(name, def)
minetest.register_alias(name, name .. "_bottom")
-- register recipe
minetest.register_craft({
output = name,
recipe = def.recipe

View File

@ -1,44 +1,45 @@
-- fancy shaped bed
-- Fancy shaped bed
beds.register_bed("beds:fancy_bed", {
description = "Fancy Bed",
inventory_image = "beds_bed_fancy.png",
wield_image = "beds_bed_fancy.png",
tiles = {
bottom = {
"beds_bed_top1.png",
"default_wood.png",
"beds_bed_side1.png",
"beds_bed_side1.png^[transformFX",
"default_wood.png",
"beds_bed_foot.png",
},
top = {
"beds_bed_top2.png",
"default_wood.png",
"beds_bed_side2.png",
"beds_bed_side2.png^[transformFX",
"beds_bed_head.png",
"default_wood.png",
}
bottom = {
"beds_bed_top1.png",
"default_wood.png",
"beds_bed_side1.png",
"beds_bed_side1.png^[transformFX",
"default_wood.png",
"beds_bed_foot.png",
},
top = {
"beds_bed_top2.png",
"default_wood.png",
"beds_bed_side2.png",
"beds_bed_side2.png^[transformFX",
"beds_bed_head.png",
"default_wood.png",
}
},
nodebox = {
bottom = {
{-0.5, -0.5, -0.5, -0.375, -0.065, -0.4375},
{0.375, -0.5, -0.5, 0.5, -0.065, -0.4375},
{-0.5, -0.375, -0.5, 0.5, -0.125, -0.4375},
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
{-0.4375, -0.3125, -0.4375, 0.4375, -0.0625, 0.5},
},
top = {
{-0.5, -0.5, 0.4375, -0.375, 0.1875, 0.5},
{0.375, -0.5, 0.4375, 0.5, 0.1875, 0.5},
{-0.5, 0, 0.4375, 0.5, 0.125, 0.5},
{-0.5, -0.375, 0.4375, 0.5, -0.125, 0.5},
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
{-0.4375, -0.3125, -0.5, 0.4375, -0.0625, 0.4375},
}
bottom = {
{-0.5, -0.5, -0.5, -0.375, -0.065, -0.4375},
{0.375, -0.5, -0.5, 0.5, -0.065, -0.4375},
{-0.5, -0.375, -0.5, 0.5, -0.125, -0.4375},
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
{-0.4375, -0.3125, -0.4375, 0.4375, -0.0625, 0.5},
},
top = {
{-0.5, -0.5, 0.4375, -0.375, 0.1875, 0.5},
{0.375, -0.5, 0.4375, 0.5, 0.1875, 0.5},
{-0.5, 0, 0.4375, 0.5, 0.125, 0.5},
{-0.5, -0.375, 0.4375, 0.5, -0.125, 0.5},
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
{-0.4375, -0.3125, -0.5, 0.4375, -0.0625, 0.4375},
}
},
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
recipe = {
@ -48,41 +49,42 @@ beds.register_bed("beds:fancy_bed", {
},
})
-- simple shaped bed
-- Simple shaped bed
beds.register_bed("beds:bed", {
description = "Simple Bed",
inventory_image = "beds_bed.png",
wield_image = "beds_bed.png",
tiles = {
bottom = {
"beds_bed_top_bottom.png^[transformR90",
"default_wood.png",
"beds_bed_side_bottom_r.png",
"beds_bed_side_bottom_r.png^[transformfx",
"beds_transparent.png",
"beds_bed_side_bottom.png"
},
top = {
"beds_bed_top_top.png^[transformR90",
"default_wood.png",
"beds_bed_side_top_r.png",
"beds_bed_side_top_r.png^[transformfx",
"beds_bed_side_top.png",
"beds_transparent.png",
}
bottom = {
"beds_bed_top_bottom.png^[transformR90",
"default_wood.png",
"beds_bed_side_bottom_r.png",
"beds_bed_side_bottom_r.png^[transformfx",
"beds_transparent.png",
"beds_bed_side_bottom.png"
},
top = {
"beds_bed_top_top.png^[transformR90",
"default_wood.png",
"beds_bed_side_top_r.png",
"beds_bed_side_top_r.png^[transformfx",
"beds_bed_side_top.png",
"beds_transparent.png",
}
},
nodebox = {
bottom = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
top = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
bottom = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
top = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
},
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
recipe = {
{"wool:red", "wool:red", "wool:white"},
{"group:wood", "group:wood", "group:wood"}
},
})
-- aliases for PA's beds mod
-- Aliases for PilzAdam's beds mod
minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom")
minetest.register_alias("beds:bed_top_red", "beds:bed_top")

View File

@ -6,15 +6,14 @@ if enable_respawn == nil then
enable_respawn = true
end
-- helper functions
-- Helper functions
local function get_look_yaw(pos)
local n = minetest.get_node(pos)
if n.param2 == 1 then
return pi/2, n.param2
return pi / 2, n.param2
elseif n.param2 == 3 then
return -pi/2, n.param2
return -pi / 2, n.param2
elseif n.param2 == 0 then
return pi, n.param2
else
@ -70,8 +69,8 @@ local function lay_down(player, pos, bed_pos, state, skip)
end
-- physics, eye_offset, etc
player:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
player:set_look_yaw(math.random(1, 180)/100)
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
player:set_look_yaw(math.random(1, 180) / 100)
default.player_attached[name] = false
player:set_physics_override(1, 1, 1)
hud_flags.wielditem = true
@ -84,11 +83,11 @@ local function lay_down(player, pos, bed_pos, state, skip)
player_in_bed = player_in_bed + 1
-- physics, eye_offset, etc
player:set_eye_offset({x=0,y=-13,z=0}, {x=0,y=0,z=0})
player:set_eye_offset({x = 0, y = -13, z = 0}, {x = 0, y = 0, z = 0})
local yaw, param2 = get_look_yaw(bed_pos)
player:set_look_yaw(yaw)
local dir = minetest.facedir_to_dir(param2)
local p = {x=bed_pos.x+dir.x/2,y=bed_pos.y,z=bed_pos.z+dir.z/2}
local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y, z = bed_pos.z + dir.z / 2}
player:set_physics_override(0, 0, 0)
player:setpos(p)
default.player_attached[name] = true
@ -102,17 +101,15 @@ end
local function update_formspecs(finished)
local ges = #minetest.get_connected_players()
local form_n = ""
local is_majority = (ges/2) < player_in_bed
local is_majority = (ges / 2) < player_in_bed
if finished then
form_n = beds.formspec ..
"label[2.7,11; Good morning.]"
form_n = beds.formspec .. "label[2.7,11; Good morning.]"
else
form_n = beds.formspec ..
"label[2.2,11;"..tostring(player_in_bed).." of "..tostring(ges).." players are in bed]"
form_n = beds.formspec .. "label[2.2,11;" .. tostring(player_in_bed) ..
" of " .. tostring(ges) .. " players are in bed]"
if is_majority and is_night_skip_enabled() then
form_n = form_n ..
"button_exit[2,8;4,0.75;force;Force night skip]"
form_n = form_n .. "button_exit[2,8;4,0.75;force;Force night skip]"
end
end
@ -122,10 +119,10 @@ local function update_formspecs(finished)
end
-- public functions
-- Public functions
function beds.kick_players()
for name,_ in pairs(beds.player) do
for name, _ in pairs(beds.player) do
local player = minetest.get_player_by_name(name)
lay_down(player, nil, nil, false)
end
@ -175,7 +172,7 @@ function beds.on_rightclick(pos, player)
end
-- callbacks
-- Callbacks
minetest.register_on_joinplayer(function(player)
beds.read_spawns()

View File

@ -3,14 +3,15 @@ beds.player = {}
beds.pos = {}
beds.spawn = {}
beds.formspec = "size[8,15;true]"..
"bgcolor[#080808BB; true]"..
"button_exit[2,12;4,0.75;leave;Leave Bed]"
beds.formspec = "size[8,15;true]" ..
"bgcolor[#080808BB; true]" ..
"button_exit[2,12;4,0.75;leave;Leave Bed]"
local modpath = minetest.get_modpath("beds")
-- load files
dofile(modpath.."/functions.lua")
dofile(modpath.."/api.lua")
dofile(modpath.."/beds.lua")
dofile(modpath.."/spawns.lua")
-- Load files
dofile(modpath .. "/functions.lua")
dofile(modpath .. "/api.lua")
dofile(modpath .. "/beds.lua")
dofile(modpath .. "/spawns.lua")

View File

@ -43,7 +43,7 @@ function beds.save_spawns()
end
local output = io.open(org_file, "w")
for i, v in pairs(beds.spawn) do
output:write(v.x.." "..v.y.." "..v.z.." "..i.."\n")
output:write(v.x .. " " .. v.y .. " " .. v.z .. " " .. i .. "\n")
end
io.close(output)
end

View File

@ -5,7 +5,7 @@ bones = {}
local function is_owner(pos, name)
local owner = minetest.get_meta(pos):get_string("owner")
if owner == "" or owner == name then
if owner == "" or owner == name or minetest.check_player_privs(placer, "protection_bypass") then
return true
end
return false
@ -43,7 +43,11 @@ minetest.register_node("bones:bones", {
can_dig = function(pos, player)
local inv = minetest.get_meta(pos):get_inventory()
return is_owner(pos, player:get_player_name()) and inv:is_empty("main")
local name = ""
if player then
name = player:get_player_name()
end
return is_owner(pos, name) and inv:is_empty("main")
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)

View File

@ -113,15 +113,15 @@ creative.set_creative_formspec = function(player, start_i, pagenum, tab_id)
tableoptions[background=#00000000;highlight=#00000000;border=false]
button[5.4,3.2;0.8,0.9;creative_prev;<]
button[7.25,3.2;0.8,0.9;creative_next;>]
button[2.1,3.4;0.8,0.5;search;?]
button[2.75,3.4;0.8,0.5;clear;X]
tooltip[search;Search]
tooltip[clear;Reset]
button[2.1,3.4;0.8,0.5;creative_search;?]
button[2.75,3.4;0.8,0.5;creative_clear;X]
tooltip[creative_search;Search]
tooltip[creative_clear;Reset]
listring[current_player;main]
]] ..
"field[0.3,3.5;2.2,1;filter;;".. filter .."]"..
"field[0.3,3.5;2.2,1;creative_filter;;".. filter .."]"..
"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(tab_id) ..";true;false]"..
"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) .."]"..
default.get_hotbar_bg(0,4.7)..
@ -139,7 +139,7 @@ creative.set_crafting_formspec = function(player)
list[detached:creative_trash;main;0,2.75;1,1;]
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]
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;craft]
]] ..
@ -158,15 +158,15 @@ minetest.register_on_joinplayer(function(player)
end)
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
end
-- Figure out current page from formspec
local player_name = player:get_player_name()
local formspec = player:get_inventory_formspec()
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 filter = formspec:match("creative_filter;;([%w_:]+)") or ""
local start_i = formspec:match("list%[.-".. player_name ..";.-;(%d+)%]")
local tab_id = tonumber(formspec:match("tabheader%[.-;(%d+)%;"))
local inv_size = player_inventory[player_name].size
start_i = tonumber(start_i) or 0
@ -174,20 +174,22 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if tab_id == 1 then
creative.set_crafting_formspec(player)
end
elseif fields.tabs then
if tonumber(fields.tabs) == 1 then
elseif fields.creative_tabs then
local tab = tonumber(fields.creative_tabs)
if tab == 1 then
creative.set_crafting_formspec(player)
else
creative.update_creative_inventory(player_name, filter, tonumber(fields.tabs))
creative.set_creative_formspec(player, 0, 1, tonumber(fields.tabs))
creative.update_creative_inventory(player_name, filter, tab)
creative.set_creative_formspec(player, 0, 1, tab)
end
elseif fields.clear then
elseif fields.creative_clear then
player_inventory[player_name].filter = ""
creative.update_creative_inventory(player_name, nil, tab_id)
creative.set_creative_formspec(player, 0, 1, tab_id)
elseif fields.search then
player_inventory[player_name].filter = fields.filter:lower()
creative.update_creative_inventory(player_name, fields.filter:lower(), tab_id)
elseif fields.creative_search then
local lowstr = fields.creative_filter:lower()
player_inventory[player_name].filter = lowstr
creative.update_creative_inventory(player_name, lowstr, tab_id)
creative.set_creative_formspec(player, 0, 1, tab_id)
else
if fields.creative_prev then

View File

@ -27,7 +27,6 @@ Cisoun's WTFPL texture pack:
default_lava.png
default_leaves.png
default_sapling.png
default_sign_wall.png
default_stone.png
default_tree.png
default_tree_top.png
@ -59,7 +58,6 @@ VanessaE (WTFPL):
default_desert_sand.png
default_desert_stone.png
default_sand.png
default_jungletree_top.png
Calinou (CC BY-SA):
default_brick.png
@ -100,28 +98,29 @@ Zeg9 (CC BY-SA 3.0):
default_gold_block.png
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_top.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_sapling.png
default_acacia_tree.png
default_acacia_tree_top.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_side.png
default_dry_grass_*.png
default_junglewood.png, derived from a texture by BlockMen (CC BY-SA 3.0)
default_grass.png, derived from a texture by Philipbenr (CC BY-SA 3.0)
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)
default_grass.png
default_grass_side.png
brunob.santos (CC BY-SA 4.0):
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_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):
default_cobble.png, based on texture by Brane praefect
default_mossycobble.png, based on texture by Brane praefect
@ -174,6 +176,8 @@ Gambit (WTFPL):
default_grass_*.png
default_paper.png
default_diamond_block.png
default_ladder_steel.png
default_sign_wall_wood.png
asl97 (WTFPL):
default_ice.png

View File

@ -23,7 +23,7 @@ minetest.register_alias("bookshelf", "default:bookshelf")
minetest.register_alias("glass", "default:glass")
minetest.register_alias("wooden_fence", "default:fence_wood")
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("mese", "default:mese")
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_source", "default:lava_source")
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("chest", "default:chest")
minetest.register_alias("locked_chest", "default:chest_locked")
@ -74,3 +74,7 @@ minetest.register_alias("default:mese_block", "default:mese")
-- Aliases for corrected pine node names
minetest.register_alias("default:pinetree", "default:pine_tree")
minetest.register_alias("default:pinewood", "default:pine_wood")
minetest.register_alias("default:ladder", "default:ladder_wood")
minetest.register_alias("default:sign_wall", "default:sign_wall_wood")

View File

@ -43,7 +43,16 @@ minetest.register_craft({
})
minetest.register_craft({
output = 'default:sign_wall',
output = 'default:sign_wall_steel 3',
recipe = {
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'', 'group:stick', ''},
}
})
minetest.register_craft({
output = 'default:sign_wall_wood 3',
recipe = {
{'group:wood', 'group:wood', 'group:wood'},
{'group:wood', 'group:wood', 'group:wood'},
@ -539,7 +548,7 @@ minetest.register_craft({
})
minetest.register_craft({
output = 'default:ladder',
output = 'default:ladder_wood 3',
recipe = {
{'group:stick', '', 'group:stick'},
{'group:stick', 'group:stick', 'group:stick'},
@ -547,6 +556,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({
output = 'default:mese',
recipe = {
@ -748,7 +766,31 @@ minetest.register_craft({
minetest.register_craft({
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 = 5,
})
@ -772,7 +814,7 @@ minetest.register_craft({
minetest.register_craft({
type = "fuel",
recipe = "default:sign_wall",
recipe = "default:sign_wall_wood",
burntime = 10,
})

View File

@ -3,7 +3,7 @@
minetest.register_craftitem("default:stick", {
description = "Stick",
inventory_image = "default_stick.png",
groups = {stick=1},
groups = {stick = 1},
})
minetest.register_craftitem("default:paper", {
@ -20,18 +20,20 @@ local function book_on_use(itemstack, user, pointed_thing)
end
local formspec
if owner == player_name then
formspec = "size[8,8]"..default.gui_bg..
"field[0.5,1;7.5,0;title;Title:;"..
minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;text;Contents:;"..
minetest.formspec_escape(text).."]"..
formspec = "size[8,8]" .. default.gui_bg ..
default.gui_bg_img ..
"field[0.5,1;7.5,0;title;Title:;" ..
minetest.formspec_escape(title) .. "]" ..
"textarea[0.5,1.5;7.5,7;text;Contents:;" ..
minetest.formspec_escape(text) .. "]" ..
"button_exit[2.5,7.5;3,1;save;Save]"
else
formspec = "size[8,8]"..default.gui_bg..
"label[0.5,0.5;by "..owner.."]"..
"label[0.5,0;"..minetest.formspec_escape(title).."]"..
"tableoptions[background=#00000000;highlight=#00000000;border=false]"..
"table[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text):gsub("\n", ",")..";1]"
formspec = "size[8,8]" .. default.gui_bg ..
default.gui_bg_img ..
"label[0.5,0.5;by " .. owner .. "]" ..
"label[0.5,0;" .. minetest.formspec_escape(title) .. "]" ..
"textarea[0.5,1.5;7.5,7;text;;" ..
minetest.formspec_escape(text) .. "]"
end
minetest.show_formspec(user:get_player_name(), "default:book", formspec)
end
@ -76,14 +78,14 @@ end)
minetest.register_craftitem("default:book", {
description = "Book",
inventory_image = "default_book.png",
groups = {book=1},
groups = {book = 1},
on_use = book_on_use,
})
minetest.register_craftitem("default:book_written", {
description = "Book With Text",
inventory_image = "default_book_written.png",
groups = {book=1, not_in_creative_inventory=1},
groups = {book = 1, not_in_creative_inventory = 1},
stack_max = 1,
on_use = book_on_use,
})
@ -91,7 +93,7 @@ minetest.register_craftitem("default:book_written", {
minetest.register_craft({
type = "shapeless",
output = "default:book_written",
recipe = { "default:book", "default:book_written" }
recipe = {"default:book", "default:book_written"}
})
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)

View File

@ -88,37 +88,24 @@ end
-- Lavacooling
--
default.cool_lava_source = function(pos)
minetest.set_node(pos, {name = "default:obsidian"})
minetest.sound_play("default_cool_lava",
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
default.cool_lava_flowing = function(pos)
minetest.set_node(pos, {name = "default:stone"})
default.cool_lava = function(pos, node)
if node.name == "default:lava_source" then
minetest.set_node(pos, {name = "default:obsidian"})
else -- Lava flowing
minetest.set_node(pos, {name = "default:stone"})
end
minetest.sound_play("default_cool_lava",
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
minetest.register_abm({
nodenames = {"default:lava_flowing"},
nodenames = {"default:lava_source", "default:lava_flowing"},
neighbors = {"group:water"},
interval = 1,
chance = 2,
chance = 1,
catch_up = false,
action = function(...)
default.cool_lava_flowing(...)
end,
})
minetest.register_abm({
nodenames = {"default:lava_source"},
neighbors = {"group:water"},
interval = 1,
chance = 2,
catch_up = false,
action = function(...)
default.cool_lava_source(...)
default.cool_lava(...)
end,
})
@ -177,8 +164,8 @@ end
minetest.register_abm({
nodenames = {"default:cactus"},
neighbors = {"group:sand"},
interval = 50,
chance = 20,
interval = 12,
chance = 83,
action = function(...)
default.grow_cactus(...)
end
@ -186,9 +173,9 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"default:papyrus"},
neighbors = {"default:dirt", "default:dirt_with_grass", "default:sand"},
interval = 50,
chance = 20,
neighbors = {"default:dirt", "default:dirt_with_grass"},
interval = 14,
chance = 71,
action = function(...)
default.grow_papyrus(...)
end
@ -226,16 +213,27 @@ function default.register_fence(name, def)
-- Allow almost everything to be overridden
local default_fields = {
paramtype = "light",
drawtype = "fencelike",
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 },
tiles = {def.texture},
sunlight_propagates = true,
is_ground_content = false,
selection_box = {
type = "fixed",
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
},
groups = {},
}
for k, v in pairs(default_fields) do
@ -270,9 +268,11 @@ minetest.register_globalstep(function(dtime)
end)
default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
node.param2 = 1
minetest.set_node(pos, node)
if placer and not placer:get_player_control().sneak then
local node = minetest.get_node(pos)
node.param2 = 1
minetest.set_node(pos, node)
end
end
minetest.register_abm({
@ -358,8 +358,9 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"default:dirt"},
interval = 2,
chance = 200,
neighbors = {"air"},
interval = 6,
chance = 67,
catch_up = false,
action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
@ -384,8 +385,8 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"default:dirt_with_grass", "default:dirt_with_dry_grass"},
interval = 2,
chance = 20,
interval = 8,
chance = 50,
catch_up = false,
action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
@ -407,7 +408,7 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"default:cobble"},
neighbors = {"group:water"},
interval = 17,
interval = 16,
chance = 200,
catch_up = false,
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()
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
--
@ -106,9 +237,26 @@ minetest.register_node("default:furnace", {
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
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_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_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
@ -138,154 +286,12 @@ minetest.register_node("default:furnace_active", {
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_timer = furnace_node_timer,
can_dig = can_dig,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
})
--
-- ABM
--
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
minetest.register_abm({
nodenames = {"default:furnace", "default:furnace_active"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
--
-- 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
--
-- Inizialize inventory
--
local inv = meta:get_inventory()
for listname, size in pairs({
src = 1,
fuel = 1,
dst = 4,
}) do
if inv:get_size(listname) ~= size then
inv:set_size(listname, size)
end
end
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 "
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")
else
if not fuellist[1]:is_empty() then
fuel_state = "0%"
end
swap_node(pos, "default:furnace")
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)
end,
})

View File

@ -991,8 +991,8 @@ function default.register_decorations()
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0.04,
scale = 0.02,
offset = 0.036,
scale = 0.022,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
@ -1010,8 +1010,8 @@ function default.register_decorations()
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0.002,
scale = 0.001,
offset = 0.0018,
scale = 0.0011,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
@ -1021,17 +1021,17 @@ function default.register_decorations()
y_min = 1,
y_max = 31000,
schematic = {
size = { x = 3, y = 3, z = 1},
size = {x = 3, y = 3, z = 1},
data = {
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "default:tree", param2 = 12, prob = 191 },
{ name = "default:tree", param2 = 12 },
{ name = "default:tree", param2 = 12, prob = 127 },
{ name = "air", prob = 0 },
{ name = "flowers:mushroom_brown", prob = 63 },
{ name = "air", prob = 0 },
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "default:tree", param2 = 12, prob = 191},
{name = "default:tree", param2 = 12},
{name = "default:tree", param2 = 12, prob = 127},
{name = "air", prob = 0},
{name = "flowers:mushroom_brown", prob = 63},
{name = "air", prob = 0},
},
},
flags = "place_center_x",
@ -1062,17 +1062,17 @@ function default.register_decorations()
y_min = 1,
y_max = 31000,
schematic = {
size = { x = 3, y = 3, z = 1},
size = {x = 3, y = 3, z = 1},
data = {
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "default:jungletree", param2 = 12, prob = 191 },
{ name = "default:jungletree", param2 = 12 },
{ name = "default:jungletree", param2 = 12, prob = 127 },
{ name = "air", prob = 0 },
{ name = "flowers:mushroom_brown", prob = 127 },
{ name = "air", prob = 0 },
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "default:jungletree", param2 = 12, prob = 191},
{name = "default:jungletree", param2 = 12},
{name = "default:jungletree", param2 = 12, prob = 127},
{name = "air", prob = 0},
{name = "flowers:mushroom_brown", prob = 127},
{name = "air", prob = 0},
},
},
flags = "place_center_x",
@ -1086,8 +1086,8 @@ function default.register_decorations()
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0.04,
scale = 0.02,
offset = 0.036,
scale = 0.022,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
@ -1104,22 +1104,29 @@ function default.register_decorations()
deco_type = "schematic",
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
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"},
y_min = 1,
y_max = 31000,
schematic = {
size = { x = 3, y = 3, z = 1},
size = {x = 3, y = 3, z = 1},
data = {
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "default:pine_tree", param2 = 12, prob = 191 },
{ name = "default:pine_tree", param2 = 12 },
{ name = "default:pine_tree", param2 = 12, prob = 127 },
{ name = "air", prob = 0 },
{ name = "flowers:mushroom_red", prob = 63 },
{ name = "air", prob = 0 },
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "default:pine_tree", param2 = 12, prob = 191},
{name = "default:pine_tree", param2 = 12},
{name = "default:pine_tree", param2 = 12, prob = 127},
{name = "air", prob = 0},
{name = "flowers:mushroom_red", prob = 63},
{name = "air", prob = 0},
},
},
flags = "place_center_x",
@ -1164,14 +1171,14 @@ function default.register_decorations()
y_min = 1,
y_max = 31000,
schematic = {
size = { x = 3, y = 2, z = 1},
size = {x = 3, y = 2, z = 1},
data = {
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "default:acacia_tree", param2 = 12, prob = 191 },
{ name = "default:acacia_tree", param2 = 12 },
{ name = "default:acacia_tree", param2 = 12, prob = 127 },
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "default:acacia_tree", param2 = 12, prob = 191},
{name = "default:acacia_tree", param2 = 12},
{name = "default:acacia_tree", param2 = 12, prob = 127},
},
},
flags = "place_center_x",
@ -1186,7 +1193,7 @@ function default.register_decorations()
sidelen = 16,
noise_params = {
offset = 0.0,
scale = -0.03,
scale = -0.015,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
@ -1206,7 +1213,7 @@ function default.register_decorations()
sidelen = 16,
noise_params = {
offset = 0.0,
scale = -0.0015,
scale = -0.0008,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
@ -1216,17 +1223,17 @@ function default.register_decorations()
y_min = 1,
y_max = 31000,
schematic = {
size = { x = 3, y = 3, z = 1},
size = {x = 3, y = 3, z = 1},
data = {
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "air", prob = 0 },
{ name = "default:aspen_tree", param2 = 12 },
{ name = "default:aspen_tree", param2 = 12 },
{ name = "default:aspen_tree", param2 = 12, prob = 127 },
{ name = "flowers:mushroom_red", prob = 63 },
{ name = "flowers:mushroom_brown", prob = 63 },
{ name = "air", prob = 0 },
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "default:aspen_tree", param2 = 12},
{name = "default:aspen_tree", param2 = 12},
{name = "default:aspen_tree", param2 = 12, prob = 127},
{name = "flowers:mushroom_red", prob = 63},
{name = "flowers:mushroom_brown", prob = 63},
{name = "air", prob = 0},
},
},
flags = "place_center_x",

Binary file not shown.

Binary file not shown.

View File

@ -146,9 +146,11 @@ default:chest_locked
default:bookshelf
default:sign_wall
default:sign_wall_wood
default:sign_wall_steel
default:ladder
default:ladder_wood
default:ladder_steel
default:fence_wood
default:fence_acacia_wood
@ -324,11 +326,10 @@ minetest.register_node("default:dirt_with_snow", {
groups = {crumbly = 3, soil = 1},
drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({
footstep = {name = "default_snow_footstep", gain = 0.25},
footstep = {name = "default_snow_footstep", gain = 0.15},
}),
})
minetest.register_node("default:sand", {
description = "Sand",
tiles = {"default_sand.png"},
@ -380,8 +381,9 @@ minetest.register_node("default:snow", {
},
groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1},
sounds = default.node_sound_dirt_defaults({
footstep = {name = "default_snow_footstep", gain = 0.25},
dug = {name = "default_snow_footstep", gain = 0.75},
footstep = {name = "default_snow_footstep", gain = 0.15},
dug = {name = "default_snow_footstep", gain = 0.2},
dig = {name = "default_snow_footstep", gain = 0.2}
}),
on_construct = function(pos)
@ -397,12 +399,12 @@ minetest.register_node("default:snowblock", {
tiles = {"default_snow.png"},
groups = {crumbly = 3, puts_out_fire = 1},
sounds = default.node_sound_dirt_defaults({
footstep = {name = "default_snow_footstep", gain = 0.25},
dug = {name = "default_snow_footstep", gain = 0.75},
footstep = {name = "default_snow_footstep", gain = 0.15},
dug = {name = "default_snow_footstep", gain = 0.2},
dig = {name = "default_snow_footstep", gain = 0.2}
}),
})
minetest.register_node("default:ice", {
description = "Ice",
tiles = {"default_ice.png"},
@ -879,10 +881,6 @@ minetest.register_node("default:cactus", {
groups = {snappy = 1, choppy = 3, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
after_dig_node = function(pos, node, metadata, digger)
default.dig_up(pos, node, digger)
end,
})
minetest.register_node("default:papyrus", {
@ -1055,7 +1053,6 @@ end
minetest.register_node("default:water_source", {
description = "Water Source",
inventory_image = minetest.inventorycube("default_water.png"),
drawtype = "liquid",
tiles = {
{
@ -1100,7 +1097,6 @@ minetest.register_node("default:water_source", {
minetest.register_node("default:water_flowing", {
description = "Flowing Water",
inventory_image = minetest.inventorycube("default_water.png"),
drawtype = "flowingliquid",
tiles = {"default_water.png"},
special_tiles = {
@ -1147,7 +1143,6 @@ minetest.register_node("default:water_flowing", {
minetest.register_node("default:river_water_source", {
description = "River Water Source",
inventory_image = minetest.inventorycube("default_river_water.png"),
drawtype = "liquid",
tiles = {
{
@ -1193,7 +1188,6 @@ minetest.register_node("default:river_water_source", {
minetest.register_node("default:river_water_flowing", {
description = "Flowing River Water",
inventory_image = minetest.inventorycube("default_river_water.png"),
drawtype = "flowingliquid",
tiles = {"default_river_water.png"},
special_tiles = {
@ -1242,7 +1236,6 @@ minetest.register_node("default:river_water_flowing", {
minetest.register_node("default:lava_source", {
description = "Lava Source",
inventory_image = minetest.inventorycube("default_lava.png"),
drawtype = "liquid",
tiles = {
{
@ -1289,7 +1282,6 @@ minetest.register_node("default:lava_source", {
minetest.register_node("default:lava_flowing", {
description = "Flowing Lava",
inventory_image = minetest.inventorycube("default_lava.png"),
drawtype = "flowingliquid",
tiles = {"default_lava.png"},
special_tiles = {
@ -1420,7 +1412,14 @@ local function get_locked_chest_formspec(pos)
end
local function has_locked_chest_privilege(meta, player)
if player:get_player_name() ~= meta:get_string("owner") then
local name = ""
if player then
if minetest.check_player_privs(player, "protection_bypass") then
return true
end
name = player:get_player_name()
end
if name ~= meta:get_string("owner") then
return false
end
return true
@ -1455,11 +1454,13 @@ minetest.register_node("default:chest", {
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" moves stuff to chest at " .. minetest.pos_to_string(pos))
" moves " .. stack:get_name() ..
" to chest at " .. minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" takes stuff from chest at " .. minetest.pos_to_string(pos))
" takes " .. stack:get_name() ..
" from chest at " .. minetest.pos_to_string(pos))
end,
})
@ -1515,11 +1516,13 @@ minetest.register_node("default:chest_locked", {
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" moves stuff to locked chest at " .. minetest.pos_to_string(pos))
" moves " .. stack:get_name() ..
" to locked chest at " .. minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" takes stuff from locked chest at " .. minetest.pos_to_string(pos))
" takes " .. stack:get_name() ..
" from locked chest at " .. minetest.pos_to_string(pos))
end,
on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos)
@ -1611,56 +1614,67 @@ minetest.register_node("default:bookshelf", {
end,
})
local function register_sign(material, desc, def)
minetest.register_node("default:sign_wall_" .. material, {
description = desc .. " Sign",
drawtype = "nodebox",
tiles = {"default_sign_wall_" .. material .. ".png"},
inventory_image = "default_sign_" .. material .. ".png",
wield_image = "default_sign_" .. material .. ".png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
is_ground_content = false,
walkable = false,
node_box = {
type = "wallmounted",
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
},
groups = def.groups,
legacy_wallmounted = true,
sounds = def.sounds,
minetest.register_node("default:sign_wall", {
description = "Sign",
drawtype = "nodebox",
tiles = {"default_sign.png"},
inventory_image = "default_sign_wall.png",
wield_image = "default_sign_wall.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
is_ground_content = false,
walkable = false,
node_box = {
type = "wallmounted",
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
},
groups = {choppy = 2, dig_immediate = 2, attached_node = 1},
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
on_construct = function(pos)
--local n = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "field[text;;${text}]")
meta:set_string("infotext", "\"\"")
end,
on_receive_fields = function(pos, formname, fields, sender)
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
local player_name = sender:get_player_name()
if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name)
return
end
local meta = minetest.get_meta(pos)
if not fields.text then return end
minetest.log("action", (player_name or "") .. " wrote \"" ..
fields.text .. "\" to sign at " .. minetest.pos_to_string(pos))
meta:set_string("text", fields.text)
meta:set_string("infotext", '"' .. fields.text .. '"')
end,
})
end
on_construct = function(pos)
--local n = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "field[text;;${text}]")
meta:set_string("infotext", "\"\"")
end,
on_receive_fields = function(pos, formname, fields, sender)
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
if minetest.is_protected(pos, sender:get_player_name()) then
minetest.record_protection_violation(pos, sender:get_player_name())
return
end
local meta = minetest.get_meta(pos)
if not fields.text then return end
minetest.log("action", (sender:get_player_name() or "") .. " wrote \"" ..
fields.text .. "\" to sign at " .. minetest.pos_to_string(pos))
meta:set_string("text", fields.text)
meta:set_string("infotext", '"' .. fields.text .. '"')
end,
register_sign("wood", "Wooden", {
sounds = default.node_sound_wood_defaults(),
groups = {choppy = 2, attached_node = 1, flammable = 2}
})
register_sign("steel", "Steel", {
sounds = default.node_sound_defaults(),
groups = {cracky = 2, attached_node = 1}
})
minetest.register_node("default:ladder", {
description = "Ladder",
minetest.register_node("default:ladder_wood", {
description = "Wooden Ladder",
drawtype = "signlike",
tiles = {"default_ladder.png"},
inventory_image = "default_ladder.png",
wield_image = "default_ladder.png",
tiles = {"default_ladder_wood.png"},
inventory_image = "default_ladder_wood.png",
wield_image = "default_ladder_wood.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
@ -1678,9 +1692,31 @@ minetest.register_node("default:ladder", {
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("default:ladder_steel", {
description = "Steel Ladder",
drawtype = "signlike",
tiles = {"default_ladder_steel.png"},
inventory_image = "default_ladder_steel.png",
wield_image = "default_ladder_steel.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
climbable = true,
is_ground_content = false,
selection_box = {
type = "wallmounted",
--wall_top = = <default>
--wall_bottom = = <default>
--wall_side = = <default>
},
groups = {cracky = 2},
sounds = default.node_sound_stone_defaults(),
})
default.register_fence("default:fence_wood", {
description = "Wooden Fence",
texture = "default_wood.png",
texture = "default_fence_wood.png",
material = "default:wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
@ -1688,7 +1724,7 @@ default.register_fence("default:fence_wood", {
default.register_fence("default:fence_acacia_wood", {
description = "Acacia Fence",
texture = "default_acacia_wood.png",
texture = "default_fence_acacia_wood.png",
material = "default:acacia_wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
@ -1696,7 +1732,7 @@ default.register_fence("default:fence_acacia_wood", {
default.register_fence("default:fence_junglewood", {
description = "Junglewood Fence",
texture = "default_junglewood.png",
texture = "default_fence_junglewood.png",
material = "default:junglewood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
@ -1704,7 +1740,7 @@ default.register_fence("default:fence_junglewood", {
default.register_fence("default:fence_pine_wood", {
description = "Pine Fence",
texture = "default_pine_wood.png",
texture = "default_fence_pine_wood.png",
material = "default:pine_wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
@ -1712,7 +1748,7 @@ default.register_fence("default:fence_pine_wood", {
default.register_fence("default:fence_aspen_wood", {
description = "Aspen Fence",
texture = "default_aspen_wood.png",
texture = "default_fence_aspen_wood.png",
material = "default:aspen_wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
@ -1722,7 +1758,6 @@ minetest.register_node("default:glass", {
description = "Glass",
drawtype = "glasslike_framed_optional",
tiles = {"default_glass.png", "default_glass_detail.png"},
inventory_image = minetest.inventorycube("default_glass.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
@ -1734,7 +1769,6 @@ minetest.register_node("default:obsidian_glass", {
description = "Obsidian Glass",
drawtype = "glasslike_framed_optional",
tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
inventory_image = minetest.inventorycube("default_obsidian_glass.png"),
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 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.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 834 B

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 467 B

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

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

View File

@ -1,10 +1,10 @@
local random = math.random
--
-- Grow trees from saplings
--
-- 'Can grow' function
local random = math.random
-- 'can grow' function
function default.can_grow(pos)
local node_under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
@ -24,6 +24,39 @@ function default.can_grow(pos)
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
minetest.register_abm({
@ -57,8 +90,11 @@ minetest.register_abm({
elseif node.name == "default:pine_sapling" then
minetest.log("action", "A pine sapling grows into a tree at "..
minetest.pos_to_string(pos))
local snow = is_snow_nearby(pos)
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
default.grow_new_pine_tree(pos)
end
@ -199,7 +235,8 @@ function default.grow_jungle_tree(pos, bad)
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
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
for z_dist = -1, 1 do
@ -240,7 +277,7 @@ local function add_snow(data, vi, c_air, c_ignore, c_snow)
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 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_needles = minetest.get_content_id("default:pine_needles")
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 - 3, y = y - 1, z = z - 3},
{x = x - 3, y = y, z = z - 3},
{x = x + 3, y = maxy + 3, z = z + 3}
)
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
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
local dev = 3
for yy = maxy - 1, maxy + 1 do
@ -350,7 +370,8 @@ function default.grow_pine_tree(pos)
end
-- 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
local vi = a:index(x, yy, z)
local node_id = data[vi]
@ -369,42 +390,57 @@ end
-- New apple tree
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},
path, 0, nil, false)
path, "0", nil, false)
end
-- New jungle tree
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},
path, 0, nil, false)
path, "0", nil, false)
end
-- New pine tree
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},
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
-- New acacia tree
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},
path, random, nil, false)
path, "random", nil, false)
end
-- New aspen tree
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},
path, 0, nil, false)
path, "0", nil, false)
end

View File

@ -1,12 +1,16 @@
Minetest Game mod: doors
========================
version: 1.3
version: 2.0
License of source code:
-----------------------
Copyright (C) 2012 PilzAdam
modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor)
Steel trapdoor added by sofar.
Copyright (C) 2016 sofar@foo-projects.org
Re-implemented most of the door algorithms, added meshes, UV wrapped texture
Added doors API to facilitate coding mods accessing and operating doors.
Added Fence Gate model, code, and sounds
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
@ -40,8 +44,25 @@ following textures created by sofar (CC-BY-SA-3.0)
doors_trapdoor_steel_side.png
door_trapdoor_side.png
Obsidian door textures by red-001 based on textures by Pilzadam and BlockMen: WTFPL
door_obsidian_glass.png
Glass door textures by red-001 based on textures by celeron55: CC BY-SA 3.0
door_glass.png
All other textures (created by PilzAdam): WTFPL
Door textures were converted to the new texture map by sofar, paramat and
red-001, under the same license as the originals.
Models:
--------------------------------------
Door 3d models by sofar (CC-BY-SA-3.0)
- door_a.obj
- door_b.obj
Fence gate models by sofar (CC-BY-SA-3.0)
- fencegate_open.obj
- fencegate_closed.obj
License of sounds
--------------------------------------
@ -49,3 +70,9 @@ Opening-Sound created by CGEffex (CC BY 3.0), modified by BlockMen
door_open.ogg
Closing-Sound created by bennstir (CC BY 3.0)
door_close.ogg
fencegate_open.ogg:
http://www.freesound.org/people/mhtaylor67/sounds/126041/ - CC0
fencegate_close.ogg:
http://www.freesound.org/people/BarkersPinhead/sounds/274807/ - CC-BY-3.0
http://www.freesound.org/people/rivernile7/sounds/249573/ - CC-BY-3.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
# Blender v2.76 (sub 0) OBJ File: 'door_a.blend'
# www.blender.org
mtllib door_a.mtl
o Cube_Cube.001
v 0.499000 -0.499000 -0.499000
v 0.499000 1.499000 -0.499000
v 0.499000 -0.499000 -0.375000
v 0.499000 1.499000 -0.375000
v -0.499000 -0.499000 -0.499000
v -0.499000 1.499000 -0.499000
v -0.499000 -0.499000 -0.375000
v -0.499000 1.499000 -0.375000
vt 0.842105 1.000000
vt 0.894737 1.000000
vt 0.894737 0.000000
vt 0.842105 0.000000
vt 0.421053 1.000000
vt 0.421053 0.000000
vt 0.947368 1.000000
vt 0.947368 0.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 1.000000 0.500000
vt 0.947368 0.500000
vt 1.000000 1.000000
vt 1.000000 0.000000
vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn -1.000000 0.000000 0.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
usemtl None
s off
f 2/1/1 4/2/1 3/3/1 1/4/1
f 4/5/2 8/1/2 7/4/2 3/6/2
f 8/2/3 6/7/3 5/8/3 7/3/3
f 6/9/4 2/5/4 1/6/4 5/10/4
f 1/11/5 3/12/5 7/7/5 5/13/5
f 6/14/6 8/8/6 4/12/6 2/11/6

View File

@ -0,0 +1,40 @@
# Blender v2.76 (sub 0) OBJ File: 'door_b.blend'
# www.blender.org
mtllib door_b.mtl
o Cube_Cube.001
v -0.499000 -0.499000 -0.499000
v -0.499000 1.499000 -0.499000
v -0.499000 -0.499000 -0.375000
v -0.499000 1.499000 -0.375000
v 0.499000 -0.499000 -0.499000
v 0.499000 1.499000 -0.499000
v 0.499000 -0.499000 -0.375000
v 0.499000 1.499000 -0.375000
vt 0.842105 1.000000
vt 0.842105 0.000000
vt 0.894737 0.000000
vt 0.894737 1.000000
vt 0.421053 1.000000
vt 0.421053 0.000000
vt 0.947368 0.000000
vt 0.947368 1.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 0.500000
vt 0.947368 0.500000
vt 1.000000 1.000000
vn -1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
usemtl None
s off
f 2/1/1 1/2/1 3/3/1 4/4/1
f 4/5/2 3/6/2 7/2/2 8/1/2
f 8/4/3 7/3/3 5/7/3 6/8/3
f 6/9/4 5/10/4 1/6/4 2/5/4
f 1/11/5 5/12/5 7/13/5 3/7/5
f 6/8/6 2/13/6 4/12/6 8/14/6

View File

@ -0,0 +1,106 @@
# Blender v2.76 (sub 0) OBJ File: 'gate_closed.blend'
# www.blender.org
mtllib gate_closed.mtl
o Cube_Cube.001
v -0.625000 -0.500000 0.125000
v -0.625000 0.500000 0.125000
v -0.625000 -0.500000 -0.125000
v -0.625000 0.500000 -0.125000
v -0.375000 -0.500000 0.125000
v -0.375000 0.500000 0.125000
v -0.375000 -0.500000 -0.125000
v -0.375000 0.500000 -0.125000
v 0.375000 -0.500000 0.125000
v 0.375000 0.500000 0.125000
v 0.375000 -0.500000 -0.125000
v 0.375000 0.500000 -0.125000
v 0.625000 -0.500000 0.125000
v 0.625000 0.500000 0.125000
v 0.625000 -0.500000 -0.125000
v 0.625000 0.500000 -0.125000
v -0.375000 0.187500 0.062500
v -0.375000 0.312500 0.062500
v -0.375000 0.187500 -0.062500
v -0.375000 0.312500 -0.062500
v 0.375000 0.187500 0.062500
v 0.375000 0.312500 0.062500
v 0.375000 0.187500 -0.062500
v 0.375000 0.312500 -0.062500
v -0.374831 0.187348 0.062500
v -0.156342 0.187363 0.062500
v -0.374831 0.187348 -0.062500
v -0.156342 0.187363 -0.062500
v 0.374981 -0.343683 0.062500
v 0.375065 -0.187304 0.062500
v 0.374981 -0.343683 -0.062500
v 0.375065 -0.187304 -0.062500
vt 0.000000 0.750000
vt 0.000000 0.500000
vt 1.000000 0.500000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt -0.000000 1.000000
vt 1.000000 -0.000000
vt 1.000000 0.250000
vt 0.000000 0.250000
vt -0.000000 0.000000
vt 0.250000 0.000000
vt 0.250000 0.250000
vt 0.250000 0.750000
vt 0.250000 1.000000
vt 0.500000 -0.000000
vt 0.500000 0.250000
vt 0.500000 0.750000
vt 0.500000 1.000000
vt 1.000000 0.625000
vt 0.000000 0.625000
vt 1.000000 0.875000
vt 0.000000 0.875000
vt -0.000000 0.687500
vt 0.000000 0.562500
vt 1.000000 0.562500
vt 1.000000 0.687500
vt 0.813740 0.249033
vt 0.201557 0.249293
vt 0.120995 0.125498
vt 0.987404 0.125469
vt 0.125000 0.375000
vt 0.812500 0.375000
vt 0.937500 0.500000
vt 0.062500 0.500000
vt 0.000000 0.125000
vt 1.000000 0.125000
vt 0.312500 0.437500
vt 0.312500 0.312500
vt 1.000000 0.312500
vt 1.000000 0.437500
vn -1.000000 0.000000 0.000000
vn 0.000000 0.000000 -1.000000
vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn -0.578000 -0.816100 0.000000
vn 0.576200 0.817300 0.000000
usemtl None
s off
f 2/1/1 4/2/1 3/3/1 1/4/1
f 4/4/2 8/5/2 7/6/2 3/1/2
f 8/7/3 6/8/3 5/9/3 7/10/3
f 6/2/4 2/9/4 1/8/4 5/3/4
f 1/9/5 3/10/5 7/11/5 5/12/5
f 6/6/6 8/1/6 4/13/6 2/14/6
f 10/1/1 12/2/1 11/3/1 9/4/1
f 12/2/2 16/9/2 15/8/2 11/3/2
f 16/7/3 14/8/3 13/9/3 15/10/3
f 14/4/4 10/5/4 9/6/4 13/1/4
f 9/12/5 11/11/5 15/15/5 13/16/5
f 14/14/6 16/13/6 12/17/6 10/18/6
f 20/2/2 24/3/2 23/19/2 19/20/2
f 22/1/4 18/4/4 17/21/4 21/22/4
f 17/23/5 19/24/5 23/25/5 21/26/5
f 22/21/6 24/5/6 20/6/6 18/22/6
f 28/27/2 32/28/2 31/29/2 27/30/2
f 30/31/4 26/32/4 25/33/4 29/34/4
f 25/35/7 27/10/7 31/7/7 29/36/7
f 30/37/8 32/38/8 28/39/8 26/40/8

View File

@ -0,0 +1,112 @@
# Blender v2.76 (sub 0) OBJ File: 'gate_open.blend'
# www.blender.org
mtllib gate_open.mtl
o Cube_Cube.001
v -0.625000 -0.500000 0.125000
v -0.625000 0.500000 0.125000
v -0.625000 -0.500000 -0.125000
v -0.625000 0.500000 -0.125000
v -0.375000 -0.500000 0.125000
v -0.375000 0.500000 0.125000
v -0.375000 -0.500000 -0.125000
v -0.375000 0.500000 -0.125000
v 0.375000 -0.500000 0.125000
v 0.375000 0.500000 0.125000
v 0.375000 -0.500000 -0.125000
v 0.375000 0.500000 -0.125000
v 0.625000 -0.500000 0.125000
v 0.625000 0.500000 0.125000
v 0.625000 -0.500000 -0.125000
v 0.625000 0.500000 -0.125000
v 0.434859 0.187500 -0.872359
v 0.434859 0.312500 -0.872359
v 0.559859 0.187500 -0.872359
v 0.559859 0.312500 -0.872359
v 0.434859 0.187500 -0.122359
v 0.434859 0.312500 -0.122359
v 0.559859 0.187500 -0.122359
v 0.559859 0.312500 -0.122359
v 0.434859 0.187348 -0.872190
v 0.434859 0.187363 -0.653701
v 0.559859 0.187348 -0.872190
v 0.559859 0.187363 -0.653701
v 0.434859 -0.343683 -0.122379
v 0.434859 -0.187304 -0.122294
v 0.559859 -0.343683 -0.122379
v 0.559859 -0.187304 -0.122294
v 0.499560 -0.442900 0.005495
vt 0.000000 0.750000
vt 0.000000 0.500000
vt 1.000000 0.500000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt -0.000000 1.000000
vt 1.000000 -0.000000
vt 1.000000 0.250000
vt 0.000000 0.250000
vt -0.000000 0.000000
vt 0.250000 0.000000
vt 0.250000 0.250000
vt 0.250000 0.750000
vt 0.250000 1.000000
vt 0.500000 -0.000000
vt 0.500000 0.250000
vt 0.500000 0.750000
vt 0.500000 1.000000
vt 1.000000 0.625000
vt 0.000000 0.625000
vt 1.000000 0.875000
vt 0.000000 0.875000
vt -0.000000 0.687500
vt 0.000000 0.562500
vt 1.000000 0.562500
vt 1.000000 0.687500
vt 0.813740 0.249033
vt 0.201557 0.249293
vt 0.120995 0.125498
vt 0.987404 0.125469
vt 0.125000 0.375000
vt 0.812500 0.375000
vt 0.937500 0.500000
vt 0.062500 0.500000
vt 0.000000 0.125000
vt 1.000000 0.125000
vt 0.312500 0.437500
vt 0.312500 0.312500
vt 1.000000 0.312500
vt 1.000000 0.437500
vt 0.312500 0.625000
vt 0.312500 0.500000
vt 0.187500 0.500000
vt 0.187500 0.625000
vn -1.000000 0.000000 0.000000
vn 0.000000 0.000000 -1.000000
vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 -0.816100 -0.578000
vn 0.000000 0.817300 0.576200
usemtl None
s off
f 2/1/1 4/2/1 3/3/1 1/4/1
f 4/4/2 8/5/2 7/6/2 3/1/2
f 8/7/3 6/8/3 5/9/3 7/10/3
f 6/2/4 2/9/4 1/8/4 5/3/4
f 1/9/5 3/10/5 7/11/5 5/12/5
f 6/6/6 8/1/6 4/13/6 2/14/6
f 10/1/1 12/2/1 11/3/1 9/4/1
f 12/2/2 16/9/2 15/8/2 11/3/2
f 16/7/3 14/8/3 13/9/3 15/10/3
f 14/4/4 10/5/4 9/6/4 13/1/4
f 9/12/5 11/11/5 15/15/5 13/16/5
f 14/14/6 16/13/6 12/17/6 10/18/6
f 20/2/3 24/3/3 23/19/3 19/20/3
f 22/1/1 18/4/1 17/21/1 21/22/1
f 17/23/5 19/24/5 23/25/5 21/26/5
f 22/21/6 24/5/6 20/6/6 18/22/6
f 28/27/3 32/28/3 31/29/3 27/30/3
f 30/31/1 26/32/1 25/33/1 29/34/1
f 25/35/7 27/10/7 31/7/7 29/36/7
f 30/37/8 32/38/8 28/39/8 26/40/8
f 17/41/2 18/42/2 20/43/2 19/44/2

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

View File

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 128 B

View File

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

View File

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

View File

@ -1,39 +1,58 @@
-- minetest/dye/init.lua
-- Other mods can use these for looping through available colors
dye = {}
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
local dyelocal = {}
-- Make dye names and descriptions available globally
-- This collection of colors is partly a historic thing, partly something else.
dyelocal.dyes = {
{"white", "White dye", {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=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}},
{"black", "Black dye", {dye=1, basecolor_black=1, excolor_black=1, unicolor_black=1}},
{"violet", "Violet dye", {dye=1, basecolor_magenta=1, excolor_violet=1, unicolor_violet=1}},
{"blue", "Blue dye", {dye=1, basecolor_blue=1, excolor_blue=1, unicolor_blue=1}},
{"cyan", "Cyan dye", {dye=1, basecolor_cyan=1, excolor_cyan=1, unicolor_cyan=1}},
{"dark_green", "Dark green dye",{dye=1, basecolor_green=1, excolor_green=1, unicolor_dark_green=1}},
{"green", "Green dye", {dye=1, basecolor_green=1, excolor_green=1, unicolor_green=1}},
{"yellow", "Yellow dye", {dye=1, basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}},
{"brown", "Brown dye", {dye=1, basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1}},
{"orange", "Orange dye", {dye=1, basecolor_orange=1, excolor_orange=1, unicolor_orange=1}},
{"red", "Red dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_red=1}},
{"magenta", "Magenta dye", {dye=1, basecolor_magenta=1, excolor_red_violet=1,unicolor_red_violet=1}},
{"pink", "Pink dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_light_red=1}},
dye.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}},
{"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}},
{"black", "Black dye", {dye=1, basecolor_black=1, excolor_black=1, unicolor_black=1}},
{"violet", "Violet dye", {dye=1, basecolor_magenta=1, excolor_violet=1, unicolor_violet=1}},
{"blue", "Blue dye", {dye=1, basecolor_blue=1, excolor_blue=1, unicolor_blue=1}},
{"cyan", "Cyan dye", {dye=1, basecolor_cyan=1, excolor_cyan=1, unicolor_cyan=1}},
{"dark_green", "Dark green dye", {dye=1, basecolor_green=1, excolor_green=1, unicolor_dark_green=1}},
{"green", "Green dye", {dye=1, basecolor_green=1, excolor_green=1, unicolor_green=1}},
{"yellow", "Yellow dye", {dye=1, basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}},
{"brown", "Brown dye", {dye=1, basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1}},
{"orange", "Orange dye", {dye=1, basecolor_orange=1, excolor_orange=1, unicolor_orange=1}},
{"red", "Red dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_red=1}},
{"magenta", "Magenta dye", {dye=1, basecolor_magenta=1, excolor_red_violet=1, unicolor_red_violet=1}},
{"pink", "Pink dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_light_red=1}},
}
-- Define items
for _, row in ipairs(dyelocal.dyes) do
for _, row in ipairs(dyes) do
local name = row[1]
local description = row[2]
local groups = row[3]
local item_name = "dye:"..name
local item_image = "dye_"..name..".png"
local item_name = "dye:" .. name
local item_image = "dye_" .. name .. ".png"
minetest.register_craftitem(item_name, {
inventory_image = item_image,
description = description,
@ -41,11 +60,13 @@ for _, row in ipairs(dyelocal.dyes) do
})
minetest.register_craft({
type = "shapeless",
output = item_name.." 4",
recipe = {"group:flower,color_"..name},
output = item_name .. " 4",
recipe = {"group:flower,color_" .. name},
})
end
-- manually add coal->black dye
-- Manually add coal->black dye
minetest.register_craft({
type = "shapeless",
output = "dye:black 4",
@ -55,33 +76,34 @@ minetest.register_craft({
-- Mix recipes
-- 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"}
local mixbases = {"pink", "magenta", "red", "orange", "brown", "yellow", "green", "dark_green", "cyan", "blue", "violet", "black", "dark_grey", "grey", "white"}
dyelocal.mixes = {
-- magenta, red, orange, brown, yellow, green, dark_green, cyan, blue, violet, black, dark_grey, grey, white
white = {"pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet", "grey", "grey", "white", "white"},
grey = {"pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "pink", "dark_grey","grey", "grey"},
dark_grey={"brown","brown", "brown", "brown", "brown","dark_green","dark_green","blue","blue","violet","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"},
blue = {"violet", "magenta","brown","brown","dark_green","cyan","cyan", "cyan", "blue"},
cyan = {"blue","brown","dark_green","dark_grey","green","cyan","dark_green","cyan"},
dark_green={"brown","brown","brown", "brown", "green", "green", "dark_green"},
green = {"brown", "yellow","yellow","dark_green","green","green"},
yellow= {"red", "orange", "yellow","orange", "yellow"},
brown = {"brown", "brown","orange", "brown"},
orange= {"red", "orange","orange"},
red = {"magenta","red"},
magenta={"magenta"},
local mixes = {
-- pink, magenta, red, orange, brown, yellow, green, dark_green, cyan, blue, violet, black, dark_grey, grey, white
white = {"pink", "pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet","grey", "grey", "grey","white"},
grey = {"pink", "pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet","dark_grey","grey", "grey"},
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"},
violet = {"magenta","magenta","magenta","red", "brown", "red", "cyan", "brown", "blue", "violet","violet"},
blue = {"violet", "violet", "magenta","brown", "brown", "dark_green","cyan", "cyan", "cyan", "blue"},
cyan = {"brown", "blue", "brown", "dark_green","dark_grey", "green", "cyan", "dark_green","cyan"},
dark_green = {"brown", "brown", "brown", "brown", "brown", "green", "green", "dark_green"},
green = {"yellow", "brown", "yellow", "yellow", "dark_green","green", "green"},
yellow = {"orange", "red", "orange", "yellow", "orange", "yellow"},
brown = {"brown", "brown", "brown", "orange", "brown"},
orange = {"orange", "red", "orange", "orange"},
red = {"pink", "magenta","red"},
magenta = {"magenta","magenta"},
pink = {"pink"},
}
for one,results in pairs(dyelocal.mixes) do
for i,result in ipairs(results) do
local another = dyelocal.mixbases[i]
for one, results in pairs(mixes) do
for i, result in ipairs(results) do
local another = mixbases[i]
minetest.register_craft({
type = "shapeless",
output = 'dye:'..result..' 2',
recipe = {'dye:'..one, 'dye:'..another},
output = 'dye:' .. result .. ' 2',
recipe = {'dye:' .. one, 'dye:' .. another},
})
end
end

View File

@ -264,8 +264,8 @@ farming.register_plant = function(name, def)
minetest.register_abm({
nodenames = {"group:" .. pname, "group:seed"},
neighbors = {"group:soil"},
interval = 90,
chance = 2,
interval = 9,
chance = 20,
action = function(pos, node)
local plant_height = minetest.get_item_group(node.name, pname)

View File

@ -170,7 +170,7 @@ minetest.register_abm({
nodenames = {"fire:basic_flame", "fire:permanent_flame"},
neighbors = {"group:puts_out_fire"},
interval = 3,
chance = 2,
chance = 1,
catch_up = false,
action = function(p0, node, _, _)
minetest.remove_node(p0)
@ -189,7 +189,7 @@ if minetest.setting_getbool("disable_fire") then
minetest.register_abm({
nodenames = {"fire:basic_flame"},
interval = 7,
chance = 2,
chance = 1,
catch_up = false,
action = function(p0, node, _, _)
minetest.remove_node(p0)
@ -235,8 +235,14 @@ else
-- remove flammable nodes around flame
local p = minetest.find_node_near(p0, 1, {"group:flammable"})
if p then
minetest.remove_node(p)
nodeupdate(p)
local node = minetest.get_node(p)
local def = minetest.registered_nodes[node.name]
if def.on_burn then
def.on_burn(p)
else
minetest.remove_node(p)
nodeupdate(p)
end
end
end
end,

View File

@ -76,8 +76,8 @@ end
minetest.register_abm({
nodenames = {"group:flora"},
neighbors = {"default:dirt_with_grass", "default:desert_sand"},
interval = 50,
chance = 25,
interval = 13,
chance = 96,
action = function(pos, node)
pos.y = pos.y - 1
local under = minetest.get_node(pos)

View File

@ -36,7 +36,7 @@ local function screwdriver_handler(itemstack, user, pointed_thing, mode)
local node = minetest.get_node(pos)
local ndef = minetest.registered_nodes[node.name]
-- verify node is facedir (expected to be rotatable)
if ndef.paramtype2 ~= "facedir" then
if not ndef or ndef.paramtype2 ~= "facedir" then
return
end
-- Compute param2

View File

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

View File

@ -235,11 +235,16 @@ minetest.register_node("tnt:tnt", {
sounds = default.node_sound_wood_defaults(),
on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "default:torch" then
<<<<<<< HEAD
if(minetest.check_player_privs(puncher:get_player_name(), {trusted_player=true})) then
minetest.sound_play("tnt_ignite", {pos=pos})
minetest.set_node(pos, {name="tnt:tnt_burning"})
minetest.get_node_timer(pos):start(4)
end
=======
minetest.sound_play("tnt_ignite", {pos=pos})
minetest.set_node(pos, {name="tnt:tnt_burning"})
>>>>>>> dfee51c21e1131c9c80fc7382b000954962f8b49
end
end,
on_blast = function(pos, intensity)
@ -263,6 +268,9 @@ minetest.register_node("tnt:tnt_burning", {
light_source = 5,
drop = "",
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(4)
end,
on_timer = boom,
-- unaffected by explosions
on_blast = function() end,
@ -383,7 +391,7 @@ minetest.register_node("tnt:gunpowder_burning", {
minetest.register_abm({
nodenames = {"tnt:tnt", "tnt:gunpowder"},
neighbors = {"fire:basic_flame", "default:lava_source", "default:lava_flowing"},
interval = 1,
interval = 4,
chance = 1,
action = burn,
})
@ -402,8 +410,3 @@ minetest.register_craft({
{"", "group:wood", ""}
}
})
if minetest.setting_get("log_mods") then
minetest.debug("[TNT] Loaded!")
end

1
mods/walls/depends.txt Normal file
View File

@ -0,0 +1 @@
default

61
mods/walls/init.lua Normal file
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:cracky", "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

@ -173,7 +173,7 @@ xpanes.register_pane("bar", {
textures = {"xpanes_bar.png","xpanes_bar.png","xpanes_space.png"},
inventory_image = "xpanes_bar.png",
wield_image = "xpanes_bar.png",
groups = {snappy=2, cracky=3, oddly_breakable_by_hand=3, pane=1},
groups = {cracky=2, pane=1},
sounds = default.node_sound_stone_defaults(),
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},