Compare commits

..

1 Commits

Author SHA1 Message Date
Aaron Suen ad8ba5a50b Simplify naming 1 year ago
  1. 22
      abm.lua
  2. 25
      goban.lua
  3. 7
      hints.lua
  4. 2
      init.lua
  5. 158
      models/go_stone.obj
  6. 255
      rules.lua
  7. 173
      stones.lua
  8. BIN
      textures/nc_concrete_pattern_corny.png
  9. BIN
      textures/nc_concrete_pattern_edgy.png

@ -1,22 +0,0 @@
-- LUALOCALS < ---------------------------------------------------------
local include, nodecore, math
= include, nodecore, math
-- LUALOCALS > ---------------------------------------------------------
minetest.register_abm({
label = "go smoke",
interval = 15,
chance = 1,
nodenames = {"group:go_stone"},
action = function(pos, node)
if not (node.param2 == 0) then
-- if smoke level is higher than 1, it can decay (lazy pseudoexponential decay)
if math.random() < (0.01 * (node.param2 - 1)) then
node.param2 = node.param2 - 1
minetest.swap_node(pos, node)
end
nodecore.smokefx(pos, 60, node.param2)
end
end
})

@ -3,30 +3,7 @@ local include, nodecore
= include, nodecore = include, nodecore
-- LUALOCALS > --------------------------------------------------------- -- LUALOCALS > ---------------------------------------------------------
local is_corny_pattern = {}
local function edgify(s)
return string.gsub(s, "nc_concrete_pattern_corny.png",
"nc_concrete_pattern_edgy.png")
end
nodecore.register_on_register_item(function(_, def)
if not def[is_corny_pattern] then return end
local tiles = def.tiles
if not tiles then return end
while #tiles < 6 do tiles[#tiles + 1] = tiles[#tiles] end
for i = 3, 6 do
local t = tiles[i]
if type(t) == "string" then
tiles[i] = edgify(t)
elseif type(t) == "table" and t.name then
t.name = edgify(t.name)
end
end
end)
nodecore.register_concrete_pattern({description = "Crossy"}) nodecore.register_concrete_pattern({description = "Crossy"})
nodecore.register_concrete_pattern({description = "Starcrossy"}) nodecore.register_concrete_pattern({description = "Starcrossy"})
nodecore.register_concrete_pattern({description = "Edgy", paramtype2 = "4dir"}) nodecore.register_concrete_pattern({description = "Edgy", paramtype2 = "4dir"})
nodecore.register_concrete_pattern({description = "Corny", paramtype2 = "4dir", nodecore.register_concrete_pattern({description = "Corny", paramtype2 = "4dir"})
[is_corny_pattern] = true})

@ -1,7 +0,0 @@
-- LUALOCALS < ---------------------------------------------------------
local include, nodecore
= include, nodecore
-- LUALOCALS > ---------------------------------------------------------
nodecore.register_hint("chop scored cement into go stones", "chop stones", "toolcap:choppy:3")
nodecore.register_hint("smash go stones into stop stones, for scoring your games", "smash stones", "chop stones")

@ -8,5 +8,3 @@ lc_liberties = {}
include("goban") include("goban")
include("rules") include("rules")
include("stones") include("stones")
include("hints")
include("abm")

