1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-05 18:10:26 +01:00
server-nalc/minetestforfun_game/mods/default/init.lua
Ombridride b0871dfe0f Reverse bad update from minetest_game
- game.conf (MAJ OK)
- default/boat/ (MAJ OK)
- craftitems.lua (MAJ OK)
- furnace.lua (not tweaked because it’s a total rewrite from
minetest_game)
- init.lua (petites modifs et remise du son/texte à la connexion de
nouveaux joueurs)
- player.lua (reprise des modifs de carbone sur l’animation du
personnage)
- tools.lua (on remet l’ancien)
- default/doors (MAJ OK, crafts modifiés)
- default/dye (MAJ OK)
- default/fire (MAJ OK)
- default/stairs (MAJ OK)

Mg, c’est à faire :
- default/textures/ (j’ai fait une bêtise, faut remettre les textures
grass/grass_side du minetest_game, et le water/water animated de
carbone)
2014-12-09 13:17:31 +01:00

148 lines
4.7 KiB
Lua

-- Minetest 0.4 mod: default
-- See README.txt for licensing and other information.
-- The API documentation in here was moved into doc/lua_api.txt
WATER_ALPHA = 160
WATER_VISC = 1
LAVA_VISC = 3 -- Slower movement in lava.
LIGHT_MAX = 14 -- 15 is reserved for sunlight.
-- Definitions made by this mod that other mods can use too
default = {}
-- GUI related stuff
default.gui_bg = "bgcolor[#080808BB;true]"
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
function default.get_hotbar_bg(x,y)
local out = ""
for i=0,7,1 do
out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]"
end
return out
end
default.gui_suvival_form = "size[8,8.5]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"list[current_player;craft;1.75,0.5;3,3;]"..
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
"image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
default.get_hotbar_bg(0,4.25)
-- Load files
dofile(minetest.get_modpath("default").."/functions.lua")
dofile(minetest.get_modpath("default").."/nodes.lua")
dofile(minetest.get_modpath("default").."/furnace.lua")
dofile(minetest.get_modpath("default").."/tools.lua")
dofile(minetest.get_modpath("default").."/craftitems.lua")
dofile(minetest.get_modpath("default").."/crafting.lua")
dofile(minetest.get_modpath("default").."/mapgen.lua")
dofile(minetest.get_modpath("default").."/player.lua")
dofile(minetest.get_modpath("default").."/trees.lua")
dofile(minetest.get_modpath("default").."/aliases.lua")
-- Code below by Casimir.
local function count_items()
local i = 0
local number = 0
for name, item in pairs(minetest.registered_items) do
if (name and name ~= "") then
number = number + 1
end
i = i + 1
end
minetest.log("action", "There are " .. number .. " registered nodes, items and tools.")
end
local function player_join_sounds()
minetest.register_on_joinplayer(function()
minetest.sound_play("player_join", {gain = 0.75})
end)
end
local function player_leave_sounds()
minetest.register_on_leaveplayer(function()
minetest.sound_play("player_leave", {gain = 1})
end)
end
minetest.after(1, count_items)
minetest.after(5, player_join_sounds)
minetest.after(5, player_leave_sounds)
hotbar_size = minetest.setting_get("hotbar_size") or 16
minetest.register_on_joinplayer(function(player)
player:set_physics_override({
sneak_glitch = false, -- Climable blocks are quite fast in Carbone.
})
player:hud_set_hotbar_itemcount(hotbar_size)
end)
minetest.register_on_respawnplayer(function(player)
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
local pos = player:getpos()
-- minetest.sound_play("player_join", {pos = pos, gain = 0.5})
end)
minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing)
if user:get_hp() >= 20 then return itemstack end
local pos = user:getpos()
minetest.sound_play("health_gain", {pos = pos, gain = 0.4})
end)
minetest.log("action", "") -- Empty line.
minetest.log("action", "") -- Empty line.
if minetest.setting_getbool("creative_mode") then
minetest.log("action", "Creative mode is enabled.")
else
minetest.log("action", "Creative mode is disabled.")
end
if minetest.setting_getbool("enable_damage") then
minetest.log("action", "Damage is enabled.")
else
minetest.log("action", "Damage is disabled.")
end
if minetest.setting_getbool("enable_pvp") then
minetest.log("action", "PvP is enabled.")
else
minetest.log("action", "PvP is disabled.")
end
if not minetest.is_singleplayer() and minetest.setting_getbool("server_announce") then
minetest.log("action", "") -- Empty line.
minetest.log("action", "Server name: " .. minetest.setting_get("server_name") or "(none)")
minetest.log("action", "Server description: " .. minetest.setting_get("server_description") or "(none)")
minetest.log("action", "Server URL: " .. minetest.setting_get("server_address") or "(none)")
minetest.log("action", "MOTD: " .. minetest.setting_get("motd") or "(none)")
minetest.log("action", "Maximum users: " .. minetest.setting_get("max_users") or 15)
end
minetest.log("action", "") -- Empty line.
minetest.log("action", "") -- Empty line.
-- Reserved slot handling:
minetest.register_on_prejoinplayer(function(name, ip)
if #minetest.get_connected_players() >= (minetest.setting_get("max_users") - 2)
and not minetest.check_player_privs(name, {server = true}) then
return "Sorry, 2 slots are reserved for administrators."
end
end)
if minetest.setting_getbool("log_mods") then
-- Highlight the default mod in the mod loading logs:
minetest.log("action", "Carbone: * [default] loaded.")
end