fix mergeconflicts
|
@ -8,6 +8,7 @@ read_globals = {
|
|||
"vector",
|
||||
"VoxelManip", "VoxelArea",
|
||||
"PseudoRandom", "ItemStack",
|
||||
"Settings",
|
||||
"unpack",
|
||||
-- Silence "accessing undefined field copy of global table".
|
||||
table = { fields = { "copy" } }
|
||||
|
|
28
game_api.txt
|
@ -282,18 +282,6 @@ Give Initial Stuff API
|
|||
^ str is a comma separated list of initial stuff
|
||||
^ Adds items to the list of items to be given
|
||||
|
||||
Nyancat API
|
||||
-----------
|
||||
|
||||
`nyancat.place(pos, facedir, length)`
|
||||
|
||||
^ Place a cat at `pos` facing `facedir` with tail length `length`
|
||||
Only accepts facedir 0-3, if facedir > 3 then it will be interpreted as facedir = 0
|
||||
|
||||
`nyancat.generate(minp, maxp, seed)`
|
||||
|
||||
^ Called by `minetest.register_on_generated`. To disable nyancat generation,
|
||||
you can redefine nyancat.generate() to be an empty function
|
||||
|
||||
TNT API
|
||||
----------
|
||||
|
@ -324,8 +312,10 @@ TNT API
|
|||
|
||||
`tnt.burn(position, [nodename])`
|
||||
|
||||
^ Ignite TNT at position, nodename isn't required unless already known.
|
||||
|
||||
^ Ignite node at position, triggering its `on_ignite` callback (see fire mod).
|
||||
If no such callback exists, fallback to turn tnt group nodes to their
|
||||
"_burning" variant.
|
||||
nodename isn't required unless already known.
|
||||
|
||||
To make dropping items from node inventories easier, you can use the
|
||||
following helper function from 'default':
|
||||
|
@ -778,14 +768,20 @@ Trees
|
|||
* `default.grow_new_pine_tree(pos)`
|
||||
* Grows a new design pine tree at pos
|
||||
|
||||
* `default.grow_new_snowy_pine_tree(pos)`
|
||||
* Grows a new design snowy pine tree at pos
|
||||
|
||||
* `default.grow_new_acacia_tree(pos)`
|
||||
* Grows a new design acacia tree at pos
|
||||
|
||||
* `default.grow_new_aspen_tree(pos)`
|
||||
* Grows a new design aspen tree at pos
|
||||
|
||||
* `default.grow_new_snowy_pine_tree(pos)`
|
||||
* Grows a new design snowy pine tree at pos
|
||||
* `default.grow_bush(pos)`
|
||||
* Grows a bush at pos
|
||||
|
||||
* `default.grow_acacia_bush(pos)`
|
||||
* Grows an acaia bush at pos
|
||||
|
||||
Carts
|
||||
-----
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
# Enable flame sound.
|
||||
#flame_sound = true
|
||||
|
||||
# Whether lavacooling should be enabled.
|
||||
#enable_lavacooling = true
|
||||
|
||||
# Whether the stuff in initial_stuff should be given to new players
|
||||
#give_initial_stuff = false
|
||||
#initial_stuff = default:pick_steel,default:axe_steel,default:shovel_steel,default:torch 99,default:cobble 99
|
||||
|
|
|
@ -89,7 +89,8 @@ function beds.register_bed(name, def)
|
|||
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
|
||||
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name())) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
Minetest Game mod: boats
|
||||
========================
|
||||
See license.txt for license information.
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by PilzAdam (MIT)
|
||||
Various Minetest developers and contributors (MIT)
|
||||
|
||||
Authors of media (textures and model)
|
||||
-------------------------------------
|
||||
Textures: Zeg9 (CC BY-SA 3.0)
|
||||
Model: thetoon and Zeg9 (CC BY-SA 3.0),
|
||||
modified by PavelS(SokolovPavel) (CC BY-SA 3.0),
|
||||
modified by sofar (CC BY-SA 3.0)
|
|
@ -0,0 +1,271 @@
|
|||
--
|
||||
-- Helper functions
|
||||
--
|
||||
|
||||
local function is_water(pos)
|
||||
local nn = minetest.get_node(pos).name
|
||||
return minetest.get_item_group(nn, "water") ~= 0
|
||||
end
|
||||
|
||||
|
||||
local function get_sign(i)
|
||||
if i == 0 then
|
||||
return 0
|
||||
else
|
||||
return i / math.abs(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
|
||||
|
||||
--
|
||||
-- Boat entity
|
||||
--
|
||||
|
||||
local boat = {
|
||||
physical = true,
|
||||
-- Warning: Do not change the position of the collisionbox top surface,
|
||||
-- lowering it causes the boat to fall through the world if underwater
|
||||
collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5},
|
||||
visual = "mesh",
|
||||
mesh = "boats_boat.obj",
|
||||
textures = {"default_wood.png"},
|
||||
|
||||
driver = nil,
|
||||
v = 0,
|
||||
last_v = 0,
|
||||
removed = false
|
||||
}
|
||||
|
||||
|
||||
function boat.on_rightclick(self, clicker)
|
||||
if not clicker or not clicker:is_player() then
|
||||
return
|
||||
end
|
||||
local name = clicker:get_player_name()
|
||||
if self.driver and clicker == self.driver then
|
||||
self.driver = nil
|
||||
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})
|
||||
default.player_attached[name] = true
|
||||
minetest.after(0.2, function()
|
||||
default.player_set_animation(clicker, "sit" , 30)
|
||||
end)
|
||||
clicker:set_look_horizontal(self.object:getyaw())
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function boat.on_activate(self, staticdata, dtime_s)
|
||||
self.object:set_armor_groups({immortal = 1})
|
||||
if staticdata then
|
||||
self.v = tonumber(staticdata)
|
||||
end
|
||||
self.last_v = self.v
|
||||
end
|
||||
|
||||
|
||||
function boat.get_staticdata(self)
|
||||
return tostring(self.v)
|
||||
end
|
||||
|
||||
|
||||
function boat.on_punch(self, puncher)
|
||||
if not puncher or not puncher:is_player() or self.removed then
|
||||
return
|
||||
end
|
||||
if self.driver and puncher == self.driver then
|
||||
self.driver = nil
|
||||
puncher:set_detach()
|
||||
default.player_attached[puncher:get_player_name()] = false
|
||||
end
|
||||
if not self.driver then
|
||||
self.removed = true
|
||||
local inv = puncher:get_inventory()
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(puncher:get_player_name()))
|
||||
or not inv:contains_item("main", "boats:boat") then
|
||||
local leftover = inv:add_item("main", "boats:boat")
|
||||
-- if no room in inventory add a replacement boat to the world
|
||||
if not leftover:is_empty() then
|
||||
minetest.add_item(self.object:getpos(), leftover)
|
||||
end
|
||||
end
|
||||
-- delay remove to ensure player is detached
|
||||
minetest.after(0.1, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function boat.on_step(self, dtime)
|
||||
self.v = get_v(self.object:getvelocity()) * get_sign(self.v)
|
||||
if self.driver then
|
||||
local ctrl = self.driver:get_player_control()
|
||||
local yaw = self.object:getyaw()
|
||||
if ctrl.up then
|
||||
self.v = self.v + 0.1
|
||||
elseif ctrl.down then
|
||||
self.v = self.v - 0.1
|
||||
end
|
||||
if ctrl.left then
|
||||
if self.v < 0 then
|
||||
self.object:setyaw(yaw - (1 + dtime) * 0.03)
|
||||
else
|
||||
self.object:setyaw(yaw + (1 + dtime) * 0.03)
|
||||
end
|
||||
elseif ctrl.right then
|
||||
if self.v < 0 then
|
||||
self.object:setyaw(yaw + (1 + dtime) * 0.03)
|
||||
else
|
||||
self.object:setyaw(yaw - (1 + dtime) * 0.03)
|
||||
end
|
||||
end
|
||||
end
|
||||
local velo = self.object:getvelocity()
|
||||
if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
|
||||
self.object:setpos(self.object:getpos())
|
||||
return
|
||||
end
|
||||
local s = get_sign(self.v)
|
||||
self.v = self.v - 0.02 * s
|
||||
if s ~= get_sign(self.v) then
|
||||
self.object:setvelocity({x = 0, y = 0, z = 0})
|
||||
self.v = 0
|
||||
return
|
||||
end
|
||||
if math.abs(self.v) > 5 then
|
||||
self.v = 5 * get_sign(self.v)
|
||||
end
|
||||
|
||||
local p = self.object:getpos()
|
||||
p.y = p.y - 0.5
|
||||
local new_velo
|
||||
local new_acce = {x = 0, y = 0, z = 0}
|
||||
if not is_water(p) then
|
||||
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
|
||||
if (not nodedef) or nodedef.walkable then
|
||||
self.v = 0
|
||||
new_acce = {x = 0, y = 1, z = 0}
|
||||
else
|
||||
new_acce = {x = 0, y = -9.8, z = 0}
|
||||
end
|
||||
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
|
||||
if is_water(p) then
|
||||
local y = self.object:getvelocity().y
|
||||
if y >= 5 then
|
||||
y = 5
|
||||
elseif y < 0 then
|
||||
new_acce = {x = 0, y = 20, z = 0}
|
||||
else
|
||||
new_acce = {x = 0, y = 5, z = 0}
|
||||
end
|
||||
new_velo = get_velocity(self.v, self.object:getyaw(), y)
|
||||
self.object:setpos(self.object:getpos())
|
||||
else
|
||||
new_acce = {x = 0, y = 0, z = 0}
|
||||
if math.abs(self.object:getvelocity().y) < 1 then
|
||||
local pos = self.object:getpos()
|
||||
pos.y = math.floor(pos.y) + 0.5
|
||||
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)
|
||||
self.object:setpos(self.object:getpos())
|
||||
end
|
||||
end
|
||||
end
|
||||
self.object:setvelocity(new_velo)
|
||||
self.object:setacceleration(new_acce)
|
||||
end
|
||||
|
||||
|
||||
minetest.register_entity("boats:boat", boat)
|
||||
|
||||
|
||||
minetest.register_craftitem("boats:boat", {
|
||||
description = "Boat",
|
||||
inventory_image = "boats_inventory.png",
|
||||
wield_image = "boats_wield.png",
|
||||
wield_scale = {x = 2, y = 2, z = 1},
|
||||
liquids_pointable = true,
|
||||
groups = {flammable = 2},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local udef = minetest.registered_nodes[node.name]
|
||||
if udef and udef.on_rightclick and
|
||||
not (placer and placer:get_player_control().sneak) then
|
||||
return udef.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
|
||||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
if not is_water(pointed_thing.under) then
|
||||
return itemstack
|
||||
end
|
||||
pointed_thing.under.y = pointed_thing.under.y + 0.5
|
||||
boat = minetest.add_entity(pointed_thing.under, "boats:boat")
|
||||
if boat then
|
||||
boat:setyaw(placer:get_look_horizontal())
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name())) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "boats:boat",
|
||||
recipe = {
|
||||
{"", "", "" },
|
||||
{"group:wood", "", "group:wood"},
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "boats:boat",
|
||||
burntime = 20,
|
||||
})
|
|
@ -1,25 +1,38 @@
|
|||
License of source code
|
||||
----------------------
|
||||
|
||||
GNU Lesser General Public License, version 2.1
|
||||
Copyright (C) 2011-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2012-2016 PilzAdam
|
||||
Copyright (C) 2012-2016 Various Minetest developers and contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms
|
||||
of the GNU Lesser General Public License as published by the Free Software Foundation;
|
||||
either version 2.1 of the License, or (at your option) any later version.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software
|
||||
without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details:
|
||||
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more details:
|
||||
https://opensource.org/licenses/MIT
|
||||
|
||||
|
||||
Licenses of media (textures)
|
||||
----------------------------
|
||||
Licenses of media (textures and model)
|
||||
--------------------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2012-2016 VanessaE
|
||||
Copyright (C) 2012-2016 Zeg9
|
||||
Copyright (C) 2012-2016 thetoon
|
||||
Copyright (C) 2012-2016 PavelS(SokolovPavel)
|
||||
Copyright (C) 2016 sofar (sofar@foo-projects.org)
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
|
@ -0,0 +1,358 @@
|
|||
# Blender v2.76 (sub 11) OBJ File: 'boat.blend'
|
||||
# www.blender.org
|
||||
mtllib boat.mtl
|
||||
o boats_boat
|
||||
v -6.786140 -3.033999 -9.415440
|
||||
v -6.786140 -1.967150 -9.415440
|
||||
v -6.786140 -1.967150 8.793510
|
||||
v -6.786140 -3.033999 8.793510
|
||||
v 5.732520 -1.967150 -9.415440
|
||||
v 5.732520 -3.033999 -9.415440
|
||||
v 5.732520 -3.033999 8.793510
|
||||
v 5.732520 -1.967150 8.793510
|
||||
v -2.233900 -3.033999 -9.415440
|
||||
v -2.233900 -1.967150 -9.415440
|
||||
v -2.233900 -1.967150 8.793510
|
||||
v -2.233900 -3.033999 8.793510
|
||||
v 2.318340 -3.033999 -9.415440
|
||||
v 2.318340 -1.967150 -9.415440
|
||||
v 2.318340 -1.967150 8.793510
|
||||
v 2.318340 -3.033999 8.793510
|
||||
v -3.371960 -3.033999 8.793510
|
||||
v -3.371960 -1.967150 8.793510
|
||||
v -3.371960 -1.967150 -9.415440
|
||||
v -3.371960 -3.033999 -9.415440
|
||||
v 2.318340 0.276645 8.793510
|
||||
v 1.180280 -1.967150 8.793510
|
||||
v 5.732520 0.276645 8.793510
|
||||
v 5.732520 1.039180 8.793510
|
||||
v 6.870580 0.276645 8.793510
|
||||
v 6.870580 -1.967150 8.793510
|
||||
v 2.318340 1.039180 8.793510
|
||||
v 1.180280 0.276645 8.793510
|
||||
v 1.180280 1.039180 8.793510
|
||||
v 1.180280 -3.033999 8.793510
|
||||
v -2.233900 0.276645 8.793510
|
||||
v -3.371960 0.276645 8.793510
|
||||
v -2.233900 1.039180 8.793510
|
||||
v -3.371960 1.039180 8.793510
|
||||
v -6.786140 0.276645 8.793510
|
||||
v -7.786200 0.276645 8.793510
|
||||
v -7.786200 -1.967150 8.793510
|
||||
v -6.786140 1.039180 8.793510
|
||||
v 1.180280 -1.967150 -9.415440
|
||||
v 1.180280 -3.033999 -9.415440
|
||||
v 2.318340 0.276645 -9.415440
|
||||
v 1.180280 0.276645 -9.415440
|
||||
v 2.318340 1.039180 -9.415440
|
||||
v 5.732520 0.276645 -9.415440
|
||||
v 6.870580 -1.967150 -9.415440
|
||||
v 5.732520 1.039180 -9.415440
|
||||
v 6.870580 0.276645 -9.415440
|
||||
v 0.042220 1.039180 -9.415440
|
||||
v 1.180280 1.039180 -9.415440
|
||||
v 0.042220 -1.967150 -9.415440
|
||||
v -1.095840 -1.967150 -9.415440
|
||||
v -2.233900 0.276645 -9.415440
|
||||
v -3.371960 0.276645 -9.415440
|
||||
v -2.233900 1.039180 -9.415440
|
||||
v -1.095840 1.039180 -9.415440
|
||||
v -3.371960 1.039180 -9.415440
|
||||
v -6.786140 0.276645 -9.415440
|
||||
v -6.786140 1.039180 -9.415440
|
||||
v -7.786200 -1.967150 -9.415440
|
||||
v -7.786200 0.276645 -9.415440
|
||||
v -1.095840 0.156645 -12.044100
|
||||
v -1.095840 -4.601110 -9.415440
|
||||
v -1.095840 1.039181 -10.802900
|
||||
v -1.095840 2.868579 -10.802900
|
||||
v -1.095840 2.868580 -7.883420
|
||||
v -1.095840 3.746069 -12.034100
|
||||
v -1.095840 3.746070 -7.883420
|
||||
v -1.095840 0.156645 -14.294900
|
||||
v -1.095840 -4.601110 -14.284900
|
||||
v 0.042220 -4.601110 -14.284900
|
||||
v 0.042220 -4.601110 -9.415440
|
||||
v 0.042220 1.039181 -10.802900
|
||||
v 0.042220 0.156645 -12.044100
|
||||
v 0.042220 2.868579 -10.802900
|
||||
v 0.042220 0.156645 -14.294900
|
||||
v 0.042220 3.746069 -12.034100
|
||||
v 0.042220 3.746070 -7.883420
|
||||
v 0.042220 2.868580 -7.883420
|
||||
v -1.096322 -3.033999 -9.415440
|
||||
v 0.044046 -3.035397 -9.415440
|
||||
vt 1.000000 0.187500
|
||||
vt -1.000000 0.312500
|
||||
vt 1.000000 0.312500
|
||||
vt 0.687500 1.000000
|
||||
vt 0.500000 0.875000
|
||||
vt 0.500000 0.625000
|
||||
vt -1.000000 0.062500
|
||||
vt 1.000000 0.062500
|
||||
vt 1.000000 -0.000000
|
||||
vt -1.000000 0.125000
|
||||
vt 1.000000 0.125000
|
||||
vt 0.437500 0.125000
|
||||
vt 0.312500 0.500000
|
||||
vt 0.312500 0.125000
|
||||
vt 1.000000 0.625000
|
||||
vt -1.000000 0.500000
|
||||
vt 1.000000 0.500000
|
||||
vt 0.187500 0.687500
|
||||
vt -0.187500 0.687500
|
||||
vt -0.187500 0.312500
|
||||
vt 1.000000 0.812500
|
||||
vt -1.000000 0.937500
|
||||
vt -1.000000 0.812500
|
||||
vt 0.812500 0.687500
|
||||
vt 1.187500 0.687500
|
||||
vt 0.812500 0.312500
|
||||
vt 1.000000 0.562500
|
||||
vt 0.312500 0.437500
|
||||
vt 1.000000 0.437500
|
||||
vt 1.000000 0.750000
|
||||
vt -1.000000 0.875000
|
||||
vt -1.000000 0.750000
|
||||
vt -1.000000 1.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.437500 0.625000
|
||||
vt 0.562500 0.437500
|
||||
vt 0.562500 0.625000
|
||||
vt -1.000000 0.437500
|
||||
vt -1.000000 0.000000
|
||||
vt 0.500000 0.062500
|
||||
vt 0.375000 0.750000
|
||||
vt 0.500000 0.750000
|
||||
vt -1.000000 0.250000
|
||||
vt -1.000000 0.687500
|
||||
vt 1.000000 0.687500
|
||||
vt 0.625000 0.375000
|
||||
vt 1.000000 0.375000
|
||||
vt 1.000000 0.250000
|
||||
vt 1.000000 0.937500
|
||||
vt 0.437500 0.812500
|
||||
vt 0.312500 0.312500
|
||||
vt 0.312500 0.812500
|
||||
vt 0.437500 0.312500
|
||||
vt 0.437500 0.437500
|
||||
vt 0.687500 0.812500
|
||||
vt 0.000000 0.687500
|
||||
vt 0.000000 0.812500
|
||||
vt -1.000000 0.562500
|
||||
vt 0.875000 0.812500
|
||||
vt 0.875000 0.687500
|
||||
vt 0.250000 0.312500
|
||||
vt 0.562500 0.187500
|
||||
vt 0.250000 0.187500
|
||||
vt -1.000000 0.187500
|
||||
vt 0.312500 0.625000
|
||||
vt 0.312500 0.187500
|
||||
vt 0.312500 -0.187500
|
||||
vt 1.000000 -0.187500
|
||||
vt 0.687500 0.500000
|
||||
vt -0.000000 1.000000
|
||||
vt 0.000000 0.875000
|
||||
vt 0.437500 0.500000
|
||||
vt -1.000000 0.625000
|
||||
vt 0.812500 0.187500
|
||||
vt 1.187500 0.187500
|
||||
vt 1.187500 0.312500
|
||||
vt 1.312500 0.312500
|
||||
vt 1.312500 0.687500
|
||||
vt 0.687500 0.187500
|
||||
vt 0.687500 0.312500
|
||||
vt 1.187500 0.812500
|
||||
vt 0.812500 0.812500
|
||||
vt 0.187500 0.312500
|
||||
vt 0.312500 0.687500
|
||||
vt 0.687500 0.687500
|
||||
vt -0.187500 0.187500
|
||||
vt 0.187500 0.187500
|
||||
vt -0.312500 0.687500
|
||||
vt -0.312500 0.312500
|
||||
vt 0.187500 0.812500
|
||||
vt -0.187500 0.812500
|
||||
vt 0.437500 0.687500
|
||||
vt 0.437500 0.187500
|
||||
vt 0.562500 0.812500
|
||||
vt 0.562500 0.687500
|
||||
vt 0.312500 0.562500
|
||||
vt 1.000000 0.875000
|
||||
vt 0.375000 0.062500
|
||||
vt -1.000000 0.375000
|
||||
vt 0.625000 0.500000
|
||||
vt 0.875000 0.562500
|
||||
vt 0.937500 0.812500
|
||||
vt 0.937500 0.687500
|
||||
vt 0.875000 0.937500
|
||||
vt 0.562500 0.312500
|
||||
vn -1.000000 0.000000 0.000000
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn 0.000000 0.000000 1.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn 0.000000 -1.000000 0.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
vn 0.000000 -0.002100 -1.000000
|
||||
vn 0.001200 -1.000000 0.000000
|
||||
vn 0.000000 0.002800 -1.000000
|
||||
vn -0.001200 -1.000000 0.000200
|
||||
g boats_boat_boats_boat_None
|
||||
usemtl None
|
||||
s off
|
||||
f 41/1/1 27/2/1 43/3/1
|
||||
f 76/4/2 74/5/2 72/6/2
|
||||
f 8/7/2 6/1/2 5/8/2
|
||||
f 15/9/1 13/10/1 16/11/1
|
||||
f 51/12/3 71/13/3 50/14/3
|
||||
f 56/15/2 32/16/2 53/17/2
|
||||
f 15/18/3 8/19/3 23/20/3
|
||||
f 22/21/2 40/22/2 39/23/2
|
||||
f 19/24/4 2/25/4 53/26/4
|
||||
f 70/27/5 62/28/5 69/29/5
|
||||
f 11/30/5 19/31/5 10/32/5
|
||||
f 4/15/5 20/33/5 17/34/5
|
||||
f 72/35/3 64/36/3 63/37/3
|
||||
f 13/8/5 7/38/5 16/7/5
|
||||
f 23/39/6 47/11/6 44/9/6
|
||||
f 68/40/7 70/41/7 69/42/7
|
||||
f 80/43/8 40/10/8 30/11/8
|
||||
f 3/15/1 1/32/1 4/30/1
|
||||
f 20/44/2 18/27/2 17/45/2
|
||||
f 74/17/5 65/46/5 64/47/5
|
||||
f 31/43/1 54/47/1 52/48/1
|
||||
f 22/47/5 14/43/5 15/48/5
|
||||
f 46/1/2 23/7/2 44/8/2
|
||||
f 57/21/1 38/22/1 58/49/1
|
||||
f 61/50/9 76/51/9 73/52/9
|
||||
f 37/45/5 2/23/5 3/21/5
|
||||
f 78/28/3 67/53/3 65/54/3
|
||||
f 64/5/1 66/4/1 63/6/1
|
||||
f 76/55/6 67/56/6 77/57/6
|
||||
f 47/17/2 26/10/2 45/11/2
|
||||
f 5/16/5 26/47/5 8/17/5
|
||||
f 33/58/6 48/59/6 55/60/6
|
||||
f 29/38/2 42/3/2 49/29/2
|
||||
f 32/44/6 52/21/6 53/45/6
|
||||
f 58/15/6 34/33/6 56/34/6
|
||||
f 27/7/6 46/29/6 43/8/6
|
||||
f 73/61/6 68/62/6 61/63/6
|
||||
f 21/58/6 42/29/6 28/38/6
|
||||
f 11/29/1 9/58/1 12/27/1
|
||||
f 59/45/1 36/2/1 60/3/1
|
||||
f 60/9/6 35/10/6 57/11/6
|
||||
f 41/1/1 21/64/1 27/2/1
|
||||
f 72/6/2 48/65/2 50/66/2
|
||||
f 50/66/2 71/67/2 70/68/2
|
||||
f 70/68/2 75/17/2 73/69/2
|
||||
f 76/4/2 77/70/2 74/5/2
|
||||
f 77/70/2 78/71/2 74/5/2
|
||||
f 50/66/2 70/68/2 73/69/2
|
||||
f 73/69/2 76/4/2 72/6/2
|
||||
f 72/6/2 50/66/2 73/69/2
|
||||
f 8/7/2 7/64/2 6/1/2
|
||||
f 15/9/1 14/39/1 13/10/1
|
||||
f 51/12/3 62/72/3 71/13/3
|
||||
f 56/15/2 34/73/2 32/16/2
|
||||
f 32/26/3 34/74/3 38/75/3
|
||||
f 35/76/3 36/77/3 37/78/3
|
||||
f 32/26/3 38/75/3 35/76/3
|
||||
f 29/66/3 33/79/3 31/80/3
|
||||
f 32/26/3 35/76/3 3/25/3
|
||||
f 28/51/3 29/66/3 31/80/3
|
||||
f 31/80/3 32/26/3 18/24/3
|
||||
f 3/25/3 4/81/3 17/82/3
|
||||
f 35/76/3 37/78/3 3/25/3
|
||||
f 21/83/3 28/51/3 22/84/3
|
||||
f 3/25/3 17/82/3 18/24/3
|
||||
f 11/85/3 12/55/3 30/52/3
|
||||
f 32/26/3 3/25/3 18/24/3
|
||||
f 11/85/3 30/52/3 22/84/3
|
||||
f 31/80/3 18/24/3 11/85/3
|
||||
f 24/86/3 27/87/3 21/83/3
|
||||
f 28/51/3 31/80/3 11/85/3
|
||||
f 11/85/3 22/84/3 28/51/3
|
||||
f 24/86/3 21/83/3 23/20/3
|
||||
f 26/88/3 25/89/3 23/20/3
|
||||
f 23/20/3 21/83/3 15/18/3
|
||||
f 15/18/3 16/90/3 7/91/3
|
||||
f 21/83/3 22/84/3 15/18/3
|
||||
f 8/19/3 26/88/3 23/20/3
|
||||
f 15/18/3 7/91/3 8/19/3
|
||||
f 22/21/2 30/49/2 40/22/2
|
||||
f 47/89/4 45/88/4 5/19/4
|
||||
f 5/19/4 6/91/4 13/90/4
|
||||
f 5/19/4 13/90/4 14/18/4
|
||||
f 44/20/4 47/89/4 5/19/4
|
||||
f 43/87/4 46/86/4 44/20/4
|
||||
f 41/83/4 43/87/4 44/20/4
|
||||
f 44/20/4 5/19/4 14/18/4
|
||||
f 39/84/4 40/52/4 80/50/4
|
||||
f 44/20/4 14/18/4 41/83/4
|
||||
f 42/51/4 41/83/4 39/84/4
|
||||
f 39/84/4 80/50/4 50/92/4
|
||||
f 41/83/4 14/18/4 39/84/4
|
||||
f 48/93/4 49/66/4 42/51/4
|
||||
f 50/92/4 48/93/4 42/51/4
|
||||
f 80/50/4 79/94/4 50/92/4
|
||||
f 50/92/4 42/51/4 39/84/4
|
||||
f 54/79/4 55/62/4 52/80/4
|
||||
f 50/92/4 79/94/4 51/95/4
|
||||
f 52/80/4 55/62/4 51/95/4
|
||||
f 51/95/4 79/94/4 10/85/4
|
||||
f 79/94/4 9/55/4 10/85/4
|
||||
f 53/26/4 52/80/4 10/85/4
|
||||
f 58/75/4 56/74/4 53/26/4
|
||||
f 59/78/4 60/77/4 57/76/4
|
||||
f 57/76/4 58/75/4 53/26/4
|
||||
f 52/80/4 51/95/4 10/85/4
|
||||
f 19/24/4 20/82/4 1/81/4
|
||||
f 53/26/4 10/85/4 19/24/4
|
||||
f 59/78/4 57/76/4 2/25/4
|
||||
f 19/24/4 1/81/4 2/25/4
|
||||
f 2/25/4 57/76/4 53/26/4
|
||||
f 70/27/5 71/96/5 62/28/5
|
||||
f 11/30/5 18/97/5 19/31/5
|
||||
f 4/15/5 1/73/5 20/33/5
|
||||
f 72/35/3 74/54/3 64/36/3
|
||||
f 13/8/5 6/29/5 7/38/5
|
||||
f 23/39/6 25/10/6 47/11/6
|
||||
f 68/40/7 75/98/7 70/41/7
|
||||
f 30/11/5 12/17/5 79/99/5
|
||||
f 79/99/10 80/43/10 30/11/10
|
||||
f 12/17/5 9/16/5 79/99/5
|
||||
f 3/15/1 2/73/1 1/32/1
|
||||
f 20/44/2 19/58/2 18/27/2
|
||||
f 74/17/5 78/100/5 65/46/5
|
||||
f 31/43/1 33/99/1 54/47/1
|
||||
f 22/47/5 39/99/5 14/43/5
|
||||
f 46/1/2 24/64/2 23/7/2
|
||||
f 57/21/1 35/23/1 38/22/1
|
||||
f 61/50/9 66/53/9 76/51/9
|
||||
f 37/45/5 59/44/5 2/23/5
|
||||
f 78/28/3 77/51/3 67/53/3
|
||||
f 62/67/1 51/66/1 69/68/1
|
||||
f 51/66/1 55/65/1 63/6/1
|
||||
f 68/17/1 69/68/1 61/69/1
|
||||
f 61/69/1 69/68/1 51/66/1
|
||||
f 61/69/1 51/66/1 63/6/1
|
||||
f 65/71/1 67/70/1 64/5/1
|
||||
f 61/69/1 63/6/1 66/4/1
|
||||
f 64/5/1 67/70/1 66/4/1
|
||||
f 76/55/6 66/85/6 67/56/6
|
||||
f 47/17/2 25/16/2 26/10/2
|
||||
f 5/16/5 45/99/5 26/47/5
|
||||
f 55/60/6 54/101/6 33/58/6
|
||||
f 33/58/6 29/22/6 48/59/6
|
||||
f 48/59/6 72/102/6 63/103/6
|
||||
f 29/22/6 49/104/6 48/59/6
|
||||
f 48/59/6 63/103/6 55/60/6
|
||||
f 29/38/2 28/2/2 42/3/2
|
||||
f 32/44/6 31/23/6 52/21/6
|
||||
f 58/15/6 38/73/6 34/33/6
|
||||
f 27/7/6 24/38/6 46/29/6
|
||||
f 73/61/6 75/105/6 68/62/6
|
||||
f 21/58/6 41/27/6 42/29/6
|
||||
f 11/29/1 10/38/1 9/58/1
|
||||
f 59/45/1 37/44/1 36/2/1
|
||||
f 60/9/6 36/39/6 35/10/6
|
After Width: | Height: | Size: 851 B |
After Width: | Height: | Size: 546 B |
|
@ -167,7 +167,8 @@ minetest.register_on_dieplayer(function(player)
|
|||
end
|
||||
|
||||
-- return if keep inventory set or in creative mode
|
||||
if bones_mode == "keep" or minetest.setting_getbool("creative_mode") then
|
||||
if bones_mode == "keep" or (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(player:get_player_name())) then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -92,7 +92,8 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
|
|||
end
|
||||
-- Pick up cart
|
||||
local inv = puncher:get_inventory()
|
||||
if not minetest.setting_getbool("creative_mode")
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(puncher:get_player_name()))
|
||||
or not inv:contains_item("main", "carts:cart") then
|
||||
local leftover = inv:add_item("main", "carts:cart")
|
||||
-- If no room in inventory add a replacement cart to the world
|
||||
|
@ -385,7 +386,8 @@ minetest.register_craftitem("carts:cart", {
|
|||
minetest.sound_play({name = "default_place_node_metal", gain = 0.5},
|
||||
{pos = pointed_thing.above})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name())) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
|
|
@ -10,11 +10,11 @@ carts:register_rail("carts:rail", {
|
|||
}, {})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "carts:rail 16",
|
||||
output = "carts:rail 18",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -31,11 +31,11 @@ carts:register_rail("carts:powerrail", {
|
|||
}, {acceleration = 5})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "carts:powerrail 8",
|
||||
output = "carts:powerrail 18",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -50,10 +50,10 @@ carts:register_rail("carts:brakerail", {
|
|||
}, {acceleration = -3})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "carts:brakerail 8",
|
||||
output = "carts:brakerail 18",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
|
|
@ -8,7 +8,7 @@ end
|
|||
|
||||
dofile(minetest.get_modpath("creative") .. "/inventory.lua")
|
||||
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
if creative_mode_cache then
|
||||
-- Dig time is modified according to difference (leveldiff) between tool
|
||||
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of
|
||||
-- leveldiff and 1.
|
||||
|
@ -55,8 +55,7 @@ function minetest.handle_node_drops(pos, drops, digger)
|
|||
local inv = digger:get_inventory()
|
||||
if inv then
|
||||
for _, item in ipairs(drops) do
|
||||
item = ItemStack(item):get_name()
|
||||
if not inv:contains_item("main", item) then
|
||||
if not inv:contains_item("main", item, true) then
|
||||
inv:add_item("main", item)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,16 +33,14 @@ function creative.init_creative_inventory(player)
|
|||
end,
|
||||
}, player_name)
|
||||
|
||||
creative.update_creative_inventory(player_name, minetest.registered_items)
|
||||
return player_inventory[player_name]
|
||||
end
|
||||
|
||||
function creative.update_creative_inventory(player_name, tab_content)
|
||||
local creative_list = {}
|
||||
local inv = player_inventory[player_name] or
|
||||
creative.init_creative_inventory(minetest.get_player_by_name(player_name))
|
||||
local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
|
||||
local inv = player_inventory[player_name]
|
||||
if not inv then
|
||||
creative.init_creative_inventory(minetest.get_player_by_name(player_name))
|
||||
end
|
||||
|
||||
for name, def in pairs(tab_content) do
|
||||
if not (def.groups.not_in_creative_inventory == 1) and
|
||||
|
@ -161,7 +159,7 @@ function creative.register_tab(name, title, items)
|
|||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
creative.init_creative_inventory(player)
|
||||
creative.update_creative_inventory(player:get_player_name(), minetest.registered_items)
|
||||
end)
|
||||
|
||||
creative.register_tab("all", "All", minetest.registered_items)
|
||||
|
|
|
@ -17,6 +17,7 @@ Cisoun's texture pack (CC BY-SA 3.0):
|
|||
default_lava.png
|
||||
default_leaves.png
|
||||
default_sapling.png
|
||||
default_bush_sapling.png
|
||||
default_stone.png
|
||||
default_tree.png
|
||||
default_tree_top.png
|
||||
|
@ -77,10 +78,6 @@ Splizard (CC BY-SA 3.0):
|
|||
|
||||
Zeg9 (CC BY-SA 3.0):
|
||||
default_coal_block.png
|
||||
default_steel_block.png
|
||||
default_copper_block.png
|
||||
default_bronze_block.png
|
||||
default_gold_block.png
|
||||
|
||||
paramat (CC BY-SA 3.0):
|
||||
wieldhand.png -- Copied from character.png by Jordach (CC BY-SA 3.0)
|
||||
|
@ -90,6 +87,7 @@ paramat (CC BY-SA 3.0):
|
|||
default_acacia_leaves.png
|
||||
default_acacia_leaves_simple.png
|
||||
default_acacia_sapling.png
|
||||
default_acacia_bush_sapling.png
|
||||
default_acacia_tree.png
|
||||
default_acacia_tree_top.png
|
||||
default_acacia_wood.png
|
||||
|
@ -126,6 +124,7 @@ brunob.santos (CC BY-SA 4.0):
|
|||
default_desert_cobble.png
|
||||
|
||||
BlockMen (CC BY-SA 3.0):
|
||||
default_aspen_leaves.png -- Derived from Sofar's texture
|
||||
default_wood.png
|
||||
default_clay_brick.png
|
||||
default_iron_ingot.png
|
||||
|
@ -152,10 +151,12 @@ Wuzzy (CC BY-SA 3.0):
|
|||
sofar (CC BY-SA 3.0):
|
||||
default_book_written.png, based on default_book.png
|
||||
default_aspen_sapling
|
||||
default_aspen_leaves
|
||||
default_aspen_tree
|
||||
default_aspen_tree_top, derived from default_pine_tree_top (by paramat)
|
||||
default_aspen_wood, derived from default_pine_wood (by paramat)
|
||||
default_chest_inside
|
||||
|
||||
sofar (WTFPL):
|
||||
default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel
|
||||
|
||||
Neuromancer (CC BY-SA 2.0):
|
||||
|
@ -210,6 +211,16 @@ kaeza (CC-BY-SA 3.0):
|
|||
default_desert_sandstone_brick.png
|
||||
default_desert_sandstone_block.png
|
||||
|
||||
kilbith (CC BY-SA 3.0):
|
||||
default_steel_block.png
|
||||
default_copper_block.png
|
||||
default_bronze_block.png
|
||||
default_gold_block.png
|
||||
default_tin_block.png
|
||||
default_mineral_tin.png
|
||||
default_tin_ingot.png
|
||||
default_tin_lump.png
|
||||
|
||||
Glass breaking sounds (CC BY 3.0):
|
||||
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
|
||||
2: http://www.freesound.org/people/Tomlija/sounds/97669/
|
||||
|
@ -277,3 +288,13 @@ https://www.freesound.org/people/AGFX/packs/1253/
|
|||
blukotek (CC0 1.0)
|
||||
https://www.freesound.org/people/blukotek/sounds/251660/
|
||||
default_dig_snappy.ogg
|
||||
|
||||
Chests sounds added by sofar, derived of several files mixed together:
|
||||
default_chest_open.ogg
|
||||
default_chest_close.ogg
|
||||
- http://www.freesound.org/people/Sevin7/sounds/269722/ CC0
|
||||
- http://www.freesound.org/people/Percy%20Duke/sounds/23448/ CC-BY-3.0
|
||||
- http://www.freesound.org/people/kingsamas/sounds/135576/ CC-BY-3.0
|
||||
- http://www.freesound.org/people/bulbastre/sounds/126887/ CC-BY-3.0
|
||||
- http://www.freesound.org/people/Yoyodaman234/sounds/183541/ CC0
|
||||
|
||||
|
|
|
@ -392,12 +392,6 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "default:bronze_ingot",
|
||||
recipe = {"default:steel_ingot", "default:copper_ingot"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:coalblock',
|
||||
recipe = {
|
||||
|
@ -446,6 +440,31 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:tinblock",
|
||||
recipe = {
|
||||
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
|
||||
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
|
||||
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:tin_ingot 9",
|
||||
recipe = {
|
||||
{"default:tinblock"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:bronze_ingot 9",
|
||||
recipe = {
|
||||
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
|
||||
{"default:copper_ingot", "default:tin_ingot", "default:copper_ingot"},
|
||||
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:bronzeblock',
|
||||
recipe = {
|
||||
|
@ -849,6 +868,12 @@ minetest.register_craft({
|
|||
recipe = "default:copper_lump",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:tin_ingot",
|
||||
recipe = "default:tin_lump",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:gold_ingot",
|
||||
|
@ -966,6 +991,18 @@ minetest.register_craft({
|
|||
burntime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:bush_sapling",
|
||||
burntime = 6,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:acacia_bush_sapling",
|
||||
burntime = 7,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:aspen_sapling",
|
||||
|
|
|
@ -12,6 +12,7 @@ minetest.register_craftitem("default:paper", {
|
|||
groups = {flammable = 3},
|
||||
})
|
||||
|
||||
|
||||
local lpp = 14 -- Lines per book's page
|
||||
local function book_on_use(itemstack, user)
|
||||
local player_name = user:get_player_name()
|
||||
|
@ -71,6 +72,7 @@ local function book_on_use(itemstack, user)
|
|||
end
|
||||
|
||||
minetest.show_formspec(player_name, "default:book", formspec)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
@ -92,6 +94,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
data = stack:get_meta():to_table().fields
|
||||
end
|
||||
|
||||
if data and data.owner and data.owner ~= player:get_player_name() then
|
||||
return
|
||||
end
|
||||
|
||||
if not data then data = {} end
|
||||
data.title = fields.title
|
||||
data.owner = player:get_player_name()
|
||||
|
@ -133,11 +139,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
end
|
||||
end
|
||||
|
||||
local data_str = minetest.serialize(data)
|
||||
stack:set_metadata(data_str)
|
||||
book_on_use(stack, player)
|
||||
stack:get_meta():from_table({fields = data})
|
||||
stack = book_on_use(stack, player)
|
||||
end
|
||||
|
||||
-- Update stack
|
||||
player:set_wielded_item(stack)
|
||||
end)
|
||||
|
||||
|
@ -178,13 +184,69 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv
|
|||
if not original then
|
||||
return
|
||||
end
|
||||
local copymeta = original:get_metadata()
|
||||
local copymeta = original:get_meta():to_table()
|
||||
-- copy of the book held by player's mouse cursor
|
||||
itemstack:set_metadata(copymeta)
|
||||
itemstack:get_meta():from_table(copymeta)
|
||||
-- put the book with metadata back in the craft grid
|
||||
craft_inv:set_stack("craft", index, original)
|
||||
end)
|
||||
|
||||
minetest.register_craftitem("default:skeleton_key", {
|
||||
description = "Skeleton Key",
|
||||
inventory_image = "default_key_skeleton.png",
|
||||
groups = {key = 1},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if not node then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use
|
||||
if not on_skeleton_key_use then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- make a new key secret in case the node callback needs it
|
||||
local random = math.random
|
||||
local newsecret = string.format(
|
||||
"%04x%04x%04x%04x",
|
||||
random(2^16) - 1, random(2^16) - 1,
|
||||
random(2^16) - 1, random(2^16) - 1)
|
||||
|
||||
local secret, _, _ = on_skeleton_key_use(pos, user, newsecret)
|
||||
|
||||
if secret then
|
||||
local inv = minetest.get_inventory({type="player", name=user:get_player_name()})
|
||||
|
||||
-- update original itemstack
|
||||
itemstack:take_item()
|
||||
|
||||
-- finish and return the new key
|
||||
local new_stack = ItemStack("default:key")
|
||||
local meta = new_stack:get_meta()
|
||||
meta:set_string("secret", secret)
|
||||
meta:set_string("description", "Key to "..user:get_player_name().."'s "
|
||||
..minetest.registered_nodes[node.name].description)
|
||||
|
||||
if itemstack:get_count() == 0 then
|
||||
itemstack = new_stack
|
||||
else
|
||||
if inv:add_item("main", new_stack):get_count() > 0 then
|
||||
minetest.add_item(user:getpos(), new_stack)
|
||||
end -- else: added to inventory successfully
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:coal_lump", {
|
||||
description = "Coal Lump",
|
||||
inventory_image = "default_coal_lump.png",
|
||||
|
@ -201,6 +263,11 @@ minetest.register_craftitem("default:copper_lump", {
|
|||
inventory_image = "default_copper_lump.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:tin_lump", {
|
||||
description = "Tin Lump",
|
||||
inventory_image = "default_tin_lump.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:mese_crystal", {
|
||||
description = "Mese Crystal",
|
||||
inventory_image = "default_mese_crystal.png",
|
||||
|
@ -231,6 +298,11 @@ minetest.register_craftitem("default:copper_ingot", {
|
|||
inventory_image = "default_copper_ingot.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:tin_ingot", {
|
||||
description = "Tin Ingot",
|
||||
inventory_image = "default_tin_ingot.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:bronze_ingot", {
|
||||
description = "Bronze Ingot",
|
||||
inventory_image = "default_bronze_ingot.png",
|
||||
|
|
|
@ -140,18 +140,17 @@ default.cool_lava = function(pos, node)
|
|||
{pos = pos, max_hear_distance = 16, gain = 0.25})
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Lava cooling",
|
||||
nodenames = {"default:lava_source", "default:lava_flowing"},
|
||||
neighbors = {"group:cools_lava", "group:water"},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
catch_up = false,
|
||||
action = function(...)
|
||||
default.cool_lava(...)
|
||||
end,
|
||||
})
|
||||
|
||||
if minetest.setting_getbool("enable_lavacooling") ~= false then
|
||||
minetest.register_abm({
|
||||
label = "Lava cooling",
|
||||
nodenames = {"default:lava_source", "default:lava_flowing"},
|
||||
neighbors = {"group:cools_lava", "group:water"},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
catch_up = false,
|
||||
action = default.cool_lava,
|
||||
})
|
||||
end
|
||||
|
||||
--
|
||||
-- optimized helper to put all items in an inventory into a drops list
|
||||
|
@ -232,9 +231,7 @@ minetest.register_abm({
|
|||
neighbors = {"group:sand"},
|
||||
interval = 12,
|
||||
chance = 83,
|
||||
action = function(...)
|
||||
default.grow_cactus(...)
|
||||
end
|
||||
action = default.grow_cactus
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
|
@ -243,9 +240,7 @@ minetest.register_abm({
|
|||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 14,
|
||||
chance = 71,
|
||||
action = function(...)
|
||||
default.grow_papyrus(...)
|
||||
end
|
||||
action = default.grow_papyrus
|
||||
})
|
||||
|
||||
|
||||
|
@ -328,8 +323,9 @@ local function leafdecay_after_destruct(pos, oldnode, def)
|
|||
for _, v in pairs(minetest.find_nodes_in_area(vector.subtract(pos, def.radius),
|
||||
vector.add(pos, def.radius), def.leaves)) do
|
||||
local node = minetest.get_node(v)
|
||||
if node.param2 == 0 then
|
||||
minetest.get_node_timer(v):start(math.random(20, 120) / 10)
|
||||
local timer = minetest.get_node_timer(v)
|
||||
if node.param2 == 0 and not timer:is_started() then
|
||||
timer:start(math.random(20, 120) / 10)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -552,9 +548,9 @@ function default.can_interact_with_node(player, pos)
|
|||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
|
||||
if player:get_player_name() == meta:get_string("owner") then
|
||||
-- Owner can access the node to any time
|
||||
if not owner or owner == "" or owner == player:get_player_name() then
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -564,7 +560,12 @@ function default.can_interact_with_node(player, pos)
|
|||
local key_meta = item:get_meta()
|
||||
|
||||
if key_meta:get_string("secret") == "" then
|
||||
key_meta:set_string("secret", minetest.parse_json(item:get_metadata()).secret)
|
||||
local key_oldmeta = item:get_metadata()
|
||||
if key_oldmeta == "" or not minetest.parse_json(key_oldmeta) then
|
||||
return false
|
||||
end
|
||||
|
||||
key_meta:set_string("secret", minetest.parse_json(key_oldmeta).secret)
|
||||
item:set_metadata("")
|
||||
end
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ Copyright (C) 2010-2016:
|
|||
Mito551
|
||||
GreenXenith
|
||||
kaeza
|
||||
kilbith
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
|
|
|
@ -187,7 +187,8 @@ function default.register_blob_ores()
|
|||
"coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest",
|
||||
"deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert",
|
||||
"cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean",
|
||||
"rainforest", "rainforest_swamp", "rainforest_ocean", "underground"}
|
||||
"rainforest", "rainforest_swamp", "rainforest_ocean", "underground",
|
||||
"floatland_ocean", "floatland_grassland", "floatland_coniferous_forest"}
|
||||
})
|
||||
|
||||
-- Dirt
|
||||
|
@ -211,7 +212,8 @@ function default.register_blob_ores()
|
|||
},
|
||||
biomes = {"taiga", "snowy_grassland", "grassland", "coniferous_forest",
|
||||
"deciduous_forest", "deciduous_forest_shore", "savanna", "savanna_shore",
|
||||
"rainforest", "rainforest_swamp"}
|
||||
"rainforest", "rainforest_swamp", "floatland_grassland",
|
||||
"floatland_coniferous_forest"}
|
||||
})
|
||||
|
||||
-- Gravel
|
||||
|
@ -239,7 +241,8 @@ function default.register_blob_ores()
|
|||
"coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest",
|
||||
"deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert",
|
||||
"cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean",
|
||||
"rainforest", "rainforest_swamp", "rainforest_ocean", "underground"}
|
||||
"rainforest", "rainforest_swamp", "rainforest_ocean", "underground",
|
||||
"floatland_ocean", "floatland_grassland", "floatland_coniferous_forest"}
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -354,6 +357,41 @@ function default.register_ores()
|
|||
y_max = -64,
|
||||
})
|
||||
|
||||
-- Tin
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_tin",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10 * 10 * 10,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_min = 1025,
|
||||
y_max = 31000,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_tin",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 13 * 13 * 13,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_min = -127,
|
||||
y_max = -32,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_tin",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10 * 10 * 10,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
y_min = -31000,
|
||||
y_max = -128,
|
||||
})
|
||||
|
||||
-- Gold
|
||||
|
||||
minetest.register_ore({
|
||||
|
@ -491,7 +529,7 @@ end
|
|||
|
||||
-- All mapgens except mgv6
|
||||
|
||||
function default.register_biomes()
|
||||
function default.register_biomes(upper_limit)
|
||||
|
||||
-- Icesheet
|
||||
|
||||
|
@ -510,7 +548,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:gravel",
|
||||
depth_riverbed = 2,
|
||||
y_min = -8,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 0,
|
||||
humidity_point = 73,
|
||||
})
|
||||
|
@ -550,7 +588,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:gravel",
|
||||
depth_riverbed = 2,
|
||||
y_min = 2,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 0,
|
||||
humidity_point = 40,
|
||||
})
|
||||
|
@ -612,7 +650,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 2,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 25,
|
||||
humidity_point = 70,
|
||||
})
|
||||
|
@ -654,7 +692,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 5,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 20,
|
||||
humidity_point = 35,
|
||||
})
|
||||
|
@ -696,7 +734,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 6,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 50,
|
||||
humidity_point = 35,
|
||||
})
|
||||
|
@ -758,7 +796,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 6,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 45,
|
||||
humidity_point = 70,
|
||||
})
|
||||
|
@ -820,7 +858,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 60,
|
||||
humidity_point = 68,
|
||||
})
|
||||
|
@ -882,7 +920,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 5,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 92,
|
||||
humidity_point = 16,
|
||||
})
|
||||
|
@ -915,7 +953,7 @@ function default.register_biomes()
|
|||
node_top = "default:sand",
|
||||
depth_top = 1,
|
||||
node_filler = "default:sand",
|
||||
depth_filler = 0,
|
||||
depth_filler = 1,
|
||||
node_stone = "default:sandstone",
|
||||
--node_water_top = "",
|
||||
--depth_water_top = ,
|
||||
|
@ -924,7 +962,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 5,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 60,
|
||||
humidity_point = 0,
|
||||
})
|
||||
|
@ -966,7 +1004,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 5,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 40,
|
||||
humidity_point = 0,
|
||||
})
|
||||
|
@ -1008,7 +1046,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 89,
|
||||
humidity_point = 42,
|
||||
})
|
||||
|
@ -1070,7 +1108,7 @@ function default.register_biomes()
|
|||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
y_max = upper_limit,
|
||||
heat_point = 86,
|
||||
humidity_point = 65,
|
||||
})
|
||||
|
@ -1137,6 +1175,100 @@ function default.register_biomes()
|
|||
end
|
||||
|
||||
|
||||
-- Biomes for floatlands
|
||||
|
||||
function default.register_floatland_biomes(floatland_level, shadow_limit)
|
||||
|
||||
-- Coniferous forest
|
||||
|
||||
minetest.register_biome({
|
||||
name = "floatland_coniferous_forest",
|
||||
--node_dust = "",
|
||||
node_top = "default:dirt_with_grass",
|
||||
depth_top = 1,
|
||||
node_filler = "default:dirt",
|
||||
depth_filler = 3,
|
||||
--node_stone = "",
|
||||
--node_water_top = "",
|
||||
--depth_water_top = ,
|
||||
--node_water = "",
|
||||
--node_river_water = "",
|
||||
--node_riverbed = "",
|
||||
--depth_riverbed = ,
|
||||
y_min = floatland_level + 2,
|
||||
y_max = 31000,
|
||||
heat_point = 50,
|
||||
humidity_point = 70,
|
||||
})
|
||||
|
||||
-- Grassland
|
||||
|
||||
minetest.register_biome({
|
||||
name = "floatland_grassland",
|
||||
--node_dust = "",
|
||||
node_top = "default:dirt_with_grass",
|
||||
depth_top = 1,
|
||||
node_filler = "default:dirt",
|
||||
depth_filler = 1,
|
||||
--node_stone = "",
|
||||
--node_water_top = "",
|
||||
--depth_water_top = ,
|
||||
--node_water = "",
|
||||
--node_river_water = "",
|
||||
--node_riverbed = "",
|
||||
--depth_riverbed = ,
|
||||
y_min = floatland_level + 2,
|
||||
y_max = 31000,
|
||||
heat_point = 50,
|
||||
humidity_point = 35,
|
||||
})
|
||||
|
||||
-- Sandstone desert
|
||||
|
||||
minetest.register_biome({
|
||||
name = "floatland_sandstone_desert",
|
||||
--node_dust = "",
|
||||
node_top = "default:sand",
|
||||
depth_top = 1,
|
||||
node_filler = "default:sand",
|
||||
depth_filler = 1,
|
||||
node_stone = "default:sandstone",
|
||||
--node_water_top = "",
|
||||
--depth_water_top = ,
|
||||
--node_water = "",
|
||||
--node_river_water = "",
|
||||
--node_riverbed = "",
|
||||
--depth_riverbed = ,
|
||||
y_min = floatland_level + 2,
|
||||
y_max = 31000,
|
||||
heat_point = 50,
|
||||
humidity_point = 0,
|
||||
})
|
||||
|
||||
-- Floatland ocean / underground
|
||||
|
||||
minetest.register_biome({
|
||||
name = "floatland_ocean",
|
||||
--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 = "",
|
||||
--node_riverbed = "",
|
||||
--depth_riverbed = ,
|
||||
y_min = shadow_limit,
|
||||
y_max = floatland_level + 1,
|
||||
heat_point = 50,
|
||||
humidity_point = 50,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Register decorations
|
||||
--
|
||||
|
@ -1247,7 +1379,8 @@ local function register_grass_decoration(offset, scale, length)
|
|||
persist = 0.6
|
||||
},
|
||||
biomes = {"grassland", "grassland_dunes", "deciduous_forest",
|
||||
"coniferous_forest", "coniferous_forest_dunes"},
|
||||
"coniferous_forest", "coniferous_forest_dunes",
|
||||
"floatland_grassland", "floatland_coniferous_forest"},
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
decoration = "default:grass_" .. length,
|
||||
|
@ -1361,7 +1494,7 @@ function default.register_decorations()
|
|||
octaves = 3,
|
||||
persist = 0.66
|
||||
},
|
||||
biomes = {"taiga", "coniferous_forest"},
|
||||
biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"},
|
||||
y_min = 2,
|
||||
y_max = 31000,
|
||||
schematic = minetest.get_modpath("default") .. "/schematics/pine_tree.mts",
|
||||
|
@ -1549,7 +1682,8 @@ function default.register_decorations()
|
|||
octaves = 3,
|
||||
persist = 0.7,
|
||||
},
|
||||
biomes = {"snowy_grassland", "grassland", "deciduous_forest"},
|
||||
biomes = {"snowy_grassland", "grassland", "deciduous_forest",
|
||||
"floatland_grassland"},
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
schematic = minetest.get_modpath("default") .. "/schematics/bush.mts",
|
||||
|
@ -1655,9 +1789,18 @@ end
|
|||
|
||||
|
||||
--
|
||||
-- Detect mapgen to select functions
|
||||
-- Detect mapgen, flags and parameters to select functions
|
||||
--
|
||||
|
||||
-- Get setting or default
|
||||
local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags") or
|
||||
"mountains, ridges, nofloatlands"
|
||||
local captures_float = string.match(mgv7_spflags, "floatlands")
|
||||
local captures_nofloat = string.match(mgv7_spflags, "nofloatlands")
|
||||
|
||||
local mgv7_floatland_level = minetest.get_mapgen_setting("mgv7_floatland_level") or 1280
|
||||
local mgv7_shadow_limit = minetest.get_mapgen_setting("mgv7_shadow_limit") or 1024
|
||||
|
||||
minetest.clear_registered_biomes()
|
||||
minetest.clear_registered_ores()
|
||||
minetest.clear_registered_decorations()
|
||||
|
@ -1667,8 +1810,16 @@ if mg_name == "v6" then
|
|||
default.register_mgv6_blob_ores()
|
||||
default.register_ores()
|
||||
default.register_mgv6_decorations()
|
||||
elseif mg_name == "v7" and captures_float == "floatlands" and
|
||||
captures_nofloat ~= "nofloatlands" then
|
||||
-- Mgv7 with floatlands
|
||||
default.register_biomes(mgv7_shadow_limit - 1)
|
||||
default.register_floatland_biomes(mgv7_floatland_level, mgv7_shadow_limit)
|
||||
default.register_blob_ores()
|
||||
default.register_ores()
|
||||
default.register_decorations()
|
||||
else
|
||||
default.register_biomes()
|
||||
default.register_biomes(31000)
|
||||
default.register_blob_ores()
|
||||
default.register_ores()
|
||||
default.register_decorations()
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
# Blender v2.78 (sub 0) OBJ File: 'chest-open.blend'
|
||||
# www.blender.org
|
||||
o Top_Cube.002_None_Top_Cube.002_None_bottom
|
||||
v -0.500000 0.408471 0.720970
|
||||
v -0.500000 1.115578 0.013863
|
||||
v -0.500000 0.894607 -0.207108
|
||||
v -0.500000 0.187501 0.499999
|
||||
v 0.500000 1.115578 0.013863
|
||||
v 0.500000 0.408471 0.720970
|
||||
v 0.500000 0.187501 0.499999
|
||||
v 0.500000 0.894607 -0.207108
|
||||
v -0.500000 0.187500 -0.500000
|
||||
v -0.500000 -0.500000 -0.500000
|
||||
v -0.500000 -0.500000 0.500000
|
||||
v 0.500000 0.187500 -0.500000
|
||||
v 0.500000 -0.500000 0.500000
|
||||
v 0.500000 -0.500000 -0.500000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 1.0000 0.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 1.0000 0.6875
|
||||
vt 0.0000 0.6875
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 0.6875
|
||||
vt 1.0000 0.6875
|
||||
vt 1.0000 0.6875
|
||||
vt 1.0000 0.0000
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.6875
|
||||
vt 1.0000 0.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 1.0000 0.6875
|
||||
vt 1.0000 0.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.6875
|
||||
vt 0.0000 0.6875
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.5000
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.5000
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.0000
|
||||
vn 0.0000 0.7071 0.7071
|
||||
vn -0.0000 -1.0000 -0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 1.0000 0.0000 -0.0000
|
||||
vn 0.0000 -0.7071 0.7071
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn -0.0000 0.7071 -0.7071
|
||||
vn -0.0000 0.0000 -1.0000
|
||||
vn -0.0000 -0.7071 -0.7071
|
||||
vn -0.0000 1.0000 -0.0000
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Top
|
||||
s off
|
||||
f 6/1/1 5/2/1 2/3/1 1/4/1
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Bottom
|
||||
f 11/5/2 10/6/2 14/7/2 13/8/2
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Right-Left
|
||||
f 1/9/3 2/10/3 3/11/3 4/12/3
|
||||
f 5/13/4 6/1/4 7/14/4 8/15/4
|
||||
f 4/12/3 9/16/3 10/17/3 11/18/3
|
||||
f 12/19/4 7/14/4 13/8/4 14/20/4
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Back
|
||||
f 6/21/5 1/9/5 4/12/5 7/22/5
|
||||
f 7/22/6 4/12/6 11/18/6 13/23/6
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Front
|
||||
f 2/10/7 5/24/7 8/25/7 3/11/7
|
||||
f 9/16/8 12/26/8 14/27/8 10/17/8
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Inside
|
||||
f 4/28/9 3/29/9 8/30/9 7/31/9
|
||||
f 7/31/10 12/32/10 9/33/10 4/28/10
|
|
@ -107,6 +107,10 @@ default:steelblock
|
|||
|
||||
default:stone_with_copper
|
||||
default:copperblock
|
||||
|
||||
default:stone_with_tin
|
||||
default:tinblock
|
||||
|
||||
default:bronzeblock
|
||||
|
||||
default:stone_with_gold
|
||||
|
@ -140,8 +144,10 @@ default:dry_grass_5
|
|||
|
||||
default:bush_stem
|
||||
default:bush_leaves
|
||||
default:bush_sapling
|
||||
default:acacia_bush_stem
|
||||
default:acacia_bush_leaves
|
||||
default:acacia_bush_sapling
|
||||
|
||||
Corals
|
||||
------
|
||||
|
@ -457,7 +463,7 @@ minetest.register_node("default:dirt_with_snow", {
|
|||
tiles = {"default_snow.png", "default_dirt.png",
|
||||
{name = "default_dirt.png^default_snow_side.png",
|
||||
tileable_vertical = false}},
|
||||
groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1, snowy = 1},
|
||||
groups = {crumbly = 3, spreading_dirt_type = 1, snowy = 1},
|
||||
drop = 'default:dirt',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_snow_footstep", gain = 0.15},
|
||||
|
@ -1067,6 +1073,24 @@ minetest.register_node("default:copperblock", {
|
|||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("default:stone_with_tin", {
|
||||
description = "Tin Ore",
|
||||
tiles = {"default_stone.png^default_mineral_tin.png"},
|
||||
groups = {cracky = 2},
|
||||
drop = "default:tin_lump",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("default:tinblock", {
|
||||
description = "Tin Block",
|
||||
tiles = {"default_tin_block.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 1, level = 2},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("default:bronzeblock", {
|
||||
description = "Bronze Block",
|
||||
tiles = {"default_bronze_block.png"},
|
||||
|
@ -1202,7 +1226,7 @@ minetest.register_node("default:junglegrass", {
|
|||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1},
|
||||
groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
|
@ -1328,7 +1352,7 @@ minetest.register_node("default:bush_stem", {
|
|||
sounds = default.node_sound_wood_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.54, 7 / 16},
|
||||
fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -1339,11 +1363,53 @@ minetest.register_node("default:bush_leaves", {
|
|||
tiles = {"default_leaves_simple.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy = 3, flammable = 2, leaves = 1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {"default:bush_sapling"}, rarity = 5},
|
||||
{items = {"default:bush_leaves"}}
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
after_place_node = default.after_place_leaves,
|
||||
})
|
||||
|
||||
minetest.register_node("default:bush_sapling", {
|
||||
description = "Bush Sapling",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"default_bush_sapling.png"},
|
||||
inventory_image = "default_bush_sapling.png",
|
||||
wield_image = "default_bush_sapling.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
on_timer = default.grow_sapling,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16}
|
||||
},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
|
||||
attached_node = 1, sapling = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(math.random(1200, 2400))
|
||||
end,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
|
||||
"default:bush_sapling",
|
||||
-- minp, maxp to be checked, relative to sapling pos
|
||||
{x = -1, y = 0, z = -1},
|
||||
{x = 1, y = 1, z = 1},
|
||||
-- maximum interval of interior volume check
|
||||
2)
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("default:acacia_bush_stem", {
|
||||
description = "Acacia Bush Stem",
|
||||
drawtype = "plantlike",
|
||||
|
@ -1357,7 +1423,7 @@ minetest.register_node("default:acacia_bush_stem", {
|
|||
sounds = default.node_sound_wood_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.54, 7 / 16},
|
||||
fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -1368,11 +1434,53 @@ minetest.register_node("default:acacia_bush_leaves", {
|
|||
tiles = {"default_acacia_leaves_simple.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy = 3, flammable = 2, leaves = 1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {"default:acacia_bush_sapling"}, rarity = 5},
|
||||
{items = {"default:acacia_bush_leaves"}}
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
after_place_node = default.after_place_leaves,
|
||||
})
|
||||
|
||||
minetest.register_node("default:acacia_bush_sapling", {
|
||||
description = "Acacia Bush Sapling",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"default_acacia_bush_sapling.png"},
|
||||
inventory_image = "default_acacia_bush_sapling.png",
|
||||
wield_image = "default_acacia_bush_sapling.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
on_timer = default.grow_sapling,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 2 / 16, 3 / 16}
|
||||
},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
|
||||
attached_node = 1, sapling = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(math.random(1200, 2400))
|
||||
end,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
|
||||
"default:acacia_bush_sapling",
|
||||
-- minp, maxp to be checked, relative to sapling pos
|
||||
{x = -1, y = 0, z = -1},
|
||||
{x = 1, y = 1, z = 1},
|
||||
-- maximum interval of interior volume check
|
||||
2)
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Corals
|
||||
|
@ -1690,19 +1798,7 @@ minetest.register_node("default:lava_flowing", {
|
|||
-- Tools / "Advanced" crafting / Non-"natural"
|
||||
--
|
||||
|
||||
local chest_formspec =
|
||||
"size[8,9]" ..
|
||||
default.gui_bg ..
|
||||
default.gui_bg_img ..
|
||||
default.gui_slots ..
|
||||
"list[current_name;main;0,0.3;8,4;]" ..
|
||||
"list[current_player;main;0,4.85;8,1;]" ..
|
||||
"list[current_player;main;0,6.08;8,3;8]" ..
|
||||
"listring[current_name;main]" ..
|
||||
"listring[current_player;main]" ..
|
||||
default.get_hotbar_bg(0,4.85)
|
||||
|
||||
local function get_locked_chest_formspec(pos)
|
||||
local function get_chest_formspec(pos)
|
||||
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
|
||||
local formspec =
|
||||
"size[8,9]" ..
|
||||
|
@ -1715,162 +1811,287 @@ local function get_locked_chest_formspec(pos)
|
|||
"listring[nodemeta:" .. spos .. ";main]" ..
|
||||
"listring[current_player;main]" ..
|
||||
default.get_hotbar_bg(0,4.85)
|
||||
return formspec
|
||||
return formspec
|
||||
end
|
||||
|
||||
minetest.register_node("default:chest", {
|
||||
description = "Chest",
|
||||
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
|
||||
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||
legacy_facedir_simple = true,
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
local function chest_lid_obstructed(pos)
|
||||
local above = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||
local def = minetest.registered_nodes[minetest.get_node(above).name]
|
||||
-- allow ladders, signs, wallmounted things and torches to not obstruct
|
||||
if def.drawtype == "airlike" or
|
||||
def.drawtype == "signlike" or
|
||||
def.drawtype == "torchlike" or
|
||||
(def.drawtype == "nodebox" and def.paramtype2 == "wallmounted") then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", chest_formspec)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end,
|
||||
on_metadata_inventory_move = function(pos, from_list, from_index,
|
||||
local open_chests = {}
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "default:chest" then
|
||||
return
|
||||
end
|
||||
if not player or not fields.quit then
|
||||
return
|
||||
end
|
||||
local pn = player:get_player_name()
|
||||
|
||||
if not open_chests[pn] then
|
||||
return
|
||||
end
|
||||
|
||||
local pos = open_chests[pn].pos
|
||||
local sound = open_chests[pn].sound
|
||||
local swap = open_chests[pn].swap
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
open_chests[pn] = nil
|
||||
for k, v in pairs(open_chests) do
|
||||
if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
|
||||
return true
|
||||
end
|
||||
end
|
||||
minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
|
||||
param2 = node.param2 })
|
||||
minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
|
||||
return true
|
||||
end)
|
||||
|
||||
function default.register_chest(name, d)
|
||||
local def = table.copy(d)
|
||||
def.drawtype = "mesh"
|
||||
def.visual = "mesh"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.legacy_facedir_simple = true
|
||||
def.is_ground_content = false
|
||||
|
||||
if def.protected then
|
||||
def.on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Locked Chest")
|
||||
meta:set_string("owner", "")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
end
|
||||
def.after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
meta:set_string("infotext", "Locked Chest (owned by " ..
|
||||
meta:get_string("owner") .. ")")
|
||||
end
|
||||
def.can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main") and
|
||||
default.can_interact_with_node(player, pos)
|
||||
end
|
||||
def.allow_metadata_inventory_move = function(pos, from_list, from_index,
|
||||
to_list, to_index, count, player)
|
||||
if not default.can_interact_with_node(player, pos) then
|
||||
return 0
|
||||
end
|
||||
return count
|
||||
end
|
||||
def.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
if not default.can_interact_with_node(player, pos) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end
|
||||
def.allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
if not default.can_interact_with_node(player, pos) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end
|
||||
def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
if not default.can_interact_with_node(clicker, pos) then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.sound_play(def.sound_open, {gain = 0.3,
|
||||
pos = pos, max_hear_distance = 10})
|
||||
if not chest_lid_obstructed(pos) then
|
||||
minetest.swap_node(pos,
|
||||
{ name = "default:" .. name .. "_open",
|
||||
param2 = node.param2 })
|
||||
end
|
||||
minetest.after(0.2, minetest.show_formspec,
|
||||
clicker:get_player_name(),
|
||||
"default:chest", get_chest_formspec(pos))
|
||||
open_chests[clicker:get_player_name()] = { pos = pos,
|
||||
sound = def.sound_close, swap = name }
|
||||
end
|
||||
def.on_blast = function() end
|
||||
def.on_key_use = function(pos, player)
|
||||
local secret = minetest.get_meta(pos):get_string("key_lock_secret")
|
||||
local itemstack = player:get_wielded_item()
|
||||
local key_meta = itemstack:get_meta()
|
||||
|
||||
if key_meta:get_string("secret") == "" then
|
||||
key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
|
||||
itemstack:set_metadata("")
|
||||
end
|
||||
|
||||
if secret ~= key_meta:get_string("secret") then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.show_formspec(
|
||||
player:get_player_name(),
|
||||
"default:chest_locked",
|
||||
get_chest_formspec(pos)
|
||||
)
|
||||
end
|
||||
def.on_skeleton_key_use = function(pos, player, newsecret)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
local pn = player:get_player_name()
|
||||
|
||||
-- verify placer is owner of lockable chest
|
||||
if owner ~= pn then
|
||||
minetest.record_protection_violation(pos, pn)
|
||||
minetest.chat_send_player(pn, "You do not own this chest.")
|
||||
return nil
|
||||
end
|
||||
|
||||
local secret = meta:get_string("key_lock_secret")
|
||||
if secret == "" then
|
||||
secret = newsecret
|
||||
meta:set_string("key_lock_secret", secret)
|
||||
end
|
||||
|
||||
return secret, "a locked chest", owner
|
||||
end
|
||||
else
|
||||
def.on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Chest")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
end
|
||||
def.can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end
|
||||
def.on_rightclick = function(pos, node, clicker)
|
||||
minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
|
||||
max_hear_distance = 10})
|
||||
if not chest_lid_obstructed(pos) then
|
||||
minetest.swap_node(pos, {
|
||||
name = "default:" .. name .. "_open",
|
||||
param2 = node.param2 })
|
||||
end
|
||||
minetest.after(0.2, minetest.show_formspec,
|
||||
clicker:get_player_name(),
|
||||
"default:chest", get_chest_formspec(pos))
|
||||
open_chests[clicker:get_player_name()] = { pos = pos,
|
||||
sound = def.sound_close, swap = name }
|
||||
end
|
||||
end
|
||||
|
||||
def.on_metadata_inventory_move = function(pos, from_list, from_index,
|
||||
to_list, to_index, count, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves stuff in chest at " .. minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
end
|
||||
def.on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves " .. stack:get_name() ..
|
||||
" to chest at " .. minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
end
|
||||
def.on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" takes " .. stack:get_name() ..
|
||||
" from chest at " .. minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_blast = function(pos)
|
||||
end
|
||||
def.on_blast = function(pos)
|
||||
local drops = {}
|
||||
default.get_inventory_drops(pos, "main", drops)
|
||||
drops[#drops+1] = "default:chest"
|
||||
minetest.remove_node(pos)
|
||||
return drops
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("default:chest_locked", {
|
||||
description = "Locked Chest",
|
||||
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
|
||||
"default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||
legacy_facedir_simple = true,
|
||||
is_ground_content = false,
|
||||
local def_opened = table.copy(def)
|
||||
local def_closed = table.copy(def)
|
||||
|
||||
def_opened.mesh = "chest_open.obj"
|
||||
def_opened.drop = "default:" .. name
|
||||
def_opened.groups.not_in_creative_inventory = 1
|
||||
def_opened.selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
|
||||
}
|
||||
def_opened.can_dig = function()
|
||||
return false
|
||||
end
|
||||
|
||||
def_closed.mesh = nil
|
||||
def_closed.drawtype = nil
|
||||
def_closed.tiles[6] = def.tiles[5] -- swap textures around for "normal"
|
||||
def_closed.tiles[5] = def.tiles[3] -- drawtype to make them match the mesh
|
||||
def_closed.tiles[3] = def.tiles[3].."^[transformFX"
|
||||
|
||||
minetest.register_node("default:" .. name, def_closed)
|
||||
minetest.register_node("default:" .. name .. "_open", def_opened)
|
||||
|
||||
-- convert old chests to this new variant
|
||||
minetest.register_lbm({
|
||||
label = "update chests to opening chests",
|
||||
name = "default:upgrade_" .. name .. "_v2",
|
||||
nodenames = {"default:" .. name},
|
||||
action = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", nil)
|
||||
local inv = meta:get_inventory()
|
||||
local list = inv:get_list("default:chest")
|
||||
if list then
|
||||
inv:set_size("main", 8*4)
|
||||
inv:set_list("main", list)
|
||||
inv:set_list("default:chest", nil)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
default.register_chest("chest", {
|
||||
description = "Chest",
|
||||
tiles = {
|
||||
"default_chest_top.png",
|
||||
"default_chest_top.png",
|
||||
"default_chest_side.png",
|
||||
"default_chest_side.png",
|
||||
"default_chest_front.png",
|
||||
"default_chest_inside.png"
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
meta:set_string("infotext", "Locked Chest (owned by " ..
|
||||
meta:get_string("owner") .. ")")
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", "")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8 * 4)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main") and default.can_interact_with_node(player, pos)
|
||||
end,
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index,
|
||||
to_list, to_index, count, player)
|
||||
if not default.can_interact_with_node(player, pos) then
|
||||
return 0
|
||||
end
|
||||
return count
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
if not default.can_interact_with_node(player, pos) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
if not default.can_interact_with_node(player, pos) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves " .. stack:get_name() ..
|
||||
" to locked chest at " .. minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" takes " .. stack:get_name() ..
|
||||
" from locked chest at " .. minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
if default.can_interact_with_node(clicker, pos) then
|
||||
minetest.show_formspec(
|
||||
clicker:get_player_name(),
|
||||
"default:chest_locked",
|
||||
get_locked_chest_formspec(pos)
|
||||
)
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
on_blast = function() end,
|
||||
on_key_use = function(pos, player)
|
||||
local secret = minetest.get_meta(pos):get_string("key_lock_secret")
|
||||
local itemstack = player:get_wielded_item()
|
||||
local key_meta = itemstack:get_meta()
|
||||
|
||||
if key_meta:get_string("secret") == "" then
|
||||
key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
|
||||
end
|
||||
|
||||
if secret ~= key_meta:get_string("secret") then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.show_formspec(
|
||||
player:get_player_name(),
|
||||
"default:chest_locked",
|
||||
get_locked_chest_formspec(pos)
|
||||
)
|
||||
end,
|
||||
on_skeleton_key_use = function(pos, player, newsecret)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
local name = player:get_player_name()
|
||||
|
||||
-- verify placer is owner of lockable chest
|
||||
if owner ~= name then
|
||||
minetest.record_protection_violation(pos, name)
|
||||
minetest.chat_send_player(name, "You do not own this chest.")
|
||||
return nil
|
||||
end
|
||||
|
||||
local secret = meta:get_string("key_lock_secret")
|
||||
if secret == "" then
|
||||
secret = newsecret
|
||||
meta:set_string("key_lock_secret", secret)
|
||||
end
|
||||
|
||||
return secret, "a locked chest", owner
|
||||
end,
|
||||
sound_open = "default_chest_open",
|
||||
sound_close = "default_chest_close",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||
})
|
||||
|
||||
default.register_chest("chest_locked", {
|
||||
description = "Locked Chest",
|
||||
tiles = {
|
||||
"default_chest_top.png",
|
||||
"default_chest_top.png",
|
||||
"default_chest_side.png",
|
||||
"default_chest_side.png",
|
||||
"default_chest_lock.png",
|
||||
"default_chest_inside.png"
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
sound_open = "default_chest_open",
|
||||
sound_close = "default_chest_close",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||
protected = true,
|
||||
})
|
||||
|
||||
local bookshelf_formspec =
|
||||
"size[8,7;]" ..
|
||||
|
@ -2109,6 +2330,7 @@ minetest.register_node("default:glass", {
|
|||
drawtype = "glasslike_framed_optional",
|
||||
tiles = {"default_glass.png", "default_glass_detail.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "glasslikeliquidlevel",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, oddly_breakable_by_hand = 3},
|
||||
|
@ -2120,6 +2342,7 @@ minetest.register_node("default:obsidian_glass", {
|
|||
drawtype = "glasslike_framed_optional",
|
||||
tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "glasslikeliquidlevel",
|
||||
is_ground_content = false,
|
||||
sunlight_propagates = true,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
|
@ -2234,7 +2457,7 @@ default.register_leafdecay({
|
|||
default.register_leafdecay({
|
||||
trunks = {"default:aspen_tree"},
|
||||
leaves = {"default:aspen_leaves"},
|
||||
radius = 2,
|
||||
radius = 3,
|
||||
})
|
||||
|
||||
default.register_leafdecay({
|
||||
|
|
|
@ -95,10 +95,6 @@ minetest.register_on_joinplayer(function(player)
|
|||
default.player_set_model(player, "character.b3d")
|
||||
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
|
||||
-- set GUI
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
player:set_inventory_formspec(default.gui_survival_form)
|
||||
end
|
||||
player:hud_set_hotbar_image("gui_hotbar.png")
|
||||
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
|
||||
end)
|
||||
|
|
After Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 873 B |
After Width: | Height: | Size: 165 B |
After Width: | Height: | Size: 102 B |
Before Width: | Height: | Size: 422 B After Width: | Height: | Size: 423 B |
After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 522 B |
After Width: | Height: | Size: 274 B |
After Width: | Height: | Size: 198 B |
After Width: | Height: | Size: 166 B |
|
@ -379,57 +379,6 @@ minetest.register_tool("default:sword_diamond", {
|
|||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
|
||||
minetest.register_tool("default:skeleton_key", {
|
||||
description = "Skeleton Key",
|
||||
inventory_image = "default_key_skeleton.png",
|
||||
groups = {key = 1},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if def and def.on_rightclick and
|
||||
not (placer and placer:get_player_control().sneak) then
|
||||
return def.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
|
||||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local pos = pointed_thing.under
|
||||
node = minetest.get_node(pos)
|
||||
|
||||
if not node then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use
|
||||
if on_skeleton_key_use then
|
||||
-- make a new key secret in case the node callback needs it
|
||||
local random = math.random
|
||||
local newsecret = string.format(
|
||||
"%04x%04x%04x%04x",
|
||||
random(2^16) - 1, random(2^16) - 1,
|
||||
random(2^16) - 1, random(2^16) - 1)
|
||||
|
||||
local secret, _, _ = on_skeleton_key_use(pos, placer, newsecret)
|
||||
|
||||
if secret then
|
||||
-- finish and return the new key
|
||||
itemstack:take_item()
|
||||
itemstack:add_item("default:key")
|
||||
local meta = itemstack:get_meta()
|
||||
meta:set_string("secret", secret)
|
||||
meta:set_string("description", "Key to "..placer:get_player_name().."'s "
|
||||
..minetest.registered_nodes[node.name].description)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_tool("default:key", {
|
||||
description = "Key",
|
||||
inventory_image = "default_key.png",
|
||||
|
|
|
@ -77,6 +77,14 @@ function default.grow_sapling(pos)
|
|||
minetest.log("action", "An aspen sapling grows into a tree at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_new_aspen_tree(pos)
|
||||
elseif node.name == "default:bush_sapling" then
|
||||
minetest.log("action", "A bush sapling grows into a bush at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_bush(pos)
|
||||
elseif node.name == "default:acacia_bush_sapling" then
|
||||
minetest.log("action", "An acacia bush sapling grows into a bush at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_acacia_bush(pos)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -426,6 +434,29 @@ function default.grow_new_aspen_tree(pos)
|
|||
end
|
||||
|
||||
|
||||
-- Bushes do not need 'from sapling' schematic variants because
|
||||
-- only the stem node is force-placed in the schematic.
|
||||
|
||||
-- Bush
|
||||
|
||||
function default.grow_bush(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/bush.mts"
|
||||
minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
|
||||
path, "0", nil, false)
|
||||
end
|
||||
|
||||
|
||||
-- Acacia bush
|
||||
|
||||
function default.grow_acacia_bush(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/acacia_bush.mts"
|
||||
minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
|
||||
path, "0", nil, false)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Sapling 'on place' function to check protection of node and resulting tree volume
|
||||
--
|
||||
|
@ -457,19 +488,47 @@ function default.sapling_on_place(itemstack, placer, pointed_thing,
|
|||
return itemstack
|
||||
end
|
||||
-- Check tree volume for protection
|
||||
if not default.intersects_protection(
|
||||
if default.intersects_protection(
|
||||
vector.add(pos, minp_relative),
|
||||
vector.add(pos, maxp_relative),
|
||||
player_name,
|
||||
interval) then
|
||||
minetest.set_node(pos, {name = sapling_name})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
else
|
||||
minetest.record_protection_violation(pos, player_name)
|
||||
-- Print extra information to explain
|
||||
minetest.chat_send_player(player_name, "Tree will intersect protection")
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.log("action", player_name .. " places node "
|
||||
.. sapling_name .. " at " .. minetest.pos_to_string(pos))
|
||||
|
||||
local take_item = not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(player_name))
|
||||
local newnode = {name = sapling_name}
|
||||
local ndef = minetest.registered_nodes[sapling_name]
|
||||
minetest.set_node(pos, newnode)
|
||||
|
||||
-- Run callback
|
||||
if ndef and ndef.after_place_node then
|
||||
-- Deepcopy place_to and pointed_thing because callback can modify it
|
||||
if ndef.after_place_node(table.copy(pos), placer,
|
||||
itemstack, table.copy(pointed_thing)) then
|
||||
take_item = false
|
||||
end
|
||||
end
|
||||
|
||||
-- Run script hook
|
||||
for _, callback in ipairs(minetest.registered_on_placenodes) do
|
||||
-- Deepcopy pos, node and pointed_thing because callback can modify them
|
||||
if callback(table.copy(pos), table.copy(newnode),
|
||||
placer, table.copy(node or {}),
|
||||
itemstack, table.copy(pointed_thing)) then
|
||||
take_item = false
|
||||
end
|
||||
end
|
||||
|
||||
if take_item then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
return itemstack
|
||||
|
|
|
@ -6,6 +6,15 @@ local _doors = {}
|
|||
_doors.registered_doors = {}
|
||||
_doors.registered_trapdoors = {}
|
||||
|
||||
local function replace_old_owner_information(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("doors_owner")
|
||||
if owner and owner ~= "" then
|
||||
meta:set_string("owner", owner)
|
||||
meta:set_string("doors_owner", "")
|
||||
end
|
||||
end
|
||||
|
||||
-- returns an object to a door object or nil
|
||||
function doors.get(pos)
|
||||
local node_name = minetest.get_node(pos).name
|
||||
|
@ -82,7 +91,7 @@ minetest.register_node("doors:hidden", {
|
|||
on_blast = function() end,
|
||||
tiles = {"doors_blank.png"},
|
||||
-- 1px transparent block inside door hinge near node top.
|
||||
nodebox = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32},
|
||||
},
|
||||
|
@ -139,28 +148,10 @@ function _doors.door_toggle(pos, node, clicker)
|
|||
state = tonumber(state)
|
||||
end
|
||||
|
||||
if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then
|
||||
-- is player wielding the right key?
|
||||
local item = clicker:get_wielded_item()
|
||||
local owner = meta:get_string("doors_owner")
|
||||
if item:get_name() == "default:key" then
|
||||
local key_meta = item:get_meta()
|
||||
local secret = meta:get_string("key_lock_secret")
|
||||
replace_old_owner_information(pos)
|
||||
|
||||
if key_meta:get_string("secret") == "" then
|
||||
key_meta:set_string("secret", minetest.parse_json(item:get_metadata()).secret)
|
||||
item:set_metadata("")
|
||||
end
|
||||
|
||||
if secret ~= key_meta:get_string("secret") then
|
||||
return false
|
||||
end
|
||||
|
||||
elseif owner ~= "" then
|
||||
if clicker:get_player_name() ~= owner then
|
||||
return false
|
||||
end
|
||||
end
|
||||
if clicker and not default.can_interact_with_node(clicker, pos) then
|
||||
return false
|
||||
end
|
||||
|
||||
-- until Lua-5.2 we have no bitwise operators :(
|
||||
|
@ -211,11 +202,13 @@ local function on_place_node(place_to, newnode,
|
|||
end
|
||||
|
||||
local function can_dig_door(pos, digger)
|
||||
local digger_name = digger and digger:get_player_name()
|
||||
if digger_name and minetest.get_player_privs(digger_name).protection_bypass then
|
||||
replace_old_owner_information(pos)
|
||||
if default.can_interact_with_node(digger, pos) then
|
||||
return true
|
||||
else
|
||||
minetest.record_protection_violation(pos, digger:get_player_name())
|
||||
return false
|
||||
end
|
||||
return minetest.get_meta(pos):get_string("doors_owner") == digger_name
|
||||
end
|
||||
|
||||
function doors.register(name, def)
|
||||
|
@ -261,6 +254,7 @@ function doors.register(name, def)
|
|||
minetest.register_craftitem(":" .. name, {
|
||||
description = def.description,
|
||||
inventory_image = def.inventory_image,
|
||||
groups = table.copy(def.groups),
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos
|
||||
|
@ -330,14 +324,16 @@ function doors.register(name, def)
|
|||
meta:set_int("state", state)
|
||||
|
||||
if def.protected then
|
||||
meta:set_string("doors_owner", pn)
|
||||
meta:set_string("owner", pn)
|
||||
meta:set_string("infotext", "Owned by " .. pn)
|
||||
end
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
minetest.sound_play(def.sounds.place, {pos = pos})
|
||||
|
||||
on_place_node(pos, minetest.get_node(pos),
|
||||
placer, node, itemstack, pointed_thing)
|
||||
|
||||
|
@ -394,8 +390,9 @@ function doors.register(name, def)
|
|||
door:toggle(player)
|
||||
end
|
||||
def.on_skeleton_key_use = function(pos, player, newsecret)
|
||||
replace_old_owner_information(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("doors_owner")
|
||||
local owner = meta:get_string("owner")
|
||||
local pname = player:get_player_name()
|
||||
|
||||
-- verify placer is owner of lockable door
|
||||
|
@ -532,28 +529,11 @@ end
|
|||
|
||||
function _doors.trapdoor_toggle(pos, node, clicker)
|
||||
node = node or minetest.get_node(pos)
|
||||
if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then
|
||||
-- is player wielding the right key?
|
||||
local item = clicker:get_wielded_item()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("doors_owner")
|
||||
if item:get_name() == "default:key" then
|
||||
local key_meta = item:get_meta()
|
||||
local secret = meta:get_string("key_lock_secret")
|
||||
|
||||
if key_meta:get_string("secret") == "" then
|
||||
key_meta:set_string("secret", minetest.parse_json(item:get_metadata()).secret)
|
||||
end
|
||||
replace_old_owner_information(pos)
|
||||
|
||||
if secret ~= key_meta:get_string("secret") then
|
||||
return false
|
||||
end
|
||||
|
||||
elseif owner ~= "" then
|
||||
if clicker:get_player_name() ~= owner then
|
||||
return false
|
||||
end
|
||||
end
|
||||
if clicker and not default.can_interact_with_node(clicker, pos) then
|
||||
return false
|
||||
end
|
||||
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
|
@ -595,10 +575,10 @@ function doors.register_trapdoor(name, def)
|
|||
def.after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local pn = placer:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("doors_owner", pn)
|
||||
meta:set_string("owner", pn)
|
||||
meta:set_string("infotext", "Owned by "..pn)
|
||||
|
||||
return minetest.setting_getbool("creative_mode")
|
||||
return (creative and creative.is_enabled_for and creative.is_enabled_for(pn))
|
||||
end
|
||||
|
||||
def.on_blast = function() end
|
||||
|
@ -607,8 +587,9 @@ function doors.register_trapdoor(name, def)
|
|||
door:toggle(player)
|
||||
end
|
||||
def.on_skeleton_key_use = function(pos, player, newsecret)
|
||||
replace_old_owner_information(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("doors_owner")
|
||||
local owner = meta:get_string("owner")
|
||||
local pname = player:get_player_name()
|
||||
|
||||
-- verify placer is owner of lockable door
|
||||
|
|
|
@ -81,7 +81,6 @@ local dye_recipes = {
|
|||
{"yellow", "red", "orange"},
|
||||
{"yellow", "blue", "green"},
|
||||
-- RYB complementary mixes
|
||||
{"red", "green", "dark_grey"},
|
||||
{"yellow", "violet", "dark_grey"},
|
||||
{"blue", "orange", "dark_grey"},
|
||||
-- CMY mixes - approximation
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
Minetest Game mod: farming
|
||||
==========================
|
||||
See license.txt for license information.
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by PilzAdam (MIT)
|
||||
webdesigner97 (MIT)
|
||||
Various Minetest developers and contributors (MIT)
|
||||
|
||||
Authors of media (textures)
|
||||
---------------------------
|
||||
Created by PilzAdam (CC BY 3.0):
|
||||
farming_bread.png
|
||||
farming_soil.png
|
||||
farming_soil_wet.png
|
||||
farming_soil_wet_side.png
|
||||
farming_string.png
|
||||
|
||||
Created by BlockMen (CC BY 3.0):
|
||||
farming_tool_diamondhoe.png
|
||||
farming_tool_mesehoe.png
|
||||
farming_tool_bronzehoe.png
|
||||
farming_tool_steelhoe.png
|
||||
farming_tool_stonehoe.png
|
||||
farming_tool_woodhoe.png
|
||||
|
||||
Created by MasterGollum (CC BY 3.0):
|
||||
farming_straw.png
|
||||
|
||||
Created by Gambit (CC BY 3.0):
|
||||
farming_wheat.png
|
||||
farming_wheat_*.png
|
||||
farming_cotton_*.png
|
||||
farming_flour.png
|
||||
farming_cotton_seed.png
|
||||
farming_wheat_seed.png
|
|
@ -0,0 +1,404 @@
|
|||
|
||||
-- Wear out hoes, place soil
|
||||
-- TODO Ignore group:flower
|
||||
farming.registered_plants = {}
|
||||
|
||||
farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
|
||||
local pt = pointed_thing
|
||||
-- check if pointing at a node
|
||||
if not pt then
|
||||
return
|
||||
end
|
||||
if pt.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local under = minetest.get_node(pt.under)
|
||||
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
|
||||
local above = minetest.get_node(p)
|
||||
|
||||
-- return if any of the nodes is not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
if not minetest.registered_nodes[above.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if the node above the pointed thing is air
|
||||
if above.name ~= "air" then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if pointing at soil
|
||||
if minetest.get_item_group(under.name, "soil") ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if (wet) soil defined
|
||||
local regN = minetest.registered_nodes
|
||||
if regN[under.name].soil == nil or regN[under.name].soil.wet == nil or regN[under.name].soil.dry == nil then
|
||||
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 and play sound
|
||||
minetest.set_node(pt.under, {name = regN[under.name].soil.dry})
|
||||
minetest.sound_play("default_dig_crumbly", {
|
||||
pos = pt.under,
|
||||
gain = 0.5,
|
||||
})
|
||||
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(user:get_player_name())) then
|
||||
-- wear tool
|
||||
local wdef = itemstack:get_definition()
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
-- tool break sound
|
||||
if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then
|
||||
minetest.sound_play(wdef.sound.breaks, {pos = pt.above, gain = 0.5})
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Register new hoes
|
||||
farming.register_hoe = function(name, def)
|
||||
-- Check for : prefix (register new hoes in your mod's namespace)
|
||||
if name:sub(1,1) ~= ":" then
|
||||
name = ":" .. name
|
||||
end
|
||||
-- Check def table
|
||||
if def.description == nil then
|
||||
def.description = "Hoe"
|
||||
end
|
||||
if def.inventory_image == nil then
|
||||
def.inventory_image = "unknown_item.png"
|
||||
end
|
||||
if def.recipe == nil then
|
||||
def.recipe = {
|
||||
{"air","air",""},
|
||||
{"","group:stick",""},
|
||||
{"","group:stick",""}
|
||||
}
|
||||
end
|
||||
if def.max_uses == nil then
|
||||
def.max_uses = 30
|
||||
end
|
||||
-- Register the tool
|
||||
minetest.register_tool(name, {
|
||||
description = def.description,
|
||||
inventory_image = def.inventory_image,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, def.max_uses)
|
||||
end,
|
||||
groups = def.groups,
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
})
|
||||
-- Register its recipe
|
||||
if def.material == nil then
|
||||
minetest.register_craft({
|
||||
output = name:sub(2),
|
||||
recipe = def.recipe
|
||||
})
|
||||
else
|
||||
minetest.register_craft({
|
||||
output = name:sub(2),
|
||||
recipe = {
|
||||
{def.material, def.material, ""},
|
||||
{"", "group:stick", ""},
|
||||
{"", "group:stick", ""}
|
||||
}
|
||||
})
|
||||
-- Reverse Recipe
|
||||
minetest.register_craft({
|
||||
output = name:sub(2),
|
||||
recipe = {
|
||||
{"", def.material, def.material},
|
||||
{"", "group:stick", ""},
|
||||
{"", "group:stick", ""}
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- how often node timers for plants will tick, +/- some random value
|
||||
local function tick(pos)
|
||||
minetest.get_node_timer(pos):start(math.random(166, 286))
|
||||
end
|
||||
-- how often a growth failure tick is retried (e.g. too dark)
|
||||
local function tick_again(pos)
|
||||
minetest.get_node_timer(pos):start(math.random(40, 80))
|
||||
end
|
||||
|
||||
-- Seed placement
|
||||
farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
|
||||
local pt = pointed_thing
|
||||
-- check if pointing at a node
|
||||
if not pt then
|
||||
return itemstack
|
||||
end
|
||||
if pt.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
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 itemstack
|
||||
end
|
||||
if not minetest.registered_nodes[above.name] then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- check if pointing at the top of the node
|
||||
if pt.above.y ~= pt.under.y+1 then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- check if you can replace the node above the pointed node
|
||||
if not minetest.registered_nodes[above.name].buildable_to then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- check if pointing at soil
|
||||
if minetest.get_item_group(under.name, "soil") < 2 then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- add the node and remove 1 item from the itemstack
|
||||
minetest.add_node(pt.above, {name = plantname, param2 = 1})
|
||||
tick(pt.above)
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name())) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
farming.grow_plant = function(pos, elapsed)
|
||||
local node = minetest.get_node(pos)
|
||||
local name = node.name
|
||||
local def = minetest.registered_nodes[name]
|
||||
|
||||
if not def.next_plant then
|
||||
-- disable timer for fully grown plant
|
||||
return
|
||||
end
|
||||
|
||||
-- grow seed
|
||||
if minetest.get_item_group(node.name, "seed") and def.fertility then
|
||||
local soil_node = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
if not soil_node then
|
||||
tick_again(pos)
|
||||
return
|
||||
end
|
||||
-- omitted is a check for light, we assume seeds can germinate in the dark.
|
||||
for _, v in pairs(def.fertility) do
|
||||
if minetest.get_item_group(soil_node.name, v) ~= 0 then
|
||||
local placenode = {name = def.next_plant}
|
||||
if def.place_param2 then
|
||||
placenode.param2 = def.place_param2
|
||||
end
|
||||
minetest.swap_node(pos, placenode)
|
||||
if minetest.registered_nodes[def.next_plant].next_plant then
|
||||
tick(pos)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
-- check if on wet soil
|
||||
local below = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
if minetest.get_item_group(below.name, "soil") < 3 then
|
||||
tick_again(pos)
|
||||
return
|
||||
end
|
||||
|
||||
-- check light
|
||||
local light = minetest.get_node_light(pos)
|
||||
if not light or light < def.minlight or light > def.maxlight then
|
||||
tick_again(pos)
|
||||
return
|
||||
end
|
||||
|
||||
-- grow
|
||||
local placenode = {name = def.next_plant}
|
||||
if def.place_param2 then
|
||||
placenode.param2 = def.place_param2
|
||||
end
|
||||
minetest.swap_node(pos, placenode)
|
||||
|
||||
-- new timer needed?
|
||||
if minetest.registered_nodes[def.next_plant].next_plant then
|
||||
tick(pos)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
-- Register plants
|
||||
farming.register_plant = function(name, def)
|
||||
local mname = name:split(":")[1]
|
||||
local pname = name:split(":")[2]
|
||||
|
||||
-- Check def table
|
||||
if not def.description then
|
||||
def.description = "Seed"
|
||||
end
|
||||
if not def.inventory_image then
|
||||
def.inventory_image = "unknown_item.png"
|
||||
end
|
||||
if not def.steps then
|
||||
return nil
|
||||
end
|
||||
if not def.minlight then
|
||||
def.minlight = 1
|
||||
end
|
||||
if not def.maxlight then
|
||||
def.maxlight = 14
|
||||
end
|
||||
if not def.fertility then
|
||||
def.fertility = {}
|
||||
end
|
||||
|
||||
farming.registered_plants[pname] = def
|
||||
|
||||
-- Register seed
|
||||
local lbm_nodes = {mname .. ":seed_" .. pname}
|
||||
local g = {seed = 1, snappy = 3, attached_node = 1, flammable = 2}
|
||||
for k, v in pairs(def.fertility) do
|
||||
g[v] = 1
|
||||
end
|
||||
minetest.register_node(":" .. mname .. ":seed_" .. pname, {
|
||||
description = def.description,
|
||||
tiles = {def.inventory_image},
|
||||
inventory_image = def.inventory_image,
|
||||
wield_image = def.inventory_image,
|
||||
drawtype = "signlike",
|
||||
groups = g,
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
place_param2 = def.place_param2 or nil, -- this isn't actually used for placement
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
fertility = def.fertility,
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
dig = {name = "", gain = 0},
|
||||
dug = {name = "default_grass_footstep", gain = 0.2},
|
||||
place = {name = "default_place_node", gain = 0.25},
|
||||
}),
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local udef = minetest.registered_nodes[node.name]
|
||||
if udef and udef.on_rightclick and
|
||||
not (placer and placer:get_player_control().sneak) then
|
||||
return udef.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":seed_" .. pname)
|
||||
end,
|
||||
next_plant = mname .. ":" .. pname .. "_1",
|
||||
on_timer = farming.grow_plant,
|
||||
minlight = def.minlight,
|
||||
maxlight = def.maxlight,
|
||||
})
|
||||
|
||||
-- Register harvest
|
||||
minetest.register_craftitem(":" .. mname .. ":" .. pname, {
|
||||
description = pname:gsub("^%l", string.upper),
|
||||
inventory_image = mname .. "_" .. pname .. ".png",
|
||||
groups = {flammable = 2},
|
||||
})
|
||||
|
||||
-- Register growing steps
|
||||
for i = 1, def.steps do
|
||||
local base_rarity = 1
|
||||
if def.steps ~= 1 then
|
||||
base_rarity = 8 - (i - 1) * 7 / (def.steps - 1)
|
||||
end
|
||||
local drop = {
|
||||
items = {
|
||||
{items = {mname .. ":" .. pname}, rarity = base_rarity},
|
||||
{items = {mname .. ":" .. pname}, rarity = base_rarity * 2},
|
||||
{items = {mname .. ":seed_" .. pname}, rarity = base_rarity},
|
||||
{items = {mname .. ":seed_" .. pname}, rarity = base_rarity * 2},
|
||||
}
|
||||
}
|
||||
local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1}
|
||||
nodegroups[pname] = i
|
||||
|
||||
local next_plant = nil
|
||||
|
||||
if i < def.steps then
|
||||
next_plant = mname .. ":" .. pname .. "_" .. (i + 1)
|
||||
lbm_nodes[#lbm_nodes + 1] = mname .. ":" .. pname .. "_" .. i
|
||||
end
|
||||
|
||||
minetest.register_node(":" .. mname .. ":" .. pname .. "_" .. i, {
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
tiles = {mname .. "_" .. pname .. "_" .. i .. ".png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = def.paramtype2 or nil,
|
||||
place_param2 = def.place_param2 or nil,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = drop,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
groups = nodegroups,
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
next_plant = next_plant,
|
||||
on_timer = farming.grow_plant,
|
||||
minlight = def.minlight,
|
||||
maxlight = def.maxlight,
|
||||
})
|
||||
end
|
||||
|
||||
-- replacement LBM for pre-nodetimer plants
|
||||
minetest.register_lbm({
|
||||
name = ":" .. mname .. ":start_nodetimer_" .. pname,
|
||||
nodenames = lbm_nodes,
|
||||
action = function(pos, node)
|
||||
tick_again(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Return
|
||||
local r = {
|
||||
seed = mname .. ":seed_" .. pname,
|
||||
harvest = mname .. ":" .. pname
|
||||
}
|
||||
return r
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
default
|
||||
wool
|
|
@ -0,0 +1,42 @@
|
|||
farming.register_hoe(":farming:hoe_wood", {
|
||||
description = "Wooden Hoe",
|
||||
inventory_image = "farming_tool_woodhoe.png",
|
||||
max_uses = 30,
|
||||
material = "group:wood",
|
||||
groups = {flammable = 2},
|
||||
})
|
||||
|
||||
farming.register_hoe(":farming:hoe_stone", {
|
||||
description = "Stone Hoe",
|
||||
inventory_image = "farming_tool_stonehoe.png",
|
||||
max_uses = 90,
|
||||
material = "group:stone"
|
||||
})
|
||||
|
||||
farming.register_hoe(":farming:hoe_steel", {
|
||||
description = "Steel Hoe",
|
||||
inventory_image = "farming_tool_steelhoe.png",
|
||||
max_uses = 200,
|
||||
material = "default:steel_ingot"
|
||||
})
|
||||
|
||||
farming.register_hoe(":farming:hoe_bronze", {
|
||||
description = "Bronze Hoe",
|
||||
inventory_image = "farming_tool_bronzehoe.png",
|
||||
max_uses = 220,
|
||||
material = "default:bronze_ingot"
|
||||
})
|
||||
|
||||
farming.register_hoe(":farming:hoe_mese", {
|
||||
description = "Mese Hoe",
|
||||
inventory_image = "farming_tool_mesehoe.png",
|
||||
max_uses = 350,
|
||||
material = "default:mese_crystal"
|
||||
})
|
||||
|
||||
farming.register_hoe(":farming:hoe_diamond", {
|
||||
description = "Diamond Hoe",
|
||||
inventory_image = "farming_tool_diamondhoe.png",
|
||||
max_uses = 500,
|
||||
material = "default:diamond"
|
||||
})
|
|
@ -0,0 +1,109 @@
|
|||
-- Global farming namespace
|
||||
farming = {}
|
||||
farming.path = minetest.get_modpath("farming")
|
||||
|
||||
-- Load files
|
||||
dofile(farming.path .. "/api.lua")
|
||||
dofile(farming.path .. "/nodes.lua")
|
||||
dofile(farming.path .. "/hoes.lua")
|
||||
|
||||
-- WHEAT
|
||||
farming.register_plant("farming:wheat", {
|
||||
description = "Wheat seed",
|
||||
paramtype2 = "meshoptions",
|
||||
inventory_image = "farming_wheat_seed.png",
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
maxlight = default.LIGHT_MAX,
|
||||
fertility = {"grassland"},
|
||||
groups = {flammable = 4},
|
||||
place_param2 = 3,
|
||||
})
|
||||
minetest.register_craftitem("farming:flour", {
|
||||
description = "Flour",
|
||||
inventory_image = "farming_flour.png",
|
||||
groups = {flammable = 1},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:bread", {
|
||||
description = "Bread",
|
||||
inventory_image = "farming_bread.png",
|
||||
on_use = minetest.item_eat(5),
|
||||
groups = {flammable = 2},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:flour",
|
||||
recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 15,
|
||||
output = "farming:bread",
|
||||
recipe = "farming:flour"
|
||||
})
|
||||
|
||||
-- Cotton
|
||||
farming.register_plant("farming:cotton", {
|
||||
description = "Cotton seed",
|
||||
inventory_image = "farming_cotton_seed.png",
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
maxlight = default.LIGHT_MAX,
|
||||
fertility = {"grassland", "desert"},
|
||||
groups = {flammable = 4},
|
||||
})
|
||||
|
||||
minetest.register_alias("farming:string", "farming:cotton")
|
||||
|
||||
minetest.register_craft({
|
||||
output = "wool:white",
|
||||
recipe = {
|
||||
{"farming:cotton", "farming:cotton"},
|
||||
{"farming:cotton", "farming:cotton"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Straw
|
||||
minetest.register_craft({
|
||||
output = "farming:straw 3",
|
||||
recipe = {
|
||||
{"farming:wheat", "farming:wheat", "farming:wheat"},
|
||||
{"farming:wheat", "farming:wheat", "farming:wheat"},
|
||||
{"farming:wheat", "farming:wheat", "farming:wheat"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:wheat 3",
|
||||
recipe = {
|
||||
{"farming:straw"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Fuels
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:straw",
|
||||
burntime = 3,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:wheat",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:cotton",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:hoe_wood",
|
||||
burntime = 5,
|
||||
})
|
|
@ -0,0 +1,61 @@
|
|||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2012-2016 PilzAdam
|
||||
Copyright (C) 2014-2016 webdesigner97
|
||||
Copyright (C) 2012-2016 Various Minetest developers and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software
|
||||
without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more details:
|
||||
https://opensource.org/licenses/MIT
|
||||
|
||||
|
||||
License of media (textures)
|
||||
---------------------------
|
||||
|
||||
Attribution 3.0 Unported (CC BY 3.0)
|
||||
Copyright (C) 2012-2016 PilzAdam
|
||||
Copyright (C) 2014-2016 BlockMen
|
||||
Copyright (C) 2015-2016 MasterGollum
|
||||
Copyright (C) 2015-2016 Gambit
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by/3.0/
|
|
@ -0,0 +1,171 @@
|
|||
minetest.override_item("default:dirt", {
|
||||
soil = {
|
||||
base = "default:dirt",
|
||||
dry = "farming:soil",
|
||||
wet = "farming:soil_wet"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.override_item("default:dirt_with_grass", {
|
||||
soil = {
|
||||
base = "default:dirt_with_grass",
|
||||
dry = "farming:soil",
|
||||
wet = "farming:soil_wet"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.override_item("default:dirt_with_dry_grass", {
|
||||
soil = {
|
||||
base = "default:dirt_with_dry_grass",
|
||||
dry = "farming:soil",
|
||||
wet = "farming:soil_wet"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.override_item("default:dirt_with_rainforest_litter", {
|
||||
soil = {
|
||||
base = "default:dirt_with_rainforest_litter",
|
||||
dry = "farming:soil",
|
||||
wet = "farming:soil_wet"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("farming:soil", {
|
||||
description = "Soil",
|
||||
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
|
||||
drop = "default:dirt",
|
||||
groups = {crumbly=3, not_in_creative_inventory=1, soil=2, grassland = 1, field = 1},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
soil = {
|
||||
base = "default:dirt",
|
||||
dry = "farming:soil",
|
||||
wet = "farming:soil_wet"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("farming:soil_wet", {
|
||||
description = "Wet Soil",
|
||||
tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"},
|
||||
drop = "default:dirt",
|
||||
groups = {crumbly=3, not_in_creative_inventory=1, soil=3, wet = 1, grassland = 1, field = 1},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
soil = {
|
||||
base = "default:dirt",
|
||||
dry = "farming:soil",
|
||||
wet = "farming:soil_wet"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.override_item("default:desert_sand", {
|
||||
groups = {crumbly=3, falling_node=1, sand=1, soil = 1},
|
||||
soil = {
|
||||
base = "default:desert_sand",
|
||||
dry = "farming:desert_sand_soil",
|
||||
wet = "farming:desert_sand_soil_wet"
|
||||
}
|
||||
})
|
||||
minetest.register_node("farming:desert_sand_soil", {
|
||||
description = "Desert Sand Soil",
|
||||
drop = "default:desert_sand",
|
||||
tiles = {"farming_desert_sand_soil.png", "default_desert_sand.png"},
|
||||
groups = {crumbly=3, not_in_creative_inventory = 1, falling_node=1, sand=1, soil = 2, desert = 1, field = 1},
|
||||
sounds = default.node_sound_sand_defaults(),
|
||||
soil = {
|
||||
base = "default:desert_sand",
|
||||
dry = "farming:desert_sand_soil",
|
||||
wet = "farming:desert_sand_soil_wet"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("farming:desert_sand_soil_wet", {
|
||||
description = "Wet Desert Sand Soil",
|
||||
drop = "default:desert_sand",
|
||||
tiles = {"farming_desert_sand_soil_wet.png", "farming_desert_sand_soil_wet_side.png"},
|
||||
groups = {crumbly=3, falling_node=1, sand=1, not_in_creative_inventory=1, soil=3, wet = 1, desert = 1, field = 1},
|
||||
sounds = default.node_sound_sand_defaults(),
|
||||
soil = {
|
||||
base = "default:desert_sand",
|
||||
dry = "farming:desert_sand_soil",
|
||||
wet = "farming:desert_sand_soil_wet"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("farming:straw", {
|
||||
description = "Straw",
|
||||
tiles = {"farming_straw.png"},
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, flammable=4, fall_damage_add_percent=-30},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Farming soil",
|
||||
nodenames = {"group:field"},
|
||||
interval = 15,
|
||||
chance = 4,
|
||||
action = function(pos, node)
|
||||
local n_def = minetest.registered_nodes[node.name] or nil
|
||||
local wet = n_def.soil.wet or nil
|
||||
local base = n_def.soil.base or nil
|
||||
local dry = n_def.soil.dry or nil
|
||||
if not n_def or not n_def.soil or not wet or not base or not dry then
|
||||
return
|
||||
end
|
||||
|
||||
pos.y = pos.y + 1
|
||||
local nn = minetest.get_node_or_nil(pos)
|
||||
if not nn or not nn.name then
|
||||
return
|
||||
end
|
||||
local nn_def = minetest.registered_nodes[nn.name] or nil
|
||||
pos.y = pos.y - 1
|
||||
|
||||
if nn_def and nn_def.walkable and minetest.get_item_group(nn.name, "plant") == 0 then
|
||||
minetest.set_node(pos, {name = base})
|
||||
return
|
||||
end
|
||||
-- check if there is water nearby
|
||||
local wet_lvl = minetest.get_item_group(node.name, "wet")
|
||||
if minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||
-- if it is dry soil and not base node, turn it into wet soil
|
||||
if wet_lvl == 0 then
|
||||
minetest.set_node(pos, {name = wet})
|
||||
end
|
||||
else
|
||||
-- only turn back if there are no unloaded blocks (and therefore
|
||||
-- possible water sources) nearby
|
||||
if not minetest.find_node_near(pos, 3, {"ignore"}) then
|
||||
-- turn it back into base if it is already dry
|
||||
if wet_lvl == 0 then
|
||||
-- only turn it back if there is no plant/seed on top of it
|
||||
if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then
|
||||
minetest.set_node(pos, {name = base})
|
||||
end
|
||||
|
||||
-- if its wet turn it back into dry soil
|
||||
elseif wet_lvl == 1 then
|
||||
minetest.set_node(pos, {name = dry})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
for i = 1, 5 do
|
||||
minetest.override_item("default:grass_"..i, {drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {'farming:seed_wheat'},rarity = 5},
|
||||
{items = {'default:grass_1'}},
|
||||
}
|
||||
}})
|
||||
end
|
||||
|
||||
minetest.override_item("default:junglegrass", {drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {'farming:seed_cotton'},rarity = 8},
|
||||
{items = {'default:junglegrass'}},
|
||||
}
|
||||
}})
|
After Width: | Height: | Size: 393 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 110 B |
After Width: | Height: | Size: 120 B |
After Width: | Height: | Size: 144 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 159 B |
After Width: | Height: | Size: 164 B |
After Width: | Height: | Size: 170 B |
After Width: | Height: | Size: 196 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 467 B |
After Width: | Height: | Size: 351 B |
After Width: | Height: | Size: 272 B |
After Width: | Height: | Size: 159 B |
After Width: | Height: | Size: 706 B |
After Width: | Height: | Size: 677 B |
After Width: | Height: | Size: 96 B |
After Width: | Height: | Size: 887 B |
After Width: | Height: | Size: 212 B |
After Width: | Height: | Size: 183 B |
After Width: | Height: | Size: 181 B |
After Width: | Height: | Size: 181 B |
After Width: | Height: | Size: 185 B |
After Width: | Height: | Size: 171 B |
After Width: | Height: | Size: 241 B |
After Width: | Height: | Size: 120 B |
After Width: | Height: | Size: 142 B |
After Width: | Height: | Size: 172 B |
After Width: | Height: | Size: 191 B |
After Width: | Height: | Size: 218 B |
After Width: | Height: | Size: 234 B |
After Width: | Height: | Size: 253 B |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 141 B |
|
@ -85,13 +85,13 @@ minetest.register_tool("fire:flint_and_steel", {
|
|||
"fire_flint_and_steel",
|
||||
{pos = sound_pos, gain = 0.5, max_hear_distance = 8}
|
||||
)
|
||||
local player_name = user:get_player_name()
|
||||
if pointed_thing.type == "node" then
|
||||
local node_under = minetest.get_node(pointed_thing.under).name
|
||||
local nodedef = minetest.registered_nodes[node_under]
|
||||
if not nodedef then
|
||||
return
|
||||
end
|
||||
local player_name = user:get_player_name()
|
||||
if minetest.is_protected(pointed_thing.under, player_name) then
|
||||
minetest.chat_send_player(player_name, "This area is protected")
|
||||
return
|
||||
|
@ -103,7 +103,8 @@ minetest.register_tool("fire:flint_and_steel", {
|
|||
minetest.set_node(pointed_thing.above, {name = "fire:basic_flame"})
|
||||
end
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(player_name)) then
|
||||
-- Wear tool
|
||||
local wdef = itemstack:get_definition()
|
||||
itemstack:add_wear(1000)
|
||||
|
@ -291,9 +292,14 @@ minetest.register_abm({
|
|||
|
||||
local fire_enabled = minetest.setting_getbool("enable_fire")
|
||||
if fire_enabled == nil then
|
||||
-- New setting not specified, check for old setting.
|
||||
-- If old setting is also not specified, 'not nil' is true.
|
||||
fire_enabled = not minetest.setting_getbool("disable_fire")
|
||||
-- enable_fire setting not specified, check for disable_fire
|
||||
local fire_disabled = minetest.setting_getbool("disable_fire")
|
||||
if fire_disabled == nil then
|
||||
-- Neither setting specified, check whether singleplayer
|
||||
fire_enabled = minetest.is_singleplayer()
|
||||
else
|
||||
fire_enabled = not fire_disabled
|
||||
end
|
||||
end
|
||||
|
||||
if not fire_enabled then
|
||||
|
|
|
@ -107,11 +107,16 @@ function flowers.flower_spread(pos, node)
|
|||
pos.y = pos.y - 1
|
||||
local under = minetest.get_node(pos)
|
||||
pos.y = pos.y + 1
|
||||
if under.name == "default:desert_sand" then
|
||||
-- Replace flora with dry shrub in desert sand and silver sand,
|
||||
-- as this is the only way to generate them.
|
||||
-- However, preserve grasses in sand dune biomes.
|
||||
if minetest.get_item_group(under.name, "sand") == 1 and
|
||||
under.name ~= "default:sand" then
|
||||
minetest.set_node(pos, {name = "default:dry_shrub"})
|
||||
return
|
||||
elseif under.name ~= "default:dirt_with_grass" and
|
||||
under.name ~= "default:dirt_with_dry_grass" then
|
||||
end
|
||||
|
||||
if minetest.get_item_group(under.name, "soil") == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -126,24 +131,26 @@ function flowers.flower_spread(pos, node)
|
|||
return
|
||||
end
|
||||
|
||||
local seedling = minetest.find_nodes_in_area_under_air(pos0, pos1,
|
||||
{"default:dirt_with_grass", "default:dirt_with_dry_grass"})
|
||||
if #seedling > 0 then
|
||||
seedling = seedling[math.random(#seedling)]
|
||||
seedling.y = seedling.y + 1
|
||||
light = minetest.get_node_light(seedling)
|
||||
if not light or light < 13 then
|
||||
local soils = minetest.find_nodes_in_area_under_air(
|
||||
pos0, pos1, "group:soil")
|
||||
if #soils > 0 then
|
||||
local seedling = soils[math.random(#soils)]
|
||||
local seedling_above =
|
||||
{x = seedling.x, y = seedling.y + 1, z = seedling.z}
|
||||
light = minetest.get_node_light(seedling_above)
|
||||
if not light or light < 13 or
|
||||
-- Desert sand is in the soil group
|
||||
minetest.get_node(seedling).name == "default:desert_sand" then
|
||||
return
|
||||
end
|
||||
minetest.set_node(seedling, {name = node.name})
|
||||
|
||||
minetest.set_node(seedling_above, {name = node.name})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Flower spread",
|
||||
nodenames = {"group:flora"},
|
||||
neighbors = {"default:dirt_with_grass", "default:dirt_with_dry_grass",
|
||||
"default:desert_sand"},
|
||||
interval = 13,
|
||||
chance = 96,
|
||||
action = function(...)
|
||||
|
@ -282,7 +289,8 @@ minetest.register_node("flowers:waterlily", {
|
|||
if not minetest.is_protected(pos, player_name) then
|
||||
minetest.set_node(pos, {name = "flowers:waterlily",
|
||||
param2 = math.random(0, 3)})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(player_name)) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
else
|
||||
|
|
|
@ -94,7 +94,8 @@ local function register_flower(seed, name)
|
|||
octaves = 3,
|
||||
persist = 0.6
|
||||
},
|
||||
biomes = {"grassland", "deciduous_forest", "coniferous_forest"},
|
||||
biomes = {"grassland", "deciduous_forest", "coniferous_forest",
|
||||
"floatland_grassland", "floatland_coniferous_forest"},
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
decoration = "flowers:"..name,
|
||||
|
@ -114,7 +115,8 @@ local function register_mushroom(name)
|
|||
octaves = 3,
|
||||
persist = 0.66
|
||||
},
|
||||
biomes = {"deciduous_forest", "coniferous_forest"},
|
||||
biomes = {"deciduous_forest", "coniferous_forest",
|
||||
"floatland_coniferous_forest"},
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
decoration = "flowers:"..name,
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
Minetest Game mod: nyancat
|
||||
==========================
|
||||
See license.txt for license information.
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
|
||||
Various Minetest developers and contributors (LGPL 2.1)
|
||||
|
||||
Authors of media files
|
||||
----------------------
|
||||
VanessaE (CC BY-SA 3.0):
|
||||
nyancat_front.png
|
||||
nyancat_back.png
|
||||
nyancat_side.png
|
||||
nyancat_rainbow.png
|
|
@ -1,92 +0,0 @@
|
|||
minetest.register_node("nyancat:nyancat", {
|
||||
description = "Nyan Cat",
|
||||
tiles = {"nyancat_side.png", "nyancat_side.png", "nyancat_side.png",
|
||||
"nyancat_side.png", "nyancat_back.png", "nyancat_front.png"},
|
||||
paramtype = "light",
|
||||
light_source = default.LIGHT_MAX,
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2},
|
||||
is_ground_content = false,
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("nyancat:nyancat_rainbow", {
|
||||
description = "Nyan Cat Rainbow",
|
||||
tiles = {
|
||||
"nyancat_rainbow.png^[transformR90",
|
||||
"nyancat_rainbow.png^[transformR90",
|
||||
"nyancat_rainbow.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
light_source = default.LIGHT_MAX,
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "nyancat:nyancat",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "nyancat:nyancat_rainbow",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
nyancat = {}
|
||||
|
||||
function nyancat.place(pos, facedir, length)
|
||||
if facedir > 3 then
|
||||
facedir = 0
|
||||
end
|
||||
local tailvec = minetest.facedir_to_dir(facedir)
|
||||
local p = {x = pos.x, y = pos.y, z = pos.z}
|
||||
minetest.set_node(p, {name = "nyancat:nyancat", param2 = facedir})
|
||||
for i = 1, length do
|
||||
p.x = p.x + tailvec.x
|
||||
p.z = p.z + tailvec.z
|
||||
minetest.set_node(p, {name = "nyancat:nyancat_rainbow", param2 = facedir})
|
||||
end
|
||||
end
|
||||
|
||||
function nyancat.generate(minp, maxp, seed)
|
||||
local height_min = -31000
|
||||
local height_max = -32
|
||||
if maxp.y < height_min or minp.y > height_max then
|
||||
return
|
||||
end
|
||||
local y_min = math.max(minp.y, height_min)
|
||||
local y_max = math.min(maxp.y, height_max)
|
||||
local volume = (maxp.x - minp.x + 1) * (y_max - y_min + 1) * (maxp.z - minp.z + 1)
|
||||
local pr = PseudoRandom(seed + 9324342)
|
||||
local max_num_nyancats = math.floor(volume / (16 * 16 * 16))
|
||||
for i = 1, max_num_nyancats do
|
||||
if pr:next(0, 1000) == 0 then
|
||||
local x0 = pr:next(minp.x, maxp.x)
|
||||
local y0 = pr:next(minp.y, maxp.y)
|
||||
local z0 = pr:next(minp.z, maxp.z)
|
||||
local p0 = {x = x0, y = y0, z = z0}
|
||||
nyancat.place(p0, pr:next(0, 3), pr:next(3, 15))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
nyancat.generate(minp, maxp, seed)
|
||||
end)
|
||||
|
||||
-- Legacy
|
||||
minetest.register_alias("default:nyancat", "nyancat:nyancat")
|
||||
minetest.register_alias("default:nyancat_rainbow", "nyancat:nyancat_rainbow")
|
||||
minetest.register_alias("nyancat", "nyancat:nyancat")
|
||||
minetest.register_alias("nyancat_rainbow", "nyancat:nyancat_rainbow")
|
||||
minetest.register_alias("default:nyancat_rainbow_doublepanel", "nyancat:nyancat_rainbow_doublepanel")
|
||||
minetest.register_alias("default:nyancat_rainbow_outerstair", "nyancat:nyancat_rainbow_outerstair")
|
||||
|
||||
default.make_nyancat = nyancat.place
|
||||
default.generate_nyancats = nyancat.generate
|
Before Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 148 B |
|
@ -93,47 +93,48 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
|
|||
|
||||
local node = minetest.get_node(pos)
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
if not ndef then
|
||||
return itemstack
|
||||
end
|
||||
-- can we rotate this paramtype2?
|
||||
local fn = screwdriver.rotate[ndef.paramtype2]
|
||||
if not fn then
|
||||
return
|
||||
if not fn and not ndef.on_rotate then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local should_rotate = true
|
||||
local new_param2 = fn(pos, node, mode)
|
||||
local new_param2
|
||||
if fn then
|
||||
new_param2 = fn(pos, node, mode)
|
||||
else
|
||||
new_param2 = node.param2
|
||||
end
|
||||
|
||||
-- Node provides a handler, so let the handler decide instead if the node can be rotated
|
||||
if ndef and ndef.on_rotate then
|
||||
if ndef.on_rotate then
|
||||
-- Copy pos and node because callback can modify it
|
||||
local result = ndef.on_rotate(vector.new(pos),
|
||||
{name = node.name, param1 = node.param1, param2 = node.param2},
|
||||
user, mode, new_param2)
|
||||
if result == false then -- Disallow rotation
|
||||
return
|
||||
return itemstack
|
||||
elseif result == true then
|
||||
should_rotate = false
|
||||
end
|
||||
else
|
||||
if not ndef or
|
||||
ndef.on_rotate == false or
|
||||
(ndef.drawtype == "nodebox" and
|
||||
(ndef.node_box and ndef.node_box.type ~= "fixed")) or
|
||||
node.param2 == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if ndef.can_dig and not ndef.can_dig(pos, user) then
|
||||
return
|
||||
end
|
||||
elseif ndef.on_rotate == false then
|
||||
return itemstack
|
||||
elseif ndef.can_dig and not ndef.can_dig(pos, user) then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if should_rotate then
|
||||
if should_rotate and new_param2 ~= node.param2 then
|
||||
node.param2 = new_param2
|
||||
minetest.swap_node(pos, node)
|
||||
minetest.check_for_falling(pos)
|
||||
end
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(user:get_player_name())) then
|
||||
itemstack:add_wear(65535 / ((uses or 200) - 1))
|
||||
end
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ local homes_file = minetest.get_worldpath() .. "/homes"
|
|||
local homepos = {}
|
||||
|
||||
local function loadhomes()
|
||||
local input, err = io.open(homes_file, "r")
|
||||
local input = io.open(homes_file, "r")
|
||||
if not input then
|
||||
return minetest.log("info", "Could not load player homes file: " .. err)
|
||||
return -- no longer an error
|
||||
end
|
||||
|
||||
-- Iterate over all stored positions in the format "x y z player" for each line
|
||||
|
@ -24,11 +24,13 @@ sethome.set = function(name, pos)
|
|||
if not player or not pos then
|
||||
return false
|
||||
end
|
||||
player:set_attribute("sethome:home", minetest.pos_to_string(pos))
|
||||
|
||||
-- remove `name` from the old storage file
|
||||
local data = {}
|
||||
local output, err = io.open(homes_file, "w")
|
||||
local output = io.open(homes_file, "w")
|
||||
if output then
|
||||
homepos[name] = pos
|
||||
homepos[name] = nil
|
||||
for i, v in pairs(homepos) do
|
||||
table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, i))
|
||||
end
|
||||
|
@ -36,12 +38,18 @@ sethome.set = function(name, pos)
|
|||
io.close(output)
|
||||
return true
|
||||
end
|
||||
minetest.log("action", "Unable to write to player homes file: " .. err)
|
||||
return false
|
||||
return true -- if the file doesn't exist - don't return an error.
|
||||
end
|
||||
|
||||
sethome.get = function(name)
|
||||
local pos = homepos[name]
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local pos = minetest.string_to_pos(player:get_attribute("sethome:home"))
|
||||
if pos then
|
||||
return pos
|
||||
end
|
||||
|
||||
-- fetch old entry from storage table
|
||||
pos = homepos[name]
|
||||
if pos then
|
||||
return vector.new(pos)
|
||||
else
|
||||
|
@ -50,9 +58,10 @@ sethome.get = function(name)
|
|||
end
|
||||
|
||||
sethome.go = function(name)
|
||||
local pos = sethome.get(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player and homepos[name] then
|
||||
player:setpos(homepos[name])
|
||||
if player and pos then
|
||||
player:setpos(pos)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
|
|
@ -129,9 +129,7 @@ end
|
|||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
if sfinv.enabled then
|
||||
minetest.after(0.5, function()
|
||||
sfinv.set_player_inventory_formspec(player)
|
||||
end)
|
||||
sfinv.set_player_inventory_formspec(player)
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
|
@ -20,6 +20,30 @@ minetest.register_alias("moretrees:slab_acacia_planks", "stairs:slab_acacia_wood
|
|||
|
||||
local replace = minetest.setting_getbool("enable_stairs_replace_abm")
|
||||
|
||||
local function rotate_and_place(itemstack, placer, pointed_thing)
|
||||
local p0 = pointed_thing.under
|
||||
local p1 = pointed_thing.above
|
||||
local param2 = 0
|
||||
|
||||
local placer_pos = placer:getpos()
|
||||
if placer_pos then
|
||||
param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
|
||||
end
|
||||
|
||||
local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
|
||||
local fpos = finepos.y % 1
|
||||
|
||||
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
|
||||
or (fpos < -0.5 and fpos > -0.999999999) then
|
||||
param2 = param2 + 20
|
||||
if param2 == 21 then
|
||||
param2 = 23
|
||||
elseif param2 == 23 then
|
||||
param2 = 21
|
||||
end
|
||||
end
|
||||
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||
end
|
||||
|
||||
-- Register stairs.
|
||||
-- Node will be called stairs:stair_<subname>
|
||||
|
@ -55,30 +79,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
|||
return itemstack
|
||||
end
|
||||
|
||||
local p0 = pointed_thing.under
|
||||
local p1 = pointed_thing.above
|
||||
local param2 = 0
|
||||
|
||||
local placer_pos = placer:getpos()
|
||||
if placer_pos then
|
||||
local dir = {
|
||||
x = p1.x - placer_pos.x,
|
||||
y = p1.y - placer_pos.y,
|
||||
z = p1.z - placer_pos.z
|
||||
}
|
||||
param2 = minetest.dir_to_facedir(dir)
|
||||
end
|
||||
|
||||
if p0.y - 1 == p1.y then
|
||||
param2 = param2 + 20
|
||||
if param2 == 21 then
|
||||
param2 = 23
|
||||
elseif param2 == 23 then
|
||||
param2 = 21
|
||||
end
|
||||
end
|
||||
|
||||
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||
return rotate_and_place(itemstack, placer, pointed_thing)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -129,8 +130,6 @@ end
|
|||
|
||||
-- Slab facedir to placement 6d matching table
|
||||
local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4}
|
||||
-- Slab facedir when placing initial slab against other surface
|
||||
local slab_trans_dir_place = {[0] = 0, 20, 12, 16, 4, 8}
|
||||
|
||||
-- Register slabs.
|
||||
-- Node will be called stairs:slab_<subname>
|
||||
|
@ -153,8 +152,10 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
|||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = minetest.get_node(pointed_thing.under)
|
||||
local wield_item = itemstack:get_name()
|
||||
local creative_enabled = (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name()))
|
||||
|
||||
if under and wield_item == under.name then
|
||||
if under and under.name:find("stairs:slab_") then
|
||||
-- place slab using under node orientation
|
||||
local dir = minetest.dir_to_facedir(vector.subtract(
|
||||
pointed_thing.above, pointed_thing.under), true)
|
||||
|
@ -162,7 +163,9 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
|||
local p2 = under.param2
|
||||
|
||||
-- combine two slabs if possible
|
||||
if slab_trans_dir[math.floor(p2 / 4)] == dir then
|
||||
if slab_trans_dir[math.floor(p2 / 4)] == dir
|
||||
and wield_item == under.name then
|
||||
|
||||
if not recipeitem then
|
||||
return itemstack
|
||||
end
|
||||
|
@ -174,7 +177,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
|||
return
|
||||
end
|
||||
minetest.set_node(pointed_thing.under, {name = recipeitem, param2 = p2})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not creative_enabled then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
@ -190,21 +193,12 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
|||
|
||||
-- else attempt to place node with proper param2
|
||||
minetest.item_place_node(ItemStack(wield_item), placer, pointed_thing, p2)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not creative_enabled then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
else
|
||||
-- place slab using look direction of player
|
||||
local dir = minetest.dir_to_wallmounted(vector.subtract(
|
||||
pointed_thing.above, pointed_thing.under), true)
|
||||
|
||||
local rot = slab_trans_dir_place[dir]
|
||||
if rot == 0 or rot == 20 then
|
||||
rot = rot + minetest.dir_to_facedir(placer:get_look_dir())
|
||||
end
|
||||
|
||||
return minetest.item_place(itemstack, placer, pointed_thing, rot)
|
||||
return rotate_and_place(itemstack, placer, pointed_thing)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
@ -596,3 +590,27 @@ stairs.register_stair_and_slab(
|
|||
"Gold Block Slab",
|
||||
default.node_sound_metal_defaults()
|
||||
)
|
||||
|
||||
stairs.register_stair_and_slab(
|
||||
"ice",
|
||||
"default:ice",
|
||||
{cracky = 3, puts_out_fire = 1, cools_lava = 1},
|
||||
{"default_ice.png"},
|
||||
"Ice Stair",
|
||||
"Ice Slab",
|
||||
default.node_sound_glass_defaults()
|
||||
)
|
||||
|
||||
stairs.register_stair_and_slab(
|
||||
"snowblock",
|
||||
"default:snowblock",
|
||||
{crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1},
|
||||
{"default_snow.png"},
|
||||
"Snow Block Stair",
|
||||
"Snow Block Slab",
|
||||
default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_snow_footstep", gain = 0.15},
|
||||
dug = {name = "default_snow_footstep", gain = 0.2},
|
||||
dig = {name = "default_snow_footstep", gain = 0.2}
|
||||
})
|
||||
)
|
||||
|
|
|
@ -245,13 +245,15 @@ end
|
|||
|
||||
function tnt.burn(pos, nodename)
|
||||
local name = nodename or minetest.get_node(pos).name
|
||||
local group = minetest.get_item_group(name, "tnt")
|
||||
if group > 0 then
|
||||
local def = minetest.registered_nodes[name]
|
||||
if not def then
|
||||
return
|
||||
elseif def.on_ignite then
|
||||
def.on_ignite(pos)
|
||||
elseif minetest.get_item_group(name, "tnt") > 0 then
|
||||
minetest.sound_play("tnt_ignite", {pos = pos})
|
||||
minetest.set_node(pos, {name = name .. "_burning"})
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
elseif name == "tnt:gunpowder" then
|
||||
minetest.set_node(pos, {name = "tnt:gunpowder_burning"})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ enable_fire (Fire) bool true
|
|||
# Enable flame sound.
|
||||
flame_sound (Flame sound) bool true
|
||||
|
||||
# Enable lavacooling.
|
||||
enable_lavacooling (Lavacooling) bool true
|
||||
|
||||
# If enabled, steel tools, torches and cobblestone will be given to new
|
||||
# players.
|
||||
give_initial_stuff (Give initial items) bool false
|
||||
|
|