@ -1,158 +0,0 @@
# Blender 4.0.1
# www.blender.org
o Cylinder
v -0.266270 -0.410835 -0.266147
v -0.366339 -0.237928 -0.366242
v 0.097370 -0.410835 -0.363585
v 0.133951 -0.237928 -0.500295
v 0.363573 -0.410835 -0.097381
v 0.500188 -0.237928 -0.134057
v 0.266136 -0.410835 0.266259
v 0.366136 -0.237928 0.366233
v -0.097504 -0.410835 0.363696
v -0.134154 -0.237928 0.500286
v -0.363707 -0.410835 0.097493
v -0.500392 -0.237928 0.134048
v 0.097555 -0.065020 -0.363264
v -0.266085 -0.065020 -0.265827
v 0.363758 -0.065020 -0.097061
v 0.266321 -0.065020 0.266579
v -0.097319 -0.065020 0.364016
v -0.363522 -0.065020 0.097813
v -0.155787 -0.496897 -0.155636
v 0.056983 -0.496897 -0.212647
v 0.212741 -0.496897 -0.056889
v 0.155729 -0.496897 0.155880
v -0.057040 -0.496897 0.212891
v -0.212798 -0.496897 0.057133
v 0.057091 0.021041 -0.212460
v -0.155678 0.021041 -0.155448
v 0.212849 0.021041 -0.056702
v 0.155837 0.021041 0.156067
v -0.056932 0.021041 0.213079
v -0.212690 0.021041 0.057321
vn -0.2111 -0.5784 -0.7880
vn 0.5769 -0.5782 -0.5769
vn 0.7882 -0.5780 0.2112
vn 0.2112 -0.5779 0.7883
vn 0.5768 0.5785 -0.5768
vn -0.5770 -0.5781 0.5770
vn -0.7880 -0.5783 -0.2112
vn 0.5187 -0.8436 0.1390
vn -0.5187 0.8436 -0.1390
vn -0.5771 0.5778 0.5771
vn -0.2109 0.5795 -0.7872
vn 0.7888 0.5772 0.2114
vn -0.7875 0.5791 -0.2110
vn 0.2114 0.5768 0.7890
vn -0.0000 -1.0000 -0.0000
vn -0.5184 -0.8438 -0.1389
vn 0.1390 -0.8436 0.5187
vn 0.3795 -0.8437 -0.3795
vn -0.3796 -0.8437 0.3796
vn -0.1389 -0.8438 -0.5183
vn -0.0000 1.0000 -0.0000
vn 0.1389 0.8438 0.5183
vn 0.3796 0.8437 -0.3796
vn -0.3795 0.8437 0.3795
vn 0.5184 0.8438 0.1389
vn -0.1390 0.8436 -0.5187
vt 0.595545 0.188484
vt 0.679281 0.437142
vt 0.071110 0.438746
vt 0.153491 0.189649
vt 0.595530 0.188589
vt 0.679282 0.437228
vt 0.071110 0.438729
vt 0.153475 0.189680
vt 0.595518 0.188653
vt 0.679281 0.437236
vt 0.071110 0.438817
vt 0.153464 0.189802
vt 0.595589 0.188672
vt 0.679281 0.437239
vt 0.071110 0.438841
vt 0.153534 0.189835
vt 0.596340 0.686344
vt 0.154285 0.687435
vt 0.596927 0.189709
vt 0.679285 0.438736
vt 0.071113 0.437217
vt 0.154872 0.188605
vt 0.596904 0.189648
vt 0.679278 0.438723
vt 0.071107 0.437190
vt 0.154850 0.188534
vt 0.244613 0.001363
vt 0.503263 0.000690
vt 0.153902 0.686444
vt 0.595957 0.687558
vt 0.503717 0.875528
vt 0.245066 0.874876
vt 0.596103 0.687285
vt 0.154048 0.686181
vt 0.596746 0.686482
vt 0.154692 0.687648
vt 0.596505 0.686074
vt 0.154450 0.687224
vt 0.597011 0.686002
vt 0.154956 0.687166
vt 0.583942 0.501917
vt 0.420255 0.665604
vt 0.196654 0.605690
vt 0.136740 0.382090
vt 0.300427 0.218402
vt 0.524028 0.278316
vt 0.247090 0.000457
vt 0.505740 0.001108
vt 0.244764 0.001412
vt 0.503415 0.000731
vt 0.244625 0.001179
vt 0.503276 0.000540
vt 0.247131 0.000598
vt 0.505782 0.001244
vt 0.244673 0.001079
vt 0.503323 0.000397
vt 0.421104 0.668772
vt 0.194334 0.608010
vt 0.133572 0.381240
vt 0.299578 0.215234
vt 0.526348 0.275996
vt 0.587110 0.502766
vt 0.505781 0.874572
vt 0.247131 0.875253
vt 0.505189 0.874805
vt 0.246538 0.875444
vt 0.503843 0.875331
vt 0.245193 0.874684
vt 0.505356 0.874621
vt 0.246705 0.875294
vt 0.505564 0.874905
vt 0.246913 0.875587
s 0
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/5/2 4/6/2 6/7/2 5/8/2
f 5/9/3 6/10/3 8/11/3 7/12/3
f 7/13/4 8/14/4 10/15/4 9/16/4
f 6/7/5 4/6/5 13/17/5 15/18/5
f 9/19/6 10/20/6 12/21/6 11/22/6
f 11/23/7 12/24/7 2/25/7 1/26/7
f 5/9/8 7/12/8 22/27/8 21/28/8
f 14/29/9 18/30/9 30/31/9 26/32/9
f 12/21/10 10/20/10 17/33/10 18/34/10
f 4/3/11 2/2/11 14/35/11 13/36/11
f 8/11/12 6/10/12 15/37/12 16/38/12
f 2/25/13 12/24/13 18/30/13 14/29/13
f 10/15/14 8/14/14 16/39/14 17/40/14
f 19/41/15 20/42/15 21/43/15 22/44/15 23/45/15 24/46/15
f 11/23/16 1/26/16 19/47/16 24/48/16
f 7/13/17 9/16/17 23/49/17 22/50/17
f 3/5/18 5/8/18 21/51/18 20/52/18
f 9/19/19 11/22/19 24/53/19 23/54/19
f 1/1/20 3/4/20 20/55/20 19/56/20
f 25/57/21 26/58/21 30/59/21 29/60/21 28/61/21 27/62/21
f 17/40/22 16/39/22 28/63/22 29/64/22
f 15/18/23 13/17/23 25/65/23 27/66/23
f 18/34/24 17/33/24 29/67/24 30/68/24
f 16/38/25 15/37/25 27/69/25 28/70/25
f 13/36/26 14/35/26 26/71/26 25/72/26

@ -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
@ -88,42 +86,6 @@ local function check_position(pos)
return ret return ret
end end
local function set_and_cache(pos, value)
nodecore.set_loud(pos, value)
cache[minetest.hash_node_position(pos)] = _check_position_uncached(pos)
end
local smokecontrol
if nodecore.smokeclear then
smokecontrol = function(pos, smoke)
local existing = check_position(pos)
if existing:sub(1, 1) == "S" then
local node = minetest.get_node(pos)
node.param2 = smoke
minetest.swap_node(pos, node)
if smoke then
nodecore.smokefx(pos, 60, smoke)
else
nodecore.smokeclear(pos)
end
else
if smoke then
nodecore.smokefx(pos, smoke, 1)
else
nodecore.smokeclear(pos)
end
end
end
else
smokecontrol = function(pos, smoke) end
end
-- check for walls, physical or implied -- check for walls, physical or implied
local function edge_check(pos, dir, terminate) local function edge_check(pos, dir, terminate)
local under = check_position(pos + down) local under = check_position(pos + down)
@ -181,71 +143,36 @@ 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
end elseif newnode == piece then
end stones[newhash] = newpos
end
end
final_result = final_result(#group)
final_result.stones = stones
return final_result
end
local function board_clear_fx(basepos)
local group = {basepos}
local checked = {[minetest.hash_node_position(basepos)] = basepos}
local probe = 0
while probe < #group do
probe = probe + 1
local pos = group[probe]
for i,v in pairs(neighbor_dirs(pos)) do
local newpos = pos + directions[v]
if (math.abs(newpos.x - basepos.x) <= 18) and (math.abs(newpos.z - basepos.z) <= 18) then
local newhash = minetest.hash_node_position(newpos)
local groups = minetest.registered_nodes[minetest.get_node(newpos).name].groups
if groups then
if groups.ko_stone then
set_and_cache(newpos, {name = "air"})
end
smokecontrol(newpos)
end
if (not checked[newhash]) then
group[#group+1] = newpos group[#group+1] = newpos
else
checked[newhash] = true checked[newhash] = true
end end
end end
end end
end end
final_result = final_result()
final_result.stones = stones
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
local function _check_captures_final(count) local function _check_captures_final()
return {capture = count} return {capture = true}
end end
local function check_captures(pos) local function check_captures(pos)
@ -253,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)
@ -281,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
@ -300,24 +217,10 @@ 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
local firenode = "nc_fire:fire_burst"
if not minetest.registered_nodes["nc_fire:fire_burst"] then
firenode = "nc_fire:fire"
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))
--nodecore.node_sound(pos, "dug")
local our_stone = check_position(pos) local our_stone = check_position(pos)
if our_stone:sub(1, 1) ~= "S" then if our_stone:sub(1, 1) ~= "S" then
@ -343,55 +246,28 @@ function lc_liberties.handle_placement(pos)
local node = check_position(new_pos) local node = check_position(new_pos)
if (node:sub(1, 1) == "S") and (node:sub(2, -1) ~= our_stone) then if (node:sub(1, 1) == "S") and (node:sub(2, -1) ~= our_stone) then
local captures = check_captures(new_pos) local captures = check_captures(new_pos)
if captures.capture then captured = captured or captures.capture
captured = (captured or 0) + captures.capture
end
captureses[#captureses+1] = captures captureses[#captureses+1] = captures
end end
end end
end end
local allcaptured = {}
local ko
if captured then if captured then
if captured == 1 then
for i,v in pairs(neighbor_dirs(pos)) do
local new_stone = check_position(pos + directions[v])
if (new_stone:sub(2, -1) == our_stone) or (new_stone:sub(1, 1) == "E") then
goto noko
end
end
ko = true
::noko::
end
for i,v in pairs(captureses) do for i,v in pairs(captureses) do
if v.capture then if v.capture then
local stone = check_position(v.stones[next(v.stones)]):sub(2, -1) -- minetest.get_node().name) local stone = minetest.get_node(v.stones[next(v.stones)]).name
local count = 0 local count = 0
local proximal local proximal
local proximal_c = 0 local proximal_c = 0
for i2, v2 in pairs(v.stones) do for i2, v2 in pairs(v.stones) do
allcaptured[#allcaptured + 1] = v2
if ko then
-- save ko capture position, for adding ko marker in fx phase
ko = {stone = stone, pos = v2}
end
local under = check_position(v2 + down) local under = check_position(v2 + down)
if (under:sub(1, 1) == "W") and (under:len() > 1) then if (under:sub(1, 1) == "W") and (under:len() > 1) then
nodecore.sound_play("nc_fire_ignite", {gain = 1, pos = pos}) nodecore.set_loud(v2, {name = "nc_fire:fire"})
set_and_cache(v2, {name = firenode})
else else
set_and_cache(v2, {name = "air"}) nodecore.set_loud(v2, {name = "air"})
end end
count = count + 1 count = count + 1
if (v2:distance(pos) < 2.3) then if (v2:distance(pos) < 2.3) then
proximal_c = proximal_c + 1 proximal_c = proximal_c + 1
@ -401,74 +277,37 @@ function lc_liberties.handle_placement(pos)
end end
end end
multi_eject(proximal, modname .. ":stone_" .. stone, 3, count) local stack_max = minetest.registered_items[stone].stack_max
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
-- if no capture was made, check for a self-capture and reject the move
local captures = check_captures(pos) local captures = check_captures(pos)
if captures.capture then if captures.capture then
local stone = minetest.get_node(pos).name local stone = minetest.get_node(pos).name
set_and_cache(pos, {name = "air"}) nodecore.set_loud(pos, {name = "air"})
nodecore.item_eject(pos, stone, 5) nodecore.item_eject(pos, stone, 5)
return
end
end end
board_clear_fx(pos)
smokecontrol(pos, 2+#allcaptured)
for i = #allcaptured, 1, -1 do
local chosen = math.random(1, i)
smokecontrol(allcaptured[chosen], 90)
allcaptured[chosen] = allcaptured[i]
end
if ko then
set_and_cache(ko.pos, {name = modname .. ":ko_" .. ko.stone})
end end
end end
function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing) function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing)
local control = placer.get_player_control and placer:get_player_control() cache = {}
if (control and (control.aux1 or control.sneak)) then
local ret = minetest.item_place(itemstack, placer, pointed_thing)
if (pointed_thing and pointed_thing.under) then
nodecore.node_sound(pointed_thing.under, "place")
end
return ret
end
local under if placer.get_player_control and placer:get_player_control().aux1 then
if (pointed_thing and pointed_thing.under) then return minetest.item_place(itemstack, placer, pointed_thing)
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)
end
end end
if pointed_thing and pointed_thing.above then if pointed_thing and pointed_thing.above then
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
set_and_cache(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()) 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
local count = 0 local count = 0
for i, v in pairs(territories.stones) do for i, v in pairs(territories.stones) do
set_and_cache(v, {name = piece}) nodecore.set_loud(v, {name = piece})
count = count + 1 count = count + 1
end end
itemstack:set_count(itemstack:get_count() - count) itemstack:set_count(itemstack:get_count() - count)
@ -479,35 +318,15 @@ function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing)
end end
function lc_liberties.handle_dig(pos, node, digger) function lc_liberties.handle_dig(pos, node, digger)
local control = digger.get_player_control and digger:get_player_control()
if (control and (control.aux1 or control.sneak))
~=
(minetest.registered_items[node.name].groups.go_territory_marker ~= nil)
then
cache = {} cache = {}
local stone = minetest.get_node(pos).name if digger.get_player_control and digger:get_player_control().aux1 then
for i, v in pairs(connected_group(pos).stones) do
local count = 0 minetest.node_dig(v, node, digger)
for i, v in pairs(connected_group(pos)) do
count = count + 1
set_and_cache(v, {name = "air"})
end end
multi_eject(pos, stone, 1, count, digger and digger:get_inventory())
return true return true
else else
return minetest.node_dig(pos, node, digger) return minetest.node_dig(pos, node, digger)
end end
end end
function lc_liberties.handle_click_ko(pos, node, clicker, itemstack, pointed_thing)
local handnode = minetest.registered_nodes[itemstack:get_name()]
if handnode and handnode.groups.go_stone and
handnode.go_team ~= minetest.registered_nodes[node.name].go_team then
set_and_cache(pos, {name = handnode.name})
itemstack:set_count(itemstack:get_count() - 1)
end
return itemstack
end

