mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 12:31:05 +01:00
Disable XP by default
This commit is contained in:
parent
945260fa29
commit
6f9f7a2cb9
4 changed files with 25 additions and 3 deletions
|
@ -46,7 +46,7 @@ end
|
|||
|
||||
-- Load default settings
|
||||
dofile(minetest.get_modpath("hudbars").."/default_settings.lua")
|
||||
if minetest.get_modpath("mcl_experience") then
|
||||
if minetest.get_modpath("mcl_experience") and minetest.settings:get_bool("mcl_experience", false) then
|
||||
-- reserve some space for experience bar:
|
||||
hb.settings.start_offset_left.y = hb.settings.start_offset_left.y - 20
|
||||
hb.settings.start_offset_right.y = hb.settings.start_offset_right.y - 20
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
local S = minetest.get_translator("mcl_experience")
|
||||
local USE_XP = minetest.settings:get_bool("mcl_experience", false)
|
||||
mcl_experience = {}
|
||||
local pool = {}
|
||||
local registered_nodes
|
||||
|
@ -99,6 +100,9 @@ end
|
|||
|
||||
-- change element of hud
|
||||
hud_manager.change_hud = function(data)
|
||||
if not USE_XP then
|
||||
return
|
||||
end
|
||||
local name = data.player:get_player_name()
|
||||
if player_huds[name] and player_huds[name][data.hud_name] then
|
||||
data.player:hud_change(player_huds[name][data.hud_name], data.element, data.data)
|
||||
|
@ -149,7 +153,9 @@ function mcl_experience.set_player_xp_level(player,level)
|
|||
end
|
||||
pool[name].level = level
|
||||
pool[name].xp, pool[name].bar_step, pool[name].next_level = mcl_experience.bar_to_xp(pool[name].bar, level)
|
||||
if USE_XP then
|
||||
hud_manager.change_hud({player = player, hud_name = "xp_level", element = "text", data = tostring(level)})
|
||||
end
|
||||
-- we may don't update the bar
|
||||
end
|
||||
|
||||
|
@ -162,6 +168,10 @@ minetest.register_on_joinplayer(function(player)
|
|||
name = player:get_player_name()
|
||||
temp_pool = pool[name]
|
||||
|
||||
if not USE_XP then
|
||||
return
|
||||
end
|
||||
|
||||
hud_manager.add_hud(player,"experience_bar",
|
||||
{
|
||||
hud_elem_type = "statbar", position = {x=0.5, y=1},
|
||||
|
@ -270,7 +280,7 @@ local name
|
|||
local temp_pool
|
||||
local xp_amount
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
if minetest.settings:get_bool("mcl_keepInventory", false) then
|
||||
if minetest.settings:get_bool("mcl_keepInventory", false) or not USE_XP then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -486,6 +496,9 @@ minetest.register_chatcommand("xp", {
|
|||
description = S("Gives a player some XP"),
|
||||
privs = {server=true},
|
||||
func = function(name, params)
|
||||
if not USE_XP then
|
||||
return false, S("XP are disabled!")
|
||||
end
|
||||
local player, xp = nil, 1000
|
||||
local P, i = {}, 0
|
||||
for str in string.gmatch(params, "([^ ]+)") do
|
||||
|
@ -517,6 +530,9 @@ minetest.register_chatcommand("xp", {
|
|||
})
|
||||
|
||||
function mcl_experience.throw_experience(pos, amount)
|
||||
if not USE_XP then
|
||||
return false
|
||||
end
|
||||
local i, j = 0, 0
|
||||
local obj, xp
|
||||
while i < amount and j < 100 do
|
||||
|
|
|
@ -4,3 +4,4 @@ Error: Too many parameters!=
|
|||
Error: Incorrect value of XP=
|
||||
Error: Player not found=
|
||||
Added @1 XP to @2, total: @3, experience level: @4=
|
||||
XP are disabled!=
|
||||
|
|
|
@ -86,6 +86,11 @@ mobs_disable_blood (Disable mob damage particles) bool false
|
|||
flame_sound (Flame sound) bool true
|
||||
|
||||
[Experimental]
|
||||
# Whether to use experience.
|
||||
# Note that experience points are currently useless.
|
||||
|
||||
mcl_experience (Experience) bool false
|
||||
|
||||
# Whether ice is translucent. If disabled, ice is fully opaque.
|
||||
#
|
||||
# Note: As of Minetest version 5.1.0, translucent ice above oceans
|
||||
|
|
Loading…
Reference in a new issue