Updated amounts and messages

This commit is contained in:
2026-04-15 18:02:43 -04:00
parent 7a95698bd1
commit db1b79cb37

View File

@@ -4,7 +4,7 @@ bounty.data = {}
bounty.prizes = false --determines if prizes or amount per points game-mechanic is used bounty.prizes = false --determines if prizes or amount per points game-mechanic is used
if true then if true then
bounty.prizes = 'currency:minegeld_100' 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 else
bounty.prizes = { bounty.prizes = {
[20] = 'default:wood 50', -- for bounties that are higher then 100 iron ingots are given [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) bounty.set_nametag_color = function(player_name)
local player = minetest.get_player_by_name(player_name) local player = minetest.get_player_by_name(player_name)
local props = player:get_properties() 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" }) 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" }) 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" }) player:set_properties({ nametag_color = "#ffff00" })
else else
if not core.check_player_privs(player_name, { fediauth_authorized = true }) then
player:set_properties({ nametag_color = "#00ff00" }) player:set_properties({ nametag_color = "#00ff00" })
else
player:set_properties({ nametag_color = "#0000ff" })
end
end end
end end
@@ -100,12 +106,12 @@ bounty.notify = function(player_name, amount)
core.chat_send_all(player_name .. " no longer has a bounty") core.chat_send_all(player_name .. " no longer has a bounty")
end end
if type(bounty.prizes) == 'string' then 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 else
for key, value in pairs(bounty.prizes) do for key, value in pairs(bounty.prizes) do
if bounty.data[player_name] > key and bounty.data[player_name] - amount < key then 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 " .. core.chat_send_all(player_name .. "'s bounty has changed to $" ..
bounty.get_player_bounty(player_name)) bounty.get_player_bounty(player_name).split(" ")[1] .. "00")
break break
end end
end end
@@ -122,7 +128,7 @@ bounty.drop_prize = function(player)
end end
bounty.get_player_bounty = function(player_name) 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 if type(bounty.prizes) == 'string' then
local amount = math.floor(bounty.data[player_name] / bounty.points_per_prize) local amount = math.floor(bounty.data[player_name] / bounty.points_per_prize)
if bounty.data[player_name] >= bounty.points_per_prize then if bounty.data[player_name] >= bounty.points_per_prize then
@@ -150,21 +156,25 @@ end
--chatcommands for testing purposes --chatcommands for testing purposes
core.register_chatcommand('bounty', { 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 }, privs = { interact = true },
func = function(name, params) func = function(name, params)
if bounty.player_exists(params) then 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
end end
}) })
core.register_chatcommand('forgive', { core.register_chatcommand('forgive', {
description = 'Forgive offender and decrease bounty by 20', description = 'Forgive offender and decrease bounty by 100',
privs = { interact = true }, privs = { interact = true },
func = function(name, params) func = function(name, params)
if bounty.player_exists(params) then if bounty.player_exists(params) then
bounty.decrease(params, 20) bounty.decrease(params, 100)
end end
end end
}) })