From 6a77451fc0163b44f801e256ea5211bd5de0ec63 Mon Sep 17 00:00:00 2001 From: capitalthree Date: Tue, 21 Nov 2023 02:46:15 -0600 Subject: [PATCH] added smaller territory marker stones for scoring --- rules.lua | 6 ++--- stones.lua | 72 ++++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 65 insertions(+), 13 deletions(-) diff --git a/rules.lua b/rules.lua index 3cccb3f..49f445f 100644 --- a/rules.lua +++ b/rules.lua @@ -156,7 +156,7 @@ end function lc_liberties.handle_placement(pos) cache = {} - minetest.chat_send_all(tostring(pos)) + --minetest.chat_send_all(tostring(pos)) --nodecore.node_sound(pos, "dug") local our_stone = check_position(pos) @@ -211,7 +211,7 @@ function lc_liberties.handle_placement(pos) local stack_max = minetest.registered_items[stone].stack_max while count > 0 do - nodecore.item_eject(proximal, stone .. " " .. math.min(count, stack_max)) + nodecore.item_eject(proximal, stone .. " " .. math.min(count, stack_max), 3) count = count - stack_max end end @@ -221,7 +221,7 @@ function lc_liberties.handle_placement(pos) if captures.capture then local stone = minetest.get_node(pos).name nodecore.set_loud(pos, {name = "air"}) - nodecore.item_eject(pos, stone) + nodecore.item_eject(pos, stone, 5) end end end diff --git a/stones.lua b/stones.lua index 1398a25..de93274 100644 --- a/stones.lua +++ b/stones.lua @@ -71,17 +71,69 @@ local function reg(name, basename, basedef) on_construct = lc_liberties.handle_placement }) + local territory_name = modname .. ":territory_" .. string_lower(name) + minetest.register_node(":" .. territory_name, { + description = "Territory Marker", + drawtype = "nodebox", + + node_box = { + type = "fixed", + fixed = { + {-2/16, -8/16, -2/16, 2/16, -7/16, 2/16}, + {-3/16, -7/16, -3/16, 3/16, -6/16, 3/16}, + {-2/16, -6/16, -2/16, 2/16, -5/16, 2/16}, + } + }, + + selection_box = { + type = "fixed", + fixed = {-6/16, -8/16, -6/16, 6/16, 0/16, 6/16} + }, + + + tiles = { + basedef.tiles[1] + }, + + paramtype = "light", + + sunlight_propagates = true, + + groups = { + snappy = 1, + falling_node = 1, + falling_repose = 1, + }, + + go_team = name, + + sounds = basedef.sounds, + }) + nodecore.register_craft({ - label = "shave " .. string_lower(desc) .. " into stones", - action = "pummel", - toolgroups = {choppy = 3}, - nodes = { - { - match = "nc_concrete:" .. name .. "_starcrossy_ply", - replace = "air" - } - }, - items = {{name = piecename, count = 3, scatter = 4}}, + 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}}, + }) + + nodecore.register_craft({ + label = "Smash go stones into territory markers", + action = "pummel", + toolgroups = {thumpy = 3}, + nodes = { + { + match = piecename, + replace = "air" + } + }, + items = {{name = territory_name, count = 9, scatter = 4}}, }) end