This commit is contained in:
tchncs 2015-12-26 21:44:42 +01:00
commit f8675b068f
102 changed files with 1456 additions and 981 deletions

View File

@ -1,23 +1,24 @@
The main game for the Minetest game engine [minetest_game]
==========================================================
Minetest Game [minetest_game]
=============================
The main subgame for the Minetest engine
========================================
To use this game with Minetest, insert this repository as
/games/minetest_game
in the Minetest Engine.
To use this subgame with the Minetest engine, insert this repository as
/games/minetest_game
The Minetest Engine can be found in:
https://github.com/minetest/minetest/
The Minetest engine can be found in:
https://github.com/minetest/minetest/
Compatibility
--------------
The minetest_game github master HEAD is generally compatible with the github
master HEAD of minetest.
The Minetest Game github master HEAD is generally compatible with the github
master HEAD of the Minetest engine.
Additionally, when the minetest engine is tagged to be a certain version (eg.
0.4.10), minetest_game is tagged with the version too.
Additionally, when the Minetest engine is tagged to be a certain version (eg.
0.4.10), Minetest Game is tagged with the version too.
When stable releases are made, minetest_game is packaged and made available in
http://minetest.net/download
When stable releases are made, Minetest Game is packaged and made available in
http://minetest.net/download
and in case the repository has grown too much, it may be reset. In that sense,
this is not a "real" git repository. (Package maintainers please note!)
@ -49,4 +50,4 @@ Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
License of menu/header.png
Copyright (C) 2013 BlockMen CC BY-3.0
Copyright (C) 2015 paramat CC BY-SA 3.0

View File

@ -1 +1 @@
name = Minetest
name = Minetest Game

View File

@ -1,11 +1,11 @@
minetest_game API
======================
Minetest Game API
=================
GitHub Repo: https://github.com/minetest/minetest_game
Introduction
------------
The minetest_game gamemode offers multiple new possibilities in addition to Minetest's built-in API, allowing you to
add new plants to farming mod, buckets for new liquids, new stairs and custom panes.
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
@ -17,23 +17,24 @@ Bucket API
The bucket API allows registering new types of buckets for non-default liquids.
bucket.register_liquid(
"default:lava_source", -- Source node name
"default:lava_flowing", -- Flowing node name
"bucket:bucket_lava", -- Name to be used for bucket
"bucket_lava.png", -- Bucket texture (for wielditem and inventory_image)
"Lava Bucket" -- Bucket description
"default:lava_source", -- name of the source node
"default:lava_flowing", -- name of the flowing node
"bucket:bucket_lava", -- name of the new bucket item (or nil if liquid is not takeable)
"bucket_lava.png", -- texture of the new bucket item (ignored if itemname == nil)
"Lava Bucket", -- text description of the bucket item
{lava_bucket = 1} -- groups of the bucket item, OPTIONAL
)
Beds API
--------
beds.register_bed(
"beds:bed", -- Bed name
def: See [#Bed definition] -- Bed definition
"beds:bed", -- Bed name
def: See [#Bed definition] -- 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
---------------
@ -50,11 +51,11 @@ Beds API
}
},
nodebox = {
bottom = regular nodebox, see [Node boxes], -- bottm part of bed
top = regular nodebox, see [Node boxes], -- top part of bed
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
selectionbox = regular nodebox, see [Node boxes], -- for both nodeboxes
recipe = { -- Craft recipe
{"group:wool", "group:wool", "group:wool"},
{"group:wood", "group:wood", "group:wood"}
}
@ -104,9 +105,9 @@ doors.register_trapdoor(name, def)
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
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
}
Farming API
@ -122,11 +123,11 @@ farming.register_plant(name, 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
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"},
@ -136,12 +137,12 @@ farming.register_plant(name, Plant definition)
#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
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
minlight = 13, -- Minimum light to grow
maxlight = default.LIGHT_MAX -- Maximum light to grow
}
Screwdriver API
@ -155,14 +156,14 @@ on_rotate(pos, node, user, mode, new_param2)
^ mode: screwdriver.ROTATE_FACE or screwdriver.ROTATE_AXIS
^ new_param2: the new value of param2 that would have been set if on_rotate wasn't there
^ return value: false to disallow rotation, nil to keep default behaviour, true to allow
it but to indicate that changed have already been made (so the screwdriver will wear out)
it but to indicate that changed have already been made (so the screwdriver will wear out)
^ use on_rotate = screwdriver.disallow to always disallow rotation
^ use on_rotate = screwdriver.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.
delivered with Minetest Game, to keep them compatible with other mods.
stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
-> Registers a stair.
@ -215,10 +216,10 @@ 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"
| Node type | Raillike group name
+-----------------------+--------------------
| default:rail | "rail"
| tnt:gunpowder | "gunpowder"
| tnt:gunpowder_burning | "gunpowder"
Example:
@ -281,13 +282,13 @@ default.player_get_animation(player)
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.
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, },
-- <anim_name> = {x = <start_frame>, y = <end_frame>},
foo = {x = 0, y = 19},
bar = {x = 20, y = 39},
-- ...
},
}
@ -375,10 +376,22 @@ dye.excolors
Trees
-----
default.grow_tree(pos, is_apple_tree)
^ Grows a tree or apple tree at pos
^ Grows a mgv6 tree or apple tree at pos
default.grow_jungle_tree(pos)
^ Grows a jungletree at pos
^ Grows a mgv6 jungletree at pos
default.grow_pine_tree(pos)
^ Grows a pinetree at pos
^ Grows a mgv6 pinetree at pos
default.grow_new_apple_tree(pos)
^ Grows a new design apple tree at pos
default.grow_new_jungle_tree(pos)
^ Grows a new design jungle 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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,6 +1,4 @@
# This file contains settings of minetest_game that can be changed in
# minetest.conf
#
# This file contains settings of Minetest Game that can be changed in minetest.conf
# By default, all the settings are commented and not functional.
# Uncomment settings by removing the preceding #.
@ -11,7 +9,8 @@
# 0 to disable
#share_bones_time = 1200
# Whether fire should be disabled (all fire nodes will instantly disappear)
# Whether standard fire should be disabled ('basic flame' nodes will disappear)
# 'permanent flame' nodes will remain with either setting
#disable_fire = false
# Whether steel tools, torches and cobblestone should be given to new players
@ -22,3 +21,15 @@
# The radius of a TNT explosion
#tnt_radius = 3
# Enable the stairs mod ABM that replaces the old 'upside down'
# stair and slab nodes in old maps with the new param2 versions.
#enable_stairs_replace_abm = false
# Whether you allow respawning in beds
# Default value is true
#enable_bed_respawn = true
# Whether players can skip night by sleeping
# Default value is true
#enable_bed_night_skip = true

View File

@ -1,18 +0,0 @@
1.0.1 beta
----------
- Add backwards compatibility with PilzAdam's beds mod
- Fix placement
- Fix small bugs
- Prevent possible crash
1.1
---
- Add fancy bed model (based on jp's model)
- Add API to register beds
- Allow players always to detach from bed (by donat-b)
- If more than 50% of players want sleep they can skip the night
- Don't show sleep dialog in singleplayer
1.1.1
-----
- Prevent possbile crash by trying to reposition leaving players

View File

@ -1,5 +1,5 @@
Minetest mod "Beds"
===================
Minetest Game mod: beds
=======================
by BlockMen (c) 2014-2015
Version: 1.1.1
@ -14,7 +14,8 @@ if more than 50% of the players are lying in bed and use this option.
Another feature is a controled respawning. If you have slept in bed (not just lying in it) your respawn point
is set to the beds location and you will respawn there after death.
You can disable the respawn at beds by setting "enable_bed_respawn = false" in minetest.conf
You can also disable the night skip feature by setting "enable_bed_night_skip = false" in minetest.conf or by using
the /set command ingame.
License of source code, textures: WTFPL

View File

@ -18,7 +18,6 @@ function beds.register_bed(name, def)
selection_box = {
type = "fixed",
fixed = def.selectionbox,
},
after_place_node = function(pos, placer, itemstack)
local n = minetest.get_node_or_nil(pos)
@ -89,16 +88,13 @@ function beds.register_bed(name, def)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
pointable = false,
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
sounds = default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = def.nodebox.top,
},
selection_box = {
type = "fixed",
fixed = {0, 0, 0, 0, 0, 0},
},
})
minetest.register_alias(name, name .. "_bottom")

View File

@ -1,3 +1,4 @@
local pi = math.pi
local player_in_bed = 0
local is_sp = minetest.is_singleplayer()
local enable_respawn = minetest.setting_getbool("enable_bed_respawn")
@ -11,16 +12,24 @@ end
local function get_look_yaw(pos)
local n = minetest.get_node(pos)
if n.param2 == 1 then
return 7.9, n.param2
return pi/2, n.param2
elseif n.param2 == 3 then
return 4.75, n.param2
return -pi/2, n.param2
elseif n.param2 == 0 then
return 3.15, n.param2
return pi, n.param2
else
return 6.28, n.param2
return 0, n.param2
end
end
local function is_night_skip_enabled()
local enable_night_skip = minetest.setting_getbool("enable_bed_night_skip")
if enable_night_skip == nil then
enable_night_skip = true
end
return enable_night_skip
end
local function check_in_beds(players)
local in_bed = beds.player
if not players then
@ -56,7 +65,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
if skip then
return
end
if p then
if p then
player:setpos(p)
end
@ -100,8 +109,8 @@ local function update_formspecs(finished)
"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]"
if is_majority then
"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]"
end
@ -154,11 +163,13 @@ function beds.on_rightclick(pos, player)
-- skip the night and let all players stand up
if check_in_beds() then
minetest.after(2, function()
beds.skip_night()
if not is_sp then
update_formspecs(true)
update_formspecs(is_night_skip_enabled())
end
if is_night_skip_enabled() then
beds.skip_night()
beds.kick_players()
end
beds.kick_players()
end)
end
end
@ -189,9 +200,11 @@ minetest.register_on_leaveplayer(function(player)
beds.player[name] = nil
if check_in_beds() then
minetest.after(2, function()
beds.skip_night()
update_formspecs(true)
beds.kick_players()
update_formspecs(is_night_skip_enabled())
if is_night_skip_enabled() then
beds.skip_night()
beds.kick_players()
end
end)
end
end)
@ -206,8 +219,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
if fields.force then
beds.skip_night()
update_formspecs(true)
beds.kick_players()
update_formspecs(is_night_skip_enabled())
if is_night_skip_enabled() then
beds.skip_night()
beds.kick_players()
end
end
end)

