factored out nodedefs with underride

master
capitalthree 12 months ago
parent 0b24f22b71
commit bb41211163
  1. 71
      stones.lua

@ -47,7 +47,21 @@ local function reg(name, basename, basedef)
fixed = {-7/16, -8/16, -7/16, 7/16, 0/16, 7/16} fixed = {-7/16, -8/16, -7/16, 7/16, 0/16, 7/16}
} }
minetest.register_node(":" .. piecename, { local go_node_base = {
tiles = {basedef.tiles[1]},
sounds = basedef.sounds,
paramtype = "light",
groups = {
snappy = 1,
falling_node = 1,
},
go_team = name,
}
minetest.register_node(":" .. piecename, nodecore.underride({
description = nodedesc_base .. "Go Stone", description = nodedesc_base .. "Go Stone",
drawtype = "mesh", drawtype = "mesh",
mesh = "go_stone.obj", mesh = "go_stone.obj",
@ -55,38 +69,38 @@ local function reg(name, basename, basedef)
selection_box = stone_selection_box, selection_box = stone_selection_box,
collision_box = stone_selection_box, collision_box = stone_selection_box,
tiles = {basedef.tiles[1]},
sounds = basedef.sounds,
mapcolor = basedef.mapcolor, mapcolor = basedef.mapcolor,
paramtype = "light",
sunlight_propagates = true,
groups = { groups = {
snappy = 1,
falling_node = 1,
falling_repose = 1, falling_repose = 1,
optic_opaque = 1, optic_opaque = 1,
go_stone = 1 go_stone = 1
}, },
go_team = name,
on_construct = lc_liberties.handle_placement, on_construct = lc_liberties.handle_placement,
on_dig = lc_liberties.handle_dig, on_dig = lc_liberties.handle_dig,
on_destruct = nodecore.smokeclear, on_destruct = nodecore.smokeclear,
}) }, go_node_base))
local territory_selection_box = { local territory_selection_box = {
type = "fixed", type = "fixed",
fixed = {-5/16, -8/16, -5/16, 5/16, -2/16, 5/16} 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
go_node_base = nodecore.underride({
mapcolor = {a = 0},
sunlight_propagates = true,
groups = {
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, { minetest.register_node(":" .. territory_name, nodecore.underride({
description = "Stop Stone", description = "Stop Stone",
drawtype = "nodebox", drawtype = "nodebox",
@ -103,34 +117,21 @@ local function reg(name, basename, basedef)
node_placement_prediction = "", node_placement_prediction = "",
tiles = {basedef.tiles[1]},
sounds = basedef.sounds,
mapcolor = {a = 0},
paramtype = "light",
sunlight_propagates = true,
groups = { groups = {
snappy = 1,
falling_node = 1,
go_territory_marker = 1, go_territory_marker = 1,
stack_as_node = 1,
}, },
go_team = name,
on_place = lc_liberties.handle_territory_fill, on_place = lc_liberties.handle_territory_fill,
on_dig = lc_liberties.handle_dig, on_dig = lc_liberties.handle_dig,
}) }, go_node_base))
local ko_selection_box = { local ko_selection_box = {
type = "fixed", type = "fixed",
fixed = {-8/16, -8/16, -8/16, 8/16, -4/16, 8/16} fixed = {-8/16, -8/16, -8/16, 8/16, -4/16, 8/16}
} }
minetest.register_node(":" .. modname .. ":ko_" .. string_lower(name), { minetest.register_node(":" .. modname .. ":ko_" .. string_lower(name), nodecore.underride({
description = nodedesc_base .. "Ko Stone", description = nodedesc_base .. "Ko Stone",
drawtype = "nodebox", drawtype = "nodebox",
@ -147,16 +148,8 @@ local function reg(name, basename, basedef)
selection_box = ko_selection_box, selection_box = ko_selection_box,
collision_box = ko_selection_box, collision_box = ko_selection_box,
tiles = {basedef.tiles[1]},
sounds = basedef.sounds,
mapcolor = {a = 0},
paramtype = "light",
sunlight_propagates = true,
groups = { groups = {
snappy = 1, falling_node = 0,
stack_as_node = 1,
ko_stone = 1, ko_stone = 1,
cheat = 1, cheat = 1,
}, },
@ -165,10 +158,8 @@ local function reg(name, basename, basedef)
destroy_on_dig = true, destroy_on_dig = true,
silktouch = false, silktouch = false,
go_team = name,
on_rightclick = lc_liberties.handle_click_ko, on_rightclick = lc_liberties.handle_click_ko,
}) }, go_node_base))
reg_stone_craft(name, "crossy") reg_stone_craft(name, "crossy")
reg_stone_craft(name, "starcrossy") reg_stone_craft(name, "starcrossy")

Loading…
Cancel
Save