stop stones will default to placing a single stone, and matching color, if placed on top of a go stone

master
capitalthree 1 year ago
parent 1c66e4e6c5
commit 0a2a4e4cda
  1. 14
      rules.lua

@ -355,8 +355,9 @@ function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing)
return ret
end
local under
if (pointed_thing and pointed_thing.under) then
local under = minetest.get_node(pointed_thing.under)
under = minetest.get_node(pointed_thing.under)
local override_rightclick = minetest.registered_nodes[under.name].on_rightclick
if override_rightclick then
return override_rightclick(pointed_thing.under, under, placer, itemstack, pointed_thing)
@ -364,8 +365,17 @@ function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing)
end
if pointed_thing and pointed_thing.above then
cache = {}
if under then
local reg_item = minetest.registered_items[under.name]
if reg_item and reg_item.groups and reg_item.groups.go_stone then
nodecore.set_loud(pointed_thing.above, {name = modname .. ":territory_" .. reg_item.go_team})
itemstack:set_count(itemstack:get_count() - 1)
return itemstack
end
end
cache = {}
local territories = territory_search(pointed_thing.above, itemstack:get_count())
if territories.team then
local piece = modname .. ":territory_" .. territories.team

Loading…
Cancel
Save