ver. 1.1.2

Fix license, remove npc, fix creative inventory, mobs spawning fix, doc
improve
master
Maksim Gamarnik 2016-02-19 00:31:22 +02:00
parent 108b5aa536
commit 152d9cfbdb
81 changed files with 713 additions and 1346 deletions

View File

@ -5,17 +5,12 @@ MultiCraft is an Open Source sandbox game inspired by [Minecraft](https://minecr
MultiCraft is based on Minetest project which is developed by a [number of contributors](https://github.com/minetest/minetest/graphs/contributors).
Copyright (c) 2014-2015 Maksim Gamarnik [MoNTE48] <MoNTE48@mail.ua> & MultiCraft Developement Team.
Copyright (c) 2014-2016 Maksim Gamarnik [MoNTE48] <MoNTE48@mail.ua> & MultiCraft Developement Team.
The engine and the game is licensed under LGPLv3 (or higher). Resources games licensed under CC-BY-SA 4.0, unless otherwise stated.
The engine and the game is licensed under LGPLv3 (or higher). Resources games licensed under CC-BY-SA 3.0, unless otherwise stated, and also a bit of proprietary code and resources.
You can help in the development. But you should always publish your source code after any changes.
Before any use of source code MultiCraft or any part of you should be familiar with [LGPL-3.0](doc/LGPL-3.0.md).
Before any use of source code MultiCraft or any part of you should be familiar with [LGPL-3.0](doc/LGPL-3.0.md) and [Other License.txt](doc/Other%20License.md)
Any code that you push to this repository is automatically licensed as LGPLv3 (or higher) and belongs MultiCraft Project and/or the owner of the project without exception.
Adding code under another license is possible only by agreement with the owner of the project and the creation of appropriate notes.
After compiling you need to archive files in assets into three zips - Files.zip, games.zip and worlds.zip.
games.zip must contain "games" folder.
worlds.zip must contain "worlds" folder and "multicraf.conf" text file.
Finally, remaining files must be packed into Files.zip.
Adding code under another license is possible only by agreement with the owner of the project and the creation of appropriate notes.

View File

@ -1,4 +1,4 @@
Minetest Android port
MultiCraft Android version
=====================
Date: 2015 12 16
@ -128,3 +128,9 @@ Other things that may be nice to know
e.g.:
> make clean_irrlicht
After compiling you need to archive files in assets into three zips - Files.zip, games.zip and worlds.zip.
games.zip must contain "games" folder.
worlds.zip must contain "worlds" folder and "multicraf.conf" text file.
Finally, remaining files must be packed into Files.zip.

View File

@ -1,21 +1,21 @@
.TH minetest 6 "10 September 2013" "" ""
.TH MultiCraft 6 "10 September 2013" "" ""
.SH NAME
minetest, minetestserver \- Multiplayer infinite-world block sandbox
MultiCraft, MultiCraftServer \- Multiplayer infinite-world block sandbox
.SH SYNOPSIS
.B minetest
.B MultiCraft
[\fB--server SERVER OPTIONS\fR | \fBCLIENT OPTIONS\fR]
[\fBCOMMON OPTIONS\fR]
[\fBWORLD PATH\fR]
.B minetestserver
.B MultiCraftServer
[\fBSERVER OPTIONS\fR]
[\fBCOMMON OPTIONS\fR]
[\fBWORLD PATH\fR]
.SH DESCRIPTION
.B Minetest
.B MultiCraft
is one of the first InfiniMiner/Minecraft(/whatever) inspired games (started October 2010), with a goal of taking the survival multiplayer gameplay to a slightly different direction.
.PP
The main design philosophy is to keep it technically simple, stable and portable. It will be kept lightweight enough to run on fairly old hardware.
@ -95,7 +95,7 @@ Display an interactive terminal over ncurses during execution.
.SH ENVIRONMENT
.TP
.B MINETEST_SUBGAME_PATH
.B MULTICRAFT_SUBGAME_PATH
Colon delimited list of directories to search for subgames.
.SH BUGS

View File

@ -1,2 +1,2 @@
.so man6/minetest.6
.so man6/MultiCraft.6

View File

@ -1,5 +1,14 @@
License of Minetest textures and sounds
---------------------------------------
MultiCraft Open Source Project:
LGPLv3.0+, CC-BY-SA 3.0 and a little bit proprietary textures. The list in the file nearby.
You can use these textures without restriction within MultiCraft Project.
You can not use them in another project.
They are an integral part of this project and created exclusively for him.
--- --- ---
License of Minetest textures and sounds:
This applies to textures and sounds contained in the main Minetest
distribution.
@ -12,17 +21,11 @@ Authors of media files
Everything not listed in here:
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
BlockMen:
textures/base/pack/menuheader.png
erlehmann:
misc/minetest-icon-24x24.png
misc/minetest-icon.ico
misc/minetest.svg
textures/base/pack/logo.png
License of Minetest source code
-------------------------------
License of Minetest source code:
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
@ -41,8 +44,9 @@ You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Irrlicht
---------------
Irrlicht:
This program uses the Irrlicht Engine. http://irrlicht.sourceforge.net/
@ -99,9 +103,9 @@ Vattic's Terms:
- If I decide I don't want you using stuff from the pack then that is final. This will only be the case in unusual circumstances.
- These guidelines can be changed at any time.
--- --- ---
JThread
---------------
JThread:
This program uses the JThread library. License for JThread follows:
@ -125,8 +129,9 @@ 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.
Lua
---------------
--- --- ---
Lua:
Lua is licensed under the terms of the MIT license reproduced below.
This means that Lua is free software and can be used for both academic
@ -154,8 +159,9 @@ 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.
Fonts
---------------
--- --- ---
Fonts:
DejaVu Sans Mono:
@ -191,14 +197,8 @@ DroidSansFallback:
See the License for the specific language governing permissions and
limitations under the License.
basis33 is a fixed-width bitmap font for programming and text editing, which contains Latin, Cyrillic, Greek and Hebrew characters.
basis33
Its designed by Manchson basing on Latin-only font Proggy Clean by Tristan Grimmer.
basis33 is free/libre software, you are welcome to redistribute and/or modify it under the terms of MIT/Expat license; see LICENSE for details.
The MIT License (MIT)
Copyright (c) 2004, 2005 Tristan Grimmer
@ -221,3 +221,35 @@ 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.
--- --- ---
Mod "Dungeon Loot" [dungeon_loot]
=================================
Copyright (c) 2015 BlockMen <blockmen2015@gmail.com>
and Amoeba <amoeba@iki.fi>
In MultiCraft Project this code has been changed:
I changed the drop in a few lines.
=================================
Copyright (c) 2015 BlockMen <blockmen2015@gmail.com>
This software is provided 'as-is', without any express or implied warranty. In no
event will the authors be held liable for any damages arising from the use of
this software.
Permission is granted to anyone to use this software for any purpose, including
commercial applications, and to alter it and redistribute it freely, subject to the
following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in a
product, an acknowledgment in the product documentation is required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

View File

@ -319,165 +319,4 @@ exit /b 0
:fail
popd
echo Failed.
exit /b 1
License of Minetest textures and sounds
---------------------------------------
This applies to textures and sounds contained in the main Minetest
distribution.
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
-----------------------
Everything not listed in here:
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
BlockMen:
textures/base/pack/menuheader.png
erlehmann:
misc/minetest-icon-24x24.png
misc/minetest-icon.ico
misc/minetest.svg
textures/base/pack/logo.png
License of Minetest source code
-------------------------------
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
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 3.0 of the License, or
(at your option) any later version.
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.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Irrlicht
---------------
This program uses the Irrlicht Engine. http://irrlicht.sourceforge.net/
The Irrlicht Engine License
Copyright © 2002-2005 Nikolaus Gebhardt
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
JThread
---------------
This program uses the JThread library. License for JThread follows:
Copyright (c) 2000-2006 Jori Liesenborgs (jori.liesenborgs@gmail.com)
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.
Lua
---------------
Lua is licensed under the terms of the MIT license reproduced below.
This means that Lua is free software and can be used for both academic
and commercial purposes at absolutely no cost.
For details and rationale, see http://www.lua.org/license.html .
Copyright (C) 1994-2008 Lua.org, PUC-Rio.
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.
Fonts
---------------
DejaVu Sans Mono:
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
Bitstream Vera Fonts Copyright:
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
a trademark of Bitstream, Inc.
Arev Fonts Copyright:
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
Liberation Fonts Copyright:
Copyright (c) 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc.
DroidSansFallback:
Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
exit /b 1

View File

@ -1,7 +1,7 @@
/** @mainpage The Minetest engine internal documentation
/** @mainpage The MultiCraft engine internal documentation
Welcome to the Minetest engine Doxygen documentation site!\n
This page documents the internal structure of the Minetest engine's C++ code.\n
Welcome to the MultiCraft engine Doxygen documentation site!\n
This page documents the internal structure of the MultiCraft engine's C++ code.\n
Use the tree view at the left to navigate.
*/

View File

@ -1,4 +1,4 @@
Minetest protocol (incomplete, early draft):
MultiCraft protocol (incomplete, early draft):
Updated 2011-06-18
A custom protocol over UDP.

View File

@ -289,11 +289,11 @@ default.player_register_model("3d_armor_character.x", {
minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
if inventory_plus and fields.armor then
local formspec = armor:get_armor_formspec(name)
inventory_plus.set_inventory_formspec(player, formspec)
return
end
--if inventory_plus and fields.armor then
--local formspec = armor:get_armor_formspec(name)
--inventory_plus.set_inventory_formspec(player, formspec)
--return
--end
for field, _ in pairs(fields) do
if string.find(field, "skins_set_") then
minetest.after(0, function(player)
@ -421,9 +421,9 @@ minetest.register_on_joinplayer(function(player)
for i=1, ARMOR_INIT_TIMES do
minetest.after(ARMOR_INIT_DELAY * i, function(player)
armor:set_player_armor(player)
if inventory_plus == nil and unified_inventory == nil then
--if inventory_plus == nil and unified_inventory == nil then
--armor:update_inventory(player)
end
--end
end, player)
end
end)

View File

@ -1,2 +0,0 @@
default

View File

@ -1,168 +0,0 @@
--[[
#!#!#!#Cake mod created by Jordan4ibanez#!#!#
#!#!#!#Released under CC Attribution-ShareAlike 3.0 Unported #!#!#
]]--
cake_texture = {"cake_top.png","cake_bottom.png","cake_inner.png","cake_side.png","cake_side.png","cake_side.png"}
slice_1 = { -7/16, -8/16, -7/16, -5/16, 0/16, 7/16}
slice_2 = { -7/16, -8/16, -7/16, -2/16, 0/16, 7/16}
slice_3 = { -7/16, -8/16, -7/16, 1/16, 0/16, 7/16}
slice_4 = { -7/16, -8/16, -7/16, 3/16, 0/16, 7/16}
slice_5 = { -7/16, -8/16, -7/16, 5/16, 0/16, 7/16}
slice_6 = { -7/16, -8/16, -7/16, 7/16, 0/16, 7/16}
minetest.register_craft({
output = "cake:cake",
recipe = {
{'bucket:bucket_water', 'bucket:bucket_water', 'bucket:bucket_water'},
{'default:sugar', 'default:leaves', 'default:sugar'},
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
},
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}},
})
minetest.register_node("cake:cake", {
description = "Cake",
tiles = {"cake_top.png","cake_bottom.png","cake_side.png","cake_side.png","cake_side.png","cake_side.png"},
paramtype = "light",
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_6
},
node_box = {
type = "fixed",
fixed = slice_6
},
is_ground_content = true,
stack_max = 1,
groups = {crumbly=3,falling_node=1, foodstuffs = 1},
drop = '',
--legacy_mineral = true,
on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.add_node(pos,{type="node",name="cake:cake_5",param2=param2})
end
end,
})
minetest.register_node("cake:cake_5", {
description = "Cake [5 Slices Left]",
tiles = cake_texture,
paramtype = "light",
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_5
},
node_box = {
type = "fixed",
fixed = slice_5
},
is_ground_content = true,
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
drop = '',
--legacy_mineral = true,
on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.add_node(pos,{type="node",name="cake:cake_4",param2=param2})
end
end,
})
minetest.register_node("cake:cake_4", {
description = "Cake [4 Slices Left]",
tiles = cake_texture,
paramtype = "light",
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_4
},
node_box = {
type = "fixed",
fixed = slice_4
},
is_ground_content = true,
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
drop = '',
--legacy_mineral = true,
on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.add_node(pos,{type="node",name="cake:cake_3",param2=param2})
end
end,
})
minetest.register_node("cake:cake_3", {
description = "Cake [3 Slices Left]",
tiles = cake_texture,
paramtype = "light",
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_3
},
node_box = {
type = "fixed",
fixed = slice_3
},
is_ground_content = true,
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
drop = '',
--legacy_mineral = true,
on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.add_node(pos,{type="node",name="cake:cake_2",param2=param2})
end
end,
})
minetest.register_node("cake:cake_2", {
description = "Cake [2 Slices Left]",
tiles = cake_texture,
paramtype = "light",
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_2
},
node_box = {
type = "fixed",
fixed = slice_2
},
is_ground_content = true,
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
drop = '',
--legacy_mineral = true,
on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.add_node(pos,{type="node",name="cake:cake_1",param2=param2})
end
end,
})
minetest.register_node("cake:cake_1", {
description = "Cake [1 Slice Left]",
tiles = cake_texture,
paramtype = "light",
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_1
},
node_box = {
type = "fixed",
fixed = slice_1
},
is_ground_content = true,
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
drop = '',
--legacy_mineral = true,
on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.remove_node(pos)
end
end,
})

