aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgpcf <gpcf@gpcf.eu>2024-09-22 21:21:09 +0200
committergpcf <gpcf@gpcf.eu>2024-09-22 21:21:09 +0200
commit1dcf3af5ab71dccad7b12f4240b62ee695a6dd9a (patch)
tree8f790a7ee6b66160efb9afe94e63399c18234e52
parentace14bc0c24ff0fb1901727a088d651e2473cac5 (diff)
downloadatm-1dcf3af5ab71dccad7b12f4240b62ee695a6dd9a.tar.gz
atm-1dcf3af5ab71dccad7b12f4240b62ee695a6dd9a.tar.bz2
atm-1dcf3af5ab71dccad7b12f4240b62ee695a6dd9a.zip
Add command to view financesHEADmaster
-rw-r--r--init.lua2
-rw-r--r--welfare.lua (renamed from interest.lua)15
2 files changed, 16 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 3ccba60..3157894 100644
--- a/init.lua
+++ b/init.lua
@@ -601,7 +601,7 @@ minetest.register_craft({
}
})
-dofile(modpath .. "/interest.lua")
+dofile(modpath .. "/welfare.lua")
atm.readaccounts()
minetest.register_on_shutdown(atm.saveaccounts)
diff --git a/interest.lua b/welfare.lua
index ffcc0fc..964c2f6 100644
--- a/interest.lua
+++ b/welfare.lua
@@ -46,3 +46,18 @@ minetest.register_chatcommand("give_welfare", {
end,
})
+minetest.register_chatcommand("view_finances", {
+ description = "view a player's finances",
+ params = "<player>",
+ privs = { kick = true },
+ func = function (name, plname)
+ if not atm.balance[plname] then
+ return false, plname.." does not have a bank account!"
+ end
+ minetest.chat_send_player(name, "Account balance: "..atm.balance[plname])
+ if atm.welfare[plname] then
+ minetest.chat_send_player(name, "Remaining welfare: "..atm.welfare[plname])
+ end
+ return true
+ end
+})