HUDs, hunger, mobs, mapgen, splash, mainmemu etc
@ -42,6 +42,9 @@ local function add_server_formspec(dialogdata)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function add_server_buttonhandler(this, fields)
|
local function add_server_buttonhandler(this, fields)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
if fields["server_add_cancel"] then
|
if fields["server_add_cancel"] then
|
||||||
this:delete()
|
this:delete()
|
||||||
|
@ -119,6 +119,9 @@ end
|
|||||||
|
|
||||||
|
|
||||||
local function handle_buttons(this, fields)
|
local function handle_buttons(this, fields)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
if fields["world_config_modlist"] ~= nil then
|
if fields["world_config_modlist"] ~= nil then
|
||||||
local event = core.explode_textlist_event(fields["world_config_modlist"])
|
local event = core.explode_textlist_event(fields["world_config_modlist"])
|
||||||
|
@ -83,6 +83,9 @@ local function create_world_formspec(dialogdata)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function create_world_buttonhandler(this, fields)
|
local function create_world_buttonhandler(this, fields)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
if fields["world_create_cancel"] then
|
if fields["world_create_cancel"] then
|
||||||
this:delete()
|
this:delete()
|
||||||
|
@ -35,6 +35,10 @@ end
|
|||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function delete_mod_buttonhandler(this, fields)
|
local function delete_mod_buttonhandler(this, fields)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
if fields["dlg_delete_mod_confirm"] ~= nil then
|
if fields["dlg_delete_mod_confirm"] ~= nil then
|
||||||
|
|
||||||
if this.data.mod.path ~= nil and
|
if this.data.mod.path ~= nil and
|
||||||
|
@ -31,8 +31,10 @@ local function delete_world_formspec(dialogdata)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function delete_world_buttonhandler(this, fields)
|
local function delete_world_buttonhandler(this, fields)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
if fields["world_delete_confirm"] then
|
if fields["world_delete_confirm"] then
|
||||||
|
|
||||||
if this.data.delete_index > 0 and
|
if this.data.delete_index > 0 and
|
||||||
this.data.delete_index <= #menudata.worldlist:get_raw_list() then
|
this.data.delete_index <= #menudata.worldlist:get_raw_list() then
|
||||||
core.delete_world(this.data.delete_index)
|
core.delete_world(this.data.delete_index)
|
||||||
@ -46,7 +48,6 @@ local function delete_world_buttonhandler(this, fields)
|
|||||||
this:delete()
|
this:delete()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,6 +37,10 @@ end
|
|||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function rename_modpack_buttonhandler(this, fields)
|
local function rename_modpack_buttonhandler(this, fields)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
if fields["dlg_rename_modpack_confirm"] ~= nil then
|
if fields["dlg_rename_modpack_confirm"] ~= nil then
|
||||||
local oldpath = core.get_modpath() .. DIR_DELIM .. this.data.mod.name
|
local oldpath = core.get_modpath() .. DIR_DELIM .. this.data.mod.name
|
||||||
local targetpath = core.get_modpath() .. DIR_DELIM .. fields["te_modpack_name"]
|
local targetpath = core.get_modpath() .. DIR_DELIM .. fields["te_modpack_name"]
|
||||||
|
@ -79,6 +79,10 @@ end
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
local function main_button_handler2(tabview, fields, name, tabdata)
|
local function main_button_handler2(tabview, fields, name, tabdata)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
local index = ''
|
local index = ''
|
||||||
if fields["btn_show_singleplayer"] then index = "singleplayer" end
|
if fields["btn_show_singleplayer"] then index = "singleplayer" end
|
||||||
if fields["btn_show_multiplayer"] then index = "multiplayer" end
|
if fields["btn_show_multiplayer"] then index = "multiplayer" end
|
||||||
|
@ -165,6 +165,10 @@ end
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- @function [parent=#modstore] handle_buttons
|
-- @function [parent=#modstore] handle_buttons
|
||||||
function modstore.handle_buttons(current_tab,fields)
|
function modstore.handle_buttons(current_tab,fields)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
|
|
||||||
if fields["modstore_tab"] then
|
if fields["modstore_tab"] then
|
||||||
local index = tonumber(fields["modstore_tab"])
|
local index = tonumber(fields["modstore_tab"])
|
||||||
|
@ -187,6 +187,10 @@ end
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- @function [parent=#modstore] handle_buttons
|
-- @function [parent=#modstore] handle_buttons
|
||||||
function modstore.handle_buttons(parent, fields, name, data)
|
function modstore.handle_buttons(parent, fields, name, data)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
|
|
||||||
if fields["btn_modstore_page_up"] then
|
if fields["btn_modstore_page_up"] then
|
||||||
if modstore.current_list ~= nil and modstore.current_list.page > 0 then
|
if modstore.current_list ~= nil and modstore.current_list.page > 0 then
|
||||||
|
@ -28,8 +28,8 @@ tab_credits = {
|
|||||||
"box[-100,-10;200,12;#999999]" ..
|
"box[-100,-10;200,12;#999999]" ..
|
||||||
|
|
||||||
"image_button[12,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_cancel;".. fgettext("OK") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
"image_button[12,9.55;4,0.8;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button.png;btn_cancel;".. fgettext("OK") .. ";true;true;"..core.formspec_escape(mm_texture.basetexturedir).."menu_button_b.png]"..
|
||||||
"label[3.5,9.75;Magichet 1.0 (based on FM " .. core.get_version() .. ")]" ..
|
"label[3.5,9.75;Multicraft (" .. core.get_version() .. ")]" ..
|
||||||
"image[0.25,9;2,2;"..core.formspec_escape(logofile).."]"..
|
-- "image[0.25,9;2,2;"..core.formspec_escape(logofile).."]"..
|
||||||
"textlist[0,2.0;15.8,6.25;list_credits;" ..
|
"textlist[0,2.0;15.8,6.25;list_credits;" ..
|
||||||
"#FFFF00" .. fgettext("Core Developers") .."," ..
|
"#FFFF00" .. fgettext("Core Developers") .."," ..
|
||||||
" Perttu Ahola (celeron55) <celeron55@gmail.com>,"..
|
" Perttu Ahola (celeron55) <celeron55@gmail.com>,"..
|
||||||
@ -48,7 +48,7 @@ tab_credits = {
|
|||||||
" paramat,"..
|
" paramat,"..
|
||||||
" ...,"..
|
" ...,"..
|
||||||
","..
|
","..
|
||||||
"#FFFF00" .. fgettext("Magichet Developers") .. "," ..
|
"#FFFF00" .. fgettext("Multicraft Developers") .. "," ..
|
||||||
" 4aiman Konsorumaniakku <4aiman@inbox.ru>,"..
|
" 4aiman Konsorumaniakku <4aiman@inbox.ru>,"..
|
||||||
" ...,"..
|
" ...,"..
|
||||||
"," ..
|
"," ..
|
||||||
@ -70,6 +70,10 @@ tab_credits = {
|
|||||||
";0;true]"
|
";0;true]"
|
||||||
end,
|
end,
|
||||||
cbf_button_handler = function(tabview, fields, name, tabdata)
|
cbf_button_handler = function(tabview, fields, name, tabdata)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
if fields["btn_cancel"] ~= nil then
|
if fields["btn_cancel"] ~= nil then
|
||||||
tabview:hide()
|
tabview:hide()
|
||||||
tabview.parent:show()
|
tabview.parent:show()
|
||||||
|
@ -111,6 +111,10 @@ end
|
|||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function handle_buttons(tabview, fields, tabname, tabdata)
|
local function handle_buttons(tabview, fields, tabname, tabdata)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
if fields["modlist"] ~= nil then
|
if fields["modlist"] ~= nil then
|
||||||
local event = core.explode_textlist_event(fields["modlist"])
|
local event = core.explode_textlist_event(fields["modlist"])
|
||||||
tabdata.selected_mod = event.index
|
tabdata.selected_mod = event.index
|
||||||
|
@ -118,6 +118,10 @@ end
|
|||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function main_button_handler(tabview, fields, name, tabdata)
|
local function main_button_handler(tabview, fields, name, tabdata)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
if not tabdata then tabdata = {} end
|
if not tabdata then tabdata = {} end
|
||||||
|
|
||||||
if fields["add_server"] ~= nil then
|
if fields["add_server"] ~= nil then
|
||||||
|
@ -77,6 +77,9 @@ end
|
|||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function main_button_handler(this, fields, name, tabdata)
|
local function main_button_handler(this, fields, name, tabdata)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
local world_doubleclick = false
|
local world_doubleclick = false
|
||||||
|
|
||||||
@ -114,7 +117,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
bool = 'true'
|
bool = 'true'
|
||||||
end
|
end
|
||||||
core.setting_set("enable_damage", bool)
|
core.setting_set("enable_damage", bool)
|
||||||
-- print(bool)
|
minetest.setting_save()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -81,6 +81,9 @@ local function dlg_confirm_reset_formspec(data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function dlg_confirm_reset_btnhandler(this, fields, dialogdata)
|
local function dlg_confirm_reset_btnhandler(this, fields, dialogdata)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
if fields["dlg_reset_singleplayer_confirm"] ~= nil then
|
if fields["dlg_reset_singleplayer_confirm"] ~= nil then
|
||||||
local worldlist = core.get_worlds()
|
local worldlist = core.get_worlds()
|
||||||
|
@ -34,8 +34,7 @@ local function singleplayer_refresh_gamebar()
|
|||||||
for key,value in pairs(fields) do
|
for key,value in pairs(fields) do
|
||||||
for j=1,#gamemgr.games,1 do
|
for j=1,#gamemgr.games,1 do
|
||||||
if ("game_btnbar_" .. gamemgr.games[j].id == key) then
|
if ("game_btnbar_" .. gamemgr.games[j].id == key) then
|
||||||
mm_texture.update("singleplayer", gamemgr.games[j])
|
-- mm_texture.update("singleplayer", gamemgr.games[j])
|
||||||
--core.set_topleft_text(gamemgr.games[j].name)
|
|
||||||
core.setting_set("menu_last_game",gamemgr.games[j].id)
|
core.setting_set("menu_last_game",gamemgr.games[j].id)
|
||||||
menudata.worldlist:set_filtercriteria(gamemgr.games[j].id)
|
menudata.worldlist:set_filtercriteria(gamemgr.games[j].id)
|
||||||
return true
|
return true
|
||||||
@ -124,6 +123,9 @@ local function get_formspec(tabview, name, tabdata)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function main_button_handler(this, fields, name, tabdata)
|
local function main_button_handler(this, fields, name, tabdata)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
--assert(name == "singleplayer")
|
--assert(name == "singleplayer")
|
||||||
|
|
||||||
@ -157,11 +159,20 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
|
|
||||||
if fields["cb_creative_mode"] then
|
if fields["cb_creative_mode"] then
|
||||||
core.setting_set("creative_mode", fields["cb_creative_mode"])
|
core.setting_set("creative_mode", fields["cb_creative_mode"])
|
||||||
|
local bool = fields["cb_creative_mode"]
|
||||||
|
if bool == 'true' then
|
||||||
|
bool = 'false'
|
||||||
|
else
|
||||||
|
bool = 'true'
|
||||||
|
end
|
||||||
|
core.setting_set("enable_damage", bool)
|
||||||
|
minetest.setting_save()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields["cb_enable_damage"] then
|
if fields["cb_enable_damage"] then
|
||||||
core.setting_set("enable_damage", fields["cb_enable_damage"])
|
core.setting_set("enable_damage", fields["cb_enable_damage"])
|
||||||
|
minetest.setting_save()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -169,7 +180,6 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
world_doubleclick or
|
world_doubleclick or
|
||||||
fields["key_enter"] then
|
fields["key_enter"] then
|
||||||
local selected = core.get_textlist_index("sp_worlds")
|
local selected = core.get_textlist_index("sp_worlds")
|
||||||
print(selected)
|
|
||||||
if selected ~= nil then
|
if selected ~= nil then
|
||||||
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
|
||||||
gamedata.singleplayer = true
|
gamedata.singleplayer = true
|
||||||
@ -184,7 +194,6 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
create_world_dlg:set_parent(this)
|
create_world_dlg:set_parent(this)
|
||||||
this:hide()
|
this:hide()
|
||||||
create_world_dlg:show()
|
create_world_dlg:show()
|
||||||
mm_texture.update("singleplayer",current_game())
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -201,7 +210,6 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
delete_world_dlg:set_parent(this)
|
delete_world_dlg:set_parent(this)
|
||||||
this:hide()
|
this:hide()
|
||||||
delete_world_dlg:show()
|
delete_world_dlg:show()
|
||||||
mm_texture.update("singleplayer",current_game())
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -219,7 +227,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
configdialog:set_parent(this)
|
configdialog:set_parent(this)
|
||||||
this:hide()
|
this:hide()
|
||||||
configdialog:show()
|
configdialog:show()
|
||||||
mm_texture.update("singleplayer",current_game())
|
--mm_texture.update("singleplayer",current_game())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -249,14 +257,14 @@ local function on_change(type, old_tab, new_tab)
|
|||||||
if game then
|
if game then
|
||||||
menudata.worldlist:set_filtercriteria(game.id)
|
menudata.worldlist:set_filtercriteria(game.id)
|
||||||
--core.set_topleft_text(game.name)
|
--core.set_topleft_text(game.name)
|
||||||
mm_texture.update("singleplayer",game)
|
-- mm_texture.update("singleplayer",game)
|
||||||
end
|
end
|
||||||
buttonbar:show()
|
buttonbar:show()
|
||||||
else
|
else
|
||||||
menudata.worldlist:set_filtercriteria(nil)
|
menudata.worldlist:set_filtercriteria(nil)
|
||||||
buttonbar:hide()
|
buttonbar:hide()
|
||||||
--core.set_topleft_text("")
|
--core.set_topleft_text("")
|
||||||
mm_texture.update(new_tab,nil)
|
--mm_texture.update(new_tab,nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -87,6 +87,10 @@ end
|
|||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function main_button_handler(tabview, fields, name, tabdata)
|
local function main_button_handler(tabview, fields, name, tabdata)
|
||||||
|
core.set_clouds(false)
|
||||||
|
core.set_background("background",core.formspec_escape(mm_texture.basetexturedir)..'background.png')
|
||||||
|
core.set_background("header",core.formspec_escape(mm_texture.basetexturedir)..'header.png')
|
||||||
|
|
||||||
if fields["TPs"] ~= nil then
|
if fields["TPs"] ~= nil then
|
||||||
local event = core.explode_textlist_event(fields["TPs"])
|
local event = core.explode_textlist_event(fields["TPs"])
|
||||||
if event.type == "CHG" or event.type == "DCL" then
|
if event.type == "CHG" or event.type == "DCL" then
|
||||||
|
@ -34,7 +34,6 @@ function mm_texture.update(tab,gamedetails)
|
|||||||
if gamedetails == nil then
|
if gamedetails == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
mm_texture.update_game(gamedetails)
|
mm_texture.update_game(gamedetails)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
-----------------------------
|
--------------------------------------------------
|
||||||
--- 4hunger mod by 4aiman ---
|
--- 4hunger mod by 4aiman - Multicraft version ---
|
||||||
-----------------------------
|
--------------------------------------------------
|
||||||
--- license: GPLv3 ---
|
--- CC BY-NC-SA ---
|
||||||
-----------------------------
|
--------------------------------------------------
|
||||||
|
|
||||||
----
|
----
|
||||||
---- Many thanks go to fairiestoy, who forced me to understand Lua a little bit more!
|
---- Many thanks go to fairiestoy, who forced me to understand Lua a little bit more!
|
||||||
@ -16,8 +16,6 @@
|
|||||||
-- This mod TRIES too copy MC hunger mechanics as described at wiki
|
-- This mod TRIES too copy MC hunger mechanics as described at wiki
|
||||||
-- here: http://minecraft.gamepedia.com/Hunger#Mechanics and FAILS to do do:
|
-- here: http://minecraft.gamepedia.com/Hunger#Mechanics and FAILS to do do:
|
||||||
-- several things aren't covered due to internal differences of MT and MC.
|
-- several things aren't covered due to internal differences of MT and MC.
|
||||||
-- Those are subject to get added by some other mod(s), creation of which
|
|
||||||
-- has began allready.
|
|
||||||
----
|
----
|
||||||
|
|
||||||
----
|
----
|
||||||
@ -25,6 +23,7 @@
|
|||||||
----
|
----
|
||||||
-- Since lua_api documentation sucks (it's of GREAT use nevertheless),
|
-- Since lua_api documentation sucks (it's of GREAT use nevertheless),
|
||||||
-- I got inspired AND "guided" by some other mods that this one:
|
-- I got inspired AND "guided" by some other mods that this one:
|
||||||
|
--
|
||||||
-- 1. "Farming" from the "Minitest" game by PilzAdam. What hunger if
|
-- 1. "Farming" from the "Minitest" game by PilzAdam. What hunger if
|
||||||
-- there's nothing to eat?
|
-- there's nothing to eat?
|
||||||
-- 2. "HUD & hunger". I make mistakes. Stupid ones too.
|
-- 2. "HUD & hunger". I make mistakes. Stupid ones too.
|
||||||
@ -34,7 +33,6 @@
|
|||||||
-- That was when I saw that his "hunger" do NOT depend on taken by a player
|
-- That was when I saw that his "hunger" do NOT depend on taken by a player
|
||||||
-- actions... That was a shame!
|
-- actions... That was a shame!
|
||||||
-- So, I got my lazy butt up and wrote this hunger mod.
|
-- So, I got my lazy butt up and wrote this hunger mod.
|
||||||
-- 3. The "Sprint" mod by I-don't-know-who. Very useful. (The old one.)
|
|
||||||
--
|
--
|
||||||
----
|
----
|
||||||
|
|
||||||
@ -63,10 +61,14 @@
|
|||||||
-- Update: ported for Multicraft
|
-- Update: ported for Multicraft
|
||||||
--
|
--
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Update: Merge upstream changes. (License change, food_saturation depletion fixes, respawn==reset hunger feature introduction)
|
||||||
|
--
|
||||||
|
|
||||||
max_save_time = 10
|
max_save_time = 10
|
||||||
save_time = 0
|
save_time = 0
|
||||||
max_drumsticks = 20
|
max_drumsticks = 20
|
||||||
foodTickTimerMAX = 10
|
foodTickTimerMAX = 5
|
||||||
max_exhaustion = 8
|
max_exhaustion = 8
|
||||||
foodTickTimerMax = {}
|
foodTickTimerMax = {}
|
||||||
food_level = {}
|
food_level = {}
|
||||||
@ -83,8 +85,6 @@ jumped = {}
|
|||||||
keypress_track = {}
|
keypress_track = {}
|
||||||
hungerhud = {}
|
hungerhud = {}
|
||||||
hungerhudb = {}
|
hungerhudb = {}
|
||||||
hearthud = {}
|
|
||||||
hearthudb = {}
|
|
||||||
need_to_update_ph = {}
|
need_to_update_ph = {}
|
||||||
|
|
||||||
|
|
||||||
@ -273,10 +273,8 @@ function multicraft.item_eat(food_points, saturation_points, replace_with_item)
|
|||||||
food_saturation[pll]=food_points
|
food_saturation[pll]=food_points
|
||||||
end
|
end
|
||||||
if poisoned then
|
if poisoned then
|
||||||
if poisoned==1 then state[pll] = 7 end
|
if poisoned==1 then state[pll].poison1 = true end
|
||||||
if poisoned==2 then state[pll] = 8 end
|
if poisoned==2 then state[pll].poison2 = true end
|
||||||
else
|
|
||||||
state[pll] = -1
|
|
||||||
end
|
end
|
||||||
itemstack:add_item(replace_with_item)
|
itemstack:add_item(replace_with_item)
|
||||||
end
|
end
|
||||||
@ -292,18 +290,25 @@ function distance(pos1,pos2)
|
|||||||
return math.sqrt( (pos1.x - pos2.x)^2 + (pos1.y - pos2.y)^2 + (pos1.z - pos2.z)^2 )
|
return math.sqrt( (pos1.x - pos2.x)^2 + (pos1.y - pos2.y)^2 + (pos1.z - pos2.z)^2 )
|
||||||
end
|
end
|
||||||
|
|
||||||
function init_hunger(player)
|
local damage_enabled = multicraft.setting_getbool("enable_damage")
|
||||||
|
|
||||||
|
function init_hunger(player, force)
|
||||||
if player then
|
if player then
|
||||||
local pll = player:get_player_name()
|
local pll = player:get_player_name()
|
||||||
if not foodTickTimerMax[pll] then foodTickTimerMax[pll]=foodTickTimerMAX end
|
if not foodTickTimerMax[pll] or force then foodTickTimerMax[pll]=foodTickTimerMAX end
|
||||||
if not food_level[pll] then food_level[pll] = max_drumsticks end
|
if not food_level[pll] or force then food_level[pll] = max_drumsticks end
|
||||||
if not death_timer[pll] then death_timer[pll] = 0 end
|
if not death_timer[pll] or force then death_timer[pll] = 0 end
|
||||||
if not food_saturation[pll] then food_saturation[pll]=food_level[pll] end
|
if not food_saturation[pll] or force then food_saturation[pll]=food_level[pll] end
|
||||||
if not timers[pll] then timers[pll] = -1 end
|
if not timers[pll] or force then timers[pll] = -1 end
|
||||||
if not keypress_track[pll] then keypress_track[pll] = {} end
|
if not keypress_track[pll] or force then keypress_track[pll] = {} end
|
||||||
|
if not state[pll] or type(state[pll])~="table" or force then state[pll] = {} end
|
||||||
|
|
||||||
multicraft.after(0, function()
|
if damage_enabled then
|
||||||
|
multicraft.after(0.5, function()
|
||||||
if not player then return end
|
if not player then return end
|
||||||
|
local hhf,hhb = player:hud_get(hungerhud[pll]), player:hud_get(hungerhudb[pll])
|
||||||
|
if hungerhud[pll] and hhf and hhf.text == "hud_hunger_fg.png" then print('remove FG') player:hud_remove(hungerhud[pll]) end
|
||||||
|
if hungerhudb[pll] and hhf and hhb.text == "hud_hunger_bg.png" then print('remove BG') player:hud_remove(hungerhudb[pll]) end
|
||||||
hungerhudb[pll]=player:hud_add({
|
hungerhudb[pll]=player:hud_add({
|
||||||
hud_elem_type = "statbar",
|
hud_elem_type = "statbar",
|
||||||
position = HUD_HUNGER_POS,
|
position = HUD_HUNGER_POS,
|
||||||
@ -322,19 +327,23 @@ function init_hunger(player)
|
|||||||
alignment = {x=-1,y=-1},
|
alignment = {x=-1,y=-1},
|
||||||
offset = HUD_HUNGER_OFFSET,
|
offset = HUD_HUNGER_OFFSET,
|
||||||
})
|
})
|
||||||
|
local hhf,hhb = player:hud_get(hungerhud[pll]), player:hud_get(hungerhudb[pll])
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
multicraft.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
init_hunger(player)
|
init_hunger(player)
|
||||||
|
local pll = player:get_player_name()
|
||||||
|
state[pll] = {}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function get_field(item,field)
|
local function get_field(item,field)
|
||||||
if multicraft.registered_nodes[item] then return multicraft.registered_nodes[item][field] end
|
if minetest.registered_nodes[item] then return minetest.registered_nodes[item][field] end
|
||||||
if multicraft.registered_items[item] then return multicraft.registered_items[item][field] end
|
if minetest.registered_items[item] then return minetest.registered_items[item][field] end
|
||||||
if multicraft.registered_craftitems[item] then return multicraft.registered_craftitems[item][field] end
|
if minetest.registered_craftitems[item] then return minetest.registered_craftitems[item][field] end
|
||||||
if multicraft.registered_tools[item] then return multicraft.registered_tools[item][field] end
|
if minetest.registered_tools[item] then return minetest.registered_tools[item][field] end
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -342,22 +351,25 @@ local function get_on_eat(item)
|
|||||||
return get_field(item,"on_eat")
|
return get_field(item,"on_eat")
|
||||||
end
|
end
|
||||||
|
|
||||||
multicraft.after(0, function(dtime)
|
if damage_enabled then
|
||||||
|
minetest.after(0, function(dtime)
|
||||||
local global_dtime = 0
|
local global_dtime = 0
|
||||||
local doit = false
|
local doit = false
|
||||||
multicraft.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
global_dtime = global_dtime + dtime
|
global_dtime = global_dtime + dtime
|
||||||
if global_dtime>1 then
|
if global_dtime>1 then
|
||||||
doit = true
|
doit = true
|
||||||
global_dtime = 0
|
global_dtime = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if save_time > max_save_time then
|
if save_time > max_save_time then
|
||||||
save_time=0
|
save_time=0
|
||||||
save_4hunger()
|
save_4hunger()
|
||||||
else
|
else
|
||||||
save_time=save_time+dtime
|
save_time=save_time+dtime
|
||||||
end
|
end
|
||||||
local players = multicraft.get_connected_players()
|
|
||||||
|
local players = minetest.get_connected_players()
|
||||||
for i,player in ipairs(players) do
|
for i,player in ipairs(players) do
|
||||||
local pll = player:get_player_name()
|
local pll = player:get_player_name()
|
||||||
local pos = player:getpos()
|
local pos = player:getpos()
|
||||||
@ -366,20 +378,21 @@ local doit = false
|
|||||||
local wstack = player:get_wielded_item():get_name()
|
local wstack = player:get_wielded_item():get_name()
|
||||||
local bar
|
local bar
|
||||||
local addex = 0
|
local addex = 0
|
||||||
|
|
||||||
if hp==1 and food_level[pll]<=0 and food_saturation[pll]<=0 then
|
if hp==1 and food_level[pll]<=0 and food_saturation[pll]<=0 then
|
||||||
death_timer[pll] = death_timer[pll] + dtime
|
death_timer[pll] = death_timer[pll] + dtime
|
||||||
end
|
end
|
||||||
if not food_level[pll] then init_hunger(player) end
|
|
||||||
if (death_timer[pll] or 0) > max_being_hungry_time then
|
if (death_timer[pll] or 0) > max_being_hungry_time then
|
||||||
death_timer[pll] = 0
|
death_timer[pll] = 0
|
||||||
multicraft.chat_send_all(death_message .. pll)
|
minetest.chat_send_all(death_message .. pll)
|
||||||
food_level[pll] = max_drumsticks
|
food_level[pll] = max_drumsticks
|
||||||
food_saturation[pll] = max_drumsticks
|
food_saturation[pll] = max_drumsticks
|
||||||
food_exhaustion[pll] = 0
|
food_exhaustion[pll] = 0
|
||||||
player:set_hp(0)
|
player:set_hp(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
if state[pll] == 7 or state[pll] == 8 then
|
if state[pll].poison1 or state[pll].poison2 then
|
||||||
if not timers[pll] then
|
if not timers[pll] then
|
||||||
timers[pll] = 15
|
timers[pll] = 15
|
||||||
player:hud_change(hungerhudb[pll],"text",'hunger_tile_d.png')
|
player:hud_change(hungerhudb[pll],"text",'hunger_tile_d.png')
|
||||||
@ -389,102 +402,131 @@ local doit = false
|
|||||||
hp=hp-1
|
hp=hp-1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if state == 7 then addex = addex + ef1
|
if state[pll].poison1 then addex = addex + ef1
|
||||||
elseif state == 8 then addex = addex + ef2 end
|
elseif state[pll].poison2 then addex = addex + ef2 end
|
||||||
end
|
end
|
||||||
|
|
||||||
if timers[pll] then
|
if timers[pll] then
|
||||||
timers[pll] = timers[pll] - dtime
|
timers[pll] = timers[pll] - dtime
|
||||||
if timers[pll]<0 then
|
if timers[pll]<0 then
|
||||||
timers[pll]=nil
|
timers[pll]=nil
|
||||||
player:hud_change(hungerhudb[pll],"text", "hud_hunger_bg.png")
|
local hhf,hhb = player:hud_get(hungerhud[pll]), player:hud_get(hungerhudb[pll])
|
||||||
player:hud_change(hungerhud[pll] ,"text", "hud_hunger_fg.png")
|
if hungerhud[pll] and hhf and hhf.text == "hud_hunger_fg.png" then
|
||||||
|
player:hud_change(hungerhud[pll] ,"text",'hud_hunger_fg.png')
|
||||||
|
end
|
||||||
|
if hungerhudb[pll] and hhf and hhb.text == "hud_hunger_bg.png" then
|
||||||
|
player:hud_change(hungerhudb[pll],"text",'hud_hunger_bg.png')
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if doit==true and hp>1 then
|
if doit==true and hp>10 then
|
||||||
player:set_hp(hp-1)
|
player:set_hp(hp-1)
|
||||||
hp=hp-1
|
hp=hp-1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local hp_diff = 0
|
local hp_diff = 0
|
||||||
if oldHPs[pll] and hp then
|
if oldHPs[pll] and hp then
|
||||||
hp_diff = oldHPs[pll]-hp
|
hp_diff = oldHPs[pll]-hp
|
||||||
end
|
end
|
||||||
|
|
||||||
if hp_diff~=0 then
|
if hp_diff~=0 then
|
||||||
state[pll] = 5
|
state[pll].hurt = true
|
||||||
addex = addex + edm
|
addex = addex + edm
|
||||||
player:hud_change(hearthud[pll],"number",hp)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
oldHPs[pll] = hp
|
oldHPs[pll] = hp
|
||||||
|
|
||||||
local dist = distance(oldpos[pll],pos)
|
local dist = distance(oldpos[pll],pos)
|
||||||
if not jumped[pll] then
|
oldpos[pll] = pos
|
||||||
local node = multicraft.get_node(pos)
|
|
||||||
|
local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||||
local name = node.name
|
local name = node.name
|
||||||
if name:find("air") then
|
|
||||||
if state[pll] == 1 then
|
if not jumped[pll] then
|
||||||
state[pll] = 6
|
if state[pll].jump then
|
||||||
addex = addex + esj
|
if not name:find("air") then
|
||||||
|
state[pll].jump = nil
|
||||||
|
end
|
||||||
else
|
else
|
||||||
state[pll] = 3
|
if name:find("air") then
|
||||||
|
state[pll].jump = true
|
||||||
|
jumped[pll] = true
|
||||||
addex = addex + ejp
|
addex = addex + ejp
|
||||||
end
|
end
|
||||||
jumped[pll] = true
|
|
||||||
else
|
|
||||||
if dist and dist>0 then
|
|
||||||
state[pll] = 0
|
|
||||||
else
|
|
||||||
state[pll] = -1
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
if not name:find("air") then
|
||||||
|
state[pll].jump = nil
|
||||||
jumped[pll] = false
|
jumped[pll] = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if dist and dist>0 then
|
||||||
|
state[pll].walk = true
|
||||||
|
end
|
||||||
|
|
||||||
pos.y=pos.y+1
|
pos.y=pos.y+1
|
||||||
local node = multicraft.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local name = node.name
|
local name = node.name
|
||||||
if multicraft.get_item_group(name, "water") ~= 0 then
|
if minetest.get_item_group(name, "water") ~= 0 then
|
||||||
state[pll] = 2
|
state[pll].swim = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if food_level[pll]<=0 then food_level[pll] = 0 end
|
if food_level[pll]<=0 then food_level[pll] = 0 end
|
||||||
if food_level[pll]==0 or (food_level[pll]>17 and food_level[pll]<=max_drumsticks)
|
|
||||||
then
|
if food_level[pll]==0 or (food_level[pll]>17 and food_level[pll]<=max_drumsticks) then
|
||||||
if foodTickTimer[pll]
|
if foodTickTimer[pll] then
|
||||||
then foodTickTimer[pll] = foodTickTimer[pll] + dtime
|
foodTickTimer[pll] = foodTickTimer[pll] + dtime
|
||||||
else foodTickTimer[pll] = dtime
|
else
|
||||||
|
foodTickTimer[pll] = dtime
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if foodTickTimer[pll]>foodTickTimerMax[pll] then
|
if foodTickTimer[pll]>foodTickTimerMax[pll] then
|
||||||
|
foodTickTimer[pll] = 0
|
||||||
if food_level[pll]>17 and food_level[pll]<=max_drumsticks then
|
if food_level[pll]>17 and food_level[pll]<=max_drumsticks then
|
||||||
if hp>0 then
|
if hp>0 then
|
||||||
player:set_hp(hp+1)
|
player:set_hp(hp+1)
|
||||||
end
|
end
|
||||||
elseif food_level[pll]==0 then
|
elseif food_level[pll]==0 then
|
||||||
if hp>1 then
|
if hp>10 then
|
||||||
player:set_hp(hp-1)
|
player:set_hp(hp-1)
|
||||||
hp = hp-1
|
hp = hp-1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
foodTickTimer[pll] = 0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if not walked_distance[pll] then walked_distance[pll] = 0 end
|
if not walked_distance[pll] then walked_distance[pll] = 0 end
|
||||||
|
|
||||||
oldpos[pll]=pos
|
oldpos[pll]=pos
|
||||||
walked_distance[pll] = walked_distance[pll] + dist
|
walked_distance[pll] = walked_distance[pll] + dist
|
||||||
if hp_diff<0 and hp>18 then state[pll]=10 end
|
|
||||||
|
|
||||||
if not state[pll] then state[pll]=-1 end
|
if hp_diff<0 and hp>18 then state[pll].regen = true end
|
||||||
if state[pll]==-1 then addex=addex+eid
|
local ccc = 0
|
||||||
elseif state[pll]==00 then addex=addex+ews*dist
|
for k,v in pairs(state[pll]) do
|
||||||
elseif state[pll]==01 then addex=addex+esp*dist
|
ccc = ccc + 1
|
||||||
elseif state[pll]==02 then addex=addex+esw*dist
|
|
||||||
elseif state[pll]==03 then addex=addex+ejp*dist
|
|
||||||
elseif state[pll]==06 then addex=addex+esj*dist
|
|
||||||
elseif state[pll]==09 then addex=addex+ebr
|
|
||||||
elseif state[pll]==10 then addex=addex+erg*-hp_diff
|
|
||||||
end
|
end
|
||||||
|
if ccc == 0 then
|
||||||
|
addex=addex+eid
|
||||||
|
else
|
||||||
|
if state[pll].walk then addex=addex+ews*dist end
|
||||||
|
if state[pll].swim then addex=addex+esw*0.1 end
|
||||||
|
if state[pll].jump then addex=addex+ejp end
|
||||||
|
if state[pll].hurt then addex=edm*hp_diff end
|
||||||
|
if state[pll].poison1 then addex=ef1*dist end
|
||||||
|
if state[pll].poison2 then addex=ef2*dist end
|
||||||
|
if state[pll].dig then addex=addex+ebr end
|
||||||
|
if state[pll].regen then addex=addex+erg*-hp_diff end
|
||||||
|
end
|
||||||
|
|
||||||
|
state[pll] = {}
|
||||||
if food_exhaustion[pll] then
|
if food_exhaustion[pll] then
|
||||||
food_exhaustion[pll]=food_exhaustion[pll]+addex
|
food_exhaustion[pll]=food_exhaustion[pll]+addex
|
||||||
else
|
else
|
||||||
food_exhaustion[pll]=addex
|
food_exhaustion[pll]=addex
|
||||||
end
|
end
|
||||||
|
|
||||||
if food_exhaustion[pll]>max_exhaustion then
|
if food_exhaustion[pll]>max_exhaustion then
|
||||||
if food_saturation[pll] then
|
if food_saturation[pll] then
|
||||||
food_saturation[pll] = food_saturation[pll]-1
|
food_saturation[pll] = food_saturation[pll]-1
|
||||||
@ -496,6 +538,7 @@ local doit = false
|
|||||||
if food_level[pll]<0 then food_level[pll]=0 end
|
if food_level[pll]<0 then food_level[pll]=0 end
|
||||||
food_exhaustion[pll] = 0
|
food_exhaustion[pll] = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if hungerhud[pll] and food_level[pll] then
|
if hungerhud[pll] and food_level[pll] then
|
||||||
player:hud_change(hungerhud[pll],"number",food_level[pll])
|
player:hud_change(hungerhud[pll],"number",food_level[pll])
|
||||||
end
|
end
|
||||||
@ -503,12 +546,12 @@ local doit = false
|
|||||||
doit = false
|
doit = false
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_dignode(function(pos, oldnode, digger)
|
||||||
multicraft.register_on_dignode(function(pos, oldnode, digger)
|
|
||||||
if not digger then return end
|
if not digger then return end
|
||||||
local pll = digger:get_player_name()
|
local pll = digger:get_player_name()
|
||||||
state[pll]=9
|
state[pll].dig = true
|
||||||
if food_exhaustion[pll] then
|
if food_exhaustion[pll] then
|
||||||
food_exhaustion[pll]=food_exhaustion[pll]+ebr
|
food_exhaustion[pll]=food_exhaustion[pll]+ebr
|
||||||
else
|
else
|
||||||
@ -516,21 +559,26 @@ multicraft.register_on_dignode(function(pos, oldnode, digger)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
multicraft.after(0,function(dtime)
|
minetest.after(0,function(dtime)
|
||||||
for cou,def in pairs(multicraft.registered_items) do
|
for cou,def in pairs(minetest.registered_items) do
|
||||||
if get_points(def['name']) ~= false then
|
if get_points(def['name']) ~= false then
|
||||||
def['on_use'] = multicraft.item_eat(1)
|
def['on_use'] = minetest.item_eat(1)
|
||||||
multicraft.register_item(':' .. def.name, def)
|
minetest.register_item(':' .. def.name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end )
|
end )
|
||||||
|
|
||||||
multicraft.register_chatcommand("hunger", {
|
minetest.register_chatcommand("hunger", {
|
||||||
|
privs = {server = true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
food_level[name] = 0
|
food_level[name] = 0
|
||||||
food_saturation[name] = 0
|
food_saturation[name] = 0
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_on_respawnplayer(function(player)
|
||||||
|
init_hunger(player, true)
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
print('[OK] 4hunger (Multicraft version) loaded')
|
print('[OK] 4hunger (Multicraft version) loaded')
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
if not multicraft.get_modpath("check") then os.exit() end
|
if not multicraft.get_modpath("check") then os.exit() end
|
||||||
if not multicraft.get_modpath("check") then os.exit() end
|
|
||||||
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
||||||
-------------------------
|
-----------------------------------------------
|
||||||
-- adbs mod by 4aiman --
|
--- adbs mod by 4aiman - Multicraft version ---
|
||||||
-------------------------
|
-----------------------------------------------
|
||||||
-- (Multicraft port) --
|
--- CC BY-NC-SA ---
|
||||||
-------------------------
|
-----------------------------------------------
|
||||||
-- --
|
|
||||||
-- Licence:GPLv3 --
|
|
||||||
-- --
|
|
||||||
-------------------------
|
|
||||||
|
|
||||||
|
--Update: Merged upstream changes. (License change, less "jumpy" mobs)
|
||||||
|
|
||||||
|
|
||||||
math.randomseed(os.time())
|
math.randomseed(os.time())
|
||||||
@ -496,12 +492,15 @@ adbs.dd = {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local yaw = self.object:getyaw()
|
local yaw = self.object:getyaw() -- jump, if there's something that can be juped on
|
||||||
local x = -math.sin(yaw)
|
local x = -math.sin(yaw)
|
||||||
local z = math.cos(yaw)
|
local z = math.cos(yaw)
|
||||||
local nm = multicraft.get_node(posf).name
|
local nm = minetest.get_node({x = posf.x+x,y = posf.y+1,z = posf.z+z}).name
|
||||||
if multicraft.registered_nodes[nm]
|
local nm2 = minetest.get_node({x = posf.x+x,y = posf.y+2,z = posf.z+z}).name
|
||||||
and multicraft.registered_nodes[nm].walkable
|
if minetest.registered_nodes[nm]
|
||||||
|
and minetest.registered_nodes[nm].walkable
|
||||||
|
and minetest.registered_nodes[nm2]
|
||||||
|
and not minetest.registered_nodes[nm2].walkable
|
||||||
then
|
then
|
||||||
self:jump()
|
self:jump()
|
||||||
end
|
end
|
||||||
|
@ -26,7 +26,15 @@ multicraft.register_alias("mapgen_stone_with_coal", "default:stone_with_coal")
|
|||||||
multicraft.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
|
multicraft.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
|
||||||
multicraft.register_alias("mapgen_desert_sand", "default:sand")
|
multicraft.register_alias("mapgen_desert_sand", "default:sand")
|
||||||
multicraft.register_alias("mapgen_desert_stone", "default:sandstone")
|
multicraft.register_alias("mapgen_desert_stone", "default:sandstone")
|
||||||
|
multicraft.register_alias("mapgen_dirt_with_snow", "default:dirt_with_snow")
|
||||||
|
multicraft.register_alias("mapgen_snowblock", "default:snowblock")
|
||||||
|
multicraft.register_alias("mapgen_snow", "default:snow")
|
||||||
|
multicraft.register_alias("mapgen_ice", "default:ice")
|
||||||
|
multicraft.register_alias("mapgen_jungletree", "default:jungletree")
|
||||||
|
multicraft.register_alias("mapgen_jungleleaves", "default:jungleleaves")
|
||||||
|
multicraft.register_alias("mapgen_junglegrass", "default:junglegrass")
|
||||||
|
multicraft.register_alias("mapgen_pinetree", "default:pinetree")
|
||||||
|
multicraft.register_alias("mapgen_pine_needles", "default:pine_needles")
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Ore generation
|
-- Ore generation
|
||||||
@ -490,41 +498,21 @@ multicraft.register_on_generated(function(minp, maxp, seed)
|
|||||||
local p = {x=x,y=ground_y,z=z}
|
local p = {x=x,y=ground_y,z=z}
|
||||||
-- Check if the node can be replaced
|
-- Check if the node can be replaced
|
||||||
if #(multicraft.find_nodes_in_area({x=x-5,y=ground_y-2,z=z-5}, {x=x+5,y=ground_y+2,z=z+5}, {"group:grass", "group:flower"}))>7 then
|
if #(multicraft.find_nodes_in_area({x=x-5,y=ground_y-2,z=z-5}, {x=x+5,y=ground_y+2,z=z+5}, {"group:grass", "group:flower"}))>7 then
|
||||||
for i=1,pr:next(1,4) do
|
|
||||||
local ground_y = nil
|
|
||||||
for y=30,0,-1 do
|
|
||||||
if multicraft.get_node({x=x,y=y,z=z}).name ~= "air"
|
|
||||||
and not multicraft.get_node({x=x,y=y,z=z}).name:find("water") then
|
|
||||||
ground_y = y
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local fruit = {"farming:pumpkin_face", "farming:melon", "farming:carrot", "farming:potato"}
|
local fruit = {"farming:pumpkin_face", "farming:melon", "farming:carrot", "farming:potato"}
|
||||||
local choice = fruit[pr:next(1,#fruit)]
|
local choice = fruit[pr:next(1,#fruit)]
|
||||||
--print(choice)
|
|
||||||
|
|
||||||
if pr:next() < 2500 then -- the "proper" alternative
|
if pr:next() < 2500 then -- the "proper" alternative
|
||||||
for i = 1, pr:next(1,3) do
|
|
||||||
local xx = pr:next(1,i+1)
|
local xx = pr:next(1,i+1)
|
||||||
local zz = pr:next(1,i+1)
|
local zz = pr:next(1,i+1)
|
||||||
local nname = multicraft.get_node({x=p.x+xx,z=p.z+zz,y=ground_y}).name
|
local nname = multicraft.get_node({x=p.x+xx,z=p.z+zz,y=ground_y}).name
|
||||||
if nname ~="air"
|
if nname ~="air"
|
||||||
and (multicraft.registered_nodes[nname] and not multicraft.registered_nodes[nname].buildable_to)
|
and (multicraft.registered_nodes[nname] and not multicraft.registered_nodes[nname].buildable_to)
|
||||||
then
|
then
|
||||||
|
|
||||||
multicraft.set_node({x=p.x+xx,z=p.z+zz,y=ground_y+1},{name=choice})
|
multicraft.set_node({x=p.x+xx,z=p.z+zz,y=ground_y+1},{name=choice})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3,6 +3,73 @@
|
|||||||
--
|
--
|
||||||
-- Node definitions
|
-- Node definitions
|
||||||
--
|
--
|
||||||
|
multicraft.register_node("default:dirt_with_snow", {
|
||||||
|
description = "Dirt with Snow",
|
||||||
|
tiles = {"default_snow.png", "default_dirt.png", "default_dirt.png^default_snow_side.png"},
|
||||||
|
groups = {crumbly=3,soil=1},
|
||||||
|
drop = 'default:dirt',
|
||||||
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
multicraft.register_node("default:snow", {
|
||||||
|
description = "Snow",
|
||||||
|
tiles = {"default_snow.png"},
|
||||||
|
inventory_image = "default_snowball.png",
|
||||||
|
wield_image = "default_snowball.png",
|
||||||
|
paramtype = "light",
|
||||||
|
buildable_to = true,
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, -0.5+2/16, 0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
groups = {crumbly=3,falling_node=1},
|
||||||
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
|
|
||||||
|
on_construct = function(pos)
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
if multicraft.get_node(pos).name == "default:dirt_with_grass" then
|
||||||
|
multicraft.set_node(pos, {name="default:dirt_with_snow"})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
multicraft.register_node("default:snowblock", {
|
||||||
|
description = "Snow Block",
|
||||||
|
tiles = {"default_snow.png"},
|
||||||
|
groups = {crumbly=3},
|
||||||
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
multicraft.register_node("default:ice", {
|
||||||
|
description = "Ice",
|
||||||
|
tiles = {"default_ice.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {cracky=3},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
multicraft.register_node("default:pinetree", {
|
||||||
|
description = "Pine Tree",
|
||||||
|
tiles = {"default_pinetree_top.png", "default_pinetree_top.png", "default_pinetree.png"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
multicraft.register_node("default:pine_needles",{
|
||||||
|
description = "Pine Needles",
|
||||||
|
drawtype = "allfaces_optional",
|
||||||
|
visual_scale = 1.3,
|
||||||
|
tiles = {"default_pine_needles.png"},
|
||||||
|
waving = 1,
|
||||||
|
paramtype = "light",
|
||||||
|
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
multicraft.register_node("default:stone", {
|
multicraft.register_node("default:stone", {
|
||||||
description = "Stone",
|
description = "Stone",
|
||||||
|
After Width: | Height: | Size: 203 B |
After Width: | Height: | Size: 280 B |
After Width: | Height: | Size: 574 B |
@ -183,7 +183,6 @@ local function add_hud_item(player, name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
multicraft.register_on_joinplayer(function(player)
|
multicraft.register_on_joinplayer(function(player)
|
||||||
|
|
||||||
-- first: hide the default statbars
|
-- first: hide the default statbars
|
||||||
local hud_flags = player:hud_get_flags()
|
local hud_flags = player:hud_get_flags()
|
||||||
hud_flags.healthbar = false
|
hud_flags.healthbar = false
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
HUD_IW_MAX = 8
|
HUD_IW_MAX = 8
|
||||||
HUD_IW_TICK = 0.4
|
HUD_IW_TICK = 0.4
|
||||||
if multicraft.is_singleplayer() == true then
|
if multicraft.is_singleplayer() == true then
|
||||||
HUD_IW_TICK = 0.2
|
HUD_IW_TICK = 0.1
|
||||||
end
|
end
|
||||||
|
|
||||||
HUD_SB_SIZE = {x = 24, y = 24}
|
HUD_SB_SIZE = {x = 24, y = 24}
|
||||||
@ -50,6 +50,7 @@ if damage_enabled then
|
|||||||
text = "hud_heart_fg.png",
|
text = "hud_heart_fg.png",
|
||||||
number = 20,
|
number = 20,
|
||||||
alignment = {x = -1, y = -1},
|
alignment = {x = -1, y = -1},
|
||||||
|
autohide_bg = false,
|
||||||
offset = HUD_HEALTH_OFFSET,
|
offset = HUD_HEALTH_OFFSET,
|
||||||
background = "hud_heart_bg.png",
|
background = "hud_heart_bg.png",
|
||||||
events = {
|
events = {
|
||||||
@ -97,7 +98,6 @@ if damage_enabled then
|
|||||||
autohide_bg = false,
|
autohide_bg = false,
|
||||||
max = 20,
|
max = 20,
|
||||||
})
|
})
|
||||||
|
|
||||||
else
|
else
|
||||||
hud.show_armor = false
|
hud.show_armor = false
|
||||||
end
|
end
|
||||||
|
@ -3104,7 +3104,7 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash)
|
|||||||
show_deathscreen(¤t_formspec, client, gamedef, texture_src,
|
show_deathscreen(¤t_formspec, client, gamedef, texture_src,
|
||||||
device, client);
|
device, client);
|
||||||
|
|
||||||
chat_backend->addMessage(L"", L"You died.");
|
// chat_backend->addMessage(L"", L"You died.");
|
||||||
|
|
||||||
/* Handle visualization */
|
/* Handle visualization */
|
||||||
*damage_flash = 0;
|
*damage_flash = 0;
|
||||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 47 KiB |