From 2ef3d5919e31cbe3f8254321efd8ddfe6c47bf81 Mon Sep 17 00:00:00 2001 From: luk3yx Date: Sat, 7 Aug 2021 16:11:08 +1200 Subject: [PATCH] Rename cr to Mg for consistency with the currency mod. --- README.md | 6 +++--- atm-core.lua | 10 +++++----- core.lua | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index fd98024..02ff442 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ The following lurkcoin-specific functions and variables exist: - `lurkcoin.get_exchange_rate(amount, to, callback)`: Get an exchange rate from this server. - `lurkcoin.pay(from, to, server, amount, callback)`: Makes `from` pay someone - `amount`cr, and calls `callback` on success/faliure. `callback` should have two + `amount`Mg, and calls `callback` on success/faliure. `callback` should have two parameters, `success` and `msg`. - `lurkcoin.server_name`: The account name used to log into lurkcoin. @@ -59,7 +59,7 @@ The below functions (except `getbal` and `pay`) return `true` on success and - `lurkcoin.bank.subtract(name, amount, reason)`: Subtracts `amount` from `name`'s balance. Will return false if `amount` is below `0`. - `lurkcoin.bank.pay(from, to, amount)`: Makes user `from` pay a user - `amount`cr. This will return two values, `success` (true/false) and + `amount` Mg. This will return two values, `success` (true/false) and `message` (a string). #### Changing the currently used bank @@ -77,4 +77,4 @@ implemented (except `pay`) must have the same return values as described in this documentation, and are entirely optional (they will be automatically created if they are not included). Any missing functions are "filled in" automatically. -*By default, payments are rounded down to the nearest 0.01cr.* +*By default, payments are rounded down to the nearest 0.01 Mg.* diff --git a/atm-core.lua b/atm-core.lua index 06ba3eb..b229df0 100644 --- a/atm-core.lua +++ b/atm-core.lua @@ -40,11 +40,11 @@ local function get_formspec(name, page, params) -- The formspec template local formspec = 'size[8,9]' .. lurkcoin.formspec_prepend .. 'label[0.5,1.75;Your balance: ' .. - e(lurkcoin.bank.getbal(name)) .. 'cr.]' .. + e(lurkcoin.bank.getbal(name)) .. 'Mg.]' .. centre_label('1,0.55;6,0.5', 'Welcome to a ' .. lurkcoin.server_name .. ' ATM!') .. 'label[0.5,2.25;Exchange rate: \194\1641.00 is equal to ' .. - e(lurkcoin.exchange_rate) .. 'cr.]' .. + e(lurkcoin.exchange_rate) .. 'Mg.]' .. centre_label('1.75,1.05;4.5,0.5', 'Your account: ' .. name) .. 'image[0.5,0.5;1,1;' .. formspec_img .. ']' .. 'image[6.5,0.5;1,1;' .. formspec_img .. ']' @@ -73,7 +73,7 @@ function formspecs.pay(name, fields) 'field[0.8,4.8;7,1;server;Server the user is on;' .. e(fields.server or lurkcoin.server_name) .. ']' .. 'field_close_on_enter[server;false]' .. - 'field[0.8,6.15;7,1;amount;Amount to pay (in cr);' .. + 'field[0.8,6.15;7,1;amount;Amount to pay (in Mg);' .. e(fields.amount or '5.00') .. ']' .. 'field_close_on_enter[amount;false]' @@ -100,12 +100,12 @@ function formspecs.pay(name, fields) fields._exchange_rate = data return lurkcoin.show_atm(name, 'pay', fields) end) - return formspec .. '\n' .. fields.amount .. 'cr is equal to' .. + return formspec .. '\n' .. fields.amount .. 'Mg is equal to' .. ' ...\n\n(Calculating...)]' end exc = tostring(math.floor(exc * 100) / 100) - formspec = formspec .. '\n' .. fields.amount .. 'cr is ' .. + formspec = formspec .. '\n' .. fields.amount .. 'Mg is ' .. 'equal to ' .. exc .. '.' end formspec = formspec .. ']' .. diff --git a/core.lua b/core.lua index 741740d..8144275 100644 --- a/core.lua +++ b/core.lua @@ -113,7 +113,7 @@ local function sync_callback(res) if not acknowledged_transactions[id] then if lurkcoin.bank.user_exists(t.target) then acknowledged_transactions[id] = true - logf('[%s] \194\164%s (sent %s, received %scr) - ' .. + logf('[%s] \194\164%s (sent %s, received %sMg) - ' .. 'Transaction from %q on %q to %q.', t.id, t.amount, t.sent_amount, t.received_amount, t.source, t.source_server, t.target) @@ -218,7 +218,7 @@ function lurkcoin.pay(source, target, target_server, amount, callback) local_currency = true }, function(res) if res.success then - logf('User %q paid %q (on server %q) %scr.', source, target, + logf('User %q paid %q (on server %q) %sMg.', source, target, target_server, amount) return callback(true, 'Transaction sent!') end