View File

@ -1,34 +1,34 @@
multicraft mod "Crafting"
=======================
Version: 2.0.1
License of source code and Textures: WTFPL
------------------------------------
copyright (c) 2013-2014 by BlockMen
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
--USING the mod--
=================
This mod changes the players inventory (survival and creative) with more slots (9*4 instead of 8*4)
Like known from Minecraft you have a 2x2 crafting grid at inventory now. Furthermore a categorized creative
inventory and a support for stu's 3d armor mod (To use the armor and a preview of player).
Left items in the crafting slots are dropped infront of you.
Workbench
_________
With following recipe you craft a workbench (aka crafting table):
wood wood
wood wood
multicraft mod "Crafting"
=======================
Version: 2.0.1
License of source code and Textures: WTFPL
------------------------------------
copyright (c) 2013-2014 by BlockMen
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
--USING the mod--
=================
This mod changes the players inventory (survival and creative) with more slots (9*4 instead of 8*4)
Like known from Minecraft you have a 2x2 crafting grid at inventory now. Furthermore a categorized creative
inventory and a support for stu's 3d armor mod (To use the armor and a preview of player).
Left items in the crafting slots are dropped infront of you.
Workbench
_________
With following recipe you craft a workbench (aka crafting table):
wood wood
wood wood
The workbench has a 3x3 crafting grid, that allows to use all recipes.

View File

