Deleted non-needed mods dumped in random folder (whoops)
|
@ -1 +0,0 @@
|
|||
default
|
|
@ -1,128 +0,0 @@
|
|||
-- add_tool
|
||||
-- Make it easier to add a tool type (e.g. gold tools, silver tools, etc.)
|
||||
-- Copyright 2011 Mark Holmquist, licensed under GPLv3
|
||||
|
||||
-- syntax:
|
||||
-- register_tool_type(mod, type, crafttype, time, uses, extra_rules)
|
||||
-- mod = name of your mod
|
||||
-- type = type of tool
|
||||
-- crafttype = name of item used to craft the tool ('craft "default:cobble"' or similar)
|
||||
-- time = speed of the tool type (lower is faster)
|
||||
-- uses = durability
|
||||
-- extra_rules = a table with any extra rules. example:
|
||||
-- {shovel_durability = 40} -- increases the base durability of shovels by 40 uses
|
||||
-- {pick_speed = -0.2} -- decreases the amount of time taken per dig by 0.2 seconds for picks
|
||||
|
||||
-- Please note that, if you're adding your tools using this mod, it expects your texture to be of form
|
||||
-- [[modname]]_tool_[[type]]shovel.png
|
||||
-- For example:
|
||||
-- moreores_tool_goldpick.png
|
||||
|
||||
-- Updated by Calinou on 2011-01-23
|
||||
-- For More Ores mod
|
||||
|
||||
register_tool_type = function(modname, labelname, typename, crafttype, basetime, basedurability, extra_rules)
|
||||
minetest.register_craft({
|
||||
description = labelname,
|
||||
output = 'tool "'..modname..':'..typename..'_pick'..'"',
|
||||
recipe = {
|
||||
{ crafttype, crafttype, crafttype },
|
||||
{ '', 'craft "default:stick"', ''},
|
||||
{ '', 'craft "default:stick"', ''}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
description = labelname,
|
||||
output = 'tool "'..modname..':'..typename..'_shovel'..'"',
|
||||
recipe = {
|
||||
{ '', crafttype, '' },
|
||||
{ '', 'craft "default:stick"', ''},
|
||||
{ '', 'craft "default:stick"', ''}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
description = labelname,
|
||||
output = 'tool "'..modname..':'..typename..'_axe'..'"',
|
||||
recipe = {
|
||||
{ crafttype, crafttype },
|
||||
{ crafttype, 'craft "default:stick"' },
|
||||
{ '', 'craft "default:stick"'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
description = labelname,
|
||||
output = 'tool "'..modname..':'..typename..'_sword'..'"',
|
||||
recipe = {
|
||||
{ crafttype },
|
||||
{ crafttype },
|
||||
{ 'craft "default:stick"' }
|
||||
}
|
||||
})
|
||||
|
||||
local ft = basetime + (extra_rules.pick_speed or 0)
|
||||
local fd = basedurability + (extra_rules.pick_durability or 0)
|
||||
minetest.register_tool(modname..":"..typename.."_pick", {
|
||||
inventory_image = modname.."_tool_"..typename.."pick.png",
|
||||
basetime = ft,
|
||||
dt_weight = 0,
|
||||
dt_crackiness = -0.5,
|
||||
dt_crumbliness = 2,
|
||||
dt_cuttability = 0,
|
||||
basedurability = fd,
|
||||
dd_weight = 0,
|
||||
dd_crackiness = 0,
|
||||
dd_crumbliness = 0,
|
||||
dd_cuttability = 0,
|
||||
})
|
||||
|
||||
ft = basetime + (extra_rules.shovel_speed or 0)
|
||||
fd = basedurability + (extra_rules.shovel_durability or 0)
|
||||
minetest.register_tool(modname..":"..typename.."_shovel", {
|
||||
inventory_image = modname.."_tool_"..typename.."shovel.png",
|
||||
basetime = ft,
|
||||
dt_weight = 0.5,
|
||||
dt_crackiness = 2,
|
||||
dt_crumbliness = -1.5,
|
||||
dt_cuttability = 0,
|
||||
basedurability = fd,
|
||||
dd_weight = 0,
|
||||
dd_crackiness = 0,
|
||||
dd_crumbliness = 0,
|
||||
dd_cuttability = 0,
|
||||
})
|
||||
|
||||
ft = basetime + (extra_rules.axe_speed or 0)
|
||||
fd = basedurability + (extra_rules.axe_durability or 0)
|
||||
minetest.register_tool(modname..":"..typename.."_axe", {
|
||||
inventory_image = modname.."_tool_"..typename.."axe.png",
|
||||
basetime = ft,
|
||||
dt_weight = 0.5,
|
||||
dt_crackiness = -0.2,
|
||||
dt_crumbliness = 1,
|
||||
dt_cuttability = -0.5,
|
||||
basedurability = fd,
|
||||
dd_weight = 0,
|
||||
dd_crackiness = 0,
|
||||
dd_crumbliness = 0,
|
||||
dd_cuttability = 0,
|
||||
})
|
||||
|
||||
ft = basetime + (extra_rules.sword_speed or 0)
|
||||
fd = basedurability + (extra_rules.sword_durability or 0)
|
||||
minetest.register_tool(modname..":"..typename.."_sword", {
|
||||
inventory_image = modname.."_tool_"..typename.."sword.png",
|
||||
basetime = ft,
|
||||
dt_weight = 3,
|
||||
dt_crackiness = 0,
|
||||
dt_crumbliness = 1,
|
||||
dt_cuttability = -1,
|
||||
basedurability = fd,
|
||||
dd_weight = 0,
|
||||
dd_crackiness = 0,
|
||||
dd_crumbliness = 0,
|
||||
dd_cuttability = 0,
|
||||
})
|
||||
end
|
|
@ -1,11 +0,0 @@
|
|||
Tinoesroho's AuTomated Trader
|
||||
Version 0.1
|
||||
"Rudy Mentry"
|
||||
|
||||
This is a rudimentary-first-off-the-mark mod designed to automate trading/creation of coins. It currently is veryyy basic, but can already exchange a variety of blocks for COINS.
|
||||
|
||||
Suggestions & Improvements are welcome
|
||||
|
||||
:-)
|
||||
Created Feb 25 2012
|
||||
Posted Feb 27 2012
|
|
@ -1,2 +0,0 @@
|
|||
money
|
||||
moreores
|
|
@ -1,94 +0,0 @@
|
|||
|
||||
|
||||
-- Tinoesroho's AuTomated Trader
|
||||
-- Depends on money mod & moreores
|
||||
-- Version 0.2
|
||||
-- Released under terms of CC-ATTRIB-BY-SA
|
||||
|
||||
-- Setting properties
|
||||
minetest.register_node("at:at",
|
||||
{
|
||||
description = "AuTomated Trader",
|
||||
|
||||
tile_images = {"at.png"},
|
||||
|
||||
is_ground_content = true,
|
||||
|
||||
material = minetest.digprop_constanttime(999.0),
|
||||
|
||||
paramtype = "facedir_simple",
|
||||
|
||||
metadata_name = "generic",
|
||||
})
|
||||
|
||||
minetest.register_node("at:at_block_steel", {
|
||||
description = "AuTomated Trader",
|
||||
tile_images = {"at_block_steel.png"},
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_constanttime(999.0),
|
||||
paramtype = "facedir_simple",
|
||||
metadata_name = "generic",
|
||||
})
|
||||
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer) if newnode.name == "at:at" then local meta = minetest.env:get_meta(pos)
|
||||
meta:set_infotext("PAWNCH with INGOT to get COINS.") elseif newnode.name == "at:at_block_steel" then
|
||||
local meta = minetest.env:get_meta(pos) meta:set_infotext("PAWNCH WITH COIN TO GET INGOT.") end end)
|
||||
|
||||
-- On PAWNCHING
|
||||
|
||||
|
||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||
if node.name == "at:at" then
|
||||
hit_with = puncher:get_wielded_item()
|
||||
|
||||
hit_with_name = hit_with:get_name()
|
||||
|
||||
hit_with_count = hit_with:get_count()
|
||||
|
||||
if hit_with_name == "moreores:copper_ingot" then
|
||||
|
||||
puncher:get_inventory():remove_item("main", hit_with)
|
||||
puncher:get_inventory():add_item("main", "money:coin_gold")
|
||||
|
||||
minetest.chat_send_player(puncher:get_player_name(), 'Thank you for using a Tinoesroho AuTomated trader!')
|
||||
elseif hit_with_name == "moreores:tin_ingot" then
|
||||
|
||||
puncher:get_inventory():remove_item("main", hit_with)
|
||||
puncher:get_inventory():add_item("main", "money:coin_silver")
|
||||
|
||||
minetest.chat_send_player(puncher:get_player_name(), 'Thank you for using a Tinoesroho AuTomated trader!')
|
||||
elseif hit_with_name == "moreores:silver_ingot" then
|
||||
|
||||
puncher:get_inventory():remove_item("main", hit_with)
|
||||
puncher:get_inventory():add_item("main", "money:coin_gold 3")
|
||||
|
||||
minetest.chat_send_player(puncher:get_player_name(), 'Thank you for using a Tinoesroho AuTomated trader!')
|
||||
elseif hit_with_name == "moreores:gold_ingot" then
|
||||
|
||||
puncher:get_inventory():remove_item("main", hit_with)
|
||||
puncher:get_inventory():add_item("main", "money:coin_gold 6" )
|
||||
|
||||
minetest.chat_send_player(puncher:get_player_name(), 'Thank you for using a Tinoesroho AuTomated trader!')
|
||||
elseif hit_with_name == "default:cactus" then
|
||||
|
||||
puncher:get_inventory():remove_item("main", hit_with)
|
||||
puncher:get_inventory():add_item("main", "money:coin_copper")
|
||||
|
||||
minetest.chat_send_player(puncher:get_player_name(), 'Thank you for using a Tinoesroho AuTomated trader!')
|
||||
end elseif node.name == "at:at_block_steel" then
|
||||
hit_with = puncher:get_wielded_item()
|
||||
|
||||
hit_with_name = hit_with:get_name()
|
||||
|
||||
hit_with_count = hit_with:get_count()
|
||||
|
||||
if hit_with_name == "money:coin_gold" then
|
||||
puncher:get_inventory():remove_item("main", hit_with)
|
||||
puncher:get_inventory():add_item("main", "default:steel_ingot ")
|
||||
|
||||
end end
|
||||
end)
|
||||
|
||||
|
||||
print("[Tinoesroho's AuTomated Trader] Loaded & Ready to TRADE!")
|
|
@ -1,64 +0,0 @@
|
|||
|
||||
|
||||
-- Tinoesroho's AuTomated Trader
|
||||
-- Depends on money mod
|
||||
-- Version 0.1
|
||||
-- Released under terms of CC-ATTRIB-BY-SA
|
||||
|
||||
-- Setting properties
|
||||
minetest.register_node("at:at", {
|
||||
description = "AuTomated Trader",
|
||||
tile_images = {"at.png"},
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_stonelike(1.0),
|
||||
paramtype = "facedir_simple",
|
||||
metadata_name = "generic",
|
||||
})
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer)if newnode.name == "at:at" then
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:set_infotext("PAWNCH with INGOT to get COINS.")
|
||||
|
||||
end)
|
||||
|
||||
minetest.register_node("at:at_block_steel", {
|
||||
description = "AuTomated Trader",
|
||||
tile_images = {"at_block_steel.png"},
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_stonelike(1.0),
|
||||
paramtype = "facedir_simple",
|
||||
metadata_name = "generic",
|
||||
})
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer)if newnode.name == "at:at_block_steel" then
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:set_infotext("PAWNCH WITH COIN TO GET INGOT.")
|
||||
|
||||
end)
|
||||
|
||||
-- On PAWNCHING
|
||||
|
||||
|
||||
minetest.register_on_punchnode(function(pos, node, puncher) if node.name == "at:at" then
|
||||
hit_with = puncher:get_wielded_item()
|
||||
hit_with_name = hit_with:get_name()
|
||||
hit_with_count = hit_with:get_count()
|
||||
if hit_with_name == "moreores:copper_ingot" then
|
||||
puncher:get_inventory():remove_item("main", hit_with)
|
||||
puncher:get_inventory():add_item("main", "money:coin_copper hit_with:get_count()")
|
||||
minetest.chat_send_player(puncher:get_player_name(), 'You exchanged INGOT for COINS!!!') end
|
||||
|
||||
|
||||
|
||||
if newnode.name == "at:at_block_steel" then minetest.register_on_punchnode(function(pos, node, puncher)
|
||||
hit_with = puncher:get_wielded_item()
|
||||
|
||||
hit_with_name = hit_with:get_name()
|
||||
|
||||
hit_with_count = hit_with:get_count()
|
||||
|
||||
if hit_with_name == "money:coin_gold" then
|
||||
|
||||
puncher:get_inventory():remove_item("main", hit_with)
|
||||
puncher:get_inventory():add_item("main", "default:steel_ingot hit_with_count")
|
||||
end end)
|
|
@ -1,141 +0,0 @@
|
|||
do
|
||||
-- declare local variables
|
||||
--// exportstring( string )
|
||||
--// returns a "Lua" portable version of the string
|
||||
local function exportstring( s )
|
||||
s = string.format( "%q",s )
|
||||
-- to replace
|
||||
s = string.gsub( s,"\\\n","\\n" )
|
||||
s = string.gsub( s,"\r","\\r" )
|
||||
s = string.gsub( s,string.char(26),"\"..string.char(26)..\"" )
|
||||
return s
|
||||
end
|
||||
--// The Save Function
|
||||
function table.save( tbl,filename )
|
||||
local charS,charE = " ","\n"
|
||||
local file,err
|
||||
-- create a pseudo file that writes to a string and return the string
|
||||
if not filename then
|
||||
file = { write = function( self,newstr ) self.str = self.str..newstr end, str = "" }
|
||||
charS,charE = "",""
|
||||
-- write table to tmpfile
|
||||
elseif filename == true or filename == 1 then
|
||||
charS,charE,file = "","",io.tmpfile()
|
||||
-- write table to file
|
||||
-- use io.open here rather than io.output, since in windows when clicking on a file opened with io.output will create an error
|
||||
else
|
||||
file,err = io.open( filename, "w" )
|
||||
if err then return _,err end
|
||||
end
|
||||
-- initiate variables for save procedure
|
||||
local tables,lookup = { tbl },{ [tbl] = 1 }
|
||||
file:write( "return {"..charE )
|
||||
for idx,t in ipairs( tables ) do
|
||||
if filename and filename ~= true and filename ~= 1 then
|
||||
file:write( "-- Table: {"..idx.."}"..charE )
|
||||
end
|
||||
file:write( "{"..charE )
|
||||
local thandled = {}
|
||||
for i,v in ipairs( t ) do
|
||||
thandled[i] = true
|
||||
-- escape functions and userdata
|
||||
if type( v ) ~= "userdata" then
|
||||
-- only handle value
|
||||
if type( v ) == "table" then
|
||||
if not lookup[v] then
|
||||
table.insert( tables, v )
|
||||
lookup[v] = #tables
|
||||
end
|
||||
file:write( charS.."{"..lookup[v].."},"..charE )
|
||||
elseif type( v ) == "function" then
|
||||
file:write( charS.."loadstring("..exportstring(string.dump( v )).."),"..charE )
|
||||
else
|
||||
local value = ( type( v ) == "string" and exportstring( v ) ) or tostring( v )
|
||||
file:write( charS..value..","..charE )
|
||||
end
|
||||
end
|
||||
end
|
||||
for i,v in pairs( t ) do
|
||||
-- escape functions and userdata
|
||||
if (not thandled[i]) and type( v ) ~= "userdata" then
|
||||
-- handle index
|
||||
if type( i ) == "table" then
|
||||
if not lookup[i] then
|
||||
table.insert( tables,i )
|
||||
lookup[i] = #tables
|
||||
end
|
||||
file:write( charS.."[{"..lookup[i].."}]=" )
|
||||
else
|
||||
local index = ( type( i ) == "string" and "["..exportstring( i ).."]" ) or string.format( "[%d]",i )
|
||||
file:write( charS..index.."=" )
|
||||
end
|
||||
-- handle value
|
||||
if type( v ) == "table" then
|
||||
if not lookup[v] then
|
||||
table.insert( tables,v )
|
||||
lookup[v] = #tables
|
||||
end
|
||||
file:write( "{"..lookup[v].."},"..charE )
|
||||
elseif type( v ) == "function" then
|
||||
file:write( "loadstring("..exportstring(string.dump( v )).."),"..charE )
|
||||
else
|
||||
local value = ( type( v ) == "string" and exportstring( v ) ) or tostring( v )
|
||||
file:write( value..","..charE )
|
||||
end
|
||||
end
|
||||
end
|
||||
file:write( "},"..charE )
|
||||
end
|
||||
file:write( "}" )
|
||||
-- Return Values
|
||||
-- return stringtable from string
|
||||
if not filename then
|
||||
-- set marker for stringtable
|
||||
return file.str.."--|"
|
||||
-- return stringttable from file
|
||||
elseif filename == true or filename == 1 then
|
||||
file:seek ( "set" )
|
||||
-- no need to close file, it gets closed and removed automatically
|
||||
-- set marker for stringtable
|
||||
return file:read( "*a" ).."--|"
|
||||
-- close file and return 1
|
||||
else
|
||||
file:close()
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
--// The Load Function
|
||||
function table.load( sfile )
|
||||
-- catch marker for stringtable
|
||||
if string.sub( sfile,-3,-1 ) == "--|" then
|
||||
tables,err = loadstring( sfile )
|
||||
else
|
||||
tables,err = loadfile( sfile )
|
||||
end
|
||||
if err then return _,err
|
||||
end
|
||||
tables = tables()
|
||||
for idx = 1,#tables do
|
||||
local tolinkv,tolinki = {},{}
|
||||
for i,v in pairs( tables[idx] ) do
|
||||
if type( v ) == "table" and tables[v[1]] then
|
||||
table.insert( tolinkv,{ i,tables[v[1]] } )
|
||||
end
|
||||
if type( i ) == "table" and tables[i[1]] then
|
||||
table.insert( tolinki,{ i,tables[i[1]] } )
|
||||
end
|
||||
end
|
||||
-- link values, first due to possible changes of indices
|
||||
for _,v in ipairs( tolinkv ) do
|
||||
tables[idx][v[1]] = v[2]
|
||||
end
|
||||
-- link indices
|
||||
for _,v in ipairs( tolinki ) do
|
||||
tables[idx][v[2]],tables[idx][v[1]] = tables[idx][v[1]],nil
|
||||
end
|
||||
end
|
||||
return tables[1]
|
||||
end
|
||||
-- close do
|
||||
end
|
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.3 KiB |
|
@ -1,10 +0,0 @@
|
|||
return {
|
||||
-- Table: {1}
|
||||
{
|
||||
["JJW"]=48233,
|
||||
["Hale"]=25,
|
||||
["SIEg"]=0,
|
||||
["HALe"]=5141,
|
||||
["DJ_Gal"]=1991,
|
||||
},
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
money
|
|
@ -1,124 +0,0 @@
|
|||
dofile(minetest.get_modpath("atm") .. "/table_db.lua")
|
||||
|
||||
minetest.register_node("atm:atm_deposit", {
|
||||
description = "ATM Deposits",
|
||||
tile_images = {"atm_deposit.png"},
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_stonelike(1.0),
|
||||
paramtype = "facedir_simple",
|
||||
metadata_name = "generic",
|
||||
})
|
||||
|
||||
minetest.register_node("atm:atm_withdrawl", {
|
||||
description = "ATM Withdrawals",
|
||||
tile_images = {"atm_withdrawl.png"},
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_stonelike(1.0),
|
||||
paramtype = "facedir_simple",
|
||||
metadata_name = "generic",
|
||||
})
|
||||
|
||||
minetest.register_node("atm:atm_check_balance", {
|
||||
description = "ATM Check Balance",
|
||||
tile_images = {"atm_check.png"},
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_stonelike(1.0),
|
||||
paramtype = "facedir_simple",
|
||||
metadata_name = "generic",
|
||||
})
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer)
|
||||
if newnode.name == "atm:atm_deposit" then
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:set_infotext("Punch with coins to deposit them.")
|
||||
elseif newnode.name == "atm:atm_withdrawl" then
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:set_infotext("Punch to remove some coins from your account.")
|
||||
elseif newnode.name == "atm:atm_check_balance" then
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:set_infotext("Punch to check the balance of your account.")
|
||||
end
|
||||
end)
|
||||
|
||||
local money_db_filename = minetest.get_modpath("atm") .. "/accounts.tbl"
|
||||
accounts = table.load(money_db_filename)
|
||||
|
||||
if type(accounts) ~= "table" then
|
||||
accounts = {}
|
||||
end
|
||||
|
||||
function GetAccountBalance(player_name)
|
||||
if accounts[player_name] == nil then
|
||||
accounts[player_name] = 0
|
||||
table.save( accounts, money_db_filename )
|
||||
end
|
||||
|
||||
print ("[ATM] GetAccountBalance - " .. player_name .. " " .. tostring(accounts[player_name]))
|
||||
return accounts[player_name]
|
||||
end
|
||||
|
||||
function AddToAccount(player_name, amount)
|
||||
if accounts[player_name] == nil then
|
||||
accounts[player_name] = 0
|
||||
end
|
||||
|
||||
accounts[player_name] = accounts[player_name] + amount
|
||||
|
||||
table.save( accounts, money_db_filename )
|
||||
end
|
||||
|
||||
function GetFromAccount(player_name, amount)
|
||||
if accounts[player_name] == nil then
|
||||
accounts[player_name] = 0
|
||||
end
|
||||
|
||||
if accounts[player_name] >= amount then
|
||||
accounts[player_name] = accounts[player_name] - amount
|
||||
table.save( accounts, money_db_filename )
|
||||
return true, amount
|
||||
else
|
||||
amount = accounts[player_name]
|
||||
accounts[player_name] = 0
|
||||
table.save( accounts, money_db_filename )
|
||||
return false, amount
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||
if node.name == "atm:atm_deposit" then
|
||||
hit_with = puncher:get_wielded_item()
|
||||
hit_with_name = hit_with:get_name()
|
||||
hit_with_count = hit_with:get_count()
|
||||
total_amount = 0
|
||||
if hit_with_name == "money:coin_copper" then
|
||||
total_amount = hit_with_count
|
||||
elseif hit_with_name == "money:coin_silver" then
|
||||
total_amount = money.ConvertToCopper(0, hit_with_count, 0)
|
||||
elseif hit_with_name == "money:coin_gold" then
|
||||
total_amount = money.ConvertToCopper(hit_with_count, 0, 0)
|
||||
else
|
||||
return
|
||||
end
|
||||
AddToAccount(puncher:get_player_name(), total_amount)
|
||||
puncher:get_inventory():remove_item("main", hit_with)
|
||||
elseif node.name == "atm:atm_withdrawl" then
|
||||
-- For now try to pull out 5 gold coins, in the future we may be able to as the player how much they want
|
||||
-- full will be false if we didn't get the amount requested, also means that the account is now empty
|
||||
full, amount = GetFromAccount(puncher:get_player_name(), money.ConvertToCopper(5, 0, 0))
|
||||
local g, s, c = money.ConvertCopperToOthers(amount)
|
||||
|
||||
if c > 0 then
|
||||
puncher:get_inventory():add_item("main", "money:coin_copper " .. c)
|
||||
end
|
||||
if s > 0 then
|
||||
puncher:get_inventory():add_item("main", "money:coin_silver " .. s)
|
||||
end
|
||||
if g > 0 then
|
||||
puncher:get_inventory():add_item("main", "money:coin_gold " .. g)
|
||||
end
|
||||
elseif node.name == "atm:atm_check_balance" then
|
||||
local c_total = GetAccountBalance(puncher:get_player_name())
|
||||
local g, s, c = money.ConvertCopperToOthers(c_total)
|
||||
minetest.chat_send_player(puncher:get_player_name(), 'Account Balance: ' .. c_total .. ' copper\nor ' .. g .. ' gold, ' .. s .. ' silver, ' .. c .. ' copper')
|
||||
end
|
||||
end)
|
|
@ -1,141 +0,0 @@
|
|||
do
|
||||
-- declare local variables
|
||||
--// exportstring( string )
|
||||
--// returns a "Lua" portable version of the string
|
||||
local function exportstring( s )
|
||||
s = string.format( "%q",s )
|
||||
-- to replace
|
||||
s = string.gsub( s,"\\\n","\\n" )
|
||||
s = string.gsub( s,"\r","\\r" )
|
||||
s = string.gsub( s,string.char(26),"\"..string.char(26)..\"" )
|
||||
return s
|
||||
end
|
||||
--// The Save Function
|
||||
function table.save( tbl,filename )
|
||||
local charS,charE = " ","\n"
|
||||
local file,err
|
||||
-- create a pseudo file that writes to a string and return the string
|
||||
if not filename then
|
||||
file = { write = function( self,newstr ) self.str = self.str..newstr end, str = "" }
|
||||
charS,charE = "",""
|
||||
-- write table to tmpfile
|
||||
elseif filename == true or filename == 1 then
|
||||
charS,charE,file = "","",io.tmpfile()
|
||||
-- write table to file
|
||||
-- use io.open here rather than io.output, since in windows when clicking on a file opened with io.output will create an error
|
||||
else
|
||||
file,err = io.open( filename, "w" )
|
||||
if err then return _,err end
|
||||
end
|
||||
-- initiate variables for save procedure
|
||||
local tables,lookup = { tbl },{ [tbl] = 1 }
|
||||
file:write( "return {"..charE )
|
||||
for idx,t in ipairs( tables ) do
|
||||
if filename and filename ~= true and filename ~= 1 then
|
||||
file:write( "-- Table: {"..idx.."}"..charE )
|
||||
end
|
||||
file:write( "{"..charE )
|
||||
local thandled = {}
|
||||
for i,v in ipairs( t ) do
|
||||
thandled[i] = true
|
||||
-- escape functions and userdata
|
||||
if type( v ) ~= "userdata" then
|
||||
-- only handle value
|
||||
if type( v ) == "table" then
|
||||
if not lookup[v] then
|
||||
table.insert( tables, v )
|
||||
lookup[v] = #tables
|
||||
end
|
||||
file:write( charS.."{"..lookup[v].."},"..charE )
|
||||
elseif type( v ) == "function" then
|
||||
file:write( charS.."loadstring("..exportstring(string.dump( v )).."),"..charE )
|
||||
else
|
||||
local value = ( type( v ) == "string" and exportstring( v ) ) or tostring( v )
|
||||
file:write( charS..value..","..charE )
|
||||
end
|
||||
end
|
||||
end
|
||||
for i,v in pairs( t ) do
|
||||
-- escape functions and userdata
|
||||
if (not thandled[i]) and type( v ) ~= "userdata" then
|
||||
-- handle index
|
||||
if type( i ) == "table" then
|
||||
if not lookup[i] then
|
||||
table.insert( tables,i )
|
||||
lookup[i] = #tables
|
||||
end
|
||||
file:write( charS.."[{"..lookup[i].."}]=" )
|
||||
else
|
||||
local index = ( type( i ) == "string" and "["..exportstring( i ).."]" ) or string.format( "[%d]",i )
|
||||
file:write( charS..index.."=" )
|
||||
end
|
||||
-- handle value
|
||||
if type( v ) == "table" then
|
||||
if not lookup[v] then
|
||||
table.insert( tables,v )
|
||||
lookup[v] = #tables
|
||||
end
|
||||
file:write( "{"..lookup[v].."},"..charE )
|
||||
elseif type( v ) == "function" then
|
||||
file:write( "loadstring("..exportstring(string.dump( v )).."),"..charE )
|
||||
else
|
||||
local value = ( type( v ) == "string" and exportstring( v ) ) or tostring( v )
|
||||
file:write( value..","..charE )
|
||||
end
|
||||
end
|
||||
end
|
||||
file:write( "},"..charE )
|
||||
end
|
||||
file:write( "}" )
|
||||
-- Return Values
|
||||
-- return stringtable from string
|
||||
if not filename then
|
||||
-- set marker for stringtable
|
||||
return file.str.."--|"
|
||||
-- return stringttable from file
|
||||
elseif filename == true or filename == 1 then
|
||||
file:seek ( "set" )
|
||||
-- no need to close file, it gets closed and removed automatically
|
||||
-- set marker for stringtable
|
||||
return file:read( "*a" ).."--|"
|
||||
-- close file and return 1
|
||||
else
|
||||
file:close()
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
--// The Load Function
|
||||
function table.load( sfile )
|
||||
-- catch marker for stringtable
|
||||
if string.sub( sfile,-3,-1 ) == "--|" then
|
||||
tables,err = loadstring( sfile )
|
||||
else
|
||||
tables,err = loadfile( sfile )
|
||||
end
|
||||
if err then return _,err
|
||||
end
|
||||
tables = tables()
|
||||
for idx = 1,#tables do
|
||||
local tolinkv,tolinki = {},{}
|
||||
for i,v in pairs( tables[idx] ) do
|
||||
if type( v ) == "table" and tables[v[1]] then
|
||||
table.insert( tolinkv,{ i,tables[v[1]] } )
|
||||
end
|
||||
if type( i ) == "table" and tables[i[1]] then
|
||||
table.insert( tolinki,{ i,tables[i[1]] } )
|
||||
end
|
||||
end
|
||||
-- link values, first due to possible changes of indices
|
||||
for _,v in ipairs( tolinkv ) do
|
||||
tables[idx][v[1]] = v[2]
|
||||
end
|
||||
-- link indices
|
||||
for _,v in ipairs( tolinki ) do
|
||||
tables[idx][v[2]],tables[idx][v[1]] = tables[idx][v[1]],nil
|
||||
end
|
||||
end
|
||||
return tables[1]
|
||||
end
|
||||
-- close do
|
||||
end
|
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.6 KiB |
|
@ -1,354 +0,0 @@
|
|||
-- BobBlocks mod by RabbiBob
|
||||
-- State Changes
|
||||
|
||||
local is_bobblock = function(node)
|
||||
if node.name == 'bobblocks:redblock' or node.name == 'bobblocks:redblock_off' or
|
||||
node.name == 'bobblocks:orangeblock' or node.name == 'bobblocks:orangeblock_off' or
|
||||
node.name == 'bobblocks:yellowblock' or node.name == 'bobblocks:yellowblock_off' or
|
||||
node.name == 'bobblocks:greenblock' or node.name == 'bobblocks:greenblock_off' or
|
||||
node.name == 'bobblocks:blueblock' or node.name == 'bobblocks:blueblock_off' or
|
||||
node.name == 'bobblocks:indigoblock' or node.name == 'bobblocks:indigoblock_off' or
|
||||
node.name == 'bobblocks:violetblock' or node.name == 'bobblocks:violetblock_off' or
|
||||
node.name == 'bobblocks:whiteblock' or node.name == 'bobblocks:whiteblock_off'
|
||||
then return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local update_bobblock = function (pos, node)
|
||||
local nodename=""
|
||||
local param2=""
|
||||
--Switch Block State
|
||||
if node.name == 'bobblocks:redblock_off' then nodename = 'bobblocks:redblock'
|
||||
elseif node.name == 'bobblocks:redblock' then nodename = 'bobblocks:redblock_off'
|
||||
elseif node.name == 'bobblocks:orangeblock_off' then nodename = 'bobblocks:orangeblock'
|
||||
elseif node.name == 'bobblocks:orangeblock' then nodename = 'bobblocks:orangeblock_off'
|
||||
elseif node.name == 'bobblocks:yellowblock_off' then nodename = 'bobblocks:yellowblock'
|
||||
elseif node.name == 'bobblocks:yellowblock' then nodename = 'bobblocks:yellowblock_off'
|
||||
elseif node.name == 'bobblocks:greenblock_off' then nodename = 'bobblocks:greenblock'
|
||||
elseif node.name == 'bobblocks:greenblock' then nodename = 'bobblocks:greenblock_off'
|
||||
elseif node.name == 'bobblocks:blueblock_off' then nodename = 'bobblocks:blueblock'
|
||||
elseif node.name == 'bobblocks:blueblock' then nodename = 'bobblocks:blueblock_off'
|
||||
elseif node.name == 'bobblocks:indigoblock_off' then nodename = 'bobblocks:indigoblock'
|
||||
elseif node.name == 'bobblocks:indigoblock' then nodename = 'bobblocks:indigoblock_off'
|
||||
elseif node.name == 'bobblocks:violetblock_off' then nodename = 'bobblocks:violetblock'
|
||||
elseif node.name == 'bobblocks:violetblock' then nodename = 'bobblocks:violetblock_off'
|
||||
elseif node.name == 'bobblocks:whiteblock_off' then nodename = 'bobblocks:whiteblock'
|
||||
elseif node.name == 'bobblocks:whiteblock' then nodename = 'bobblocks:whiteblock_off'
|
||||
end
|
||||
minetest.env:add_node(pos, {name = nodename})
|
||||
end
|
||||
|
||||
local toggle_bobblock = function (pos, node)
|
||||
if not is_bobblock(node) then return end
|
||||
update_bobblock (pos, node, state)
|
||||
end
|
||||
|
||||
local on_bobblock_punched = function (pos, node, puncher)
|
||||
if node.name == 'bobblocks:redblock_off' or node.name == 'bobblocks:redblock' or
|
||||
node.name == 'bobblocks:orangeblock_off' or node.name == 'bobblocks:orangeblock' or
|
||||
node.name == 'bobblocks:yellowblock_off' or node.name == 'bobblocks:yellowblock' or
|
||||
node.name == 'bobblocks:greenblock_off' or node.name == 'bobblocks:greenblock' or
|
||||
node.name == 'bobblocks:blueblock_off' or node.name == 'bobblocks:blueblock' or
|
||||
node.name == 'bobblocks:indigoblock_off' or node.name == 'bobblocks:indigoblock' or
|
||||
node.name == 'bobblocks:violetblock_off' or node.name == 'bobblocks:violetblock' or
|
||||
node.name == 'bobblocks:whiteblock_off' or node.name == 'bobblocks:whiteblock'
|
||||
then
|
||||
update_bobblock(pos, node)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_punchnode(on_bobblock_punched)
|
||||
|
||||
-- Nodes
|
||||
-- Block Nodes
|
||||
|
||||
minetest.register_node("bobblocks:btm", {
|
||||
description = "Bobs TransMorgifier",
|
||||
tile_images = {"bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm_sides.png",
|
||||
"bobblocks_btm_sides.png", "bobblocks_btm_sides.png", "bobblocks_btm.png"},
|
||||
inventory_image = "bobblocks_btm.png",
|
||||
paramtype2 = "facedir",
|
||||
material = minetest.digprop_dirtlike(1.0),
|
||||
legacy_facedir_simple = true,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
default.register_falling_node("bobblocks:btm", "bobblocks_btm_sides.png")
|
||||
|
||||
minetest.register_node("bobblocks:redblock", {
|
||||
description = "Red Block",
|
||||
drawtype = "glasslike",
|
||||
tile_images = {"bobblocks_redblock.png"},
|
||||
inventory_image = minetest.inventorycube("bobblocks_redblock.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:redblock_off", {
|
||||
description = "Red Block",
|
||||
tile_images = {"bobblocks_redblock.png"},
|
||||
is_ground_content = true,
|
||||
alpha = WATER_ALPHA,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
drop = 'bobblocks:redblock',
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:orangeblock", {
|
||||
description = "Orange Block",
|
||||
drawtype = "glasslike",
|
||||
tile_images = {"bobblocks_orangeblock.png"},
|
||||
inventory_image = minetest.inventorycube("bobblocks_orangeblock.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:orangeblock_off", {
|
||||
description = "Orange Block",
|
||||
tile_images = {"bobblocks_orangeblock.png"},
|
||||
is_ground_content = true,
|
||||
alpha = WATER_ALPHA,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
drop = 'bobblocks:orangeblock',
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("bobblocks:yellowblock", {
|
||||
description = "Yellow Block",
|
||||
drawtype = "glasslike",
|
||||
tile_images = {"bobblocks_yellowblock.png"},
|
||||
inventory_image = minetest.inventorycube("bobblocks_yellowblock.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:yellowblock_off", {
|
||||
description = "yellow Block",
|
||||
tile_images = {"bobblocks_yellowblock.png"},
|
||||
is_ground_content = true,
|
||||
alpha = WATER_ALPHA,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
drop = 'bobblocks:yellowblock',
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:greenblock", {
|
||||
description = "Green Block",
|
||||
drawtype = "glasslike",
|
||||
tile_images = {"bobblocks_greenblock.png"},
|
||||
inventory_image = minetest.inventorycube("bobblocks_greenblock.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:greenblock_off", {
|
||||
description = "green Block",
|
||||
tile_images = {"bobblocks_greenblock.png"},
|
||||
is_ground_content = true,
|
||||
alpha = WATER_ALPHA,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
drop = 'bobblocks:greenblock',
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:blueblock", {
|
||||
description = "Blue Block",
|
||||
drawtype = "glasslike",
|
||||
tile_images = {"bobblocks_blueblock.png"},
|
||||
inventory_image = minetest.inventorycube("bobblocks_blueblock.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:blueblock_off", {
|
||||
description = "Blue Block",
|
||||
tile_images = {"bobblocks_blueblock.png"},
|
||||
is_ground_content = true,
|
||||
alpha = WATER_ALPHA,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
drop = 'bobblocks:blueblock',
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:indigoblock", {
|
||||
description = "Indigo Block",
|
||||
drawtype = "glasslike",
|
||||
tile_images = {"bobblocks_indigoblock.png"},
|
||||
inventory_image = minetest.inventorycube("bobblocks_indigoblock.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:indigoblock_off", {
|
||||
description = "indigo Block",
|
||||
tile_images = {"bobblocks_indigoblock.png"},
|
||||
is_ground_content = true,
|
||||
alpha = WATER_ALPHA,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
drop = 'bobblocks:indigoblock',
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:violetblock", {
|
||||
description = "Violet Block",
|
||||
drawtype = "glasslike",
|
||||
tile_images = {"bobblocks_violetblock.png"},
|
||||
inventory_image = minetest.inventorycube("bobblocks_violetblock.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:violetblock_off", {
|
||||
description = "violet Block",
|
||||
tile_images = {"bobblocks_violetblock.png"},
|
||||
is_ground_content = true,
|
||||
alpha = WATER_ALPHA,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
drop = 'bobblocks:violetblock',
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:whiteblock", {
|
||||
description = "White Block",
|
||||
drawtype = "glasslike",
|
||||
tile_images = {"bobblocks_whiteblock.png"},
|
||||
inventory_image = minetest.inventorycube("bobblocks_whiteblock.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:whiteblock_off", {
|
||||
description = "white Block",
|
||||
tile_images = {"bobblocks_whiteblock.png"},
|
||||
is_ground_content = true,
|
||||
alpha = WATER_ALPHA,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
drop = 'bobblocks:whiteblock',
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:greyblock", {
|
||||
description = "Grey Block",
|
||||
drawtype = "glasslike",
|
||||
tile_images = {"bobblocks_greyblock.png"},
|
||||
inventory_image = minetest.inventorycube("bobblocks_greyblock.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
-- Crafts
|
||||
-- BTM
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:btm" 1',
|
||||
recipe = {
|
||||
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:leaves" 1',
|
||||
'node "default:mese" 1','node "default:rat" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:greyblock" 2',
|
||||
recipe = {
|
||||
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:cobble" 1'},
|
||||
},
|
||||
})
|
||||
|
||||
-- Red / Yellow / Blue / White
|
||||
-- Red / Yellow -> Orange
|
||||
-- Red / Blue -> Violet
|
||||
-- Blue / Yellow -> Green
|
||||
-- Red / Yellow / White -> Indigo
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:redblock" 2',
|
||||
recipe = {
|
||||
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:brick" 1'},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:yellowblock" 2',
|
||||
recipe = {
|
||||
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:sand" 1'},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:blueblock" 2',
|
||||
recipe = {
|
||||
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:gravel" 1'},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:whiteblock" 2',
|
||||
recipe = {
|
||||
{'node "default:glass" 1', 'node "default:torch" 1', 'node "default:dirt" 1'},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:orangeblock" 2',
|
||||
recipe = {
|
||||
{'node "bobblocks:redblock" 1', 'node "bobblocks:yellowblock" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:violetblock" 2',
|
||||
recipe = {
|
||||
{'node "bobblocks:redblock" 1', 'node "bobblocks:blueblock" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:greenblock" 2',
|
||||
recipe = {
|
||||
{'node "bobblocks:blueblock" 1', 'node "bobblocks:yellowblock" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:indigoblock" 3',
|
||||
recipe = {
|
||||
{'node "bobblocks:redblock" 1', 'node "bobblocks:blueblock" 1', 'node "bobblocks:whiteblock" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
default
|
|
@ -1,87 +0,0 @@
|
|||
local is_healthpack = function(node)
|
||||
if node.name == 'bobblocks:health_off' or node.name == 'health_on' then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local update_healthpack = function (pos, node)
|
||||
local nodename=""
|
||||
local param2=""
|
||||
--Switch HealthPack State
|
||||
if node.name == 'bobblocks:health_off' then
|
||||
nodename = 'bobblocks:health_on'
|
||||
elseif node.name == 'bobblocks:health_on' then
|
||||
nodename = 'bobblocks:health_off'
|
||||
end
|
||||
minetest.env:add_node(pos, {name = nodename})
|
||||
end
|
||||
|
||||
local toggle_healthpack = function (pos, node)
|
||||
if not is_healthgate(node) then return end
|
||||
update_healthpack (pos, node, state)
|
||||
end
|
||||
|
||||
local on_healthpack_punched = function (pos, node, puncher)
|
||||
if node.name == 'bobblocks:health_off' or node.name == 'bobblocks:health_on' then
|
||||
update_healthpack(pos, node)
|
||||
end
|
||||
end
|
||||
|
||||
-- Healing Node
|
||||
|
||||
minetest.register_node("bobblocks:health_off", {
|
||||
description = "Health Pack 1",
|
||||
tile_images = {"bobblocks_health_off.png"},
|
||||
inventory_image = "bobblocks_health_off.png",
|
||||
paramtype2 = "facedir",
|
||||
material = minetest.digprop_dirtlike(1.0),
|
||||
legacy_facedir_simple = true,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
is_ground_content = true,
|
||||
walkable = false,
|
||||
climbable = false,
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:health_on", {
|
||||
description = "Health Pack 1",
|
||||
tile_images = {"bobblocks_health_on.png"},
|
||||
paramtype2 = "facedir",
|
||||
material = minetest.digprop_dirtlike(1.0),
|
||||
legacy_facedir_simple = true,
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
is_ground_content = true,
|
||||
walkable = false,
|
||||
climbable = false,
|
||||
drop = "bobblocks:health_off",
|
||||
})
|
||||
|
||||
|
||||
minetest.register_abm(
|
||||
{nodenames = {"bobblocks:health_on"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
obj:set_hp(obj:get_hp()+10)
|
||||
minetest.env:remove_node(pos)
|
||||
end
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
--- Health
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:health_off" 1',
|
||||
recipe = {
|
||||
{'node "default:dirt" 1', 'node "default:paper" 1', 'node "default:apple" 2'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_on_punchnode(on_healthpack_punched)
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
-- BobBlocks v0.0.4
|
||||
-- (Minetest 0.4 mod Compatible 20120122 thru v20120320)
|
||||
-- http://c55.me/minetest/forum/viewtopic.php?id=1274
|
||||
--
|
||||
-- Colored Lit Blocks
|
||||
--- Default state = Solid lit block
|
||||
--- Secondary state (punch) = transparent unlit block
|
||||
-- Colored Lit Poles
|
||||
-- Health Kit
|
||||
--- Default state = health kit inactive
|
||||
--- Secondary state (punch) = health kit active +10HP when walked through
|
||||
-- Licenced under the GPLv2/later
|
||||
|
||||
dofile(minetest.get_modpath("bobblocks") .. "/blocks.lua")
|
||||
dofile(minetest.get_modpath("bobblocks") .. "/poles.lua")
|
||||
dofile(minetest.get_modpath("bobblocks") .. "/health.lua")
|
||||
|
|
@ -1,195 +0,0 @@
|
|||
-- Poles
|
||||
minetest.register_node("bobblocks:redpole", {
|
||||
description = "Red Pole",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"bobblocks_redblock.png"},
|
||||
inventory_image = ("bobblocks_invredpole.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:orangepole", {
|
||||
description = "Orange Pole",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"bobblocks_orangeblock.png"},
|
||||
inventory_image = ("bobblocks_invorangepole.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:yellowpole", {
|
||||
description = "Yellow Pole",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"bobblocks_yellowblock.png"},
|
||||
inventory_image = ("bobblocks_invyellowpole.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:greenpole", {
|
||||
description = "Green Pole",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"bobblocks_greenblock.png"},
|
||||
inventory_image = ("bobblocks_invgreenpole.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:bluepole", {
|
||||
description = "Blue Pole",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"bobblocks_blueblock.png"},
|
||||
inventory_image = ("bobblocks_invbluepole.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:indigopole", {
|
||||
description = "Indigo Pole",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"bobblocks_indigoblock.png"},
|
||||
inventory_image = ("bobblocks_invindigopole.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:violetpole", {
|
||||
description = "Violet Pole",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"bobblocks_violetblock.png"},
|
||||
inventory_image = ("bobblocks_invvioletpole.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:whitepole", {
|
||||
description = "White Pole",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"bobblocks_whiteblock.png"},
|
||||
inventory_image = ("bobblocks_invwhitepole.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
light_source = LIGHT_MAX-0,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
})
|
||||
|
||||
minetest.register_node("bobblocks:greypole", {
|
||||
description = "Grey Pole",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"bobblocks_greyblock.png"},
|
||||
inventory_image = ("bobblocks_invgreypole.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = true,
|
||||
material = minetest.digprop_glasslike(1.0),
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
--light_source = LIGHT_MAX-0,
|
||||
})
|
||||
|
||||
-- Crafts
|
||||
|
||||
-- Poles
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:redpole" 1',
|
||||
recipe = {
|
||||
{'node "bobblocks:redblock" 1', 'node "default:stick" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:yellowpole" 1',
|
||||
recipe = {
|
||||
{'node "bobblocks:yellowblock" 1', 'node "default:stick" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:bluepole" 1',
|
||||
recipe = {
|
||||
{'node "bobblocks:blueblock" 1', 'node "default:stick" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:whitepole" 1',
|
||||
recipe = {
|
||||
{'node "bobblocks:whiteblock" 1', 'node "default:stick" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:orangepole" 1',
|
||||
recipe = {
|
||||
{'node "bobblocks:orangeblock" 1', 'node "default:stick" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:violetpole" 1',
|
||||
recipe = {
|
||||
{'node "bobblocks:violetblock" 1', 'node "default:stick" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:greenpole" 1',
|
||||
recipe = {
|
||||
{'node "bobblocks:greenblock" 1', 'node "default:stick" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:indigopole" 1',
|
||||
recipe = {
|
||||
{'node "bobblocks:indigoblock" 1', 'node "default:stick" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'NodeItem "bobblocks:greypole" 1',
|
||||
recipe = {
|
||||
{'node "bobblocks:greyblock" 1', 'node "default:stick" 1'},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
|
Before Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 8.4 KiB |
|
@ -1,2 +0,0 @@
|
|||
default
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
-- bucket (Minetest 0.4 mod)
|
||||
-- A bucket, which can pick up water and lava
|
||||
|
||||
minetest.register_alias("bucket", "bucket:bucket_empty")
|
||||
minetest.register_alias("bucket_water", "bucket:bucket_water")
|
||||
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'bucket:bucket_empty 1',
|
||||
recipe = {
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
{'', 'default:steel_ingot', ''},
|
||||
}
|
||||
})
|
||||
|
||||
bucket = {}
|
||||
bucket.liquids = {}
|
||||
|
||||
-- Register a new liquid
|
||||
-- source = name of the source node
|
||||
-- flowing = name of the flowing node
|
||||
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
|
||||
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
|
||||
-- This function can be called from any mod (that depends on bucket).
|
||||
function bucket.register_liquid(source, flowing, itemname, inventory_image)
|
||||
bucket.liquids[source] = {
|
||||
source = source,
|
||||
flowing = flowing,
|
||||
itemname = itemname,
|
||||
}
|
||||
bucket.liquids[flowing] = bucket.liquids[source]
|
||||
|
||||
if itemname ~= nil then
|
||||
minetest.register_craftitem(itemname, {
|
||||
inventory_image = inventory_image,
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
-- Must be pointing to node
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
-- Check if pointing to a liquid
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if bucket.liquids[n.name] == nil then
|
||||
-- Not a liquid
|
||||
minetest.env:add_node(pointed_thing.above, {name=source})
|
||||
elseif n.name ~= source then
|
||||
-- It's a liquid
|
||||
minetest.env:add_node(pointed_thing.under, {name=source})
|
||||
end
|
||||
return {name="bucket:bucket_empty"}
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_craftitem("bucket:bucket_empty", {
|
||||
inventory_image = "bucket.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
-- Must be pointing to node
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
-- Check if pointing to a liquid source
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
liquiddef = bucket.liquids[n.name]
|
||||
if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
|
||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||
return {name=liquiddef.itemname}
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
bucket.register_liquid(
|
||||
"default:water_source",
|
||||
"default:water_flowing",
|
||||
"bucket:bucket_water",
|
||||
"bucket_water.png"
|
||||
)
|
||||
|
||||
bucket.register_liquid(
|
||||
"default:lava_source",
|
||||
"default:lava_flowing",
|
||||
"bucket:bucket_lava",
|
||||
"bucket_lava.png"
|
||||
)
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:bucket_lava",
|
||||
burntime = 60,
|
||||
})
|
Before Width: | Height: | Size: 329 B |
Before Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 203 B |
Before Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 597 B |
Before Width: | Height: | Size: 604 B |
Before Width: | Height: | Size: 279 B |
Before Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 142 B |
Before Width: | Height: | Size: 613 B |
Before Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 118 B |
Before Width: | Height: | Size: 933 B |
Before Width: | Height: | Size: 830 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 539 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 978 B |
Before Width: | Height: | Size: 874 B |
Before Width: | Height: | Size: 856 B |
Before Width: | Height: | Size: 878 B |
Before Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 936 B |
Before Width: | Height: | Size: 672 B |
Before Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 507 B |
Before Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 203 B |
Before Width: | Height: | Size: 952 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 965 B |
Before Width: | Height: | Size: 303 B |
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 203 B |
Before Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 507 B |
Before Width: | Height: | Size: 555 B |
Before Width: | Height: | Size: 545 B |