diff --git a/init.lua b/init.lua index 9a52f16..583aaf4 100644 --- a/init.lua +++ b/init.lua @@ -4,7 +4,7 @@ bounty.data = {} bounty.prizes = false --determines if prizes or amount per points game-mechanic is used if true then bounty.prizes = 'currency:minegeld_100' - bounty.points_per_prize = 20 --per 100 points you get a default:steel_ingot + bounty.points_per_prize = 100 --per 100 points you get a default:steel_ingot else bounty.prizes = { [20] = 'default:wood 50', -- for bounties that are higher then 100 iron ingots are given @@ -49,14 +49,20 @@ end bounty.set_nametag_color = function(player_name) local player = minetest.get_player_by_name(player_name) local props = player:get_properties() - if bounty.data[player_name] > 100 then + if bounty.data[player_name] > 10000 then + player:set_properties({ nametag_color = "#ffffff" }) + elseif bounty.data[player_name] > 1000 then player:set_properties({ nametag_color = "#ff0000" }) - elseif bounty.data[player_name] > 50 then + elseif bounty.data[player_name] > 500 then player:set_properties({ nametag_color = "#ffa500" }) - elseif bounty.data[player_name] > 0 then + elseif bounty.data[player_name] > 100 then player:set_properties({ nametag_color = "#ffff00" }) else - player:set_properties({ nametag_color = "#00ff00" }) + if not core.check_player_privs(player_name, { fediauth_authorized = true }) then + player:set_properties({ nametag_color = "#00ff00" }) + else + player:set_properties({ nametag_color = "#0000ff" }) + end end end @@ -100,12 +106,12 @@ bounty.notify = function(player_name, amount) core.chat_send_all(player_name .. " no longer has a bounty") end if type(bounty.prizes) == 'string' then - core.chat_send_all(player_name .. "'s bounty is equal to " .. bounty.get_player_bounty(player_name)) + core.chat_send_all(player_name .. "'s bounty is $" .. bounty.get_player_bounty(player_name).split(" ")[1] .. "00") else for key, value in pairs(bounty.prizes) do if bounty.data[player_name] > key and bounty.data[player_name] - amount < key then - core.chat_send_all(player_name .. "'s bounty has changed to " .. - bounty.get_player_bounty(player_name)) + core.chat_send_all(player_name .. "'s bounty has changed to $" .. + bounty.get_player_bounty(player_name).split(" ")[1] .. "00") break end end @@ -122,7 +128,7 @@ bounty.drop_prize = function(player) end bounty.get_player_bounty = function(player_name) - local prize = ' has griefed a little bit' + local prize = ' has no bounty' if type(bounty.prizes) == 'string' then local amount = math.floor(bounty.data[player_name] / bounty.points_per_prize) if bounty.data[player_name] >= bounty.points_per_prize then @@ -150,21 +156,25 @@ end --chatcommands for testing purposes core.register_chatcommand('bounty', { - description = 'Place bounty on offenders and increasing the bounty by 20', + description = 'Place bounty on offenders and increasing the bounty by 100', privs = { interact = true }, func = function(name, params) if bounty.player_exists(params) then - bounty.increase(params, 20) + local inv = core.get_inventory({ type="player", name=name }) + if inv:contains_item("main", "currency:minegeld_100") then + inv:remove_item("main", "currency:minegeld_100") + bounty.increase(params, 100) + end end end }) core.register_chatcommand('forgive', { - description = 'Forgive offender and decrease bounty by 20', + description = 'Forgive offender and decrease bounty by 100', privs = { interact = true }, func = function(name, params) if bounty.player_exists(params) then - bounty.decrease(params, 20) + bounty.decrease(params, 100) end end })