[add] Adding integration to 'computing' mod apps.

This commit is contained in:
Lunovox 2024-11-19 14:27:03 -03:00
parent 30775e527f
commit 1627146ffe
3 changed files with 25 additions and 49 deletions

View file

@ -10,6 +10,7 @@ dofile(modPath.."/item_atm.lua")
--dofile(modPath.."/item_strongbox.lua") --dofile(modPath.."/item_strongbox.lua")
--dofile(modPath.."/item_strongbox_old.lua") --dofile(modPath.."/item_strongbox_old.lua")
dofile(modPath.."/item_minercash.lua") dofile(modPath.."/item_minercash.lua")
dofile(modPath.."/item_computing_app.lua")
--dofile(path.."/item_rent_door.lua") --dofile(path.."/item_rent_door.lua")
dofile(modPath.."/api_payday.lua") dofile(modPath.."/api_payday.lua")
--dofile(modPath.."/commands.lua") --dofile(modPath.."/commands.lua")

23
item_computing_app.lua Normal file
View file

@ -0,0 +1,23 @@
if core.global_exists("modComputing") then
modComputing.add_app("minertrade:btnWebBank", {
icon_name = "btnWebBank",
icon_title = modMinerTrade.translate("WEB BANK"),
icon_descryption = modMinerTrade.translate("Allows you to access the bank account anywhere in the world."),
icon_type = "button", --types: button/button_exit
icon_image = "obj_credit_card.png",
on_iconclick = function(player)
local playername = player:get_player_name()
core.log(
"action","[MINERTRADE] "
..modCorreio.translate(
"Player '@1' is trying to access the bank account via the '@2'!"
, playername
, "computing app"
)
)
modMinerTrade.showAccountBank.inCreditCard(playername, playername)
end,
})
end

View file

@ -273,61 +273,13 @@ minetest.register_alias(
minetest.register_craftitem("minertrade:creditcard", { minetest.register_craftitem("minertrade:creditcard", {
description = core.colorize("#00FF00", description = core.colorize("#00FF00",
modMinerTrade.translate("CREDIT CARD") modMinerTrade.translate("CREDIT CARD")
).."\n\t* "..modMinerTrade.translate("Allows you to access the bank account of the credit card owner anywhere in the world."), ).."\n\t* "..modMinerTrade.translate("Allows you to access the bank account anywhere in the world."),
inventory_image = "obj_credit_card.png", inventory_image = "obj_credit_card.png",
--stack_max=9, --Acumula 9 por slot --stack_max=9, --Acumula 9 por slot
groups = {cash=0, trade=1}, groups = {cash=0, trade=1},
on_use = function(itemstack, player) on_use = function(itemstack, player)
--[[
modMinerTrade.showInventory(
clicker,
clickername,
modMinerTrade.translate("PUBLIC ATM - Account of '%s':"):format(clickername)
)
--]]
local playername = player:get_player_name() local playername = player:get_player_name()
--modMinerTrade.doSoundPlayer(playername, "sfx_atm", 5)
--modMinerTrade.showAtm.frmMain(playername)
modMinerTrade.showAccountBank.inCreditCard(playername, playername) modMinerTrade.showAccountBank.inCreditCard(playername, playername)
--[[
local playername = player:get_player_name()
local meta = itemstack:get_meta()
local old_data = minetest.deserialize(itemstack:get_metadata())
if old_data then
meta:from_table({ fields = old_data })
end
local tmpDatabase = meta:to_table().fields
if type(tmpDatabase.ownername)~="string" or tmpDatabase.ownername=="" then
tmpDatabase.ownername = playername
tmpDatabase.description = modMinerTrade.translate("CREDIT CARD of '%s'"):format(tmpDatabase.ownername)
local invPlayer = player:get_inventory()
local new_stack
local count = itemstack:get_count()
itemstack:set_count(count - 1)
new_stack = ItemStack("minertrade:creditcard")
new_stack:get_meta():from_table({ fields = tmpDatabase })
if invPlayer:room_for_item("main", new_stack) then
invPlayer:add_item("main", new_stack)
else
minetest.add_item(player:get_pos(), new_stack)
end
minetest.chat_send_player(playername,
core.colorize("#00FF00", "["..modMinerTrade.translate("CREDIT CARD").."]: ")
..modMinerTrade.translate("Your name has been saved to this credit card. Anyone using this credit card will be able to access the '%s' bank account."):format(tmpDatabase.ownername)
)
minetest.sound_play("sfx_alert", {object=player, max_hear_distance=5.0,})
return itemstack
end
modMinerTrade.showInventory(
player,
tmpDatabase.ownername,
modMinerTrade.translate("ACCOUNT BANK of '%s':"):format(tmpDatabase.ownername)
)
return itemstack
--]]
end, end,
}) })