@ -1,398 +1,340 @@
crafting = {}
crafting.creative_inventory_size = 0
crafting.start_is = {}
crafting.pages = {}
function init()
local inv = minetest.create_detached_inventory("creative", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then
return count
else
return 0
end
end,
allow_put = function(inv, listname, index, stack, player)
return 0
end,
allow_take = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return -1
else
return 0
end
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
end,
on_put = function(inv, listname, index, stack, player)
end,
on_take = function(inv, listname, index, stack, player)
print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
if stack then
print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
end
end,
})
set_inv("all")
end
function set_inv(filter, player)
local inv = minetest.get_inventory({type="detached", name="creative"})
inv:set_size("main", 0)
local creative_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then
if filter ~= "" then
if filter == "#blocks" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.building
then
table.insert(creative_list, name)
end
elseif filter == "#deco" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.decorative
then
table.insert(creative_list, name)
end
elseif filter == "#mese" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.mese
then
table.insert(creative_list, name)
end
elseif filter == "#rail" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.rail
then
table.insert(creative_list, name)
end
elseif filter == "#misc" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.misc
then
table.insert(creative_list, name)
end
elseif filter == "#food" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.foodstuffs
then
table.insert(creative_list, name)
end
elseif filter == "#tools" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.tools
then
table.insert(creative_list, name)
end
elseif filter == "#combat" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.combat
then
table.insert(creative_list, name)
end
elseif filter == "#matr" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.materials
then
table.insert(creative_list, name)
end
elseif filter == "#brew" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.brewing
then
table.insert(creative_list, name)
end
elseif filter == "all" then
table.insert(creative_list, name)
else --for all other
if string.find(string.lower(def.name), filter) or string.find(string.lower(def.description), filter) then
table.insert(creative_list, name)
end
end
end
end
end
table.sort(creative_list)
inv:set_size("main", #creative_list)
for _,itemstring in ipairs(creative_list) do
inv:add_item("main", ItemStack(itemstring))
end
crafting.creative_inventory_size = #creative_list
--print("creative inventory size: "..dump(crafting.creative_inventory_size))
end
-- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", {
allow_put = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then
return stack:get_count()
else
return 0
end
end,
on_put = function(inv, listname, index, stack, player)
inv:set_stack(listname, index, "")
end,
})
trash:set_size("main", 1)
-- Create detached creative inventory after loading all mods
minetest.after(0, init)
local offset = {}
local hoch = {}
local bg = {}
offset["blocks"] = "-0.29,-0.25"
offset["deco"] = "0.98,-0.25"
offset["mese"] = "2.23,-0.25"
offset["rail"] = "3.495,-0.25"
offset["misc"] = "4.75,-0.25"
offset["nix"] = "8.99,-0.25"
offset["food"] = "-0.29,8.12"
offset["tools"] = "0.98,8.12"
offset["combat"] = "2.23,8.12"
offset["brew"] = "4.78,8.12"
offset["matr"] = "3.495,8.12"
offset["inv"] = "8.99,8.12"
hoch["blocks"] = ""
hoch["deco"] = ""
hoch["mese"] = ""
hoch["rail"] = ""
hoch["misc"] = ""
hoch["nix"] = ""
hoch["food"] = "^[transformfy"
hoch["tools"] = "^[transformfy"
hoch["combat"] = "^[transformfy"
hoch["brew"] = "^[transformfy"
hoch["matr"] = "^[transformfy"
hoch["inv"] = "^[transformfy"
local dark_bg = "crafting_creative_bg_dark.png"
local function reset_menu_item_bg()
bg["blocks"] = dark_bg
bg["deco"] = dark_bg
bg["mese"] = dark_bg
bg["rail"] = dark_bg
bg["misc"] = dark_bg
bg["nix"] = dark_bg
bg["food"] = dark_bg
bg["tools"] = dark_bg
bg["combat"] = dark_bg
bg["brew"] = dark_bg
bg["matr"] = dark_bg
bg["inv"] = dark_bg
end
crafting.set_creative_formspec = function(player, start_i, pagenum, show, page, scroll)
reset_menu_item_bg()
pagenum = math.floor(pagenum) or 1
local pagemax = math.floor((crafting.creative_inventory_size) / (9*5) + 1)
local slider_height = 4/pagemax
local slider_pos = slider_height*(pagenum-1)+2.2
local player_name = player:get_player_name()
crafting.start_is[player_name] = start_i
crafting.pages[player_name] = page
local formspec = ""
local main_list = "list[detached:creative;main;0,1.75;9,5;"..tostring(start_i).."]"
local name = "nix"
if page ~= nil then name = page end
bg[name] = "crafting_creative_bg.png"
if name == "inv" then
main_list = "image[-0.2,1.7;11.35,2.33;crafting_creative_bg.png]"..
"image[-0.3,0.15;3,4;crafting_inventory_armor2.png]"..
"list[current_player;main;0,3.75;9,3;9]"..
"list[detached:"..player_name.."_armor;armor;0,1.55;1,1;]"..
"list[detached:"..player_name.."_armor;armor;0,2.55;1,1;1]"..
"list[detached:"..player_name.."_armor;armor;1,1.55;1,1;2]"..
"list[detached:"..player_name.."_armor;armor;1,2.55;1,1;3]"
end
formspec = "size[10,9.3]"..
"image_button_exit[10,0;1,1;;exit;X;true;true;]"..
"background[-0.19,-0.25;10.5,9.87;crafting_inventory_creative.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"label[-5,-5;"..name.."]"..
"image[" .. offset[name] .. ";1.5,1.44;crafting_creative_active.png"..hoch[name].."]"..
"image_button[-0.1,0;1,1;"..bg["blocks"].."^crafting_creative_build.png;build;]".. --build blocks
"image_button[1.15,0;1,1;"..bg["deco"].."^crafting_creative_deko.png;deco;]".. --decoration blocks
"image_button[2.415,0;1,1;"..bg["mese"].."^crafting_creative_mese.png;mese;]".. --bluestone
"image_button[3.693,0;1,1;"..bg["rail"].."^crafting_creative_rail.png;rail;]".. --transportation
"image_button[4.93,0;1,1;"..bg["misc"].."^crafting_creative_misc.png;misc;]".. --miscellaneous
"image_button[9.19,0;1,1;"..bg["nix"].."^crafting_creative_all.png;default;]".. --search
"image[0,1;5,0.75;fnt_"..name..".png]"..
"list[current_player;main;0,7;9,1;]"..
main_list..
"image_button[9.03,1.74;0.85,0.6;crafting_creative_up.png;creative_prev;]"..
"image_button[9.03,6.15;0.85,0.6;crafting_creative_down.png;creative_next;]"..
"image_button[-0.1,8.28;1,1;"..bg["food"].."^crafting_food.png;food;]".. --foodstuff
"image_button[1.15,8.28;1,1;"..bg["tools"].."^crafting_creative_tool.png;tools;]".. --tools
"image_button[2.415,8.28;1,1;"..bg["combat"].."^crafting_creative_sword.png;combat;]".. --combat
"image_button[3.693,8.28;1,1;"..bg["matr"].."^crafting_creative_matr.png;matr;]".. --brewing
"image_button[4.93,8.28;1,1;"..bg["brew"].."^crafting_inventory_brew.png;brew;]".. --materials^
"image_button[9.19,8.28;1,1;"..bg["inv"].."^crafting_creative_inv.png;inv;]".. --inventory
"list[detached:creative_trash;main;9,7;1,1;]"..
"image[9,7;1,1;crafting_creative_trash.png]"..
"image[9.04," .. tostring(slider_pos) .. ";0.78,"..tostring(slider_height) .. ";crafting_slider.png]"
if name == "nix" then formspec = formspec .. "field[5.3,1.3;4,0.75;suche;;]" end
if pagenum ~= nil then formspec = formspec .. "p"..tostring(pagenum) end
player:set_inventory_formspec(formspec)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
local page = nil
if not minetest.setting_getbool("creative_mode") then
return
end
if fields.bgcolor then
-- minetest.chat_send_all("jupp")
end
if fields.suche ~= nil and fields.suche ~= "" then
set_inv(string.lower(fields.suche))
minetest.after(0, function()
minetest.show_formspec(player:get_player_name(), "detached:creative", player:get_inventory_formspec())
end)
end
if fields.build then
set_inv("#blocks",player)
page = "blocks"
end
if fields.deco then
set_inv("#deco",player)
page = "deco"
end
if fields.mese then
set_inv("#mese",player)
page = "mese"
end
if fields.rail then
set_inv("#rail",player)
page = "rail"
end
if fields.misc then
set_inv("#misc",player)
page = "misc"
end
if fields.default then
set_inv("all")
page = 'nix'
end
if fields.food then
set_inv("#food")
page = "food"
end
if fields.tools then
set_inv("#tools")
page = "tools"
end
if fields.combat then
set_inv("#combat")
page = "combat"
end
if fields.matr then
set_inv("#matr")
page = "matr"
end
if fields.inv then
page = "inv"
end
if fields.brew then
set_inv("#brew")
page = "brew"
end
-- Figure out current page from formspec
local current_page = 0
local formspec = player:get_inventory_formspec()
local size = string.len(formspec)
local marker = string.sub(formspec,size-1)
marker = string.sub(marker,1,1)
local player_name = player:get_player_name()
local start_i = crafting.start_is[player_name]
if not page then page = crafting.pages[player_name] end
if page ~= crafting.pages[player_name] then
start_i = 0
end
--if marker ~= nil and marker == "p" then
--local ppage = string.sub(formspec,size)
-- print('ppage ' .. (ppage or 'nope'))
--minetest.chat_send_all(page)
--start_i = ppage - 1
--end
--start_i = tonumber(start_i) or 0
if fields.creative_prev then
start_i = start_i - 9*5
end
if fields.creative_next
and start_i + 9*5 <= crafting.creative_inventory_size+1 then
start_i = start_i + 9*5
end
if start_i < 0 then
start_i = 0
end
crafting.set_creative_formspec(player, start_i, start_i/(9*5) +1, false, page)
end)
if minetest.setting_getbool("creative_mode") then
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=0.5},
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
crumbly = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
cracky = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
snappy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
choppy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
oddly_breakable_by_hand = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
}
}
})
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
return true
end)
function minetest.handle_node_drops(pos, drops, digger)
if not digger or not digger:is_player() then
return
end
local inv = digger:get_inventory()
if inv then
for _,item in ipairs(drops) do
item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then
inv:add_item("main", item)
end
end
end
end
end
crafting = {}
crafting.creative_inventory_size = 0
crafting.start_is = {}
crafting.pages = {}
function init()
local inv = minetest.create_detached_inventory("creative", {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
return count
end,
allow_put = function(inv, listname, index, stack, player)
return 0
end,
allow_take = function(inv, listname, index, stack, player)
return -1
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
end,
on_put = function(inv, listname, index, stack, player)
end,
on_take = function(inv, listname, index, stack, player)
print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
if stack then
print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
end
end,
})
set_inv("all")
end
function set_inv(filter, player)
local inv = minetest.get_inventory({type="detached", name="creative"})
inv:set_size("main", 0)
local creative_list = {}
for name,def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then
if filter ~= "" then
if filter == "#blocks" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.building
then
table.insert(creative_list, name)
end
elseif filter == "#deco" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.decorative
then
table.insert(creative_list, name)
end
elseif filter == "#mese" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.mese
then
table.insert(creative_list, name)
end
elseif filter == "#rail" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.rail
then
table.insert(creative_list, name)
end
elseif filter == "#misc" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.misc
then
table.insert(creative_list, name)
end
elseif filter == "#food" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.foodstuffs
then
table.insert(creative_list, name)
end
elseif filter == "#tools" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.tools
then
table.insert(creative_list, name)
end
elseif filter == "#combat" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.combat
then
table.insert(creative_list, name)
end
elseif filter == "#matr" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.materials
then
table.insert(creative_list, name)
end
elseif filter == "#brew" then
if minetest.registered_items[def.name]
and minetest.registered_items[def.name].groups
and minetest.registered_items[def.name].groups.brewing
then
table.insert(creative_list, name)
end
elseif filter == "all" then
table.insert(creative_list, name)
else --for all other
if string.find(string.lower(def.name), filter) or string.find(string.lower(def.description), filter) then
table.insert(creative_list, name)
end
end
end
end
end
table.sort(creative_list)
inv:set_size("main", #creative_list)
for _,itemstring in ipairs(creative_list) do
inv:add_item("main", ItemStack(itemstring))
end
crafting.creative_inventory_size = #creative_list
--print("creative inventory size: "..dump(crafting.creative_inventory_size))
end
-- Create the trash field
local trash = minetest.create_detached_inventory("creative_trash", {
allow_put = function(inv, listname, index, stack, player)
return stack:get_count()
end,
on_put = function(inv, listname, index, stack, player)
inv:set_stack(listname, index, "")
end,
})
trash:set_size("main", 1)
-- Create detached creative inventory after loading all mods
minetest.after(0.5, init)
local offset = {}
local hoch = {}
local bg = {}
offset["blocks"] = "-0.29,-0.25"
offset["deco"] = "0.98,-0.25"
offset["mese"] = "2.23,-0.25"
offset["rail"] = "3.495,-0.25"
offset["misc"] = "4.75,-0.25"
offset["nix"] = "8.99,-0.25"
offset["food"] = "-0.29,8.12"
offset["tools"] = "0.98,8.12"
offset["combat"] = "2.23,8.12"
offset["brew"] = "4.78,8.12"
offset["matr"] = "3.495,8.12"
offset["inv"] = "8.99,8.12"
hoch["blocks"] = ""
hoch["deco"] = ""
hoch["mese"] = ""
hoch["rail"] = ""
hoch["misc"] = ""
hoch["nix"] = ""
hoch["food"] = "^[transformfy"
hoch["tools"] = "^[transformfy"
hoch["combat"] = "^[transformfy"
hoch["brew"] = "^[transformfy"
hoch["matr"] = "^[transformfy"
hoch["inv"] = "^[transformfy"
local dark_bg = "crafting_creative_bg_dark.png"
local function reset_menu_item_bg()
bg["blocks"] = dark_bg
bg["deco"] = dark_bg
bg["mese"] = dark_bg
bg["rail"] = dark_bg
bg["misc"] = dark_bg
bg["nix"] = dark_bg
bg["food"] = dark_bg
bg["tools"] = dark_bg
bg["combat"] = dark_bg
bg["brew"] = dark_bg
bg["matr"] = dark_bg
bg["inv"] = dark_bg
end
crafting.set_creative_formspec = function(player, start_i, pagenum, show, page, scroll)
reset_menu_item_bg()
pagenum = math.floor(pagenum) or 1
local pagemax = math.floor((crafting.creative_inventory_size-1) / (9*5) + 1)
local slider_height = 4/pagemax
local slider_pos = slider_height*(pagenum-1)+2.2
local player_name = player:get_player_name()
crafting.start_is[player_name] = start_i
crafting.pages[player_name] = page
local name = "nix"
local formspec = ""
local main_list = "list[detached:creative;main;0,1.75;9,5;"..tostring(start_i).."]"
if page ~= nil then name = page end
bg[name] = "crafting_creative_bg.png"
if name == "inv" then
main_list = "image[-0.2,1.7;11.35,2.33;crafting_creative_bg.png]"..
"image[-0.3,0.15;3,4;crafting_inventory_armor2.png]"..
"list[current_player;main;0,3.75;9,3;9]"..
"list[detached:"..player_name.."_armor;armor;0,1.55;1,1;]"..
"list[detached:"..player_name.."_armor;armor;0,2.55;1,1;1]"..
"list[detached:"..player_name.."_armor;armor;1,1.55;1,1;2]"..
"list[detached:"..player_name.."_armor;armor;1,2.55;1,1;3]"
end
formspec = "size[10,9.3]"..
"image_button_exit[10,0;1,1;;exit;X;true;true;]"..
"background[-0.19,-0.25;10.5,9.87;crafting_inventory_creative.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"label[-5,-5;"..name.."]"..
"image[" .. offset[name] .. ";1.5,1.44;crafting_creative_active.png"..hoch[name].."]"..
"image_button[-0.1,0;1,1;"..bg["blocks"].."^crafting_creative_build.png;build;]".. --build blocks
"image_button[1.15,0;1,1;"..bg["deco"].."^crafting_creative_deko.png;deco;]".. --decoration blocks
"image_button[2.415,0;1,1;"..bg["mese"].."^crafting_creative_mese.png;mese;]".. --bluestone
"image_button[3.693,0;1,1;"..bg["rail"].."^crafting_creative_rail.png;rail;]".. --transportation
"image_button[4.93,0;1,1;"..bg["misc"].."^crafting_creative_misc.png;misc;]".. --miscellaneous
"image_button[9.19,0;1,1;"..bg["nix"].."^crafting_creative_all.png;default;]".. --search
"image[0,1;5,0.75;fnt_"..name..".png]"..
"list[current_player;main;0,7;9,1;]"..
main_list..
"image_button[9.03,1.74;0.85,0.6;crafting_creative_up.png;creative_prev;]"..
"image[9.04," .. tostring(slider_pos) .. ";0.75,"..tostring(slider_height) .. ";crafting_slider.png]"..
"image_button[9.03,6.15;0.85,0.6;crafting_creative_down.png;creative_next;]"..
"image_button[-0.1,8.28;1,1;"..bg["food"].."^crafting_food.png;food;]".. --foodstuff
"image_button[1.15,8.28;1,1;"..bg["tools"].."^crafting_creative_tool.png;tools;]".. --tools
"image_button[2.415,8.28;1,1;"..bg["combat"].."^crafting_creative_sword.png;combat;]".. --combat
"image_button[3.693,8.28;1,1;"..bg["matr"].."^crafting_creative_matr.png;matr;]".. --brewing
"image_button[4.93,8.28;1,1;"..bg["brew"].."^crafting_inventory_brew.png;brew;]".. --materials^
"image_button[9.19,8.28;1,1;"..bg["inv"].."^crafting_creative_inv.png;inv;]".. --inventory
"list[detached:creative_trash;main;9,7;1,1;]"..
"image[9,7;1,1;crafting_creative_trash.png]"
if name == "nix" then formspec = formspec .. "field[5.3,1.3;4,0.75;suche;;]" end
if pagenum ~= nil then formspec = formspec .. "p"..tostring(pagenum) end
player:set_inventory_formspec(formspec)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
local page = nil
if fields.bgcolor then
-- minetest.chat_send_all("jupp")
end
if fields.suche ~= nil and fields.suche ~= "" then
set_inv(string.lower(fields.suche))
minetest.after(0.5, function()
minetest.show_formspec(player:get_player_name(), "detached:creative", player:get_inventory_formspec())
end)
end
if fields.build then
set_inv("#blocks",player)
page = "blocks"
end
if fields.deco then
set_inv("#deco",player)
page = "deco"
end
if fields.mese then
set_inv("#mese",player)
page = "mese"
end
if fields.rail then
set_inv("#rail",player)
page = "rail"
end
if fields.misc then
set_inv("#misc",player)
page = "misc"
end
if fields.default then
set_inv("all")
page = 'nix'
end
if fields.food then
set_inv("#food")
page = "food"
end
if fields.tools then
set_inv("#tools")
page = "tools"
end
if fields.combat then
set_inv("#combat")
page = "combat"
end
if fields.matr then
set_inv("#matr")
page = "matr"
end
if fields.inv then
page = "inv"
end
if fields.brew then
set_inv("#brew")
page = "brew"
end
-- Figure out current page from formspec
local current_page = 0
local formspec = player:get_inventory_formspec()
local size = string.len(formspec)
local marker = string.sub(formspec,size-2)
marker = string.sub(marker,1)
local player_name = player:get_player_name()
local start_i = crafting.start_is[player_name]
if not page then page = crafting.pages[player_name] end
if page ~= crafting.pages[player_name] then
start_i = 0
end
start_i = tonumber(start_i) or 0
if fields.creative_prev then
start_i = start_i - 9*5
page = tmp_page
end
if fields.creative_next then
start_i = start_i + 9*5
page = tmp_page
end
if start_i < 0 then
start_i = start_i + 9*5
end
if start_i >= crafting.creative_inventory_size then
start_i = start_i - 9*5
end
if start_i < 0 or start_i >= crafting.creative_inventory_size then
start_i = 0
end
crafting.set_creative_formspec(player, start_i, start_i / (9*5) + 1, false, page)
end)

