parent
4a77d3d257
commit
6bc99cb7f4
|
@ -13,7 +13,7 @@ basic_machines.max_range = 10 -- machines normal range of operation
|
|||
basic_machines.machines_operations = 10 -- 1 coal will provide 10 mover basic operations ( moving dirt 1 block distance)
|
||||
basic_machines.machines_TTL = 16 -- time to live for signals, how many hops before signal dissipates
|
||||
|
||||
basic_machines.version = "06/04/2019a";
|
||||
basic_machines.version = "06/22/2019a";
|
||||
basic_machines.clockgen = 1; -- if 0 all background continuously running activity (clockgen/keypad) repeating is disabled
|
||||
|
||||
-- how hard it is to move blocks, default factor 1, note fuel cost is this multiplied by distance and divided by machine_operations..
|
||||
|
@ -80,16 +80,17 @@ basic_machines.no_teleport_table = {
|
|||
}
|
||||
|
||||
-- list of nodes mover cant take from in inventory mode
|
||||
basic_machines.limit_inventory_table = { -- node name = {list of bad inventories to take from}
|
||||
basic_machines.limit_inventory_table = { -- node name = {list of bad inventories to take from} OR node name = true to ban all inventories
|
||||
["basic_machines:autocrafter"]= {["recipe"]=1, ["output"]=1},
|
||||
["basic_machines:constructor"]= {["recipe"]=1},
|
||||
["basic_machines:battery_0"] = {["upgrade"] = 1},
|
||||
["basic_machines:battery_1"] = {["upgrade"] = 1},
|
||||
["basic_machines:battery_2"] = {["upgrade"] = 1},
|
||||
["basic_machines:generator"] = {["upgrade"] = 1},
|
||||
["basic_machines:mover"] = {["upgrade"] = 1},
|
||||
["basic_machines:mover"] = true,
|
||||
["basic_machines:grinder"] = {["upgrade"] = 1},
|
||||
["moreblocks:circular_saw"] = {["input"]=1,["recycle"]=1,["micro"]=1,["output"]=1},
|
||||
["moreblocks:circular_saw"] = true,
|
||||
["smartshop:shop"] = true,
|
||||
}
|
||||
|
||||
-- when activated with keypad these will be "punched" to update their text too
|
||||
|
@ -511,15 +512,15 @@ minetest.register_node("basic_machines:mover", {
|
|||
for _,obj in pairs(minetest.get_objects_inside_radius({x=x0+pos.x,y=y0+pos.y,z=z0+pos.z}, r)) do
|
||||
local lua_entity = obj:get_luaentity()
|
||||
if not obj:is_player() and lua_entity and lua_entity.itemstring ~= "" then
|
||||
local detected_obj = lua_entity.name or ""
|
||||
if not basic_machines.no_teleport_table[detected_obj] then -- object on no teleport list
|
||||
local detected_obj = lua_entity.itemstring or ""
|
||||
if not basic_machines.no_teleport_table[detected_obj] and (prefer=="" or prefer==detected_obj) then -- object on no teleport list
|
||||
-- put item in chest
|
||||
local stack = ItemStack(lua_entity.itemstring)
|
||||
if inv:room_for_item("main", stack) then
|
||||
teleport_any = true;
|
||||
inv:add_item("main", stack);
|
||||
end
|
||||
obj:setpos({x=0,y=0,z=0}); -- patch for dupe, might not be needed if future minetest object management is better
|
||||
obj:setpos({x=0,y=0,z=0});
|
||||
obj:remove();
|
||||
end
|
||||
end
|
||||
|
@ -629,8 +630,9 @@ minetest.register_node("basic_machines:mover", {
|
|||
--if prefer == "" then meta:set_string("infotext", "Mover block. must set nodes to move (filter) in inventory mode."); return; end
|
||||
|
||||
-- forbidden nodes to take from in inventory mode - to prevent abuses :
|
||||
if basic_machines.limit_inventory_table[node1.name] then
|
||||
if basic_machines.limit_inventory_table[node1.name][invName1] then -- forbidden to take from this inventory
|
||||
local limit_inventory = basic_machines.limit_inventory_table[node1.name]
|
||||
if limit_inventory then
|
||||
if limit_inventory == true or limit_inventory[invName1] then -- forbidden to take from this inventory
|
||||
return
|
||||
end
|
||||
end
|
||||
|
|
|
@ -161,17 +161,16 @@ if not init then
|
|||
return {p1,p2, nodeidx}
|
||||
end
|
||||
|
||||
get_boxes = function(blockdata)
|
||||
get_boxes = function(blockdata,boxdata)
|
||||
|
||||
local dx = blockdata[1][2].x
|
||||
local dy = blockdata[1][2].y
|
||||
local dz = blockdata[1][2].z
|
||||
|
||||
local boxdata = {}; -- will mark 'done' areas as true
|
||||
for k,v in pairs(boxdata) do boxdata[k] = nil end
|
||||
local res = {}; -- list of boxes
|
||||
|
||||
|
||||
local air_id = xxx
|
||||
for x=1,dx do
|
||||
boxdata[x] = {}
|
||||
for y = 1,dy do
|
||||
|
@ -287,12 +286,12 @@ if not init then
|
|||
--box = get_box({x=3,y=1,z=2},blockdata)
|
||||
--say(serialize(box))
|
||||
|
||||
local boxes = get_boxes(blockdata);
|
||||
local boxdata = {};
|
||||
local boxes = get_boxes(blockdata,boxdata);
|
||||
self.label("dimensions " .. blockdata[1][2].x .. " " .. blockdata[1][2].y .. " " .. blockdata[1][2].z .. ", n^3/7 = " .. blockdata[1][2].x*blockdata[1][2].y*blockdata[1][2].z/7 .. ", boxes " .. #boxes )
|
||||
--dout(serialize(boxes))
|
||||
|
||||
render_boxes(blockdata,boxes)
|
||||
|
||||
-- PROBLEM: why some boxes at end missing? is it next id problem? it seems it skips id in for loop
|
||||
|
||||
end
|
|
@ -13,7 +13,7 @@ selling: /sell price adds items in hand to shop OK
|
|||
|
||||
modname = "basic_shop";
|
||||
basic_shop = {};
|
||||
basic_shop.data = {}; -- {"item name", quantity, price, time_left, seller, minimal sell quantity}
|
||||
basic_shop.data = {}; -- {"item name", quantity, price, time_left, seller, how many items left to sell}
|
||||
basic_shop.guidata = {}; -- [name] = {idx = idx, filter = filter, sort = sort } (start index on cur. page, filter item name, sort_coloumn)
|
||||
basic_shop.bank = {}; -- bank for offline players, [name] = {balance, deposit_time},
|
||||
|
||||
|
@ -281,7 +281,7 @@ minetest.register_on_player_receive_fields(
|
|||
"Depending on how much money you have (/shop_money command) you get ability to create " ..
|
||||
"more shops with variable life span:\n\n"..
|
||||
" balance 0-4 : new player, can't create shops yet\n"..
|
||||
" balance 0-99 : new trader, 1 shop\n"..
|
||||
" balance 5-99 : new trader, 1 shop\n"..
|
||||
" balance 100-999 : medium trader, 5 shops\n"..
|
||||
" balance 1000+ : pro trader, 25 shops\n\n"..
|
||||
"All trader shop lifetime is one week ( after that shop closes down), for pro traders unlimited lifetime."
|
||||
|
@ -348,6 +348,15 @@ minetest.register_on_player_receive_fields(
|
|||
local bank_balance = bank_account[1] or 0;
|
||||
basic_shop.bank[seller] = {bank_balance + price, minetest.get_gametime()} -- balance, time of deposit.
|
||||
end
|
||||
else -- shop owner buys all and removes shop
|
||||
local inv = player:get_inventory();
|
||||
inv:add_item("main",shop_item[1] .. " " .. shop_item[6]);
|
||||
player_shops[seller] = (player_shops[seller] or 1) - 1;
|
||||
local data = {};
|
||||
for i = 1,sel-1 do data[i] = make_table_copy(basic_shop.data[i]) end -- expensive, but ok for 'small'<1000 number of shops
|
||||
for i = sel+1,#basic_shop.data do data[i-1] = make_table_copy(basic_shop.data[i]) end
|
||||
basic_shop.data = data;
|
||||
return
|
||||
end
|
||||
|
||||
local inv = player:get_inventory();
|
||||
|
|
|
@ -120,7 +120,6 @@ minetest.register_node("compost:wood_barrel_3", {
|
|||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos);
|
||||
meta:set_string("infotext","composter ready. Punch to get dirt or use it for farming - right click to insert nutrients.")
|
||||
update_composter_formspec(pos)
|
||||
end,
|
||||
|
||||
|
@ -143,6 +142,8 @@ minetest.register_abm({
|
|||
chance = 5,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.swap_node(pos, {name = "compost:wood_barrel_3"})
|
||||
local meta = minetest.get_meta(pos);
|
||||
meta:set_string("infotext","Composter ready. Punch to get dirt or use it for farming - right click to insert nutrients.")
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
@ -486,7 +486,6 @@ if sfinv then
|
|||
sfinv.register_page("sfinv:craftguide", {
|
||||
title = "Craft Guide",
|
||||
get = function(self, player, context)
|
||||
|
||||
local tmp = {
|
||||
"size[8,8.6]",
|
||||
"bgcolor[#080808BB;true]" .. default.gui_bg .. default.gui_bg_img,
|
||||
|
@ -497,6 +496,10 @@ if sfinv then
|
|||
return table.concat(tmp, "")
|
||||
end,
|
||||
|
||||
on_enter = function(self, player, context)
|
||||
craftguide:on_use(nil, player)
|
||||
end,
|
||||
|
||||
on_player_receive_fields = function(self, player, context, fields)
|
||||
--minetest.chat_send_all(minetest.serialize(fields))
|
||||
if fields.craft_guide_show then
|
||||
|
|
|
@ -117,12 +117,27 @@ function load_player_data(name)
|
|||
local pdatastring = file:read("*a");
|
||||
file:close()
|
||||
pdata = minetest.deserialize(pdatastring) or {};
|
||||
else
|
||||
minetest.chat_send_all("#skyblock: problem loading player data for " .. name .. " from file")
|
||||
end
|
||||
|
||||
pdata.stats = pdata.stats or {}; -- init
|
||||
pdata.stats.time_played = pdata.stats.time_played or 0
|
||||
pdata.stats.last_login = minetest.get_gametime() -- update
|
||||
skyblock.players[name] = pdata; return
|
||||
skyblock.players[name] = pdata;
|
||||
|
||||
-- verify data vs quest data definitions
|
||||
local level = pdata.level; if not level then return end
|
||||
for k,v in pairs( skyblock.quests[level] ) do
|
||||
if quest_types[k] then
|
||||
local w = pdata[k]; if not w then pdata[k] = {}; w = pdata[k] end
|
||||
for k_,v_ in pairs(v) do
|
||||
w[k_] = w[k_] or 0; -- if quests update define progress and set it to 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
function save_player_data(name)
|
||||
|
@ -353,8 +368,8 @@ minetest.register_globalstep(
|
|||
end
|
||||
end
|
||||
|
||||
local count = pdata[qtype][item] or 0;
|
||||
local tcount = qdef.count or 0;
|
||||
local count = pdata[qtype][item] or -1;
|
||||
local tcount = qdef.count or -1;
|
||||
local desc = qdef.description or "ERROR!";
|
||||
if count>=tcount then
|
||||
desc = minetest.colorize("Green", desc)
|
||||
|
|
Loading…
Reference in New Issue