pass streetlight "model" parameters via table
This commit is contained in:
parent
5815180b0e
commit
6c4bfd6205
@ -31,7 +31,14 @@ function streetlights.rightclick_pointed_thing(pos, placer, itemstack, pointed_t
|
||||
return def.on_rightclick(pos, node, placer, itemstack, pointed_thing) or itemstack
|
||||
end
|
||||
|
||||
function streetlights.check_and_place(itemstack, placer, pointed_thing, pole, light, param2, needs_digiline_wire, distributor_node)
|
||||
function streetlights.check_and_place(itemstack, placer, pointed_thing, def)
|
||||
|
||||
local pole = def.pole
|
||||
local light = def.light
|
||||
local param2 = def.param2
|
||||
local needs_digiline_wire = def.needs_digiline_wire
|
||||
local distributor_node = def.distributor_node
|
||||
|
||||
local controls = placer:get_player_control()
|
||||
if not placer then return end
|
||||
local playername = placer:get_player_name()
|
||||
|
21
simple.lua
21
simple.lua
@ -114,7 +114,11 @@ for _, pole in ipairs(poles_tab) do
|
||||
use_texture_alpha = true,
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
streetlights.check_and_place(itemstack, placer, pointed_thing, matnode, lightnode, lightparam2)
|
||||
streetlights.check_and_place(itemstack, placer, pointed_thing, {
|
||||
pole=matnode,
|
||||
light=lightnode,
|
||||
param2=lightparam2
|
||||
})
|
||||
end
|
||||
})
|
||||
|
||||
@ -142,7 +146,12 @@ for _, pole in ipairs(poles_tab) do
|
||||
use_texture_alpha = true,
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
streetlights.check_and_place(itemstack, placer, pointed_thing, matnode, lightnode, lightparam2, true)
|
||||
streetlights.check_and_place(itemstack, placer, pointed_thing, {
|
||||
pole=matnode,
|
||||
light=lightnode,
|
||||
param2=lightparam2,
|
||||
needs_digiline_wire=true
|
||||
})
|
||||
end,
|
||||
on_use = ilights.digiline_on_use
|
||||
})
|
||||
@ -192,7 +201,13 @@ for _, pole in ipairs(poles_tab) do
|
||||
use_texture_alpha = true,
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
streetlights.check_and_place(itemstack, placer, pointed_thing, matnode, lightnode, lightparam2, true, distributor)
|
||||
streetlights.check_and_place(itemstack, placer, pointed_thing, {
|
||||
pole=matnode,
|
||||
light=lightnode,
|
||||
param2=lightparam2,
|
||||
needs_digiline_wire=true,
|
||||
distributor_node=distributor
|
||||
})
|
||||
end,
|
||||
on_use = ilights.digiline_on_use
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user