View File

@ -1,48 +1,48 @@
default.chest_formspec =
"size[9,9.75]"..
"image_button_exit[9,0;1,1;;exit;X;true;true;]"..
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"list[current_name;main;0,0.5;9,4;]"..
"list[current_player;main;0,5.5;9,3;9]"..
"list[current_player;main;0,8.74;9,1;]"
local chest_inv_size = 4*9
local chest_inv_vers = 2
function default.get_locked_chest_formspec(pos)
local meta = minetest.get_meta(pos)
local inv_v = meta:get_int("chest_inv_ver")
if inv_v and inv_v < chest_inv_vers then
local inv = meta:get_inventory()
inv:set_size("main",chest_inv_size)
meta:set_int("chest_inv_ver",chest_inv_vers)
end
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
local formspec =
"size[9,9.75]"..
"image_button_exit[9,0;1,1;;exit;X;true;true;]"..
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"list[nodemeta:".. spos .. ";main;0,0.5;9,4;]"..
"list[current_player;main;0,5.5;9,3;9]"..
"list[current_player;main;0,8.74;9,1;]"
return formspec
end
minetest.register_abm({
nodenames = {"default:chest"},
interval = 1,
chance = 1,
action = function(pos, node)
local meta = minetest.get_meta(pos)
local inv_v = meta:get_int("chest_inv_ver")
if inv_v and inv_v < chest_inv_vers then
local inv = meta:get_inventory()
inv:set_size("main",chest_inv_size)
meta:set_int("chest_inv_ver",chest_inv_vers)
end
end
default.chest_formspec =
"size[9,9.75]"..
"image_button_exit[9,0;1,1;;exit;X;true;true;]"..
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"list[current_name;main;0,0.5;9,4;]"..
"list[current_player;main;0,5.5;9,3;9]"..
"list[current_player;main;0,8.74;9,1;]"
local chest_inv_size = 4*9
local chest_inv_vers = 2
function default.get_locked_chest_formspec(pos)
local meta = minetest.get_meta(pos)
local inv_v = meta:get_int("chest_inv_ver")
if inv_v and inv_v < chest_inv_vers then
local inv = meta:get_inventory()
inv:set_size("main",chest_inv_size)
meta:set_int("chest_inv_ver",chest_inv_vers)
end
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
local formspec =
"size[9,9.75]"..
"image_button_exit[9,0;1,1;;exit;X;true;true;]"..
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"list[nodemeta:".. spos .. ";main;0,0.5;9,4;]"..
"list[current_player;main;0,5.5;9,3;9]"..
"list[current_player;main;0,8.74;9,1;]"
return formspec
end
minetest.register_abm({
nodenames = {"default:chest"},
interval = 1,
chance = 1,
action = function(pos, node)
local meta = minetest.get_meta(pos)
local inv_v = meta:get_int("chest_inv_ver")
if inv_v and inv_v < chest_inv_vers then
local inv = meta:get_inventory()
inv:set_size("main",chest_inv_size)
meta:set_int("chest_inv_ver",chest_inv_vers)
end
end
})

View File

@ -1,203 +1,198 @@
dofile(minetest.get_modpath("crafting").."/formspecs.lua")
local show_armor = false
if minetest.get_modpath("3d_armor") ~= nil then show_armor = true end
local function item_drop(itemstack, dropper, pos)
if dropper:is_player() then
local v = dropper:get_look_dir()
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
p.x = p.x+(math.random(1,3)*0.2)
p.z = p.z+(math.random(1,3)*0.2)
local obj = minetest.add_item(p, itemstack)
if obj then
v.x = v.x*4
v.y = v.y*4 + 2
v.z = v.z*4
obj:setvelocity(v)
end
else
minetest.add_item(pos, itemstack)
end
return itemstack
end
local function drop_fields(player, name)
local inv = player:get_inventory()
for i,stack in ipairs(inv:get_list(name)) do
item_drop(stack, player, player:getpos())
stack:clear()
inv:set_stack(name, i, stack)
end
end
local player_armor = {}
local function update_armor(player)
local out = ""
if not player then return end
local name = player:get_player_name()
if not armor or not armor.textures then return end
local armor_str = armor.textures[name].armor
if string.find(armor_str, "leggings") then
out = out .. "^crafting_armor_legs.png"
end
if string.find(armor_str, "boots") then
out = out .. "^crafting_armor_boots.png"
end
if string.find(armor_str, "helmet") then
out = out .. "^crafting_armor_helmet.png"
end
if string.find(armor_str, "chestplate") then
out = out .. "^crafting_armor_chest.png"
end
player_armor[name] = out
end
local function set_inventory(player)
if minetest.setting_getbool("creative_mode") then
minetest.after(0.5,function()
crafting.set_creative_formspec(player, 0, 1)
return
end)
end
player:get_inventory():set_width("craft", 3)
player:get_inventory():set_size("craft", 9)
player:get_inventory():set_size("main", 9*4)
local player_name = player:get_player_name()
local img = "crafting_inventory_player.png"
local armor_img = ""
if show_armor then
armor_img = "^crafting_inventory_armor.png"
if player_armor[player_name] ~= nil then
img = img .. player_armor[player_name]
end
end
local img_element = "image[1,0;3,4;"..img.."]"
if show_armor and armor.textures[player_name] and armor.textures[player_name].preview then
img = armor.textures[player_name].preview
local s1 = img:find("character_preview")
if s1 ~= nil then
s1 = img:sub(s1+21)
img = "crafting_player2d.png"..s1
end
img_element = "image[1.5,0;2,4;"..img.."]"
end
local form = "size[9,8.75]"..
"image_button_exit[9,0;1,1;;exit;X;true;true;]"..
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_inv.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
img_element
--armor
if show_armor then
if armor.def[player_name] and armor.def[player_name].level then
form = form ..
"list[detached:"..player_name.."_armor;armor;0,0;1,1;]"..
"list[detached:"..player_name.."_armor;armor;0,1;1,1;1]"..
"list[detached:"..player_name.."_armor;armor;0,2;1,1;2]"..
"list[detached:"..player_name.."_armor;armor;0,3;1,1;3]"
else
form = form ..
"list[detached:"..player_name.."_armor;armor_head;0,0;1,1;]"..
"list[detached:"..player_name.."_armor;armor_torso;0,1;1,1;1]"..
"list[detached:"..player_name.."_armor;armor_legs;0,2;1,1;2]"..
"list[detached:"..player_name.."_armor;armor_feet;0,3;1,1;3]"
end
end
form = form ..
"list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]"..
"list[current_player;craft;4,1;2,1;1]"..
"list[current_player;craft;4,2;2,1;4]"..
"list[current_player;craftpreview;7,1.5;1,1;]"..
"inv"
player:set_inventory_formspec(form)
end
local function set_workbench(player)
player:get_inventory():set_width("craft", 3)
player:get_inventory():set_size("craft", 9)
player:get_inventory():set_size("main", 9*4)
local form = "size[9,8.75]"..
"image_button_exit[9,0;1,1;;exit;X;true;true;]"..
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_workbench.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]"..
"list[current_player;craft;1.75,0.5;3,3;]"..
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
"wob"
--player:set_inventory_formspec(form)
minetest.show_formspec(player:get_player_name(), "main", form)
end
--drop craf items and reset inventory on closing
minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.quit then
local formspec = player:get_inventory_formspec()
local size = string.len(formspec)
local marker = string.sub(formspec,size-2)
if marker == "inv" or marker == "wob" then
set_inventory(player)
drop_fields(player,"craft")
end
end
end)
minetest.register_on_joinplayer(function(player)
minetest.after(0,function(dt)
if player then set_inventory(player) end
end)
if minetest.setting_getbool("creative_mode") then
dofile(minetest.get_modpath("crafting").."/creative.lua")
end
--init inventory
set_inventory(player)
--set hotbar size
if player.hud_set_hotbar_itemcount then
minetest.after(0, player.hud_set_hotbar_itemcount, player, 8)
end
--add hotbar images
minetest.after(0,function()
player:hud_set_hotbar_image("crafting_hotbar.png")
player:hud_set_hotbar_selected_image("crafting_hotbar_selected.png")
if show_armor then
local armor_orginal = armor.set_player_armor
armor.set_player_armor = function(self, player)
armor_orginal(self, player)
update_armor(player)
-- set_inventory(player)
end
end
end)
end)
minetest.register_node("crafting:workbench", {
description = "Workbench",
tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png",
"crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"},
paramtype2 = "facedir",
paramtype = "light",
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2, decorative = 1},
on_rightclick = function(pos, node, clicker, itemstack)
set_workbench(clicker)
end
})
minetest.register_craft({
output = "crafting:workbench",
recipe = {
{"group:wood", "group:wood"},
{"group:wood", "group:wood"}
}
})
dofile(minetest.get_modpath("crafting").."/formspecs.lua")
local show_armor = true
local function item_drop(itemstack, dropper, pos)
if dropper:is_player() then
local v = dropper:get_look_dir()
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
p.x = p.x+(math.random(1,3)*0.2)
p.z = p.z+(math.random(1,3)*0.2)
local obj = minetest.env:add_item(p, itemstack)
if obj then
v.x = v.x*4
v.y = v.y*4 + 2
v.z = v.z*4
obj:setvelocity(v)
end
else
minetest.add_item(pos, itemstack)
end
return itemstack
end
local function drop_fields(player, name)
local inv = player:get_inventory()
for i,stack in ipairs(inv:get_list(name)) do
item_drop(stack, player, player:getpos())
stack:clear()
inv:set_stack(name, i, stack)
end
end
local player_armor = {}
local function update_armor(player)
local out = ""
if not player then return end
local name = player:get_player_name()
if not armor or not armor.textures then return end
local armor_str = armor.textures[name].armor
if string.find(armor_str, "leggings") then
out = out .. "^crafting_armor_legs.png"
end
if string.find(armor_str, "boots") then
out = out .. "^crafting_armor_boots.png"
end
if string.find(armor_str, "helmet") then
out = out .. "^crafting_armor_helmet.png"
end
if string.find(armor_str, "chestplate") then
out = out .. "^crafting_armor_chest.png"
end
player_armor[name] = out
end
local function set_inventory(player)
player:get_inventory():set_width("craft", 3)
player:get_inventory():set_size("craft", 9)
player:get_inventory():set_size("main", 9*4)
local player_name = player:get_player_name()
local img = "crafting_player2d.png"
local armor_img = ""
if show_armor then
armor_img = "^crafting_inventory_armor.png"
if player_armor[player_name] ~= nil then
img = img .. player_armor[player_name]
end
end
local img_element = "image[1.5,0;2,4;"..img.."]"
if show_armor and armor.textures[player_name] and armor.textures[player_name].preview then
img = armor.textures[player_name].preview
local s1 = img:find("character_preview")
if s1 ~= nil then
s1 = img:sub(s1+21)
img = "crafting_player2d.png"..s1
end
img_element = "image[1.5,0;2,4;"..img.."]"
end
local form = "size[9,8.75]"..
"image_button_exit[9,0;1,1;;exit;X;true;true;]"..
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_inv.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
img_element
--armor
if show_armor then
if armor.def[player_name] and armor.def[player_name].level then
form = form ..
"list[detached:"..player_name.."_armor;armor;0,0;1,1;]"..
"list[detached:"..player_name.."_armor;armor;0,1;1,1;1]"..
"list[detached:"..player_name.."_armor;armor;0,2;1,1;2]"..
"list[detached:"..player_name.."_armor;armor;0,3;1,1;3]"
else
form = form ..
"list[detached:"..player_name.."_armor;armor_head;0,0;1,1;]"..
"list[detached:"..player_name.."_armor;armor_torso;0,1;1,1;1]"..
"list[detached:"..player_name.."_armor;armor_legs;0,2;1,1;2]"..
"list[detached:"..player_name.."_armor;armor_feet;0,3;1,1;3]"
end
end
form = form ..
"list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]"..
"list[current_player;craft;4,1;2,1;1]"..
"list[current_player;craft;4,2;2,1;4]"..
"list[current_player;craftpreview;7,1.5;1,1;]"..
"inv"
player:set_inventory_formspec(form)
end
local function set_workbench(player)
player:get_inventory():set_width("craft", 3)
player:get_inventory():set_size("craft", 9)
player:get_inventory():set_size("main", 9*4)
local form = "size[9,8.75]"..
"image_button_exit[9,0;1,1;;exit;X;true;true;]"..
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_workbench.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]"..
"list[current_player;craft;1.75,0.5;3,3;]"..
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
"wob"
minetest.show_formspec(player:get_player_name(), "main", form)
end
--drop craf items and reset inventory on closing
minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.quit then
local formspec = player:get_inventory_formspec()
local size = string.len(formspec)
local marker = string.sub(formspec,size-2)
if marker == "inv" or marker == "wob" then
set_inventory(player)
drop_fields(player,"craft")
end
end
end)
minetest.register_on_joinplayer(function(player)
if minetest.setting_getbool("creative_mode") then
minetest.after(0.5,function()
dofile(minetest.get_modpath("crafting").."/creative.lua")
crafting.set_creative_formspec(player, 0, 1)
return
end)
else
--init inventory
set_inventory(player)
end
--set hotbar size
--if player.hud_set_hotbar_itemcount then
--minetest.after(0.5, player.hud_set_hotbar_itemcount, player, 8)
--end
--add hotbar images
minetest.after(0.5,function()
player:hud_set_hotbar_image("crafting_hotbar.png")
player:hud_set_hotbar_selected_image("crafting_hotbar_selected.png")
if show_armor then
local armor_orginal = armor.set_player_armor
armor.set_player_armor = function(self, player)
armor_orginal(self, player)
update_armor(player)
minetest.after(0.5,function()
--set_inventory(player)
return
end)
end
end
end)
end)
minetest.register_node("crafting:workbench", {
description = "Workbench",
tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png",
"crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"},
paramtype2 = "facedir",
paramtype = "light",
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2, decorative = 1},
on_rightclick = function(pos, node, clicker, itemstack)
set_workbench(clicker)
end
})
minetest.register_craft({
output = "crafting:workbench",
recipe = {
{"group:wood", "group:wood"},
{"group:wood", "group:wood"}
}
})

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 186 B

