Revert "MTG: Trim out the remaining bloat from default (#639)"

This reverts commit ec06b8edde.
This commit is contained in:
LoneWolfHT 2020-09-22 13:16:25 -07:00
parent 77c9f9d21b
commit 65652ec405
7 changed files with 1652 additions and 0 deletions

View file

@ -73,6 +73,9 @@ for _, chest_color in pairs(colors) do
local formspec = table.concat({
"size[8,12]",
default.gui_bg,
default.gui_bg_img,
default.gui_slots,
default.get_hotbar_bg(0,7.85),
"list[current_player;main;0,7.85;8,1;]",
"list[current_player;main;0,9.08;8,3;8]",

View file

@ -130,6 +130,21 @@ function default.node_sound_snow_defaults(table)
end
--
-- Lavacooling
--
default.cool_lava = function(pos, node)
if node.name == "default:lava_source" then
minetest.set_node(pos, {name = "default:obsidian"})
else -- Lava flowing
minetest.set_node(pos, {name = "default:stone"})
end
minetest.sound_play("default_cool_lava",
{pos = pos, max_hear_distance = 16, gain = 0.25})
end
--
-- Optimized helper to put all items in an inventory into a drops list
--
@ -147,6 +162,63 @@ function default.get_inventory_drops(pos, inventory, drops)
end
--
-- 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 >= 4 then
return
end
pos.y = pos.y - 1
if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then
return
end
pos.y = pos.y + 1
local height = 0
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
return
end
if minetest.get_node_light(pos) < 13 then
return
end
minetest.set_node(pos, {name = "default:cactus"})
return true
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
return
end
if not minetest.find_node_near(pos, 3, {"group:water"}) then
return
end
pos.y = pos.y + 1
local height = 0
while node.name == "default:papyrus" 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
return
end
if minetest.get_node_light(pos) < 13 then
return
end
minetest.set_node(pos, {name = "default:papyrus"})
return true
end
--
-- Dig upwards
--

View file

@ -44,4 +44,6 @@ dofile(default_path.."/tools.lua")
dofile(default_path.."/item_entity.lua")
dofile(default_path.."/craftitems.lua")
dofile(default_path.."/crafting.lua")
dofile(default_path.."/mapgen.lua")
dofile(default_path.."/aliases.lua")
dofile(default_path.."/legacy.lua")

View file

@ -0,0 +1,46 @@
-- mods/default/legacy.lua
-- Horrible stuff to support old code registering falling nodes
-- Don't use this and never do what this does, it's completely wrong!
-- (More specifically, the client and the C++ code doesn't get the group)
function default.register_falling_node(nodename, texture)
minetest.log("error", debug.traceback())
minetest.log('error', "WARNING: default.register_falling_node is deprecated")
if minetest.registered_nodes[nodename] then
minetest.registered_nodes[nodename].groups.falling_node = 1
end
end
function default.spawn_falling_node(p, nodename)
spawn_falling_node(p, nodename)
end
-- Liquids
WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha
WATER_VISC = minetest.registered_nodes["default:water_source"].liquid_viscosity
LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity
LIGHT_MAX = default.LIGHT_MAX
-- Formspecs
default.gui_suvival_form = default.gui_survival_form
default.gui_bg = ""
default.gui_bg_img = ""
default.gui_slots = ""
-- Players
if minetest.get_modpath("player_api") then
default.registered_player_models = player_api.registered_models
default.player_register_model = player_api.register_model
default.player_attached = player_api.player_attached
default.player_get_animation = player_api.get_animation
default.player_set_model = player_api.set_model
default.player_set_textures = player_api.set_textures
default.player_set_animation = player_api.set_animation
end
-- Check for a volume intersecting protection
function default.intersects_protection(minp, maxp, player_name, interval)
minetest.log("warning", "default.intersects_protection() is " ..
"deprecated, use minetest.is_area_protected() instead.")
minetest.is_area_protected(minp, maxp, player_name, interval)
end

1520
mods/mtg/default/mapgen.lua Normal file

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,9 @@
function default.get_furnace_active_formspec(fuel_percent, item_percent)
return "size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[context;src;2.75,0.5;1,1;]"..
"list[context;fuel;2.75,2.5;1,1;]"..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
@ -25,6 +28,9 @@ end
function default.get_furnace_inactive_formspec()
return "size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[context;src;2.75,0.5;1,1;]"..
"list[context;fuel;2.75,2.5;1,1;]"..
"image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..

View file

@ -27,6 +27,9 @@ local non_ground_nodes = {
local chest_formspec =
"size[8,9]" ..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[current_name;main;0,0.3;8,4;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..