mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-06-28 06:11:47 +02:00
Removed whitespaces
This commit is contained in:
@ -150,7 +150,7 @@ function awards.register_achievement(name,data_table)
|
||||
if data_table.custom_announce == nil or data_table.custom_announce == "" then
|
||||
data_table.custom_announce = "Achievement Unlocked:"
|
||||
end
|
||||
|
||||
|
||||
-- add the achievement to the definition table
|
||||
data_table.name = name
|
||||
awards.def[name] = data_table
|
||||
@ -191,7 +191,7 @@ end
|
||||
function awards.give_achievement(name, award)
|
||||
-- Access Player Data
|
||||
local data = awards.players[name]
|
||||
|
||||
|
||||
-- Perform checks
|
||||
if not data then
|
||||
return
|
||||
@ -277,7 +277,7 @@ function awards.give_achievement(name, award)
|
||||
position = {x = 0.5, y = 0},
|
||||
offset = {x = 0, y = 40},
|
||||
alignment = {x = 0, y = -1}
|
||||
})
|
||||
})
|
||||
local three = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
name = "award_title",
|
||||
@ -287,7 +287,7 @@ function awards.give_achievement(name, award)
|
||||
position = {x = 0.5, y = 0},
|
||||
offset = {x = 30, y = 100},
|
||||
alignment = {x = 0, y = -1}
|
||||
})
|
||||
})
|
||||
local four = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
name = "award_icon",
|
||||
@ -304,10 +304,10 @@ function awards.give_achievement(name, award)
|
||||
player:hud_remove(four)
|
||||
end)
|
||||
end
|
||||
|
||||
-- record this in the log
|
||||
|
||||
-- record this in the log
|
||||
minetest.log("action", name.." has unlocked award "..title)
|
||||
|
||||
|
||||
-- save playertable
|
||||
awards.save()
|
||||
minetest.sound_play("award_award_won", {to_player = name, gain = 0.5*soundset.get_gain(name,"other")})
|
||||
@ -392,7 +392,7 @@ function awards.showto(name, to, sid, text)
|
||||
local def = awards.def[str]
|
||||
if def then
|
||||
if def.title then
|
||||
if def.description then
|
||||
if def.description then
|
||||
minetest.chat_send_player(to, def.title..": "..def.description)
|
||||
else
|
||||
minetest.chat_send_player(to, def.title)
|
||||
@ -406,9 +406,9 @@ function awards.showto(name, to, sid, text)
|
||||
if sid == nil or sid < 1 then
|
||||
sid = 1
|
||||
end
|
||||
local formspec = "size[11,5]"
|
||||
local formspec = "size[11,5]"
|
||||
local listofawards = awards._order_awards(name)
|
||||
|
||||
|
||||
-- Sidebar
|
||||
if sid then
|
||||
local item = listofawards[sid+0]
|
||||
@ -417,7 +417,7 @@ function awards.showto(name, to, sid, text)
|
||||
formspec = formspec .. "label[1,2.75;Secret Award]"..
|
||||
"image[1,0;3,3;unknown.png]"
|
||||
if def and def.description then
|
||||
formspec = formspec .. "label[0,3.25;Unlock this award to find out what it is]"
|
||||
formspec = formspec .. "label[0,3.25;Unlock this award to find out what it is]"
|
||||
end
|
||||
else
|
||||
local title = item.name
|
||||
@ -435,13 +435,13 @@ function awards.showto(name, to, sid, text)
|
||||
formspec = formspec .. "label[1,2.75;"..title..status.."]"..
|
||||
"image[1,0;3,3;"..icon.."]"
|
||||
if def and def.description then
|
||||
formspec = formspec .. "label[0,3.25;"..def.description.."]"
|
||||
formspec = formspec .. "label[0,3.25;"..def.description.."]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Create list box
|
||||
formspec = formspec .. "textlist[4.75,0;6,5;awards;"
|
||||
formspec = formspec .. "textlist[4.75,0;6,5;awards;"
|
||||
local first = true
|
||||
for _,award in pairs(listofawards) do
|
||||
local def = awards.def[award.name]
|
||||
@ -450,14 +450,14 @@ function awards.showto(name, to, sid, text)
|
||||
formspec = formspec .. ","
|
||||
end
|
||||
first = false
|
||||
|
||||
|
||||
if def.secret and not award.got then
|
||||
formspec = formspec .. "#ACACACSecret Award"
|
||||
else
|
||||
local title = award.name
|
||||
local title = award.name
|
||||
if def and def.title then
|
||||
title = def.title
|
||||
end
|
||||
end
|
||||
if award.got then
|
||||
formspec = formspec .. minetest.formspec_escape(title)
|
||||
else
|
||||
@ -465,7 +465,7 @@ function awards.showto(name, to, sid, text)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
formspec = formspec .. ";"..sid.."]"
|
||||
|
||||
-- Show formspec to user
|
||||
@ -483,11 +483,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
local name = player:get_player_name()
|
||||
if fields.awards then
|
||||
local event = minetest.explode_textlist_event(fields.awards)
|
||||
if event.type == "CHG" then
|
||||
awards.showto(name,name,event.index,false)
|
||||
end
|
||||
if event.type == "CHG" then
|
||||
awards.showto(name,name,event.index,false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return true
|
||||
end)
|
||||
|
||||
|
@ -351,7 +351,7 @@ awards.register_onDeath(function(player,data)
|
||||
local pos = player:getpos()
|
||||
if pos and minetest.find_node_near(pos, 2, "fire:basic_flame") ~= nil then
|
||||
return "award_burn"
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end)
|
||||
|
||||
@ -365,7 +365,7 @@ awards.register_onDeath(function(player,data)
|
||||
local pos = player:getpos()
|
||||
if pos and minetest.find_node_near(pos, 2, "default:lava_flowing") ~= nil then
|
||||
return "award_in_the_flow"
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end)
|
||||
|
||||
@ -379,7 +379,7 @@ awards.register_onDeath(function(player,data)
|
||||
local pos = player:getpos()
|
||||
if pos and minetest.find_node_near(pos, 5, "default:stone_with_diamond") ~= nil then
|
||||
return "award_this_is_sad"
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end)
|
||||
|
||||
@ -392,7 +392,7 @@ awards.register_onDeath(function(player,data)
|
||||
local pos = player:getpos()
|
||||
if pos and minetest.find_node_near(pos, 5, "bones:bones") ~= nil then
|
||||
return "award_the_stack"
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end)
|
||||
|
||||
|
@ -128,14 +128,14 @@ minetest.register_on_dieplayer(function(player)
|
||||
if not player or not name or name=="" then
|
||||
return
|
||||
end
|
||||
|
||||
-- Get player
|
||||
|
||||
-- Get player
|
||||
awards.assertPlayer(name)
|
||||
local data = awards.players[name]
|
||||
|
||||
-- Increment counter
|
||||
data.deaths = data.deaths + 1
|
||||
|
||||
|
||||
-- Run callbacks and triggers
|
||||
for _,trigger in pairs(awards.onDeath) do
|
||||
local res = nil
|
||||
@ -160,14 +160,14 @@ minetest.register_on_joinplayer(function(player)
|
||||
if not player or not name or name=="" then
|
||||
return
|
||||
end
|
||||
|
||||
-- Get player
|
||||
|
||||
-- Get player
|
||||
awards.assertPlayer(name)
|
||||
local data = awards.players[name]
|
||||
|
||||
-- Increment counter
|
||||
data.joins = data.joins + 1
|
||||
|
||||
|
||||
-- Run callbacks and triggers
|
||||
for _,trigger in pairs(awards.onJoin) do
|
||||
local res = nil
|
||||
@ -197,11 +197,11 @@ minetest.register_on_chat_message(function(name, message)
|
||||
awards.assertPlayer(name)
|
||||
local data = awards.players[name]
|
||||
local player = minetest.get_player_by_name(name)
|
||||
|
||||
|
||||
-- Increment counter
|
||||
data.chats = data.chats + 1
|
||||
|
||||
-- Run callbacks and triggers
|
||||
|
||||
-- Run callbacks and triggers
|
||||
for _,trigger in pairs(awards.onChat) do
|
||||
local res = nil
|
||||
if type(trigger) == "function" then
|
||||
|
Reference in New Issue
Block a user