View File

Before

Width:  |  Height:  |  Size: 288 B

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 451 B

After

Width:  |  Height:  |  Size: 451 B

View File

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 229 B

View File

Before

Width:  |  Height:  |  Size: 668 B

After

Width:  |  Height:  |  Size: 668 B

View File

Before

Width:  |  Height:  |  Size: 494 B

After

Width:  |  Height:  |  Size: 494 B

View File

Before

Width:  |  Height:  |  Size: 356 B

After

Width:  |  Height:  |  Size: 356 B

View File

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 402 B

View File

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

View File

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

View File

Before

Width:  |  Height:  |  Size: 283 B

After

Width:  |  Height:  |  Size: 283 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

View File

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 428 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 144 B

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 204 B

View File

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 432 B

View File

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 253 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 550 B

View File

Before

Width:  |  Height:  |  Size: 82 B

After

Width:  |  Height:  |  Size: 82 B

View File

Before

Width:  |  Height:  |  Size: 583 B

After

Width:  |  Height:  |  Size: 583 B

View File

Before

Width:  |  Height:  |  Size: 571 B

After

Width:  |  Height:  |  Size: 571 B

View File

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 447 B

View File

@ -1,31 +0,0 @@
multicraft mod "Crafting"
=======================
version: 2.0.1
License of source code and Textures: WTFPL
------------------------------------
Copyright (c) 2013-2014 BlockMen
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
--USING the mod--
=================
This mod changes the players inventory (survival and creative) with more slots (9*4 instead of 8*4)
Like known from Minecraft you have a 2x2 crafting grid at inventory now. Furthermore a categorized creative
inventory and a support for stu's 3d armor mod (To use the armor and a preview of player).
Left items in the crafting slots are dropped infront of you.
Workbench
=========
With following recipe you craft a workbench (aka crafting table):
wood wood
wood wood
The workbench has a 3x3 crafting grid, that allows to use all recipes.

