diff --git a/builtin/mainmenu/dlg_add_server.lua b/builtin/mainmenu/dlg_add_server.lua index 2341ec6af..fa71489a7 100644 --- a/builtin/mainmenu/dlg_add_server.lua +++ b/builtin/mainmenu/dlg_add_server.lua @@ -42,6 +42,9 @@ local function add_server_formspec(dialogdata) end 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 this:delete() diff --git a/builtin/mainmenu/dlg_config_world.lua b/builtin/mainmenu/dlg_config_world.lua index 8e1da1f67..031b79359 100644 --- a/builtin/mainmenu/dlg_config_world.lua +++ b/builtin/mainmenu/dlg_config_world.lua @@ -119,6 +119,9 @@ end 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 local event = core.explode_textlist_event(fields["world_config_modlist"]) diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 340a28c5a..3d5906c4c 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -83,6 +83,9 @@ local function create_world_formspec(dialogdata) end 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 this:delete() diff --git a/builtin/mainmenu/dlg_delete_mod.lua b/builtin/mainmenu/dlg_delete_mod.lua index 985272ab3..516662e55 100644 --- a/builtin/mainmenu/dlg_delete_mod.lua +++ b/builtin/mainmenu/dlg_delete_mod.lua @@ -35,6 +35,10 @@ end -------------------------------------------------------------------------------- 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 this.data.mod.path ~= nil and diff --git a/builtin/mainmenu/dlg_delete_world.lua b/builtin/mainmenu/dlg_delete_world.lua index 3f92f95f2..f2a6e476b 100644 --- a/builtin/mainmenu/dlg_delete_world.lua +++ b/builtin/mainmenu/dlg_delete_world.lua @@ -31,22 +31,23 @@ local function delete_world_formspec(dialogdata) end 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 this.data.delete_index > 0 and - this.data.delete_index <= #menudata.worldlist:get_raw_list() then - core.delete_world(this.data.delete_index) - menudata.worldlist:refresh() - end - this:delete() - return true + if this.data.delete_index > 0 and + this.data.delete_index <= #menudata.worldlist:get_raw_list() then + core.delete_world(this.data.delete_index) + menudata.worldlist:refresh() + end + this:delete() + return true end if fields["world_delete_cancel"] then - this:delete() - return true + this:delete() + return true end - return false end diff --git a/builtin/mainmenu/dlg_rename_modpack.lua b/builtin/mainmenu/dlg_rename_modpack.lua index 23b237f32..86c4b52c6 100644 --- a/builtin/mainmenu/dlg_rename_modpack.lua +++ b/builtin/mainmenu/dlg_rename_modpack.lua @@ -37,6 +37,10 @@ end -------------------------------------------------------------------------------- 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 local oldpath = core.get_modpath() .. DIR_DELIM .. this.data.mod.name local targetpath = core.get_modpath() .. DIR_DELIM .. fields["te_modpack_name"] diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua index e8114467f..4b0315156 100644 --- a/builtin/mainmenu/init.lua +++ b/builtin/mainmenu/init.lua @@ -79,6 +79,10 @@ end -------------------------------------------------------------------------------- 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 = '' if fields["btn_show_singleplayer"] then index = "singleplayer" end if fields["btn_show_multiplayer"] then index = "multiplayer" end diff --git a/builtin/mainmenu/modstore.lua b/builtin/mainmenu/modstore.lua index 391b5806e..8dceda231 100644 --- a/builtin/mainmenu/modstore.lua +++ b/builtin/mainmenu/modstore.lua @@ -35,7 +35,7 @@ function modstore.init() modstore.lastmodtitle = "" modstore.last_search = "" - + modstore.searchlist = filterlist.create( function() if modstore.modlist_unsorted ~= nil and @@ -57,18 +57,18 @@ function modstore.init() return false end substring = substring:upper() - + if element.title ~= nil and element.title:upper():find(substring) ~= nil then return true end - + if element.details ~= nil and element.details.author ~= nil and element.details.author:upper():find(substring) ~= nil then return true end - + if element.details ~= nil and element.details.description ~= nil and element.details.description:upper():find(substring) ~= nil then @@ -102,15 +102,15 @@ function modstore.getsuccessfuldialog() if modstore.lastmodentry ~= nil then retval = retval .. "label[0,0.25;" .. fgettext("Successfully installed:") .. "]" retval = retval .. "label[3,0.25;" .. modstore.lastmodentry.moddetails.title .. "]" - - + + retval = retval .. "label[0,0.75;" .. fgettext("Shortname:") .. "]" retval = retval .. "label[3,0.75;" .. core.formspec_escape(modstore.lastmodentry.moddetails.basename) .. "]" end retval = retval .. "button[2.5,1.5;1,0.5;btn_confirm_mod_successfull;" .. fgettext("ok") .. "]" - - + + return retval end @@ -165,6 +165,10 @@ end -------------------------------------------------------------------------------- -- @function [parent=#modstore] handle_buttons 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 local index = tonumber(fields["modstore_tab"]) @@ -182,14 +186,14 @@ function modstore.handle_buttons(current_tab,fields) data = filterlist.get_list(modstore.searchlist), } end - + return { current_tab = modstore.tabnames[index], is_dialog = true, show_buttons = false } end - + end if fields["btn_modstore_page_up"] then @@ -244,8 +248,8 @@ function modstore.handle_buttons(current_tab,fields) data = filterlist.get_list(modstore.searchlist), } end - - + + if fields["btn_modstore_close"] then return { is_dialog = false, @@ -253,7 +257,7 @@ function modstore.handle_buttons(current_tab,fields) current_tab = core.setting_get("main_menu_tab") } end - + for key,value in pairs(fields) do local foundat = key:find("btn_install_mod_") if ( foundat == 1) then @@ -265,15 +269,15 @@ function modstore.handle_buttons(current_tab,fields) if modstore.lastmodtitle ~= "" then modstore.lastmodtitle = modstore.lastmodtitle .. ", " end - + modstore.lastmodtitle = modstore.lastmodtitle .. moddetails.title - + core.handle_async( function(param) - + local fullurl = core.setting_get("modstore_download_url") .. param.moddetails.download_url - + if param.version ~= nil then local found = false for i=1,#param.moddetails.versions, 1 do @@ -283,7 +287,7 @@ function modstore.handle_buttons(current_tab,fields) found = true end end - + if not found then return { moddetails = param.moddetails, @@ -291,7 +295,7 @@ function modstore.handle_buttons(current_tab,fields) } end end - + if core.download_file(fullurl,param.filename) then return { texturename = param.texturename, @@ -319,7 +323,7 @@ function modstore.handle_buttons(current_tab,fields) else gamedata.errormessage = "Failed to download " .. result.moddetails.title end - + if gamedata.errormessage == nil then core.button_handler({btn_hidden_close_download=result}) else @@ -327,7 +331,7 @@ function modstore.handle_buttons(current_tab,fields) end end ) - + return { current_tab = "modstore_downloading", is_dialog = true, @@ -410,25 +414,25 @@ function modstore.getscreenshot(ypos,listentry) if listentry.details ~= nil and (listentry.details.screenshot_url == nil or listentry.details.screenshot_url == "") then - + if listentry.texturename == nil then listentry.texturename = modstore.basetexturedir .. "no_screenshot.png" end - + return "image[0,".. ypos .. ";3,2;" .. core.formspec_escape(listentry.texturename) .. "]" end - + if listentry.details ~= nil and listentry.texturename == nil then --make sure we don't download multiple times listentry.texturename = "in progress" - + --prepare url and filename local fullurl = core.setting_get("modstore_download_url") .. listentry.details.screenshot_url local filename = os.tempfolder() .. "_MID_" .. listentry.id - + --trigger download core.handle_async( --first param is downloadfct @@ -468,7 +472,7 @@ function modstore.getscreenshot(ypos,listentry) return "image[0,".. ypos .. ";3,2;" .. core.formspec_escape(listentry.texturename) .. "]" end - + return "" end @@ -476,7 +480,7 @@ end --@function [parent=#modstore] getshortmodinfo function modstore.getshortmodinfo(ypos,listentry,details) local retval = "" - + retval = retval .. "box[0," .. ypos .. ";11.4,1.75;#FFFFFF]" --screenshot @@ -490,13 +494,13 @@ function modstore.getshortmodinfo(ypos,listentry,details) local descriptiony = ypos + 0.5 retval = retval .. "textarea[3," .. descriptiony .. ";6.5,1.55;;" .. core.formspec_escape(details.description) .. ";]" - + --rating local ratingy = ypos retval = retval .."label[7," .. ratingy .. ";" .. fgettext("Rating") .. ":]" retval = retval .. "label[8.7," .. ratingy .. ";" .. details.rating .."]" - + --versions (IMPORTANT has to be defined AFTER rating) if details.versions ~= nil and #details.versions > 1 then @@ -507,7 +511,7 @@ function modstore.getshortmodinfo(ypos,listentry,details) if versions ~= "" then versions = versions .. "," end - + versions = versions .. details.versions[i].date:sub(1,10) end retval = retval .. versions .. ";1]" @@ -524,7 +528,7 @@ function modstore.getshortmodinfo(ypos,listentry,details) retval = retval .. fgettext("Install") .."]" end end - + return retval end @@ -533,11 +537,11 @@ end function modstore.getmodlist(list,yoffset) modstore.current_list = list - + if #list.data == 0 then return "" end - + if yoffset == nil then yoffset = 0 end @@ -578,13 +582,13 @@ function modstore.getmodlist(list,yoffset) if details ~= nil then local screenshot_ypos = yoffset +(i-1 - (list.page * modstore.modsperpage))*1.9 +0.2 - + retval = retval .. modstore.getshortmodinfo(screenshot_ypos, list.data[i], details) end end - + return retval .. scrollbar end @@ -593,7 +597,7 @@ end function modstore.getsearchpage() local retval = "" local search = "" - + if modstore.last_search ~= nil then search = modstore.last_search end @@ -602,7 +606,7 @@ function modstore.getsearchpage() "button[9.5,0.2;2.5,0.5;btn_modstore_search;".. fgettext("Search") .. "]" .. "field[0.5,0.5;9,0.5;te_modstore_search;;" .. search .. "]" - + --show 4 mods only modstore.modsperpage = 4 retval = retval .. diff --git a/builtin/mainmenu/store.lua b/builtin/mainmenu/store.lua index 88489629d..e98d5fb59 100644 --- a/builtin/mainmenu/store.lua +++ b/builtin/mainmenu/store.lua @@ -187,6 +187,10 @@ end -------------------------------------------------------------------------------- -- @function [parent=#modstore] handle_buttons 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 modstore.current_list ~= nil and modstore.current_list.page > 0 then diff --git a/builtin/mainmenu/tab_credits.lua b/builtin/mainmenu/tab_credits.lua index 5bb63b727..65780d66c 100644 --- a/builtin/mainmenu/tab_credits.lua +++ b/builtin/mainmenu/tab_credits.lua @@ -28,8 +28,8 @@ tab_credits = { "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]".. - "label[3.5,9.75;Magichet 1.0 (based on FM " .. core.get_version() .. ")]" .. - "image[0.25,9;2,2;"..core.formspec_escape(logofile).."]".. + "label[3.5,9.75;Multicraft (" .. core.get_version() .. ")]" .. + -- "image[0.25,9;2,2;"..core.formspec_escape(logofile).."]".. "textlist[0,2.0;15.8,6.25;list_credits;" .. "#FFFF00" .. fgettext("Core Developers") .."," .. " Perttu Ahola (celeron55) ,".. @@ -48,7 +48,7 @@ tab_credits = { " paramat,".. " ...,".. ",".. - "#FFFF00" .. fgettext("Magichet Developers") .. "," .. + "#FFFF00" .. fgettext("Multicraft Developers") .. "," .. " 4aiman Konsorumaniakku <4aiman@inbox.ru>,".. " ...,".. "," .. @@ -70,6 +70,10 @@ tab_credits = { ";0;true]" end, 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 tabview:hide() tabview.parent:show() diff --git a/builtin/mainmenu/tab_mods.lua b/builtin/mainmenu/tab_mods.lua index 63b32ebba..8d01a4c2f 100644 --- a/builtin/mainmenu/tab_mods.lua +++ b/builtin/mainmenu/tab_mods.lua @@ -111,6 +111,10 @@ end -------------------------------------------------------------------------------- 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 local event = core.explode_textlist_event(fields["modlist"]) tabdata.selected_mod = event.index diff --git a/builtin/mainmenu/tab_multiplayer.lua b/builtin/mainmenu/tab_multiplayer.lua index c6cd25e53..37eb9346e 100644 --- a/builtin/mainmenu/tab_multiplayer.lua +++ b/builtin/mainmenu/tab_multiplayer.lua @@ -118,6 +118,10 @@ end -------------------------------------------------------------------------------- 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 fields["add_server"] ~= nil then diff --git a/builtin/mainmenu/tab_server.lua b/builtin/mainmenu/tab_server.lua index 324a45302..42529997f 100644 --- a/builtin/mainmenu/tab_server.lua +++ b/builtin/mainmenu/tab_server.lua @@ -77,6 +77,9 @@ end -------------------------------------------------------------------------------- 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 @@ -114,7 +117,7 @@ local function main_button_handler(this, fields, name, tabdata) bool = 'true' end core.setting_set("enable_damage", bool) --- print(bool) + minetest.setting_save() return true end diff --git a/builtin/mainmenu/tab_settings.lua b/builtin/mainmenu/tab_settings.lua index 50bf2d353..08d998568 100644 --- a/builtin/mainmenu/tab_settings.lua +++ b/builtin/mainmenu/tab_settings.lua @@ -81,6 +81,9 @@ local function dlg_confirm_reset_formspec(data) end 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 local worldlist = core.get_worlds() diff --git a/builtin/mainmenu/tab_singleplayer.lua b/builtin/mainmenu/tab_singleplayer.lua index a949575e4..ddcf1ebef 100644 --- a/builtin/mainmenu/tab_singleplayer.lua +++ b/builtin/mainmenu/tab_singleplayer.lua @@ -34,8 +34,7 @@ local function singleplayer_refresh_gamebar() for key,value in pairs(fields) do for j=1,#gamemgr.games,1 do if ("game_btnbar_" .. gamemgr.games[j].id == key) then - mm_texture.update("singleplayer", gamemgr.games[j]) - --core.set_topleft_text(gamemgr.games[j].name) +-- mm_texture.update("singleplayer", gamemgr.games[j]) core.setting_set("menu_last_game",gamemgr.games[j].id) menudata.worldlist:set_filtercriteria(gamemgr.games[j].id) return true @@ -124,6 +123,9 @@ local function get_formspec(tabview, name, tabdata) end 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") @@ -155,13 +157,22 @@ local function main_button_handler(this, fields, name, tabdata) return true end - if fields["cb_creative_mode"] then - core.setting_set("creative_mode", fields["cb_creative_mode"]) - return true - end + if fields["cb_creative_mode"] then + 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 + end if fields["cb_enable_damage"] then core.setting_set("enable_damage", fields["cb_enable_damage"]) + minetest.setting_save() return true end @@ -169,7 +180,6 @@ local function main_button_handler(this, fields, name, tabdata) world_doubleclick or fields["key_enter"] then local selected = core.get_textlist_index("sp_worlds") - print(selected) if selected ~= nil then gamedata.selected_world = menudata.worldlist:get_raw_index(selected) gamedata.singleplayer = true @@ -184,7 +194,6 @@ local function main_button_handler(this, fields, name, tabdata) create_world_dlg:set_parent(this) this:hide() create_world_dlg:show() - mm_texture.update("singleplayer",current_game()) return true end @@ -201,7 +210,6 @@ local function main_button_handler(this, fields, name, tabdata) delete_world_dlg:set_parent(this) this:hide() delete_world_dlg:show() - mm_texture.update("singleplayer",current_game()) end end @@ -219,7 +227,7 @@ local function main_button_handler(this, fields, name, tabdata) configdialog:set_parent(this) this:hide() configdialog:show() - mm_texture.update("singleplayer",current_game()) + --mm_texture.update("singleplayer",current_game()) end end @@ -249,14 +257,14 @@ local function on_change(type, old_tab, new_tab) if game then menudata.worldlist:set_filtercriteria(game.id) --core.set_topleft_text(game.name) - mm_texture.update("singleplayer",game) +-- mm_texture.update("singleplayer",game) end buttonbar:show() else menudata.worldlist:set_filtercriteria(nil) buttonbar:hide() --core.set_topleft_text("") - mm_texture.update(new_tab,nil) + --mm_texture.update(new_tab,nil) end end diff --git a/builtin/mainmenu/tab_texturepacks.lua b/builtin/mainmenu/tab_texturepacks.lua index 55f4f710e..2126b6d69 100644 --- a/builtin/mainmenu/tab_texturepacks.lua +++ b/builtin/mainmenu/tab_texturepacks.lua @@ -87,6 +87,10 @@ end -------------------------------------------------------------------------------- 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 local event = core.explode_textlist_event(fields["TPs"]) if event.type == "CHG" or event.type == "DCL" then diff --git a/builtin/mainmenu/textures.lua b/builtin/mainmenu/textures.lua index 4ecc36430..dccf2f3db 100644 --- a/builtin/mainmenu/textures.lua +++ b/builtin/mainmenu/textures.lua @@ -34,7 +34,6 @@ function mm_texture.update(tab,gamedetails) if gamedetails == nil then return end - mm_texture.update_game(gamedetails) end diff --git a/games/MultiCraft_game/files/4hunger/init.lua b/games/MultiCraft_game/files/4hunger/init.lua index d08e584d7..011411515 100644 --- a/games/MultiCraft_game/files/4hunger/init.lua +++ b/games/MultiCraft_game/files/4hunger/init.lua @@ -1,9 +1,9 @@ ------------------------------ ---- 4hunger mod by 4aiman --- ------------------------------ ---- license: GPLv3 --- ------------------------------ +-------------------------------------------------- +--- 4hunger mod by 4aiman - Multicraft version --- +-------------------------------------------------- +--- CC BY-NC-SA --- +-------------------------------------------------- ---- ---- 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 -- 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. --- 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), -- I got inspired AND "guided" by some other mods that this one: +-- -- 1. "Farming" from the "Minitest" game by PilzAdam. What hunger if -- there's nothing to eat? -- 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 -- actions... That was a shame! -- 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: Merge upstream changes. (License change, food_saturation depletion fixes, respawn==reset hunger feature introduction) +-- + max_save_time = 10 save_time = 0 max_drumsticks = 20 -foodTickTimerMAX = 10 +foodTickTimerMAX = 5 max_exhaustion = 8 foodTickTimerMax = {} food_level = {} @@ -83,8 +85,6 @@ jumped = {} keypress_track = {} hungerhud = {} hungerhudb = {} -hearthud = {} -hearthudb = {} need_to_update_ph = {} @@ -273,10 +273,8 @@ function multicraft.item_eat(food_points, saturation_points, replace_with_item) food_saturation[pll]=food_points end if poisoned then - if poisoned==1 then state[pll] = 7 end - if poisoned==2 then state[pll] = 8 end - else - state[pll] = -1 + if poisoned==1 then state[pll].poison1 = true end + if poisoned==2 then state[pll].poison2 = true end end itemstack:add_item(replace_with_item) end @@ -292,49 +290,60 @@ function distance(pos1,pos2) return math.sqrt( (pos1.x - pos2.x)^2 + (pos1.y - pos2.y)^2 + (pos1.z - pos2.z)^2 ) end -function init_hunger(player) +local damage_enabled = multicraft.setting_getbool("enable_damage") + +function init_hunger(player, force) if player then local pll = player:get_player_name() - if not foodTickTimerMax[pll] then foodTickTimerMax[pll]=foodTickTimerMAX end - if not food_level[pll] then food_level[pll] = max_drumsticks end - if not death_timer[pll] then death_timer[pll] = 0 end - if not food_saturation[pll] then food_saturation[pll]=food_level[pll] end - if not timers[pll] then timers[pll] = -1 end - if not keypress_track[pll] then keypress_track[pll] = {} end + if not foodTickTimerMax[pll] or force then foodTickTimerMax[pll]=foodTickTimerMAX end + if not food_level[pll] or force then food_level[pll] = max_drumsticks end + if not death_timer[pll] or force then death_timer[pll] = 0 end + if not food_saturation[pll] or force then food_saturation[pll]=food_level[pll] end + if not timers[pll] or force then timers[pll] = -1 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 not player then return end - hungerhudb[pll]=player:hud_add({ - hud_elem_type = "statbar", - position = HUD_HUNGER_POS, - size = HUD_SB_SIZE, - text = "hud_hunger_bg.png", - number = 20, - alignment = {x=-1,y=-1}, - offset = HUD_HUNGER_OFFSET, - }) - hungerhud[pll]=player:hud_add({ - hud_elem_type = "statbar", - position = HUD_HUNGER_POS, - size = HUD_SB_SIZE, - text = "hud_hunger_fg.png", - number = 20, - alignment = {x=-1,y=-1}, - offset = HUD_HUNGER_OFFSET, - }) +if damage_enabled then + multicraft.after(0.5, function() + 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({ + hud_elem_type = "statbar", + position = HUD_HUNGER_POS, + size = HUD_SB_SIZE, + text = "hud_hunger_bg.png", + number = 20, + alignment = {x=-1,y=-1}, + offset = HUD_HUNGER_OFFSET, + }) + hungerhud[pll]=player:hud_add({ + hud_elem_type = "statbar", + position = HUD_HUNGER_POS, + size = HUD_SB_SIZE, + text = "hud_hunger_fg.png", + number = 20, + alignment = {x=-1,y=-1}, + offset = HUD_HUNGER_OFFSET, + }) + local hhf,hhb = player:hud_get(hungerhud[pll]), player:hud_get(hungerhudb[pll]) end) end end +end -multicraft.register_on_joinplayer(function(player) +minetest.register_on_joinplayer(function(player) init_hunger(player) + local pll = player:get_player_name() + state[pll] = {} end) local function get_field(item,field) - if multicraft.registered_nodes[item] then return multicraft.registered_nodes[item][field] end - if multicraft.registered_items[item] then return multicraft.registered_items[item][field] end - if multicraft.registered_craftitems[item] then return multicraft.registered_craftitems[item][field] end - if multicraft.registered_tools[item] then return multicraft.registered_tools[item][field] end + if minetest.registered_nodes[item] then return minetest.registered_nodes[item][field] end + if minetest.registered_items[item] then return minetest.registered_items[item][field] end + if minetest.registered_craftitems[item] then return minetest.registered_craftitems[item][field] end + if minetest.registered_tools[item] then return minetest.registered_tools[item][field] end return "" end @@ -342,173 +351,207 @@ local function get_on_eat(item) return get_field(item,"on_eat") end -multicraft.after(0, function(dtime) -local global_dtime = 0 -local doit = false - multicraft.register_globalstep(function(dtime) - global_dtime = global_dtime + dtime - if global_dtime>1 then - doit = true - global_dtime = 0 - end - if save_time > max_save_time then - save_time=0 - save_4hunger() - else - save_time=save_time+dtime - end - local players = multicraft.get_connected_players() - for i,player in ipairs(players) do - local pll = player:get_player_name() - local pos = player:getpos() - local hp = player:get_hp() - local control = player:get_player_control() - local wstack = player:get_wielded_item():get_name() - local bar - local addex = 0 - if hp==1 and food_level[pll]<=0 and food_saturation[pll]<=0 then - death_timer[pll] = death_timer[pll] + dtime - end - if not food_level[pll] then init_hunger(player) end - if (death_timer[pll] or 0) > max_being_hungry_time then - death_timer[pll] = 0 - multicraft.chat_send_all(death_message .. pll) - food_level[pll] = max_drumsticks - food_saturation[pll] = max_drumsticks - food_exhaustion[pll] = 0 - player:set_hp(0) - end +if damage_enabled then + minetest.after(0, function(dtime) + local global_dtime = 0 + local doit = false + minetest.register_globalstep(function(dtime) + global_dtime = global_dtime + dtime + if global_dtime>1 then + doit = true + global_dtime = 0 + end - if state[pll] == 7 or state[pll] == 8 then - if not timers[pll] then - timers[pll] = 15 - player:hud_change(hungerhudb[pll],"text",'hunger_tile_d.png') - player:hud_change(hungerhud[pll] ,"text",'hunger_tile_c.png') + if save_time > max_save_time then + save_time=0 + save_4hunger() + else + save_time=save_time+dtime + end + + local players = minetest.get_connected_players() + for i,player in ipairs(players) do + local pll = player:get_player_name() + local pos = player:getpos() + local hp = player:get_hp() + local control = player:get_player_control() + local wstack = player:get_wielded_item():get_name() + local bar + local addex = 0 + + if hp==1 and food_level[pll]<=0 and food_saturation[pll]<=0 then + death_timer[pll] = death_timer[pll] + dtime + end + + if (death_timer[pll] or 0) > max_being_hungry_time then + death_timer[pll] = 0 + minetest.chat_send_all(death_message .. pll) + food_level[pll] = max_drumsticks + food_saturation[pll] = max_drumsticks + food_exhaustion[pll] = 0 + player:set_hp(0) + end + + if state[pll].poison1 or state[pll].poison2 then + if not timers[pll] then + timers[pll] = 15 + player:hud_change(hungerhudb[pll],"text",'hunger_tile_d.png') + player:hud_change(hungerhud[pll] ,"text",'hunger_tile_c.png') if doit==true and hp>10 then - player:set_hp(hp-1) - hp=hp-1 + player:set_hp(hp-1) + hp=hp-1 + end + end + if state[pll].poison1 then addex = addex + ef1 + elseif state[pll].poison2 then addex = addex + ef2 end + end + + if timers[pll] then + timers[pll] = timers[pll] - dtime + if timers[pll]<0 then + timers[pll]=nil + 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 + 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 + if doit==true and hp>10 then + player:set_hp(hp-1) + hp=hp-1 + end + end + end + + local hp_diff = 0 + if oldHPs[pll] and hp then + hp_diff = oldHPs[pll]-hp + end + + if hp_diff~=0 then + state[pll].hurt = true + addex = addex + edm + end + + oldHPs[pll] = hp + + local dist = distance(oldpos[pll],pos) + oldpos[pll] = pos + + local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) + local name = node.name + + if not jumped[pll] then + if state[pll].jump then + if not name:find("air") then + state[pll].jump = nil + end + else + if name:find("air") then + state[pll].jump = true + jumped[pll] = true + addex = addex + ejp + end + end + else + if not name:find("air") then + state[pll].jump = nil + jumped[pll] = false + end + end + + if dist and dist>0 then + state[pll].walk = true + end + + pos.y=pos.y+1 + local node = minetest.get_node(pos) + local name = node.name + if minetest.get_item_group(name, "water") ~= 0 then + state[pll].swim = true + 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 foodTickTimer[pll] then + foodTickTimer[pll] = foodTickTimer[pll] + dtime + else + foodTickTimer[pll] = dtime end end - if state == 7 then addex = addex + ef1 - elseif state == 8 then addex = addex + ef2 end - end - if timers[pll] then - timers[pll] = timers[pll] - dtime - if timers[pll]<0 then - timers[pll]=nil - player:hud_change(hungerhudb[pll],"text", "hud_hunger_bg.png") - player:hud_change(hungerhud[pll] ,"text", "hud_hunger_fg.png") - else - if doit==true and hp>1 then - player:set_hp(hp-1) - hp=hp-1 - end - end - end - local hp_diff = 0 - if oldHPs[pll] and hp then - hp_diff = oldHPs[pll]-hp - end - if hp_diff~=0 then - state[pll] = 5 - addex = addex + edm - player:hud_change(hearthud[pll],"number",hp) - end - oldHPs[pll] = hp - local dist = distance(oldpos[pll],pos) - if not jumped[pll] then - local node = multicraft.get_node(pos) - local name = node.name - if name:find("air") then - if state[pll] == 1 then - state[pll] = 6 - addex = addex + esj - else - state[pll] = 3 - addex = addex + ejp - end - jumped[pll] = true - else - if dist and dist>0 then - state[pll] = 0 - else - state[pll] = -1 + if foodTickTimer[pll]>foodTickTimerMax[pll] then + foodTickTimer[pll] = 0 + if food_level[pll]>17 and food_level[pll]<=max_drumsticks then + if hp>0 then + player:set_hp(hp+1) + end + elseif food_level[pll]==0 then + if hp>10 then + player:set_hp(hp-1) + hp = hp-1 end - jumped[pll] = false - end - end - pos.y=pos.y+1 - local node = multicraft.get_node(pos) - local name = node.name - if multicraft.get_item_group(name, "water") ~= 0 then - state[pll] = 2 - 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 foodTickTimer[pll] - then foodTickTimer[pll] = foodTickTimer[pll] + dtime - else foodTickTimer[pll] = dtime end - end - if foodTickTimer[pll]>foodTickTimerMax[pll] then - if food_level[pll]>17 and food_level[pll]<=max_drumsticks then - if hp>0 then - player:set_hp(hp+1) - end - elseif food_level[pll]==0 then - if hp>1 then - player:set_hp(hp-1) - hp = hp-1 - end - end - foodTickTimer[pll] = 0 - end - if not walked_distance[pll] then walked_distance[pll] = 0 end - oldpos[pll]=pos - walked_distance[pll] = walked_distance[pll] + dist - if hp_diff<0 and hp>18 then state[pll]=10 end + end - if not state[pll] then state[pll]=-1 end - if state[pll]==-1 then addex=addex+eid - elseif state[pll]==00 then addex=addex+ews*dist - elseif state[pll]==01 then addex=addex+esp*dist - 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 - if food_exhaustion[pll] then - food_exhaustion[pll]=food_exhaustion[pll]+addex - else + if not walked_distance[pll] then walked_distance[pll] = 0 end + + oldpos[pll]=pos + walked_distance[pll] = walked_distance[pll] + dist + + if hp_diff<0 and hp>18 then state[pll].regen = true end + local ccc = 0 + for k,v in pairs(state[pll]) do + ccc = ccc + 1 + 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 + food_exhaustion[pll]=food_exhaustion[pll]+addex + else food_exhaustion[pll]=addex - end - if food_exhaustion[pll]>max_exhaustion then - if food_saturation[pll] then - food_saturation[pll] = food_saturation[pll]-1 - if food_saturation[pll]<0 then food_saturation[pll]=0 end - else - food_saturation[pll] = food_level[pll]-1 - end - if food_saturation[pll]==0 then food_level[pll]=food_level[pll]-1 end - if food_level[pll]<0 then food_level[pll]=0 end - food_exhaustion[pll] = 0 - end - if hungerhud[pll] and food_level[pll] then - player:hud_change(hungerhud[pll],"number",food_level[pll]) - end - end - doit = false + end + + if food_exhaustion[pll]>max_exhaustion then + if food_saturation[pll] then + food_saturation[pll] = food_saturation[pll]-1 + if food_saturation[pll]<0 then food_saturation[pll]=0 end + else + food_saturation[pll] = food_level[pll]-1 + end + if food_saturation[pll]==0 then food_level[pll]=food_level[pll]-1 end + if food_level[pll]<0 then food_level[pll]=0 end + food_exhaustion[pll] = 0 + end + + if hungerhud[pll] and food_level[pll] then + player:hud_change(hungerhud[pll],"number",food_level[pll]) + end + end + doit = false + end) end) -end) +end - -multicraft.register_on_dignode(function(pos, oldnode, digger) +minetest.register_on_dignode(function(pos, oldnode, digger) if not digger then return end local pll = digger:get_player_name() - state[pll]=9 + state[pll].dig = true if food_exhaustion[pll] then food_exhaustion[pll]=food_exhaustion[pll]+ebr else @@ -516,21 +559,26 @@ multicraft.register_on_dignode(function(pos, oldnode, digger) end end) -multicraft.after(0,function(dtime) - for cou,def in pairs(multicraft.registered_items) do +minetest.after(0,function(dtime) + for cou,def in pairs(minetest.registered_items) do if get_points(def['name']) ~= false then - def['on_use'] = multicraft.item_eat(1) - multicraft.register_item(':' .. def.name, def) + def['on_use'] = minetest.item_eat(1) + minetest.register_item(':' .. def.name, def) end end end ) -multicraft.register_chatcommand("hunger", { +minetest.register_chatcommand("hunger", { + privs = {server = true}, func = function(name, param) food_level[name] = 0 food_saturation[name] = 0 end }) +minetest.register_on_respawnplayer(function(player) + init_hunger(player, true) +end) + print('[OK] 4hunger (Multicraft version) loaded') diff --git a/games/MultiCraft_game/files/adbs/init.lua b/games/MultiCraft_game/files/adbs/init.lua index 4972d5317..7a7e73072 100644 --- a/games/MultiCraft_game/files/adbs/init.lua +++ b/games/MultiCraft_game/files/adbs/init.lua @@ -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 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 -- -------------------------- --- (Multicraft port) -- -------------------------- --- -- --- Licence:GPLv3 -- --- -- -------------------------- +----------------------------------------------- +--- adbs mod by 4aiman - Multicraft version --- +----------------------------------------------- +--- CC BY-NC-SA --- +----------------------------------------------- +--Update: Merged upstream changes. (License change, less "jumpy" mobs) math.randomseed(os.time()) @@ -496,12 +492,15 @@ adbs.dd = { 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 z = math.cos(yaw) - local nm = multicraft.get_node(posf).name - if multicraft.registered_nodes[nm] - and multicraft.registered_nodes[nm].walkable + local nm = minetest.get_node({x = posf.x+x,y = posf.y+1,z = posf.z+z}).name + local nm2 = minetest.get_node({x = posf.x+x,y = posf.y+2,z = posf.z+z}).name + if minetest.registered_nodes[nm] + and minetest.registered_nodes[nm].walkable + and minetest.registered_nodes[nm2] + and not minetest.registered_nodes[nm2].walkable then self:jump() end diff --git a/games/MultiCraft_game/files/default/mapgen.lua b/games/MultiCraft_game/files/default/mapgen.lua index aeb1c5f2a..2954fb034 100644 --- a/games/MultiCraft_game/files/default/mapgen.lua +++ b/games/MultiCraft_game/files/default/mapgen.lua @@ -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_desert_sand", "default:sand") 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 @@ -490,40 +498,20 @@ multicraft.register_on_generated(function(minp, maxp, seed) local p = {x=x,y=ground_y,z=z} -- 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 - 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 + local fruit = {"farming:pumpkin_face", "farming:melon", "farming:carrot", "farming:potato"} + local choice = fruit[pr:next(1,#fruit)] + if pr:next() < 2500 then -- the "proper" alternative + local xx = 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 + if nname ~="air" + and (multicraft.registered_nodes[nname] and not multicraft.registered_nodes[nname].buildable_to) + then + multicraft.set_node({x=p.x+xx,z=p.z+zz,y=ground_y+1},{name=choice}) end - local fruit = {"farming:pumpkin_face", "farming:melon", "farming:carrot", "farming:potato"} - local choice = fruit[pr:next(1,#fruit)] - --print(choice) - - if pr:next() < 2500 then -- the "proper" alternative - for i = 1, pr:next(1,3) do - local xx = 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 - if nname ~="air" - and (multicraft.registered_nodes[nname] and not multicraft.registered_nodes[nname].buildable_to) - then - - 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 diff --git a/games/MultiCraft_game/files/default/nodes.lua b/games/MultiCraft_game/files/default/nodes.lua index f5c3bbe12..7ba49c12f 100644 --- a/games/MultiCraft_game/files/default/nodes.lua +++ b/games/MultiCraft_game/files/default/nodes.lua @@ -3,6 +3,73 @@ -- -- 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", { description = "Stone", diff --git a/games/MultiCraft_game/files/default/textures/default_pine_needles.png b/games/MultiCraft_game/files/default/textures/default_pine_needles.png new file mode 100644 index 000000000..1a32f632d Binary files /dev/null and b/games/MultiCraft_game/files/default/textures/default_pine_needles.png differ diff --git a/games/MultiCraft_game/files/default/textures/default_pinetree.png b/games/MultiCraft_game/files/default/textures/default_pinetree.png new file mode 100644 index 000000000..4a5328ff3 Binary files /dev/null and b/games/MultiCraft_game/files/default/textures/default_pinetree.png differ diff --git a/games/MultiCraft_game/files/default/textures/default_pinetree_top.png b/games/MultiCraft_game/files/default/textures/default_pinetree_top.png new file mode 100644 index 000000000..8705710ed Binary files /dev/null and b/games/MultiCraft_game/files/default/textures/default_pinetree_top.png differ diff --git a/games/MultiCraft_game/files/hud/api.lua b/games/MultiCraft_game/files/hud/api.lua index 74296d13e..31824859a 100644 --- a/games/MultiCraft_game/files/hud/api.lua +++ b/games/MultiCraft_game/files/hud/api.lua @@ -61,7 +61,7 @@ function hud.register(name, def) end end end - + -- no error so far, return sucess return true end @@ -106,7 +106,7 @@ function hud.change_item(player, name, def) if bg and bg.max and bg.max < 1 and def.max and def.max > bg.max then player:hud_change(bg.id, "number", def.max) bg.max = def.max - end + end end end end @@ -183,7 +183,6 @@ local function add_hud_item(player, name, def) end multicraft.register_on_joinplayer(function(player) - -- first: hide the default statbars local hud_flags = player:hud_get_flags() hud_flags.healthbar = false diff --git a/games/MultiCraft_game/files/hud/builtin.lua b/games/MultiCraft_game/files/hud/builtin.lua index 611c6bee2..ef1861c2e 100644 --- a/games/MultiCraft_game/files/hud/builtin.lua +++ b/games/MultiCraft_game/files/hud/builtin.lua @@ -1,7 +1,7 @@ HUD_IW_MAX = 8 HUD_IW_TICK = 0.4 if multicraft.is_singleplayer() == true then - HUD_IW_TICK = 0.2 + HUD_IW_TICK = 0.1 end HUD_SB_SIZE = {x = 24, y = 24} @@ -50,6 +50,7 @@ if damage_enabled then text = "hud_heart_fg.png", number = 20, alignment = {x = -1, y = -1}, + autohide_bg = false, offset = HUD_HEALTH_OFFSET, background = "hud_heart_bg.png", events = { @@ -97,7 +98,6 @@ if damage_enabled then autohide_bg = false, max = 20, }) - else hud.show_armor = false end diff --git a/src/game.cpp b/src/game.cpp index b42eda46e..11835e6fe 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -282,11 +282,11 @@ public: Check if a node is pointable */ inline bool isPointableNode(const MapNode &n, - Client *client, bool liquids_pointable) + Client *client, bool liquids_pointable) { const ContentFeatures &features = client->getNodeDefManager()->get(n); return features.pointable || - (liquids_pointable && features.isLiquid()); + (liquids_pointable && features.isLiquid()); } /* @@ -321,8 +321,8 @@ PointedThing getPointedThing(Client *client, v3f player_position, v3f pos = selected_object->getPosition(); hilightboxes.push_back(aabb3f( - selection_box->MinEdge + pos - intToFloat(camera_offset, BS), - selection_box->MaxEdge + pos - intToFloat(camera_offset, BS))); + selection_box->MinEdge + pos - intToFloat(camera_offset, BS), + selection_box->MaxEdge + pos - intToFloat(camera_offset, BS))); } mindistance = (selected_object->getPosition() - camera_position).getLength(); @@ -902,8 +902,8 @@ bool nodePlacementPrediction(Client &client, if (prediction != "" && !nodedef->get(node).rightclickable) { verbosestream << "Node placement prediction for " - << playeritem_def.name << " is " - << prediction << std::endl; + << playeritem_def.name << " is " + << prediction << std::endl; v3s16 p = neighbourpos; // Place inside node itself if buildable_to @@ -925,9 +925,9 @@ bool nodePlacementPrediction(Client &client, if (!found) { errorstream << "Node placement prediction failed for " - << playeritem_def.name << " (places " - << prediction - << ") - Name not known" << std::endl; + << playeritem_def.name << " (places " + << prediction + << ") - Name not known" << std::endl; return false; } @@ -1000,9 +1000,9 @@ bool nodePlacementPrediction(Client &client, } } catch (InvalidPositionException &e) { errorstream << "Node placement prediction failed for " - << playeritem_def.name << " (places " - << prediction - << ") - Position not loaded" << std::endl; + << playeritem_def.name << " (places " + << prediction + << ") - Position not loaded" << std::endl; } } @@ -1017,7 +1017,7 @@ static inline void create_formspec_menu(GUIFormSpecMenu **cur_formspec, if (*cur_formspec == 0) { *cur_formspec = new GUIFormSpecMenu(device, guiroot, -1, &g_menumgr, - invmgr, gamedef, tsrc, fs_src, txt_dest, client); + invmgr, gamedef, tsrc, fs_src, txt_dest, client); (*cur_formspec)->doPause = false; /* @@ -1035,13 +1035,13 @@ static inline void create_formspec_menu(GUIFormSpecMenu **cur_formspec, } #ifdef __ANDROID__ -# define SIZE_TAG "size[11,5.5]" -# define PAUSE_MENU_SIZE_TAG "size[6,3.5]" -# define PAUSE_MENU_BUTTON_LEFT 1.5 +# define SIZE_TAG "size[11,5.5]" +# define PAUSE_MENU_SIZE_TAG "size[6,3.5]" +# define PAUSE_MENU_BUTTON_LEFT 1.5 #else -# define SIZE_TAG "size[11,5.5,true]" // Fixed size on desktop -# define PAUSE_MENU_SIZE_TAG "size[11,5.5,true]" // Fixed size on desktop -# define PAUSE_MENU_BUTTON_LEFT 4 +# define SIZE_TAG "size[11,5.5,true]" // Fixed size on desktop +# define PAUSE_MENU_SIZE_TAG "size[11,5.5,true]" // Fixed size on desktop +# define PAUSE_MENU_BUTTON_LEFT 4 #endif static void show_chat_menu(GUIFormSpecMenu **cur_formspec, @@ -1093,19 +1093,19 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec, bool singleplayermode) { #ifdef __ANDROID__ -// std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n" -// "No menu visible:\n" -// "- single tap: button activate\n" -// "- double tap: place/use\n" -// "- slide finger: look around\n" -// "Menu/Inventory visible:\n" -// "- double tap (outside):\n" -// " -->close\n" -// "- touch stack, touch slot:\n" -// " --> move stack\n" -// "- touch&drag, tap 2nd finger\n" -// " --> place single item to slot\n" -// )); +// std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n" +// "No menu visible:\n" +// "- single tap: button activate\n" +// "- double tap: place/use\n" +// "- slide finger: look around\n" +// "Menu/Inventory visible:\n" +// "- double tap (outside):\n" +// " -->close\n" +// "- touch stack, touch slot:\n" +// " --> move stack\n" +// "- touch&drag, tap 2nd finger\n" +// " --> place single item to slot\n" +// )); #else std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n" "- WASD: move\n" @@ -1118,7 +1118,7 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec, "- Mouse right: place/use\n" "- Mouse wheel: select item\n" "- T: chat\n" - )); + )); #endif float ypos = singleplayermode ? 0.5 : 0.1; @@ -1134,14 +1134,14 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec, } #ifndef __ANDROID__ - os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_sound;" + os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_sound;" << wide_to_narrow(wstrgettext("Sound Volume")) << "]"; - os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_key_config;" + os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_key_config;" << wide_to_narrow(wstrgettext("Change Keys")) << "]"; #endif - os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_exit_menu;" + os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_exit_menu;" << wide_to_narrow(wstrgettext("Exit to Menu")) << "]"; - os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_exit_os;" + os << "button_exit[" << PAUSE_MENU_BUTTON_LEFT << "," << (ypos++) << ";3,0.5;btn_exit_os;" << wide_to_narrow(wstrgettext("Exit to OS")) << "]" #ifndef __ANDROID__ << "textarea[7.5,0.25;3.9,6.25;;" << control_text << ";]" @@ -1200,13 +1200,13 @@ static void updateChat(Client &client, f32 dtime, bool show_debug, // first pass to calculate height of text to be set s32 width = std::min(g_fontengine->getTextWidth(recent_chat) + 10, - porting::getWindowSize().X - 20); + porting::getWindowSize().X - 20); core::rect rect(10, chat_y, width, chat_y + porting::getWindowSize().Y); guitext_chat->setRelativePosition(rect); //now use real height of text and adjust rect according to this size rect = core::rect(10, chat_y, width, - chat_y + guitext_chat->getTextHeight()); + chat_y + guitext_chat->getTextHeight()); guitext_chat->setRelativePosition(rect); @@ -1574,7 +1574,7 @@ private: GUIChatConsole *gui_chat_console; // Free using ->Drop() MapDrawControl *draw_control; Camera *camera; - Clouds *clouds; // Free using ->Drop() + Clouds *clouds; // Free using ->Drop() Sky *sky; // Free using ->Drop() Inventory *local_inventory; Hud *hud; @@ -1605,7 +1605,7 @@ private: gui::IGUIStaticText *guitext2; // Second line of debug text gui::IGUIStaticText *guitext_info; // At the middle of the screen gui::IGUIStaticText *guitext_status; - gui::IGUIStaticText *guitext_chat; // Chat text + gui::IGUIStaticText *guitext_chat; // Chat text gui::IGUIStaticText *guitext_profiler; // Profiler text std::wstring infotext; @@ -1671,7 +1671,7 @@ Game::Game() : m_cache_mouse_sensitivity = rangelim(m_cache_mouse_sensitivity, 0.001, 100.0); #ifdef __ANDROID__ - m_cache_hold_aux1 = false; // This is initialised properly later + m_cache_hold_aux1 = false; // This is initialised properly later #endif } @@ -1973,7 +1973,7 @@ bool Game::createSingleplayerServer(const std::string map_dir, } server = new Server(map_dir, gamespec, simple_singleplayer_mode, - bind_addr.isIPv6()); + bind_addr.isIPv6()); server->start(bind_addr); @@ -2036,7 +2036,7 @@ bool Game::createClient(const std::string &playername, /* Skybox */ sky = new Sky(smgr->getRootSceneNode(), smgr, -1, texture_src); - skybox = NULL; // This is used/set later on in the main run loop + skybox = NULL; // This is used/set later on in the main run loop local_inventory = new Inventory(itemdef_manager); @@ -2152,7 +2152,7 @@ bool Game::connectToServer(const std::string &playername, const std::string &password, std::string *address, u16 port, bool *connect_ok, bool *aborted) { - *connect_ok = false; // Let's not be overly optimistic + *connect_ok = false; // Let's not be overly optimistic *aborted = false; bool local_server_mode = false; @@ -2197,7 +2197,7 @@ bool Game::connectToServer(const std::string &playername, if (!client) return false; - gamedef = client; // Client acts as our GameDef + gamedef = client; // Client acts as our GameDef infostream << "Connecting to server at "; connect_address.print(&infostream); @@ -2397,19 +2397,19 @@ inline bool Game::handleCallbacks() if (g_gamecallback->changepassword_requested) { (new GUIPasswordChange(guienv, guiroot, -1, - &g_menumgr, client))->drop(); + &g_menumgr, client))->drop(); g_gamecallback->changepassword_requested = false; } if (g_gamecallback->changevolume_requested) { (new GUIVolumeChange(guienv, guiroot, -1, - &g_menumgr, client))->drop(); + &g_menumgr, client))->drop(); g_gamecallback->changevolume_requested = false; } if (g_gamecallback->keyconfig_requested) { (new GUIKeyChangeMenu(guienv, guiroot, -1, - &g_menumgr))->drop(); + &g_menumgr))->drop(); g_gamecallback->keyconfig_requested = false; } @@ -2643,10 +2643,10 @@ void Game::processKeyboardInput(VolatileRunFlags *flags, else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_DEBUG_STACKS])) { // Print debug stacks dstream << "-----------------------------------------" - << std::endl; + << std::endl; dstream << DTIME << "Printing debug stacks:" << std::endl; dstream << "-----------------------------------------" - << std::endl; + << std::endl; debug_stacks_print(); } @@ -2675,7 +2675,7 @@ void Game::processItemSelection(u16 *new_playeritem) s32 wheel = input->getMouseWheel(); u16 max_item = MYMIN(PLAYER_INVENTORY_SIZE - 1, - player->hud_hotbar_itemcount - 1); + player->hud_hotbar_itemcount - 1); if (wheel < 0) *new_playeritem = *new_playeritem < max_item ? *new_playeritem + 1 : 0; @@ -2894,7 +2894,7 @@ void Game::toggleProfiler(float *statustext_time, u32 *profiler_current_page, if (*profiler_current_page != 0) { std::wstringstream sstr; sstr << "Profiler shown (page " << *profiler_current_page - << " of " << profiler_max_page << ")"; + << " of " << profiler_max_page << ")"; statustext = sstr.str(); } else { statustext = L"Profiler hidden"; @@ -3061,7 +3061,7 @@ inline void Game::step(f32 *dtime) bool can_be_and_is_paused = (simple_singleplayer_mode && g_menumgr.pausesGame()); - if (can_be_and_is_paused) { // This is for a singleplayer server + if (can_be_and_is_paused) { // This is for a singleplayer server *dtime = 0; // No time passes } else { if (server != NULL) { @@ -3104,7 +3104,7 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash) show_deathscreen(¤t_formspec, client, gamedef, texture_src, device, client); - chat_backend->addMessage(L"", L"You died."); + // chat_backend->addMessage(L"", L"You died."); /* Handle visualization */ *damage_flash = 0; @@ -3118,7 +3118,7 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash) new TextDestPlayerInventory(client, *(event.show_formspec.formname)); create_formspec_menu(¤t_formspec, client, gamedef, - texture_src, device, fs_src, txt_dst, client); + texture_src, device, fs_src, txt_dst, client); delete(event.show_formspec.formspec); delete(event.show_formspec.formname); @@ -3322,7 +3322,7 @@ void Game::updateCamera(VolatileRunFlags *flags, u32 busy_time, tool_reload_ratio = MYMIN(tool_reload_ratio, 1.0); camera->update(player, dtime, busy_time / 1000.0f, tool_reload_ratio, - client->getEnv()); + client->getEnv()); camera->step(dtime); v3f camera_position = camera->getPosition(); @@ -3352,13 +3352,13 @@ void Game::updateSound(f32 dtime) // Update sound listener v3s16 camera_offset = camera->getOffset(); sound->updateListener(camera->getCameraNode()->getPosition() + intToFloat(camera_offset, BS), - v3f(0, 0, 0), // velocity - camera->getDirection(), - camera->getCameraNode()->getUpVector()); + v3f(0, 0, 0), // velocity + camera->getDirection(), + camera->getCameraNode()->getUpVector()); sound->setListenerGain(g_settings->getFloat("sound_volume")); - // Update sound maker + // Update sound maker soundmaker->step(dtime); LocalPlayer *player = client->getEnv().getLocalPlayer(); @@ -3411,7 +3411,7 @@ void Game::processPlayerInteraction(std::vector &highlight_boxes, camera_position + camera_direction * BS * (d + 1)); } else { - // prevent player pointing anything in front-view + // prevent player pointing anything in front-view if (camera->getCameraMode() == CAMERA_MODE_THIRD_FRONT) shootline = core::line3d(0, 0, 0, 0, 0, 0); } @@ -3457,7 +3457,7 @@ void Game::processPlayerInteraction(std::vector &highlight_boxes, if (runData->digging) { if (input->getLeftReleased()) { infostream << "Left button released" - << " (stopped digging)" << std::endl; + << " (stopped digging)" << std::endl; runData->digging = false; } else if (pointed != runData->pointed_old) { if (pointed.type == POINTEDTHING_NODE @@ -3468,7 +3468,7 @@ void Game::processPlayerInteraction(std::vector &highlight_boxes, // Don't reset. } else { infostream << "Pointing away from node" - << " (stopped digging)" << std::endl; + << " (stopped digging)" << std::endl; runData->digging = false; } } @@ -3584,7 +3584,7 @@ void Game::handlePointingAtNode(GameRunData *runData, TextDest *txt_dst = new TextDestNodeMetadata(nodepos, client); create_formspec_menu(¤t_formspec, client, gamedef, - texture_src, device, fs_src, txt_dst, client); + texture_src, device, fs_src, txt_dst, client); current_formspec->setFormSpec(meta->getString("formspec"), inventoryloc); } else { @@ -3829,7 +3829,7 @@ void Game::updateFrame(std::vector &highlight_boxes, direct_brightness = client->getEnv().getClientMap() .getBackgroundBrightness(MYMIN(runData->fog_range * 1.2, 60 * BS), daynight_ratio, (int)(old_brightness * 255.5), &sunlight_seen) - / 255.0; + / 255.0; } float time_of_day = runData->time_of_day; @@ -3868,7 +3868,7 @@ void Game::updateFrame(std::vector &highlight_boxes, clouds->setVisible(true); clouds->step(dtime); clouds->update(v2f(player_position.X, player_position.Z), - sky->getCloudColor()); + sky->getCloudColor()); } else { clouds->setVisible(false); } @@ -4264,20 +4264,20 @@ void Game::extendedResourceCleanup() // Extended resource accounting infostream << "Irrlicht resources after cleanup:" << std::endl; infostream << "\tRemaining meshes : " - << device->getSceneManager()->getMeshCache()->getMeshCount() << std::endl; + << device->getSceneManager()->getMeshCache()->getMeshCount() << std::endl; infostream << "\tRemaining textures : " - << driver->getTextureCount() << std::endl; + << driver->getTextureCount() << std::endl; for (unsigned int i = 0; i < driver->getTextureCount(); i++) { irr::video::ITexture *texture = driver->getTextureByIndex(i); infostream << "\t\t" << i << ":" << texture->getName().getPath().c_str() - << std::endl; + << std::endl; } clearTextureNameCache(); infostream << "\tRemaining materials: " - << driver-> getMaterialRendererCount() - << " (note: irrlicht doesn't support removing renderers)" << std::endl; + << driver-> getMaterialRendererCount() + << " (note: irrlicht doesn't support removing renderers)" << std::endl; } diff --git a/textures/base/pack/ad_label1.png b/textures/base/pack/ad_label1.png index 7ca601553..c296a2e9a 100644 Binary files a/textures/base/pack/ad_label1.png and b/textures/base/pack/ad_label1.png differ diff --git a/textures/base/pack/ad_label10.png b/textures/base/pack/ad_label10.png index 8001c1a98..55cad4712 100644 Binary files a/textures/base/pack/ad_label10.png and b/textures/base/pack/ad_label10.png differ diff --git a/textures/base/pack/ad_label11.png b/textures/base/pack/ad_label11.png index 549a4f1ea..0d86cb244 100644 Binary files a/textures/base/pack/ad_label11.png and b/textures/base/pack/ad_label11.png differ diff --git a/textures/base/pack/ad_label2.png b/textures/base/pack/ad_label2.png index 8022bd50b..e08f26894 100644 Binary files a/textures/base/pack/ad_label2.png and b/textures/base/pack/ad_label2.png differ diff --git a/textures/base/pack/ad_label3.png b/textures/base/pack/ad_label3.png index 7c8ee88bd..08eebbe8e 100644 Binary files a/textures/base/pack/ad_label3.png and b/textures/base/pack/ad_label3.png differ diff --git a/textures/base/pack/ad_label4.png b/textures/base/pack/ad_label4.png index ac954e602..d9f37789e 100644 Binary files a/textures/base/pack/ad_label4.png and b/textures/base/pack/ad_label4.png differ diff --git a/textures/base/pack/ad_label5.png b/textures/base/pack/ad_label5.png index a91c09727..0cbe26783 100644 Binary files a/textures/base/pack/ad_label5.png and b/textures/base/pack/ad_label5.png differ diff --git a/textures/base/pack/ad_label6.png b/textures/base/pack/ad_label6.png index f99fe9014..de1c8fdfd 100644 Binary files a/textures/base/pack/ad_label6.png and b/textures/base/pack/ad_label6.png differ diff --git a/textures/base/pack/ad_label7.png b/textures/base/pack/ad_label7.png index 637539773..2ea5c0d82 100644 Binary files a/textures/base/pack/ad_label7.png and b/textures/base/pack/ad_label7.png differ diff --git a/textures/base/pack/ad_label8.png b/textures/base/pack/ad_label8.png index 30c6f564f..4d8f5e3b5 100644 Binary files a/textures/base/pack/ad_label8.png and b/textures/base/pack/ad_label8.png differ diff --git a/textures/base/pack/ad_label9.png b/textures/base/pack/ad_label9.png index 1bbb3d59f..17882808e 100644 Binary files a/textures/base/pack/ad_label9.png and b/textures/base/pack/ad_label9.png differ