View File

@ -1,6 +1,6 @@
Minetest 0.4 mod: boats
=======================
by PilzAdam, slightly modified for NeXt
Minetest Game mod: boats
========================
by PilzAdam
License of source code:
-----------------------

View File

@ -1,4 +1,3 @@
--
-- Helper functions
--
@ -8,6 +7,7 @@ local function is_water(pos)
return minetest.get_item_group(nn, "water") ~= 0
end
local function get_sign(i)
if i == 0 then
return 0
@ -16,12 +16,14 @@ local function get_sign(i)
end
end
local function get_velocity(v, yaw, y)
local x = -math.sin(yaw) * v
local z = math.cos(yaw) * v
return {x = x, y = y, z = z}
end
local function get_v(v)
return math.sqrt(v.x ^ 2 + v.z ^ 2)
end
@ -32,7 +34,7 @@ end
local boat = {
physical = true,
collisionbox = {-0.5, -0.4, -0.5, 0.5, 0.3, 0.5},
collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5},
visual = "mesh",
mesh = "boat.obj",
textures = {"default_wood.png"},
@ -43,6 +45,7 @@ local boat = {
removed = false
}
function boat.on_rightclick(self, clicker)
if not clicker or not clicker:is_player() then
return
@ -53,9 +56,23 @@ function boat.on_rightclick(self, clicker)
clicker:set_detach()
default.player_attached[name] = false
default.player_set_animation(clicker, "stand" , 30)
local pos = clicker:getpos()
pos = {x = pos.x, y = pos.y + 0.2, z = pos.z}
minetest.after(0.1, function()
clicker:setpos(pos)
end)
elseif not self.driver then
local attach = clicker:get_attach()
if attach and attach:get_luaentity() then
local luaentity = attach:get_luaentity()
if luaentity.driver then
luaentity.driver = nil
end
clicker:set_detach()
end
self.driver = clicker
clicker:set_attach(self.object, "", {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0})
clicker:set_attach(self.object, "",
{x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0})
default.player_attached[name] = true
minetest.after(0.2, function()
default.player_set_animation(clicker, "sit" , 30)
@ -64,6 +81,7 @@ function boat.on_rightclick(self, clicker)
end
end
function boat.on_activate(self, staticdata, dtime_s)
self.object:set_armor_groups({immortal = 1})
if staticdata then
@ -72,11 +90,13 @@ function boat.on_activate(self, staticdata, dtime_s)
self.last_v = self.v
end
function boat.get_staticdata(self)
return tostring(self.v)
end
function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction)
function boat.on_punch(self, puncher)
if not puncher or not puncher:is_player() or self.removed then
return
end
@ -92,11 +112,17 @@ function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d
self.object:remove()
end)
if not minetest.setting_getbool("creative_mode") then
puncher:get_inventory():add_item("main", "boats:boat")
local inv = puncher:get_inventory()
if inv:room_for_item("main", "boats:boat") then
inv:add_item("main", "boats:boat")
else
minetest.add_item(self.object:getpos(), "boats:boat")
end
end
end
end
function boat.on_step(self, dtime)
self.v = get_v(self.object:getvelocity()) * get_sign(self.v)
if self.driver then
@ -149,7 +175,8 @@ function boat.on_step(self, dtime)
else
new_acce = {x = 0, y = -9.8, z = 0}
end
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
new_velo = get_velocity(self.v, self.object:getyaw(),
self.object:getvelocity().y)
self.object:setpos(self.object:getpos())
else
p.y = p.y + 1
@ -172,7 +199,8 @@ function boat.on_step(self, dtime)
self.object:setpos(pos)
new_velo = get_velocity(self.v, self.object:getyaw(), 0)
else
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
new_velo = get_velocity(self.v, self.object:getyaw(),
self.object:getvelocity().y)
self.object:setpos(self.object:getpos())
end
end
@ -181,8 +209,10 @@ function boat.on_step(self, dtime)
self.object:setacceleration(new_acce)
end
minetest.register_entity("boats:boat", boat)
minetest.register_craftitem("boats:boat", {
description = "Boat",
inventory_image = "boat_inventory.png",
@ -206,6 +236,7 @@ minetest.register_craftitem("boats:boat", {
end,
})
minetest.register_craft({
output = "boats:boat",
recipe = {
@ -214,4 +245,3 @@ minetest.register_craft({
{"group:wood", "group:wood", "group:wood"},
},
})

View File

@ -1,5 +1,5 @@
Minetest 0.4 mod: bones
=======================
Minetest Game mod: bones
========================
License of source code:
-----------------------

View File

@ -76,6 +76,10 @@ minetest.register_node("bones:bones", {
return
end
if(minetest.get_meta(pos):get_string("infotext") == "") then
return
end
local inv = minetest.get_meta(pos):get_inventory()
local player_inv = player:get_inventory()
local has_space = true
@ -93,6 +97,11 @@ minetest.register_node("bones:bones", {
-- remove bones if player emptied them
if has_space then
if player_inv:room_for_item("main", {name = "bones:bones"}) then
player_inv:add_item("main", {name = "bones:bones"})
else
minetest.add_item(pos,"bones:bones")
end
minetest.remove_node(pos)
end
end,

View File

@ -1,4 +1,4 @@
Minetest 0.4 mod: bucket
Minetest Game mod: bucket
=========================
License of source code:

BIN
mods/bucket/textures/bucket.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 221 B

View File

@ -1,5 +1,5 @@
Minetest 0.4 mod: creative
==========================
Minetest Game mod: creative
===========================
Implements creative mode.

View File

@ -1,11 +1,16 @@
-- minetest/creative/init.lua
creative_inventory = {}
creative_inventory.creative_inventory_size = 0
-- Create detached creative inventory after loading all mods
minetest.after(0, function()
local inv = minetest.create_detached_inventory("creative", {
creative_inventory.init_creative_inventory = function(player)
local player_name = player:get_player_name()
creative_inventory[player_name] = {}
creative_inventory[player_name].size = 0
creative_inventory[player_name].filter = nil
creative_inventory[player_name].start_i = 1
local inv = minetest.create_detached_inventory("creative_" .. player_name, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then
return count
@ -35,21 +40,29 @@ minetest.after(0, function()
end
end,
})
creative_inventory.update(player_name, nil)
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
end
function creative_inventory.update(player_name, filter)
local creative_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
and def.description and def.description ~= "" then
table.insert(creative_list, name)
local inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
for name, def in pairs(minetest.registered_items) do
if not (def.groups.not_in_creative_inventory == 1) and
def.description and def.description ~= "" then
if (filter and def.name:find(filter, 1, true)) or not filter then
creative_list[#creative_list+1] = name
end
end
end
table.sort(creative_list)
inv:set_size("main", #creative_list)
for _,itemstring in ipairs(creative_list) do
inv:add_item("main", ItemStack(itemstring))
end
creative_inventory.creative_inventory_size = #creative_list
--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
end)
inv:set_list("main", creative_list)
creative_inventory[player_name].size = #creative_list
end
-- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", {
@ -68,10 +81,12 @@ local trash = minetest.create_detached_inventory("creative_trash", {
})
trash:set_size("main", 1)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
local player_name = player:get_player_name()
local filter = creative_inventory[player_name].filter or ""
pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
local pagemax = math.floor((creative_inventory[player_name].size - 1) / (6*4) + 1)
player:set_inventory_formspec(
"size[13,7.5]"..
--"image[6,0.6;1,2;player.png]"..
@ -83,51 +98,67 @@ creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
"list[current_player;craft;8,0;3,3;]"..
"list[current_player;craftpreview;12,1;1,1;]"..
"image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
"button[2.7,6.5;1.6,1;creative_next;>>]"..
"list[detached:creative_" .. player_name .. ";main;0.05,1;4,6;" .. tostring(start_i) .. "]"..
"tablecolumns[color;text;color;text]"..
"tableoptions[background=#00000000;highlight=#00000000;border=false]"..
"table[1.4,7.2;1.1,0.5;pagenum;#FFFF00," .. tostring(pagenum) .. ",#FFFFFF,/ " .. tostring(pagemax) .. "]"..
"button[0,7;1,1;creative_prev;<<]"..
"button[3.08,7;1,1;creative_next;>>]"..
"button[2.55,0.2;0.8,0.5;search;?]"..
"button[3.3,0.2;0.8,0.5;clear;X]"..
"tooltip[search;Search]"..
"tooltip[clear;Reset]"..
"listring[current_player;main]"..
"listring[current_player;craft]"..
"listring[current_player;main]"..
"listring[detached:creative;main]"..
"listring[detached:creative_" .. player_name .. ";main]"..
"label[5,1.5;Trash:]"..
"list[detached:creative_trash;main;5,2;1,1;]"..
"field[0.3,0.3;2.6,1;filter;;" .. filter .. "]"..
default.get_hotbar_bg(5,3.5)
)
end
minetest.register_on_joinplayer(function(player)
-- If in creative mode, modify player's inventory forms
if not minetest.setting_getbool("creative_mode") then
return
end
creative_inventory.init_creative_inventory(player)
creative_inventory.set_creative_formspec(player, 0, 1)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.setting_getbool("creative_mode") then
return
end
-- Figure out current page from formspec
local current_page = 0
local player_name = player:get_player_name()
local formspec = player:get_inventory_formspec()
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
local start_i = formspec:match("list%[detached:creative_" .. player_name .. ";main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
start_i = tonumber(start_i) or 0
if fields.creative_prev then
if fields.creative_prev or start_i >= creative_inventory[player_name].size then
start_i = start_i - 4*6
end
if fields.creative_next then
elseif fields.creative_next or start_i < 0 then
start_i = start_i + 4*6
end
if start_i < 0 then
start_i = start_i + 4*6
if fields.search or fields.clear then
if fields.clear then
creative_inventory[player_name].filter = ""
creative_inventory.update(player_name, nil)
else
creative_inventory[player_name].filter = fields.filter:lower()
creative_inventory.update(player_name, fields.filter:lower())
end
minetest.after(0, function()
creative_inventory.set_creative_formspec(player, 0, 1)
end)
end
if start_i >= creative_inventory.creative_inventory_size then
start_i = start_i - 4*6
end
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
if start_i < 0 or start_i >= creative_inventory[player_name].size then
start_i = 0
end
@ -154,18 +185,18 @@ if minetest.setting_getbool("creative_mode") then
damage_groups = {fleshy = 10},
}
})
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
return true
end)
function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() then
return
end
local inv = digger:get_inventory()
if inv then
for _,item in ipairs(drops) do
for _, item in ipairs(drops) do
item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then
inv:add_item("main", item)
@ -173,5 +204,4 @@ if minetest.setting_getbool("creative_mode") then
end
end
end
end

View File

@ -1,4 +1,4 @@
Minetest 0.4 mod: default
Minetest Game mod: default
==========================
License of source code:
@ -24,7 +24,6 @@ Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
Cisoun's WTFPL texture pack:
default_jungletree.png
default_jungletree_top.png
default_lava.png
default_leaves.png
default_sapling.png
@ -59,8 +58,8 @@ VanessaE (WTFPL):
default_nc_side.png
default_desert_sand.png
default_desert_stone.png
default_desert_stone_brick.png
default_sand.png
default_jungletree_top.png
Calinou (CC BY-SA):
default_brick.png
@ -77,7 +76,6 @@ Jordach (CC BY-SA 3.0):
PilzAdam (WTFPL):
default_jungleleaves.png
default_junglesapling.png
default_junglewood.png
default_obsidian_glass.png
default_obsidian_shard.png
default_mineral_gold.png
@ -119,12 +117,16 @@ paramat (CC BY-SA 3.0):
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)
brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png
BlockMen (CC BY-SA 3.0):
default_stone_brick.png
default_wood.png
default_clay_brick.png
default_iron_ingot.png
@ -146,6 +148,9 @@ BlockMen (CC BY-SA 3.0):
heart.png
gui_*.png
sofar (CC BY-SA 3.0):
default_book_written.png, based on default_book.png
Neuromancer (CC BY-SA 2.0):
default_cobble.png, based on texture by Brane praefect
default_mossycobble.png, based on texture by Brane praefect
@ -153,10 +158,6 @@ Neuromancer (CC BY-SA 3.0):
default_dirt.png
default_furnace_*.png
Philipbenr (CC BY-SA 3.0):
default_grass.png
default_grass_side.png
Gambit (WTFPL):
default_bronze_ingot.png
default_copper_ingot.png

View File

@ -68,5 +68,9 @@ minetest.register_alias("steel_ingot", "default:steel_ingot")
minetest.register_alias("clay_brick", "default:clay_brick")
minetest.register_alias("snow", "default:snow")
-- Mese now comes in the form of blocks, ore, crystal and fragments
-- 'mese_block' was used for a while for the block form of mese
minetest.register_alias("default:mese_block", "default:mese")
-- Aliases for corrected pine node names
minetest.register_alias("default:pinetree", "default:pine_tree")
minetest.register_alias("default:pinewood", "default:pine_wood")

View File

@ -15,9 +15,9 @@ minetest.register_craft({
})
minetest.register_craft({
output = 'default:pinewood 4',
output = 'default:pine_wood 4',
recipe = {
{'default:pinetree'},
{'default:pine_tree'},
}
})

View File

@ -30,7 +30,8 @@ local function book_on_use(itemstack, user, pointed_thing)
formspec = "size[8,8]"..default.gui_bg..
"label[0.5,0.5;by "..owner.."]"..
"label[0.5,0;"..minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]"
"tableoptions[background=#00000000;highlight=#00000000;border=false]"..
"table[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text):gsub("\n", ",")..";1]"
end
minetest.show_formspec(user:get_player_name(), "default:book", formspec)
end
@ -81,7 +82,7 @@ minetest.register_craftitem("default:book", {
minetest.register_craftitem("default:book_written", {
description = "Book With Text",
inventory_image = "default_book.png",
inventory_image = "default_book_written.png",
groups = {book=1, not_in_creative_inventory=1},
stack_max = 1,
on_use = book_on_use,

View File

@ -105,6 +105,7 @@ minetest.register_abm({
neighbors = {"group:water"},
interval = 1,
chance = 2,
catch_up = false,
action = function(...)
default.cool_lava_flowing(...)
end,
@ -115,6 +116,7 @@ minetest.register_abm({
neighbors = {"group:water"},
interval = 1,
chance = 2,
catch_up = false,
action = function(...)
default.cool_lava_source(...)
end,
@ -184,7 +186,7 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"default:papyrus"},
neighbors = {"default:dirt", "default:dirt_with_grass"},
neighbors = {"default:dirt", "default:dirt_with_grass", "default:sand"},
interval = 50,
chance = 20,
action = function(...)
@ -306,13 +308,14 @@ minetest.register_abm({
--
-- Grass growing
-- Grass growing on well-lit dirt
--
minetest.register_abm({
nodenames = {"default:dirt"},
interval = 2,
chance = 200,
catch_up = false,
action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local name = minetest.get_node(above).name
@ -329,10 +332,16 @@ minetest.register_abm({
end
})
--
-- Grass and dry grass removed in darkness
--
minetest.register_abm({
nodenames = {"default:dirt_with_grass", "default:dirt_with_dry_grass"},
interval = 2,
chance = 20,
catch_up = false,
action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local name = minetest.get_node(above).name
@ -345,3 +354,18 @@ minetest.register_abm({
end
})
--
-- Moss growth on cobble near water
--
minetest.register_abm({
nodenames = {"default:cobble"},
neighbors = {"group:water"},
interval = 17,
chance = 200,
catch_up = false,
action = function(pos, node)
minetest.set_node(pos, {name = "default:mossycobble"})
end
})

View File

@ -26,7 +26,7 @@ minetest.register_alias("mapgen_apple", "default:apple")
minetest.register_alias("mapgen_jungletree", "default:jungletree")
minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves")
minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
minetest.register_alias("mapgen_pinetree", "default:pinetree")
minetest.register_alias("mapgen_pine_tree", "default:pine_tree")
minetest.register_alias("mapgen_pine_needles", "default:pine_needles")
-- Dungeons
@ -50,84 +50,85 @@ function default.register_ores()
-- Clay
minetest.register_ore({
ore_type = "blob",
ore = "default:clay",
wherein = {"default:sand"},
clust_scarcity = 24 * 24 * 24,
clust_size = 7,
y_min = -15,
y_max = 0,
noise_threshhold = 0,
noise_params = {
offset = 0.35,
ore_type = "blob",
ore = "default:clay",
wherein = {"default:sand"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -15,
y_max = 0,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = -316,
octaves = 1,
persist = 0.5
persist = 0.0
},
})
-- Sand
minetest.register_ore({
ore_type = "blob",
ore = "default:sand",
wherein = {"default:stone"},
clust_scarcity = 24 * 24 * 24,
clust_size = 7,
y_min = -63,
y_max = 4,
noise_threshhold = 0,
noise_params = {
offset = 0.35,
ore_type = "blob",
ore = "default:sand",
wherein = {"default:stone", "default:sandstone",
"default:desert_stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31,
y_max = 4,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 2316,
octaves = 1,
persist = 0.5
persist = 0.0
},
})
-- Dirt
minetest.register_ore({
ore_type = "blob",
ore = "default:dirt",
wherein = {"default:stone"},
clust_scarcity = 24 * 24 * 24,
clust_size = 7,
y_min = -63,
y_max = 31000,
noise_threshhold = 0,
noise_params = {
offset = 0.35,
ore_type = "blob",
ore = "default:dirt",
wherein = {"default:stone", "default:sandstone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 17676,
octaves = 1,
persist = 0.5
persist = 0.0
},
})
-- Gravel
minetest.register_ore({
ore_type = "blob",
ore = "default:gravel",
wherein = {"default:stone"},
clust_scarcity = 24 * 24 * 24,
clust_size = 7,
y_min = -31000,
y_max = 31000,
noise_threshhold = 0,
noise_params = {
offset = 0.35,
ore_type = "blob",
ore = "default:gravel",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31000,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.5
persist = 0.0
},
})
@ -330,11 +331,12 @@ function default.register_biomes()
depth_filler = 3,
node_stone = "default:ice",
node_water_top = "default:ice",
depth_water_top = 8,
depth_water_top = 10,
--node_water = "",
y_min = -6,
node_river_water = "default:ice",
y_min = -8,
y_max = 31000,
heat_point = -5,
heat_point = 0,
humidity_point = 50,
})
@ -344,14 +346,15 @@ function default.register_biomes()
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -112,
y_max = -7,
heat_point = -5,
y_max = -9,
heat_point = 0,
humidity_point = 50,
})
@ -359,19 +362,20 @@ function default.register_biomes()
minetest.register_biome({
name = "tundra",
node_dust = "default:snow",
--node_dust = "",
node_top = "default:dirt_with_snow",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 0,
depth_filler = 1,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 2,
y_max = 31000,
heat_point = 20,
humidity_point = 30,
heat_point = 15,
humidity_point = 35,
})
minetest.register_biome({
@ -380,32 +384,35 @@ function default.register_biomes()
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -112,
y_max = 1,
heat_point = 20,
humidity_point = 30,
heat_point = 15,
humidity_point = 35,
})
minetest.register_biome({
name = "taiga",
node_dust = "default:snow",
node_top = "default:snowblock",
node_top = "default:dirt_with_snow",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 2,
y_max = 31000,
heat_point = 20,
humidity_point = 70,
heat_point = 15,
humidity_point = 65,
})
minetest.register_biome({
@ -414,18 +421,19 @@ function default.register_biomes()
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -112,
y_max = 1,
heat_point = 20,
humidity_point = 70,
heat_point = 15,
humidity_point = 65,
})
-- Cool
-- Temperate
minetest.register_biome({
name = "stone_grassland",
@ -433,15 +441,34 @@ function default.register_biomes()
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 0,
depth_filler = 1,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 6,
y_max = 31000,
heat_point = 45,
humidity_point = 30,
heat_point = 40,
humidity_point = 35,
})
minetest.register_biome({
name = "stone_grassland_dunes",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_max = 5,
heat_point = 40,
humidity_point = 35,
})
minetest.register_biome({
@ -450,32 +477,53 @@ function default.register_biomes()
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -112,
y_max = 5,
heat_point = 45,
humidity_point = 30,
y_max = 4,
heat_point = 40,
humidity_point = 35,
})
minetest.register_biome({
name = "coniferous_forest",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 6,
y_max = 31000,
heat_point = 45,
humidity_point = 70,
heat_point = 40,
humidity_point = 65,
})
minetest.register_biome({
name = "coniferous_forest_dunes",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_max = 5,
heat_point = 40,
humidity_point = 65,
})
minetest.register_biome({
@ -484,18 +532,18 @@ function default.register_biomes()
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -112,
y_max = 5,
heat_point = 45,
humidity_point = 70,
y_max = 4,
heat_point = 40,
humidity_point = 65,
})
-- Warm
minetest.register_biome({
name = "sandstone_grassland",
@ -503,15 +551,34 @@ function default.register_biomes()
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 0,
depth_filler = 1,
node_stone = "default:sandstone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 6,
y_max = 31000,
heat_point = 70,
humidity_point = 30,
heat_point = 60,
humidity_point = 35,
})
minetest.register_biome({
name = "sandstone_grassland_dunes",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
node_stone = "default:sandstone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 5,
y_max = 5,
heat_point = 60,
humidity_point = 35,
})
minetest.register_biome({
@ -520,32 +587,53 @@ function default.register_biomes()
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
depth_filler = 3,
node_stone = "default:sandstone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -112,
y_max = 5,
heat_point = 70,
humidity_point = 30,
y_max = 4,
heat_point = 60,
humidity_point = 35,
})
minetest.register_biome({
name = "deciduous_forest",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
y_min = 6,
--node_river_water = "",
y_min = 1,
y_max = 31000,
heat_point = 70,
humidity_point = 70,
heat_point = 60,
humidity_point = 65,
})
minetest.register_biome({
name = "deciduous_forest_swamp",
--node_dust = "",
node_top = "default:dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -3,
y_max = 0,
heat_point = 60,
humidity_point = 65,
})
minetest.register_biome({
@ -554,15 +642,16 @@ function default.register_biomes()
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -112,
y_max = 5,
heat_point = 70,
humidity_point = 70,
y_max = -4,
heat_point = 60,
humidity_point = 65,
})
-- Hot
@ -578,10 +667,11 @@ function default.register_biomes()
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
y_min = 1,
--node_river_water = "",
y_min = 5,
y_max = 31000,
heat_point = 95,
humidity_point = 10,
heat_point = 85,
humidity_point = 20,
})
minetest.register_biome({
@ -590,17 +680,19 @@ function default.register_biomes()
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
depth_filler = 3,
node_stone = "default:desert_stone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -112,
y_max = 0,
heat_point = 95,
humidity_point = 10,
y_max = 4,
heat_point = 85,
humidity_point = 20,
})
minetest.register_biome({
name = "savanna",
--node_dust = "",
@ -612,9 +704,28 @@ function default.register_biomes()
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
y_min = 5,
--node_river_water = "",
y_min = 1,
y_max = 31000,
heat_point = 95,
heat_point = 85,
humidity_point = 50,
})
minetest.register_biome({
name = "savanna_swamp",
--node_dust = "",
node_top = "default:dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -3,
y_max = 0,
heat_point = 85,
humidity_point = 50,
})
@ -624,32 +735,35 @@ function default.register_biomes()
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -112,
y_max = 4,
heat_point = 95,
y_max = -4,
heat_point = 85,
humidity_point = 50,
})
minetest.register_biome({
name = "rainforest",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 1,
y_max = 31000,
heat_point = 95,
humidity_point = 90,
heat_point = 85,
humidity_point = 80,
})
minetest.register_biome({
@ -658,15 +772,16 @@ function default.register_biomes()
node_top = "default:dirt",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
y_min = 0,
--node_river_water = "",
y_min = -3,
y_max = 0,
heat_point = 95,
humidity_point = 90,
heat_point = 85,
humidity_point = 80,
})
minetest.register_biome({
@ -675,15 +790,16 @@ function default.register_biomes()
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -112,
y_max = -1,
heat_point = 95,
humidity_point = 90,
y_max = -4,
heat_point = 85,
humidity_point = 80,
})
-- Underground
@ -692,13 +808,14 @@ function default.register_biomes()
name = "underground",
--node_dust = "",
--node_top = "",
depth_top = 0,
--depth_top = ,
--node_filler = "",
depth_filler = -4,
--depth_filler = ,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -31000,
y_max = -113,
heat_point = 50,
@ -721,7 +838,7 @@ function default.register_mgv6_decorations()
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
sidelen = 8,
sidelen = 16,
noise_params = {
offset = -0.3,
scale = 0.7,
@ -734,7 +851,7 @@ function default.register_mgv6_decorations()
y_max = 1,
decoration = "default:papyrus",
height = 2,
height_max = 4,
height_max = 4,
spawn_by = "default:water_source",
num_spawn_by = 1,
})
@ -811,38 +928,36 @@ local function register_grass_decoration(offset, scale, length)
noise_params = {
offset = offset,
scale = scale,
spread = {x=200, y=200, z=200},
spread = {x = 200, y = 200, z = 200},
seed = 329,
octaves = 3,
persist = 0.6
},
biomes = {
"stone_grassland", "stone_grassland_ocean",
"sandstone_grassland", "sandstone_grassland_ocean",
"deciduous_forest", "deciduous_forest_ocean",
"coniferous_forest", "coniferous_forest_ocean",
},
y_min = 5,
biomes = {"stone_grassland", "sandstone_grassland",
"deciduous_forest", "coniferous_forest",
"stone_grassland_dunes", "sandstone_grassland_dunes",
"coniferous_forest_dunes"},
y_min = 1,
y_max = 31000,
decoration = "default:grass_"..length,
})
end
local function register_dry_grass_decoration(length)
local function register_dry_grass_decoration(offset, scale, length)
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_dry_grass"},
sidelen = 16,
noise_params = {
offset = 0.04,
scale = 0.02,
spread = {x=200, y=200, z=200},
offset = offset,
scale = scale,
spread = {x = 200, y = 200, z = 200},
seed = 329,
octaves = 3,
persist = 0.6
},
biomes = {"savanna"},
y_min = 5,
y_min = 1,
y_max = 31000,
decoration = "default:dry_grass_"..length,
})
@ -860,13 +975,13 @@ function default.register_decorations()
noise_params = {
offset = 0.04,
scale = 0.02,
spread = {x=250, y=250, z=250},
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {"deciduous_forest"},
y_min = 6,
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath("default").."/schematics/apple_tree.mts",
flags = "place_center_x, place_center_z",
@ -884,18 +999,19 @@ function default.register_decorations()
y_max = 31000,
schematic = minetest.get_modpath("default").."/schematics/jungle_tree.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
-- Taiga and temperate forest pine tree
-- Taiga and temperate coniferous forest pine tree
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:snowblock", "default:dirt_with_grass"},
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0.04,
scale = 0.02,
spread = {x=250, y=250, z=250},
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
@ -912,17 +1028,17 @@ function default.register_decorations()
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_dry_grass"},
sidelen = 80,
sidelen = 16,
noise_params = {
offset = 0.001,
scale = 0.0015,
spread = {x=250, y=250, z=250},
offset = 0,
scale = 0.002,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {"savanna"},
y_min = 6,
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath("default").."/schematics/acacia_tree.mts",
flags = "place_center_x, place_center_z",
@ -934,17 +1050,17 @@ function default.register_decorations()
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:desert_sand"},
sidelen = 80,
sidelen = 16,
noise_params = {
offset = -0.0005,
scale = 0.0015,
spread = {x=200, y=200, z=200},
offset = -0.0003,
scale = 0.0009,
spread = {x = 200, y = 200, z = 200},
seed = 230,
octaves = 3,
persist = 0.6
},
biomes = {"desert"},
y_min = 2,
y_min = 5,
y_max = 31000,
schematic = minetest.get_modpath("default").."/schematics/large_cactus.mts",
flags = "place_center_x",
@ -956,38 +1072,38 @@ function default.register_decorations()
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:desert_sand"},
sidelen = 80,
sidelen = 16,
noise_params = {
offset = -0.0005,
scale = 0.0015,
spread = {x=200, y=200, z=200},
offset = -0.0003,
scale = 0.0009,
spread = {x = 200, y = 200, z = 200},
seed = 230,
octaves = 3,
persist = 0.6
},
biomes = {"desert"},
y_min = 2,
y_min = 5,
y_max = 31000,
decoration = "default:cactus",
height = 2,
height_max = 5,
height_max = 5,
})
-- Papyrus
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:sand"},
place_on = {"default:dirt"},
sidelen = 16,
noise_params = {
offset = -0.3,
scale = 0.7,
spread = {x=200, y=200, z=200},
spread = {x = 200, y = 200, z = 200},
seed = 354,
octaves = 3,
persist = 0.7
},
biomes = {"savanna_ocean", "desert_ocean"},
biomes = {"savanna_swamp"},
y_min = 0,
y_max = 0,
schematic = minetest.get_modpath("default").."/schematics/papyrus.mts",
@ -1003,11 +1119,11 @@ function default.register_decorations()
-- Dry grasses
register_dry_grass_decoration(5)
register_dry_grass_decoration(4)
register_dry_grass_decoration(3)
register_dry_grass_decoration(2)
register_dry_grass_decoration(1)
register_dry_grass_decoration(0.01, 0.05, 5)
register_dry_grass_decoration(0.03, 0.03, 4)
register_dry_grass_decoration(0.05, 0.01, 3)
register_dry_grass_decoration(0.07, -0.01, 2)
register_dry_grass_decoration(0.09, -0.03, 1)
-- Junglegrass
@ -1031,7 +1147,7 @@ function default.register_decorations()
noise_params = {
offset = 0,
scale = 0.02,
spread = {x=200, y=200, z=200},
spread = {x = 200, y = 200, z = 200},
seed = 329,
octaves = 3,
persist = 0.6

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 280 B

View File

Before

Width:  |  Height:  |  Size: 574 B

After

Width:  |  Height:  |  Size: 574 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -1,10 +1,12 @@
--
-- Grow trees
-- Grow trees from saplings
--
-- 'Can grow' function
local random = math.random
local function can_grow(pos)
function default.can_grow(pos)
local node_under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
if not node_under then
return false
@ -14,84 +16,65 @@ local function can_grow(pos)
if is_soil == 0 then
return false
end
local light_level = minetest.get_node_light(pos)
if not light_level or light_level < 13 then
return false
end
return true
end
-- Sapling ABMs
-- Sapling ABM
minetest.register_abm({
nodenames = {"default:sapling"},
nodenames = {"default:sapling", "default:junglesapling",
"default:pine_sapling", "default:acacia_sapling"},
interval = 10,
chance = 50,
action = function(pos, node)
if not can_grow(pos) then
if not default.can_grow(pos) then
return
end
minetest.log("action", "A sapling grows into a tree at "..
minetest.pos_to_string(pos))
if minetest.get_mapgen_params().mgname == "v6" then
default.grow_tree(pos, random(1, 4) == 1)
else
default.grow_new_apple_tree(pos)
local mapgen = minetest.get_mapgen_params().mgname
if node.name == "default:sapling" then
minetest.log("action", "A sapling grows into a tree at "..
minetest.pos_to_string(pos))
if mapgen == "v6" then
default.grow_tree(pos, random(1, 4) == 1)
else
default.grow_new_apple_tree(pos)
end
elseif node.name == "default:junglesapling" then
minetest.log("action", "A jungle sapling grows into a tree at "..
minetest.pos_to_string(pos))
if mapgen == "v6" then
default.grow_jungle_tree(pos)
else
default.grow_new_jungle_tree(pos)
end
elseif node.name == "default:pine_sapling" then
minetest.log("action", "A pine sapling grows into a tree at "..
minetest.pos_to_string(pos))
if mapgen == "v6" then
default.grow_pine_tree(pos)
else
default.grow_new_pine_tree(pos)
end
elseif node.name == "default:acacia_sapling" then
minetest.log("action", "An acacia sapling grows into a tree at "..
minetest.pos_to_string(pos))
default.grow_new_acacia_tree(pos)
end
end
})
minetest.register_abm({
nodenames = {"default:junglesapling"},
interval = 11,
chance = 50,
action = function(pos, node)
if not can_grow(pos) then
return
end
minetest.log("action", "A jungle sapling grows into a tree at "..
minetest.pos_to_string(pos))
if minetest.get_mapgen_params().mgname == "v6" then
default.grow_jungle_tree(pos)
else
default.grow_new_jungle_tree(pos)
end
end
})
--
-- Tree generation
--
minetest.register_abm({
nodenames = {"default:pine_sapling"},
interval = 12,
chance = 50,
action = function(pos, node)
if not can_grow(pos) then
return
end
minetest.log("action", "A pine sapling grows into a tree at "..
minetest.pos_to_string(pos))
if minetest.get_mapgen_params().mgname == "v6" then
default.grow_pine_tree(pos)
else
default.grow_new_pine_tree(pos)
end
end
})
minetest.register_abm({
nodenames = {"default:acacia_sapling"},
interval = 13,
chance = 50,
action = function(pos, node)
if not can_grow(pos) then
return
end
minetest.log("action", "An acacia sapling grows into a tree at "..
minetest.pos_to_string(pos))
default.grow_new_acacia_tree(pos)
end
})
-- Appletree, jungletree function
-- Apple tree and jungle tree trunk and leaves function
local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
height, size, iters, is_apple_tree)
@ -150,7 +133,8 @@ local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid,
end
end
-- Appletree
-- Apple tree
function default.grow_tree(pos, is_apple_tree, bad)
--[[
@ -182,7 +166,8 @@ function default.grow_tree(pos, is_apple_tree, bad)
vm:update_map()
end
-- Jungletree
-- Jungle tree
function default.grow_jungle_tree(pos, bad)
--[[
@ -233,7 +218,8 @@ function default.grow_jungle_tree(pos, bad)
vm:update_map()
end
-- Pinetree from mg mapgen mod, design by sfan5, pointy top added by paramat
-- Pine tree from mg mapgen mod, design by sfan5, pointy top added by paramat
local function add_pine_needles(data, vi, c_air, c_ignore, c_snow, c_pine_needles)
local node_id = data[vi]
@ -255,7 +241,7 @@ function default.grow_pine_tree(pos)
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_pinetree = minetest.get_content_id("default:pinetree")
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")
@ -359,12 +345,13 @@ function default.grow_pine_tree(pos)
end
-- Trunk
data[a:index(x, y, z)] = c_pinetree -- Force-place lowest trunk node to replace sapling
data[a:index(x, y, z)] = c_pine_tree -- Force-place lowest trunk node to replace sapling
for yy = y + 1, maxy do
local vi = a:index(x, yy, z)
local node_id = data[vi]
if node_id == c_air or node_id == c_ignore or node_id == c_pine_needles then
data[vi] = c_pinetree
if node_id == c_air or node_id == c_ignore or
node_id == c_pine_needles or node_id == c_snow then
data[vi] = c_pine_tree
end
end
@ -373,34 +360,38 @@ function default.grow_pine_tree(pos)
vm:update_map()
end
-- New tree
-- New apple tree
function default.grow_new_apple_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/apple_tree.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)
end
-- New jungle tree
function default.grow_new_jungle_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/jungle_tree.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)
end
-- New pine tree
function default.grow_new_pine_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/pine_tree.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)
end
-- New acacia tree
function default.grow_new_acacia_tree(pos)
local path = minetest.get_modpath("default") .. "/schematics/acacia_tree.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)
end

View File

@ -1,5 +1,5 @@
Minetest 0.4 mod: doors
=======================
Minetest Game mod: doors
========================
version: 1.3
License of source code:

View File

@ -129,7 +129,7 @@ function doors.register_door(name, def)
local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
pos.y = pos.y+dir
if not minetest.get_node(pos).name == check_name then
if minetest.get_node(pos).name ~= check_name then
return
end
local p2 = minetest.get_node(pos).param2

View File

@ -1,4 +1,4 @@
Minetest 0.4 mod: dye
Minetest Game mod: dye
======================
See init.lua for documentation.

View File

@ -1,28 +0,0 @@
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]
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
}

View File

@ -1,5 +1,5 @@
Minetest 0.4 mod: farming
=========================
Minetest Game mod: farming
==========================
License of source code:
-----------------------
@ -45,4 +45,4 @@ Created by Gambit (License: WTFPL):
farming_cotton_*.png
farming_flour.png
farming_cotton_seed.png
farming_wheat_seed.png
farming_wheat_seed.png

View File

@ -38,6 +38,16 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
return
end
if minetest.is_protected(pt.under, user:get_player_name()) then
minetest.record_protection_violation(pt.under, user:get_player_name())
return
end
if minetest.is_protected(pt.above, user:get_player_name()) then
minetest.record_protection_violation(pt.above, user:get_player_name())
return
end
-- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name = regN[under.name].soil.dry})
minetest.sound_play("default_dig_crumbly", {
@ -123,6 +133,16 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
local under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above)
if minetest.is_protected(pt.under, placer:get_player_name()) then
minetest.record_protection_violation(pt.under, placer:get_player_name())
return
end
if minetest.is_protected(pt.above, placer:get_player_name()) then
minetest.record_protection_violation(pt.above, placer:get_player_name())
return
end
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return

View File

@ -1,5 +1,5 @@
Minetest 0.4 mod: fire
======================
Minetest Game mod: fire
=======================
License of source code:
-----------------------

View File

@ -1,21 +1,35 @@
-- minetest/fire/init.lua
-- Global namespace for functions
fire = {}
-- Register flame nodes
minetest.register_node("fire:basic_flame", {
description = "Fire",
description = "Basic Flame",
drawtype = "firelike",
tiles = {{
name="fire_basic_flame_animated.png",
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1},
}},
tiles = {
{
name = "fire_basic_flame_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1
},
},
},
inventory_image = "fire_basic_flame.png",
paramtype = "light",
light_source = 14,
groups = {igniter=2,dig_immediate=3},
drop = '',
walkable = false,
buildable_to = true,
sunlight_propagates = true,
damage_per_second = 4,
groups = {igniter = 2, dig_immediate = 3},
drop = "",
on_construct = function(pos)
minetest.after(0, fire.on_flame_add_at, pos)
@ -25,48 +39,86 @@ minetest.register_node("fire:basic_flame", {
minetest.after(0, fire.on_flame_remove_at, pos)
end,
-- unaffected by explosions
on_blast = function() end,
on_blast = function()
end, -- unaffected by explosions
})
fire.D = 6
-- key: position hash of low corner of area
-- value: {handle=sound handle, name=sound name}
fire.sounds = {}
minetest.register_node("fire:permanent_flame", {
description = "Permanent Flame",
drawtype = "firelike",
tiles = {
{
name = "fire_basic_flame_animated.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1
},
},
},
inventory_image = "fire_basic_flame.png",
paramtype = "light",
light_source = 14,
walkable = false,
buildable_to = true,
sunlight_propagates = true,
damage_per_second = 4,
groups = {igniter = 2, dig_immediate = 3},
drop = "",
on_blast = function()
end,
})
-- Get sound area of position
fire.D = 6 -- size of sound areas
function fire.get_area_p0p1(pos)
local p0 = {
x=math.floor(pos.x/fire.D)*fire.D,
y=math.floor(pos.y/fire.D)*fire.D,
z=math.floor(pos.z/fire.D)*fire.D,
x = math.floor(pos.x / fire.D) * fire.D,
y = math.floor(pos.y / fire.D) * fire.D,
z = math.floor(pos.z / fire.D) * fire.D,
}
local p1 = {
x=p0.x+fire.D-1,
y=p0.y+fire.D-1,
z=p0.z+fire.D-1
x = p0.x + fire.D - 1,
y = p0.y + fire.D - 1,
z = p0.z + fire.D - 1
}
return p0, p1
end
-- Fire sounds table
-- key: position hash of low corner of area
-- value: {handle=sound handle, name=sound name}
fire.sounds = {}
-- Update fire sounds in sound area of position
function fire.update_sounds_around(pos)
local p0, p1 = fire.get_area_p0p1(pos)
local cp = {x=(p0.x+p1.x)/2, y=(p0.y+p1.y)/2, z=(p0.z+p1.z)/2}
local cp = {x = (p0.x + p1.x) / 2, y = (p0.y + p1.y) / 2, z = (p0.z + p1.z) / 2}
local flames_p = minetest.find_nodes_in_area(p0, p1, {"fire:basic_flame"})
--print("number of flames at "..minetest.pos_to_string(p0).."/"
-- ..minetest.pos_to_string(p1)..": "..#flames_p)
local should_have_sound = (#flames_p > 0)
local wanted_sound = nil
if #flames_p >= 9 then
wanted_sound = {name="fire_large", gain=1.5}
wanted_sound = {name = "fire_large", gain = 0.7}
elseif #flames_p > 0 then
wanted_sound = {name="fire_small", gain=1.5}
wanted_sound = {name = "fire_small", gain = 0.9}
end
local p0_hash = minetest.hash_node_position(p0)
local sound = fire.sounds[p0_hash]
if not sound then
if should_have_sound then
fire.sounds[p0_hash] = {
handle = minetest.sound_play(wanted_sound, {pos=cp, max_hear_distance = 16, loop=true}),
handle = minetest.sound_play(wanted_sound,
{pos = cp, max_hear_distance = 16, loop = true}),
name = wanted_sound.name,
}
end
@ -77,53 +129,127 @@ function fire.update_sounds_around(pos)
elseif sound.name ~= wanted_sound.name then
minetest.sound_stop(sound.handle)
fire.sounds[p0_hash] = {
handle = minetest.sound_play(wanted_sound, {pos=cp, max_hear_distance = 16, loop=true}),
handle = minetest.sound_play(wanted_sound,
{pos = cp, max_hear_distance = 16, loop = true}),
name = wanted_sound.name,
}
end
end
end
-- Update fire sounds on flame node construct or destruct
function fire.on_flame_add_at(pos)
fire.update_sounds_around(pos)
end
function fire.on_flame_remove_at(pos)
fire.update_sounds_around(pos)
end
-- Return positions for flames around a burning node
function fire.find_pos_for_flame_around(pos)
return minetest.find_node_near(pos, 1, {"air"})
end
-- Detect nearby extinguishing nodes
function fire.flame_should_extinguish(pos)
if minetest.setting_getbool("disable_fire") then return true end
--return minetest.find_node_near(pos, 1, {"group:puts_out_fire"})
local p0 = {x=pos.x-2, y=pos.y, z=pos.z-2}
local p1 = {x=pos.x+2, y=pos.y, z=pos.z+2}
local ps = minetest.find_nodes_in_area(p0, p1, {"group:puts_out_fire"})
return (#ps ~= 0)
return minetest.find_node_near(pos, 1, {"group:puts_out_fire"})
end
-- Ignite neighboring nodes
-- Extinguish all flames quickly with water, snow, ice
minetest.register_abm({
nodenames = {"group:flammable"},
neighbors = {"group:igniter"},
interval = 5,
nodenames = {"fire:basic_flame", "fire:permanent_flame"},
neighbors = {"group:puts_out_fire"},
interval = 3,
chance = 2,
catch_up = false,
action = function(p0, node, _, _)
-- If there is water or stuff like that around flame, don't ignite
if fire.flame_should_extinguish(p0) then
return
end
local p = fire.find_pos_for_flame_around(p0)
if p then
minetest.set_node(p, {name="fire:basic_flame"})
end
minetest.remove_node(p0)
minetest.sound_play("fire_extinguish_flame",
{pos = p0, max_hear_distance = 16, gain = 0.25})
end,
})
-- Enable the following ABMs according to 'disable fire' setting
if minetest.setting_getbool("disable_fire") then
-- Remove basic flames only
minetest.register_abm({
nodenames = {"fire:basic_flame"},
interval = 7,
chance = 2,
catch_up = false,
action = function(p0, node, _, _)
minetest.remove_node(p0)
end,
})
else
-- Ignite neighboring nodes, add basic flames
minetest.register_abm({
nodenames = {"group:flammable"},
neighbors = {"group:igniter"},
interval = 7,
chance = 16,
catch_up = false,
action = function(p0, node, _, _)
-- If there is water or stuff like that around node, don't ignite
if fire.flame_should_extinguish(p0) then
return
end
local p = fire.find_pos_for_flame_around(p0)
if p then
minetest.set_node(p, {name = "fire:basic_flame"})
end
end,
})
-- Remove basic flames and flammable nodes
minetest.register_abm({
nodenames = {"fire:basic_flame"},
interval = 5,
chance = 16,
catch_up = false,
action = function(p0, node, _, _)
-- If there are no flammable nodes around flame, remove flame
if not minetest.find_node_near(p0, 1, {"group:flammable"}) then
minetest.remove_node(p0)
return
end
if math.random(1, 4) == 1 then
-- remove flammable nodes around flame
local p = minetest.find_node_near(p0, 1, {"group:flammable"})
if p then
minetest.remove_node(p)
nodeupdate(p)
end
end
end,
})
end
-- Rarely ignite things from far
--[[ Currently disabled to reduce the chance of uncontrollable spreading
fires that disrupt servers. Also for less lua processing load.
minetest.register_abm({
nodenames = {"group:igniter"},
neighbors = {"air"},
@ -143,47 +269,9 @@ minetest.register_abm({
end
local p2 = fire.find_pos_for_flame_around(p)
if p2 then
minetest.set_node(p2, {name="fire:basic_flame"})
minetest.set_node(p2, {name = "fire:basic_flame"})
end
end
end,
})
-- Remove flammable nodes and flame
minetest.register_abm({
nodenames = {"fire:basic_flame"},
interval = 3,
chance = 2,
action = function(p0, node, _, _)
-- If there is water or stuff like that around flame, remove flame
if fire.flame_should_extinguish(p0) then
minetest.remove_node(p0)
return
end
-- Make the following things rarer
if math.random(1,3) == 1 then
return
end
-- If there are no flammable nodes around flame, remove flame
if not minetest.find_node_near(p0, 1, {"group:flammable"}) then
minetest.remove_node(p0)
return
end
if math.random(1,4) == 1 then
-- remove a flammable node around flame
local p = minetest.find_node_near(p0, 1, {"group:flammable"})
if p then
-- If there is water or stuff like that around flame, don't remove
if fire.flame_should_extinguish(p0) then
return
end
minetest.remove_node(p)
nodeupdate(p)
end
else
-- remove flame
minetest.remove_node(p0)
end
end,
})
--]]

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
Minetest 0.4 mod: flowers
=========================
Minetest Game mod: flowers
==========================
License of source code:
-----------------------
@ -16,7 +16,8 @@ License of media (textures and sounds)
WTFPL
Gambit (WTFPL):
flowers_mushroom_*.png
flowers_mushroom_*.png
flowers_waterlily.png
DanDuncombe (WTFPL):
flowers_spores_*.png
flowers_spores_*.png

View File

@ -1,21 +1,29 @@
-- Minetest 0.4 mod: default
-- See README.txt for licensing and other information.
-- Namespace for functions
flowers = {}
-- Map Generation
dofile(minetest.get_modpath("flowers") .. "/mapgen.lua")
--
-- Flowers
--
-- Aliases for original flowers mod
minetest.register_alias("flowers:flower_dandelion_white", "flowers:dandelion_white")
minetest.register_alias("flowers:flower_dandelion_yellow", "flowers:dandelion_yellow")
minetest.register_alias("flowers:flower_geranium", "flowers:geranium")
minetest.register_alias("flowers:flower_rose", "flowers:rose")
minetest.register_alias("flowers:flower_tulip", "flowers:tulip")
minetest.register_alias("flowers:flower_dandelion_yellow", "flowers:dandelion_yellow")
minetest.register_alias("flowers:flower_geranium", "flowers:geranium")
minetest.register_alias("flowers:flower_viola", "flowers:viola")
minetest.register_alias("flowers:flower_dandelion_white", "flowers:dandelion_white")
-- Flower registration
@ -31,12 +39,14 @@ local function add_simple_flower(name, desc, box, f_groups)
minetest.register_node("flowers:" .. name, {
description = desc,
drawtype = "plantlike",
waving = 1,
tiles = {"flowers_" .. name .. ".png"},
inventory_image = "flowers_" .. name .. ".png",
wield_image = "flowers_" .. name .. ".png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
stack_max = 99,
groups = f_groups,
sounds = default.node_sound_leaves_defaults(),
@ -61,88 +71,6 @@ for _,item in pairs(flowers.datas) do
end
-- Mushrooms
local mushrooms_datas = {
{"brown", 2},
{"red", -6}
}
for _, m in pairs(mushrooms_datas) do
local name, nut = m[1], m[2]
-- Register mushrooms
minetest.register_node("flowers:mushroom_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
string.sub(name, 2) .. " Mushroom",
tiles = {"flowers_mushroom_" .. name .. ".png"},
inventory_image = "flowers_mushroom_" .. name .. ".png",
wield_image = "flowers_mushroom_" .. name .. ".png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1},
drop = {
items = {
{items = {"flowers:spores_" .. name}, rarity = 2,},
{items = {"flowers:spores_" .. name}, rarity = 2,},
{items = {"flowers:spores_" .. name}, rarity = 2,},
{items = {"flowers:mushroom_" .. name},},
},
},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(nut),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
-- Register spores
minetest.register_node("flowers:spores_" .. name, {
description = string.sub(string.upper(name), 0, 1) ..
string.sub(name, 2) .. " Mushroom Spores",
drawtype = "signlike",
tiles = {"flowers_spores_" .. name .. ".png"},
inventory_image = "flowers_spores_" .. name .. ".png",
wield_image = "flowers_spores_" .. name .. ".png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
selection_box = {
type = "wallmounted",
},
groups = {dig_immediate = 3, attached_node = 1},
})
-- Register growth ABMs
minetest.register_abm({
nodenames = {"flowers:spores_" .. name},
interval = 14,
chance = 25,
action = function(pos, node)
local node_under = minetest.get_node_or_nil({x = pos.x,
y = pos.y - 1, z = pos.z})
if not node_under then
return
end
if minetest.get_item_group(node_under.name, "soil") ~= 0 and
minetest.get_node_light(pos, nil) <= 13 then
minetest.set_node({x = pos.x, y = pos.y, z = pos.z},
{name = "flowers:mushroom_" .. name})
end
end
})
end
-- Flower spread
minetest.register_abm({
@ -159,23 +87,23 @@ minetest.register_abm({
elseif under.name ~= "default:dirt_with_grass" then
return
end
local light = minetest.get_node_light(pos)
if not light or light < 13 then
return
end
local pos0 = {x = pos.x - 4, y = pos.y - 4, z = pos.z - 4}
local pos1 = {x = pos.x + 4, y = pos.y + 4, z = pos.z + 4}
if #minetest.find_nodes_in_area(pos0, pos1, "group:flora_block") > 0 then
return
end
local flowers = minetest.find_nodes_in_area(pos0, pos1, "group:flora")
if #flowers > 3 then
return
end
local seedling = minetest.find_nodes_in_area(pos0, pos1, "default:dirt_with_grass")
if #seedling > 0 then
seedling = seedling[math.random(#seedling)]
@ -190,3 +118,133 @@ minetest.register_abm({
end
end,
})
--
-- Mushrooms
--
minetest.register_node("flowers:mushroom_red", {
description = "Red Mushroom",
tiles = {"flowers_mushroom_red.png"},
inventory_image = "flowers_mushroom_red.png",
wield_image = "flowers_mushroom_red.png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(-5),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
minetest.register_node("flowers:mushroom_brown", {
description = "Brown Mushroom",
tiles = {"flowers_mushroom_brown.png"},
inventory_image = "flowers_mushroom_brown.png",
wield_image = "flowers_mushroom_brown.png",
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flammable = 3, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(1),
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3}
}
})
-- mushroom spread and death
minetest.register_abm({
nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"},
interval = 11,
chance = 50,
action = function(pos, node)
if minetest.get_node_light(pos, nil) == 15 then
minetest.remove_node(pos)
end
local random = {
x = pos.x + math.random(-2,2),
y = pos.y + math.random(-1,1),
z = pos.z + math.random(-2,2)
}
local random_node = minetest.get_node_or_nil(random)
if not random_node then
return
end
if random_node.name ~= "air" then
return
end
local node_under = minetest.get_node_or_nil({x = random.x,
y = random.y - 1, z = random.z})
if not node_under then
return
end
if minetest.get_item_group(node_under.name, "soil") ~= 0 and
minetest.get_node_light(pos, nil) <= 9 and
minetest.get_node_light(random, nil) <= 9 then
minetest.set_node(random, {name = node.name})
end
end
})
-- these old mushroom related nodes can be simplified now
minetest.register_alias("flowers:mushroom_spores_brown", "flowers:mushroom_brown")
minetest.register_alias("flowers:mushroom_spores_red", "flowers:mushroom_red")
minetest.register_alias("flowers:mushroom_fertile_brown", "flowers:mushroom_brown")
minetest.register_alias("flowers:mushroom_fertile_red", "flowers:mushroom_red")
--
-- Waterlily
--
minetest.register_node("flowers:waterlily", {
description = "Waterlily",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
tiles = {"flowers_waterlily.png"},
inventory_image = "flowers_waterlily.png",
wield_image = "flowers_waterlily.png",
liquids_pointable = true,
walkable = false,
buildable_to = true,
groups = {snappy = 3, flower = 1},
sounds = default.node_sound_leaves_defaults(),
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.46875, 0.5}
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}
},
after_place_node = function(pos, placer, itemstack, pointed_thing)
local find_water = minetest.find_nodes_in_area({x = pos.x - 1, y = pos.y, z = pos.z - 1},
{x = pos.x + 1, y = pos.y, z = pos.z + 1}, "default:water_source")
local find_river_water = minetest.find_nodes_in_area({x = pos.x - 1, y = pos.y, z = pos.z - 1},
{x = pos.x + 1, y = pos.y, z = pos.z + 1}, "default:river_water_source")
if #find_water ~= 0 then
minetest.set_node(pos, {name = "default:water_source"})
pos.y = pos.y + 1
minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)})
elseif #find_river_water ~= 0 then
minetest.set_node(pos, {name = "default:river_water_source"})
pos.y = pos.y + 1
minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)})
else
minetest.remove_node(pos)
return true
end
end
})

View File

@ -1,4 +1,6 @@
--
-- Mgv6
--
local function register_mgv6_flower(name)
minetest.register_decoration({
@ -8,7 +10,7 @@ local function register_mgv6_flower(name)
noise_params = {
offset = 0,
scale = 0.006,
spread = {x=100, y=100, z=100},
spread = {x = 100, y = 100, z = 100},
seed = 436,
octaves = 3,
persist = 0.6
@ -26,8 +28,8 @@ local function register_mgv6_mushroom(name)
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.006,
spread = {x=100, y=100, z=100},
scale = 0.04,
spread = {x = 100, y = 100, z = 100},
seed = 7133,
octaves = 3,
persist = 0.6
@ -35,6 +37,28 @@ local function register_mgv6_mushroom(name)
y_min = 1,
y_max = 30,
decoration = "flowers:"..name,
spawn_by = "default:tree",
num_spawn_by = 1,
})
end
local function register_mgv6_waterlily()
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt"},
sidelen = 16,
noise_params = {
offset = -0.12,
scale = 0.3,
spread = {x = 100, y = 100, z = 100},
seed = 33,
octaves = 3,
persist = 0.7
},
y_min = 0,
y_max = 0,
schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts",
rotation = "random",
})
end
@ -46,11 +70,16 @@ function flowers.register_mgv6_decorations()
register_mgv6_flower("viola")
register_mgv6_flower("dandelion_white")
register_mgv6_mushroom("mushroom_brown")
register_mgv6_mushroom("mushroom_red")
register_mgv6_mushroom("mushroom_fertile_brown")
register_mgv6_mushroom("mushroom_fertile_red")
register_mgv6_waterlily()
end
-- All other biome API mapgens (not singlenode)
--
-- All other biome API mapgens
--
local function register_flower(seed, name)
minetest.register_decoration({
@ -58,20 +87,16 @@ local function register_flower(seed, name)
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = -0.02,
scale = 0.03,
spread = {x=200, y=200, z=200},
offset = -0.015,
scale = 0.025,
spread = {x = 200, y = 200, z = 200},
seed = seed,
octaves = 3,
persist = 0.6
},
biomes = {
"stone_grassland",
"sandstone_grassland",
"deciduous_forest",
"coniferous_forest",
},
y_min = 6,
biomes = {"stone_grassland", "sandstone_grassland",
"deciduous_forest", "coniferous_forest"},
y_min = 1,
y_max = 31000,
decoration = "flowers:"..name,
})
@ -85,18 +110,39 @@ local function register_mushroom(name)
noise_params = {
offset = 0,
scale = 0.006,
spread = {x=200, y=200, z=200},
seed = 7133,
spread = {x = 200, y = 200, z = 200},
seed = 2,
octaves = 3,
persist = 0.6
persist = 0.66
},
biomes = {"deciduous_forest", "coniferous_forest"},
y_min = 6,
y_min = 1,
y_max = 31000,
decoration = "flowers:"..name,
})
end
local function register_waterlily()
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt"},
sidelen = 16,
noise_params = {
offset = -0.12,
scale = 0.3,
spread = {x = 200, y = 200, z = 200},
seed = 33,
octaves = 3,
persist = 0.7
},
biomes = {"rainforest_swamp", "savanna_swamp", "deciduous_forest_swamp"},
y_min = 0,
y_max = 0,
schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts",
rotation = "random",
})
end
function flowers.register_decorations()
register_flower(436, "rose")
register_flower(19822, "tulip")
@ -105,11 +151,16 @@ function flowers.register_decorations()
register_flower(1133, "viola")
register_flower(73133, "dandelion_white")
register_mushroom("mushroom_brown")
register_mushroom("mushroom_red")
register_mushroom("mushroom_fertile_brown")
register_mushroom("mushroom_fertile_red")
register_waterlily()
end
--
-- Detect mapgen to select functions
--
-- Mods using singlenode mapgen can call these functions to enable
-- the use of minetest.generate_ores or minetest.generate_decorations

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -35,6 +35,10 @@ 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
return
end
-- Compute param2
local rotationPart = node.param2 % 32 -- get first 4 bits
local preservePart = node.param2 - rotationPart

View File

@ -1,5 +1,5 @@
Minetest mod: screwdriver
=========================
Minetest Game mod: screwdriver
==============================
License of source code:
-----------------------
@ -18,4 +18,4 @@ Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Created by Gambit (WTFPL):
screwdriver.png
screwdriver.png

View File

@ -1,4 +1,4 @@
Minetest 0.4 mod: stairs
Minetest Game mod: stairs
=========================
License of source code:

View File

@ -1 +1,2 @@
default
farming

View File

@ -1,9 +1,26 @@
-- Minetest 0.4 mod: stairs
-- See README.txt for licensing and other information.
-- Global namespace for functions
stairs = {}
-- Register aliases for new pine node names
minetest.register_alias("stairs:stair_pinewood", "stairs:stair_pine_wood")
minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood")
-- Get setting for replace ABM
local replace = minetest.setting_getbool("enable_stairs_replace_abm")
-- Register stairs.
-- Node will be called stairs:stair_<subname>
function stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
minetest.register_node(":stairs:stair_" .. subname, {
description = description,
@ -48,7 +65,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
param2 = minetest.dir_to_facedir(dir)
end
if p0.y-1 == p1.y then
if p0.y - 1 == p1.y then
param2 = param2 + 20
if param2 == 21 then
param2 = 23
@ -62,10 +79,12 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
})
-- for replace ABM
minetest.register_node(":stairs:stair_" .. subname.."upside_down", {
replace_name = "stairs:stair_" .. subname,
groups = {slabs_replace=1},
})
if replace then
minetest.register_node(":stairs:stair_" .. subname .. "upside_down", {
replace_name = "stairs:stair_" .. subname,
groups = {slabs_replace = 1},
})
end
minetest.register_craft({
output = 'stairs:stair_' .. subname .. ' 6',
@ -87,7 +106,10 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
})
end
-- Register slabs.
-- Node will be called stairs:slab_<subname>
function stairs.register_slab(subname, recipeitem, groups, images, description, sounds)
minetest.register_node(":stairs:slab_" .. subname, {
description = description,
@ -120,7 +142,8 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
local n0_is_upside_down = (n0.name == "stairs:slab_" .. subname and
n0.param2 >= 20)
if n0.name == "stairs:slab_" .. subname and not n0_is_upside_down and p0.y+1 == p1.y then
if n0.name == "stairs:slab_" .. subname and not n0_is_upside_down and
p0.y + 1 == p1.y then
slabpos = p0
slabnode = n0
elseif n1.name == "stairs:slab_" .. subname then
@ -136,7 +159,8 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
pointed_thing.above = slabpos
local success
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
fakestack, success = minetest.item_place(fakestack, placer,
pointed_thing)
-- If the item was taken from the fake stack, decrement original
if success then
itemstack:set_count(fakestack:get_count())
@ -148,7 +172,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end
-- Upside down slabs
if p0.y-1 == p1.y then
if p0.y - 1 == p1.y then
-- Turn into full block if pointing at a existing slab
if n0_is_upside_down then
-- Remove the slab at the position of the slab
@ -159,7 +183,8 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
pointed_thing.above = p0
local success
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
fakestack, success = minetest.item_place(fakestack, placer,
pointed_thing)
-- If the item was taken from the fake stack, decrement original
if success then
itemstack:set_count(fakestack:get_count())
@ -175,7 +200,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end
-- If pointing at the side of a upside down slab
if n0_is_upside_down and p0.y+1 ~= p1.y then
if n0_is_upside_down and p0.y + 1 ~= p1.y then
param2 = 20
end
@ -184,10 +209,12 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
})
-- for replace ABM
minetest.register_node(":stairs:slab_" .. subname.."upside_down", {
replace_name = "stairs:slab_"..subname,
groups = {slabs_replace=1},
})
if replace then
minetest.register_node(":stairs:slab_" .. subname .. "upside_down", {
replace_name = "stairs:slab_".. subname,
groups = {slabs_replace = 1},
})
end
minetest.register_craft({
output = 'stairs:slab_' .. subname .. ' 6',
@ -197,29 +224,41 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
})
end
-- Replace old "upside_down" nodes with new param2 versions
minetest.register_abm({
nodenames = {"group:slabs_replace"},
interval = 8,
chance = 1,
action = function(pos, node)
node.name = minetest.registered_nodes[node.name].replace_name
node.param2 = node.param2 + 20
if node.param2 == 21 then
node.param2 = 23
elseif node.param2 == 23 then
node.param2 = 21
end
minetest.set_node(pos, node)
end,
})
-- Optionally replace old "upside_down" nodes with new param2 versions.
-- Disabled by default.
if replace then
minetest.register_abm({
nodenames = {"group:slabs_replace"},
interval = 8,
chance = 1,
action = function(pos, node)
node.name = minetest.registered_nodes[node.name].replace_name
node.param2 = node.param2 + 20
if node.param2 == 21 then
node.param2 = 23
elseif node.param2 == 23 then
node.param2 = 21
end
minetest.set_node(pos, node)
end,
})
end
-- Stair/slab registration function.
-- Nodes will be called stairs:{stair,slab}_<subname>
function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)
function stairs.register_stair_and_slab(subname, recipeitem, groups, images,
desc_stair, desc_slab, sounds)
stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds)
end
-- Register default stairs and slabs
stairs.register_stair_and_slab("wood", "default:wood",
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"default_wood.png"},
@ -234,11 +273,11 @@ stairs.register_stair_and_slab("junglewood", "default:junglewood",
"Junglewood Slab",
default.node_sound_wood_defaults())
stairs.register_stair_and_slab("pinewood", "default:pinewood",
stairs.register_stair_and_slab("pine_wood", "default:pine_wood",
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"default_pinewood.png"},
"Pinewood Stair",
"Pinewood Slab",
{"default_pine_wood.png"},
"Pine Wood Stair",
"Pine Wood Slab",
default.node_sound_wood_defaults())
stairs.register_stair_and_slab("acacia_wood", "default:acacia_wood",
@ -290,13 +329,6 @@ stairs.register_stair_and_slab("desert_stonebrick", "default:desert_stonebrick",
"Desert Stone Brick Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("brick", "default:brick",
{cracky = 3},
{"default_brick.png"},
"Brick Stair",
"Brick Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("sandstone", "default:sandstone",
{crumbly = 2, cracky = 2},
{"default_sandstone.png"},
@ -324,3 +356,45 @@ stairs.register_stair_and_slab("obsidianbrick", "default:obsidianbrick",
"Obsidian Brick Stair",
"Obsidian Brick Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("brick", "default:brick",
{cracky = 3},
{"default_brick.png"},
"Brick Stair",
"Brick Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("straw", "farming:straw",
{snappy = 3, flammable = 4},
{"farming_straw.png"},
"Straw Stair",
"Straw Slab",
default.node_sound_leaves_defaults())
stairs.register_stair_and_slab("steelblock", "default:steelblock",
{cracky = 1, level = 2},
{"default_steel_block.png"},
"Steel Block Stair",
"Steel Block Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("copperblock", "default:copperblock",
{cracky = 1, level = 2},
{"default_copper_block.png"},
"Copper Block Stair",
"Copper Block Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("bronzeblock", "default:bronzeblock",
{cracky = 1, level = 2},
{"default_bronze_block.png"},
"Bronze Block Stair",
"Bronze Block Slab",
default.node_sound_stone_defaults())
stairs.register_stair_and_slab("goldblock", "default:goldblock",
{cracky = 1},
{"default_gold_block.png"},
"Gold Block Stair",
"Gold Block Slab",
default.node_sound_stone_defaults())

View File

@ -1,4 +1,5 @@
=== TNT mod for Minetest ===
Minetest Game mod: tnt
======================
by PilzAdam and ShadowNinja
Introduction:

View File

@ -1,4 +1,4 @@
Minetest 0.4 mod: vessels
Minetest Game mod: vessels
==========================
Crafts

View File

@ -1,5 +1,5 @@
Minetest 0.4 mod: wool
======================
Minetest Game mod: wool
=======================
Mostly backward-compatible with jordach's 16-color wool mod.

Some files were not shown because too many files have changed in this diff Show More