View File

@ -1,3 +0,0 @@
default
crafting

View File

@ -1,9 +0,0 @@
inventory_plus = {}
function inventory_plus.set_inventory_formspec(player, formspec)
end
function inventory_plus.register_button(player,str1, str2)
end

View File

@ -1,6 +1,3 @@
creative = {}
local player_inventory = {}
if minetest.setting_getbool("creative_mode") then
local digtime = 1
minetest.register_item(":", {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

View File

@ -9,6 +9,8 @@ Version: 1.1 alpha
A simple mod that add to dungeons chests that contain some loot.
Configurable in many aspects, see "config.lua" for more details.
In MultiCraft Project this code has been changed:
I changed the drop in a few lines.
License:
~~~~~~~~

View File

@ -61,21 +61,6 @@ minetest.register_craft({
}
})
-- net
minetest.register_tool("mobs:net", {
description = "Net (right-click animal to put in inventory)",
inventory_image = "mobs_net.png",
})
minetest.register_craft({
output = "mobs:net",
recipe = {
{"default:stick", "", "default:stick"},
{"default:stick", "", "default:stick"},
{"farming:string", "default:stick", "farming:string"},
}
})
-- shears (right click to shear animal)
minetest.register_tool("mobs:shears", {
description = "Steel Shears (right-click to shear)",

View File

@ -1,99 +1,3 @@
-- Npc by TenPlus1
mobs.npc_drops = {
"default:pick_steel", "mobs:meat", "default:sword_steel",
"default:shovel_steel", "farming:bread", "bucket:bucket_water"
}
mobs:register_mob("mobs:npc", {
type = "npc",
passive = false,
damage = 3,
attack_type = "dogfight",
attacks_monsters = true,
reach = 2,
hp_min = 10,
hp_max = 20,
armor = 100,
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
visual = "mesh",
mesh = "character.b3d",
drawtype = "front",
textures = {
{"mobs_npc.png"},
{"mobs_npc2.png"}, -- female by nuttmeg20
},
child_texture = {
{"mobs_npc_baby.png"}, -- derpy baby by AmirDerAssassine
},
makes_footstep_sound = true,
sounds = {},
walk_velocity = 2,
run_velocity = 3,
jump = true,
drops = {
{name = "default:wood",
chance = 1, min = 1, max = 3},
{name = "default:apple",
chance = 2, min = 1, max = 2},
{name = "default:axe_stone",
chance = 5, min = 1, max = 1},
},
water_damage = 0,
lava_damage = 2,
light_damage = 0,
follow = {"farming:bread", "mobs:meat", "default:diamond"},
view_range = 15,
owner = "",
order = "follow",
animation = {
speed_normal = 30,
speed_run = 30,
stand_start = 0,
stand_end = 79,
walk_start = 168,
walk_end = 187,
run_start = 168,
run_end = 187,
punch_start = 200,
punch_end = 219,
},
on_rightclick = function(self, clicker)
-- feed to heal npc
if not mobs:feed_tame(self, clicker, 8, true, true) then
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
-- right clicking with gold lump drops random item from mobs.npc_drops
if item:get_name() == "default:gold_lump" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {
name = mobs.npc_drops[math.random(1, #mobs.npc_drops)]
})
return
else
-- if owner switch between follow and stand
if self.owner and self.owner == clicker:get_player_name() then
if self.order == "follow" then
self.order = "stand"
else
self.order = "follow"
end
end
end
end
mobs:capture_mob(self, clicker, 0, 5, 80, false, nil)
end,
})
mobs:register_spawn("mobs:npc", {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 0, 10000, 1, 31000)
mobs:register_egg("mobs:npc", "Npc", "default_brick.png", 1)
lifetimer = 1,
})

View File

@ -7,7 +7,7 @@ mobs:register_mob("mobs:rat", {
hp_min = 1,
hp_max = 4,
armor = 100,
collisionbox = {-0.2, -1, -0.2, 0.2, -0.8, 0.2},
collisionbox = {-0.25, -1, -0.25, 0.25, -0.8, 0.25},
visual = "mesh",
mesh = "mobs_rat.b3d",
textures = {

View File

@ -44,6 +44,6 @@ mobs:register_mob("mobs:skeleton", {
mobs:spawn_specific("mobs:skeleton",
{"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"},
{"air"},
0, 5, 0, 4000, 1, -31000, 31000
0, 7, 0, 4000, 1, -31000, 31000
)
--mobs:register_egg("mobs:skeleton", "Zombie", "zombie_head.png", 0)

View File

@ -51,7 +51,7 @@ mobs:register_mob("mobs:spider", {
mobs:spawn_specific("mobs:spider",
{"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"},
{"air"},
0, 5, 0, 5000, 1, -31000, 31000
0, 7, 0, 5000, 1, -31000, 31000
)
mobs:register_egg("mobs:spider", "Spider", "mobs_cobweb.png", 1)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 B

View File

@ -44,7 +44,7 @@ mobs:register_mob("mobs:zombie", {
mobs:spawn_specific("mobs:zombie",
{"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"},
{"air"},
0, 5, 0, 4000, 1, -31000, 31000
0, 7, 0, 4000, 1, -31000, 31000
)
mobs:register_egg("mobs:zombie", "Zombie", "zombie_head.png", 0)

View File

@ -1,15 +0,0 @@
[mod] visible wielded items [wieldview]
=======================================
depends: default, 3d_armor
Makes hand wielded items visible to other players.
default settings: [minetest.conf]
# Set number of seconds between visible wielded item updates.
wieldview_update_time = 2
# Show nodes as tiles, disabled by default
wieldview_node_tiles = false

View File

@ -1,2 +0,0 @@
default
3d_armor

View File

@ -1,76 +0,0 @@
local time = 0
local update_time = tonumber(minetest.setting_get("wieldview_update_time"))
if not update_time then
update_time = 2
minetest.setting_set("wieldview_update_time", tostring(update_time))
end
local node_tiles = minetest.setting_getbool("wieldview_node_tiles")
if not node_tiles then
node_tiles = false
minetest.setting_set("wieldview_node_tiles", "false")
end
wieldview = {
wielded_item = {},
transform = {},
}
dofile(minetest.get_modpath(minetest.get_current_modname()).."/transform.lua")
wieldview.get_item_texture = function(self, item)
local texture = "3d_armor_trans.png"
if item ~= "" then
if minetest.registered_items[item] then
if minetest.registered_items[item].inventory_image ~= "" then
texture = minetest.registered_items[item].inventory_image
elseif node_tiles == true and minetest.registered_items[item].tiles
and type(minetest.registered_items[item].tiles[1]) == "string"
and minetest.registered_items[item].tiles[1] ~= "" then
texture = minetest.inventorycube(minetest.registered_items[item].tiles[1])
end
end
if wieldview.transform[item] then
texture = texture.."^[transform"..wieldview.transform[item]
end
end
return texture
end
wieldview.update_wielded_item = function(self, player)
if not player then
return
end
local name = player:get_player_name()
local stack = player:get_wielded_item()
local item = stack:get_name()
if not item then
return
end
if self.wielded_item[name] then
if self.wielded_item[name] == item then
return
end
armor.textures[name].wielditem = self:get_item_texture(item)
armor:update_player_visuals(player)
end
self.wielded_item[name] = item
end
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
wieldview.wielded_item[name] = ""
minetest.after(0, function(player)
wieldview:update_wielded_item(player)
end, player)
end)
minetest.register_globalstep(function(dtime)
time = time + dtime
if time > update_time then
for _,player in ipairs(minetest.get_connected_players()) do
wieldview:update_wielded_item(player)
end
time = 0
end
end)

View File

@ -1,24 +0,0 @@
-- Wielded Item Transformations - http://dev.minetest.net/texture
wieldview.transform = {
["default:torch"]="R270",
["default:sapling"]="R270",
["flowers:dandelion_white"]="R270",
["flowers:dandelion_yellow"]="R270",
["flowers:orchid"]="R270",
["flowers:rose"]="R270",
["flowers:tulip"]="R270",
["flowers:allium"]="R270",
["bucket:bucket_empty"]="R270",
["bucket:bucket_water"]="R270",
["bucket:bucket_lava"]="R270",
["screwdriver:screwdriver"]="R270",
["screwdriver:screwdriver1"]="R270",
["screwdriver:screwdriver2"]="R270",
["screwdriver:screwdriver3"]="R270",
["screwdriver:screwdriver4"]="R270",
["vessels:glass_bottle"]="R270",
["vessels:drinking_glass"]="R270",
["vessels:steel_bottle"]="R270",
}

View File

@ -1136,7 +1136,7 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
<< strgettext("Continue") << "]";
if (!singleplayermode) {
os << "button_exit[1," << (ypos++) << ";3,0.5;btn_change_password;"
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_change_password;"
<< strgettext("Change Password") << "]";
}