Huge update
- Rework of inventorys, add new creative inventory - Slow down fire a bit - Tweak digging times of some tools - Improved textures for jungletree, -wood - Dropped items also rotate and 3D - Tweaked menu image a bit - Add abms for trees, grass, etc - Update stairs mod - Remove hardened clay - and a few more smaller tweaksmaster
14
README.txt
|
@ -1,6 +1,6 @@
|
||||||
Minetest+ - a game for the Minetest game engine [based on minetest_game]
|
Minetest+ - a game for the Minetest game engine [based on minetest_game]
|
||||||
=========
|
=========
|
||||||
Version 0.5
|
Version 0.6
|
||||||
|
|
||||||
About this game
|
About this game
|
||||||
---------------
|
---------------
|
||||||
|
@ -60,6 +60,18 @@ Version 0.5:
|
||||||
- removed rat, cooked rat and sorched stuff from inventory
|
- removed rat, cooked rat and sorched stuff from inventory
|
||||||
- drowning damages player more (is drowning faster)
|
- drowning damages player more (is drowning faster)
|
||||||
|
|
||||||
|
Version 0.6:
|
||||||
|
- Rework of inventorys, add new creative inventory
|
||||||
|
- Slow down fire a bit
|
||||||
|
- Tweak digging times of some tools
|
||||||
|
- Improved textures for jungletree, -wood, torch(inventory)
|
||||||
|
- Dropped items also rotate and 3D
|
||||||
|
- Tweaked menu image a bit
|
||||||
|
- Add abms for trees, grass, etc
|
||||||
|
- Update stairs mod
|
||||||
|
- Remove hardened clay
|
||||||
|
- and a few more smaller tweaks
|
||||||
|
|
||||||
So hope you enjoy this game and like the changes i made to default game.
|
So hope you enjoy this game and like the changes i made to default game.
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
menu/overlay.png
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 80 KiB |
|
@ -17,3 +17,5 @@ liquid_update = 0.5
|
||||||
|
|
||||||
|
|
||||||
selectionbox_color = (8,8,8)
|
selectionbox_color = (8,8,8)
|
||||||
|
|
||||||
|
mgv6_freq_desert = 0.65
|
|
@ -31,18 +31,13 @@ minetest.register_entity(":__builtin:item", {
|
||||||
end
|
end
|
||||||
prop = {
|
prop = {
|
||||||
is_visible = true,
|
is_visible = true,
|
||||||
visual = "sprite",
|
visual = "wielditem",
|
||||||
textures = {"unknown_item.png"}
|
textures = {itemname},
|
||||||
|
visual_size = {x=0.20, y=0.20},
|
||||||
|
automatic_rotate = math.pi * 0.35,
|
||||||
}
|
}
|
||||||
if item_texture and item_texture ~= "" then
|
if itemname == "default:apple" then
|
||||||
prop.visual = "sprite"
|
prop.visual_size = {x=0.5,y=0.5}
|
||||||
prop.textures = {item_texture}
|
|
||||||
prop.visual_size = {x=0.50, y=0.50}
|
|
||||||
else
|
|
||||||
prop.visual = "wielditem"
|
|
||||||
prop.textures = {itemname}
|
|
||||||
prop.visual_size = {x=0.20, y=0.20}
|
|
||||||
prop.automatic_rotate = math.pi * 0.25
|
|
||||||
end
|
end
|
||||||
self.object:set_properties(prop)
|
self.object:set_properties(prop)
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
Minetest 0.4 mod: creative
|
Minetest 0.4 mod: creative
|
||||||
==========================
|
==========================
|
||||||
|
Version 1.0
|
||||||
|
This mod is based on the original creative mod by celeron55
|
||||||
|
------------------------
|
||||||
|
|
||||||
Implements creative mode.
|
Implements creative mode.
|
||||||
|
|
||||||
|
@ -10,9 +13,10 @@ Registered items that
|
||||||
- do not have the group not_in_creative_inventory
|
- do not have the group not_in_creative_inventory
|
||||||
are added to the creative inventory.
|
are added to the creative inventory.
|
||||||
|
|
||||||
License of source code and media files:
|
License (WTFPL):
|
||||||
---------------------------------------
|
----------------
|
||||||
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
Copyright (C) 2013 by BlockMen
|
||||||
|
|
||||||
|
|
||||||
This program is free software. It comes without any warranty, to
|
This program is free software. It comes without any warranty, to
|
||||||
the extent permitted by applicable law. You can redistribute it
|
the extent permitted by applicable law. You can redistribute it
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
-- minetest/creative/init.lua
|
creative = {}
|
||||||
|
creative.creative_inventory_size = 0
|
||||||
|
|
||||||
creative_inventory = {}
|
function init()
|
||||||
creative_inventory.creative_inventory_size = 0
|
|
||||||
|
|
||||||
-- Create detached creative inventory after loading all mods
|
|
||||||
minetest.after(0, function()
|
|
||||||
local inv = minetest.create_detached_inventory("creative", {
|
local inv = minetest.create_detached_inventory("creative", {
|
||||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||||
if minetest.setting_getbool("creative_mode") then
|
if minetest.setting_getbool("creative_mode") then
|
||||||
|
@ -14,6 +11,15 @@ minetest.after(0, function()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
allow_put = function(inv, listname, index, stack, player)
|
allow_put = function(inv, listname, index, stack, player)
|
||||||
|
print(stack:get_name())
|
||||||
|
local slot = inv:get_stack(listname, index)
|
||||||
|
print(slot:get_name())
|
||||||
|
if stack and slot then
|
||||||
|
if stack:get_name() == slot:get_name() then
|
||||||
|
inv:set_stack(listname,index,{name=stack:get_name(), count = 2})
|
||||||
|
return 2
|
||||||
|
end
|
||||||
|
end
|
||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
allow_take = function(inv, listname, index, stack, player)
|
allow_take = function(inv, listname, index, stack, player)
|
||||||
|
@ -34,26 +40,57 @@ minetest.after(0, function()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
set_inv("all")
|
||||||
|
end
|
||||||
|
|
||||||
|
function set_inv(filter, player)
|
||||||
|
local inv = minetest.get_inventory({type="detached", name="creative"})
|
||||||
|
inv:set_size("main", 0)
|
||||||
local creative_list = {}
|
local creative_list = {}
|
||||||
for name,def in pairs(minetest.registered_items) do
|
for name,def in pairs(minetest.registered_items) do
|
||||||
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0)
|
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then
|
||||||
and def.description and def.description ~= "" then
|
if filter ~= "" then
|
||||||
|
if filter == "#blocks" then
|
||||||
|
if def.walkable == true then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
|
elseif filter == "#deco" then
|
||||||
|
if (def.walkable == false or def.drawtype == "plantlike" or def.drawtype == "allfaces_optional" or string.find(string.lower(def.description), "torch") or string.find(string.lower(def.description), "door")) and not string.find(string.lower(def.description), "apple") then--def.groups. == true then
|
||||||
|
table.insert(creative_list, name)
|
||||||
|
end
|
||||||
|
elseif filter == "#misc" then
|
||||||
|
if def.drawtype == nil and def.type ~= "tool" and not string.find(string.lower(def.description), "torch") and not string.find(string.lower(def.description), "bread") and not string.find(string.lower(def.description), "door") then
|
||||||
|
table.insert(creative_list, name)
|
||||||
|
end
|
||||||
|
elseif filter == "#food" then
|
||||||
|
if def.groups.food ~= nil or string.find(string.lower(def.description), "apple") or string.find(string.lower(def.description), "bread") then
|
||||||
|
table.insert(creative_list, name)
|
||||||
|
end
|
||||||
|
elseif filter == "#tools" then
|
||||||
|
if def.type == "tool" then
|
||||||
|
table.insert(creative_list, name)
|
||||||
|
end
|
||||||
|
elseif filter == "all" then
|
||||||
|
table.insert(creative_list, name)
|
||||||
|
else --for all other
|
||||||
|
if string.find(string.lower(def.name), filter) or string.find(string.lower(def.description), filter) then
|
||||||
|
table.insert(creative_list, name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
table.sort(creative_list)
|
table.sort(creative_list)
|
||||||
inv:set_size("main", #creative_list)
|
inv:set_size("main", #creative_list)
|
||||||
for _,itemstring in ipairs(creative_list) do
|
for _,itemstring in ipairs(creative_list) do
|
||||||
inv:add_item("main", ItemStack(itemstring))
|
inv:add_item("main", ItemStack(itemstring))
|
||||||
end
|
end
|
||||||
creative_inventory.creative_inventory_size = #creative_list
|
creative.creative_inventory_size = #creative_list
|
||||||
print("creative inventory size: "..dump(creative_inventory.creative_inventory_size))
|
--print("creative inventory size: "..dump(creative.creative_inventory_size))
|
||||||
end)
|
end
|
||||||
|
|
||||||
-- Create the trash field
|
-- Create the trash field
|
||||||
local trash = minetest.create_detached_inventory("creative_trash", {
|
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)
|
allow_put = function(inv, listname, index, stack, player)
|
||||||
if minetest.setting_getbool("creative_mode") then
|
if minetest.setting_getbool("creative_mode") then
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
|
@ -68,61 +105,140 @@ local trash = minetest.create_detached_inventory("creative_trash", {
|
||||||
trash:set_size("main", 1)
|
trash:set_size("main", 1)
|
||||||
|
|
||||||
|
|
||||||
creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
|
-- Create detached creative inventory after loading all mods
|
||||||
pagenum = math.floor(pagenum)
|
minetest.after(0, init)
|
||||||
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
|
|
||||||
player:set_inventory_formspec("size[13,7.5]"..
|
local offset = {}
|
||||||
--"image[6,0.6;1,2;player.png]"..
|
local bg = {}
|
||||||
"list[current_player;main;5,3.5;8,4;]"..
|
offset["nix"] = "-0.29,-0.27"
|
||||||
"list[current_player;craft;8,0;3,3;]"..
|
offset["build"] = "0.979,-0.27"
|
||||||
"list[current_player;craftpreview;12,1;1,1;]"..
|
offset["other"] = "2.24,-0.27"
|
||||||
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]"..
|
offset["tools"] = "3.5,-0.27"
|
||||||
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]"..
|
offset["misc"] = "4.79,-0.27"
|
||||||
"button[0.3,6.5;1.6,1;creative_prev;<<]"..
|
offset["food"] = "6.05,-0.27"
|
||||||
"button[2.7,6.5;1.6,1;creative_next;>>]"..
|
offset["inv"] = "8,-0.27"
|
||||||
"label[5,1.5;Trash:]"..
|
|
||||||
"list[detached:creative_trash;main;5,2;1,1;]")
|
local function reset_menu_item_bg()
|
||||||
|
bg["nix"] = "creative_bg_dark.png"
|
||||||
|
bg["build"] = "creative_bg_dark.png"
|
||||||
|
bg["other"] = "creative_bg_dark.png"
|
||||||
|
bg["tools"] = "creative_bg_dark.png"
|
||||||
|
bg["misc"] = "creative_bg_dark.png"
|
||||||
|
bg["food"] = "creative_bg_dark.png"
|
||||||
|
bg["inv"] = "creative_bg_dark.png"
|
||||||
end
|
end
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
-- If in creative mode, modify player's inventory forms
|
creative.set_creative_formspec = function(player, start_i, pagenum, show, page)
|
||||||
|
reset_menu_item_bg()
|
||||||
|
pagenum = math.floor(pagenum)
|
||||||
|
local pagemax = math.floor((creative.creative_inventory_size-1) / (8*5) + 1)
|
||||||
|
local slider_height = 4/pagemax
|
||||||
|
local slider_pos = slider_height*(pagenum-1)+2.24
|
||||||
|
local name = "nix"
|
||||||
|
local formspec = ""
|
||||||
|
local main_list = "list[detached:creative;main;0,1.75;8,5;"..tostring(start_i).."]"--"list[current_player;main;0,3.75;9,3;8]"--..
|
||||||
|
if page ~= nil then name = page end
|
||||||
|
bg[name] = "creative_bg.png"
|
||||||
|
if name == "inv" then
|
||||||
|
main_list = "image[-0.2,1.7;10.1,2.33;creative_bg.png]"..
|
||||||
|
"list[current_player;main;0,3.75;8,3;8]"
|
||||||
|
end
|
||||||
|
formspec = "size[9,8.3]"..
|
||||||
|
"label[-5,-5;"..name.."]"..
|
||||||
|
"image[" .. offset[name] .. ";1.5,1.44;creative_active.png]"..
|
||||||
|
"image_button[-0.1,-0.05;1,1;"..bg["nix"].."^creative_all.png;default;]".. --nix+search
|
||||||
|
"image_button[1.154,-0.05;1,1;"..bg["build"].."^creative_build.png;build;]".. --decoration blocks
|
||||||
|
"image_button[2.419,-0.05;1,1;"..bg["other"].."^creative_other.png;other;]".. --redstone
|
||||||
|
"image_button[3.7,-0.05;1,1;"..bg["tools"].."^creative_tool.png;tools;]".. --transportation
|
||||||
|
"image_button[4.95,-0.05;1,1;"..bg["misc"].."^creative_misc.png;misc;]".. --miscellaneous
|
||||||
|
"image_button[6.25,-0.05;1,1;"..bg["food"].."^creative_food.png;food;]".. --food
|
||||||
|
"image_button[8.19,-0.05;1,1;"..bg["inv"].."^creative_inv.png;inv;]".. --inv
|
||||||
|
"image[0,1;5,0.75;fnt_"..name..".png]"..
|
||||||
|
main_list..
|
||||||
|
"list[current_player;main;0,7;8,1;]"..
|
||||||
|
"background[-0.19,-0.25;9.53,8.54;creative_inventory.png]"..
|
||||||
|
"image_button[8.03,1.74;0.85,0.6;creative_up.png;creative_prev;]"..
|
||||||
|
"image[8.04," .. tostring(slider_pos) .. ";0.75,"..tostring(slider_height) .. ";creative_slider.png]"..
|
||||||
|
"image_button[8.03,6.15;0.85,0.6;creative_down.png;creative_next;]"..
|
||||||
|
"list[detached:creative_trash;main;8,7;1,1;]"..
|
||||||
|
"image[8,7;1,1;creative_trash.png]"..
|
||||||
|
"bgcolor[#000A;true]"..
|
||||||
|
"listcolors[#9990;#FFF7;#FFF0;#160816;#9E9D9E]"
|
||||||
|
if page == nil then formspec = formspec .. "field[5.3,1.3;3,0.75;suche;;]" end
|
||||||
|
player:set_inventory_formspec(formspec)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
local page = nil
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
creative_inventory.set_creative_formspec(player, 0, 1)
|
|
||||||
end)
|
if fields.suche ~= nil and fields.suche ~= "" then
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
set_inv(string.lower(fields.suche))
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
minetest.after(0.5, function()
|
||||||
return
|
minetest.show_formspec(player:get_player_name(), "detached:creative", player:get_inventory_formspec())
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
if fields.build then
|
||||||
|
set_inv("#blocks",player)
|
||||||
|
page = "build"
|
||||||
|
end
|
||||||
|
if fields.other then
|
||||||
|
set_inv("#deco",player)
|
||||||
|
page = "other"
|
||||||
|
end
|
||||||
|
if fields.misc then
|
||||||
|
set_inv("#misc",player)
|
||||||
|
page = "misc"
|
||||||
|
end
|
||||||
|
if fields.default then
|
||||||
|
set_inv("all")
|
||||||
|
page = nil
|
||||||
|
end
|
||||||
|
if fields.food then
|
||||||
|
set_inv("#food")
|
||||||
|
page = "food"
|
||||||
|
end
|
||||||
|
if fields.tools then
|
||||||
|
set_inv("#tools")
|
||||||
|
page = "tools"
|
||||||
|
end
|
||||||
|
if fields.inv then
|
||||||
|
page = "inv"
|
||||||
end
|
end
|
||||||
-- Figure out current page from formspec
|
-- Figure out current page from formspec
|
||||||
local current_page = 0
|
local current_page = 0
|
||||||
local formspec = player:get_inventory_formspec()
|
local formspec = player:get_inventory_formspec()
|
||||||
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
|
|
||||||
start_i = tonumber(start_i) or 0
|
|
||||||
|
|
||||||
|
local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]")
|
||||||
|
local bis = string.find (formspec, "image") or 2
|
||||||
|
local tmp_page = string.sub(formspec, 24, bis-2)
|
||||||
|
if tmp_page == "nix" then tmp_page = nil end
|
||||||
|
start_i = tonumber(start_i) or 0
|
||||||
if fields.creative_prev then
|
if fields.creative_prev then
|
||||||
start_i = start_i - 4*6
|
start_i = start_i - 8*5
|
||||||
|
page = tmp_page
|
||||||
end
|
end
|
||||||
if fields.creative_next then
|
if fields.creative_next then
|
||||||
start_i = start_i + 4*6
|
start_i = start_i + 8*5
|
||||||
|
page = tmp_page
|
||||||
end
|
end
|
||||||
|
|
||||||
if start_i < 0 then
|
if start_i < 0 then
|
||||||
start_i = start_i + 4*6
|
start_i = start_i + 8*5
|
||||||
end
|
end
|
||||||
if start_i >= creative_inventory.creative_inventory_size then
|
if start_i >= creative.creative_inventory_size then
|
||||||
start_i = start_i - 4*6
|
start_i = start_i - 8*5
|
||||||
end
|
end
|
||||||
|
if start_i < 0 or start_i >= creative.creative_inventory_size then
|
||||||
if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then
|
|
||||||
start_i = 0
|
start_i = 0
|
||||||
end
|
end
|
||||||
|
creative.set_creative_formspec(player, start_i, start_i / (8*5) + 1, false, page)
|
||||||
creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if minetest.setting_getbool("creative_mode") then
|
|
||||||
|
|
||||||
|
if minetest.setting_getbool("creative_mode") then
|
||||||
minetest.register_item(":", {
|
minetest.register_item(":", {
|
||||||
type = "none",
|
type = "none",
|
||||||
wield_image = "wieldhand.png",
|
wield_image = "wieldhand.png",
|
||||||
|
@ -131,13 +247,12 @@ if minetest.setting_getbool("creative_mode") then
|
||||||
full_punch_interval = 0.5,
|
full_punch_interval = 0.5,
|
||||||
max_drop_level = 3,
|
max_drop_level = 3,
|
||||||
groupcaps = {
|
groupcaps = {
|
||||||
crumbly = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
crumbly = {times={[1]=0.3, [2]=0.3, [3]=0.3}, uses=0, maxlevel=3},
|
||||||
cracky = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
cracky = {times={[1]=0.3, [2]=0.3, [3]=0.3}, uses=0, maxlevel=3},
|
||||||
snappy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
snappy = {times={[1]=0.3, [2]=0.3, [3]=0.3}, uses=0, maxlevel=3},
|
||||||
choppy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
choppy = {times={[1]=0.3, [2]=0.3, [3]=0.3}, uses=0, maxlevel=3},
|
||||||
oddly_breakable_by_hand = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
oddly_breakable_by_hand = {times={[1]=0.3, [2]=0.3, [3]=0.3}, uses=0, maxlevel=3},
|
||||||
},
|
}
|
||||||
damage_groups = {fleshy = 10},
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 229 B |
After Width: | Height: | Size: 229 B |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 923 B |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 218 B |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
|
@ -605,12 +605,6 @@ minetest.register_craft({
|
||||||
recipe = "default:gold_lump",
|
recipe = "default:gold_lump",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "cooking",
|
|
||||||
output = "default:hardened_clay",
|
|
||||||
recipe = "default:clay",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "default:clay_brick",
|
output = "default:clay_brick",
|
||||||
|
|
|
@ -90,7 +90,7 @@ minetest.register_craftitem("default:clay_brick", {
|
||||||
minetest.register_craftitem("default:scorched_stuff", {
|
minetest.register_craftitem("default:scorched_stuff", {
|
||||||
description = "Scorched Stuff",
|
description = "Scorched Stuff",
|
||||||
inventory_image = "default_scorched_stuff.png",
|
inventory_image = "default_scorched_stuff.png",
|
||||||
groups = {not_in_creative = 1},
|
groups = {not_in_creative_inventory=1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("default:obsidian_shard", {
|
minetest.register_craftitem("default:obsidian_shard", {
|
||||||
|
|
|
@ -118,6 +118,88 @@ function on_punchnode(p, node)
|
||||||
end
|
end
|
||||||
minetest.register_on_punchnode(on_punchnode)
|
minetest.register_on_punchnode(on_punchnode)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Default grass+dirt abms
|
||||||
|
--
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"default:dirt"},
|
||||||
|
interval = 2,
|
||||||
|
chance = 200,
|
||||||
|
action = function(pos, node)
|
||||||
|
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 ((minetest.get_node_light(above) or 0) >= 13) then
|
||||||
|
if name == "default:snow" or name == "default:snowblock" then
|
||||||
|
minetest.set_node(pos, {name = "default:dirt_with_snow"})
|
||||||
|
else
|
||||||
|
minetest.set_node(pos, {name = "default:dirt_with_grass"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"default:dirt_with_grass"},
|
||||||
|
interval = 2,
|
||||||
|
chance = 20,
|
||||||
|
action = function(pos, node)
|
||||||
|
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
|
||||||
|
minetest.set_node(pos, {name = "default:dirt"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Grow trees
|
||||||
|
--
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"default:sapling"},
|
||||||
|
interval = 10,
|
||||||
|
chance = 50,
|
||||||
|
action = function(pos, node)
|
||||||
|
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
|
||||||
|
if is_soil == nil or is_soil == 0 then return end
|
||||||
|
print("A sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||||
|
local vm = minetest.get_voxel_manip()
|
||||||
|
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
|
||||||
|
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
|
||||||
|
local data = vm:get_data()
|
||||||
|
default.grow_tree(data, a, pos, math.random(1, 4) == 1, math.random(1,100000))
|
||||||
|
vm:set_data(data)
|
||||||
|
vm:write_to_map(data)
|
||||||
|
vm:update_map()
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"default:junglesapling"},
|
||||||
|
interval = 10,
|
||||||
|
chance = 50,
|
||||||
|
action = function(pos, node)
|
||||||
|
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
|
||||||
|
if is_soil == nil or is_soil == 0 then return end
|
||||||
|
print("A jungle sapling grows into a tree at "..minetest.pos_to_string(pos))
|
||||||
|
local vm = minetest.get_voxel_manip()
|
||||||
|
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y-1, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
|
||||||
|
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
|
||||||
|
local data = vm:get_data()
|
||||||
|
default.grow_jungletree(data, a, pos, math.random(1,100000))
|
||||||
|
vm:set_data(data)
|
||||||
|
vm:write_to_map(data)
|
||||||
|
vm:update_map()
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Lavacooling
|
-- Lavacooling
|
||||||
--
|
--
|
||||||
|
|
|
@ -21,3 +21,5 @@ dofile(minetest.get_modpath("default").."/crafting.lua")
|
||||||
dofile(minetest.get_modpath("default").."/mapgen.lua")
|
dofile(minetest.get_modpath("default").."/mapgen.lua")
|
||||||
dofile(minetest.get_modpath("default").."/player.lua")
|
dofile(minetest.get_modpath("default").."/player.lua")
|
||||||
dofile(minetest.get_modpath("default").."/torches.lua")
|
dofile(minetest.get_modpath("default").."/torches.lua")
|
||||||
|
dofile(minetest.get_modpath("default").."/trees.lua")
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ minetest.register_node("default:stone", {
|
||||||
description = "Stone",
|
description = "Stone",
|
||||||
tiles = {"default_stone.png"},
|
tiles = {"default_stone.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {cracky=3, stone=1},
|
groups = {cracky=3, stone=1,oddly_breakable_by_hand=4},
|
||||||
drop = 'default:cobble',
|
drop = 'default:cobble',
|
||||||
legacy_mineral = true,
|
legacy_mineral = true,
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
@ -183,16 +183,6 @@ minetest.register_node("default:clay", {
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("default:hardened_clay", {
|
|
||||||
description = "Hardened Clay",
|
|
||||||
tiles = {"default_hardened_clay.png"},
|
|
||||||
is_ground_content = true,
|
|
||||||
groups = {crumbly=2},
|
|
||||||
sounds = default.node_sound_dirt_defaults({
|
|
||||||
footstep = "",
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("default:brick", {
|
minetest.register_node("default:brick", {
|
||||||
description = "Brick Block",
|
description = "Brick Block",
|
||||||
tiles = {"default_brick.png"},
|
tiles = {"default_brick.png"},
|
||||||
|
@ -635,15 +625,23 @@ minetest.register_node("default:sign_wall", {
|
||||||
|
|
||||||
default.chest_formspec =
|
default.chest_formspec =
|
||||||
"size[8,9]"..
|
"size[8,9]"..
|
||||||
"list[current_name;main;0,0;8,4;]"..
|
"bgcolor[#000A;true]"..
|
||||||
"list[current_player;main;0,5;8,4;]"
|
"background[-0.19,-0.25;8.41,9.8;default_formspec_chest.png]"..
|
||||||
|
"list[current_name;main;0,0.43;8,4;]"..
|
||||||
|
"list[current_player;main;0,4.85;8,1;]"..
|
||||||
|
"list[current_player;main;0,6.08;8,3;8]"..
|
||||||
|
"listcolors[#AAA0;#FFF5]"
|
||||||
|
|
||||||
function default.get_locked_chest_formspec(pos)
|
function default.get_locked_chest_formspec(pos)
|
||||||
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
||||||
local formspec =
|
local formspec =
|
||||||
"size[8,9]"..
|
"size[8,9]"..
|
||||||
"list[nodemeta:".. spos .. ";main;0,0;8,4;]"..
|
"bgcolor[#000A;true]"..
|
||||||
"list[current_player;main;0,5;8,4;]"
|
"background[-0.19,-0.25;8.41,9.8;default_formspec_chest.png]"..
|
||||||
|
"list[nodemeta:".. spos .. ";main;0,0.43;8,4;]"..
|
||||||
|
"list[current_player;main;0,4.85;8,1;]"..
|
||||||
|
"list[current_player;main;0,6.08;8,3;8]"..
|
||||||
|
"listcolors[#AAA0;#FFF5]"
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -780,25 +778,34 @@ minetest.register_node("default:chest_locked", {
|
||||||
|
|
||||||
function default.get_furnace_active_formspec(pos, percent, item_percent)
|
function default.get_furnace_active_formspec(pos, percent, item_percent)
|
||||||
local formspec =
|
local formspec =
|
||||||
"size[8,8]"..
|
"size[8,8.5]"..
|
||||||
"image[2,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
"bgcolor[#000A;true]"..
|
||||||
|
"background[-0.19,-0.25;8.41,9.25;default_formspec_bg.png^default_formspec_furnace.png]"..
|
||||||
|
"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||||
(100-percent)..":default_furnace_fire_fg.png]"..
|
(100-percent)..":default_furnace_fire_fg.png]"..
|
||||||
"image[3.5,1.5;1,1;default_furnace_arrow_bg.png^[lowpart:"..
|
"image[3.75,1.5;1,1;default_furnace_arrow_bg.png^[lowpart:"..
|
||||||
(item_percent*100)..":default_furnace_arrow_fg.png^[transformR270]"..
|
(item_percent*100)..":default_furnace_arrow_fg.png^[transformR270]"..
|
||||||
"list[current_name;fuel;2,2.5;1,1;]"..
|
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||||
"list[current_name;src;2,0.5;1,1;]"..
|
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||||
"list[current_name;dst;5,1;2,2;]"..
|
"list[current_name;dst;4.75,0.96;2,2;]"..
|
||||||
"list[current_player;main;0,4;8,4;]"
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listcolors[#AAA0;#FFF5]"
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
default.furnace_inactive_formspec =
|
default.furnace_inactive_formspec =
|
||||||
"size[8,8]"..
|
"size[8,8.5]"..
|
||||||
"image[2,1.5;1,1;default_furnace_fire_bg.png]"..
|
"bgcolor[#000A;true]"..
|
||||||
"list[current_name;fuel;2,2.5;1,1;]"..
|
"background[-0.19,-0.25;8.41,9.25;default_formspec_bg.png^default_formspec_furnace.png]"..
|
||||||
"list[current_name;src;2,0.5;1,1;]"..
|
"image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
|
||||||
"list[current_name;dst;5,1;2,2;]"..
|
"image[3.75,1.5;1,1;default_furnace_arrow_bg.png^[transformR270]"..
|
||||||
"list[current_player;main;0,4;8,4;]"
|
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||||
|
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||||
|
"list[current_name;dst;4.75,0.96;2,2;]"..
|
||||||
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
|
"listcolors[#AAA0;#FFF5]"
|
||||||
|
|
||||||
minetest.register_node("default:furnace", {
|
minetest.register_node("default:furnace", {
|
||||||
description = "Furnace",
|
description = "Furnace",
|
||||||
|
@ -1178,7 +1185,7 @@ minetest.register_node("default:sapling", {
|
||||||
minetest.register_node("default:apple", {
|
minetest.register_node("default:apple", {
|
||||||
description = "Apple",
|
description = "Apple",
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
visual_scale = 1.0,
|
visual_scale = 0.8,
|
||||||
tiles = {"default_apple.png"},
|
tiles = {"default_apple.png"},
|
||||||
inventory_image = "default_apple.png",
|
inventory_image = "default_apple.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
@ -1186,7 +1193,7 @@ minetest.register_node("default:apple", {
|
||||||
walkable = false,
|
walkable = false,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
|
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
|
||||||
},
|
},
|
||||||
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
|
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
|
||||||
on_use = minetest.item_eat(1),
|
on_use = minetest.item_eat(1),
|
||||||
|
|
|
@ -67,8 +67,28 @@ function player_update_visuals(pl)
|
||||||
pl:set_properties(prop)
|
pl:set_properties(prop)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update appearance when the player joins
|
function default.set_player_inventory(player)
|
||||||
minetest.register_on_joinplayer(player_update_visuals)
|
player:set_inventory_formspec(
|
||||||
|
"size[8,8.5]"..
|
||||||
|
"bgcolor[#000A;true]"..
|
||||||
|
"background[-0.19,-0.25;8.41,9.25;default_formspec_bg.png^default_formspec_player.png]"..
|
||||||
|
"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;]"..
|
||||||
|
"listcolors[#AAA0;#FFF5]"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Update appearance and formspec when the player joins
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
player_update_visuals(player)
|
||||||
|
if minetest.setting_getbool("creative_mode") then
|
||||||
|
creative.set_creative_formspec(player, 0, 1)
|
||||||
|
else
|
||||||
|
default.set_player_inventory(player)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
-- Check each player and apply animations
|
-- Check each player and apply animations
|
||||||
function player_step(dtime)
|
function player_step(dtime)
|
||||||
|
|
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 265 B |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 1019 B |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 613 B |
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 771 B After Width: | Height: | Size: 957 B |
Before Width: | Height: | Size: 926 B After Width: | Height: | Size: 811 B |
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 497 B |
After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 369 B |
|
@ -11,7 +11,7 @@ minetest.register_item(":", {
|
||||||
groupcaps = {
|
groupcaps = {
|
||||||
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
|
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
|
||||||
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
|
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
|
||||||
oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40}, uses=0, maxlevel=3}
|
oddly_breakable_by_hand = {times={[1]=6.70,[2]=4.00,[3]=1.40,[4]=30.00}, uses=0, maxlevel=3}
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=1},
|
damage_groups = {fleshy=1},
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ minetest.register_tool("default:pick_wood", {
|
||||||
full_punch_interval = 1.2,
|
full_punch_interval = 1.2,
|
||||||
max_drop_level=0,
|
max_drop_level=0,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
cracky = {times={[3]=1.60}, uses=10, maxlevel=1},
|
cracky = {times={[3]=1.40}, uses=10/3, maxlevel=1},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=2},
|
damage_groups = {fleshy=2},
|
||||||
},
|
},
|
||||||
|
@ -37,10 +37,10 @@ minetest.register_tool("default:pick_stone", {
|
||||||
description = "Stone Pickaxe",
|
description = "Stone Pickaxe",
|
||||||
inventory_image = "default_tool_stonepick.png",
|
inventory_image = "default_tool_stonepick.png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 1.3,
|
full_punch_interval = 1.1,
|
||||||
max_drop_level=0,
|
max_drop_level=0,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
cracky = {times={[2]=2.0, [3]=1.20}, uses=20, maxlevel=1},
|
cracky = {times={[2]=1.80, [3]=1.15}, uses=20/3, maxlevel=1},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=3},
|
damage_groups = {fleshy=3},
|
||||||
},
|
},
|
||||||
|
@ -52,7 +52,7 @@ minetest.register_tool("default:pick_steel", {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=2},
|
cracky = {times={[1]=3.50, [2]=1.50, [3]=0.80}, uses=20/3, maxlevel=2},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=4},
|
damage_groups = {fleshy=4},
|
||||||
},
|
},
|
||||||
|
@ -64,7 +64,7 @@ minetest.register_tool("default:pick_bronze", {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=30, maxlevel=2},
|
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=30/3, maxlevel=2},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=4},
|
damage_groups = {fleshy=4},
|
||||||
},
|
},
|
||||||
|
@ -73,10 +73,10 @@ minetest.register_tool("default:pick_mese", {
|
||||||
description = "Mese Pickaxe",
|
description = "Mese Pickaxe",
|
||||||
inventory_image = "default_tool_mesepick.png",
|
inventory_image = "default_tool_mesepick.png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 0.9,
|
full_punch_interval = 0.7,
|
||||||
max_drop_level=3,
|
max_drop_level=3,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel=3},
|
cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20/3, maxlevel=3},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=5},
|
damage_groups = {fleshy=5},
|
||||||
},
|
},
|
||||||
|
@ -88,7 +88,7 @@ minetest.register_tool("default:pick_diamond", {
|
||||||
full_punch_interval = 0.9,
|
full_punch_interval = 0.9,
|
||||||
max_drop_level=3,
|
max_drop_level=3,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3},
|
cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30/3, maxlevel=3},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=5},
|
damage_groups = {fleshy=5},
|
||||||
},
|
},
|
||||||
|
@ -106,7 +106,7 @@ minetest.register_tool("default:shovel_wood", {
|
||||||
full_punch_interval = 1.2,
|
full_punch_interval = 1.2,
|
||||||
max_drop_level=0,
|
max_drop_level=0,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
crumbly = {times={[1]=3.00, [2]=1.60, [3]=0.60}, uses=10, maxlevel=1},
|
crumbly = {times={[1]=2.80, [2]=1.50, [3]=0.60}, uses=10/3, maxlevel=1},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=2},
|
damage_groups = {fleshy=2},
|
||||||
},
|
},
|
||||||
|
@ -116,10 +116,10 @@ minetest.register_tool("default:shovel_stone", {
|
||||||
inventory_image = "default_tool_stoneshovel.png",
|
inventory_image = "default_tool_stoneshovel.png",
|
||||||
wield_image = "default_tool_stoneshovel.png^[transformR90",
|
wield_image = "default_tool_stoneshovel.png^[transformR90",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 1.4,
|
full_punch_interval = 1.1,
|
||||||
max_drop_level=0,
|
max_drop_level=0,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
crumbly = {times={[1]=1.80, [2]=1.20, [3]=0.50}, uses=20, maxlevel=1},
|
crumbly = {times={[1]=1.80, [2]=1.20, [3]=0.50}, uses=20/3, maxlevel=1},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=2},
|
damage_groups = {fleshy=2},
|
||||||
},
|
},
|
||||||
|
@ -129,10 +129,10 @@ minetest.register_tool("default:shovel_steel", {
|
||||||
inventory_image = "default_tool_steelshovel.png",
|
inventory_image = "default_tool_steelshovel.png",
|
||||||
wield_image = "default_tool_steelshovel.png^[transformR90",
|
wield_image = "default_tool_steelshovel.png^[transformR90",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 1.1,
|
full_punch_interval = 0.9,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=30, maxlevel=2},
|
crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=30/3, maxlevel=2},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=3},
|
damage_groups = {fleshy=3},
|
||||||
},
|
},
|
||||||
|
@ -145,7 +145,7 @@ minetest.register_tool("default:shovel_bronze", {
|
||||||
full_punch_interval = 1.1,
|
full_punch_interval = 1.1,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=40, maxlevel=2},
|
crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=40/3, maxlevel=2},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=3},
|
damage_groups = {fleshy=3},
|
||||||
},
|
},
|
||||||
|
@ -158,7 +158,7 @@ minetest.register_tool("default:shovel_mese", {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
max_drop_level=3,
|
max_drop_level=3,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.30}, uses=20, maxlevel=3},
|
crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.30}, uses=20/3, maxlevel=3},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=4},
|
damage_groups = {fleshy=4},
|
||||||
},
|
},
|
||||||
|
@ -171,7 +171,7 @@ minetest.register_tool("default:shovel_diamond", {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=30, maxlevel=3},
|
crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=30/3, maxlevel=3},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=4},
|
damage_groups = {fleshy=4},
|
||||||
},
|
},
|
||||||
|
@ -188,7 +188,7 @@ minetest.register_tool("default:axe_wood", {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
max_drop_level=0,
|
max_drop_level=0,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
choppy = {times={[2]=3.00, [3]=2.00}, uses=10, maxlevel=1},
|
choppy = {times={[2]=2.60, [3]=1.80}, uses=10/3, maxlevel=1},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=2},
|
damage_groups = {fleshy=2},
|
||||||
},
|
},
|
||||||
|
@ -200,7 +200,7 @@ minetest.register_tool("default:axe_stone", {
|
||||||
full_punch_interval = 1.2,
|
full_punch_interval = 1.2,
|
||||||
max_drop_level=0,
|
max_drop_level=0,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
choppy={times={[1]=3.00, [2]=2.00, [3]=1.50}, uses=20, maxlevel=1},
|
choppy={times={[1]=3.00, [2]=2.00, [3]=1.50}, uses=20/3, maxlevel=1},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=3},
|
damage_groups = {fleshy=3},
|
||||||
},
|
},
|
||||||
|
@ -212,7 +212,7 @@ minetest.register_tool("default:axe_steel", {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=20, maxlevel=2},
|
choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=20/3, maxlevel=2},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=4},
|
damage_groups = {fleshy=4},
|
||||||
},
|
},
|
||||||
|
@ -224,7 +224,7 @@ minetest.register_tool("default:axe_bronze", {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=30, maxlevel=2},
|
choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=30/3, maxlevel=2},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=4},
|
damage_groups = {fleshy=4},
|
||||||
},
|
},
|
||||||
|
@ -236,7 +236,7 @@ minetest.register_tool("default:axe_mese", {
|
||||||
full_punch_interval = 0.9,
|
full_punch_interval = 0.9,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
choppy={times={[1]=2.20, [2]=1.00, [3]=0.60}, uses=20, maxlevel=3},
|
choppy={times={[1]=2.20, [2]=1.00, [3]=0.60}, uses=20/3, maxlevel=3},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=6},
|
damage_groups = {fleshy=6},
|
||||||
},
|
},
|
||||||
|
@ -248,7 +248,7 @@ minetest.register_tool("default:axe_diamond", {
|
||||||
full_punch_interval = 0.9,
|
full_punch_interval = 0.9,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=2},
|
choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30/3, maxlevel=2},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=7},
|
damage_groups = {fleshy=7},
|
||||||
},
|
},
|
||||||
|
@ -277,7 +277,7 @@ minetest.register_tool("default:sword_stone", {
|
||||||
full_punch_interval = 1.2,
|
full_punch_interval = 1.2,
|
||||||
max_drop_level=0,
|
max_drop_level=0,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
snappy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1},
|
snappy={times={[2]=1.4, [3]=0.40}, uses=20/3, maxlevel=1},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=4},
|
damage_groups = {fleshy=4},
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ minetest.register_tool("default:sword_steel", {
|
||||||
full_punch_interval = 0.8,
|
full_punch_interval = 0.8,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2},
|
snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30/3, maxlevel=2},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=6},
|
damage_groups = {fleshy=6},
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ minetest.register_tool("default:sword_bronze", {
|
||||||
full_punch_interval = 0.8,
|
full_punch_interval = 0.8,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=40, maxlevel=2},
|
snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=40/3, maxlevel=2},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=6},
|
damage_groups = {fleshy=6},
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ minetest.register_tool("default:sword_mese", {
|
||||||
full_punch_interval = 0.7,
|
full_punch_interval = 0.7,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3},
|
snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30/3, maxlevel=3},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=7},
|
damage_groups = {fleshy=7},
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ minetest.register_tool("default:sword_diamond", {
|
||||||
full_punch_interval = 0.7,
|
full_punch_interval = 0.7,
|
||||||
max_drop_level=1,
|
max_drop_level=1,
|
||||||
groupcaps={
|
groupcaps={
|
||||||
snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3},
|
snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40/3, maxlevel=3},
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy=8},
|
damage_groups = {fleshy=8},
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ end
|
||||||
--node_boxes
|
--node_boxes
|
||||||
minetest.register_craftitem(":default:torch", {
|
minetest.register_craftitem(":default:torch", {
|
||||||
description = "Torch",
|
description = "Torch",
|
||||||
inventory_image = "default_torch.png",
|
inventory_image = "default_torch_inv.png",
|
||||||
wield_image = "default_torch.png",
|
wield_image = "default_torch.png",
|
||||||
wield_scale = {x=1,y=1,z=1+1/16},
|
wield_scale = {x=1,y=1,z=1+1/16},
|
||||||
liquids_pointable = false,
|
liquids_pointable = false,
|
||||||
|
@ -102,7 +102,7 @@ minetest.register_craftitem(":default:torch", {
|
||||||
|
|
||||||
minetest.register_node("default:torch_floor", {
|
minetest.register_node("default:torch_floor", {
|
||||||
--description = "Fakel",
|
--description = "Fakel",
|
||||||
inventory_image = "default_torch.png",
|
inventory_image = "default_torch_inv.png",
|
||||||
wield_image = "default_torch.png",
|
wield_image = "default_torch.png",
|
||||||
wield_scale = {x=1,y=1,z=1+2/16},
|
wield_scale = {x=1,y=1,z=1+2/16},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
@ -142,7 +142,7 @@ local wall_ndbx = {
|
||||||
|
|
||||||
minetest.register_node("default:torch_wand", {
|
minetest.register_node("default:torch_wand", {
|
||||||
--description = "Fakel",
|
--description = "Fakel",
|
||||||
inventory_image = "default_torch.png",
|
inventory_image = "default_torch_inv.png",
|
||||||
wield_image = "default_torch.png",
|
wield_image = "default_torch.png",
|
||||||
wield_scale = {x=1,y=1,z=1+1/16},
|
wield_scale = {x=1,y=1,z=1+1/16},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
local c_air = minetest.get_content_id("air")
|
||||||
|
local c_ignore = minetest.get_content_id("ignore")
|
||||||
|
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")
|
||||||
|
|
||||||
|
function default.grow_tree(data, a, pos, is_apple_tree, seed)
|
||||||
|
--[[
|
||||||
|
NOTE: Tree-placing code is currently duplicated in the engine
|
||||||
|
and in games that have saplings; both are deprecated but not
|
||||||
|
replaced yet
|
||||||
|
]]--
|
||||||
|
local pr = PseudoRandom(seed)
|
||||||
|
local th = pr:next(4, 5)
|
||||||
|
local x, y, z = pos.x, pos.y, pos.z
|
||||||
|
for yy = y, y+th-1 do
|
||||||
|
local vi = a:index(x, yy, z)
|
||||||
|
if a:contains(x, yy, z) and (data[vi] == c_air or yy == y) then
|
||||||
|
data[vi] = c_tree
|
||||||
|
end
|
||||||
|
end
|
||||||
|
y = y+th-1 -- (x, y, z) is now last piece of trunk
|
||||||
|
local leaves_a = VoxelArea:new{MinEdge={x=-2, y=-1, z=-2}, MaxEdge={x=2, y=2, z=2}}
|
||||||
|
local leaves_buffer = {}
|
||||||
|
|
||||||
|
-- Force leaves near the trunk
|
||||||
|
local d = 1
|
||||||
|
for xi = -d, d do
|
||||||
|
for yi = -d, d do
|
||||||
|
for zi = -d, d do
|
||||||
|
leaves_buffer[leaves_a:index(xi, yi, zi)] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add leaves randomly
|
||||||
|
for iii = 1, 8 do
|
||||||
|
local d = 1
|
||||||
|
local xx = pr:next(leaves_a.MinEdge.x, leaves_a.MaxEdge.x - d)
|
||||||
|
local yy = pr:next(leaves_a.MinEdge.y, leaves_a.MaxEdge.y - d)
|
||||||
|
local zz = pr:next(leaves_a.MinEdge.z, leaves_a.MaxEdge.z - d)
|
||||||
|
|
||||||
|
for xi = 0, d do
|
||||||
|
for yi = 0, d do
|
||||||
|
for zi = 0, d do
|
||||||
|
leaves_buffer[leaves_a:index(xx+xi, yy+yi, zz+zi)] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add the leaves
|
||||||
|
for xi = leaves_a.MinEdge.x, leaves_a.MaxEdge.x do
|
||||||
|
for yi = leaves_a.MinEdge.y, leaves_a.MaxEdge.y do
|
||||||
|
for zi = leaves_a.MinEdge.z, leaves_a.MaxEdge.z do
|
||||||
|
if a:contains(x+xi, y+yi, z+zi) then
|
||||||
|
local vi = a:index(x+xi, y+yi, z+zi)
|
||||||
|
if data[vi] == c_air or data[vi] == c_ignore then
|
||||||
|
if leaves_buffer[leaves_a:index(xi, yi, zi)] then
|
||||||
|
if is_apple_tree and pr:next(1, 100) <= 10 then
|
||||||
|
data[vi] = c_apple
|
||||||
|
else
|
||||||
|
data[vi] = c_leaves
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local c_jungletree = minetest.get_content_id("default:jungletree")
|
||||||
|
local c_jungleleaves = minetest.get_content_id("default:jungleleaves")
|
||||||
|
|
||||||
|
function default.grow_jungletree(data, a, pos, seed)
|
||||||
|
--[[
|
||||||
|
NOTE: Tree-placing code is currently duplicated in the engine
|
||||||
|
and in games that have saplings; both are deprecated but not
|
||||||
|
replaced yet
|
||||||
|
]]--
|
||||||
|
local pr = PseudoRandom(seed)
|
||||||
|
local x, y, z = pos.x, pos.y, pos.z
|
||||||
|
for xi = -1, 1 do
|
||||||
|
for zi = -1, 1 do
|
||||||
|
if pr:next(1, 3) >= 2 then
|
||||||
|
local vi1 = a:index(x+xi, y, z+zi)
|
||||||
|
local vi2 = a:index(x+xi, y-1, z+zi)
|
||||||
|
if a:contains(x+xi, y-1, z+zi) and data[vi2] == c_air then
|
||||||
|
data[vi2] = c_jungletree
|
||||||
|
elseif a:contains(x+xi, y, z+zi) and data[vi1] == c_air then
|
||||||
|
data[vi1] = c_jungletree
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local th = pr:next(8, 12)
|
||||||
|
for yy = y, y+th-1 do
|
||||||
|
local vi = a:index(x, yy, z)
|
||||||
|
if a:contains(x, yy, z) and (data[vi] == c_air or yy == y) then
|
||||||
|
data[vi] = c_jungletree
|
||||||
|
end
|
||||||
|
end
|
||||||
|
y = y+th-1 -- (x, y, z) is now last piece of trunk
|
||||||
|
local leaves_a = VoxelArea:new{MinEdge={x=-3, y=-2, z=-3}, MaxEdge={x=3, y=2, z=3}}
|
||||||
|
local leaves_buffer = {}
|
||||||
|
|
||||||
|
-- Force leaves near the trunk
|
||||||
|
local d = 1
|
||||||
|
for xi = -d, d do
|
||||||
|
for yi = -d, d do
|
||||||
|
for zi = -d, d do
|
||||||
|
leaves_buffer[leaves_a:index(xi, yi, zi)] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add leaves randomly
|
||||||
|
for iii = 1, 30 do
|
||||||
|
local d = 1
|
||||||
|
local xx = pr:next(leaves_a.MinEdge.x, leaves_a.MaxEdge.x - d)
|
||||||
|
local yy = pr:next(leaves_a.MinEdge.y, leaves_a.MaxEdge.y - d)
|
||||||
|
local zz = pr:next(leaves_a.MinEdge.z, leaves_a.MaxEdge.z - d)
|
||||||
|
|
||||||
|
for xi = 0, d do
|
||||||
|
for yi = 0, d do
|
||||||
|
for zi = 0, d do
|
||||||
|
leaves_buffer[leaves_a:index(xx+xi, yy+yi, zz+zi)] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add the leaves
|
||||||
|
for xi = leaves_a.MinEdge.x, leaves_a.MaxEdge.x do
|
||||||
|
for yi = leaves_a.MinEdge.y, leaves_a.MaxEdge.y do
|
||||||
|
for zi = leaves_a.MinEdge.z, leaves_a.MaxEdge.z do
|
||||||
|
if a:contains(x+xi, y+yi, z+zi) then
|
||||||
|
local vi = a:index(x+xi, y+yi, z+zi)
|
||||||
|
if data[vi] == c_air or data[vi] == c_ignore then
|
||||||
|
if leaves_buffer[leaves_a:index(xi, yi, zi)] then
|
||||||
|
data[vi] = c_jungleleaves
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -62,7 +62,7 @@ function fire.update_sounds_around(pos)
|
||||||
if not sound then
|
if not sound then
|
||||||
if should_have_sound then
|
if should_have_sound then
|
||||||
fire.sounds[p0_hash] = {
|
fire.sounds[p0_hash] = {
|
||||||
handle = minetest.sound_play(wanted_sound, {pos=cp, loop=true}),
|
handle = minetest.sound_play(wanted_sound, {pos=cp, max_hear_distance = 20, loop=true}),
|
||||||
name = wanted_sound.name,
|
name = wanted_sound.name,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -73,7 +73,7 @@ function fire.update_sounds_around(pos)
|
||||||
elseif sound.name ~= wanted_sound.name then
|
elseif sound.name ~= wanted_sound.name then
|
||||||
minetest.sound_stop(sound.handle)
|
minetest.sound_stop(sound.handle)
|
||||||
fire.sounds[p0_hash] = {
|
fire.sounds[p0_hash] = {
|
||||||
handle = minetest.sound_play(wanted_sound, {pos=cp, loop=true}),
|
handle = minetest.sound_play(wanted_sound, {pos=cp, max_hear_distance = 30, loop=true}),
|
||||||
name = wanted_sound.name,
|
name = wanted_sound.name,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -107,7 +107,7 @@ end
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"group:flammable"},
|
nodenames = {"group:flammable"},
|
||||||
neighbors = {"group:igniter"},
|
neighbors = {"group:igniter"},
|
||||||
interval = 1,
|
interval = 2,
|
||||||
chance = 2,
|
chance = 2,
|
||||||
action = function(p0, node, _, _)
|
action = function(p0, node, _, _)
|
||||||
-- If there is water or stuff like that around flame, don't ignite
|
-- If there is water or stuff like that around flame, don't ignite
|
||||||
|
@ -126,8 +126,8 @@ minetest.register_abm({
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"group:igniter"},
|
nodenames = {"group:igniter"},
|
||||||
neighbors = {"air"},
|
neighbors = {"air"},
|
||||||
interval = 2,
|
interval = 8,
|
||||||
chance = 10,
|
chance = 8,
|
||||||
action = function(p0, node, _, _)
|
action = function(p0, node, _, _)
|
||||||
local reg = minetest.registered_nodes[node.name]
|
local reg = minetest.registered_nodes[node.name]
|
||||||
if not reg or not reg.groups.igniter or reg.groups.igniter < 2 then
|
if not reg or not reg.groups.igniter or reg.groups.igniter < 2 then
|
||||||
|
|
Before Width: | Height: | Size: 369 B |
|
@ -28,36 +28,35 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
||||||
|
|
||||||
local p0 = pointed_thing.under
|
local p0 = pointed_thing.under
|
||||||
local p1 = pointed_thing.above
|
local p1 = pointed_thing.above
|
||||||
|
local param2 = 0
|
||||||
|
|
||||||
|
local placer_pos = placer:getpos()
|
||||||
|
if placer_pos then
|
||||||
|
local dir = {
|
||||||
|
x = p1.x - placer_pos.x,
|
||||||
|
y = p1.y - placer_pos.y,
|
||||||
|
z = p1.z - placer_pos.z
|
||||||
|
}
|
||||||
|
param2 = minetest.dir_to_facedir(dir)
|
||||||
|
end
|
||||||
|
|
||||||
if p0.y-1 == p1.y then
|
if p0.y-1 == p1.y then
|
||||||
local fakestack = ItemStack("stairs:stair_" .. subname.."upside_down")
|
param2 = param2 + 20
|
||||||
local ret = minetest.item_place(fakestack, placer, pointed_thing)
|
if param2 == 21 then
|
||||||
if ret:is_empty() then
|
param2 = 23
|
||||||
itemstack:take_item()
|
elseif param2 == 23 then
|
||||||
return itemstack
|
param2 = 21
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Otherwise place regularly
|
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- for replace ABM
|
||||||
minetest.register_node(":stairs:stair_" .. subname.."upside_down", {
|
minetest.register_node(":stairs:stair_" .. subname.."upside_down", {
|
||||||
drop = "stairs:stair_" .. subname,
|
replace_name = "stairs:stair_" .. subname,
|
||||||
drawtype = "nodebox",
|
groups = {slabs_replace=1},
|
||||||
tiles = images,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
is_ground_content = true,
|
|
||||||
groups = groups,
|
|
||||||
sounds = sounds,
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, 0, -0.5, 0.5, 0.5, 0.5},
|
|
||||||
{-0.5, -0.5, 0, 0.5, 0, 0.5},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -87,6 +86,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = images,
|
tiles = images,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = groups,
|
groups = groups,
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
|
@ -106,21 +106,32 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
local p0 = pointed_thing.under
|
local p0 = pointed_thing.under
|
||||||
local p1 = pointed_thing.above
|
local p1 = pointed_thing.above
|
||||||
local n0 = minetest.get_node(p0)
|
local n0 = minetest.get_node(p0)
|
||||||
if n0.name == "stairs:slab_" .. subname and
|
local n1 = minetest.get_node(p1)
|
||||||
p0.y+1 == p1.y then
|
local param2 = 0
|
||||||
|
|
||||||
|
local n0_is_upside_down = (n0.name == "stairs:slab_" .. subname and
|
||||||
|
n0.param2 >= 20)
|
||||||
|
|
||||||
|
if n0.name == "stairs:slab_" .. subname and not n0_is_upside_down and p0.y+1 == p1.y then
|
||||||
slabpos = p0
|
slabpos = p0
|
||||||
slabnode = n0
|
slabnode = n0
|
||||||
|
elseif n1.name == "stairs:slab_" .. subname then
|
||||||
|
slabpos = p1
|
||||||
|
slabnode = n1
|
||||||
end
|
end
|
||||||
if slabpos then
|
if slabpos then
|
||||||
-- Remove the slab at slabpos
|
-- Remove the slab at slabpos
|
||||||
minetest.remove_node(slabpos)
|
minetest.remove_node(slabpos)
|
||||||
-- Make a fake stack of a single item and try to place it
|
-- Make a fake stack of a single item and try to place it
|
||||||
local fakestack = ItemStack(recipeitem)
|
local fakestack = ItemStack(recipeitem)
|
||||||
|
fakestack:set_count(itemstack:get_count())
|
||||||
|
|
||||||
pointed_thing.above = slabpos
|
pointed_thing.above = slabpos
|
||||||
fakestack = minetest.item_place(fakestack, placer, pointed_thing)
|
local success
|
||||||
|
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
|
||||||
-- If the item was taken from the fake stack, decrement original
|
-- If the item was taken from the fake stack, decrement original
|
||||||
if not fakestack or fakestack:is_empty() then
|
if success then
|
||||||
itemstack:take_item(1)
|
itemstack:set_count(fakestack:get_count())
|
||||||
-- Else put old node back
|
-- Else put old node back
|
||||||
else
|
else
|
||||||
minetest.set_node(slabpos, slabnode)
|
minetest.set_node(slabpos, slabnode)
|
||||||
|
@ -131,16 +142,19 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
-- Upside down slabs
|
-- Upside down slabs
|
||||||
if p0.y-1 == p1.y then
|
if p0.y-1 == p1.y then
|
||||||
-- Turn into full block if pointing at a existing slab
|
-- Turn into full block if pointing at a existing slab
|
||||||
if n0.name == "stairs:slab_" .. subname.."upside_down" then
|
if n0_is_upside_down then
|
||||||
-- Remove the slab at the position of the slab
|
-- Remove the slab at the position of the slab
|
||||||
minetest.remove_node(p0)
|
minetest.remove_node(p0)
|
||||||
-- Make a fake stack of a single item and try to place it
|
-- Make a fake stack of a single item and try to place it
|
||||||
local fakestack = ItemStack(recipeitem)
|
local fakestack = ItemStack(recipeitem)
|
||||||
|
fakestack:set_count(itemstack:get_count())
|
||||||
|
|
||||||
pointed_thing.above = p0
|
pointed_thing.above = p0
|
||||||
fakestack = minetest.item_place(fakestack, placer, pointed_thing)
|
local success
|
||||||
|
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
|
||||||
-- If the item was taken from the fake stack, decrement original
|
-- If the item was taken from the fake stack, decrement original
|
||||||
if not fakestack or fakestack:is_empty() then
|
if success then
|
||||||
itemstack:take_item(1)
|
itemstack:set_count(fakestack:get_count())
|
||||||
-- Else put old node back
|
-- Else put old node back
|
||||||
else
|
else
|
||||||
minetest.set_node(p0, n0)
|
minetest.set_node(p0, n0)
|
||||||
|
@ -149,43 +163,22 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Place upside down slab
|
-- Place upside down slab
|
||||||
local fakestack = ItemStack("stairs:slab_" .. subname.."upside_down")
|
param2 = 20
|
||||||
local ret = minetest.item_place(fakestack, placer, pointed_thing)
|
|
||||||
if ret:is_empty() then
|
|
||||||
itemstack:take_item()
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If pointing at the side of a upside down slab
|
-- If pointing at the side of a upside down slab
|
||||||
if n0.name == "stairs:slab_" .. subname.."upside_down" and
|
if n0_is_upside_down and p0.y+1 ~= p1.y then
|
||||||
p0.y+1 ~= p1.y then
|
param2 = 20
|
||||||
-- Place upside down slab
|
|
||||||
local fakestack = ItemStack("stairs:slab_" .. subname.."upside_down")
|
|
||||||
local ret = minetest.item_place(fakestack, placer, pointed_thing)
|
|
||||||
if ret:is_empty() then
|
|
||||||
itemstack:take_item()
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Otherwise place regularly
|
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- for replace ABM
|
||||||
minetest.register_node(":stairs:slab_" .. subname.."upside_down", {
|
minetest.register_node(":stairs:slab_" .. subname.."upside_down", {
|
||||||
drop = "stairs:slab_"..subname,
|
replace_name = "stairs:slab_"..subname,
|
||||||
drawtype = "nodebox",
|
groups = {slabs_replace=1},
|
||||||
tiles = images,
|
|
||||||
paramtype = "light",
|
|
||||||
is_ground_content = true,
|
|
||||||
groups = groups,
|
|
||||||
sounds = sounds,
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.5, 0, -0.5, 0.5, 0.5, 0.5},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -196,6 +189,23 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Replace old "upside_down" nodes with new param2 versions
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"group:slabs_replace"},
|
||||||
|
interval = 1,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node)
|
||||||
|
node.name = minetest.registered_nodes[node.name].replace_name
|
||||||
|
node.param2 = node.param2 + 20
|
||||||
|
if node.param2 == 21 then
|
||||||
|
node.param2 = 23
|
||||||
|
elseif node.param2 == 23 then
|
||||||
|
node.param2 = 21
|
||||||
|
end
|
||||||
|
minetest.set_node(pos, node)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Nodes will be called stairs:{stair,slab}_<subname>
|
-- Nodes will be called stairs:{stair,slab}_<subname>
|
||||||
function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)
|
function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)
|
||||||
stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
|
stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
|
||||||
|
|