mirror of
https://gitlab.com/lunovox/minertrade.git
synced 2025-03-15 05:31:20 +00:00
Correção de bug grotesco! =(
This commit is contained in:
parent
3ecd89974b
commit
923a61e1b7
4 changed files with 121 additions and 76 deletions
53
api.lua
53
api.lua
|
@ -179,13 +179,50 @@ modMinerTrade.floor_pos = function(pos)
|
|||
}
|
||||
end
|
||||
|
||||
modMinerTrade.getPosMachineName = function(pos)
|
||||
modMinerTrade.getPosMachineName = function(posMachine)
|
||||
if type(posMachine)=="table" and type(posMachine.x)=="number" and type(posMachine.y)=="number" and type(posMachine.z)=="number" then
|
||||
return minetest.pos_to_string(modMinerTrade.floor_pos(posMachine))
|
||||
else
|
||||
minetest.log(
|
||||
"error",("[modMinerTrade.sendMailMachine(pos='%s')] "):format(dump(posMachine), dump(ownername), dump(message))
|
||||
..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("pos")
|
||||
"error",("[modMinerTrade.getPosMachineName(posMachine='%s')] "):format(dump(posMachine))
|
||||
..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("posMachine")
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
modMinerTrade.setMachineFlagsAlert = function (posMachine, value)
|
||||
if type(posMachine)=="table" and type(posMachine.x)=="number" and type(posMachine.y)=="number" and type(posMachine.z)=="number" then
|
||||
local posMachineName = modMinerTrade.getPosMachineName(posMachine)
|
||||
|
||||
if type(modMinerTrade.machine_flags)~="table" then modMinerTrade.machine_flags={} end
|
||||
if type(modMinerTrade.machine_flags[posMachineName])~="table" then modMinerTrade.machine_flags[posMachineName]={} end
|
||||
if type(value)=="number" and value>=0 then
|
||||
modMinerTrade.machine_flags[posMachineName].lastalert = value
|
||||
else
|
||||
minetest.log(
|
||||
"error",("[modMinerTrade.setMachineFlagsAlert(posMachine='%s', value='%d')] "):format(dump(posMachine), dump(value))
|
||||
..modMinerTrade.translate("The '%s' parameter must be of the non-empty string type!"):format("message")
|
||||
)
|
||||
end
|
||||
else
|
||||
minetest.log(
|
||||
"error",("[modMinerTrade.setMachineFlagsAlert(posMachine='%s', value='%s')] "):format(dump(posMachine), dump(dump))
|
||||
..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("posMachine")
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
modMinerTrade.getMachineFlagsAlert = function (posMachine)
|
||||
if type(posMachine)=="table" and type(posMachine.x)=="number" and type(posMachine.y)=="number" and type(posMachine.z)=="number" then
|
||||
local posMachineName = modMinerTrade.getPosMachineName(posMachine)
|
||||
if type(modMinerTrade.machine_flags)~="table" then modMinerTrade.machine_flags={} end
|
||||
if type(modMinerTrade.machine_flags[posMachineName])~="table" then modMinerTrade.machine_flags[posMachineName]={} end
|
||||
if type(modMinerTrade.machine_flags[posMachineName].lastalert)~="number" or modMinerTrade.machine_flags[posMachineName].lastalert < 0 then modMinerTrade.machine_flags[posMachineName].lastalert = 0 end
|
||||
return modMinerTrade.machine_flags[posMachineName].lastalert
|
||||
else
|
||||
minetest.log(
|
||||
"error",("[modMinerTrade.getMachineFlagsAlert(posMachine='%s', value='%s')] "):format(dump(posMachine), dump(dump))
|
||||
..modMinerTrade.translate("The '%s' parameter must be of the position type (x,y,z)!"):format("posMachine")
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -194,15 +231,13 @@ modMinerTrade.sendMailMachine = function(posMachine, ownername, message)
|
|||
if minetest.get_modpath("correio") then
|
||||
local mailMachineInterval = (60*60)
|
||||
if type(posMachine)=="table" and type(posMachine.x)=="number" and type(posMachine.y)=="number" and type(posMachine.z)=="number" then
|
||||
local posMachineName = modMinerTrade.getPosMachineName(posMachine)
|
||||
if type(ownername)=="string" and ownername:trim()~="" and minetest.player_exists(ownername) then --Checks whether the owner really exists.
|
||||
if type(message)=="string" and message:trim()~="" then
|
||||
local agora = os.time()
|
||||
if type(modMinerTrade.machine_flags)~="table" then modMinerTrade.machine_flags={} end
|
||||
if type(modMinerTrade.machine_flags[posMachineName])~="table" then modMinerTrade.machine_flags[posMachineName]={} end
|
||||
if type(modMinerTrade.machine_flags[posMachineName].lastalert)~="number" or modMinerTrade.machine_flags[posMachineName].lastalert + mailMachineInterval < agora then
|
||||
local macFlag = modMinerTrade.getMachineFlagsAlert(posMachine)
|
||||
if macFlag + mailMachineInterval < agora then
|
||||
local carta = modCorreio.set_mail(
|
||||
modMinerTrade.translate("DISPENSING MACHINE").." "..posMachineName,
|
||||
modMinerTrade.translate("DISPENSING MACHINE").." "..modMinerTrade.getPosMachineName(posMachine),
|
||||
ownername,
|
||||
message:trim()
|
||||
)
|
||||
|
@ -217,7 +252,7 @@ modMinerTrade.sendMailMachine = function(posMachine, ownername, message)
|
|||
..modMinerTrade.translate("Due to an unknown error, it was not possible to send an email through the dispensing machine!")
|
||||
)
|
||||
end
|
||||
modMinerTrade.machine_flags[posMachineName].lastalert = agora
|
||||
modMinerTrade.setMachineFlagsAlert(posMachine, agora)
|
||||
end --if type(modMinerTrade.machine_flags[posMachineName].lastalert)~="number" or modMinerTrade.machine_flags[posMachineName].lastalert + mailMachineInterval < agora then
|
||||
else
|
||||
minetest.log(
|
||||
|
|
|
@ -44,7 +44,7 @@ modMinerTrade.dispensing.formspec = {
|
|||
.."background[-0.25,-0.25;8.50,11.50;dispensador_traz.png]"
|
||||
--listcolors[slot_bg_normal;slot_bg_hover;slot_border;tooltip_bgcolor;tooltip_fontcolor]
|
||||
.."listcolors[#004400EE;#008800;#00FF00;#CCCC00;#FFFFFF]"
|
||||
.."label[0,0;"..minetest.formspec_escape(modMinerTrade.translate("Items Received (Your Profit)"))..":]"
|
||||
.."label[0,0;"..minetest.formspec_escape(modMinerTrade.translate("Received (Your Profit)"))..":]"
|
||||
.."list["..list_name..";customers_gave;0,0.5;3,2;]"
|
||||
.."label[0,2.5;"..minetest.formspec_escape(modMinerTrade.translate("Stock to Offer"))..":]"
|
||||
.."list["..list_name..";stock;0,3;3,2;]"
|
||||
|
@ -160,6 +160,7 @@ minetest.register_node("minertrade:dispensingmachine", {
|
|||
inv:set_size("stock", 3*2)
|
||||
inv:set_size("owner_wants", 3*2)
|
||||
inv:set_size("owner_gives", 3*2)
|
||||
modMinerTrade.setMachineFlagsAlert(posMachine, 0)--0 = Can send new emails
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
--print("minertrade:dispensing.on_rightclick aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
||||
|
@ -213,7 +214,9 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields)
|
|||
local sendername = sender:get_player_name()
|
||||
local pos = modMinerTrade.dispensing.loja_atual[sendername]
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local ownername = meta:get_string("owner")
|
||||
local ownername = meta:get_string("owner") or ""
|
||||
local offer = meta:get_string("offer") or ""
|
||||
|
||||
--minetest.chat_send_player(sendername,"ownername('"..ownername.."') == sendername('"..sendername.."')")
|
||||
|
||||
if modMinerTrade.dispensing.canOpen(pos, sendername) and sender:get_player_control().aux1 then
|
||||
|
@ -294,21 +297,21 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields)
|
|||
..modMinerTrade.translate("Dispending done!")
|
||||
)
|
||||
minetest.sound_play("sfx_cash_register", {object=sender, max_hear_distance=5.0,})
|
||||
modMinerTrade.machine_flags[modMinerTrade.getPosMachineName(posMachine)].lastalert = 0 --0 = Can sedn emails
|
||||
modMinerTrade.setMachineFlagsAlert(posMachine, 0)--0 = Can send new emails
|
||||
else
|
||||
if error_name == "owners_fault" then
|
||||
minetest.errorDispensing(
|
||||
modMinerTrade.translate(
|
||||
--"The stock of '%s' is gone."
|
||||
"Cannot deliver more items to '%s' because stock of '%s' is gone!"
|
||||
):format(sendername, ownername)
|
||||
"The Dispensing Machine with offer '%s' cannot deliver more items to '%s' because stock of '%s' is empty!"
|
||||
):format(offer, sendername, ownername)
|
||||
,sender ,pos ,ownername
|
||||
)
|
||||
elseif error_name == "without_space_to_profit" then
|
||||
minetest.errorDispensing(
|
||||
modMinerTrade.translate(
|
||||
"Without enough space in Dispensing Machine to receive the customer item '%s'."
|
||||
):format(sendername)
|
||||
"The Dispensing Machine with offer '%s' is out of space to receive customer item '%s'."
|
||||
):format(offer, sendername)
|
||||
,sender ,pos ,ownername
|
||||
)
|
||||
elseif error_name == "without_space_to_offer" then
|
||||
|
|
68
locale/pt.po
68
locale/pt.po
|
@ -7,8 +7,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-04-14 21:11-0300\n"
|
||||
"PO-Revision-Date: 2020-04-14 21:19-0300\n"
|
||||
"POT-Creation-Date: 2020-04-15 20:34-0300\n"
|
||||
"PO-Revision-Date: 2020-04-15 20:36-0300\n"
|
||||
"Last-Translator: Lunovox Heavenfinder <lunovox@disroot.org>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: pt\n"
|
||||
|
@ -54,18 +54,23 @@ msgstr "O jogador '%s' colocou %02d '%s' em seu cofre!"
|
|||
msgid "Player '%s' has removed %02d '%s' in his safe!"
|
||||
msgstr "O jogador '%s' retirou %02d '%s' em seu cofre!"
|
||||
|
||||
#: api.lua:188 api.lua:237
|
||||
#: api.lua:188 api.lua:210 api.lua:225 api.lua:272
|
||||
#, lua-format
|
||||
msgid "The '%s' parameter must be of the position type (x,y,z)!"
|
||||
msgstr "O parâmetro '%s' deve ser do tipo de POSITION (x,y,z)!"
|
||||
|
||||
#: api.lua:205 api.lua:247 item_dispensing_machine.lua:13
|
||||
#: item_dispensing_machine.lua:203 item_dispensing_machine.lua:221
|
||||
#: item_dispensing_machine.lua:293
|
||||
#: api.lua:204 api.lua:260 api.lua:266 api.lua:291
|
||||
#, lua-format
|
||||
msgid "The '%s' parameter must be of the non-empty string type!"
|
||||
msgstr "O parâmetro '%s' deve ser do tipo de STRING não vazia!"
|
||||
|
||||
#: api.lua:240 api.lua:282 item_dispensing_machine.lua:13
|
||||
#: item_dispensing_machine.lua:204 item_dispensing_machine.lua:224
|
||||
#: item_dispensing_machine.lua:296
|
||||
msgid "DISPENSING MACHINE"
|
||||
msgstr "MÁQUINA DE DISPENSADORA"
|
||||
|
||||
#: api.lua:211
|
||||
#: api.lua:246
|
||||
#, lua-format
|
||||
msgid ""
|
||||
"A letter was sent by the dispensing machine '%s' to '%s' advising about '%s'!"
|
||||
|
@ -73,7 +78,7 @@ msgstr ""
|
|||
"Uma carta foi enviada pela Máquina Dispensadora '%s' para '%s' informando "
|
||||
"sobre '%s'!"
|
||||
|
||||
#: api.lua:217
|
||||
#: api.lua:252
|
||||
msgid ""
|
||||
"Due to an unknown error, it was not possible to send an email through the "
|
||||
"dispensing machine!"
|
||||
|
@ -81,11 +86,6 @@ msgstr ""
|
|||
"Devido a um erro desconhecido, não foi possível enviar um email através da "
|
||||
"Máquina Dispensadora!"
|
||||
|
||||
#: api.lua:225 api.lua:231 api.lua:256
|
||||
#, lua-format
|
||||
msgid "The '%s' parameter must be of the non-empty string type!"
|
||||
msgstr "O parâmetro '%s' deve ser do tipo de STRING não vazia!"
|
||||
|
||||
#: commands.lua:2 commands.lua:9 commands.lua:27
|
||||
msgid "Lets you check the contents of another players strongbox."
|
||||
msgstr "Permite verificar o conteúdo do cofre de outro jogador."
|
||||
|
@ -167,7 +167,7 @@ msgid "The Machine Offer"
|
|||
msgstr "Máquina Oferece"
|
||||
|
||||
#: item_dispensing_machine.lua:47
|
||||
msgid "Items Received (Your Profit)"
|
||||
msgid "Received (Your Profit)"
|
||||
msgstr "Recebido (Seu Lucro)"
|
||||
|
||||
#: item_dispensing_machine.lua:49
|
||||
|
@ -206,39 +206,43 @@ msgstr ""
|
|||
"MÁQUINA DE DISPENSADORA\n"
|
||||
"* Vende seus itens, mesmo se você não estiver online."
|
||||
|
||||
#: item_dispensing_machine.lua:154 item_dispensing_machine.lua:232
|
||||
#: item_dispensing_machine.lua:237
|
||||
#: item_dispensing_machine.lua:154 item_dispensing_machine.lua:235
|
||||
#: item_dispensing_machine.lua:240
|
||||
#, lua-format
|
||||
msgid "Dispensing Machine of '%s'."
|
||||
msgstr "Maquina Dispensadora de '%s'."
|
||||
|
||||
#: item_dispensing_machine.lua:204
|
||||
#: item_dispensing_machine.lua:205
|
||||
msgid "The Dispensing Machine can not be removed before being emptied!"
|
||||
msgstr "A Máquina Dispensadora não pode ser retirada antes de ser esvaziada!"
|
||||
|
||||
#: item_dispensing_machine.lua:222
|
||||
#: item_dispensing_machine.lua:225
|
||||
msgid "You can not change your own machine!"
|
||||
msgstr "Você não pode trocar na sua própria maquina!"
|
||||
|
||||
#: item_dispensing_machine.lua:294
|
||||
#: item_dispensing_machine.lua:297
|
||||
msgid "Dispending done!"
|
||||
msgstr "Dispensa Concluida!"
|
||||
|
||||
#: item_dispensing_machine.lua:303
|
||||
#, lua-format
|
||||
msgid "Cannot deliver more items to '%s' because stock of '%s' is gone!"
|
||||
msgstr ""
|
||||
"Não é possível entregar mais itens para '%s' porque o estoque de '%s' acabou!"
|
||||
|
||||
#: item_dispensing_machine.lua:310
|
||||
#: item_dispensing_machine.lua:306
|
||||
#, lua-format
|
||||
msgid ""
|
||||
"Without enough space in Dispensing Machine to receive the customer item '%s'."
|
||||
"The Dispensing Machine with offer '%s' cannot deliver more items to '%s' "
|
||||
"because stock of '%s' is empty!"
|
||||
msgstr ""
|
||||
"Sem espaço suficiente na Maquina Dispensadora para receber o item do cliente "
|
||||
"'%s'."
|
||||
"A Máquina Dispensadora com oferta '%s' não é possível entregar mais itens "
|
||||
"para '%s' porque o estoque de '%s' acabou!"
|
||||
|
||||
#: item_dispensing_machine.lua:316
|
||||
#: item_dispensing_machine.lua:313
|
||||
#, lua-format
|
||||
msgid ""
|
||||
"The Dispensing Machine with offer '%s' is out of space to receive customer "
|
||||
"item '%s'."
|
||||
msgstr ""
|
||||
"A Maquina Dispensadora com oferta '%s' está sem espaço suficiente para "
|
||||
"receber o item do cliente '%s'."
|
||||
|
||||
#: item_dispensing_machine.lua:319
|
||||
msgid ""
|
||||
"Without enough space in Dispensing Machine to receive the seller's item. "
|
||||
"(Please, empty the receiving box!)"
|
||||
|
@ -246,7 +250,7 @@ msgstr ""
|
|||
"Sem espaço suficiente na Maquina Dispensadora para receber o item do "
|
||||
"vendedor. (Por favor, esvazie a caixa de recebimento!)"
|
||||
|
||||
#: item_dispensing_machine.lua:321
|
||||
#: item_dispensing_machine.lua:324
|
||||
msgid ""
|
||||
"The dispending can not be done. Make sure you offer what the machine asks "
|
||||
"for!"
|
||||
|
@ -254,7 +258,7 @@ msgstr ""
|
|||
"A dispensa não pode ser feita. Verifique se você ofereceu o que a Maquina "
|
||||
"Dispensadora pede!"
|
||||
|
||||
#: item_dispensing_machine.lua:343
|
||||
#: item_dispensing_machine.lua:346
|
||||
msgid "dispensingmachine"
|
||||
msgstr "dispensadora"
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-04-14 21:11-0300\n"
|
||||
"POT-Creation-Date: 2020-04-15 20:34-0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -53,34 +53,34 @@ msgstr ""
|
|||
msgid "Player '%s' has removed %02d '%s' in his safe!"
|
||||
msgstr ""
|
||||
|
||||
#: api.lua:188 api.lua:237
|
||||
#: api.lua:188 api.lua:210 api.lua:225 api.lua:272
|
||||
#, lua-format
|
||||
msgid "The '%s' parameter must be of the position type (x,y,z)!"
|
||||
msgstr ""
|
||||
|
||||
#: api.lua:205 api.lua:247 item_dispensing_machine.lua:13
|
||||
#: item_dispensing_machine.lua:203 item_dispensing_machine.lua:221
|
||||
#: item_dispensing_machine.lua:293
|
||||
#: api.lua:204 api.lua:260 api.lua:266 api.lua:291
|
||||
#, lua-format
|
||||
msgid "The '%s' parameter must be of the non-empty string type!"
|
||||
msgstr ""
|
||||
|
||||
#: api.lua:240 api.lua:282 item_dispensing_machine.lua:13
|
||||
#: item_dispensing_machine.lua:204 item_dispensing_machine.lua:224
|
||||
#: item_dispensing_machine.lua:296
|
||||
msgid "DISPENSING MACHINE"
|
||||
msgstr ""
|
||||
|
||||
#: api.lua:211
|
||||
#: api.lua:246
|
||||
#, lua-format
|
||||
msgid ""
|
||||
"A letter was sent by the dispensing machine '%s' to '%s' advising about '%s'!"
|
||||
msgstr ""
|
||||
|
||||
#: api.lua:217
|
||||
#: api.lua:252
|
||||
msgid ""
|
||||
"Due to an unknown error, it was not possible to send an email through the "
|
||||
"dispensing machine!"
|
||||
msgstr ""
|
||||
|
||||
#: api.lua:225 api.lua:231 api.lua:256
|
||||
#, lua-format
|
||||
msgid "The '%s' parameter must be of the non-empty string type!"
|
||||
msgstr ""
|
||||
|
||||
#: commands.lua:2 commands.lua:9 commands.lua:27
|
||||
msgid "Lets you check the contents of another players strongbox."
|
||||
msgstr ""
|
||||
|
@ -154,7 +154,7 @@ msgid "The Machine Offer"
|
|||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:47
|
||||
msgid "Items Received (Your Profit)"
|
||||
msgid "Received (Your Profit)"
|
||||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:49
|
||||
|
@ -191,48 +191,51 @@ msgid ""
|
|||
"* Sells your items, even if you are not online."
|
||||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:154 item_dispensing_machine.lua:232
|
||||
#: item_dispensing_machine.lua:237
|
||||
#: item_dispensing_machine.lua:154 item_dispensing_machine.lua:235
|
||||
#: item_dispensing_machine.lua:240
|
||||
#, lua-format
|
||||
msgid "Dispensing Machine of '%s'."
|
||||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:204
|
||||
#: item_dispensing_machine.lua:205
|
||||
msgid "The Dispensing Machine can not be removed before being emptied!"
|
||||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:222
|
||||
#: item_dispensing_machine.lua:225
|
||||
msgid "You can not change your own machine!"
|
||||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:294
|
||||
#: item_dispensing_machine.lua:297
|
||||
msgid "Dispending done!"
|
||||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:303
|
||||
#, lua-format
|
||||
msgid "Cannot deliver more items to '%s' because stock of '%s' is gone!"
|
||||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:310
|
||||
#: item_dispensing_machine.lua:306
|
||||
#, lua-format
|
||||
msgid ""
|
||||
"Without enough space in Dispensing Machine to receive the customer item '%s'."
|
||||
"The Dispensing Machine with offer '%s' cannot deliver more items to '%s' "
|
||||
"because stock of '%s' is empty!"
|
||||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:316
|
||||
#: item_dispensing_machine.lua:313
|
||||
#, lua-format
|
||||
msgid ""
|
||||
"The Dispensing Machine with offer '%s' is out of space to receive customer "
|
||||
"item '%s'."
|
||||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:319
|
||||
msgid ""
|
||||
"Without enough space in Dispensing Machine to receive the seller's item. "
|
||||
"(Please, empty the receiving box!)"
|
||||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:321
|
||||
#: item_dispensing_machine.lua:324
|
||||
msgid ""
|
||||
"The dispending can not be done. Make sure you offer what the machine asks "
|
||||
"for!"
|
||||
msgstr ""
|
||||
|
||||
#: item_dispensing_machine.lua:343
|
||||
#: item_dispensing_machine.lua:346
|
||||
msgid "dispensingmachine"
|
||||
msgstr ""
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue