|
|
@ -27,28 +27,6 @@ local solid_drawtypes = { |
|
|
|
glasslike_framed = true, |
|
|
|
glasslike_framed = true, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
local smokecontrol |
|
|
|
|
|
|
|
if nodecore.smokeclear then |
|
|
|
|
|
|
|
smokecontrol = function(pos, smoke,smoke2) |
|
|
|
|
|
|
|
local existing = _check_position_uncached(pos) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if smoke then |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--if smoke then |
|
|
|
|
|
|
|
-- nodecore.smokefx(pos, smoke, smoke2 or 1) |
|
|
|
|
|
|
|
--else |
|
|
|
|
|
|
|
-- nodecore.smokeclear(pos) |
|
|
|
|
|
|
|
--end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
smokecontrol = function(pos, smoke) end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--[[ |
|
|
|
--[[ |
|
|
|
E: air |
|
|
|
E: air |
|
|
|
E_: other empty |
|
|
|
E_: other empty |
|
|
@ -110,6 +88,42 @@ 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) |
|
|
@ -209,7 +223,7 @@ local function board_clear_fx(basepos) |
|
|
|
local groups = minetest.registered_nodes[minetest.get_node(newpos).name].groups |
|
|
|
local groups = minetest.registered_nodes[minetest.get_node(newpos).name].groups |
|
|
|
if groups then |
|
|
|
if groups then |
|
|
|
if groups.ko_stone then |
|
|
|
if groups.ko_stone then |
|
|
|
nodecore.set_loud(newpos, {name = "air"}) |
|
|
|
set_and_cache(newpos, {name = "air"}) |
|
|
|
end |
|
|
|
end |
|
|
|
smokecontrol(newpos) |
|
|
|
smokecontrol(newpos) |
|
|
|
end |
|
|
|
end |
|
|
@ -373,9 +387,9 @@ function lc_liberties.handle_placement(pos) |
|
|
|
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.sound_play("nc_fire_ignite", {gain = 1, pos = pos}) |
|
|
|
nodecore.set_loud(v2, {name = firenode}) |
|
|
|
set_and_cache(v2, {name = firenode}) |
|
|
|
else |
|
|
|
else |
|
|
|
nodecore.set_loud(v2, {name = "air"}) |
|
|
|
set_and_cache(v2, {name = "air"}) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
count = count + 1 |
|
|
|
count = count + 1 |
|
|
@ -395,7 +409,7 @@ function lc_liberties.handle_placement(pos) |
|
|
|
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 |
|
|
|
nodecore.set_loud(pos, {name = "air"}) |
|
|
|
set_and_cache(pos, {name = "air"}) |
|
|
|
nodecore.item_eject(pos, stone, 5) |
|
|
|
nodecore.item_eject(pos, stone, 5) |
|
|
|
|
|
|
|
|
|
|
|
return |
|
|
|
return |
|
|
@ -404,7 +418,7 @@ function lc_liberties.handle_placement(pos) |
|
|
|
|
|
|
|
|
|
|
|
board_clear_fx(pos) |
|
|
|
board_clear_fx(pos) |
|
|
|
|
|
|
|
|
|
|
|
smokecontrol(pos, 300, 2+#allcaptured) |
|
|
|
smokecontrol(pos, 2+#allcaptured) |
|
|
|
|
|
|
|
|
|
|
|
for i = #allcaptured, 1, -1 do |
|
|
|
for i = #allcaptured, 1, -1 do |
|
|
|
local chosen = math.random(1, i) |
|
|
|
local chosen = math.random(1, i) |
|
|
@ -413,7 +427,7 @@ function lc_liberties.handle_placement(pos) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
if ko then |
|
|
|
if ko then |
|
|
|
nodecore.set_loud(ko.pos, {name = modname .. ":ko_" .. ko.stone}) |
|
|
|
set_and_cache(ko.pos, {name = modname .. ":ko_" .. ko.stone}) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -442,7 +456,7 @@ function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing) |
|
|
|
local reg_item = minetest.registered_items[under.name] |
|
|
|
local reg_item = minetest.registered_items[under.name] |
|
|
|
|
|
|
|
|
|
|
|
if reg_item and reg_item.groups and reg_item.groups.go_stone then |
|
|
|
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}) |
|
|
|
set_and_cache(pointed_thing.above, {name = modname .. ":territory_" .. reg_item.go_team}) |
|
|
|
itemstack:set_count(itemstack:get_count() - 1) |
|
|
|
itemstack:set_count(itemstack:get_count() - 1) |
|
|
|
return itemstack |
|
|
|
return itemstack |
|
|
|
end |
|
|
|
end |
|
|
@ -454,7 +468,7 @@ function lc_liberties.handle_territory_fill(itemstack, placer, pointed_thing) |
|
|
|
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 |
|
|
|
nodecore.set_loud(v, {name = piece}) |
|
|
|
set_and_cache(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) |
|
|
@ -477,7 +491,7 @@ function lc_liberties.handle_dig(pos, node, digger) |
|
|
|
local count = 0 |
|
|
|
local count = 0 |
|
|
|
for i, v in pairs(connected_group(pos)) do |
|
|
|
for i, v in pairs(connected_group(pos)) do |
|
|
|
count = count + 1 |
|
|
|
count = count + 1 |
|
|
|
nodecore.set_loud(v, {name = "air"}) |
|
|
|
set_and_cache(v, {name = "air"}) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
multi_eject(pos, stone, 1, count, digger and digger:get_inventory()) |
|
|
|
multi_eject(pos, stone, 1, count, digger and digger:get_inventory()) |
|
|
@ -492,7 +506,7 @@ function lc_liberties.handle_click_ko(pos, node, clicker, itemstack, pointed_thi |
|
|
|
local handnode = minetest.registered_nodes[itemstack:get_name()] |
|
|
|
local handnode = minetest.registered_nodes[itemstack:get_name()] |
|
|
|
if handnode and handnode.groups.go_stone and |
|
|
|
if handnode and handnode.groups.go_stone and |
|
|
|
handnode.go_team ~= minetest.registered_nodes[node.name].go_team then |
|
|
|
handnode.go_team ~= minetest.registered_nodes[node.name].go_team then |
|
|
|
nodecore.set_loud(pos, {name = handnode.name}) |
|
|
|
set_and_cache(pos, {name = handnode.name}) |
|
|
|
itemstack:set_count(itemstack:get_count() - 1) |
|
|
|
itemstack:set_count(itemstack:get_count() - 1) |
|
|
|
end |
|
|
|
end |
|
|
|
return itemstack |
|
|
|
return itemstack |
|
|
|