allow specifying a custom "base" node for the pole
(like if the bottom part should be bigger than the rest of the pole, or has some details such as bolts securing it to the ground)
This commit is contained in:
parent
42f775f716
commit
92eb5b9e8d
@ -34,6 +34,7 @@ end
|
||||
function streetlights.check_and_place(itemstack, placer, pointed_thing, def)
|
||||
|
||||
local pole = def.pole
|
||||
local base = def.base or def.pole
|
||||
local light = def.light
|
||||
local param2 = def.param2
|
||||
local height = def.height or 5
|
||||
@ -149,7 +150,10 @@ function streetlights.check_and_place(itemstack, placer, pointed_thing, def)
|
||||
pole2 = pole.."_digilines"
|
||||
end
|
||||
|
||||
for i = 1, height do
|
||||
local pos2b = {x=pos1.x, y = pos1.y+1, z=pos1.z}
|
||||
minetest.set_node(pos2b, {name = base })
|
||||
|
||||
for i = 2, height do
|
||||
pos2 = {x=pos1.x, y = pos1.y+i, z=pos1.z}
|
||||
minetest.set_node(pos2, {name = pole2 })
|
||||
end
|
||||
|
10
simple.lua
10
simple.lua
@ -30,7 +30,7 @@ end
|
||||
local digiline_wire_node = "digilines:wire_std_00000000"
|
||||
|
||||
local poles_tab = {
|
||||
-- material name, mod name, node name, optional height, has top section
|
||||
-- material name, mod name, node name, optional base, optional height, has top section
|
||||
{ "wood", "default", "default:fence_wood" },
|
||||
{ "junglewood", "default", "default:fence_junglewood" },
|
||||
{ "brass", "homedecor_fences", "homedecor:fence_brass"},
|
||||
@ -49,8 +49,9 @@ for _, pole in ipairs(poles_tab) do
|
||||
local matname = pole[1]
|
||||
local matmod = pole[2]
|
||||
local matnode = pole[3]
|
||||
local height = pole[4] or 5
|
||||
local has_top = (pole[5] ~= false)
|
||||
local basenode = pole[4]
|
||||
local height = pole[5]
|
||||
local has_top = pole[6]
|
||||
|
||||
if minetest.get_modpath(matmod) then
|
||||
|
||||
@ -117,6 +118,7 @@ for _, pole in ipairs(poles_tab) do
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
streetlights.check_and_place(itemstack, placer, pointed_thing, {
|
||||
base=basenode,
|
||||
pole=matnode,
|
||||
light=lightnode,
|
||||
param2=lightparam2,
|
||||
@ -151,6 +153,7 @@ for _, pole in ipairs(poles_tab) do
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
streetlights.check_and_place(itemstack, placer, pointed_thing, {
|
||||
base=basenode,
|
||||
pole=matnode,
|
||||
light=lightnode,
|
||||
param2=lightparam2,
|
||||
@ -208,6 +211,7 @@ for _, pole in ipairs(poles_tab) do
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
streetlights.check_and_place(itemstack, placer, pointed_thing, {
|
||||
base=basenode,
|
||||
pole=matnode,
|
||||
light=lightnode,
|
||||
param2=lightparam2,
|
||||
|
Loading…
x
Reference in New Issue
Block a user