From d788495988269041c267d2779eb767982588b9d1 Mon Sep 17 00:00:00 2001 From: capitalthree Date: Wed, 22 Nov 2023 04:30:40 -0600 Subject: [PATCH] enable crafting go stones with crossy as well as starcrossy --- rules.lua | 4 ++-- stones.lua | 31 +++++++++++++++++++------------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/rules.lua b/rules.lua index 6235bd5..cd06f9f 100644 --- a/rules.lua +++ b/rules.lua @@ -295,8 +295,6 @@ function lc_liberties.handle_placement(pos) end function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing) - cache = {} - if (placer.get_player_control and placer:get_player_control().aux1) or (pointed_thing and pointed_thing.under and minetest.get_node(pointed_thing.under).name == "nc_items:stack") @@ -305,6 +303,8 @@ function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing) end if pointed_thing and pointed_thing.above then + cache = {} + local territories = territory_search(pointed_thing.above, itemstack:get_count()) if territories.team then local piece = modname .. ":territory_" .. territories.team diff --git a/stones.lua b/stones.lua index bb5fd5f..3ebbf9f 100644 --- a/stones.lua +++ b/stones.lua @@ -9,6 +9,23 @@ include("rules") local modname = minetest.get_current_modname() +local function reg_stone_craft(name, pattern) + local piecename = modname .. ":stone_" .. string_lower(name) + + nodecore.register_craft({ + label = "Chop scored cement into go stones", + action = "pummel", + toolgroups = {choppy = 3}, + nodes = { + { + match = "nc_concrete:" .. name .. "_" .. pattern .. "_ply", + replace = "air" + } + }, + items = {{name = piecename, count = 3, scatter = 4}}, + }) +end + local function reg(name, basename, basedef) local piecename = modname .. ":stone_" .. string_lower(name) if minetest.registered_nodes[piecename] then return end @@ -119,18 +136,8 @@ local function reg(name, basename, basedef) on_dig = lc_liberties.handle_dig, }) - nodecore.register_craft({ - label = "Chop scored cement into go stones", - action = "pummel", - toolgroups = {choppy = 3}, - nodes = { - { - match = "nc_concrete:" .. name .. "_starcrossy_ply", - replace = "air" - } - }, - items = {{name = piecename, count = 3, scatter = 4}}, - }) + reg_stone_craft(name, "crossy") + reg_stone_craft(name, "starcrossy") nodecore.register_craft({ label = "Smash go stones into territory markers",