|
|
@ -231,6 +231,16 @@ local function territory_search(pos, max) |
|
|
|
) |
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function multi_eject(proximal, stone, speed, count, inv) |
|
|
|
|
|
|
|
local stack_max = minetest.registered_items[stone].stack_max |
|
|
|
|
|
|
|
while count > 0 do |
|
|
|
|
|
|
|
local items = stone .. " " .. math.min(count, stack_max) |
|
|
|
|
|
|
|
if inv then items = inv:add_item("main", items) end |
|
|
|
|
|
|
|
nodecore.item_eject(proximal, items, speed) |
|
|
|
|
|
|
|
count = count - stack_max |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function lc_liberties.handle_placement(pos) |
|
|
|
function lc_liberties.handle_placement(pos) |
|
|
|
cache = {} |
|
|
|
cache = {} |
|
|
|
--minetest.chat_send_all(tostring(pos)) |
|
|
|
--minetest.chat_send_all(tostring(pos)) |
|
|
@ -291,11 +301,7 @@ function lc_liberties.handle_placement(pos) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
local stack_max = minetest.registered_items[stone].stack_max |
|
|
|
multi_eject(proximal, stone, 3, count) |
|
|
|
while count > 0 do |
|
|
|
|
|
|
|
nodecore.item_eject(proximal, stone .. " " .. math.min(count, stack_max), 3) |
|
|
|
|
|
|
|
count = count - stack_max |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
else |
|
|
|
else |
|
|
@ -308,7 +314,7 @@ function lc_liberties.handle_placement(pos) |
|
|
|
for x=pos.x-18, pos.x+18 do |
|
|
|
for x=pos.x-18, pos.x+18 do |
|
|
|
for z=pos.z-18, pos.z+18 do |
|
|
|
for z=pos.z-18, pos.z+18 do |
|
|
|
if (x ~= pos.x) or (z ~= pos.z) then |
|
|
|
if (x ~= pos.x) or (z ~= pos.z) then |
|
|
|
nodecore.smokequell({x = x, y = pos.y, z = z}) |
|
|
|
nodecore.smokeclear({x = x, y = pos.y, z = z}) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -351,12 +357,21 @@ function lc_liberties.handle_dig(pos, node, digger) |
|
|
|
~= |
|
|
|
~= |
|
|
|
(minetest.registered_items[node.name].groups.go_territory_marker ~= nil) |
|
|
|
(minetest.registered_items[node.name].groups.go_territory_marker ~= nil) |
|
|
|
then |
|
|
|
then |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local stone = minetest.get_node(pos).name |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local count = 0 |
|
|
|
for i, v in pairs(connected_group(pos)) do |
|
|
|
for i, v in pairs(connected_group(pos)) do |
|
|
|
minetest.node_dig(v, node, digger) |
|
|
|
count = count + 1 |
|
|
|
|
|
|
|
nodecore.smokeclear(v) |
|
|
|
|
|
|
|
nodecore.set_loud(v, {name = "air"}) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
multi_eject(pos, stone, 1, count, digger and digger:get_inventory()) |
|
|
|
|
|
|
|
|
|
|
|
return true |
|
|
|
return true |
|
|
|
else |
|
|
|
else |
|
|
|
|
|
|
|
nodecore.smokeclear(pos) |
|
|
|
return minetest.node_dig(pos, node, digger) |
|
|
|
return minetest.node_dig(pos, node, digger) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|