@ -9,164 +9,119 @@ 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 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
local desc = basedef.description or name local desc = basedef.description or name
local nodedesc_base local nodeDesc = desc .. " Go Stone"
local nameStone = string.match(desc, "(.*)stone$") minetest.register_node(":" .. piecename, {
if nameStone then description = nodeDesc,
nodedesc_base = nameStone .. " " drawtype = "nodebox",
elseif desc == "Stone" then
nodedesc_base = ""
else
nodedesc_base = desc .. " "
end
local stone_selection_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {-7/16, -8/16, -7/16, 7/16, 0/16, 7/16} fixed = {
{-3/16, -8/16, -3/16, 3/16, -7/16, 3/16},
{-5/16, -7/16, -5/16, 5/16, -6/16, 5/16},
{-6/16, -6/16, -6/16, 6/16, -4/16, 6/16},
{-7/16, -4/16, -7/16, 7/16, -2/16, 7/16},
{-6/16, -2/16, -6/16, 6/16, 0/16, 6/16},
{-5/16, 0/16, -5/16, 5/16, 1/16, 5/16},
{-3/16, 1/16, -3/16, 3/16, 2/16, 3/16},
} }
},
local go_node_base = { selection_box = {
tiles = {basedef.tiles[1]}, type = "fixed",
sounds = basedef.sounds, fixed = {-7/16, -8/16, -7/16, 7/16, 2/16, 7/16}
paramtype = "light",
paramtype2 = "none",
groups = {
snappy = 1,
falling_node = 1,
}, },
go_team = name,
}
minetest.register_node(":" .. piecename, nodecore.underride({ tiles = {
description = nodedesc_base .. "Go Stone", basedef.tiles[1]
drawtype = "mesh", },
mesh = "go_stone.obj",
selection_box = stone_selection_box, paramtype = "light",
collision_box = stone_selection_box,
mapcolor = basedef.mapcolor, sunlight_propagates = true,
groups = { groups = {
snappy = 1,
falling_node = 1,
falling_repose = 1, falling_repose = 1,
optic_opaque = 1,
go_stone = 1 go_stone = 1
}, },
on_construct = lc_liberties.handle_placement, go_team = name,
on_dig = lc_liberties.handle_dig,
on_destruct = nodecore.smokeclear,
}, go_node_base))
local territory_selection_box = { sounds = basedef.sounds,
type = "fixed",
fixed = {-5/16, -8/16, -5/16, 5/16, -2/16, 5/16}
}
-- base properties for token nodes only, which are more ephemeral than stones on_construct = lc_liberties.handle_placement,
go_node_base = nodecore.underride({
mapcolor = {a = 0},
sunlight_propagates = true,
groups = { on_dig = lc_liberties.handle_dig,
stack_as_node = 1, })
},
}, go_node_base)
local territory_name = modname .. ":territory_" .. string_lower(name) local territory_name = modname .. ":territory_" .. string_lower(name)
minetest.register_node(":" .. territory_name, nodecore.underride({ minetest.register_node(":" .. territory_name, {
description = "Stop Stone", description = "Territory Marker",
drawtype = "nodebox", drawtype = "nodebox",
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},
} }
}, },
selection_box = territory_selection_box, selection_box = {
collision_box = territory_selection_box, type = "fixed",
fixed = {-6/16, -8/16, -6/16, 6/16, 0/16, 6/16}
node_placement_prediction = "",
groups = {
go_territory_marker = 1,
}, },
on_place = lc_liberties.handle_territory_fill,
on_dig = lc_liberties.handle_dig, tiles = {
}, go_node_base)) basedef.tiles[1]
},
local ko_selection_box = { paramtype = "light",
type = "fixed",
fixed = {-8/16, -8/16, -8/16, 8/16, -4/16, 8/16}
}
minetest.register_node(":" .. modname .. ":ko_" .. string_lower(name), nodecore.underride({ sunlight_propagates = true,
description = nodedesc_base .. "Ko Stone",
drawtype = "nodebox",
node_box = { groups = {
type = "fixed", snappy = 1,
fixed = { falling_node = 1,
{-5/16, -6/16, -5/16, 5/16, -5/16, -4/16}, falling_repose = 1,
{5/16, -6/16, -5/16, 4/16, -5/16, 5/16}, go_territory_marker = 1,
{5/16, -6/16, 5/16, -5/16, -5/16, 4/16},
{-5/16, -6/16, 5/16, -4/16, -5/16, -5/16},
}
}, },
selection_box = ko_selection_box, go_team = name,
collision_box = ko_selection_box,
groups = { sounds = basedef.sounds,
falling_node = 0,
ko_stone = 1,
cheat = 1,
},
drop = "", on_place = lc_liberties.handle_territory_fill,
destroy_on_dig = true,
silktouch = false,
on_rightclick = lc_liberties.handle_click_ko, on_dig = lc_liberties.handle_dig,
}, go_node_base)) })
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 stones", label = "Smash go stones into territory markers",
action = "pummel", action = "pummel",
toolgroups = {thumpy = 3}, toolgroups = {thumpy = 3},
nodes = { nodes = {

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