mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-05 01:50:25 +01:00
Merged most of default
- Merged README, crafting, functions, furnace, init, mapgen, nodes, tools and trees
This commit is contained in:
parent
05685e7a72
commit
12501fb1cd
|
@ -62,7 +62,6 @@ VanessaE (WTFPL):
|
|||
default_desert_stone.png
|
||||
default_desert_stone_brick.png
|
||||
default_sand.png
|
||||
default_sandstone_brick.png
|
||||
|
||||
Calinou (CC BY-SA):
|
||||
default_brick.png
|
||||
|
@ -109,6 +108,11 @@ paramat (CC BY-SA 3.0):
|
|||
default_pinetree.png
|
||||
default_pinetree_top.png
|
||||
default_pinewood.png
|
||||
default_sandstone_brick.png
|
||||
default_obsidian_brick.png
|
||||
default_river_water.png
|
||||
default_river_water_source_animated.png
|
||||
default_river_water_flowing_animated.png
|
||||
|
||||
brunob.santos (CC BY-SA 4.0):
|
||||
default_desert_cobble.png
|
||||
|
|
|
@ -14,16 +14,87 @@ minetest.register_craftitem("default:paper", {
|
|||
inventory_image = "default_paper.png",
|
||||
})
|
||||
|
||||
local function book_on_use(itemstack, user, pointed_thing)
|
||||
local player_name = user:get_player_name()
|
||||
local data = minetest.deserialize(itemstack:get_metadata())
|
||||
local title, text, owner = "", "", player_name
|
||||
if data then
|
||||
title, text, owner = data.title, data.text, data.owner
|
||||
end
|
||||
local formspec
|
||||
if owner == player_name then
|
||||
formspec = "size[8,8]"..default.gui_bg..
|
||||
"field[0.5,1;7.5,0;title;Title:;"..
|
||||
minetest.formspec_escape(title).."]"..
|
||||
"textarea[0.5,1.5;7.5,7;text;Contents:;"..
|
||||
minetest.formspec_escape(text).."]"..
|
||||
"button_exit[2.5,7.5;3,1;save;Save]"
|
||||
else
|
||||
formspec = "size[8,8]"..default.gui_bg..
|
||||
"label[0.5,0.5;by "..owner.."]"..
|
||||
"label[0.5,0;"..minetest.formspec_escape(title).."]"..
|
||||
"textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]"
|
||||
end
|
||||
minetest.show_formspec(user:get_player_name(), "default:book", formspec)
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, form_name, fields)
|
||||
if form_name ~= "default:book" or not fields.save or
|
||||
fields.title == "" or fields.text == "" then
|
||||
return
|
||||
end
|
||||
local inv = player:get_inventory()
|
||||
local stack = player:get_wielded_item()
|
||||
local new_stack, data
|
||||
if stack:get_name() ~= "default:book_written" then
|
||||
local count = stack:get_count()
|
||||
if count == 1 then
|
||||
stack:set_name("default:book_written")
|
||||
else
|
||||
stack:set_count(count - 1)
|
||||
new_stack = ItemStack("default:book_written")
|
||||
end
|
||||
else
|
||||
data = minetest.deserialize(stack:get_metadata())
|
||||
end
|
||||
if not data then data = {} end
|
||||
data.title = fields.title
|
||||
data.text = fields.text
|
||||
data.owner = player:get_player_name()
|
||||
local data_str = minetest.serialize(data)
|
||||
if new_stack then
|
||||
new_stack:set_metadata(data_str)
|
||||
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)
|
||||
end
|
||||
player:set_wielded_item(stack)
|
||||
end)
|
||||
|
||||
minetest.register_craftitem("default:book", {
|
||||
description = "Book",
|
||||
inventory_image = "default_book.png",
|
||||
groups = {book=1},
|
||||
on_use = book_on_use,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:book_written", {
|
||||
description = "Book With Text",
|
||||
inventory_image = "default_book.png",
|
||||
groups = {book=1, not_in_creative_inventory=1},
|
||||
stack_max = 1,
|
||||
on_use = book_on_use,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:coal_lump", {
|
||||
description = "Coal Lump",
|
||||
wield_scale = {x = 1, y = 1, z = 2},
|
||||
inventory_image = "default_coal_lump.png",
|
||||
groups = {coal = 1}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:iron_lump", {
|
||||
|
|
|
@ -129,30 +129,6 @@ function default.node_sound_glass_defaults(table)
|
|||
return table
|
||||
end
|
||||
|
||||
--
|
||||
-- Global callbacks
|
||||
--
|
||||
|
||||
-- Global environment step function
|
||||
function on_step(dtime)
|
||||
-- print("on_step, " .. p .. ", " .. node)
|
||||
end
|
||||
minetest.register_globalstep(on_step)
|
||||
|
||||
function on_placenode(p, node)
|
||||
-- print("on_placenode, " .. p .. ", " .. node)
|
||||
end
|
||||
minetest.register_on_placenode(on_placenode)
|
||||
|
||||
function on_dignode(p, node)
|
||||
-- print("on_dignode, " .. p .. ", " .. node)
|
||||
end
|
||||
minetest.register_on_dignode(on_dignode)
|
||||
|
||||
function on_punchnode(p, node)
|
||||
-- print("on_punchnode, " .. p .. ", " .. node)
|
||||
end
|
||||
minetest.register_on_punchnode(on_punchnode)
|
||||
|
||||
--
|
||||
-- Lavacooling
|
||||
|
@ -245,6 +221,8 @@ minetest.register_abm({
|
|||
-- Papyrus and cactus growing
|
||||
--
|
||||
|
||||
-- wrapping the functions in abm action is necessary to make overriding them possible
|
||||
|
||||
function default.grow_cactus(pos, node)
|
||||
if node.param2 ~= 0 then
|
||||
return
|
||||
|
@ -255,13 +233,12 @@ function default.grow_cactus(pos, node)
|
|||
end
|
||||
pos.y = pos.y + 1
|
||||
local height = 0
|
||||
while node.name == "default:cactus" and height < 4 and node.param2 == 0 do
|
||||
while node.name == "default:cactus" and height < 4 do
|
||||
height = height + 1
|
||||
pos.y = pos.y + 1
|
||||
node = minetest.get_node(pos)
|
||||
end
|
||||
if height == 4
|
||||
or node.name ~= "air" then
|
||||
if height == 4 or node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name = "default:cactus"})
|
||||
|
@ -271,8 +248,7 @@ end
|
|||
function default.grow_papyrus(pos, node)
|
||||
pos.y = pos.y - 1
|
||||
local name = minetest.get_node(pos).name
|
||||
if name ~= "default:dirt_with_grass"
|
||||
and name ~= "default:dirt" then
|
||||
if name ~= "default:dirt_with_grass" and name ~= "default:dirt" then
|
||||
return
|
||||
end
|
||||
if not minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||
|
@ -285,8 +261,7 @@ function default.grow_papyrus(pos, node)
|
|||
pos.y = pos.y + 1
|
||||
node = minetest.get_node(pos)
|
||||
end
|
||||
if height == 4
|
||||
or node.name ~= "air" then
|
||||
if height == 4 or node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name = "default:papyrus"})
|
||||
|
@ -300,7 +275,7 @@ minetest.register_abm({
|
|||
chance = 25,
|
||||
action = function(...)
|
||||
default.grow_cactus(...)
|
||||
end,
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
|
@ -310,9 +285,14 @@ minetest.register_abm({
|
|||
chance = 25,
|
||||
action = function(...)
|
||||
default.grow_papyrus(...)
|
||||
end,
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- dig upwards
|
||||
--
|
||||
|
||||
function default.dig_up(pos, node, digger)
|
||||
if digger == nil then return end
|
||||
local np = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
|
@ -327,19 +307,6 @@ end
|
|||
-- Leafdecay
|
||||
--
|
||||
|
||||
-- To enable leaf decay for a node, add it to the "leafdecay" group.
|
||||
--
|
||||
-- The rating of the group determines how far from a node in the group "tree"
|
||||
-- the node can be without decaying.
|
||||
--
|
||||
-- If param2 of the node is ~= 0, the node will always be preserved. Thus, if
|
||||
-- the player places a node of that kind, you will want to set param2= 1 or so.
|
||||
--
|
||||
-- If the node is in the leafdecay_drop group then the it will always be dropped
|
||||
-- as an item
|
||||
|
||||
if minetest.setting_getbool("leaf_decay") ~= false then -- “If not defined or set to true then”
|
||||
|
||||
default.leafdecay_trunk_cache = {}
|
||||
default.leafdecay_enable_cache = true
|
||||
-- Spread the load of finding trunks
|
||||
|
@ -360,7 +327,8 @@ end
|
|||
minetest.register_abm({
|
||||
nodenames = {"group:leafdecay"},
|
||||
neighbors = {"air", "group:liquid"},
|
||||
interval = 1, -- A low interval and a high inverse chance spreads the load.
|
||||
-- A low interval and a high inverse chance spreads the load
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
|
||||
action = function(p0, node, _, _)
|
||||
|
@ -383,13 +351,15 @@ minetest.register_abm({
|
|||
if trunkp then
|
||||
local n = minetest.get_node(trunkp)
|
||||
local reg = minetest.registered_nodes[n.name]
|
||||
-- Assume ignore is a trunk, to make the thing work at the border of the active area:
|
||||
if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then
|
||||
-- print("Cached trunk still exists.")
|
||||
-- Assume ignore is a trunk, to make the thing
|
||||
-- work at the border of the active area
|
||||
if n.name == "ignore" or (reg and reg.groups.tree and
|
||||
reg.groups.tree ~= 0) then
|
||||
--print("cached trunk still exists")
|
||||
return
|
||||
end
|
||||
-- print("Cached trunk is invalid.")
|
||||
-- Cache is invalid:
|
||||
--print("cached trunk is invalid")
|
||||
-- Cache is invalid
|
||||
table.remove(default.leafdecay_trunk_cache, p0_hash)
|
||||
end
|
||||
end
|
||||
|
@ -398,33 +368,38 @@ minetest.register_abm({
|
|||
end
|
||||
default.leafdecay_trunk_find_allow_accumulator =
|
||||
default.leafdecay_trunk_find_allow_accumulator - 1
|
||||
-- Assume ignore is a trunk, to make the thing work at the border of the active area:
|
||||
-- Assume ignore is a trunk, to make the thing
|
||||
-- work at the border of the active area
|
||||
local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"})
|
||||
if p1 then
|
||||
do_preserve = true
|
||||
if default.leafdecay_enable_cache then
|
||||
-- print("Caching trunk.")
|
||||
-- Cache the trunk:
|
||||
--print("caching trunk")
|
||||
-- Cache the trunk
|
||||
default.leafdecay_trunk_cache[p0_hash] = p1
|
||||
end
|
||||
end
|
||||
if not do_preserve then
|
||||
-- Drop stuff other than the node itself:
|
||||
-- Drop stuff other than the node itself
|
||||
local itemstacks = minetest.get_node_drops(n0.name)
|
||||
for _, itemname in ipairs(itemstacks) do
|
||||
if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0
|
||||
or itemname ~= n0.name then
|
||||
minetest.add_item(p0, itemname)
|
||||
if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or
|
||||
itemname ~= n0.name then
|
||||
local p_drop = {
|
||||
x = p0.x - 0.5 + math.random(),
|
||||
y = p0.y - 0.5 + math.random(),
|
||||
z = p0.z - 0.5 + math.random(),
|
||||
}
|
||||
minetest.add_item(p_drop, itemname)
|
||||
end
|
||||
end
|
||||
-- Remove node
|
||||
minetest.remove_node(p0)
|
||||
-- minetest.log("action", n0.name .. " decayed at " .. minetest.pos_to_string(p0) .. ".")
|
||||
nodeupdate(p0)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
end -- Ends: if minetest.setting_getbool("leaf_decay") ~= false
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
|
||||
if newnode.name ~= "default:torch" or minetest.get_item_group(oldnode.name, "water") == 0 then
|
||||
|
@ -435,6 +410,9 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack
|
|||
minetest.add_item(pos, "default:torch")
|
||||
end)
|
||||
|
||||
--
|
||||
-- Grass growing
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt"},
|
||||
|
@ -444,10 +422,10 @@ minetest.register_abm({
|
|||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local name = minetest.get_node(above).name
|
||||
local nodedef = minetest.registered_nodes[name]
|
||||
if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light")
|
||||
and nodedef.liquidtype == "none"
|
||||
and pos.y >= 0
|
||||
and (minetest.get_node_light(above) or 0) >= 12 then
|
||||
if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light") and
|
||||
nodedef.liquidtype == "none" and
|
||||
pos.y >= 0 and
|
||||
(minetest.get_node_light(above) or 0) >= 12 then
|
||||
if name == "default:snow" or name == "default:snowblock" then
|
||||
minetest.set_node(pos, {name = "default:dirt_with_snow"})
|
||||
else
|
||||
|
@ -457,7 +435,6 @@ minetest.register_abm({
|
|||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_grass"},
|
||||
interval = 30,
|
||||
|
@ -466,10 +443,11 @@ minetest.register_abm({
|
|||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local name = minetest.get_node(above).name
|
||||
local nodedef = minetest.registered_nodes[name]
|
||||
if name ~= "ignore" and nodedef
|
||||
and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
|
||||
and nodedef.liquidtype == "none") then
|
||||
if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or
|
||||
nodedef.paramtype == "light") and
|
||||
nodedef.liquidtype == "none") then
|
||||
minetest.set_node(pos, {name = "default:dirt"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
local function active_formspec(fuel_percent, item_percent)
|
||||
local formspec =
|
||||
"size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||
|
@ -22,6 +24,8 @@ end
|
|||
|
||||
local inactive_formspec =
|
||||
"size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||
|
|
|
@ -24,8 +24,11 @@ function default.get_hotbar_bg(x,y)
|
|||
end
|
||||
|
||||
default.gui_survival_form = "size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[current_player;main;0,4.25;8,4;]"..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"list[current_player;craft;1.75,0.5;3,3;]"..
|
||||
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
|
||||
default.get_hotbar_bg(0,4.25)..
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1300,11 +1300,11 @@ minetest.register_node("default:water_flowing", {
|
|||
|
||||
minetest.register_node("default:river_water_source", {
|
||||
description = "River Water Source",
|
||||
inventory_image = minetest.inventorycube("default_water.png"),
|
||||
inventory_image = minetest.inventorycube("default_river_water.png"),
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{
|
||||
name = "default_water_source_animated.png",
|
||||
name = "default_river_water_source_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
|
@ -1315,7 +1315,7 @@ minetest.register_node("default:river_water_source", {
|
|||
},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "default_water_source_animated.png",
|
||||
name = "default_river_water_source_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
|
@ -1346,12 +1346,12 @@ minetest.register_node("default:river_water_source", {
|
|||
|
||||
minetest.register_node("default:river_water_flowing", {
|
||||
description = "Flowing River Water",
|
||||
inventory_image = minetest.inventorycube("default_water.png"),
|
||||
inventory_image = minetest.inventorycube("default_river_water.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"default_water.png"},
|
||||
tiles = {"default_river_water.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "default_water_flowing_animated.png",
|
||||
name = "default_river_water_flowing_animated.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
|
@ -1361,7 +1361,7 @@ minetest.register_node("default:river_water_flowing", {
|
|||
},
|
||||
},
|
||||
{
|
||||
name = "default_water_flowing_animated.png",
|
||||
name = "default_river_water_flowing_animated.png",
|
||||
backface_culling = true,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
minetest.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
wield_scale = {x=1,y=1,z=2.5},
|
||||
range = 5,
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.8,
|
||||
|
@ -124,6 +125,7 @@ minetest.register_tool("default:pick_diamond", {
|
|||
damage_groups = {fleshy = 4},
|
||||
},
|
||||
})
|
||||
|
||||
--
|
||||
-- Shovels
|
||||
--
|
||||
|
|
Loading…
Reference in New Issue
Block a user