From a9137e8c212a5d9da20311a0cae549858ffe535c Mon Sep 17 00:00:00 2001 From: Craig Davison Date: Wed, 24 Dec 2014 23:13:15 +0000 Subject: [PATCH] Fix typo in survival formspec & create legacy file --- mods/default/aliases.lua | 9 +++++++-- mods/default/functions.lua | 19 ------------------- mods/default/init.lua | 9 ++------- mods/default/legacy.lua | 25 +++++++++++++++++++++++++ mods/default/player.lua | 2 +- 5 files changed, 35 insertions(+), 29 deletions(-) create mode 100644 mods/default/legacy.lua diff --git a/mods/default/aliases.lua b/mods/default/aliases.lua index d80082e..7247751 100644 --- a/mods/default/aliases.lua +++ b/mods/default/aliases.lua @@ -1,6 +1,7 @@ --- aliases (Minetest 0.4 mod) --- Provides alias for most default items +-- mods/default/aliases.lua +-- Aliases to support loading worlds using nodes following the old naming convention +-- These can also be helpful when using chat commands, for example /giveme minetest.register_alias("stone", "default:stone") minetest.register_alias("stone_with_coal", "default:stone_with_coal") minetest.register_alias("stone_with_iron", "default:stone_with_iron") @@ -65,3 +66,7 @@ minetest.register_alias("lump_of_iron", "default:iron_lump") minetest.register_alias("lump_of_clay", "default:clay_lump") minetest.register_alias("steel_ingot", "default:steel_ingot") minetest.register_alias("clay_brick", "default:clay_brick") +minetest.register_alias("snow", "default:snow") + +-- Mese now comes in the form of blocks, ore, crystal and fragments +minetest.register_alias("default:mese", "default:mese_block") diff --git a/mods/default/functions.lua b/mods/default/functions.lua index c562320..82c9282 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -83,25 +83,6 @@ function default.node_sound_glass_defaults(table) return table end --- --- Legacy --- - -function default.spawn_falling_node(p, nodename) - spawn_falling_node(p, nodename) -end - --- Horrible crap to support old code --- 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 - -- -- Lavacooling -- diff --git a/mods/default/init.lua b/mods/default/init.lua index 663a3ae..3f0efea 100644 --- a/mods/default/init.lua +++ b/mods/default/init.lua @@ -21,7 +21,7 @@ function default.get_hotbar_bg(x,y) return out end -default.gui_suvival_form = "size[8,8.5]".. +default.gui_survival_form = "size[8,8.5]".. default.gui_bg.. default.gui_bg_img.. default.gui_slots.. @@ -43,9 +43,4 @@ dofile(minetest.get_modpath("default").."/mapgen.lua") dofile(minetest.get_modpath("default").."/player.lua") dofile(minetest.get_modpath("default").."/trees.lua") dofile(minetest.get_modpath("default").."/aliases.lua") - --- Legacy: -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 +dofile(minetest.get_modpath("default").."/legacy.lua") diff --git a/mods/default/legacy.lua b/mods/default/legacy.lua new file mode 100644 index 0000000..76fcc8e --- /dev/null +++ b/mods/default/legacy.lua @@ -0,0 +1,25 @@ +-- mods/default/legacy.lua + +-- Horrible crap 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 diff --git a/mods/default/player.lua b/mods/default/player.lua index 688ef62..87618e3 100644 --- a/mods/default/player.lua +++ b/mods/default/player.lua @@ -98,7 +98,7 @@ minetest.register_on_joinplayer(function(player) -- set GUI if not minetest.setting_getbool("creative_mode") then - player:set_inventory_formspec(default.gui_suvival_form) + 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")