Compare commits
236 Commits
0.3.0
...
0.4.dev-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74c6836f2f | ||
|
|
d8d6d0dc95 | ||
|
|
f6c6c4f917 | ||
|
|
918c507a66 | ||
|
|
1b61ca412b | ||
|
|
cd563473fa | ||
|
|
d26e19a296 | ||
|
|
a244e367ea | ||
|
|
347216d654 | ||
|
|
49e4f55b09 | ||
|
|
661ed387df | ||
|
|
ccfec0400f | ||
|
|
e109ed5cef | ||
|
|
b2c905d800 | ||
|
|
4bcff65ad0 | ||
|
|
e5d372f238 | ||
|
|
103d4793f0 | ||
|
|
2a610b011a | ||
|
|
cd030639a4 | ||
|
|
6d23fb2592 | ||
|
|
bc48cf076d | ||
|
|
be2ecf9186 | ||
|
|
d57aa531e1 | ||
|
|
bb898bf587 | ||
|
|
9d35e4fa6e | ||
|
|
bd1e5f4fc8 | ||
|
|
95951ce558 | ||
|
|
10a363ebf3 | ||
|
|
d6b30dd3a5 | ||
|
|
1c19f959db | ||
|
|
dde22d26a8 | ||
|
|
c8211ceb3e | ||
|
|
c910ead4db | ||
|
|
fe64f2b673 | ||
|
|
a91eb36277 | ||
|
|
026979e39d | ||
|
|
705f142b8d | ||
|
|
e880cc40e9 | ||
|
|
7bb4b7911b | ||
|
|
fadf248892 | ||
|
|
0f2b932e92 | ||
|
|
34bd1b3032 | ||
|
|
8924588511 | ||
|
|
6029d9e5a9 | ||
|
|
19a1ac1f34 | ||
|
|
30648d1cc9 | ||
|
|
842eb5da28 | ||
|
|
05df2ee8a4 | ||
|
|
ab3911ba9e | ||
|
|
013921782b | ||
|
|
c449e5f20a | ||
|
|
6e0de7b42c | ||
|
|
2e42391b86 | ||
|
|
21bd679076 | ||
|
|
fd8b9a3a44 | ||
|
|
5c1cb01936 | ||
|
|
ec4f58741b | ||
|
|
4ce6e5f0c5 | ||
|
|
a8a82e0b21 | ||
|
|
739cb87385 | ||
|
|
8492796a5c | ||
|
|
218b626016 | ||
|
|
f42c57d9a8 | ||
|
|
82a460ec90 | ||
|
|
b4e6ca63b5 | ||
|
|
1d36e68346 | ||
|
|
41c473cf5e | ||
|
|
b2ccbdffc1 | ||
|
|
769cc9879f | ||
|
|
0dbb31afeb | ||
|
|
1bfc3c1eb9 | ||
|
|
8bd178c2e5 | ||
|
|
b58dc083a9 | ||
|
|
65b2a2cb02 | ||
|
|
70363847aa | ||
|
|
1ce749c86a | ||
|
|
08c9b6037d | ||
|
|
57a2bd056c | ||
|
|
234bf99743 | ||
|
|
f93144fee7 | ||
|
|
945d01fd9e | ||
|
|
d99d27dcbe | ||
|
|
908db7c1d2 | ||
|
|
77337271fc | ||
|
|
c1479a2732 | ||
|
|
1f53ca5f4c | ||
|
|
425db289d5 | ||
|
|
d2eed169ae | ||
|
|
61ffe1eac4 | ||
|
|
9e7ad1e2aa | ||
|
|
ae9f183cda | ||
|
|
71bc20c453 | ||
|
|
ff1ae29f97 | ||
|
|
fdf6eecd59 | ||
|
|
651657edfd | ||
|
|
74770ab718 | ||
|
|
6153a2fb10 | ||
|
|
e5650bb549 | ||
|
|
18bb0ea1ea | ||
|
|
6a8f9135de | ||
|
|
704d8a62bf | ||
|
|
3b3ca65562 | ||
|
|
697ff926ce | ||
|
|
e8a9578774 | ||
|
|
0bf3a15886 | ||
|
|
cebc8c78a4 | ||
|
|
290e921920 | ||
|
|
94feb62b08 | ||
|
|
941176cd65 | ||
|
|
251b015210 | ||
|
|
616bad96af | ||
|
|
1b765b9740 | ||
|
|
0ce0c8fcfb | ||
|
|
811ac5ac3a | ||
|
|
901d98b687 | ||
|
|
4503b03b26 | ||
|
|
0e64406b06 | ||
|
|
1220b642eb | ||
|
|
cc03718d3c | ||
|
|
d7cb6146c8 | ||
|
|
4f021fc7dd | ||
|
|
498ebef357 | ||
|
|
cebbaf1664 | ||
|
|
227e067512 | ||
|
|
9d5b458479 | ||
|
|
8dd3622c6d | ||
|
|
564c3a9c96 | ||
|
|
4725e5c52e | ||
|
|
106027fc29 | ||
|
|
d1298fe5e7 | ||
|
|
eabfb370ac | ||
|
|
62164d955c | ||
|
|
a5545593ba | ||
|
|
f68fa667c8 | ||
|
|
7a29b14a20 | ||
|
|
df8346ef4d | ||
|
|
c0f6395cf0 | ||
|
|
50d63e4b0a | ||
|
|
6a417c538f | ||
|
|
7fae32095a | ||
|
|
37a5f8a30b | ||
|
|
f107967fdc | ||
|
|
a793533d1a | ||
|
|
3318d0b4b8 | ||
|
|
81f1cc662f | ||
|
|
28fe2987a0 | ||
|
|
26abf6fd82 | ||
|
|
594b189569 | ||
|
|
7696a38543 | ||
|
|
cde35d1606 | ||
|
|
9fc78cbece | ||
|
|
e4dff41560 | ||
|
|
2f2392f783 | ||
|
|
c3703ded95 | ||
|
|
e5fd010a6c | ||
|
|
ba762bcd49 | ||
|
|
6da8cb00e2 | ||
|
|
eed727c61b | ||
|
|
89e7bacd99 | ||
|
|
ff34955a0d | ||
|
|
a48a0e77eb | ||
|
|
cf6e22e9a6 | ||
|
|
c1202a2ecc | ||
|
|
01ae0daea5 | ||
|
|
45fc45a49e | ||
|
|
7bdc328a71 | ||
|
|
e71744b918 | ||
|
|
40e7a1a5c9 | ||
|
|
7878d9b3f6 | ||
|
|
9e1c4533b8 | ||
|
|
4b8e4dae58 | ||
|
|
0754f2a7af | ||
|
|
8d2d28f1dc | ||
|
|
e9620d9c8c | ||
|
|
de51f87e05 | ||
|
|
1afed48a2c | ||
|
|
c6fd2986d4 | ||
|
|
abceeee92f | ||
|
|
5fc791ac9a | ||
|
|
72884bf85f | ||
|
|
f97d4355be | ||
|
|
e19d1ea95a | ||
|
|
96b71236ed | ||
|
|
3b77a63d5d | ||
|
|
64fa59e24f | ||
|
|
79c9f14aec | ||
|
|
2ef414d05f | ||
|
|
77cf27b82b | ||
|
|
64996422c0 | ||
|
|
f8c9b70379 | ||
|
|
7b802c547d | ||
|
|
73bb3bc595 | ||
|
|
1320d07068 | ||
|
|
0b97ad8384 | ||
|
|
ddaff2d653 | ||
|
|
75a0ca6bd6 | ||
|
|
38944467d3 | ||
|
|
23adfff4fe | ||
|
|
b35adfbd2d | ||
|
|
526eedf98e | ||
|
|
dcedfdacd1 | ||
|
|
ea8d6d7abd | ||
|
|
f145d498a6 | ||
|
|
41c91391fc | ||
|
|
1ddfdc55dd | ||
|
|
a6a1e6ed1a | ||
|
|
f8430723e0 | ||
|
|
bfc68d3151 | ||
|
|
ee8b6d3444 | ||
|
|
2115a766f6 | ||
|
|
d1a5e97a7f | ||
|
|
7372282a72 | ||
|
|
bc0e5c0063 | ||
|
|
045e32b6ec | ||
|
|
fea55a9b87 | ||
|
|
763da10c7b | ||
|
|
1c98ec94da | ||
|
|
28660b4c1a | ||
|
|
fa72e65b59 | ||
|
|
7d5d676eac | ||
|
|
61f2cc45c2 | ||
|
|
c1d92d72e1 | ||
|
|
4f71a9fbde | ||
|
|
4142b8c352 | ||
|
|
d0fdfd44c5 | ||
|
|
f5995337e8 | ||
|
|
1469196d3b | ||
|
|
e9fd3def90 | ||
|
|
a2af490b7b | ||
|
|
4964daa5be | ||
|
|
718086f383 | ||
|
|
339b7588d2 | ||
|
|
0ac5f6a7ca | ||
|
|
1726b82a16 | ||
|
|
03db16d55b | ||
|
|
0c20973c17 |
4
.gitignore
vendored
@@ -21,3 +21,7 @@ src/jthread/libjthread.a
|
||||
debug.txt
|
||||
bin/debug.txt
|
||||
minetestmapper/map.png
|
||||
locale/
|
||||
src/lua/build/
|
||||
src/lua/CMakeFiles/
|
||||
*bak*
|
||||
|
||||
@@ -9,8 +9,8 @@ project(minetest)
|
||||
|
||||
# Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
|
||||
set(VERSION_MAJOR 0)
|
||||
set(VERSION_MINOR 3)
|
||||
set(VERSION_PATCH 0)
|
||||
set(VERSION_MINOR 4)
|
||||
set(VERSION_PATCH dev-20111201-0)
|
||||
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
|
||||
MESSAGE(STATUS "*** Will build version ${VERSION_STRING} ***")
|
||||
@@ -66,7 +66,7 @@ elseif(UNIX) # Linux, BSD etc
|
||||
set(EXAMPLE_CONF_DIR "share/doc/${PROJECT_NAME}")
|
||||
endif()
|
||||
|
||||
install(FILES "doc/README.txt" DESTINATION "${DOCDIR}")
|
||||
install(FILES "README.txt" DESTINATION "${DOCDIR}")
|
||||
install(FILES "doc/changelog.txt" DESTINATION "${DOCDIR}")
|
||||
install(FILES "minetest.conf.example" DESTINATION "${DOCDIR}")
|
||||
|
||||
|
||||
49
README.txt
@@ -54,12 +54,12 @@ Compiling on GNU/Linux:
|
||||
-----------------------
|
||||
|
||||
Install dependencies. Here's an example for Debian/Ubuntu:
|
||||
$ apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng12-dev libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev
|
||||
$ apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng12-dev libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev
|
||||
|
||||
Download source, extract (this is the URL to the latest of source repository, which might not work at all times):
|
||||
$ wget https://bitbucket.org/celeron55/minetest/get/tip.tar.gz
|
||||
$ tar xf tip.tar.gz
|
||||
$ cd minetest
|
||||
$ wget https://github.com/celeron55/minetest/tarball/master -O master.tar.gz
|
||||
$ tar xf master.tar.gz
|
||||
$ cd celeron55-minetest-286edd4 (or similar)
|
||||
|
||||
Build a version that runs directly from the source directory:
|
||||
$ cmake . -DRUN_IN_PLACE=1
|
||||
@@ -73,7 +73,7 @@ $ ./minetest
|
||||
- If you want to install it system-wide (or are making a distribution package), you will want to use -DRUN_IN_PLACE=0
|
||||
- You can build a bare server or a bare client by specifying -DBUILD_CLIENT=0 or -DBUILD_SERVER=0
|
||||
- You can select between Release and Debug build by -DCMAKE_BUILD_TYPE=<Debug or Release>
|
||||
- Note that the Debug build is considerably slower
|
||||
- Debug build is slower, but gives much more useful output in a debugger
|
||||
|
||||
Compiling on Windows:
|
||||
---------------------
|
||||
@@ -90,16 +90,18 @@ Compiling on Windows:
|
||||
http://www.winimage.com/zLibDll/index.html
|
||||
* Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip):
|
||||
http://www.winimage.com/zLibDll/index.html
|
||||
* gettext bibrary and tools:
|
||||
* Optional: gettext bibrary and tools:
|
||||
http://gnuwin32.sourceforge.net/downlinks/gettext.php
|
||||
- This is used for other UI languages. Feel free to leave it out.
|
||||
* And, of course, Minetest-c55:
|
||||
http://celeron.55.lt/~celeron55/minetest/download
|
||||
- Steps:
|
||||
- Select a directory called DIR hereafter in which you will operate.
|
||||
- Make sure you have CMake and a compiler installed.
|
||||
- Download all the other stuff to DIR and extract them into there. All those
|
||||
packages contain a nice base directory in them, which should end up being
|
||||
the direct subdirectories of DIR.
|
||||
- Download all the other stuff to DIR and extract them into there.
|
||||
("extract here", not "extract to packagename/")
|
||||
- All those packages contain a nice base directory in them, which
|
||||
should end up being the direct subdirectories of DIR.
|
||||
- You will end up with a directory structure like this (+=dir, -=file):
|
||||
-----------------
|
||||
+ DIR
|
||||
@@ -119,7 +121,7 @@ Compiling on Windows:
|
||||
+ lib
|
||||
+ include
|
||||
...
|
||||
+ gettext
|
||||
+ gettext (optional)
|
||||
+bin
|
||||
+include
|
||||
+lib
|
||||
@@ -163,7 +165,8 @@ Compiling on Windows:
|
||||
If using MSVC:
|
||||
- Open the generated minetest.sln
|
||||
- The project defaults to the "Debug" configuration. Make very sure to
|
||||
select "Release", unless you want to debug some stuff (it's slower)
|
||||
select "Release", unless you want to debug some stuff (it's slower
|
||||
and might not even work at all)
|
||||
- Build the ALL_BUILD project
|
||||
- Build the INSTALL project
|
||||
- You should now have a working game with the executable in
|
||||
@@ -176,6 +179,30 @@ Compiling on Windows:
|
||||
- You should now have a working game with the executable in
|
||||
DIR/minetest/bin/minetest.exe
|
||||
|
||||
Windows releases of minetest are built using a bat script like this:
|
||||
--------------------------------------------------------------------
|
||||
|
||||
set installpath="C:\tmp\minetest_install"
|
||||
set irrlichtpath="C:\tmp\irrlicht-1.7.2"
|
||||
|
||||
set sourcedir=%CD%
|
||||
set builddir=%sourcedir%\bvc10
|
||||
mkdir %builddir%
|
||||
pushd %builddir%
|
||||
cmake %sourcedir% -G "Visual Studio 10" -DIRRLICHT_SOURCE_DIR=%irrlichtpath% -DRUN_IN_PLACE=1 -DCMAKE_INSTALL_PREFIX=%installpath%
|
||||
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration=Release
|
||||
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" INSTALL.vcxproj /p:Configuration=Release
|
||||
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" PACKAGE.vcxproj /p:Configuration=Release
|
||||
popd
|
||||
|
||||
License of Minetest-c55 textures
|
||||
--------------------------------
|
||||
|
||||
This does not apply to texture packs made by others.
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
License of Minetest-c55
|
||||
-----------------------
|
||||
|
||||
|
||||
349
data/builtin.lua
Normal file
@@ -0,0 +1,349 @@
|
||||
--
|
||||
-- This file contains built-in stuff in Minetest implemented in Lua.
|
||||
--
|
||||
-- It is always loaded and executed after registration of the C API,
|
||||
-- before loading and running any mods.
|
||||
--
|
||||
|
||||
function basic_dump2(o)
|
||||
if type(o) == "number" then
|
||||
return tostring(o)
|
||||
elseif type(o) == "string" then
|
||||
return string.format("%q", o)
|
||||
elseif type(o) == "boolean" then
|
||||
return tostring(o)
|
||||
elseif type(o) == "function" then
|
||||
return "<function>"
|
||||
elseif type(o) == "userdata" then
|
||||
return "<userdata>"
|
||||
elseif type(o) == "nil" then
|
||||
return "nil"
|
||||
else
|
||||
error("cannot dump a " .. type(o))
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function dump2(o, name, dumped)
|
||||
name = name or "_"
|
||||
dumped = dumped or {}
|
||||
io.write(name, " = ")
|
||||
if type(o) == "number" or type(o) == "string" or type(o) == "boolean"
|
||||
or type(o) == "function" or type(o) == "nil"
|
||||
or type(o) == "userdata" then
|
||||
io.write(basic_dump2(o), "\n")
|
||||
elseif type(o) == "table" then
|
||||
if dumped[o] then
|
||||
io.write(dumped[o], "\n")
|
||||
else
|
||||
dumped[o] = name
|
||||
io.write("{}\n") -- new table
|
||||
for k,v in pairs(o) do
|
||||
local fieldname = string.format("%s[%s]", name, basic_dump2(k))
|
||||
dump2(v, fieldname, dumped)
|
||||
end
|
||||
end
|
||||
else
|
||||
error("cannot dump a " .. type(o))
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function dump(o, dumped)
|
||||
dumped = dumped or {}
|
||||
if type(o) == "number" then
|
||||
return tostring(o)
|
||||
elseif type(o) == "string" then
|
||||
return string.format("%q", o)
|
||||
elseif type(o) == "table" then
|
||||
if dumped[o] then
|
||||
return "<circular reference>"
|
||||
end
|
||||
dumped[o] = true
|
||||
local t = {}
|
||||
for k,v in pairs(o) do
|
||||
t[#t+1] = "" .. k .. " = " .. dump(v, dumped)
|
||||
end
|
||||
return "{" .. table.concat(t, ", ") .. "}"
|
||||
elseif type(o) == "boolean" then
|
||||
return tostring(o)
|
||||
elseif type(o) == "function" then
|
||||
return "<function>"
|
||||
elseif type(o) == "userdata" then
|
||||
return "<userdata>"
|
||||
elseif type(o) == "nil" then
|
||||
return "nil"
|
||||
else
|
||||
error("cannot dump a " .. type(o))
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Built-in node definitions. Also defined in C.
|
||||
--
|
||||
|
||||
minetest.register_nodedef_defaults({
|
||||
-- name intentionally not defined here
|
||||
drawtype = "normal",
|
||||
visual_scale = 1.0,
|
||||
tile_images = {"unknown_block.png"},
|
||||
inventory_image = "unknown_block.png",
|
||||
special_materials = {
|
||||
{image="", backface_culling=true},
|
||||
{image="", backface_culling=true},
|
||||
},
|
||||
alpha = 255,
|
||||
post_effect_color = {a=0, r=0, g=0, b=0},
|
||||
paramtype = "none",
|
||||
is_ground_content = false,
|
||||
light_propagates = false,
|
||||
sunlight_propagates = false,
|
||||
walkable = true,
|
||||
pointable = true,
|
||||
diggable = true,
|
||||
climbable = false,
|
||||
buildable_to = false,
|
||||
wall_mounted = false,
|
||||
often_contains_mineral = false,
|
||||
dug_item = "",
|
||||
extra_dug_item = "",
|
||||
extra_dug_item_rarity = 2,
|
||||
metadata_name = "",
|
||||
liquidtype = "none",
|
||||
liquid_alternative_flowing = "",
|
||||
liquid_alternative_source = "",
|
||||
liquid_viscosity = 0,
|
||||
light_source = 0,
|
||||
damage_per_second = 0,
|
||||
selection_box = {type="regular"},
|
||||
material = {
|
||||
diggablity = "normal",
|
||||
weight = 0,
|
||||
crackiness = 0,
|
||||
crumbliness = 0,
|
||||
cuttability = 0,
|
||||
flammability = 0,
|
||||
},
|
||||
cookresult_item = "", -- Cannot be cooked
|
||||
furnace_cooktime = 3.0,
|
||||
furnace_burntime = -1, -- Cannot be used as fuel
|
||||
})
|
||||
|
||||
minetest.register_node("air", {
|
||||
drawtype = "airlike",
|
||||
paramtype = "light",
|
||||
light_propagates = true,
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
air_equivalent = true,
|
||||
})
|
||||
|
||||
minetest.register_node("ignore", {
|
||||
drawtype = "airlike",
|
||||
paramtype = "none",
|
||||
light_propagates = false,
|
||||
sunlight_propagates = false,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true, -- A way to remove accidentally placed ignores
|
||||
air_equivalent = true,
|
||||
})
|
||||
|
||||
--
|
||||
-- stackstring manipulation functions
|
||||
-- example stackstring: 'CraftItem "apple" 4'
|
||||
-- example item: {type="CraftItem", name="apple"}
|
||||
-- example item: {type="ToolItem", name="SteelPick", wear="23272"}
|
||||
--
|
||||
|
||||
function stackstring_take_item(stackstring)
|
||||
if stackstring == nil then
|
||||
return '', nil
|
||||
end
|
||||
local stacktype = nil
|
||||
stacktype = string.match(stackstring,
|
||||
'([%a%d]+Item[%a%d]*)')
|
||||
if stacktype == "NodeItem" or stacktype == "CraftItem" then
|
||||
local itemtype = nil
|
||||
local itemname = nil
|
||||
local itemcount = nil
|
||||
itemtype, itemname, itemcount = string.match(stackstring,
|
||||
'([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)')
|
||||
itemcount = tonumber(itemcount)
|
||||
if itemcount == 0 then
|
||||
return '', nil
|
||||
elseif itemcount == 1 then
|
||||
return '', {type=itemtype, name=itemname}
|
||||
else
|
||||
return itemtype.." \""..itemname.."\" "..(itemcount-1),
|
||||
{type=itemtype, name=itemname}
|
||||
end
|
||||
elseif stacktype == "ToolItem" then
|
||||
local itemtype = nil
|
||||
local itemname = nil
|
||||
local itemwear = nil
|
||||
itemtype, itemname, itemwear = string.match(stackstring,
|
||||
'([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)')
|
||||
itemwear = tonumber(itemwear)
|
||||
return '', {type=itemtype, name=itemname, wear=itemwear}
|
||||
end
|
||||
end
|
||||
|
||||
function stackstring_put_item(stackstring, item)
|
||||
if item == nil then
|
||||
return stackstring, false
|
||||
end
|
||||
stackstring = stackstring or ''
|
||||
local stacktype = nil
|
||||
stacktype = string.match(stackstring,
|
||||
'([%a%d]+Item[%a%d]*)')
|
||||
stacktype = stacktype or ''
|
||||
if stacktype ~= '' and stacktype ~= item.type then
|
||||
return stackstring, false
|
||||
end
|
||||
if item.type == "NodeItem" or item.type == "CraftItem" then
|
||||
local itemtype = nil
|
||||
local itemname = nil
|
||||
local itemcount = nil
|
||||
itemtype, itemname, itemcount = string.match(stackstring,
|
||||
'([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)')
|
||||
itemtype = itemtype or item.type
|
||||
itemname = itemname or item.name
|
||||
if itemcount == nil then
|
||||
itemcount = 0
|
||||
end
|
||||
itemcount = itemcount + 1
|
||||
return itemtype.." \""..itemname.."\" "..itemcount, true
|
||||
elseif item.type == "ToolItem" then
|
||||
if stacktype ~= nil then
|
||||
return stackstring, false
|
||||
end
|
||||
local itemtype = nil
|
||||
local itemname = nil
|
||||
local itemwear = nil
|
||||
itemtype, itemname, itemwear = string.match(stackstring,
|
||||
'([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)')
|
||||
itemwear = tonumber(itemwear)
|
||||
return itemtype.." \""..itemname.."\" "..itemwear, true
|
||||
end
|
||||
return stackstring, false
|
||||
end
|
||||
|
||||
function stackstring_put_stackstring(stackstring, src)
|
||||
while src ~= '' do
|
||||
--print("src="..dump(src))
|
||||
src, item = stackstring_take_item(src)
|
||||
--print("src="..dump(src).." item="..dump(item))
|
||||
local success
|
||||
stackstring, success = stackstring_put_item(stackstring, item)
|
||||
if not success then
|
||||
return stackstring, false
|
||||
end
|
||||
end
|
||||
return stackstring, true
|
||||
end
|
||||
|
||||
function test_stackstring()
|
||||
local stack
|
||||
local item
|
||||
local success
|
||||
|
||||
stack, item = stackstring_take_item('NodeItem "TNT" 3')
|
||||
assert(stack == 'NodeItem "TNT" 2')
|
||||
assert(item.type == 'NodeItem')
|
||||
assert(item.name == 'TNT')
|
||||
|
||||
stack, item = stackstring_take_item('CraftItem "with spaces" 2')
|
||||
assert(stack == 'CraftItem "with spaces" 1')
|
||||
assert(item.type == 'CraftItem')
|
||||
assert(item.name == 'with spaces')
|
||||
|
||||
stack, item = stackstring_take_item('CraftItem "with spaces" 1')
|
||||
assert(stack == '')
|
||||
assert(item.type == 'CraftItem')
|
||||
assert(item.name == 'with spaces')
|
||||
|
||||
stack, item = stackstring_take_item('CraftItem "s8df2kj3" 0')
|
||||
assert(stack == '')
|
||||
assert(item == nil)
|
||||
|
||||
stack, item = stackstring_take_item('ToolItem "With Spaces" 32487')
|
||||
assert(stack == '')
|
||||
assert(item.type == 'ToolItem')
|
||||
assert(item.name == 'With Spaces')
|
||||
assert(item.wear == 32487)
|
||||
|
||||
stack, success = stackstring_put_item('NodeItem "With Spaces" 40',
|
||||
{type='NodeItem', name='With Spaces'})
|
||||
assert(stack == 'NodeItem "With Spaces" 41')
|
||||
assert(success == true)
|
||||
|
||||
stack, success = stackstring_put_item('CraftItem "With Spaces" 40',
|
||||
{type='CraftItem', name='With Spaces'})
|
||||
assert(stack == 'CraftItem "With Spaces" 41')
|
||||
assert(success == true)
|
||||
|
||||
stack, success = stackstring_put_item('ToolItem "With Spaces" 32487',
|
||||
{type='ToolItem', name='With Spaces'})
|
||||
assert(stack == 'ToolItem "With Spaces" 32487')
|
||||
assert(success == false)
|
||||
|
||||
stack, success = stackstring_put_item('NodeItem "With Spaces" 40',
|
||||
{type='ToolItem', name='With Spaces'})
|
||||
assert(stack == 'NodeItem "With Spaces" 40')
|
||||
assert(success == false)
|
||||
|
||||
assert(stackstring_put_stackstring('NodeItem "With Spaces" 2',
|
||||
'NodeItem "With Spaces" 1') == 'NodeItem "With Spaces" 3')
|
||||
end
|
||||
test_stackstring()
|
||||
|
||||
--
|
||||
-- craftitem helpers
|
||||
--
|
||||
|
||||
minetest.craftitem_place_item = function(item, placer, pos)
|
||||
--print("craftitem_place_item")
|
||||
--print("item: " .. dump(item))
|
||||
--print("placer: " .. dump(placer))
|
||||
--print("pos: " .. dump(pos))
|
||||
minetest.env:add_item(pos, 'CraftItem "' .. item .. '" 1')
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.craftitem_eat = function(hp_change)
|
||||
return function(item, user, pointed_thing) -- closure
|
||||
--print("craftitem_eat(" .. hp_change .. ")")
|
||||
--print("item: " .. dump(item))
|
||||
--print("user: " .. dump(user))
|
||||
--print("pointed_thing: " .. dump(pointed_thing))
|
||||
user:set_hp(user:get_hp() + hp_change)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Callback registration
|
||||
--
|
||||
|
||||
function make_registration()
|
||||
local t = {}
|
||||
local registerfunc = function(func) table.insert(t, func) end
|
||||
return t, registerfunc
|
||||
end
|
||||
|
||||
minetest.registered_on_chat_messages, minetest.register_on_chat_message = make_registration()
|
||||
minetest.registered_globalsteps, minetest.register_globalstep = make_registration()
|
||||
minetest.registered_on_placenodes, minetest.register_on_placenode = make_registration()
|
||||
minetest.registered_on_dignodes, minetest.register_on_dignode = make_registration()
|
||||
minetest.registered_on_punchnodes, minetest.register_on_punchnode = make_registration()
|
||||
minetest.registered_on_generateds, minetest.register_on_generated = make_registration()
|
||||
minetest.registered_on_newplayers, minetest.register_on_newplayer = make_registration()
|
||||
minetest.registered_on_respawnplayers, minetest.register_on_respawnplayer = make_registration()
|
||||
|
||||
-- END
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 498 B After Width: | Height: | Size: 498 B |
|
Before Width: | Height: | Size: 582 B After Width: | Height: | Size: 582 B |
BIN
data/clienttextures/unknown_object.png
Normal file
|
After Width: | Height: | Size: 489 B |
BIN
data/glass.png
|
Before Width: | Height: | Size: 1.3 KiB |
2
data/mods/bucket/depends.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
default
|
||||
|
||||
73
data/mods/bucket/init.lua
Normal file
@@ -0,0 +1,73 @@
|
||||
minetest.register_craft({
|
||||
output = 'CraftItem "bucket" 1',
|
||||
recipe = {
|
||||
{'CraftItem "steel_ingot"', '', 'CraftItem "steel_ingot"'},
|
||||
{'', 'CraftItem "steel_ingot"', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bucket", {
|
||||
image = "bucket.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "water_source" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||
player:add_to_inventory_later('CraftItem "bucket_water" 1')
|
||||
return true
|
||||
elseif n.name == "lava_source" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||
player:add_to_inventory_later('CraftItem "bucket_lava" 1')
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bucket_water", {
|
||||
image = "bucket_water.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "water_source" then
|
||||
-- unchanged
|
||||
elseif n.name == "water_flowing" or n.name == "lava_source" or n.name == "lava_flowing" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="water_source"})
|
||||
else
|
||||
minetest.env:add_node(pointed_thing.above, {name="water_source"})
|
||||
end
|
||||
player:add_to_inventory_later('CraftItem "bucket" 1')
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bucket_lava", {
|
||||
image = "bucket_lava.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "lava_source" then
|
||||
-- unchanged
|
||||
elseif n.name == "water_source" or n.name == "water_flowing" or n.name == "lava_flowing" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="lava_source"})
|
||||
else
|
||||
minetest.env:add_node(pointed_thing.above, {name="lava_source"})
|
||||
end
|
||||
player:add_to_inventory_later('CraftItem "bucket" 1')
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
})
|
||||
BIN
data/mods/bucket/textures/bucket.png
Normal file
|
After Width: | Height: | Size: 329 B |
BIN
data/mods/bucket/textures/bucket_lava.png
Normal file
|
After Width: | Height: | Size: 363 B |
BIN
data/mods/bucket/textures/bucket_water.png
Normal file
|
After Width: | Height: | Size: 369 B |
1386
data/mods/default/init.lua
Normal file
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 292 B |
|
Before Width: | Height: | Size: 597 B After Width: | Height: | Size: 597 B |
|
Before Width: | Height: | Size: 604 B After Width: | Height: | Size: 604 B |
|
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 279 B |
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 167 B |
|
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
|
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 151 B |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 613 B After Width: | Height: | Size: 613 B |
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |
|
Before Width: | Height: | Size: 830 B After Width: | Height: | Size: 830 B |
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 539 B After Width: | Height: | Size: 539 B |
|
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 603 B |
|
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 116 B |
|
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
BIN
data/mods/default/textures/glass.png
Normal file
|
After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 874 B After Width: | Height: | Size: 874 B |
|
Before Width: | Height: | Size: 856 B After Width: | Height: | Size: 856 B |
|
Before Width: | Height: | Size: 878 B After Width: | Height: | Size: 878 B |
|
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 591 B |
|
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 308 B |
|
Before Width: | Height: | Size: 672 B After Width: | Height: | Size: 672 B |
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
|
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 507 B |
|
Before Width: | Height: | Size: 395 B After Width: | Height: | Size: 395 B |
|
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
|
Before Width: | Height: | Size: 933 B After Width: | Height: | Size: 933 B |
|
Before Width: | Height: | Size: 936 B After Width: | Height: | Size: 936 B |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 952 B After Width: | Height: | Size: 952 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 965 B After Width: | Height: | Size: 965 B |
BIN
data/mods/default/textures/mud.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 303 B After Width: | Height: | Size: 303 B |
|
Before Width: | Height: | Size: 410 B After Width: | Height: | Size: 410 B |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 341 B |
|
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 242 B |
|
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
|
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 212 B |
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
|
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 507 B |
|
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 555 B |
|
Before Width: | Height: | Size: 545 B After Width: | Height: | Size: 545 B |
|
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 542 B |
|
Before Width: | Height: | Size: 920 B After Width: | Height: | Size: 920 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 772 B |
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 489 B |
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 598 B After Width: | Height: | Size: 598 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
|
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 190 B After Width: | Height: | Size: 190 B |
|
Before Width: | Height: | Size: 190 B After Width: | Height: | Size: 190 B |
|
Before Width: | Height: | Size: 190 B After Width: | Height: | Size: 190 B |
|
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 219 B |
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 182 B |
|
Before Width: | Height: | Size: 806 B After Width: | Height: | Size: 806 B |
BIN
data/mods/default/textures/tnt_bottom.png
Normal file
|
After Width: | Height: | Size: 161 B |
BIN
data/mods/default/textures/tnt_side.png
Normal file
|
After Width: | Height: | Size: 186 B |
BIN
data/mods/default/textures/tnt_top.png
Normal file
|
After Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 252 B |
|
Before Width: | Height: | Size: 927 B After Width: | Height: | Size: 927 B |
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |