4.16 release
@ -1,7 +1,7 @@
|
||||
Extreme Survival created by maikerumine<br>
|
||||
Minetest 0.4.14 mod: "Extreme Survival"<br>
|
||||
Minetest 0.4.16 mod: "Extreme Survival"<br>
|
||||
namespace: extreme_survival<br>
|
||||
(c) 2014-2016 by: maikerumine<br>
|
||||
(c) 2014-2017 by: maikerumine<br>
|
||||
https://github.com/maikerumine<br>
|
||||
LGPLv2.1 (SEE BOTTOM)<br>
|
||||
=======================
|
||||
|
7
mods/a_mapgen_mods/flowlib/README.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Waterlib
|
||||
================
|
||||
Simple flow functions for use in Minetest mods by Qwertymine3
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
WTFPL
|
146
mods/a_mapgen_mods/flowlib/init.lua
Normal file
@ -0,0 +1,146 @@
|
||||
flowlib = {}
|
||||
|
||||
--sum of direction vectors must match an array index
|
||||
local function to_unit_vector(dir_vector)
|
||||
--(sum,root)
|
||||
-- (0,1), (1,1+0=1), (2,1+1=2), (3,1+2^2=5), (4,2^2+2^2=8)
|
||||
local inv_roots = {[0] = 1, [1] = 1, [2] = 0.70710678118655, [4] = 0.5
|
||||
, [5] = 0.44721359549996, [8] = 0.35355339059327}
|
||||
local sum = dir_vector.x*dir_vector.x + dir_vector.z*dir_vector.z
|
||||
return {x=dir_vector.x*inv_roots[sum],y=dir_vector.y
|
||||
,z=dir_vector.z*inv_roots[sum]}
|
||||
end
|
||||
|
||||
local is_touching = function(realpos,nodepos,radius)
|
||||
local boarder = 0.5 - radius
|
||||
return (math.abs(realpos - nodepos) > (boarder))
|
||||
end
|
||||
|
||||
flowlib.is_touching = is_touching
|
||||
|
||||
local is_water = function(pos)
|
||||
return (minetest.get_item_group(minetest.get_node(
|
||||
{x=pos.x,y=pos.y,z=pos.z}).name
|
||||
, "water") ~= 0)
|
||||
end
|
||||
|
||||
flowlib.is_water = is_water
|
||||
|
||||
local node_is_water = function(node)
|
||||
return (minetest.get_item_group(node.name, "water") ~= 0)
|
||||
end
|
||||
|
||||
flowlib.node_is_water = node_is_water
|
||||
|
||||
local is_lava = function(pos)
|
||||
return (minetest.get_item_group(minetest.get_node(
|
||||
{x=pos.x,y=pos.y,z=pos.z}).name
|
||||
, "lava") ~= 0)
|
||||
end
|
||||
|
||||
flowlib.is_lava = is_lava
|
||||
|
||||
local node_is_lava = function(node)
|
||||
return (minetest.get_item_group(node.name, "lava") ~= 0)
|
||||
end
|
||||
|
||||
flowlib.node_is_lava = node_is_lava
|
||||
|
||||
|
||||
local is_liquid = function(pos)
|
||||
return (minetest.get_item_group(minetest.get_node(
|
||||
{x=pos.x,y=pos.y,z=pos.z}).name
|
||||
, "liquid") ~= 0)
|
||||
end
|
||||
|
||||
flowlib.is_liquid = is_liquid
|
||||
|
||||
local node_is_liquid = function(node)
|
||||
return (minetest.get_item_group(node.name, "liquid") ~= 0)
|
||||
end
|
||||
|
||||
flowlib.node_is_liquid = node_is_liquid
|
||||
|
||||
--This code is more efficient
|
||||
local function quick_flow_logic(node,pos_testing,direction)
|
||||
local name = node.name
|
||||
if minetest.registered_nodes[name].liquidtype == "source" then
|
||||
local node_testing = minetest.get_node(pos_testing)
|
||||
local param2_testing = node_testing.param2
|
||||
if minetest.registered_nodes[node_testing.name].liquidtype
|
||||
~= "flowing" then
|
||||
return 0
|
||||
else
|
||||
return direction
|
||||
end
|
||||
elseif minetest.registered_nodes[name].liquidtype == "flowing" then
|
||||
local node_testing = minetest.get_node(pos_testing)
|
||||
local param2_testing = node_testing.param2
|
||||
if minetest.registered_nodes[node_testing.name].liquidtype
|
||||
== "source" then
|
||||
return -direction
|
||||
elseif minetest.registered_nodes[node_testing.name].liquidtype
|
||||
== "flowing" then
|
||||
if param2_testing < node.param2 then
|
||||
if (node.param2 - param2_testing) > 6 then
|
||||
return -direction
|
||||
else
|
||||
return direction
|
||||
end
|
||||
elseif param2_testing > node.param2 then
|
||||
if (param2_testing - node.param2) > 6 then
|
||||
return direction
|
||||
else
|
||||
return -direction
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
local quick_flow = function(pos,node)
|
||||
local x = 0
|
||||
local z = 0
|
||||
|
||||
if not node_is_liquid(node) then
|
||||
return {x=0,y=0,z=0}
|
||||
end
|
||||
|
||||
x = x + quick_flow_logic(node,{x=pos.x-1,y=pos.y,z=pos.z},-1)
|
||||
x = x + quick_flow_logic(node,{x=pos.x+1,y=pos.y,z=pos.z}, 1)
|
||||
z = z + quick_flow_logic(node,{x=pos.x,y=pos.y,z=pos.z-1},-1)
|
||||
z = z + quick_flow_logic(node,{x=pos.x,y=pos.y,z=pos.z+1}, 1)
|
||||
|
||||
return to_unit_vector({x=x,y=0,z=z})
|
||||
end
|
||||
|
||||
flowlib.quick_flow = quick_flow
|
||||
|
||||
|
||||
--if not in water but touching, move centre to touching block
|
||||
--x has higher precedence than z
|
||||
--if pos changes with x, it affects z
|
||||
local move_centre = function(pos,realpos,node,radius)
|
||||
if is_touching(realpos.x,pos.x,radius) then
|
||||
if is_liquid({x=pos.x-1,y=pos.y,z=pos.z}) then
|
||||
node = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})
|
||||
pos = {x=pos.x-1,y=pos.y,z=pos.z}
|
||||
elseif is_liquid({x=pos.x+1,y=pos.y,z=pos.z}) then
|
||||
node = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z})
|
||||
pos = {x=pos.x+1,y=pos.y,z=pos.z}
|
||||
end
|
||||
end
|
||||
if is_touching(realpos.z,pos.z,radius) then
|
||||
if is_liquid({x=pos.x,y=pos.y,z=pos.z-1}) then
|
||||
node = minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})
|
||||
pos = {x=pos.x,y=pos.y,z=pos.z-1}
|
||||
elseif is_liquid({x=pos.x,y=pos.y,z=pos.z+1}) then
|
||||
node = minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})
|
||||
pos = {x=pos.x,y=pos.y,z=pos.z+1}
|
||||
end
|
||||
end
|
||||
return pos,node
|
||||
end
|
||||
|
||||
flowlib.move_centre = move_centre
|
1
mods/a_mapgen_mods/flowlib/mod.conf
Normal file
@ -0,0 +1 @@
|
||||
name = flowlib
|
7
mods/a_mapgen_mods/roadvalleys/README.txt
Normal file
@ -0,0 +1,7 @@
|
||||
roadvalleys 0.1.0 by paramat
|
||||
For Minetest 0.4.13 and later
|
||||
Depends default
|
||||
Licenses: Source code LGPL (2.1). Media (textures) CC BY-SA 3.0
|
||||
See license.txt for license information
|
||||
|
||||
Use with Minetest core mapgen 'valleys' only.
|
1
mods/a_mapgen_mods/roadvalleys/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
373
mods/a_mapgen_mods/roadvalleys/init.lua
Normal file
@ -0,0 +1,373 @@
|
||||
-- Parameters
|
||||
|
||||
local DEBUG = true
|
||||
|
||||
-- Mapgen valleys noises
|
||||
|
||||
local np_terrain_height = {
|
||||
offset = -10,
|
||||
scale = 50,
|
||||
spread = {x = 1024, y = 1024, z = 1024},
|
||||
seed = 5202,
|
||||
octaves = 6,
|
||||
persist = 0.4,
|
||||
lacunarity = 2.0,
|
||||
}
|
||||
|
||||
local np_valley_depth = {
|
||||
offset = 5,
|
||||
scale = 4,
|
||||
spread = {x = 512, y = 512, z = 512},
|
||||
seed = -1914,
|
||||
octaves = 1,
|
||||
persist = 0.0,
|
||||
lacunarity = 2.0,
|
||||
}
|
||||
|
||||
-- Mod noises
|
||||
|
||||
-- 2D noise for patha
|
||||
|
||||
local np_patha = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x = 1024, y = 1024, z = 1024},
|
||||
seed = 11711,
|
||||
octaves = 3,
|
||||
persist = 0.4
|
||||
}
|
||||
|
||||
-- 2D noise for pathb
|
||||
|
||||
local np_pathb = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x = 2048, y = 2048, z = 2048},
|
||||
seed = 8017,
|
||||
octaves = 4,
|
||||
persist = 0.4
|
||||
}
|
||||
|
||||
-- 2D noise for pathc
|
||||
|
||||
local np_pathc = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x = 4096, y = 4096, z = 4096},
|
||||
seed = 300707,
|
||||
octaves = 5,
|
||||
persist = 0.4
|
||||
}
|
||||
|
||||
-- 2D noise for pathd
|
||||
|
||||
local np_pathd = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x = 8192, y = 8192, z = 8192},
|
||||
seed = 80033,
|
||||
octaves = 6,
|
||||
persist = 0.4
|
||||
}
|
||||
|
||||
|
||||
-- Do files
|
||||
|
||||
dofile(minetest.get_modpath("roadvalleys") .. "/nodes.lua")
|
||||
|
||||
|
||||
-- Constants
|
||||
|
||||
local c_roadblack = minetest.get_content_id("roadvalleys:road_black")
|
||||
local c_roadslab = minetest.get_content_id("roadvalleys:road_black_slab")
|
||||
local c_roadwhite = minetest.get_content_id("roadvalleys:road_white")
|
||||
local c_concrete = minetest.get_content_id("roadvalleys:concrete")
|
||||
|
||||
local c_air = minetest.CONTENT_AIR
|
||||
local c_ignore = minetest.CONTENT_IGNORE
|
||||
local c_stone = minetest.get_content_id("default:stone")
|
||||
local c_sastone = minetest.get_content_id("default:sandstone")
|
||||
local c_destone = minetest.get_content_id("default:desert_stone")
|
||||
local c_ice = minetest.get_content_id("default:ice")
|
||||
local c_tree = minetest.get_content_id("default:tree")
|
||||
local c_leaves = minetest.get_content_id("default:leaves")
|
||||
local c_apple = minetest.get_content_id("default:apple")
|
||||
local c_jungletree = minetest.get_content_id("default:jungletree")
|
||||
local c_jungleleaves = minetest.get_content_id("default:jungleleaves")
|
||||
local c_pinetree = minetest.get_content_id("default:pine_tree")
|
||||
local c_pineneedles = minetest.get_content_id("default:pine_needles")
|
||||
local c_snow = minetest.get_content_id("default:snow")
|
||||
local c_acaciatree = minetest.get_content_id("default:acacia_tree")
|
||||
local c_acacialeaves = minetest.get_content_id("default:acacia_leaves")
|
||||
local c_aspentree = minetest.get_content_id("default:aspen_tree")
|
||||
local c_aspenleaves = minetest.get_content_id("default:aspen_leaves")
|
||||
local c_meselamp = minetest.get_content_id("default:meselamp")
|
||||
|
||||
|
||||
-- Initialise noise objects to nil
|
||||
|
||||
local nobj_terrain_height = nil
|
||||
local nobj_valley_depth = nil
|
||||
local nobj_patha = nil
|
||||
local nobj_pathb = nil
|
||||
local nobj_pathc = nil
|
||||
local nobj_pathd = nil
|
||||
|
||||
|
||||
-- Localise noise buffers
|
||||
|
||||
local nbuf_terrain_height = {}
|
||||
local nbuf_valley_depth = {}
|
||||
local nbuf_patha = {}
|
||||
local nbuf_pathb = {}
|
||||
local nbuf_pathc = {}
|
||||
local nbuf_pathd = {}
|
||||
|
||||
|
||||
-- Localise data buffer
|
||||
|
||||
local dbuf = {}
|
||||
|
||||
|
||||
-- On generated function
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if minp.y > 0 or maxp.y < 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local t1 = os.clock()
|
||||
|
||||
local x1 = maxp.x
|
||||
local y1 = maxp.y
|
||||
local z1 = maxp.z
|
||||
local x0 = minp.x
|
||||
local y0 = minp.y
|
||||
local z0 = minp.z
|
||||
|
||||
local sidelen = x1 - x0 + 1
|
||||
local emerlen = sidelen + 32
|
||||
local overlen = sidelen + 9
|
||||
local pmapdims = {x = overlen, y = overlen, z = 1}
|
||||
local pmapminp = {x = x0 - 5, y = z0 - 5}
|
||||
|
||||
nobj_terrain_height = nobj_terrain_height or
|
||||
minetest.get_perlin_map(np_terrain_height, pmapdims)
|
||||
nobj_valley_depth = nobj_valley_depth or
|
||||
minetest.get_perlin_map(np_valley_depth, pmapdims)
|
||||
nobj_patha = nobj_patha or minetest.get_perlin_map(np_patha, pmapdims)
|
||||
nobj_pathb = nobj_pathb or minetest.get_perlin_map(np_pathb, pmapdims)
|
||||
nobj_pathc = nobj_pathc or minetest.get_perlin_map(np_pathc, pmapdims)
|
||||
nobj_pathd = nobj_pathd or minetest.get_perlin_map(np_pathd, pmapdims)
|
||||
|
||||
local nvals_terrain_height =
|
||||
nobj_terrain_height:get2dMap_flat(pmapminp, nbuf_terrain_height)
|
||||
local nvals_valley_depth =
|
||||
nobj_valley_depth:get2dMap_flat(pmapminp, nbuf_valley_depth)
|
||||
local nvals_patha = nobj_patha:get2dMap_flat(pmapminp, nbuf_patha)
|
||||
local nvals_pathb = nobj_pathb:get2dMap_flat(pmapminp, nbuf_pathb)
|
||||
local nvals_pathc = nobj_pathc:get2dMap_flat(pmapminp, nbuf_pathc)
|
||||
local nvals_pathd = nobj_pathd:get2dMap_flat(pmapminp, nbuf_pathd)
|
||||
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
|
||||
local data = vm:get_data(dbuf)
|
||||
|
||||
local ni = 1
|
||||
for z = z0 - 5, z1 + 4 do
|
||||
local n_xprepatha = nil
|
||||
local n_xprepathb = nil
|
||||
local n_xprepathc = nil
|
||||
local n_xprepathd = nil
|
||||
-- x0 - 5, z0 - 5 is to setup initial values of 'xprepath_', 'zprepath_'
|
||||
for x = x0 - 5, x1 + 4 do
|
||||
local n_patha = nvals_patha[ni]
|
||||
local n_zprepatha = nvals_patha[(ni - overlen)]
|
||||
local n_pathb = nvals_pathb[ni]
|
||||
local n_zprepathb = nvals_pathb[(ni - overlen)]
|
||||
local n_pathc = nvals_pathc[ni]
|
||||
local n_zprepathc = nvals_pathc[(ni - overlen)]
|
||||
local n_pathd = nvals_pathd[ni]
|
||||
local n_zprepathd = nvals_pathd[(ni - overlen)]
|
||||
|
||||
if x >= x0 - 4 and z >= z0 - 4 then
|
||||
local n_terrain_height = nvals_terrain_height[ni]
|
||||
local n_valley_depth = nvals_valley_depth[ni]
|
||||
-- *** math.floor() fixes scattered bridge elements bug ***
|
||||
local tlevel = math.floor(n_terrain_height +
|
||||
(n_valley_depth * n_valley_depth))
|
||||
-- Add 6 to terrain level so that bridges pass over rivers
|
||||
local pathy = math.min(math.max(tlevel + 6, 7), 42)
|
||||
|
||||
if (n_patha >= 0 and n_xprepatha < 0) -- detect sign change of noise
|
||||
or (n_patha < 0 and n_xprepatha >= 0)
|
||||
or (n_patha >= 0 and n_zprepatha < 0)
|
||||
or (n_patha < 0 and n_zprepatha >= 0)
|
||||
|
||||
or (n_pathb >= 0 and n_xprepathb < 0)
|
||||
or (n_pathb < 0 and n_xprepathb >= 0)
|
||||
or (n_pathb >= 0 and n_zprepathb < 0)
|
||||
or (n_pathb < 0 and n_zprepathb >= 0)
|
||||
|
||||
or (n_pathc >= 0 and n_xprepathc < 0)
|
||||
or (n_pathc < 0 and n_xprepathc >= 0)
|
||||
or (n_pathc >= 0 and n_zprepathc < 0)
|
||||
or (n_pathc < 0 and n_zprepathc >= 0)
|
||||
|
||||
or (n_pathd >= 0 and n_xprepathd < 0)
|
||||
or (n_pathd < 0 and n_xprepathd >= 0)
|
||||
or (n_pathd >= 0 and n_zprepathd < 0)
|
||||
or (n_pathd < 0 and n_zprepathd >= 0) then
|
||||
-- scan disk 5 nodes above path
|
||||
local tunnel = false
|
||||
local excatop
|
||||
|
||||
for zz = z - 4, z + 4 do
|
||||
local vi = area:index(x - 4, pathy + 5, zz)
|
||||
for xx = x - 4, x + 4 do
|
||||
local nodid = data[vi]
|
||||
if nodid == c_stone
|
||||
or nodid == c_destone
|
||||
or nodid == c_sastone
|
||||
or nodid == c_ice then
|
||||
tunnel = true
|
||||
end
|
||||
vi = vi + 1
|
||||
end
|
||||
end
|
||||
|
||||
if tunnel then
|
||||
excatop = pathy + 5
|
||||
else
|
||||
excatop = y1
|
||||
end
|
||||
-- place path node brush
|
||||
local vi = area:index(x, pathy, z)
|
||||
data[vi] = c_roadwhite
|
||||
|
||||
for k = -4, 4 do
|
||||
local vi = area:index(x - 4, pathy, z + k)
|
||||
for i = -4, 4 do
|
||||
local radsq = (math.abs(i)) ^ 2 + (math.abs(k)) ^ 2
|
||||
if radsq <= 13 then
|
||||
local nodid = data[vi]
|
||||
if nodid ~= c_roadwhite then
|
||||
data[vi] = c_roadblack
|
||||
end
|
||||
elseif radsq <= 25 then
|
||||
local nodid = data[vi]
|
||||
if nodid ~= c_roadblack
|
||||
and nodid ~= c_roadwhite then
|
||||
data[vi] = c_roadslab
|
||||
end
|
||||
end
|
||||
vi = vi + 1
|
||||
end
|
||||
end
|
||||
-- foundations or bridge structure
|
||||
for k = -4, 4 do
|
||||
local vi = area:index(x - 4, pathy - 1, z + k)
|
||||
for i = -4, 4 do
|
||||
local radsq = (math.abs(i)) ^ 2 + (math.abs(k)) ^ 2
|
||||
if radsq <= 25 then
|
||||
local nodid = data[vi]
|
||||
if nodid ~= c_roadblack
|
||||
and nodid ~= c_roadwhite
|
||||
and nodid ~= c_roadslab then
|
||||
data[vi] = c_concrete
|
||||
end
|
||||
end
|
||||
if radsq <= 2 then
|
||||
local viu = vi - emerlen
|
||||
local nodid = data[viu]
|
||||
if nodid ~= c_roadblack
|
||||
and nodid ~= c_roadwhite
|
||||
and nodid ~= c_roadslab then
|
||||
data[viu] = c_concrete
|
||||
end
|
||||
end
|
||||
vi = vi + 1
|
||||
end
|
||||
end
|
||||
-- bridge columns
|
||||
if math.random() <= 0.0625 then
|
||||
for xx = x - 1, x + 1 do
|
||||
for zz = z - 1, z + 1 do
|
||||
local vi = area:index(xx, pathy - 3, zz)
|
||||
for y = pathy - 3, y0 - 16, -1 do
|
||||
local nodid = data[vi]
|
||||
if nodid == c_stone
|
||||
or nodid == c_destone
|
||||
or nodid == c_sastone then
|
||||
break
|
||||
else
|
||||
data[vi] = c_concrete
|
||||
end
|
||||
vi = vi - emerlen
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- excavate above path
|
||||
for y = pathy + 1, excatop do
|
||||
for zz = z - 4, z + 4 do
|
||||
local vi = area:index(x - 4, y, zz)
|
||||
for xx = x - 4, x + 4 do
|
||||
local nodid = data[vi]
|
||||
if tunnel and y == excatop then -- tunnel ceiling
|
||||
if nodid ~= c_air
|
||||
and nodid ~= c_ignore
|
||||
and nodid ~= c_meselamp then
|
||||
if (math.abs(zz - z) == 4
|
||||
or math.abs(xx - x) == 4)
|
||||
and math.random() <= 0.2 then
|
||||
data[vi] = c_meselamp
|
||||
else
|
||||
data[vi] = c_concrete
|
||||
end
|
||||
end
|
||||
elseif y <= pathy + 5 then
|
||||
if nodid ~= c_roadblack
|
||||
and nodid ~= c_roadslab
|
||||
and nodid ~= c_roadwhite then
|
||||
data[vi] = c_air
|
||||
end
|
||||
elseif nodid == c_tree
|
||||
or nodid == c_leaves
|
||||
or nodid == c_apple
|
||||
or nodid == c_jungletree
|
||||
or nodid == c_jungleleaves
|
||||
or nodid == c_pinetree
|
||||
or nodid == c_pineneedles
|
||||
or nodid == c_snow
|
||||
or nodid == c_acaciatree
|
||||
or nodid == c_acacialeaves
|
||||
or nodid == c_aspentree
|
||||
or nodid == c_aspenleaves then
|
||||
data[vi] = c_air
|
||||
end
|
||||
vi = vi + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
n_xprepatha = n_patha
|
||||
n_xprepathb = n_pathb
|
||||
n_xprepathc = n_pathc
|
||||
n_xprepathd = n_pathd
|
||||
ni = ni + 1
|
||||
end
|
||||
end
|
||||
|
||||
vm:set_data(data)
|
||||
vm:set_lighting({day = 0, night = 0})
|
||||
vm:calc_lighting()
|
||||
vm:write_to_map(data)
|
||||
|
||||
local chugent = math.ceil((os.clock() - t1) * 1000)
|
||||
if DEBUG then
|
||||
print ("[roadvalleys] "..chugent.." ms")
|
||||
end
|
||||
end)
|
49
mods/a_mapgen_mods/roadvalleys/license.txt
Normal file
@ -0,0 +1,49 @@
|
||||
License of source code
|
||||
----------------------
|
||||
Copyright (C) 2016-2017 paramat
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms
|
||||
of the GNU Lesser General Public License as published by the Free Software Foundation;
|
||||
either version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details:
|
||||
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||
|
||||
|
||||
License of media (textures)
|
||||
---------------------------
|
||||
Copyright (C) 2016 paramat
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
|
||||
You are free to:
|
||||
|
||||
Share — copy and redistribute the material in any medium or format
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
43
mods/a_mapgen_mods/roadvalleys/nodes.lua
Normal file
@ -0,0 +1,43 @@
|
||||
minetest.register_node("roadvalleys:road_black", {
|
||||
description = "Road Black",
|
||||
tiles = {"roadvalleys_road_black.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("roadvalleys:road_black_slab", {
|
||||
description = "Road Black Slab",
|
||||
tiles = {"roadvalleys_road_black.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}},
|
||||
},
|
||||
groups = {cracky = 2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("roadvalleys:road_white", {
|
||||
description = "Road White",
|
||||
tiles = {"roadvalleys_road_white.png"},
|
||||
paramtype = "light",
|
||||
--light_source = 12,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("roadvalleys:concrete", {
|
||||
description = "Concrete",
|
||||
tiles = {"roadvalleys_concrete.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
BIN
mods/a_mapgen_mods/roadvalleys/textures/roadvalleys_concrete.png
Normal file
After Width: | Height: | Size: 155 B |
After Width: | Height: | Size: 480 B |
After Width: | Height: | Size: 136 B |
17
mods/a_mapgen_mods/tsm_railcorridors/README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Railway corridors [`tsm_railcorridors`]
|
||||
MineClone 2 adaption. NO TREASURER SUPPORT!
|
||||
|
||||
* Current version 0.11.0
|
||||
|
||||
Minetest mod for adding underground corridors with rails and wood constructions with
|
||||
a few treasure chests now and then. Optional Treasurer support is available for adding
|
||||
treasures from various mods.
|
||||
|
||||
Use the advanced settings to finetune the railway corridors.
|
||||
|
||||
* Forum thread: https://forum.minetest.net/viewtopic.php?t=10339
|
||||
* License: MIT License.
|
||||
|
||||
## Info for modders
|
||||
Want to include this mod in a subgame, but you hate the dependencies?
|
||||
You can edit the node names in gameconfig.lua to fit your needs. :-)
|
3
mods/a_mapgen_mods/tsm_railcorridors/depends.txt
Normal file
@ -0,0 +1,3 @@
|
||||
default
|
||||
tnt
|
||||
farming
|
1
mods/a_mapgen_mods/tsm_railcorridors/description.txt
Normal file
@ -0,0 +1 @@
|
||||
Adds simple underground mines with railways and occasional treasure chests.
|
98
mods/a_mapgen_mods/tsm_railcorridors/gameconfig.lua
Normal file
@ -0,0 +1,98 @@
|
||||
-- This file stores the various node types. This makes it easier to plug this mod into subgames
|
||||
-- in which you need to change the node names.
|
||||
|
||||
-- Adapted for MineClone 2!
|
||||
|
||||
-- Node names (Don't use aliases!)
|
||||
tsm_railcorridors.nodes = {
|
||||
dirt = "default:dirt",
|
||||
chest = "default:chest",
|
||||
rail = "carts:rail",
|
||||
torch_floor = "default:torch",
|
||||
torch_wall = "default:torch_wall",
|
||||
|
||||
--[[ Wood types for the corridors. Corridors are made out of full wood blocks
|
||||
and posts. For each corridor system, a random wood type is chosen with the chance
|
||||
specified in per mille. ]]
|
||||
corridor_woods = {
|
||||
{ wood = "default:wood", post = "default:fence_wood", chance = 900},
|
||||
{ wood = "default:junglewood", post = "default:fence_junglewood", chance = 100},
|
||||
},
|
||||
}
|
||||
|
||||
-- Fallback function. Returns a random treasure. This function is called for chests
|
||||
-- only if the Treasurer mod is not found.
|
||||
-- pr: A PseudoRandom object
|
||||
function tsm_railcorridors.get_default_treasure(pr)
|
||||
-- UNUSED IN MINECLONE 2!
|
||||
end
|
||||
|
||||
-- MineClone 2's treasure function. Gets all treasures for a single chest.
|
||||
-- Based on information from Minecraft Wiki.
|
||||
function tsm_railcorridors.get_treasures(pr)
|
||||
local items = {}
|
||||
-- First roll
|
||||
local r1 = pr:next(1,71)
|
||||
if r1 <= 30 then
|
||||
table.insert(items, "mobs:nametag")
|
||||
elseif r1 <= 50 then
|
||||
table.insert(items, "farming:carrot_gold")
|
||||
elseif r1 <= 60 then
|
||||
-- TODO: Enchanted Book
|
||||
table.insert(items, "default:book")
|
||||
elseif r1 <= 65 then
|
||||
-- Nothing!
|
||||
elseif r1 <= 70 then
|
||||
table.insert(items, "default:pick_steel")
|
||||
else
|
||||
-- TODO: Enchanted Golden Apple
|
||||
table.insert(items, "farming:carrot_gold")
|
||||
end
|
||||
|
||||
-- Second roll
|
||||
local r2stacks = pr:next(2,4)
|
||||
for i=1, r2stacks do
|
||||
local r2 = pr:next(1,83)
|
||||
if r2 <= 15 then
|
||||
table.insert(items, "farming:bread "..pr:next(1,3))
|
||||
elseif r2 <= 25 then
|
||||
table.insert(items, "default:coal_lump "..pr:next(3,8))
|
||||
elseif r2 <= 35 then
|
||||
table.insert(items, "farming:tomato "..pr:next(2,4))
|
||||
elseif r2 <= 45 then
|
||||
table.insert(items, "farming:melon_slice "..pr:next(2,4))
|
||||
elseif r2 <= 55 then
|
||||
table.insert(items, "farming:carrot "..pr:next(2,4))
|
||||
elseif r2 <= 65 then
|
||||
table.insert(items, "default:steel_ingot "..pr:next(1,5))
|
||||
elseif r2 <= 70 then
|
||||
table.insert(items, "dye:blue "..pr:next(4,9))
|
||||
elseif r2 <= 75 then
|
||||
table.insert(items, "default:mese_crystal_fragment "..pr:next(4,9))
|
||||
elseif r2 <= 80 then
|
||||
table.insert(items, "default:gold_ingot "..pr:next(1,3))
|
||||
else
|
||||
table.insert(items, "default:diamond "..pr:next(1,2))
|
||||
end
|
||||
end
|
||||
|
||||
-- Third roll
|
||||
for i=1, 3 do
|
||||
local r3 = pr:next(1,50)
|
||||
if r3 <= 20 then
|
||||
table.insert(items, "carts:rail "..pr:next(4,8))
|
||||
elseif r3 <= 35 then
|
||||
table.insert(items, "default:torch "..pr:next(1,16))
|
||||
elseif r3 <= 40 then
|
||||
-- TODO: Activator Rail
|
||||
table.insert(items, "carts:rail "..pr:next(1,4))
|
||||
elseif r3 <= 45 then
|
||||
-- TODO: Detector Rail
|
||||
table.insert(items, "carts:rail "..pr:next(1,4))
|
||||
else
|
||||
table.insert(items, "carts:powerrail "..pr:next(1,4))
|
||||
end
|
||||
end
|
||||
|
||||
return items
|
||||
end
|
580
mods/a_mapgen_mods/tsm_railcorridors/init.lua
Normal file
@ -0,0 +1,580 @@
|
||||
tsm_railcorridors = {}
|
||||
|
||||
-- Load node names
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/gameconfig.lua")
|
||||
|
||||
-- Settings
|
||||
local setting
|
||||
|
||||
-- Probability function
|
||||
-- TODO: Check if this is correct
|
||||
local P = function (float)
|
||||
return math.floor(32767 * float)
|
||||
end
|
||||
|
||||
-- Wahrscheinlichkeit für jeden Chunk, solche Gänge mit Schienen zu bekommen
|
||||
-- Probability for every newly generated chunk to get corridors
|
||||
local probability_railcaves_in_chunk = P(0.3)
|
||||
setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_railcaves_in_chunk"))
|
||||
if setting then
|
||||
probability_railcaves_in_chunk = P(setting)
|
||||
end
|
||||
|
||||
-- Innerhalb welcher Parameter soll sich die Pfadlänge bewegen? (Forks heben den Maximalwert auf)
|
||||
-- Minimal and maximal value of path length (forks don't look up this value)
|
||||
local way_min = 4;
|
||||
local way_max = 7;
|
||||
setting = tonumber(minetest.setting_get("tsm_railcorridors_way_min"))
|
||||
if setting then
|
||||
way_min = setting
|
||||
end
|
||||
setting = tonumber(minetest.setting_get("tsm_railcorridors_way_max"))
|
||||
if setting then
|
||||
way_max = setting
|
||||
end
|
||||
|
||||
-- Wahrsch. für jeden geraden Teil eines Korridors, Fackeln zu bekommen
|
||||
-- Probability for every horizontal part of a corridor to be with torches
|
||||
local probability_torches_in_segment = P(0.5)
|
||||
setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_torches_in_segment"))
|
||||
if setting then
|
||||
probability_torches_in_segment = P(setting)
|
||||
end
|
||||
|
||||
-- Wahrsch. für jeden Teil eines Korridors, nach oben oder nach unten zu gehen
|
||||
-- Probability for every part of a corridor to go up or down
|
||||
local probability_up_or_down = P(0.2)
|
||||
setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_up_or_down"))
|
||||
if setting then
|
||||
probability_up_or_down = P(setting)
|
||||
end
|
||||
|
||||
-- Wahrscheinlichkeit für jeden Teil eines Korridors, sich zu verzweigen – vorsicht, wenn fast jeder Gang sich verzweigt, kann der Algorithums unlösbar werden und MT hängt sich auf
|
||||
-- Probability for every part of a corridor to fork – caution, too high values may cause MT to hang on.
|
||||
local probability_fork = P(0.04)
|
||||
setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_fork"))
|
||||
if setting then
|
||||
probability_fork = P(setting)
|
||||
end
|
||||
|
||||
-- Wahrscheinlichkeit für jeden geraden Teil eines Korridors eine Kiste zu enthalten
|
||||
-- Probability for every part of a corridor to contain a chest
|
||||
local probability_chest = P(0.05)
|
||||
setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_chest"))
|
||||
if setting then
|
||||
probability_chest = P(setting)
|
||||
end
|
||||
|
||||
-- Probability for a rail corridor system to be damaged
|
||||
local probability_damage = P(0.90)
|
||||
setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_damage"))
|
||||
if setting then
|
||||
probability_damage = P(setting)
|
||||
end
|
||||
|
||||
-- Max. and min. heights between rail corridors are generated
|
||||
--local height_min = mcl_vars.mg_bedrock_overworld_max + 5 -- FIXME: Above lava layers
|
||||
local height_min = -958
|
||||
--local height_max = mcl_util.layer_to_y(60)
|
||||
local height_max = -23
|
||||
|
||||
-- Chaos Mode: If enabled, rail corridors don't stop generating when hitting obstacles
|
||||
local chaos_mode = minetest.setting_getbool("tsm_railcorridors_chaos") or false
|
||||
|
||||
-- Parameter Ende
|
||||
|
||||
-- random generator
|
||||
local pr
|
||||
local pr_initialized = false
|
||||
|
||||
local function InitRandomizer(seed)
|
||||
pr = PseudoRandom(seed)
|
||||
pr_initialized = true
|
||||
end
|
||||
|
||||
|
||||
-- Checks if the mapgen is allowed to carve through this structure and only sets
|
||||
-- the node if it is allowed. Does never build in liquids.
|
||||
-- If check_above is true, don't build if the node above is attached (e.g. rail)
|
||||
-- or a liquid.
|
||||
local function SetNodeIfCanBuild(pos, node, check_above)
|
||||
if check_above then
|
||||
local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
|
||||
local abovedef = minetest.registered_nodes[abovename]
|
||||
if abovename == "unknown" or abovename == "ignore" or (abovedef.groups and abovedef.groups.attached_node) or abovedef.liquidtype ~= "none" then
|
||||
return false
|
||||
end
|
||||
end
|
||||
local name = minetest.get_node(pos).name
|
||||
local def = minetest.registered_nodes[name]
|
||||
if name ~= "unknown" and name ~= "ignore" and def.is_ground_content and def.liquidtype == "none" then
|
||||
minetest.set_node(pos, node)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Tries to place a rail, taking the damage chance into account
|
||||
local function PlaceRail(pos, damage_chance)
|
||||
if damage_chance ~= nil and damage_chance > 0 then
|
||||
local x = pr:next(0,100)
|
||||
if x <= damage_chance then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return SetNodeIfCanBuild(pos, {name=tsm_railcorridors.nodes.rail})
|
||||
end
|
||||
|
||||
-- Returns true if the node as point can be considered “ground”, that is, a solid material
|
||||
-- in which mine shafts can be built into, e.g. stone, but not air or water
|
||||
local function IsGround(pos)
|
||||
local nodename = minetest.get_node(pos).name
|
||||
local nodedef = minetest.registered_nodes[nodename]
|
||||
return nodename ~= "unknown" and nodename ~= "ignore" and nodedef.is_ground_content and nodedef.walkable and nodedef.liquidtype == "none"
|
||||
end
|
||||
|
||||
-- Returns true if rails are allowed to be placed on top of this node
|
||||
local function IsRailSurface(pos)
|
||||
local nodename = minetest.get_node(pos).name
|
||||
local nodedef = minetest.registered_nodes[nodename]
|
||||
return nodename ~= "unknown" and nodename ~= "ignore" and nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular")
|
||||
end
|
||||
|
||||
-- Checks if the node is empty space which requires to be filled by a platform
|
||||
local function NeedsPlatform(pos)
|
||||
local node = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
|
||||
local node2 = minetest.get_node({x=pos.x,y=pos.y-2,z=pos.z})
|
||||
local nodedef = minetest.registered_nodes[node.name]
|
||||
return node.name ~= "ignore" and node.name ~= "unknown" and nodedef.is_ground_content and ((nodedef.walkable == false and node2.name ~= tsm_railcorridors.nodes.dirt) or (nodedef.groups and nodedef.groups.falling_node))
|
||||
end
|
||||
|
||||
-- Create a cube filled with the specified nodes
|
||||
-- Specialties:
|
||||
-- * Avoids floating rails for non-solid nodes like air
|
||||
-- Returns true if all nodes could be set
|
||||
-- Returns false if setting one or more nodes failed
|
||||
local function Cube(p, radius, node)
|
||||
local y_top = p.y+radius
|
||||
local nodedef = minetest.registered_nodes[node.name]
|
||||
local solid = nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodedef.liquidtype == "none"
|
||||
-- Check if all the nodes could be set
|
||||
local built_all = true
|
||||
for zi = p.z-radius, p.z+radius do
|
||||
for yi = y_top, p.y-radius, -1 do
|
||||
for xi = p.x-radius, p.x+radius do
|
||||
local ok = false
|
||||
if not solid and yi == y_top then
|
||||
local topdef = minetest.registered_nodes[minetest.get_node({x=xi,y=yi+1,z=zi}).name]
|
||||
if not (topdef.groups and topdef.groups.attached_node) and topdef.liquidtype == "none" then
|
||||
ok = true
|
||||
end
|
||||
else
|
||||
ok = true
|
||||
end
|
||||
local built = false
|
||||
if ok then
|
||||
built = SetNodeIfCanBuild({x=xi,y=yi,z=zi}, node)
|
||||
end
|
||||
if not built then
|
||||
built_all = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return built_all
|
||||
end
|
||||
|
||||
local function Platform(p, radius, node)
|
||||
for zi = p.z-radius, p.z+radius do
|
||||
for xi = p.x-radius, p.x+radius do
|
||||
local np = NeedsPlatform({x=xi,y=p.y,z=zi})
|
||||
if np then
|
||||
minetest.set_node({x=xi,y=p.y-1,z=zi}, node)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Random chest items
|
||||
-- Zufälliger Kisteninhalt
|
||||
|
||||
-- chests
|
||||
local function Place_Chest(pos, param2)
|
||||
if SetNodeIfCanBuild(pos, {name=tsm_railcorridors.nodes.chest, param2=param2}) then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local items = tsm_railcorridors.get_treasures(pr)
|
||||
for i=1, math.min(#items, inv:get_size("main")) do
|
||||
inv:set_stack("main", i, ItemStack(items[i]))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function WoodBulk(pos, wood)
|
||||
SetNodeIfCanBuild({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=wood})
|
||||
SetNodeIfCanBuild({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=wood})
|
||||
SetNodeIfCanBuild({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=wood})
|
||||
SetNodeIfCanBuild({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=wood})
|
||||
end
|
||||
|
||||
-- Gänge mit Schienen
|
||||
-- Corridors with rails
|
||||
|
||||
-- Returns <success>, <segments>
|
||||
-- success: true if corridor could be placed entirely
|
||||
-- segments: Number of segments successfully placed
|
||||
local function corridor_part(start_point, segment_vector, segment_count, wood, post, is_final)
|
||||
local p = {x=start_point.x, y=start_point.y, z=start_point.z}
|
||||
local torches = pr:next() < probability_torches_in_segment
|
||||
local dir = {0, 0}
|
||||
local torchdir = {1, 1}
|
||||
local node_wood = {name=wood}
|
||||
local node_fence = {name=post}
|
||||
if segment_vector.x == 0 and segment_vector.z ~= 0 then
|
||||
dir = {1, 0}
|
||||
torchdir = {5, 4}
|
||||
elseif segment_vector.x ~= 0 and segment_vector.z == 0 then
|
||||
dir = {0, 1}
|
||||
torchdir = {3, 2}
|
||||
end
|
||||
for segmentindex = 0, segment_count-1 do
|
||||
local dug = Cube(p, 1, {name="air"})
|
||||
if not chaos_mode and segmentindex > 0 and not dug then return false, segmentindex end
|
||||
-- Add wooden platform, if neccessary. To avoid floating rails
|
||||
if segment_vector.y == 0 then
|
||||
Platform({x=p.x, y=p.y-1, z=p.z}, 1, node_wood)
|
||||
end
|
||||
-- Diese komischen Holz-Konstruktionen
|
||||
-- These strange wood structs
|
||||
if segmentindex % 2 == 1 and segment_vector.y == 0 then
|
||||
local calc = {
|
||||
p.x+dir[1], p.z+dir[2], -- X and Z, added by direction
|
||||
p.x-dir[1], p.z-dir[2], -- subtracted
|
||||
p.x+dir[2], p.z+dir[1], -- orthogonal
|
||||
p.x-dir[2], p.z-dir[1], -- orthogonal, the other way
|
||||
}
|
||||
--[[ Shape:
|
||||
WWW
|
||||
P.P
|
||||
PrP
|
||||
pfp
|
||||
W = wood
|
||||
P = post (above floor level)
|
||||
p = post (in floor level, only placed if no floor)
|
||||
|
||||
From previous generation (for reference):
|
||||
f = floor
|
||||
r = rail
|
||||
. = air
|
||||
]]
|
||||
|
||||
-- Don't place those wood structs below open air
|
||||
if not (minetest.get_node({x=calc[1], y=p.y+2, z=calc[2]}).name == "air" and
|
||||
minetest.get_node({x=calc[3], y=p.y+2, z=calc[4]}).name == "air" and
|
||||
minetest.get_node({x=p.x, y=p.y+2, z=p.z}).name == "air") then
|
||||
|
||||
-- Left post and planks
|
||||
local left_ok = true
|
||||
left_ok = SetNodeIfCanBuild({x=calc[1], y=p.y-1, z=calc[2]}, node_fence)
|
||||
if left_ok then left_ok = SetNodeIfCanBuild({x=calc[1], y=p.y , z=calc[2]}, node_fence) end
|
||||
if left_ok then left_ok = SetNodeIfCanBuild({x=calc[1], y=p.y+1, z=calc[2]}, node_wood) end
|
||||
|
||||
-- Right post and planks
|
||||
local right_ok = true
|
||||
right_ok = SetNodeIfCanBuild({x=calc[3], y=p.y-1, z=calc[4]}, node_fence)
|
||||
if right_ok then right_ok = SetNodeIfCanBuild({x=calc[3], y=p.y , z=calc[4]}, node_fence) end
|
||||
if right_ok then right_ok = SetNodeIfCanBuild({x=calc[3], y=p.y+1, z=calc[4]}, node_wood) end
|
||||
|
||||
-- Middle planks
|
||||
local top_planks_ok = false
|
||||
if left_ok and right_ok then top_planks_ok = SetNodeIfCanBuild({x=p.x, y=p.y+1, z=p.z}, node_wood) end
|
||||
|
||||
if minetest.get_node({x=p.x,y=p.y-2,z=p.z}).name=="air" then
|
||||
if left_ok then SetNodeIfCanBuild({x=calc[1], y=p.y-2, z=calc[2]}, node_fence) end
|
||||
if right_ok then SetNodeIfCanBuild({x=calc[3], y=p.y-2, z=calc[4]}, node_fence) end
|
||||
end
|
||||
-- Torches on the middle planks
|
||||
if torches and top_planks_ok then
|
||||
-- Place torches at horizontal sides
|
||||
SetNodeIfCanBuild({x=calc[5], y=p.y+1, z=calc[6]}, {name=tsm_railcorridors.nodes.torch_wall, param2=torchdir[1]}, true)
|
||||
SetNodeIfCanBuild({x=calc[7], y=p.y+1, z=calc[8]}, {name=tsm_railcorridors.nodes.torch_wall, param2=torchdir[2]}, true)
|
||||
end
|
||||
elseif torches then
|
||||
-- Try to build torches instead of the wood structs
|
||||
local node = {name=tsm_railcorridors.nodes.torch_floor, param2=minetest.dir_to_wallmounted({x=0,y=-1,z=0})}
|
||||
|
||||
-- Try two different height levels
|
||||
local pos1 = {x=calc[1], y=p.y-2, z=calc[2]}
|
||||
local pos2 = {x=calc[3], y=p.y-2, z=calc[4]}
|
||||
local nodedef1 = minetest.registered_nodes[minetest.get_node(pos1).name]
|
||||
local nodedef2 = minetest.registered_nodes[minetest.get_node(pos2).name]
|
||||
|
||||
if nodedef1.walkable then
|
||||
pos1.y = pos1.y + 1
|
||||
end
|
||||
SetNodeIfCanBuild(pos1, node, true)
|
||||
|
||||
if nodedef2.walkable then
|
||||
pos2.y = pos2.y + 1
|
||||
end
|
||||
SetNodeIfCanBuild(pos2, node, true)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
-- nächster Punkt durch Vektoraddition
|
||||
-- next way point
|
||||
p = vector.add(p, segment_vector)
|
||||
end
|
||||
|
||||
-- End of the corridor; create the final piece
|
||||
if is_final then
|
||||
local dug = Cube(p, 1, {name="air"})
|
||||
if not chaos_mode and not dug then return false, segment_count end
|
||||
Platform({x=p.x, y=p.y-1, z=p.z}, 1, node_wood)
|
||||
end
|
||||
return true, segment_count
|
||||
end
|
||||
|
||||
local function corridor_func(waypoint, coord, sign, up_or_down, up, wood, post, is_final, up_or_down_next, damage)
|
||||
local segamount = 3
|
||||
if up_or_down then
|
||||
segamount = 1
|
||||
end
|
||||
if sign then
|
||||
segamount = 0-segamount
|
||||
end
|
||||
local vek = {x=0,y=0,z=0};
|
||||
local start = table.copy(waypoint)
|
||||
if coord == "x" then
|
||||
vek.x=segamount
|
||||
if up_or_down and up == false then
|
||||
start.x=start.x+segamount
|
||||
end
|
||||
elseif coord == "z" then
|
||||
vek.z=segamount
|
||||
if up_or_down and up == false then
|
||||
start.z=start.z+segamount
|
||||
end
|
||||
end
|
||||
if up_or_down then
|
||||
if up then
|
||||
vek.y = 1
|
||||
else
|
||||
vek.y = -1
|
||||
end
|
||||
end
|
||||
local segcount = pr:next(4,6)
|
||||
if up_or_down and up == false then
|
||||
Cube(waypoint, 1, {name="air"})
|
||||
end
|
||||
local corridor_dug, corridor_segments_dug = corridor_part(start, vek, segcount, wood, post, is_final)
|
||||
local corridor_vek = {x=vek.x*segcount, y=vek.y*segcount, z=vek.z*segcount}
|
||||
|
||||
-- nachträglich Schienen legen
|
||||
-- after this: rails
|
||||
segamount = 1
|
||||
if sign then
|
||||
segamount = 0-segamount
|
||||
end
|
||||
if coord == "x" then
|
||||
vek.x=segamount
|
||||
elseif coord == "z" then
|
||||
vek.z=segamount
|
||||
end
|
||||
if up_or_down then
|
||||
if up then
|
||||
vek.y = 1
|
||||
else
|
||||
vek.y = -1
|
||||
end
|
||||
end
|
||||
local chestplace = -1
|
||||
if corridor_dug and not up_or_down and pr:next() < probability_chest then
|
||||
chestplace = pr:next(1,segcount+1)
|
||||
end
|
||||
local railsegcount
|
||||
if not chaos_mode and not corridor_dug then
|
||||
railsegcount = corridor_segments_dug * 3
|
||||
elseif not up_or_down then
|
||||
railsegcount = segcount * 3
|
||||
else
|
||||
railsegcount = segcount
|
||||
end
|
||||
for i=1,railsegcount do
|
||||
local p = {x=waypoint.x+vek.x*i, y=waypoint.y+vek.y*i-1, z=waypoint.z+vek.z*i}
|
||||
if (minetest.get_node({x=p.x,y=p.y-1,z=p.z}).name=="air" and minetest.get_node({x=p.x,y=p.y-3,z=p.z}).name~=tsm_railcorridors.nodes.rail) then
|
||||
p.y = p.y - 1;
|
||||
if i == chestplace then
|
||||
chestplace = chestplace + 1
|
||||
end
|
||||
end
|
||||
if IsRailSurface({x=p.x,y=p.y-1,z=p.z}) then
|
||||
PlaceRail(p, damage)
|
||||
end
|
||||
if i == chestplace then
|
||||
if minetest.get_node({x=p.x+vek.z,y=p.y-1,z=p.z-vek.x}).name == post then
|
||||
chestplace = chestplace + 1
|
||||
else
|
||||
Place_Chest({x=p.x+vek.z,y=p.y,z=p.z-vek.x}, minetest.dir_to_facedir(vek))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local offset = table.copy(corridor_vek)
|
||||
local final_point = vector.add(waypoint, offset)
|
||||
if up_or_down then
|
||||
if up then
|
||||
offset.y = offset.y - 1
|
||||
final_point = vector.add(waypoint, offset)
|
||||
else
|
||||
offset[coord] = offset[coord] + segamount
|
||||
final_point = vector.add(waypoint, offset)
|
||||
if IsRailSurface({x=final_point.x,y=final_point.y-2,z=final_point.z}) then
|
||||
PlaceRail({x=final_point.x,y=final_point.y-1,z=final_point.z}, damage)
|
||||
end
|
||||
end
|
||||
end
|
||||
if not corridor_dug then
|
||||
return false
|
||||
else
|
||||
return final_point
|
||||
end
|
||||
end
|
||||
|
||||
local function start_corridor(waypoint, coord, sign, length, psra, wood, post, damage)
|
||||
local wp = waypoint
|
||||
local c = coord
|
||||
local s = sign
|
||||
local ud = false -- up or down
|
||||
local udn = false -- up or down is next
|
||||
local up
|
||||
for i=1,length do
|
||||
local needs_platform
|
||||
-- Up or down?
|
||||
if udn then
|
||||
needs_platform = NeedsPlatform(wp)
|
||||
if needs_platform then
|
||||
ud = false
|
||||
end
|
||||
ud = true
|
||||
-- Force direction near the height limits
|
||||
if wp.y >= height_max - 12 then
|
||||
up = false
|
||||
elseif wp.y <= height_min + 12 then
|
||||
up = true
|
||||
else
|
||||
-- Chose random direction in between
|
||||
up = pr:next(0, 2) < 1
|
||||
end
|
||||
else
|
||||
ud = false
|
||||
end
|
||||
-- Update up/down next
|
||||
if pr:next() < probability_up_or_down and i~=1 and not udn and not needs_platform then
|
||||
udn = i < length
|
||||
elseif udn and not needs_platform then
|
||||
udn = false
|
||||
end
|
||||
-- Make corridor / Korridor graben
|
||||
wp = corridor_func(wp,c,s, ud, up, wood, post, i == length, udn, damage)
|
||||
if wp == false then return end
|
||||
-- Verzweigung?
|
||||
-- Fork?
|
||||
if pr:next() < probability_fork then
|
||||
local p = {x=wp.x, y=wp.y, z=wp.z}
|
||||
start_corridor(wp, c, s, pr:next(way_min,way_max), psra, wood, post, damage)
|
||||
if c == "x" then c="z" else c="x" end
|
||||
start_corridor(wp, c, s, pr:next(way_min,way_max), psra, wood, post, damage)
|
||||
start_corridor(wp, c, not s, pr:next(way_min,way_max), psra, wood, post, damage)
|
||||
WoodBulk({x=p.x, y=p.y-1, z=p.z}, wood)
|
||||
WoodBulk({x=p.x, y=p.y, z=p.z}, wood)
|
||||
WoodBulk({x=p.x, y=p.y+1, z=p.z}, wood)
|
||||
WoodBulk({x=p.x, y=p.y+2, z=p.z}, wood)
|
||||
return
|
||||
end
|
||||
-- coord und sign verändern
|
||||
-- randomly change sign and coord
|
||||
if c=="x" then
|
||||
c="z"
|
||||
elseif c=="z" then
|
||||
c="x"
|
||||
end;
|
||||
s = pr:next(0, 2) < 1
|
||||
end
|
||||
end
|
||||
|
||||
local function place_corridors(main_cave_coords, psra)
|
||||
--[[ ALWAYS start building in the ground. Prevents corridors starting
|
||||
in mid-air or in liquids. ]]
|
||||
if not IsGround(main_cave_coords) then
|
||||
return
|
||||
end
|
||||
|
||||
-- Determine if this corridor system is “damaged” (some rails removed) and to which extent
|
||||
local damage = 0
|
||||
if pr:next() < probability_damage then
|
||||
damage = pr:next(10, 50)
|
||||
end
|
||||
--[[ Starter cube: A big hollow dirt cube from which the corridors will extend.
|
||||
Corridor generation starts here. ]]
|
||||
if pr:next(0, 100) < 50 then
|
||||
Cube(main_cave_coords, 4, {name=tsm_railcorridors.nodes.dirt})
|
||||
Cube(main_cave_coords, 3, {name="air"})
|
||||
PlaceRail({x=main_cave_coords.x, y=main_cave_coords.y-3, z=main_cave_coords.z}, damage)
|
||||
main_cave_coords.y =main_cave_coords.y - 1
|
||||
else
|
||||
Cube(main_cave_coords, 3, {name=tsm_railcorridors.nodes.dirt})
|
||||
Cube(main_cave_coords, 2, {name="air"})
|
||||
PlaceRail({x=main_cave_coords.x, y=main_cave_coords.y-2, z=main_cave_coords.z}, damage)
|
||||
end
|
||||
local xs = pr:next(0, 2) < 1
|
||||
local zs = pr:next(0, 2) < 1;
|
||||
|
||||
-- Select random wood type (found in gameconfig.lua)
|
||||
local rnd = pr:next(1,1000)
|
||||
|
||||
local woodtype = 1
|
||||
local accumulated_chance = 0
|
||||
for w=1, #tsm_railcorridors.nodes.corridor_woods do
|
||||
local woodtable = tsm_railcorridors.nodes.corridor_woods[w]
|
||||
accumulated_chance = accumulated_chance + woodtable.chance
|
||||
if accumulated_chance > 1000 then
|
||||
minetest.log("warning", "[tsm_railcorridors] Warning: Wood chances add up to over 100%!")
|
||||
break
|
||||
end
|
||||
if rnd <= accumulated_chance then
|
||||
woodtype = w
|
||||
break
|
||||
end
|
||||
end
|
||||
local wood = tsm_railcorridors.nodes.corridor_woods[woodtype].wood
|
||||
local post = tsm_railcorridors.nodes.corridor_woods[woodtype].post
|
||||
start_corridor(main_cave_coords, "x", xs, pr:next(way_min,way_max), psra, wood, post, damage)
|
||||
start_corridor(main_cave_coords, "z", zs, pr:next(way_min,way_max), psra, wood, post, damage)
|
||||
-- Auch mal die andere Richtung?
|
||||
-- Try the other direction?
|
||||
if pr:next(0, 100) < 70 then
|
||||
start_corridor(main_cave_coords, "x", not xs, pr:next(way_min,way_max), psra, wood, post, damage)
|
||||
end
|
||||
if pr:next(0, 100) < 70 then
|
||||
start_corridor(main_cave_coords, "z", not zs, pr:next(way_min,way_max), psra, wood, post, damage)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
InitRandomizer(blockseed)
|
||||
if minp.y < height_max and maxp.y > height_min and pr:next() < probability_railcaves_in_chunk then
|
||||
-- Get semi-random height in chunk
|
||||
|
||||
local buffer = 5
|
||||
local y = pr:next(minp.y + buffer, maxp.y - buffer)
|
||||
y = math.floor(math.max(height_min, math.min(height_max, y)))
|
||||
local p = {x=minp.x+(maxp.x-minp.x)/2, y=y, z=minp.z+(maxp.z-minp.z)/2}
|
||||
-- Haupthöhle und alle weiteren
|
||||
-- Corridors; starting with main cave out of dirt
|
||||
place_corridors(p, pr)
|
||||
end
|
||||
end)
|
1
mods/a_mapgen_mods/tsm_railcorridors/mod.conf
Normal file
@ -0,0 +1 @@
|
||||
name = tsm_railcorridors
|
30
mods/a_mapgen_mods/tsm_railcorridors/settingtypes.txt
Normal file
@ -0,0 +1,30 @@
|
||||
#Probability (0.0 to 1.0) for every newly generated chunk to get rail corridors.
|
||||
tsm_railcorridors_probability_railcaves_in_chunk (Rail corridor probability) float 0.3 0.0 1.0
|
||||
|
||||
#Minimum rail corridor path length (excludes forks).
|
||||
tsm_railcorridors_way_min (Minimum rail corridor length) int 4 1
|
||||
|
||||
#Maximum rail corridor path length (excludes forks).
|
||||
tsm_railcorridors_way_max (Maximum rail corridor length) int 7 1
|
||||
|
||||
#Probability (0.0 to 1.0) for every horizontal part of a rail corridor to have torches.
|
||||
tsm_railcorridors_probability_torches_in_segment (Torch probability) float 0.5 0.0 1.0
|
||||
|
||||
#Probability (0.0 to 1.0) for every part of a rail corridor to go up or down.
|
||||
tsm_railcorridors_probability_up_or_down (Stairway probability) float 0.2 0.0 1.0
|
||||
|
||||
#Probability (0.0 to 1.0) for every part of a rail corridor to fork.
|
||||
#Caution! Too high values may cause Minetest to hang.
|
||||
tsm_railcorridors_probability_fork (Fork probability) float 0.04 0.0 1.0
|
||||
|
||||
#Probability (0.0 to 1.0) for every part of a rail corridor to contain a treasure chest.
|
||||
tsm_railcorridors_probability_chest (Chest probability) float 0.05 0.0 1.0
|
||||
|
||||
#Probability (0.0 to 1.0) for a rail corridor system to have damaged/incomplete railways
|
||||
tsm_railcorridors_probability_damage (Damaged railway probability) float 0.90 0.0 1.0
|
||||
|
||||
#If enabled, rail corridors continue to generate through obstacles such
|
||||
#as other rail corridors (without destroying them, mostly). This may lead
|
||||
#to pretty chaotic rail corridors, but they are also more free to spread.
|
||||
#If disabled, rail corridors spread in a orderly fashion.
|
||||
tsm_railcorridors_chaos (Chaos Mode) bool false
|
@ -1,30 +1,26 @@
|
||||
Minetest Game mod: beds
|
||||
=======================
|
||||
by BlockMen (c) 2014-2015
|
||||
See license.txt for license information.
|
||||
|
||||
Version: 1.1.1
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by BlockMen (MIT)
|
||||
Various Minetest developers and contributors (MIT)
|
||||
|
||||
About
|
||||
~~~~~
|
||||
This mod adds a bed to Minetest which allows to skip the night. To sleep rightclick the bed, if playing
|
||||
in singleplayer mode the night gets skipped imideatly. If playing on server you get shown how many other
|
||||
players are in bed too. If all players are sleeping the night gets skipped aswell. Also the night skip can be forced
|
||||
if more than 50% of the players are lying in bed and use this option.
|
||||
Authors of media (textures)
|
||||
---------------------------
|
||||
BlockMen (CC BY-SA 3.0)
|
||||
|
||||
Another feature is a controled respawning. If you have slept in bed (not just lying in it) your respawn point
|
||||
is set to the beds location and you will respawn there after death.
|
||||
You can disable the respawn at beds by setting "enable_bed_respawn = false" in minetest.conf
|
||||
You can also disable the night skip feature by setting "enable_bed_night_skip = false" in minetest.conf or by using
|
||||
the /set command ingame.
|
||||
This mod adds a bed to Minetest which allows to skip the night.
|
||||
To sleep, rightclick the bed. If playing in singleplayer mode the night gets skipped
|
||||
immediately. If playing multiplayer you get shown how many other players are in bed too,
|
||||
if all players are sleeping the night gets skipped. The night skip can be forced if more
|
||||
than 50% of the players are lying in bed and use this option.
|
||||
|
||||
|
||||
License of source code, textures: WTFPL
|
||||
---------------------------------------
|
||||
(c) Copyright BlockMen (2014-2015)
|
||||
|
||||
|
||||
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.
|
||||
Another feature is a controlled respawning. If you have slept in bed (not just lying in
|
||||
it) your respawn point is set to the beds location and you will respawn there after
|
||||
death.
|
||||
You can disable the respawn at beds by setting "enable_bed_respawn = false" in
|
||||
minetest.conf.
|
||||
You can disable the night skip feature by setting "enable_bed_night_skip = false" in
|
||||
minetest.conf or by using the /set command in-game.
|
||||
|
@ -16,7 +16,7 @@ local function destruct_bed(pos, n)
|
||||
if reverse then
|
||||
reverse = not reverse
|
||||
minetest.remove_node(other)
|
||||
nodeupdate(other)
|
||||
minetest.check_for_falling(other)
|
||||
else
|
||||
reverse = not reverse
|
||||
end
|
||||
@ -33,8 +33,8 @@ function beds.register_bed(name, def)
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
stack_max = 1,
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
|
||||
sounds = def.sounds or default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = def.nodebox.bottom,
|
||||
@ -46,6 +46,14 @@ function beds.register_bed(name, def)
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local udef = minetest.registered_nodes[node.name]
|
||||
if udef and udef.on_rightclick and
|
||||
not (placer and placer:get_player_control().sneak) then
|
||||
return udef.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
|
||||
local pos
|
||||
if minetest.registered_items[minetest.get_node(under).name].buildable_to then
|
||||
pos = under
|
||||
@ -59,8 +67,8 @@ function beds.register_bed(name, def)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local def = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
if not def or not def.buildable_to then
|
||||
local node_def = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
if not node_def or not node_def.buildable_to then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
@ -81,7 +89,8 @@ function beds.register_bed(name, def)
|
||||
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
|
||||
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name())) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
@ -91,8 +100,9 @@ function beds.register_bed(name, def)
|
||||
destruct_bed(pos, 1)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
beds.on_rightclick(pos, clicker)
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
on_rotate = function(pos, node, user, mode, new_param2)
|
||||
@ -112,8 +122,8 @@ function beds.register_bed(name, def)
|
||||
end
|
||||
local newp = vector.add(pos, minetest.facedir_to_dir(new_param2))
|
||||
local node3 = minetest.get_node_or_nil(newp)
|
||||
local def = node3 and minetest.registered_nodes[node3.name]
|
||||
if not def or not def.buildable_to then
|
||||
local node_def = node3 and minetest.registered_nodes[node3.name]
|
||||
if not node_def or not node_def.buildable_to then
|
||||
return false
|
||||
end
|
||||
if minetest.is_protected(newp, user:get_player_name()) then
|
||||
@ -136,8 +146,8 @@ function beds.register_bed(name, def)
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
pointable = false,
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
|
||||
sounds = def.sounds or default.node_sound_wood_defaults(),
|
||||
drop = name .. "_bottom",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
@ -66,7 +66,7 @@ beds.register_bed("beds:bed", {
|
||||
},
|
||||
top = {
|
||||
"beds_bed_top_top.png^[transformR90",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"beds_bed_side_top_r.png",
|
||||
"beds_bed_side_top_r.png^[transformfx",
|
||||
"beds_bed_side_top.png",
|
||||
@ -88,3 +88,17 @@ beds.register_bed("beds:bed", {
|
||||
|
||||
minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom")
|
||||
minetest.register_alias("beds:bed_top_red", "beds:bed_top")
|
||||
|
||||
-- Fuel
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "beds:fancy_bed_bottom",
|
||||
burntime = 13,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "beds:bed_bottom",
|
||||
burntime = 12,
|
||||
})
|
||||
|
@ -1,7 +1,7 @@
|
||||
local pi = math.pi
|
||||
local player_in_bed = 0
|
||||
local is_sp = minetest.is_singleplayer()
|
||||
local enable_respawn = minetest.setting_getbool("enable_bed_respawn")
|
||||
local enable_respawn = minetest.settings:get_bool("enable_bed_respawn")
|
||||
if enable_respawn == nil then
|
||||
enable_respawn = true
|
||||
end
|
||||
@ -22,7 +22,7 @@ local function get_look_yaw(pos)
|
||||
end
|
||||
|
||||
local function is_night_skip_enabled()
|
||||
local enable_night_skip = minetest.setting_getbool("enable_bed_night_skip")
|
||||
local enable_night_skip = minetest.settings:get_bool("enable_bed_night_skip")
|
||||
if enable_night_skip == nil then
|
||||
enable_night_skip = true
|
||||
end
|
||||
@ -70,7 +70,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
||||
|
||||
-- physics, eye_offset, etc
|
||||
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
player:set_look_yaw(math.random(1, 180) / 100)
|
||||
player:set_look_horizontal(math.random(1, 180) / 100)
|
||||
default.player_attached[name] = false
|
||||
player:set_physics_override(1, 1, 1)
|
||||
hud_flags.wielditem = true
|
||||
@ -85,7 +85,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
||||
-- physics, eye_offset, etc
|
||||
player:set_eye_offset({x = 0, y = -13, z = 0}, {x = 0, y = 0, z = 0})
|
||||
local yaw, param2 = get_look_yaw(bed_pos)
|
||||
player:set_look_yaw(yaw)
|
||||
player:set_look_horizontal(yaw)
|
||||
local dir = minetest.facedir_to_dir(param2)
|
||||
local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y, z = bed_pos.z + dir.z / 2}
|
||||
player:set_physics_override(0, 0, 0)
|
||||
@ -100,7 +100,7 @@ end
|
||||
|
||||
local function update_formspecs(finished)
|
||||
local ges = #minetest.get_connected_players()
|
||||
local form_n = ""
|
||||
local form_n
|
||||
local is_majority = (ges / 2) < player_in_bed
|
||||
|
||||
if finished then
|
||||
@ -130,7 +130,6 @@ end
|
||||
|
||||
function beds.skip_night()
|
||||
minetest.set_timeofday(0.23)
|
||||
beds.set_spawns()
|
||||
end
|
||||
|
||||
function beds.on_rightclick(pos, player)
|
||||
@ -149,7 +148,7 @@ function beds.on_rightclick(pos, player)
|
||||
-- move to bed
|
||||
if not beds.player[name] then
|
||||
lay_down(player, ppos, pos)
|
||||
beds.set_spawns()--hack for set spawn maikerumine
|
||||
beds.set_spawns() -- save respawn positions when entering bed
|
||||
else
|
||||
lay_down(player, nil, nil, false)
|
||||
end
|
||||
@ -174,23 +173,18 @@ end
|
||||
|
||||
|
||||
-- Callbacks
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
beds.read_spawns()
|
||||
end)
|
||||
|
||||
-- respawn player at bed if enabled and valid position is found
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
if not enable_respawn then
|
||||
return false
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
local pos = beds.spawn[name] or nil
|
||||
if pos then
|
||||
player:setpos(pos)
|
||||
return true
|
||||
end
|
||||
end)
|
||||
-- Only register respawn callback if respawn enabled
|
||||
if enable_respawn then
|
||||
-- respawn player at bed if enabled and valid position is found
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
local pos = beds.spawn[name]
|
||||
if pos then
|
||||
player:setpos(pos)
|
||||
return true
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
|
60
mods/beds/license.txt
Normal file
@ -0,0 +1,60 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2014-2016 BlockMen
|
||||
Copyright (C) 2014-2016 Various Minetest developers and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software
|
||||
without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more details:
|
||||
https://opensource.org/licenses/MIT
|
||||
|
||||
|
||||
Licenses of media (textures)
|
||||
----------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2014-2016 BlockMen
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
@ -32,11 +32,11 @@ function beds.read_spawns()
|
||||
beds.save_spawns()
|
||||
os.rename(file, file .. ".backup")
|
||||
file = org_file
|
||||
else
|
||||
spawns = {}
|
||||
end
|
||||
end
|
||||
|
||||
beds.read_spawns()
|
||||
|
||||
function beds.save_spawns()
|
||||
if not beds.spawn then
|
||||
return
|
||||
|
@ -1,16 +1,15 @@
|
||||
Minetest Game mod: boats
|
||||
========================
|
||||
by PilzAdam
|
||||
See license.txt for license information.
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
WTFPL
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by PilzAdam (MIT)
|
||||
Various Minetest developers and contributors (MIT)
|
||||
|
||||
License of media (textures and sounds):
|
||||
---------------------------------------
|
||||
WTFPL
|
||||
|
||||
Authors of media files:
|
||||
-----------------------
|
||||
textures: Zeg9
|
||||
model: thetoon and Zeg9, modified by PavelS(SokolovPavel)
|
||||
Authors of media (textures and model)
|
||||
-------------------------------------
|
||||
Textures: Zeg9 (CC BY-SA 3.0)
|
||||
Model: thetoon and Zeg9 (CC BY-SA 3.0),
|
||||
modified by PavelS(SokolovPavel) (CC BY-SA 3.0),
|
||||
modified by sofar (CC BY-SA 3.0)
|
||||
|
@ -34,6 +34,8 @@ end
|
||||
|
||||
local boat = {
|
||||
physical = true,
|
||||
-- Warning: Do not change the position of the collisionbox top surface,
|
||||
-- lowering it causes the boat to fall through the world if underwater
|
||||
collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5},
|
||||
visual = "mesh",
|
||||
mesh = "boats_boat.obj",
|
||||
@ -77,7 +79,7 @@ function boat.on_rightclick(self, clicker)
|
||||
minetest.after(0.2, function()
|
||||
default.player_set_animation(clicker, "sit" , 30)
|
||||
end)
|
||||
self.object:setyaw(clicker:get_look_yaw() - math.pi / 2)
|
||||
clicker:set_look_horizontal(self.object:getyaw())
|
||||
end
|
||||
end
|
||||
|
||||
@ -107,18 +109,20 @@ function boat.on_punch(self, puncher)
|
||||
end
|
||||
if not self.driver then
|
||||
self.removed = true
|
||||
local inv = puncher:get_inventory()
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(puncher:get_player_name()))
|
||||
or not inv:contains_item("main", "boats:boat") then
|
||||
local leftover = inv:add_item("main", "boats:boat")
|
||||
-- if no room in inventory add a replacement boat to the world
|
||||
if not leftover:is_empty() then
|
||||
minetest.add_item(self.object:getpos(), leftover)
|
||||
end
|
||||
end
|
||||
-- delay remove to ensure player is detached
|
||||
minetest.after(0.1, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
local inv = puncher:get_inventory()
|
||||
if inv:room_for_item("main", "boats:boat") then
|
||||
inv:add_item("main", "boats:boat")
|
||||
else
|
||||
minetest.add_item(self.object:getpos(), "boats:boat")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -165,7 +169,7 @@ function boat.on_step(self, dtime)
|
||||
|
||||
local p = self.object:getpos()
|
||||
p.y = p.y - 0.5
|
||||
local new_velo = {x = 0, y = 0, z = 0}
|
||||
local new_velo
|
||||
local new_acce = {x = 0, y = 0, z = 0}
|
||||
if not is_water(p) then
|
||||
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
|
||||
@ -219,18 +223,32 @@ minetest.register_craftitem("boats:boat", {
|
||||
wield_image = "boats_wield.png",
|
||||
wield_scale = {x = 2, y = 2, z = 1},
|
||||
liquids_pointable = true,
|
||||
groups = {flammable = 2},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local udef = minetest.registered_nodes[node.name]
|
||||
if udef and udef.on_rightclick and
|
||||
not (placer and placer:get_player_control().sneak) then
|
||||
return udef.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
return itemstack
|
||||
end
|
||||
if not is_water(pointed_thing.under) then
|
||||
return
|
||||
return itemstack
|
||||
end
|
||||
pointed_thing.under.y = pointed_thing.under.y + 0.5
|
||||
minetest.add_entity(pointed_thing.under, "boats:boat")
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
boat = minetest.add_entity(pointed_thing.under, "boats:boat")
|
||||
if boat then
|
||||
boat:setyaw(placer:get_look_horizontal())
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name())) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
@ -245,3 +263,9 @@ minetest.register_craft({
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "boats:boat",
|
||||
burntime = 20,
|
||||
})
|
||||
|
63
mods/boats/license.txt
Normal file
@ -0,0 +1,63 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2012-2016 PilzAdam
|
||||
Copyright (C) 2012-2016 Various Minetest developers and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software
|
||||
without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more details:
|
||||
https://opensource.org/licenses/MIT
|
||||
|
||||
|
||||
Licenses of media (textures and model)
|
||||
--------------------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2012-2016 Zeg9
|
||||
Copyright (C) 2012-2016 thetoon
|
||||
Copyright (C) 2012-2016 PavelS(SokolovPavel)
|
||||
Copyright (C) 2016 sofar (sofar@foo-projects.org)
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
@ -1,26 +1,13 @@
|
||||
Minetest Game mod: bucket
|
||||
=========================
|
||||
See license.txt for license information.
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
Copyright (C) 2011-2012 Kahrl <kahrl@gmx.net>
|
||||
Copyright (C) 2011-2012 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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
License of media (textures and sounds)
|
||||
--------------------------------------
|
||||
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>
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Kahrl <kahrl@gmx.net> (LGPL 2.1)
|
||||
celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
|
||||
Various Minetest developers and contributors (LGPL 2.1)
|
||||
|
||||
Authors of media (textures)
|
||||
---------------------------
|
||||
ElementW (CC BY-SA 3.0)
|
||||
|
@ -36,12 +36,17 @@ end
|
||||
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
|
||||
-- name = text description of the bucket item
|
||||
-- groups = (optional) groups of the bucket item, for example {water_bucket = 1}
|
||||
-- force_renew = (optional) bool. Force the liquid source to renew if it has a
|
||||
-- source neighbour, even if defined as 'liquid_renewable = false'.
|
||||
-- Needed to avoid creating holes in sloping rivers.
|
||||
-- This function can be called from any mod (that depends on bucket).
|
||||
function bucket.register_liquid(source, flowing, itemname, inventory_image, name, groups)
|
||||
function bucket.register_liquid(source, flowing, itemname, inventory_image, name,
|
||||
groups, force_renew)
|
||||
bucket.liquids[source] = {
|
||||
source = source,
|
||||
flowing = flowing,
|
||||
itemname = itemname,
|
||||
force_renew = force_renew,
|
||||
}
|
||||
bucket.liquids[flowing] = bucket.liquids[source]
|
||||
|
||||
@ -110,8 +115,11 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
||||
stack_max = 99,
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
-- Must be pointing to node
|
||||
if pointed_thing.type ~= "node" then
|
||||
if pointed_thing.type == "object" then
|
||||
pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0 }, nil)
|
||||
return user:get_wielded_item()
|
||||
elseif pointed_thing.type ~= "node" then
|
||||
-- do nothing if it's neither object nor node
|
||||
return
|
||||
end
|
||||
-- Check if pointing to a liquid source
|
||||
@ -141,7 +149,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
core.add_item(pos, liquiddef.itemname)
|
||||
minetest.add_item(pos, liquiddef.itemname)
|
||||
end
|
||||
|
||||
-- set to return empty buckets minus 1
|
||||
@ -149,9 +157,24 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
||||
|
||||
end
|
||||
|
||||
minetest.add_node(pointed_thing.under, {name="air"})
|
||||
-- force_renew requires a source neighbour
|
||||
local source_neighbor = false
|
||||
if liquiddef.force_renew then
|
||||
source_neighbor =
|
||||
minetest.find_node_near(pointed_thing.under, 1, liquiddef.source)
|
||||
end
|
||||
if not (source_neighbor and liquiddef.force_renew) then
|
||||
minetest.add_node(pointed_thing.under, {name = "air"})
|
||||
end
|
||||
|
||||
return ItemStack(giving_back)
|
||||
else
|
||||
-- non-liquid nodes will have their on_punch triggered
|
||||
local node_def = minetest.registered_nodes[node.name]
|
||||
if node_def then
|
||||
node_def.on_punch(pointed_thing.under, node, user, pointed_thing)
|
||||
end
|
||||
return user:get_wielded_item()
|
||||
end
|
||||
end,
|
||||
})
|
||||
@ -171,7 +194,8 @@ bucket.register_liquid(
|
||||
"bucket:bucket_river_water",
|
||||
"bucket_river_water.png",
|
||||
"River Water Bucket",
|
||||
{water_bucket = 1}
|
||||
{water_bucket = 1},
|
||||
true
|
||||
)
|
||||
|
||||
bucket.register_liquid(
|
||||
|
51
mods/bucket/license.txt
Normal file
@ -0,0 +1,51 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
GNU Lesser General Public License, version 2.1
|
||||
Copyright (C) 2011-2016 Kahrl <kahrl@gmx.net>
|
||||
Copyright (C) 2011-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2011-2016 Various Minetest developers and contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms
|
||||
of the GNU Lesser General Public License as published by the Free Software Foundation;
|
||||
either version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details:
|
||||
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||
|
||||
|
||||
Licenses of media (textures)
|
||||
----------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2015-2016 ElementW
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
4
mods/builtin_item/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
## Generic ignorable patterns and files
|
||||
*~
|
||||
.*.swp
|
||||
debug.txt
|
@ -1,25 +0,0 @@
|
||||
item_entity.lua
|
||||
|
||||
edited by TenPlus1
|
||||
|
||||
Features:
|
||||
- Items are destroyed by lava
|
||||
- Items are moved along by flowing water (new routine)
|
||||
- Items are removed after 120 seconds or the time that is specified by
|
||||
remove_items in minetest.conf (-1 disables it)
|
||||
- Particle effects added
|
||||
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
@ -1,2 +0,0 @@
|
||||
default
|
||||
mobs?
|
@ -1,450 +0,0 @@
|
||||
-- Minetest: builtin/item_entity.lua (27th January 2016)
|
||||
|
||||
-- water flow functions by QwertyMine3, edited by TenPlus1
|
||||
local function to_unit_vector(dir_vector)
|
||||
|
||||
local inv_roots = {
|
||||
[0] = 1,
|
||||
[1] = 1,
|
||||
[2] = 0.70710678118655,
|
||||
[4] = 0.5,
|
||||
[5] = 0.44721359549996,
|
||||
[8] = 0.35355339059327
|
||||
}
|
||||
|
||||
local sum = dir_vector.x * dir_vector.x + dir_vector.z * dir_vector.z
|
||||
|
||||
return {
|
||||
x = dir_vector.x * inv_roots[sum],
|
||||
y = dir_vector.y,
|
||||
z = dir_vector.z * inv_roots[sum]
|
||||
}
|
||||
end
|
||||
|
||||
local function is_touching(realpos, nodepos, radius)
|
||||
|
||||
return (math.abs(realpos - nodepos) > (0.5 - radius))
|
||||
end
|
||||
|
||||
local function node_ok(pos)
|
||||
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
|
||||
if not node then
|
||||
return minetest.registered_nodes["default:dirt"]
|
||||
end
|
||||
|
||||
if minetest.registered_nodes[node.name] then
|
||||
return node
|
||||
end
|
||||
|
||||
return minetest.registered_nodes["default:dirt"]
|
||||
end
|
||||
|
||||
local function is_water(pos)
|
||||
|
||||
return (minetest.registered_nodes[
|
||||
node_ok({x = pos.x, y = pos.y, z = pos.z}).name].groups.water)
|
||||
end
|
||||
|
||||
local function is_liquid(pos)
|
||||
|
||||
return (minetest.registered_nodes[
|
||||
node_ok({x = pos.x, y = pos.y, z = pos.z}).name].groups.liquid)
|
||||
end
|
||||
|
||||
local function node_is_liquid(node)
|
||||
|
||||
return (minetest.registered_nodes[node.name].groups.liquid)
|
||||
end
|
||||
|
||||
local function quick_flow_logic(node, pos_testing, direction)
|
||||
|
||||
if minetest.registered_nodes[node.name].liquidtype == "source" then
|
||||
|
||||
local node_testing = node_ok(pos_testing)
|
||||
local param2_testing = node_testing.param2
|
||||
|
||||
if minetest.registered_nodes[node_testing.name].liquidtype ~= "flowing" then
|
||||
return 0
|
||||
else
|
||||
return direction
|
||||
end
|
||||
|
||||
elseif minetest.registered_nodes[node.name].liquidtype == "flowing" then
|
||||
|
||||
local node_testing = node_ok(pos_testing)
|
||||
local param2_testing = node_testing.param2
|
||||
|
||||
if minetest.registered_nodes[node_testing.name].liquidtype == "source" then
|
||||
return -direction
|
||||
|
||||
elseif minetest.registered_nodes[node_testing.name].liquidtype == "flowing" then
|
||||
|
||||
if param2_testing < node.param2 then
|
||||
|
||||
if (node.param2 - param2_testing) > 6 then
|
||||
return -direction
|
||||
else
|
||||
return direction
|
||||
end
|
||||
|
||||
elseif param2_testing > node.param2 then
|
||||
|
||||
if (param2_testing - node.param2) > 6 then
|
||||
return direction
|
||||
else
|
||||
return -direction
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
local function quick_flow(pos, node)
|
||||
|
||||
local x, z = 0, 0
|
||||
|
||||
if not node_is_liquid(node) then
|
||||
return {x = 0, y = 0, z = 0}
|
||||
end
|
||||
|
||||
x = x + quick_flow_logic(node, {x = pos.x - 1, y = pos.y, z = pos.z},-1)
|
||||
x = x + quick_flow_logic(node, {x = pos.x + 1, y = pos.y, z = pos.z}, 1)
|
||||
z = z + quick_flow_logic(node, {x = pos.x, y = pos.y, z = pos.z - 1},-1)
|
||||
z = z + quick_flow_logic(node, {x = pos.x, y = pos.y, z = pos.z + 1}, 1)
|
||||
|
||||
return to_unit_vector({x = x, y = 0, z = z})
|
||||
end
|
||||
|
||||
--if not in water but touching, move centre to touching block
|
||||
--x has higher precedence than z -- if pos changes with x, it affects z
|
||||
local function move_centre(pos, realpos, node, radius)
|
||||
|
||||
if is_touching(realpos.x, pos.x, radius) then
|
||||
|
||||
if is_liquid({x = pos.x - 1, y = pos.y, z = pos.z}) then
|
||||
pos = {x = pos.x - 1, y = pos.y, z = pos.z}
|
||||
node = node_ok(pos)
|
||||
|
||||
elseif is_liquid({x = pos.x + 1, y = pos.y, z = pos.z}) then
|
||||
pos = {x = pos.x + 1, y = pos.y, z = pos.z}
|
||||
node = node_ok(pos)
|
||||
end
|
||||
end
|
||||
|
||||
if is_touching(realpos.z, pos.z, radius) then
|
||||
|
||||
if is_liquid({x = pos.x, y = pos.y, z = pos.z - 1}) then
|
||||
pos = {x = pos.x, y = pos.y, z = pos.z - 1}
|
||||
node = node_ok(pos)
|
||||
|
||||
elseif is_liquid({x = pos.x, y = pos.y, z = pos.z + 1}) then
|
||||
pos = {x = pos.x, y = pos.y, z = pos.z + 1}
|
||||
node = node_ok(pos)
|
||||
end
|
||||
end
|
||||
|
||||
return pos, node
|
||||
end
|
||||
-- END water flow functions
|
||||
|
||||
function core.spawn_item(pos, item)
|
||||
|
||||
local obj = core.add_entity(pos, "__builtin:item")
|
||||
|
||||
-- Don't use obj if it couldn't be added to the map.
|
||||
if obj then
|
||||
obj:get_luaentity():set_item(ItemStack(item):to_string())
|
||||
end
|
||||
|
||||
return obj
|
||||
end
|
||||
|
||||
-- if item_entity_ttl is not set, enity will have default life time
|
||||
-- setting to -1 disables the feature
|
||||
local time_to_live = tonumber(core.setting_get("item_entity_ttl")) or 900
|
||||
|
||||
-- if destroy_item is 1 then dropped items will burn inside lava
|
||||
local destroy_item = tonumber(core.setting_get("destroy_item")) or 1
|
||||
|
||||
-- entity gravity
|
||||
local gravity = tonumber(minetest.setting_get("movement_gravity")) or 9.81
|
||||
|
||||
-- particle effects for when item is destroyed
|
||||
local function add_effects(pos)
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = 1,
|
||||
time = 0.25,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x = -1, y = 2, z = -1},
|
||||
maxvel = {x = 1, y = 5, z = 1},
|
||||
minacc = {x = -4, y = -4, z = -4},
|
||||
maxacc = {x = 4, y = 4, z = 4},
|
||||
minexptime = 1,
|
||||
maxexptime = 3,
|
||||
minsize = 1,
|
||||
maxsize = 4,
|
||||
texture = "tnt_smoke.png",
|
||||
})
|
||||
end
|
||||
|
||||
-- check if within map limits (-30911 to 30927)
|
||||
local function within_limits(pos)
|
||||
|
||||
if pos.x > -30913
|
||||
and pos.x < 30928
|
||||
and pos.y > -30913
|
||||
and pos.y < 30928
|
||||
and pos.z > -30913
|
||||
and pos.z < 30928 then
|
||||
return true -- within limits
|
||||
end
|
||||
|
||||
return false -- beyond limits
|
||||
end
|
||||
|
||||
core.register_entity(":__builtin:item", {
|
||||
initial_properties = {
|
||||
hp_max = 1,
|
||||
physical = true,
|
||||
collide_with_objects = false,
|
||||
collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.3, 0.3},
|
||||
visual = "wielditem",
|
||||
visual_size = {x = 0.4, y = 0.4},
|
||||
textures = {""},
|
||||
spritediv = {x = 1, y = 1},
|
||||
initial_sprite_basepos = {x = 0, y = 0},
|
||||
is_visible = false,
|
||||
infotext = "",
|
||||
},
|
||||
|
||||
itemstring = "",
|
||||
physical_state = true,
|
||||
age = 0,
|
||||
|
||||
set_item = function(self, itemstring)
|
||||
|
||||
self.itemstring = itemstring
|
||||
|
||||
local stack = ItemStack(itemstring)
|
||||
local itemname = stack:get_name()
|
||||
local max_count = stack:get_stack_max()
|
||||
local count = math.min(stack:get_count(), max_count)
|
||||
local size = 0.2 + 0.1 * (count / max_count)
|
||||
|
||||
if not core.registered_items[itemname] then
|
||||
itemname = "unknown"
|
||||
end
|
||||
|
||||
self.object:set_properties({
|
||||
is_visible = true,
|
||||
visual = "wielditem",
|
||||
textures = {itemname},
|
||||
visual_size = {x = size, y = size},
|
||||
collisionbox = {-size, -size, -size, size, size, size},
|
||||
automatic_rotate = math.pi * 0.5,
|
||||
infotext = core.registered_items[itemname].description
|
||||
})
|
||||
end,
|
||||
|
||||
update_gravity = function(self)
|
||||
if not self.physical_state then
|
||||
self.object:setacceleration({x = 0, y = 0, z = 0})
|
||||
return
|
||||
end
|
||||
|
||||
self.object:setacceleration({x = 0, y = -gravity, z = 0})
|
||||
end,
|
||||
|
||||
get_staticdata = function(self)
|
||||
|
||||
return core.serialize({
|
||||
itemstring = self.itemstring,
|
||||
always_collect = self.always_collect,
|
||||
age = self.age,
|
||||
dropped_by = self.dropped_by
|
||||
})
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
|
||||
-- special function to fast remove entities (xanadu only)
|
||||
if (mobs and mobs.entity and mobs.entity == false)
|
||||
or not self then
|
||||
|
||||
self.object:remove()
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if string.sub(staticdata, 1, string.len("return")) == "return" then
|
||||
|
||||
local data = core.deserialize(staticdata)
|
||||
|
||||
if data and type(data) == "table" then
|
||||
|
||||
self.itemstring = data.itemstring
|
||||
self.always_collect = data.always_collect
|
||||
self.age = data.age or 0
|
||||
self.age = self.age + dtime_s
|
||||
self.dropped_by = data.dropped_by
|
||||
end
|
||||
else
|
||||
self.itemstring = staticdata
|
||||
end
|
||||
|
||||
self.object:set_armor_groups({immortal = 1})
|
||||
self.object:setvelocity({x = 0, y = 2, z = 0})
|
||||
self:update_gravity()
|
||||
self:set_item(self.itemstring)
|
||||
end,
|
||||
|
||||
try_merge_with = function(self, own_stack, object, entity)
|
||||
|
||||
if self.age == entity.age then
|
||||
-- Can not merge with itself
|
||||
return false
|
||||
end
|
||||
|
||||
local stack = ItemStack(entity.itemstring)
|
||||
local name = stack:get_name()
|
||||
|
||||
if own_stack:get_name() ~= name or own_stack:get_free_space() == 0 then
|
||||
-- Can not merge different or full stack
|
||||
return false
|
||||
end
|
||||
|
||||
local count = own_stack:get_count()
|
||||
local total_count = stack:get_count() + count
|
||||
local max_count = stack:get_stack_max()
|
||||
|
||||
-- Merge the remote stack into this one
|
||||
if total_count > max_count then
|
||||
return false
|
||||
end
|
||||
|
||||
local pos = object:getpos()
|
||||
pos.y = pos.y + ((total_count - count) / max_count) * 0.15
|
||||
|
||||
self:set_item(name .. " " .. total_count)
|
||||
|
||||
entity.itemstring = ""
|
||||
object:remove()
|
||||
|
||||
return true
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
|
||||
self.age = self.age + dtime
|
||||
if time_to_live > 0 and self.age > time_to_live then
|
||||
self.itemstring = ""
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
||||
local pos = self.object:getpos()
|
||||
local node = node_ok({
|
||||
x = pos.x,
|
||||
y = pos.y - 0.5,
|
||||
z = pos.z
|
||||
})
|
||||
local def = core.registered_nodes[node.name]
|
||||
|
||||
-- destroy item when dropped into lava (if enabled)
|
||||
if destroy_item > 0 and def.groups.lava then
|
||||
minetest.sound_play("builtin_item_lava", {
|
||||
pos = pos,
|
||||
max_hear_distance = 6,
|
||||
gain = 0.5
|
||||
})
|
||||
add_effects(pos)
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
||||
-- flowing water pushes item along (by QwertyMine3)
|
||||
local nod = node_ok({x = pos.x, y = pos.y + 0.5, z = pos.z})
|
||||
if minetest.registered_nodes[nod.name].liquidtype == "flowing" then
|
||||
|
||||
local vec = quick_flow(self.object:getpos(),
|
||||
node_ok(self.object:getpos()))
|
||||
|
||||
if vec then
|
||||
|
||||
local v = self.object:getvelocity()
|
||||
|
||||
self.object:setvelocity(
|
||||
{x = vec.x, y = v.y, z = vec.z})
|
||||
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
-- Ignore is walkable -> stop until the block loaded
|
||||
local entity_fall = (def and not def.walkable)
|
||||
|
||||
if self.physical_state == entity_fall then
|
||||
return
|
||||
end
|
||||
|
||||
self.object:setvelocity({x = 0, y = 0, z = 0})
|
||||
self.physical_state = entity_fall
|
||||
self.object:set_properties({
|
||||
physical = entity_fall
|
||||
})
|
||||
|
||||
self:update_gravity()
|
||||
|
||||
-- Collect the items around to merge with
|
||||
local own_stack = ItemStack(self.itemstring)
|
||||
if own_stack:get_free_space() == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local objects = core.get_objects_inside_radius(pos, 0.8)
|
||||
|
||||
for k, object in pairs(objects) do
|
||||
|
||||
local entity = object:get_luaentity()
|
||||
|
||||
if entity and entity.name == "__builtin:item" then
|
||||
|
||||
if self:try_merge_with(own_stack, object, entity) then
|
||||
|
||||
own_stack = ItemStack(self.itemstring)
|
||||
|
||||
if own_stack:get_free_space() == 0 then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
on_punch = function(self, puncher)
|
||||
|
||||
local inv = puncher:get_inventory()
|
||||
|
||||
if inv and self.itemstring ~= "" then
|
||||
|
||||
local left = inv:add_item("main", self.itemstring)
|
||||
|
||||
if left and not left:is_empty() then
|
||||
|
||||
self:set_item(left:to_string())
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
self.itemstring = ""
|
||||
self.object:remove()
|
||||
end,
|
||||
})
|
Before Width: | Height: | Size: 202 B |
@ -1,23 +1,12 @@
|
||||
Minetest Game mod: creative
|
||||
===========================
|
||||
See license.txt for license information.
|
||||
|
||||
Implements creative mode.
|
||||
|
||||
Switch on by using the "creative_mode" setting.
|
||||
|
||||
Registered items that
|
||||
- have a description, and
|
||||
- do not have the group not_in_creative_inventory
|
||||
are added to the creative inventory.
|
||||
|
||||
License of source code and media files:
|
||||
---------------------------------------
|
||||
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
||||
Copyright (C) 2016 Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com>
|
||||
|
||||
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.
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by Perttu Ahola (celeron55) <celeron55@gmail.com> (MIT)
|
||||
Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com> (MIT)
|
||||
|
||||
Author of media (textures)
|
||||
--------------------------
|
||||
Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com> (CC BY-SA 3.0)
|
||||
|
@ -1 +1,2 @@
|
||||
default
|
||||
sfinv
|
||||
|
@ -1,228 +1,22 @@
|
||||
-- minetest/creative/init.lua
|
||||
|
||||
creative = {}
|
||||
local player_inventory = {}
|
||||
local creative_mode = minetest.setting_getbool("creative_mode")
|
||||
|
||||
-- Create detached creative inventory after loading all mods
|
||||
creative.init_creative_inventory = function(owner)
|
||||
local owner_name = owner:get_player_name()
|
||||
player_inventory[owner_name] = {
|
||||
size = 0,
|
||||
filter = "",
|
||||
start_i = 1,
|
||||
tab_id = 2,
|
||||
}
|
||||
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
|
||||
|
||||
minetest.create_detached_inventory("creative_" .. owner_name, {
|
||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
if creative_mode and not to_list == "main" 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 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)
|
||||
local player_name, stack_name = player:get_player_name(), stack:get_name()
|
||||
--print(player_name .. " takes item from creative inventory; listname = " .. listname .. ", index = " .. index .. ", stack = " .. dump(stack:to_table()))
|
||||
if stack then
|
||||
minetest.log("action", player_name .. " takes " .. stack_name .. " from creative inventory")
|
||||
--print("Stack name: " .. stack_name .. ", Stack count: " .. stack:get_count())
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
creative.update_creative_inventory(owner_name)
|
||||
--print("creative inventory size: " .. player_inventory[player_name].size)
|
||||
function creative.is_enabled_for(name)
|
||||
return creative_mode_cache
|
||||
end
|
||||
|
||||
local function tab_category(tab_id)
|
||||
local id_category = {
|
||||
nil, -- Reserved for crafting tab.
|
||||
minetest.registered_items,
|
||||
minetest.registered_nodes,
|
||||
minetest.registered_tools,
|
||||
minetest.registered_craftitems
|
||||
}
|
||||
dofile(minetest.get_modpath("creative") .. "/inventory.lua")
|
||||
|
||||
-- If index out of range, show default ("All") page.
|
||||
return id_category[tab_id] or id_category[2]
|
||||
end
|
||||
|
||||
function creative.update_creative_inventory(player_name)
|
||||
local creative_list = {}
|
||||
local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
|
||||
local inv = player_inventory[player_name]
|
||||
|
||||
for name, def in pairs(tab_category(inv.tab_id)) do
|
||||
if not (def.groups.not_in_creative_inventory == 1) and
|
||||
def.description and def.description ~= "" and
|
||||
(def.name:find(inv.filter, 1, true) or
|
||||
def.description:lower():find(inv.filter, 1, true)) then
|
||||
creative_list[#creative_list+1] = name
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(creative_list)
|
||||
player_inv:set_size("main", #creative_list)
|
||||
player_inv:set_list("main", creative_list)
|
||||
inv.size = #creative_list
|
||||
end
|
||||
|
||||
-- Create the trash field
|
||||
local trash = minetest.create_detached_inventory("creative_trash", {
|
||||
-- Allow the stack to be placed and remove it in on_put()
|
||||
-- This allows the creative inventory to restore the stack
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
if creative_mode then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
on_put = function(inv, listname)
|
||||
inv:set_list(listname, {})
|
||||
end,
|
||||
})
|
||||
trash:set_size("main", 1)
|
||||
|
||||
creative.formspec_add = ""
|
||||
|
||||
creative.set_creative_formspec = function(player, start_i)
|
||||
local player_name = player:get_player_name()
|
||||
local inv = player_inventory[player_name]
|
||||
local pagenum = math.floor(start_i / (3*8) + 1)
|
||||
local pagemax = math.ceil(inv.size / (3*8))
|
||||
|
||||
player:set_inventory_formspec([[
|
||||
size[8,8.6]
|
||||
image[4.06,3.4;0.8,0.8;creative_trash_icon.png]
|
||||
list[current_player;main;0,4.7;8,1;]
|
||||
list[current_player;main;0,5.85;8,3;8]
|
||||
list[detached:creative_trash;main;4,3.3;1,1;]
|
||||
listring[]
|
||||
tablecolumns[color;text;color;text]
|
||||
tableoptions[background=#00000000;highlight=#00000000;border=false]
|
||||
button[5.4,3.2;0.8,0.9;creative_prev;<]
|
||||
button[7.25,3.2;0.8,0.9;creative_next;>]
|
||||
button[2.1,3.4;0.8,0.5;creative_search;?]
|
||||
button[2.75,3.4;0.8,0.5;creative_clear;X]
|
||||
tooltip[creative_search;Search]
|
||||
tooltip[creative_clear;Reset]
|
||||
listring[current_player;main]
|
||||
]] ..
|
||||
"field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" ..
|
||||
"listring[detached:creative_" .. player_name .. ";main]" ..
|
||||
"tabheader[0,0;creative_tabs;Crafting,All,Nodes,Tools,Items;" .. tostring(inv.tab_id) .. ";true;false]" ..
|
||||
"list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" ..
|
||||
"table[6.05,3.35;1.15,0.5;pagenum;#FFFF00," .. tostring(pagenum) .. ",#FFFFFF,/ " .. tostring(pagemax) .. "]" ..
|
||||
default.get_hotbar_bg(0,4.7) ..
|
||||
default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
||||
.. creative.formspec_add
|
||||
)
|
||||
end
|
||||
|
||||
creative.set_crafting_formspec = function(player)
|
||||
player:set_inventory_formspec([[
|
||||
size[8,8.6]
|
||||
list[current_player;craft;2,0.75;3,3;]
|
||||
list[current_player;craftpreview;6,1.75;1,1;]
|
||||
list[current_player;main;0,4.7;8,1;]
|
||||
list[current_player;main;0,5.85;8,3;8]
|
||||
list[detached:creative_trash;main;0,2.75;1,1;]
|
||||
image[0.06,2.85;0.8,0.8;creative_trash_icon.png]
|
||||
image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270]
|
||||
tabheader[0,0;creative_tabs;Crafting,All,Nodes,Tools,Items;1;true;false]
|
||||
listring[current_player;main]
|
||||
listring[current_player;craft]
|
||||
]] ..
|
||||
default.get_hotbar_bg(0,4.7) ..
|
||||
default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
||||
)
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
-- If in creative mode, modify player's inventory forms
|
||||
if not creative_mode then
|
||||
return
|
||||
end
|
||||
creative.init_creative_inventory(player)
|
||||
creative.set_creative_formspec(player, 0)
|
||||
end)
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "" or not creative_mode then
|
||||
return
|
||||
end
|
||||
|
||||
local player_name = player:get_player_name()
|
||||
local inv = player_inventory[player_name]
|
||||
|
||||
if fields.quit then
|
||||
if inv.tab_id == 1 then
|
||||
creative.set_crafting_formspec(player)
|
||||
end
|
||||
elseif fields.creative_tabs then
|
||||
local tab = tonumber(fields.creative_tabs)
|
||||
inv.tab_id = tab
|
||||
player_inventory[player_name].start_i = 1
|
||||
|
||||
if tab == 1 then
|
||||
creative.set_crafting_formspec(player)
|
||||
else
|
||||
creative.update_creative_inventory(player_name)
|
||||
creative.set_creative_formspec(player, 0)
|
||||
end
|
||||
elseif fields.creative_clear then
|
||||
player_inventory[player_name].start_i = 1
|
||||
inv.filter = ""
|
||||
creative.update_creative_inventory(player_name)
|
||||
creative.set_creative_formspec(player, 0)
|
||||
elseif fields.creative_search then
|
||||
player_inventory[player_name].start_i = 1
|
||||
inv.filter = fields.creative_filter:lower()
|
||||
creative.update_creative_inventory(player_name)
|
||||
creative.set_creative_formspec(player, 0)
|
||||
else
|
||||
local start_i = player_inventory[player_name].start_i or 0
|
||||
|
||||
if fields.creative_prev then
|
||||
start_i = start_i - 3*8
|
||||
if start_i < 0 then
|
||||
start_i = inv.size - (inv.size % (3*8))
|
||||
if inv.size == start_i then
|
||||
start_i = math.max(0, inv.size - (3*8))
|
||||
end
|
||||
end
|
||||
elseif fields.creative_next then
|
||||
start_i = start_i + 3*8
|
||||
if start_i >= inv.size then
|
||||
start_i = 0
|
||||
end
|
||||
end
|
||||
|
||||
player_inventory[player_name].start_i = start_i
|
||||
creative.set_creative_formspec(player, start_i)
|
||||
end
|
||||
end)
|
||||
|
||||
if creative_mode then
|
||||
local digtime = 0.5
|
||||
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 3}
|
||||
if creative_mode_cache then
|
||||
-- Dig time is modified according to difference (leveldiff) between tool
|
||||
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of
|
||||
-- leveldiff and 1.
|
||||
-- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been
|
||||
-- increased such that nodes of differing levels have an insignificant
|
||||
-- effect on digtime.
|
||||
local digtime = 42
|
||||
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
|
||||
|
||||
minetest.register_item(":", {
|
||||
type = "none",
|
||||
@ -242,22 +36,27 @@ if creative_mode then
|
||||
damage_groups = {fleshy = 10},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||
return true
|
||||
end)
|
||||
-- Unlimited node placement
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||
return creative.is_enabled_for(placer:get_player_name())
|
||||
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
|
||||
-- Don't pick up if the item is already in the inventory
|
||||
local old_handle_node_drops = minetest.handle_node_drops
|
||||
function minetest.handle_node_drops(pos, drops, digger)
|
||||
if not digger or not digger:is_player() then
|
||||
return
|
||||
end
|
||||
if not creative.is_enabled_for(digger:get_player_name()) then
|
||||
return old_handle_node_drops(pos, drops, digger)
|
||||
end
|
||||
local inv = digger:get_inventory()
|
||||
if inv then
|
||||
for _, item in ipairs(drops) do
|
||||
if not inv:contains_item("main", item, true) then
|
||||
inv:add_item("main", item)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
177
mods/creative/inventory.lua
Normal file
@ -0,0 +1,177 @@
|
||||
local player_inventory = {}
|
||||
|
||||
function creative.init_creative_inventory(player)
|
||||
local player_name = player:get_player_name()
|
||||
player_inventory[player_name] = {
|
||||
size = 0,
|
||||
filter = "",
|
||||
start_i = 0
|
||||
}
|
||||
|
||||
minetest.create_detached_inventory("creative_" .. player_name, {
|
||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
|
||||
if not to_list == "main" then
|
||||
return count
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
allow_put = function(inv, listname, index, stack, player2)
|
||||
return 0
|
||||
end,
|
||||
allow_take = function(inv, listname, index, stack, player2)
|
||||
return -1
|
||||
end,
|
||||
on_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
|
||||
end,
|
||||
on_put = function(inv, listname, index, stack, player2)
|
||||
end,
|
||||
on_take = function(inv, listname, index, stack, player2)
|
||||
if stack and stack:get_count() > 0 then
|
||||
minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory")
|
||||
end
|
||||
end,
|
||||
}, player_name)
|
||||
|
||||
return player_inventory[player_name]
|
||||
end
|
||||
|
||||
function creative.update_creative_inventory(player_name, tab_content)
|
||||
local creative_list = {}
|
||||
local inv = player_inventory[player_name] or
|
||||
creative.init_creative_inventory(minetest.get_player_by_name(player_name))
|
||||
local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
|
||||
|
||||
for name, def in pairs(tab_content) do
|
||||
if not (def.groups.not_in_creative_inventory == 1) and
|
||||
def.description and def.description ~= "" and
|
||||
(def.name:find(inv.filter, 1, true) or
|
||||
def.description:lower():find(inv.filter, 1, true)) then
|
||||
creative_list[#creative_list+1] = name
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(creative_list)
|
||||
player_inv:set_size("main", #creative_list)
|
||||
player_inv:set_list("main", creative_list)
|
||||
inv.size = #creative_list
|
||||
end
|
||||
|
||||
-- Create the trash field
|
||||
local trash = minetest.create_detached_inventory("creative_trash", {
|
||||
-- Allow the stack to be placed and remove it in on_put()
|
||||
-- This allows the creative inventory to restore the stack
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
return stack:get_count()
|
||||
end,
|
||||
on_put = function(inv, listname)
|
||||
inv:set_list(listname, {})
|
||||
end,
|
||||
})
|
||||
trash:set_size("main", 1)
|
||||
|
||||
creative.formspec_add = ""
|
||||
|
||||
function creative.register_tab(name, title, items)
|
||||
sfinv.register_page("creative:" .. name, {
|
||||
title = title,
|
||||
is_in_nav = function(self, player, context)
|
||||
return creative.is_enabled_for(player:get_player_name())
|
||||
end,
|
||||
get = function(self, player, context)
|
||||
local player_name = player:get_player_name()
|
||||
creative.update_creative_inventory(player_name, items)
|
||||
local inv = player_inventory[player_name]
|
||||
local start_i = inv.start_i or 0
|
||||
local pagenum = math.floor(start_i / (3*8) + 1)
|
||||
local pagemax = math.ceil(inv.size / (3*8))
|
||||
return sfinv.make_formspec(player, context,
|
||||
"label[6.2,3.35;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" ..
|
||||
[[
|
||||
image[4.06,3.4;0.8,0.8;creative_trash_icon.png]
|
||||
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]
|
||||
list[current_player;main;0,4.7;8,1;]
|
||||
list[current_player;main;0,5.85;8,3;8]
|
||||
list[detached:creative_trash;main;4,3.3;1,1;]
|
||||
listring[]
|
||||
button[5.4,3.2;0.8,0.9;creative_prev;<]
|
||||
button[7.25,3.2;0.8,0.9;creative_next;>]
|
||||
button[2.1,3.4;0.8,0.5;creative_search;?]
|
||||
button[2.75,3.4;0.8,0.5;creative_clear;X]
|
||||
tooltip[creative_search;Search]
|
||||
tooltip[creative_clear;Reset]
|
||||
listring[current_player;main]
|
||||
field_close_on_enter[creative_filter;false]
|
||||
]] ..
|
||||
"field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" ..
|
||||
"listring[detached:creative_" .. player_name .. ";main]" ..
|
||||
"list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" ..
|
||||
default.get_hotbar_bg(0,4.7) ..
|
||||
default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
||||
.. creative.formspec_add, false)
|
||||
end,
|
||||
on_enter = function(self, player, context)
|
||||
local player_name = player:get_player_name()
|
||||
local inv = player_inventory[player_name]
|
||||
if inv then
|
||||
inv.start_i = 0
|
||||
end
|
||||
end,
|
||||
on_player_receive_fields = function(self, player, context, fields)
|
||||
local player_name = player:get_player_name()
|
||||
local inv = player_inventory[player_name]
|
||||
assert(inv)
|
||||
|
||||
if fields.creative_clear then
|
||||
inv.start_i = 0
|
||||
inv.filter = ""
|
||||
creative.update_creative_inventory(player_name, items)
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
elseif fields.creative_search or
|
||||
fields.key_enter_field == "creative_filter" then
|
||||
inv.start_i = 0
|
||||
inv.filter = fields.creative_filter:lower()
|
||||
creative.update_creative_inventory(player_name, items)
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
elseif not fields.quit then
|
||||
local start_i = inv.start_i or 0
|
||||
|
||||
if fields.creative_prev then
|
||||
start_i = start_i - 3*8
|
||||
if start_i < 0 then
|
||||
start_i = inv.size - (inv.size % (3*8))
|
||||
if inv.size == start_i then
|
||||
start_i = math.max(0, inv.size - (3*8))
|
||||
end
|
||||
end
|
||||
elseif fields.creative_next then
|
||||
start_i = start_i + 3*8
|
||||
if start_i >= inv.size then
|
||||
start_i = 0
|
||||
end
|
||||
end
|
||||
|
||||
inv.start_i = start_i
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
creative.update_creative_inventory(player:get_player_name(), minetest.registered_items)
|
||||
end)
|
||||
|
||||
creative.register_tab("all", "All", minetest.registered_items)
|
||||
creative.register_tab("nodes", "Nodes", minetest.registered_nodes)
|
||||
creative.register_tab("tools", "Tools", minetest.registered_tools)
|
||||
creative.register_tab("craftitems", "Items", minetest.registered_craftitems)
|
||||
|
||||
local old_homepage_name = sfinv.get_homepage_name
|
||||
function sfinv.get_homepage_name(player)
|
||||
if creative.is_enabled_for(player:get_player_name()) then
|
||||
return "creative:all"
|
||||
else
|
||||
return old_homepage_name(player)
|
||||
end
|
||||
end
|
60
mods/creative/license.txt
Normal file
@ -0,0 +1,60 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2012-2016 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
||||
Copyright (C) 2015-2016 Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@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.
|
||||
|
||||
For more details:
|
||||
https://opensource.org/licenses/MIT
|
||||
|
||||
|
||||
Licenses of media (textures)
|
||||
----------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2016 Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com>
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
@ -22,7 +22,7 @@ minetest.register_alias("papyrus", "default:papyrus")
|
||||
minetest.register_alias("bookshelf", "default:bookshelf")
|
||||
minetest.register_alias("glass", "default:glass")
|
||||
minetest.register_alias("wooden_fence", "default:fence_wood")
|
||||
minetest.register_alias("rail", "default:rail")
|
||||
minetest.register_alias("rail", "carts:rail")
|
||||
minetest.register_alias("ladder", "default:ladder_wood")
|
||||
minetest.register_alias("wood", "default:wood")
|
||||
minetest.register_alias("mese", "default:mese")
|
||||
|
@ -35,6 +35,20 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:wood',
|
||||
recipe = {
|
||||
{'default:bush_stem'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:acacia_wood',
|
||||
recipe = {
|
||||
{'default:acacia_bush_stem'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:stick 4',
|
||||
recipe = {
|
||||
@ -339,11 +353,9 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:rail 24',
|
||||
output = 'default:skeleton_key',
|
||||
recipe = {
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
{'default:gold_ingot'},
|
||||
}
|
||||
})
|
||||
|
||||
@ -380,12 +392,6 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "default:bronze_ingot",
|
||||
recipe = {"default:steel_ingot", "default:copper_ingot"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:coalblock',
|
||||
recipe = {
|
||||
@ -434,6 +440,31 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:tinblock",
|
||||
recipe = {
|
||||
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
|
||||
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
|
||||
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:tin_ingot 9",
|
||||
recipe = {
|
||||
{"default:tinblock"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:bronze_ingot 9",
|
||||
recipe = {
|
||||
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
|
||||
{"default:copper_ingot", "default:tin_ingot", "default:copper_ingot"},
|
||||
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:bronzeblock',
|
||||
recipe = {
|
||||
@ -483,34 +514,98 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sandstone',
|
||||
output = "default:sandstone",
|
||||
recipe = {
|
||||
{'group:sand', 'group:sand'},
|
||||
{'group:sand', 'group:sand'},
|
||||
{"default:sand", "default:sand"},
|
||||
{"default:sand", "default:sand"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sand 4',
|
||||
output = "default:sand 4",
|
||||
recipe = {
|
||||
{'default:sandstone'},
|
||||
{"default:sandstone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sandstonebrick 4',
|
||||
output = "default:sandstonebrick 4",
|
||||
recipe = {
|
||||
{'default:sandstone', 'default:sandstone'},
|
||||
{'default:sandstone', 'default:sandstone'},
|
||||
{"default:sandstone", "default:sandstone"},
|
||||
{"default:sandstone", "default:sandstone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:sandstone_block 9',
|
||||
output = "default:sandstone_block 9",
|
||||
recipe = {
|
||||
{'default:sandstone', 'default:sandstone', 'default:sandstone'},
|
||||
{'default:sandstone', 'default:sandstone', 'default:sandstone'},
|
||||
{'default:sandstone', 'default:sandstone', 'default:sandstone'},
|
||||
{"default:sandstone", "default:sandstone", "default:sandstone"},
|
||||
{"default:sandstone", "default:sandstone", "default:sandstone"},
|
||||
{"default:sandstone", "default:sandstone", "default:sandstone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:desert_sandstone",
|
||||
recipe = {
|
||||
{"default:desert_sand", "default:desert_sand"},
|
||||
{"default:desert_sand", "default:desert_sand"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:desert_sand 4",
|
||||
recipe = {
|
||||
{"default:desert_sandstone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:desert_sandstone_brick 4",
|
||||
recipe = {
|
||||
{"default:desert_sandstone", "default:desert_sandstone"},
|
||||
{"default:desert_sandstone", "default:desert_sandstone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:desert_sandstone_block 9",
|
||||
recipe = {
|
||||
{"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"},
|
||||
{"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"},
|
||||
{"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:silver_sandstone",
|
||||
recipe = {
|
||||
{"default:silver_sand", "default:silver_sand"},
|
||||
{"default:silver_sand", "default:silver_sand"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:silver_sand 4",
|
||||
recipe = {
|
||||
{"default:silver_sandstone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:silver_sandstone_brick 4",
|
||||
recipe = {
|
||||
{"default:silver_sandstone", "default:silver_sandstone"},
|
||||
{"default:silver_sandstone", "default:silver_sandstone"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:silver_sandstone_block 9",
|
||||
recipe = {
|
||||
{"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"},
|
||||
{"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"},
|
||||
{"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"},
|
||||
}
|
||||
})
|
||||
|
||||
@ -570,11 +665,11 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:ladder_wood 3',
|
||||
output = "default:ladder_wood 5",
|
||||
recipe = {
|
||||
{'group:stick', '', 'group:stick'},
|
||||
{'group:stick', 'group:stick', 'group:stick'},
|
||||
{'group:stick', '', 'group:stick'},
|
||||
{"group:stick", "", "group:stick"},
|
||||
{"group:stick", "group:stick", "group:stick"},
|
||||
{"group:stick", "", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
@ -620,10 +715,19 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:meselamp 1',
|
||||
output = 'default:meselamp',
|
||||
recipe = {
|
||||
{'', 'default:mese_crystal',''},
|
||||
{'default:mese_crystal', 'default:glass', 'default:mese_crystal'},
|
||||
{'default:glass'},
|
||||
{'default:mese_crystal'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:mese_post_light 3",
|
||||
recipe = {
|
||||
{"", "default:glass", ""},
|
||||
{"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
|
||||
{"", "group:wood", ""},
|
||||
}
|
||||
})
|
||||
|
||||
@ -764,6 +868,12 @@ minetest.register_craft({
|
||||
recipe = "default:copper_lump",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:tin_ingot",
|
||||
recipe = "default:tin_lump",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:gold_ingot",
|
||||
@ -776,6 +886,20 @@ minetest.register_craft({
|
||||
recipe = "default:clay_lump",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'cooking',
|
||||
output = 'default:gold_ingot',
|
||||
recipe = 'default:skeleton_key',
|
||||
cooktime = 5,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'cooking',
|
||||
output = 'default:gold_ingot',
|
||||
recipe = 'default:key',
|
||||
cooktime = 5,
|
||||
})
|
||||
|
||||
--
|
||||
-- Fuels
|
||||
--
|
||||
@ -867,6 +991,18 @@ minetest.register_craft({
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:bush_sapling",
|
||||
burntime = 6,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:acacia_bush_sapling",
|
||||
burntime = 7,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:aspen_sapling",
|
||||
@ -901,34 +1037,46 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fence_aspen_wood",
|
||||
burntime = 11,
|
||||
burntime = 5,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fence_pine_wood",
|
||||
burntime = 13,
|
||||
burntime = 6,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fence_wood",
|
||||
burntime = 15,
|
||||
burntime = 7,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fence_acacia_wood",
|
||||
burntime = 17,
|
||||
burntime = 8,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fence_junglewood",
|
||||
burntime = 19,
|
||||
burntime = 9,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:bush_stem",
|
||||
burntime = 7,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:acacia_bush_stem",
|
||||
burntime = 8,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:junglegrass",
|
||||
@ -962,7 +1110,7 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:ladder_wood",
|
||||
burntime = 5,
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
@ -1024,3 +1172,58 @@ minetest.register_craft({
|
||||
recipe = "default:dry_grass_1",
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:paper",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:book",
|
||||
burntime = 3,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:book_written",
|
||||
burntime = 3,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:dry_shrub",
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "group:stick",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:pick_wood",
|
||||
burntime = 6,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:shovel_wood",
|
||||
burntime = 4,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:axe_wood",
|
||||
burntime = 6,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:sword_wood",
|
||||
burntime = 5,
|
||||
})
|
||||
|
@ -12,14 +12,23 @@ minetest.register_craftitem("default:paper", {
|
||||
groups = {flammable = 3},
|
||||
})
|
||||
|
||||
|
||||
local lpp = 14 -- Lines per book's page
|
||||
local function book_on_use(itemstack, user)
|
||||
local player_name = user:get_player_name()
|
||||
local data = minetest.deserialize(itemstack:get_metadata())
|
||||
local meta = itemstack:get_meta()
|
||||
local title, text, owner = "", "", player_name
|
||||
local page, page_max, lines, string = 1, 1, {}, ""
|
||||
|
||||
if data then
|
||||
-- Backwards compatibility
|
||||
local old_data = minetest.deserialize(itemstack:get_metadata())
|
||||
if old_data then
|
||||
meta:from_table({ fields = old_data })
|
||||
end
|
||||
|
||||
local data = meta:to_table().fields
|
||||
|
||||
if data.owner then
|
||||
title = data.title
|
||||
text = data.text
|
||||
owner = data.owner
|
||||
@ -63,6 +72,7 @@ local function book_on_use(itemstack, user)
|
||||
end
|
||||
|
||||
minetest.show_formspec(player_name, "default:book", formspec)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
@ -81,35 +91,42 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
new_stack = ItemStack("default:book_written")
|
||||
end
|
||||
else
|
||||
data = minetest.deserialize(stack:get_metadata())
|
||||
data = stack:get_meta():to_table().fields
|
||||
end
|
||||
|
||||
if data and data.owner and data.owner ~= player:get_player_name() then
|
||||
return
|
||||
end
|
||||
|
||||
if not data then data = {} end
|
||||
data.title = fields.title
|
||||
data.owner = player:get_player_name()
|
||||
data.description = "\""..fields.title.."\" by "..data.owner
|
||||
data.text = fields.text
|
||||
data.text_len = #data.text
|
||||
data.page = 1
|
||||
data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp)
|
||||
data.owner = player:get_player_name()
|
||||
local data_str = minetest.serialize(data)
|
||||
|
||||
if new_stack then
|
||||
new_stack:set_metadata(data_str)
|
||||
new_stack:get_meta():from_table({ fields = data })
|
||||
if inv:room_for_item("main", new_stack) then
|
||||
inv:add_item("main", new_stack)
|
||||
else
|
||||
minetest.add_item(player:getpos(), new_stack)
|
||||
end
|
||||
else
|
||||
stack:set_metadata(data_str)
|
||||
stack:get_meta():from_table({ fields = data })
|
||||
end
|
||||
|
||||
elseif fields.book_next or fields.book_prev then
|
||||
local data = minetest.deserialize(stack:get_metadata())
|
||||
local data = stack:get_meta():to_table().fields
|
||||
if not data or not data.page then
|
||||
return
|
||||
end
|
||||
|
||||
data.page = tonumber(data.page)
|
||||
data.page_max = tonumber(data.page_max)
|
||||
|
||||
if fields.book_next then
|
||||
data.page = data.page + 1
|
||||
if data.page > data.page_max then
|
||||
@ -122,11 +139,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
end
|
||||
|
||||
local data_str = minetest.serialize(data)
|
||||
stack:set_metadata(data_str)
|
||||
book_on_use(stack, player)
|
||||
stack:get_meta():from_table({fields = data})
|
||||
stack = book_on_use(stack, player)
|
||||
end
|
||||
|
||||
-- Update stack
|
||||
player:set_wielded_item(stack)
|
||||
end)
|
||||
|
||||
@ -167,13 +184,69 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv
|
||||
if not original then
|
||||
return
|
||||
end
|
||||
local copymeta = original:get_metadata()
|
||||
local copymeta = original:get_meta():to_table()
|
||||
-- copy of the book held by player's mouse cursor
|
||||
itemstack:set_metadata(copymeta)
|
||||
itemstack:get_meta():from_table(copymeta)
|
||||
-- put the book with metadata back in the craft grid
|
||||
craft_inv:set_stack("craft", index, original)
|
||||
end)
|
||||
|
||||
minetest.register_craftitem("default:skeleton_key", {
|
||||
description = "Skeleton Key",
|
||||
inventory_image = "default_key_skeleton.png",
|
||||
groups = {key = 1},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if not node then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use
|
||||
if not on_skeleton_key_use then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- make a new key secret in case the node callback needs it
|
||||
local random = math.random
|
||||
local newsecret = string.format(
|
||||
"%04x%04x%04x%04x",
|
||||
random(2^16) - 1, random(2^16) - 1,
|
||||
random(2^16) - 1, random(2^16) - 1)
|
||||
|
||||
local secret, _, _ = on_skeleton_key_use(pos, user, newsecret)
|
||||
|
||||
if secret then
|
||||
local inv = minetest.get_inventory({type="player", name=user:get_player_name()})
|
||||
|
||||
-- update original itemstack
|
||||
itemstack:take_item()
|
||||
|
||||
-- finish and return the new key
|
||||
local new_stack = ItemStack("default:key")
|
||||
local meta = new_stack:get_meta()
|
||||
meta:set_string("secret", secret)
|
||||
meta:set_string("description", "Key to "..user:get_player_name().."'s "
|
||||
..minetest.registered_nodes[node.name].description)
|
||||
|
||||
if itemstack:get_count() == 0 then
|
||||
itemstack = new_stack
|
||||
else
|
||||
if inv:add_item("main", new_stack):get_count() > 0 then
|
||||
minetest.add_item(user:getpos(), new_stack)
|
||||
end -- else: added to inventory successfully
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:coal_lump", {
|
||||
description = "Coal Lump",
|
||||
inventory_image = "default_coal_lump.png",
|
||||
@ -190,6 +263,11 @@ minetest.register_craftitem("default:copper_lump", {
|
||||
inventory_image = "default_copper_lump.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:tin_lump", {
|
||||
description = "Tin Lump",
|
||||
inventory_image = "default_tin_lump.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:mese_crystal", {
|
||||
description = "Mese Crystal",
|
||||
inventory_image = "default_mese_crystal.png",
|
||||
@ -220,6 +298,11 @@ minetest.register_craftitem("default:copper_ingot", {
|
||||
inventory_image = "default_copper_ingot.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:tin_ingot", {
|
||||
description = "Tin Ingot",
|
||||
inventory_image = "default_tin_ingot.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:bronze_ingot", {
|
||||
description = "Bronze Ingot",
|
||||
inventory_image = "default_bronze_ingot.png",
|
||||
@ -249,4 +332,3 @@ minetest.register_craftitem("default:flint", {
|
||||
description = "Flint",
|
||||
inventory_image = "default_flint.png"
|
||||
})
|
||||
|
||||
|
@ -18,7 +18,7 @@ end
|
||||
function default.node_sound_stone_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "default_hard_footstep", gain = 0.5}
|
||||
{name = "default_hard_footstep", gain = 0.3}
|
||||
table.dug = table.dug or
|
||||
{name = "default_hard_footstep", gain = 1.0}
|
||||
default.node_sound_defaults(table)
|
||||
@ -28,9 +28,9 @@ end
|
||||
function default.node_sound_dirt_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "default_dirt_footstep", gain = 1.0}
|
||||
{name = "default_dirt_footstep", gain = 0.4}
|
||||
table.dug = table.dug or
|
||||
{name = "default_dirt_footstep", gain = 1.5}
|
||||
{name = "default_dirt_footstep", gain = 1.0}
|
||||
table.place = table.place or
|
||||
{name = "default_place_node", gain = 1.0}
|
||||
default.node_sound_defaults(table)
|
||||
@ -52,7 +52,7 @@ end
|
||||
function default.node_sound_gravel_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "default_gravel_footstep", gain = 0.5}
|
||||
{name = "default_gravel_footstep", gain = 0.4}
|
||||
table.dug = table.dug or
|
||||
{name = "default_gravel_footstep", gain = 1.0}
|
||||
table.place = table.place or
|
||||
@ -64,7 +64,7 @@ end
|
||||
function default.node_sound_wood_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "default_wood_footstep", gain = 0.5}
|
||||
{name = "default_wood_footstep", gain = 0.3}
|
||||
table.dug = table.dug or
|
||||
{name = "default_wood_footstep", gain = 1.0}
|
||||
default.node_sound_defaults(table)
|
||||
@ -74,11 +74,9 @@ end
|
||||
function default.node_sound_leaves_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "default_grass_footstep", gain = 0.35}
|
||||
{name = "default_grass_footstep", gain = 0.45}
|
||||
table.dug = table.dug or
|
||||
{name = "default_grass_footstep", gain = 0.7}
|
||||
table.dig = table.dig or
|
||||
{name = "default_dig_crumbly", gain = 0.4}
|
||||
table.place = table.place or
|
||||
{name = "default_place_node", gain = 1.0}
|
||||
default.node_sound_defaults(table)
|
||||
@ -88,6 +86,8 @@ end
|
||||
function default.node_sound_glass_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "default_glass_footstep", gain = 0.3}
|
||||
table.dig = table.dig or
|
||||
{name = "default_glass_footstep", gain = 0.5}
|
||||
table.dug = table.dug or
|
||||
{name = "default_break_glass", gain = 1.0}
|
||||
@ -98,7 +98,7 @@ end
|
||||
function default.node_sound_metal_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "default_metal_footstep", gain = 0.5}
|
||||
{name = "default_metal_footstep", gain = 0.4}
|
||||
table.dig = table.dig or
|
||||
{name = "default_dig_metal", gain = 0.5}
|
||||
table.dug = table.dug or
|
||||
@ -109,6 +109,14 @@ function default.node_sound_metal_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function default.node_sound_water_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name = "default_water_footstep", gain = 0.2}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
--
|
||||
-- Lavacooling
|
||||
--
|
||||
@ -123,18 +131,17 @@ default.cool_lava = function(pos, node)
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.25})
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Lava cooling",
|
||||
nodenames = {"default:lava_source", "default:lava_flowing"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
catch_up = false,
|
||||
action = function(...)
|
||||
default.cool_lava(...)
|
||||
end,
|
||||
})
|
||||
|
||||
if minetest.settings:get_bool("enable_lavacooling") ~= false then
|
||||
minetest.register_abm({
|
||||
label = "Lava cooling",
|
||||
nodenames = {"default:lava_source", "default:lava_flowing"},
|
||||
neighbors = {"group:cools_lava", "group:water"},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
catch_up = false,
|
||||
action = default.cool_lava,
|
||||
})
|
||||
end
|
||||
|
||||
--
|
||||
-- optimized helper to put all items in an inventory into a drops list
|
||||
@ -176,6 +183,9 @@ function default.grow_cactus(pos, node)
|
||||
if height == 4 or node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
if minetest.get_node_light(pos) < 13 then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name = "default:cactus"})
|
||||
return true
|
||||
end
|
||||
@ -199,6 +209,9 @@ function default.grow_papyrus(pos, node)
|
||||
if height == 4 or node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
if minetest.get_node_light(pos) < 13 then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name = "default:papyrus"})
|
||||
return true
|
||||
end
|
||||
@ -209,9 +222,7 @@ minetest.register_abm({
|
||||
neighbors = {"group:sand"},
|
||||
interval = 12,
|
||||
chance = 83,
|
||||
action = function(...)
|
||||
default.grow_cactus(...)
|
||||
end
|
||||
action = default.grow_cactus
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
@ -220,9 +231,7 @@ minetest.register_abm({
|
||||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 14,
|
||||
chance = 71,
|
||||
action = function(...)
|
||||
default.grow_papyrus(...)
|
||||
end
|
||||
action = default.grow_papyrus
|
||||
})
|
||||
|
||||
|
||||
@ -311,47 +320,65 @@ default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
|
||||
end
|
||||
end
|
||||
|
||||
-- Leafdecay ABM
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Leaf decay",
|
||||
nodenames = {"group:leafdecay"},
|
||||
neighbors = {"air"},
|
||||
interval = 2,
|
||||
chance = 10,
|
||||
catch_up = false,
|
||||
|
||||
action = function(pos, node, _, _)
|
||||
-- Check if leaf is placed
|
||||
if node.param2 ~= 0 then
|
||||
return
|
||||
-- Leafdecay
|
||||
local function leafdecay_after_destruct(pos, oldnode, def)
|
||||
for _, v in pairs(minetest.find_nodes_in_area(vector.subtract(pos, def.radius),
|
||||
vector.add(pos, def.radius), def.leaves)) do
|
||||
local node = minetest.get_node(v)
|
||||
local timer = minetest.get_node_timer(v)
|
||||
if node.param2 == 0 and not timer:is_started() then
|
||||
timer:start(math.random(20, 120) / 10)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local rad = minetest.registered_nodes[node.name].groups.leafdecay
|
||||
-- Assume ignore is a trunk, to make this
|
||||
-- work at the border of a loaded area
|
||||
if minetest.find_node_near(pos, rad, {"ignore", "group:tree"}) then
|
||||
return
|
||||
end
|
||||
-- Drop stuff
|
||||
local itemstacks = minetest.get_node_drops(node.name)
|
||||
for _, itemname in ipairs(itemstacks) do
|
||||
if itemname ~= node.name or
|
||||
minetest.get_item_group(node.name, "leafdecay_drop") ~= 0 then
|
||||
local p_drop = {
|
||||
x = pos.x - 0.5 + math.random(),
|
||||
y = pos.y - 0.5 + math.random(),
|
||||
z = pos.z - 0.5 + math.random(),
|
||||
}
|
||||
minetest.add_item(p_drop, itemname)
|
||||
local function leafdecay_on_timer(pos, def)
|
||||
if minetest.find_node_near(pos, def.radius, def.trunks) then
|
||||
return false
|
||||
end
|
||||
|
||||
local node = minetest.get_node(pos)
|
||||
local drops = minetest.get_node_drops(node.name)
|
||||
for _, item in ipairs(drops) do
|
||||
local is_leaf
|
||||
for _, v in pairs(def.leaves) do
|
||||
if v == item then
|
||||
is_leaf = true
|
||||
end
|
||||
end
|
||||
-- Remove node
|
||||
minetest.remove_node(pos)
|
||||
nodeupdate(pos)
|
||||
if minetest.get_item_group(item, "leafdecay_drop") ~= 0 or
|
||||
not is_leaf then
|
||||
minetest.add_item({
|
||||
x = pos.x - 0.5 + math.random(),
|
||||
y = pos.y - 0.5 + math.random(),
|
||||
z = pos.z - 0.5 + math.random(),
|
||||
}, item)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.remove_node(pos)
|
||||
minetest.check_for_falling(pos)
|
||||
end
|
||||
|
||||
function default.register_leafdecay(def)
|
||||
assert(def.leaves)
|
||||
assert(def.trunks)
|
||||
assert(def.radius)
|
||||
for _, v in pairs(def.trunks) do
|
||||
minetest.override_item(v, {
|
||||
after_destruct = function(pos, oldnode)
|
||||
leafdecay_after_destruct(pos, oldnode, def)
|
||||
end,
|
||||
})
|
||||
end
|
||||
for _, v in pairs(def.leaves) do
|
||||
minetest.override_item(v, {
|
||||
on_timer = function(pos)
|
||||
leafdecay_on_timer(pos, def)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Convert dirt to something that fits the environment
|
||||
@ -429,7 +456,7 @@ minetest.register_abm({
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Moss growth",
|
||||
nodenames = {"default:cobble", "stairs:slab_cobble", "stairs:stair_cobble"},
|
||||
nodenames = {"default:cobble", "stairs:slab_cobble", "stairs:stair_cobble", "walls:cobble"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 16,
|
||||
chance = 200,
|
||||
@ -441,6 +468,8 @@ minetest.register_abm({
|
||||
minetest.set_node(pos, {name = "stairs:slab_mossycobble", param2 = node.param2})
|
||||
elseif node.name == "stairs:stair_cobble" then
|
||||
minetest.set_node(pos, {name = "stairs:stair_mossycobble", param2 = node.param2})
|
||||
elseif node.name == "walls:cobble" then
|
||||
minetest.set_node(pos, {name = "walls:mossycobble", param2 = node.param2})
|
||||
end
|
||||
end
|
||||
})
|
||||
@ -500,3 +529,46 @@ minetest.register_abm({
|
||||
minetest.set_node(pos, {name = "default:coral_skeleton"})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- NOTICE: This method is not an official part of the API yet!
|
||||
-- This method may change in future.
|
||||
--
|
||||
|
||||
function default.can_interact_with_node(player, pos)
|
||||
if player then
|
||||
if minetest.check_player_privs(player, "protection_bypass") then
|
||||
return true
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
|
||||
if not owner or owner == "" or owner == player:get_player_name() then
|
||||
return true
|
||||
end
|
||||
|
||||
-- is player wielding the right key?
|
||||
local item = player:get_wielded_item()
|
||||
if item:get_name() == "default:key" then
|
||||
local key_meta = item:get_meta()
|
||||
|
||||
if key_meta:get_string("secret") == "" then
|
||||
local key_oldmeta = item:get_metadata()
|
||||
if key_oldmeta == "" or not minetest.parse_json(key_oldmeta) then
|
||||
return false
|
||||
end
|
||||
|
||||
key_meta:set_string("secret", minetest.parse_json(key_oldmeta).secret)
|
||||
item:set_metadata("")
|
||||
end
|
||||
|
||||
return meta:get_string("key_lock_secret") == key_meta:get_string("secret")
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
@ -4,7 +4,7 @@
|
||||
--
|
||||
|
||||
local function active_formspec(fuel_percent, item_percent)
|
||||
local formspec =
|
||||
local formspec =
|
||||
"size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
@ -22,6 +22,8 @@ local function active_formspec(fuel_percent, item_percent)
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;fuel]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
return formspec
|
||||
end
|
||||
@ -42,6 +44,8 @@ local inactive_formspec =
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;fuel]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
|
||||
--
|
||||
@ -109,62 +113,78 @@ local function furnace_node_timer(pos, elapsed)
|
||||
local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
local srclist = inv:get_list("src")
|
||||
local fuellist = inv:get_list("fuel")
|
||||
local srclist, fuellist
|
||||
|
||||
--
|
||||
-- Cooking
|
||||
--
|
||||
local cookable, cooked
|
||||
local fuel
|
||||
|
||||
-- Check if we have cookable content
|
||||
local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
local cookable = true
|
||||
local update = true
|
||||
while update do
|
||||
update = false
|
||||
|
||||
if cooked.time == 0 then
|
||||
cookable = false
|
||||
end
|
||||
srclist = inv:get_list("src")
|
||||
fuellist = inv:get_list("fuel")
|
||||
|
||||
-- Check if we have enough fuel to burn
|
||||
if fuel_time < fuel_totaltime then
|
||||
-- The furnace is currently active and has enough fuel
|
||||
fuel_time = fuel_time + 1
|
||||
--
|
||||
-- Cooking
|
||||
--
|
||||
|
||||
-- If there is a cookable item then check if it is ready yet
|
||||
if cookable then
|
||||
src_time = src_time + 1
|
||||
if src_time >= cooked.time then
|
||||
-- Place result in dst list if possible
|
||||
if inv:room_for_item("dst", cooked.item) then
|
||||
inv:add_item("dst", cooked.item)
|
||||
inv:set_stack("src", 1, aftercooked.items[1])
|
||||
src_time = 0
|
||||
-- Check if we have cookable content
|
||||
local aftercooked
|
||||
cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
cookable = cooked.time ~= 0
|
||||
|
||||
-- Check if we have enough fuel to burn
|
||||
if fuel_time < fuel_totaltime then
|
||||
-- The furnace is currently active and has enough fuel
|
||||
fuel_time = fuel_time + elapsed
|
||||
-- If there is a cookable item then check if it is ready yet
|
||||
if cookable then
|
||||
src_time = src_time + elapsed
|
||||
if src_time >= cooked.time then
|
||||
-- Place result in dst list if possible
|
||||
if inv:room_for_item("dst", cooked.item) then
|
||||
inv:add_item("dst", cooked.item)
|
||||
inv:set_stack("src", 1, aftercooked.items[1])
|
||||
src_time = src_time - cooked.time
|
||||
update = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Furnace ran out of fuel
|
||||
if cookable then
|
||||
-- We need to get new fuel
|
||||
local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||
|
||||
if fuel.time == 0 then
|
||||
-- No valid fuel in fuel list
|
||||
fuel_totaltime = 0
|
||||
fuel_time = 0
|
||||
src_time = 0
|
||||
else
|
||||
-- Take fuel from fuel list
|
||||
inv:set_stack("fuel", 1, afterfuel.items[1])
|
||||
|
||||
fuel_totaltime = fuel.time
|
||||
fuel_time = 0
|
||||
end
|
||||
else
|
||||
-- We don't need to get new fuel since there is no cookable item
|
||||
fuel_totaltime = 0
|
||||
-- Furnace ran out of fuel
|
||||
if cookable then
|
||||
-- We need to get new fuel
|
||||
local afterfuel
|
||||
fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
|
||||
|
||||
if fuel.time == 0 then
|
||||
-- No valid fuel in fuel list
|
||||
fuel_totaltime = 0
|
||||
src_time = 0
|
||||
else
|
||||
-- Take fuel from fuel list
|
||||
inv:set_stack("fuel", 1, afterfuel.items[1])
|
||||
update = true
|
||||
fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime)
|
||||
src_time = src_time + elapsed
|
||||
end
|
||||
else
|
||||
-- We don't need to get new fuel since there is no cookable item
|
||||
fuel_totaltime = 0
|
||||
src_time = 0
|
||||
end
|
||||
fuel_time = 0
|
||||
src_time = 0
|
||||
end
|
||||
|
||||
elapsed = 0
|
||||
end
|
||||
|
||||
if fuel and fuel_totaltime > fuel.time then
|
||||
fuel_totaltime = fuel.time
|
||||
end
|
||||
if srclist[1]:is_empty() then
|
||||
src_time = 0
|
||||
end
|
||||
|
||||
--
|
||||
@ -192,7 +212,7 @@ local function furnace_node_timer(pos, elapsed)
|
||||
local active = "inactive "
|
||||
local result = false
|
||||
|
||||
if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then
|
||||
if fuel_totaltime ~= 0 then
|
||||
active = "active "
|
||||
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
|
||||
fuel_state = fuel_percent .. "%"
|
||||
@ -206,8 +226,7 @@ local function furnace_node_timer(pos, elapsed)
|
||||
end
|
||||
swap_node(pos, "default:furnace")
|
||||
-- stop timer on the inactive furnace
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:stop()
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
|
||||
local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")"
|
||||
@ -255,13 +274,11 @@ minetest.register_node("default:furnace", {
|
||||
end,
|
||||
|
||||
on_metadata_inventory_move = function(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
minetest.get_node_timer(pos):start(1.0)
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos)
|
||||
-- start timer function, it will sort out whether furnace can burn or not.
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
minetest.get_node_timer(pos):start(1.0)
|
||||
end,
|
||||
on_blast = function(pos)
|
||||
local drops = {}
|
||||
|
@ -41,6 +41,7 @@ dofile(default_path.."/functions.lua")
|
||||
dofile(default_path.."/trees.lua")
|
||||
dofile(default_path.."/nodes.lua")
|
||||
dofile(default_path.."/furnace.lua")
|
||||
dofile(default_path.."/torch.lua")
|
||||
dofile(default_path.."/tools.lua")
|
||||
dofile(default_path.."/item_entity.lua")
|
||||
dofile(default_path.."/craftitems.lua")
|
||||
|
@ -41,6 +41,9 @@ Copyright (C) 2010-2016:
|
||||
asl97
|
||||
KevDoy
|
||||
Mito551
|
||||
GreenXenith
|
||||
kaeza
|
||||
kilbith
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
@ -144,6 +147,9 @@ Copyright (C) 2009 cmusounddesign
|
||||
Copyright (C) 2010 Tomlija
|
||||
Copyright (C) 2010 lsprice
|
||||
Copyright (C) 2014 sonictechtonic
|
||||
Copyright (C) 2015 yadronoff
|
||||
Copyright (C) 2007 HerbertBoland
|
||||
Copyright (C) 2006 AGFX
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
|
79
mods/default/models/chest_open.obj
Normal file
@ -0,0 +1,79 @@
|
||||
# Blender v2.78 (sub 0) OBJ File: 'chest-open.blend'
|
||||
# www.blender.org
|
||||
o Top_Cube.002_None_Top_Cube.002_None_bottom
|
||||
v -0.500000 0.408471 0.720970
|
||||
v -0.500000 1.115578 0.013863
|
||||
v -0.500000 0.894607 -0.207108
|
||||
v -0.500000 0.187501 0.499999
|
||||
v 0.500000 1.115578 0.013863
|
||||
v 0.500000 0.408471 0.720970
|
||||
v 0.500000 0.187501 0.499999
|
||||
v 0.500000 0.894607 -0.207108
|
||||
v -0.500000 0.187500 -0.500000
|
||||
v -0.500000 -0.500000 -0.500000
|
||||
v -0.500000 -0.500000 0.500000
|
||||
v 0.500000 0.187500 -0.500000
|
||||
v 0.500000 -0.500000 0.500000
|
||||
v 0.500000 -0.500000 -0.500000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 1.0000 0.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 1.0000 0.6875
|
||||
vt 0.0000 0.6875
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 0.6875
|
||||
vt 1.0000 0.6875
|
||||
vt 1.0000 0.6875
|
||||
vt 1.0000 0.0000
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.6875
|
||||
vt 1.0000 0.0000
|
||||
vt 1.0000 1.0000
|
||||
vt 1.0000 0.6875
|
||||
vt 1.0000 0.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.6875
|
||||
vt 0.0000 0.6875
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.5000
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.5000
|
||||
vt 0.0000 0.0000
|
||||
vt 1.0000 0.0000
|
||||
vn 0.0000 0.7071 0.7071
|
||||
vn -0.0000 -1.0000 -0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 1.0000 0.0000 -0.0000
|
||||
vn 0.0000 -0.7071 0.7071
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn -0.0000 0.7071 -0.7071
|
||||
vn -0.0000 0.0000 -1.0000
|
||||
vn -0.0000 -0.7071 -0.7071
|
||||
vn -0.0000 1.0000 -0.0000
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Top
|
||||
s off
|
||||
f 6/1/1 5/2/1 2/3/1 1/4/1
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Bottom
|
||||
f 11/5/2 10/6/2 14/7/2 13/8/2
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Right-Left
|
||||
f 1/9/3 2/10/3 3/11/3 4/12/3
|
||||
f 5/13/4 6/1/4 7/14/4 8/15/4
|
||||
f 4/12/3 9/16/3 10/17/3 11/18/3
|
||||
f 12/19/4 7/14/4 13/8/4 14/20/4
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Back
|
||||
f 6/21/5 1/9/5 4/12/5 7/22/5
|
||||
f 7/22/6 4/12/6 11/18/6 13/23/6
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Front
|
||||
f 2/10/7 5/24/7 8/25/7 3/11/7
|
||||
f 9/16/8 12/26/8 14/27/8 10/17/8
|
||||
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Inside
|
||||
f 4/28/9 3/29/9 8/30/9 7/31/9
|
||||
f 7/31/10 12/32/10 9/33/10 4/28/10
|
58
mods/default/models/torch_ceiling.obj
Normal file
@ -0,0 +1,58 @@
|
||||
# Blender v2.77 (sub 0) OBJ File: 'torch_ceiling.blend'
|
||||
# www.blender.org
|
||||
mtllib torch_ceiling.mtl
|
||||
o Cube_Cube.001
|
||||
v -0.062469 -0.047331 0.068152
|
||||
v -0.062469 -0.559515 -0.164388
|
||||
v -0.062469 0.004344 -0.045667
|
||||
v -0.062469 -0.507839 -0.278206
|
||||
v 0.062531 -0.047331 0.068152
|
||||
v 0.062531 -0.559515 -0.164388
|
||||
v 0.062531 0.004344 -0.045667
|
||||
v 0.062531 -0.507839 -0.278206
|
||||
v 0.353584 0.040000 0.363553
|
||||
v 0.353584 -0.397500 0.363553
|
||||
v -0.353522 0.040000 -0.343553
|
||||
v -0.353522 -0.397500 -0.343553
|
||||
v 0.353584 0.040000 -0.343553
|
||||
v -0.353522 0.040000 0.363553
|
||||
v 0.353584 -0.397500 -0.343553
|
||||
v -0.353522 -0.397500 0.363553
|
||||
vt 0.5625 0.5000
|
||||
vt 0.5625 0.6250
|
||||
vt 0.4375 0.6250
|
||||
vt 0.4375 0.5000
|
||||
vt 0.4375 0.0000
|
||||
vt 0.5625 0.0000
|
||||
vt 0.5625 0.1250
|
||||
vt 0.4375 0.1250
|
||||
vt 0.5625 0.6250
|
||||
vt 0.4375 0.6250
|
||||
vt 0.4375 0.6250
|
||||
vt 0.4375 0.0000
|
||||
vt 0.5625 0.6250
|
||||
vt 0.5625 0.0000
|
||||
vt 1.0000 0.5625
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 1.0000
|
||||
vt 0.0000 0.5625
|
||||
vt 0.0000 0.5625
|
||||
vt 1.0000 0.5625
|
||||
vt 1.0000 1.0000
|
||||
vt 0.0000 1.0000
|
||||
vn 0.0000 0.9105 0.4134
|
||||
vn -0.0000 -0.4134 0.9105
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.7071 0.0000 -0.7071
|
||||
vn 0.7071 0.0000 0.7071
|
||||
usemtl Material.001
|
||||
s off
|
||||
f 3/1/1 1/2/1 5/3/1 7/4/1
|
||||
f 8/5/1 4/6/1 2/7/1 6/8/1
|
||||
f 3/9/2 4/6/2 8/5/2 7/10/2
|
||||
f 1/11/3 3/9/3 4/6/3 2/12/3
|
||||
f 5/13/2 1/11/2 2/12/2 6/14/2
|
||||
f 7/10/3 8/5/3 6/14/3 5/13/3
|
||||
usemtl Material.002
|
||||
f 9/15/4 10/16/4 12/17/4 11/18/4
|
||||
f 13/19/5 14/20/5 16/21/5 15/22/5
|
50
mods/default/models/torch_floor.obj
Normal file
@ -0,0 +1,50 @@
|
||||
# Blender v2.76 (sub 11) OBJ File: 'torch_floor.blend'
|
||||
# www.blender.org
|
||||
mtllib torch_floor.mtl
|
||||
o Cube_Cube.001
|
||||
v 0.062500 0.062500 -0.062500
|
||||
v 0.062500 -0.500000 -0.062500
|
||||
v 0.062500 0.062500 0.062500
|
||||
v 0.062500 -0.500000 0.062500
|
||||
v -0.062500 0.062500 -0.062500
|
||||
v -0.062500 -0.500000 -0.062500
|
||||
v -0.062500 0.062500 0.062500
|
||||
v -0.062500 -0.500000 0.062500
|
||||
v -0.353553 -0.500000 0.353553
|
||||
v -0.353553 0.500000 0.353553
|
||||
v 0.353553 -0.500000 -0.353553
|
||||
v 0.353553 0.500000 -0.353553
|
||||
v -0.353553 -0.500000 -0.353553
|
||||
v 0.353553 -0.500000 0.353553
|
||||
v -0.353553 0.500000 -0.353553
|
||||
v 0.353553 0.500000 0.353553
|
||||
vt 0.562500 0.500000
|
||||
vt 0.562500 0.625000
|
||||
vt 0.437500 0.625000
|
||||
vt 0.437500 0.500000
|
||||
vt 0.437500 0.000000
|
||||
vt 0.562500 0.000000
|
||||
vt 0.562500 0.125000
|
||||
vt 0.437500 0.125000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn -0.707100 0.000000 -0.707100
|
||||
vn -0.707100 -0.000000 0.707100
|
||||
g Cube_Cube.001_Cube_Cube.001_Material.001
|
||||
usemtl Material.001
|
||||
s off
|
||||
f 3/1/1 1/2/1 5/3/1 7/4/1
|
||||
f 8/5/1 4/6/1 2/7/1 6/8/1
|
||||
f 3/2/2 4/6/2 8/5/2 7/3/2
|
||||
f 1/3/3 3/2/3 4/6/3 2/5/3
|
||||
f 5/2/2 1/3/2 2/5/2 6/6/2
|
||||
f 7/3/3 8/5/3 6/6/3 5/2/3
|
||||
g Cube_Cube.001_Cube_Cube.001_Material.002
|
||||
usemtl Material.002
|
||||
f 9/9/4 10/10/4 12/11/4 11/12/4
|
||||
f 13/12/5 14/9/5 16/10/5 15/11/5
|
64
mods/default/models/torch_wall.obj
Normal file
@ -0,0 +1,64 @@
|
||||
# Blender v2.76 (sub 11) OBJ File: 'torch_wall.blend'
|
||||
# www.blender.org
|
||||
mtllib torch_wall.mtl
|
||||
o Cube_Cube.001
|
||||
v 0.062469 -0.195248 0.023570
|
||||
v 0.062469 -0.476498 -0.463570
|
||||
v 0.062469 -0.303502 0.086070
|
||||
v 0.062469 -0.584752 -0.401070
|
||||
v -0.062531 -0.195248 0.023570
|
||||
v -0.062531 -0.476498 -0.463570
|
||||
v -0.062531 -0.303502 0.086070
|
||||
v -0.062531 -0.584752 -0.401070
|
||||
v -0.353584 -0.613553 0.022500
|
||||
v -0.353584 -0.613553 0.460000
|
||||
v 0.353522 0.093553 0.022500
|
||||
v 0.353522 0.093553 0.460000
|
||||
v -0.353584 0.093553 0.022500
|
||||
v 0.353522 -0.613553 0.022500
|
||||
v -0.353584 0.093553 0.460000
|
||||
v 0.353522 -0.613553 0.460000
|
||||
v 0.353553 0.056811 -0.121957
|
||||
v 0.353553 -0.224439 -0.609096
|
||||
v -0.353553 -0.555561 0.231596
|
||||
v -0.353553 -0.836811 -0.255543
|
||||
v -0.353553 0.056811 -0.121957
|
||||
v -0.353553 -0.224439 -0.609096
|
||||
v 0.353553 -0.555561 0.231596
|
||||
v 0.353553 -0.836811 -0.255543
|
||||
vt 0.562500 0.500000
|
||||
vt 0.562500 0.625000
|
||||
vt 0.437500 0.625000
|
||||
vt 0.437500 0.500000
|
||||
vt 0.437500 0.000000
|
||||
vt 0.562500 0.000000
|
||||
vt 0.562500 0.125000
|
||||
vt 0.437500 0.125000
|
||||
vt 0.000000 0.562500
|
||||
vt 0.000000 -0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 0.562500
|
||||
vt 1.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vn -0.000000 0.500000 0.866000
|
||||
vn -0.000000 0.866000 -0.500000
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn -0.707100 0.612400 -0.353600
|
||||
vn -0.707100 -0.612400 0.353600
|
||||
vn -0.707100 0.707100 -0.000000
|
||||
vn -0.707100 -0.707100 -0.000000
|
||||
g Cube_Cube.001_Cube_Cube.001_Material.001
|
||||
usemtl Material.001
|
||||
s off
|
||||
f 3/1/1 1/2/1 5/3/1 7/4/1
|
||||
f 8/5/1 4/6/1 2/7/1 6/8/1
|
||||
f 3/2/2 4/6/2 8/5/2 7/3/2
|
||||
f 1/3/3 3/2/3 4/6/3 2/5/3
|
||||
f 5/2/2 1/3/2 2/5/2 6/6/2
|
||||
f 7/3/3 8/5/3 6/6/3 5/2/3
|
||||
f 17/9/4 18/10/4 20/11/4 19/12/4
|
||||
f 21/9/5 22/10/5 24/11/5 23/12/5
|
||||
g Cube_Cube.001_Cube_Cube.001_Material.002
|
||||
usemtl Material.002
|
||||
f 9/12/6 10/13/6 12/14/6 11/9/6
|
||||
f 13/9/7 14/12/7 16/13/7 15/14/7
|
@ -94,11 +94,7 @@ minetest.register_on_joinplayer(function(player)
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
default.player_set_model(player, "character.b3d")
|
||||
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
|
||||
-- set GUI
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
player:set_inventory_formspec(default.gui_survival_form)
|
||||
end
|
||||
|
||||
player:hud_set_hotbar_image("gui_hotbar.png")
|
||||
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
|
||||
end)
|
||||
|
BIN
mods/default/schematics/acacia_bush.mts
Normal file
BIN
mods/default/schematics/acacia_log.mts
Normal file
BIN
mods/default/schematics/apple_log.mts
Normal file
BIN
mods/default/schematics/aspen_log.mts
Normal file
BIN
mods/default/schematics/bush.mts
Normal file
BIN
mods/default/schematics/corals.mts
Normal file
BIN
mods/default/schematics/jungle_log.mts
Normal file
BIN
mods/default/schematics/pine_log.mts
Normal file
BIN
mods/default/sounds/default_chest_close.ogg
Normal file
BIN
mods/default/sounds/default_chest_open.ogg
Normal file
BIN
mods/default/sounds/default_dig_snappy.ogg
Normal file
BIN
mods/default/sounds/default_tool_breaks.1.ogg
Normal file
BIN
mods/default/sounds/default_tool_breaks.2.ogg
Normal file
BIN
mods/default/sounds/default_tool_breaks.3.ogg
Normal file
BIN
mods/default/sounds/default_water_footstep.1.ogg
Normal file
BIN
mods/default/sounds/default_water_footstep.2.ogg
Normal file
BIN
mods/default/sounds/default_water_footstep.3.ogg
Normal file
BIN
mods/default/sounds/default_water_footstep.4.ogg
Normal file
BIN
mods/default/textures/default_acacia_bush_sapling.png
Normal file
After Width: | Height: | Size: 151 B |
BIN
mods/default/textures/default_acacia_bush_stem.png
Normal file
After Width: | Height: | Size: 476 B |
BIN
mods/default/textures/default_acacia_leaves_simple.png
Normal file
After Width: | Height: | Size: 688 B |
BIN
mods/default/textures/default_bookshelf_slot.png
Normal file
After Width: | Height: | Size: 191 B |
BIN
mods/default/textures/default_bush_sapling.png
Normal file
After Width: | Height: | Size: 165 B |
BIN
mods/default/textures/default_bush_stem.png
Normal file
After Width: | Height: | Size: 428 B |
BIN
mods/default/textures/default_chest_inside.png
Normal file
After Width: | Height: | Size: 102 B |
BIN
mods/default/textures/default_key.png
Normal file
After Width: | Height: | Size: 415 B |
BIN
mods/default/textures/default_key_skeleton.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
mods/default/textures/default_mese_post_light_side.png
Normal file
After Width: | Height: | Size: 353 B |
BIN
mods/default/textures/default_mese_post_light_side_dark.png
Normal file
After Width: | Height: | Size: 353 B |
BIN
mods/default/textures/default_mese_post_light_top.png
Normal file
After Width: | Height: | Size: 155 B |
BIN
mods/default/textures/default_mineral_tin.png
Normal file
After Width: | Height: | Size: 171 B |
BIN
mods/default/textures/default_rainforest_litter.png
Normal file
After Width: | Height: | Size: 940 B |