Compare commits

..

No commits in common. '300ec81e0864d3ec5cfe370a09f5a8321e1b2803' and '558a45b705de3038d8b684af9306517ba93d7c53' have entirely different histories.

  1. 72
      rules.lua
  2. 77
      stones.lua
  3. BIN
      textures/nc_concrete_pattern_corny.png
  4. BIN
      textures/nc_concrete_pattern_edgy.png

@ -11,8 +11,6 @@ local modname = minetest.get_current_modname()
local cache = {} local cache = {}
local global_search_maximum = 361
local directions = { [0] = local directions = { [0] =
vector.new(0, 0, -1), vector.new(0, 0, -1),
vector.new(-1, 0, 0), vector.new(-1, 0, 0),
@ -60,9 +58,9 @@ local function _check_position_uncached(pos)
if reg_item.pattern_def then if reg_item.pattern_def then
if reg_item.pattern_def.name == "edgy" then if reg_item.pattern_def.name == "edgy" then
return "WE" .. ((node.param2+2)%4) return "WE" .. node.param2
elseif reg_item.pattern_def.name == "corny" then elseif reg_item.pattern_def.name == "corny" then
return "WC" .. ((node.param2+2)%4) return "WC" .. node.param2
elseif reg_item.pattern_def.name == "crossy" then elseif reg_item.pattern_def.name == "crossy" then
return "WB" return "WB"
elseif reg_item.pattern_def.name == "starcrossy" then elseif reg_item.pattern_def.name == "starcrossy" then
@ -145,20 +143,18 @@ local function connected_search(pos, final_result, early_termination_filter)
if (not stones[newhash]) and (not checked[newhash]) then if (not stones[newhash]) and (not checked[newhash]) then
local newnode = check_position(newpos) local newnode = check_position(newpos)
if newnode == piece then
stones[newhash] = newpos
group[#group+1] = newpos
else
checked[newhash] = true
end
local filter_result local filter_result
if early_termination_filter then if early_termination_filter then
filter_result = early_termination_filter(newnode, #group) filter_result = early_termination_filter(newnode)
end end
if filter_result then if filter_result then
filter_result.stones = stones filter_result.stones = stones
return filter_result return filter_result
elseif newnode == piece then
stones[newhash] = newpos
group[#group+1] = newpos
else
checked[newhash] = true
end end
end end
end end
@ -169,8 +165,8 @@ local function connected_search(pos, final_result, early_termination_filter)
return final_result return final_result
end end
local function _check_captures_filter(node, count) local function _check_captures_filter(node)
if (count > global_search_maximum) or (node:sub(1, 1) == "E") then if node:sub(1, 1) == "E" then
return {capture = false} return {capture = false}
end end
end end
@ -184,22 +180,11 @@ local function check_captures(pos)
end end
local function _connected_group_final() local function _connected_group_final()
return {complete = true}
end
local function _connected_group_filter(node, count)
if (count > global_search_maximum) then
return {} return {}
end end
end
local function connected_group(pos) local function connected_group(pos)
local search = connected_search(pos, _connected_group_final, _connected_group_filter) return connected_search(pos, _connected_group_final)
if search.complete then
return search.stones
else
return {pos}
end
end end
local function territory_search(pos, max) local function territory_search(pos, max)
@ -212,12 +197,13 @@ local function territory_search(pos, max)
function() function()
return {team = team} return {team = team}
end, end,
function(node, count) function(node)
if (count > max) then if node == "E" then
max = max - 1
if max <= 0 then
return {} return {}
end end
elseif node ~= "E_" and ((node:sub(1, 1) == "E") or (node:sub(1, 1) == "S")) and node:len() > 1 then
if node ~= "E_" and ((node:sub(1, 1) == "E") or (node:sub(1, 1) == "S")) and node:len() > 1 then
node = node:sub(2, -1) node = node:sub(2, -1)
if team then if team then
if team ~= node then if team ~= node then
@ -304,31 +290,18 @@ function lc_liberties.handle_placement(pos)
local stone = minetest.get_node(pos).name local stone = minetest.get_node(pos).name
nodecore.set_loud(pos, {name = "air"}) nodecore.set_loud(pos, {name = "air"})
nodecore.item_eject(pos, stone, 5) nodecore.item_eject(pos, stone, 5)
else
for x=pos.x-18, pos.x+18 do
for z=pos.z-18, pos.z+18 do
if (x ~= pos.x) or (z ~= pos.z) then
nodecore.smokequell({x = x, y = pos.y, z = z})
end
end
end
nodecore.smokefx(pos, 300, 2)
end end
end end
end end
function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing) function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing)
if (placer.get_player_control and placer:get_player_control().aux1) cache = {}
or
(pointed_thing and pointed_thing.under and minetest.get_node(pointed_thing.under).name == "nc_items:stack") if placer.get_player_control and placer:get_player_control().aux1 then
then
return minetest.item_place(itemstack, placer, pointed_thing) return minetest.item_place(itemstack, placer, pointed_thing)
end end
if pointed_thing and pointed_thing.above then if pointed_thing and pointed_thing.above then
cache = {}
local territories = territory_search(pointed_thing.above, itemstack:get_count()) local territories = territory_search(pointed_thing.above, itemstack:get_count())
if territories.team then if territories.team then
local piece = modname .. ":territory_" .. territories.team local piece = modname .. ":territory_" .. territories.team
@ -347,11 +320,8 @@ end
function lc_liberties.handle_dig(pos, node, digger) function lc_liberties.handle_dig(pos, node, digger)
cache = {} cache = {}
if (digger.get_player_control and digger:get_player_control().aux1) if digger.get_player_control and digger:get_player_control().aux1 then
~= for i, v in pairs(connected_group(pos).stones) do
(minetest.registered_items[node.name].groups.go_territory_marker ~= nil)
then
for i, v in pairs(connected_group(pos)) do
minetest.node_dig(v, node, digger) minetest.node_dig(v, node, digger)
end end

@ -9,23 +9,6 @@ include("rules")
local modname = minetest.get_current_modname() 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 function reg(name, basename, basedef)
local piecename = modname .. ":stone_" .. string_lower(name) local piecename = modname .. ":stone_" .. string_lower(name)
if minetest.registered_nodes[piecename] then return end if minetest.registered_nodes[piecename] then return end
@ -50,38 +33,13 @@ local function reg(name, basename, basedef)
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-2/16, -8/16, -2/16, 2/16, -0/16, 2/16}, {-3/16, -8/16, -3/16, 3/16, -7/16, 3/16},
{-4/16, -7/16, -5/16, 4/16, -1/16, 5/16}, {-5/16, -7/16, -5/16, 5/16, -6/16, 5/16},
{-5/16, -7/16, -4/16, 5/16, -1/16, 4/16}, {-6/16, -6/16, -6/16, 6/16, -4/16, 6/16},
{-5/16, -6/16, -6/16, 5/16, -2/16, 6/16}, {-7/16, -4/16, -7/16, 7/16, -2/16, 7/16},
{-6/16, -6/16, -5/16, 6/16, -2/16, 5/16}, {-6/16, -2/16, -6/16, 6/16, 0/16, 6/16},
{-3/16, -5/16, -7/16, 3/16, -3/16, 7/16}, {-5/16, 0/16, -5/16, 5/16, 1/16, 5/16},
{-7/16, -5/16, -3/16, 7/16, -3/16, 3/16}, {-3/16, 1/16, -3/16, 3/16, 2/16, 3/16},
-- wolfie model high-detail-ified:
--{-3/16, -8/16, -2/16, 3/16, -0/16, 2/16},
--{-2/16, -8/16, -3/16, 2/16, -0/16, 3/16},
--{-4/16, -7/16, -5/16, 4/16, -1/16, 5/16},
--{-5/16, -7/16, -4/16, 5/16, -1/16, 4/16},
--{-5/16, -5/16, -6/16, 5/16, -3/16, 6/16},
--{-6/16, -5/16, -5/16, 6/16, -3/16, 5/16},
--{-4/16, -6/16, -6/16, 4/16, -2/16, 6/16},
--{-6/16, -6/16, -4/16, 6/16, -2/16, 4/16},
--{-5/16, -6/16, -5/16, 5/16, -2/16, 5/16},
--{-3/16, -5/16, -7/16, 3/16, -3/16, 7/16},
--{-7/16, -5/16, -3/16, 7/16, -3/16, 3/16},
-- lizzie's pre-wolfie model:
--{-2/16, -8/16, -2/16, 2/16, -0/16, 2/16},
--{-4/16, -7/16, -5/16, 4/16, -1/16, 5/16},
--{-5/16, -7/16, -4/16, 5/16, -1/16, 4/16},
--{-5/16, -6/16, -6/16, 5/16, -2/16, 6/16},
--{-6/16, -6/16, -5/16, 6/16, -2/16, 5/16},
--{-5/16, -5/16, -7/16, 5/16, -3/16, 7/16},
--{-7/16, -5/16, -5/16, 7/16, -3/16, 5/16},
--{-6/16, -5/16, -6/16, 6/16, -3/16, 6/16},
} }
}, },
@ -90,6 +48,7 @@ local function reg(name, basename, basedef)
fixed = {-7/16, -8/16, -7/16, 7/16, 2/16, 7/16} fixed = {-7/16, -8/16, -7/16, 7/16, 2/16, 7/16}
}, },
tiles = { tiles = {
basedef.tiles[1] basedef.tiles[1]
}, },
@ -102,7 +61,6 @@ local function reg(name, basename, basedef)
snappy = 1, snappy = 1,
falling_node = 1, falling_node = 1,
falling_repose = 1, falling_repose = 1,
optic_opaque = 1,
go_stone = 1 go_stone = 1
}, },
@ -123,8 +81,9 @@ local function reg(name, basename, basedef)
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-2/16, -8/16, -2/16, 2/16, -5/16, 2/16}, {-2/16, -8/16, -2/16, 2/16, -7/16, 2/16},
{-3/16, -7/16, -3/16, 3/16, -6/16, 3/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},
} }
}, },
@ -133,7 +92,6 @@ local function reg(name, basename, basedef)
fixed = {-6/16, -8/16, -6/16, 6/16, 0/16, 6/16} fixed = {-6/16, -8/16, -6/16, 6/16, 0/16, 6/16}
}, },
node_placement_prediction = "",
tiles = { tiles = {
basedef.tiles[1] basedef.tiles[1]
@ -148,7 +106,6 @@ local function reg(name, basename, basedef)
falling_node = 1, falling_node = 1,
falling_repose = 1, falling_repose = 1,
go_territory_marker = 1, go_territory_marker = 1,
stack_as_node = 1,
}, },
go_team = name, go_team = name,
@ -160,8 +117,18 @@ local function reg(name, basename, basedef)
on_dig = lc_liberties.handle_dig, on_dig = lc_liberties.handle_dig,
}) })
reg_stone_craft(name, "crossy") nodecore.register_craft({
reg_stone_craft(name, "starcrossy") 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({ nodecore.register_craft({
label = "Smash go stones into territory markers", label = "Smash go stones into territory markers",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 B

After

Width:  |  Height:  |  Size: 109 B

Loading…
Cancel
Save