update homedecor and simple_streetlights
@ -126,7 +126,7 @@ minetest.register_node(":homedecor:glowlight_small_cube", {
|
||||
})
|
||||
|
||||
homedecor.register("plasma_lamp", {
|
||||
description = S("Plasma Lamp"),
|
||||
description = S("Plasma Lamp/Light"),
|
||||
drawtype = "mesh",
|
||||
mesh = "plasma_lamp.obj",
|
||||
tiles = {
|
||||
@ -273,7 +273,7 @@ local ol_cbox = {
|
||||
}
|
||||
|
||||
homedecor.register("oil_lamp", {
|
||||
description = S("Oil lamp (hurricane)"),
|
||||
description = S("Oil lamp/Light (hurricane)"),
|
||||
mesh = "homedecor_oil_lamp.obj",
|
||||
tiles = {
|
||||
"homedecor_generic_metal_brass.png",
|
||||
@ -293,7 +293,7 @@ homedecor.register("oil_lamp", {
|
||||
})
|
||||
|
||||
homedecor.register("oil_lamp_tabletop", {
|
||||
description = S("Oil Lamp (tabletop)"),
|
||||
description = S("Oil Lamp/Light (tabletop)"),
|
||||
mesh = "homedecor_oil_lamp_tabletop.obj",
|
||||
tiles = {"homedecor_oil_lamp_tabletop.png"},
|
||||
inventory_image = "homedecor_oil_lamp_tabletop_inv.png",
|
||||
@ -312,7 +312,7 @@ local gl_cbox = {
|
||||
minetest.register_alias("homedecor:wall_lantern", "homedecor:ground_lantern")
|
||||
|
||||
homedecor.register("ground_lantern", {
|
||||
description = S("Ground Lantern"),
|
||||
description = S("Ground Lantern/Light"),
|
||||
mesh = "homedecor_ground_lantern.obj",
|
||||
tiles = { "homedecor_light.png", "homedecor_generic_metal_wrought_iron.png" },
|
||||
use_texture_alpha = true,
|
||||
@ -330,7 +330,7 @@ local hl_cbox = {
|
||||
}
|
||||
|
||||
homedecor.register("hanging_lantern", {
|
||||
description = S("Hanging Lantern"),
|
||||
description = S("Hanging Lantern/Light"),
|
||||
mesh = "homedecor_hanging_lantern.obj",
|
||||
tiles = { "homedecor_generic_metal_wrought_iron.png", "homedecor_light.png" },
|
||||
use_texture_alpha = true,
|
||||
@ -353,7 +353,7 @@ homedecor.register("ceiling_lantern", {
|
||||
tiles = { "homedecor_light.png", "homedecor_generic_metal_wrought_iron.png" },
|
||||
use_texture_alpha = true,
|
||||
inventory_image = "homedecor_ceiling_lantern_inv.png",
|
||||
description = S("Ceiling Lantern"),
|
||||
description = S("Ceiling Lantern/Light"),
|
||||
groups = {snappy=3},
|
||||
light_source = 11,
|
||||
selection_box = cl_cbox,
|
||||
@ -367,7 +367,7 @@ if minetest.get_modpath("darkage") then
|
||||
sm_light = default.LIGHT_MAX-5
|
||||
else
|
||||
homedecor.register("lattice_lantern_large", {
|
||||
description = S("Lattice lantern (large)"),
|
||||
description = S("Lattice lantern/Light (large)"),
|
||||
tiles = { 'homedecor_lattice_lantern_large.png' },
|
||||
groups = { snappy = 3 },
|
||||
light_source = default.LIGHT_MAX,
|
||||
@ -438,7 +438,7 @@ local function reg_lamp(suffix, nxt, light, brightness)
|
||||
local wool_brighten = (light or 0) * 15
|
||||
|
||||
homedecor.register("table_lamp_"..suffix, {
|
||||
description = S("Table Lamp"),
|
||||
description = S("Table Lamp/Light"),
|
||||
mesh = "homedecor_table_lamp.obj",
|
||||
tiles = {
|
||||
"wool_grey.png^[colorize:#ffffff:"..wool_brighten,
|
||||
@ -471,7 +471,7 @@ local function reg_lamp(suffix, nxt, light, brightness)
|
||||
})
|
||||
|
||||
homedecor.register("standing_lamp_"..suffix, {
|
||||
description = S("Standing Lamp"),
|
||||
description = S("Standing Lamp/Light"),
|
||||
mesh = "homedecor_standing_lamp.obj",
|
||||
tiles = {
|
||||
"wool_grey.png^[colorize:#ffffff:"..wool_brighten,
|
||||
@ -522,7 +522,7 @@ local dlamp_cbox = {
|
||||
}
|
||||
|
||||
homedecor.register("desk_lamp", {
|
||||
description = S("Desk Lamp"),
|
||||
description = S("Desk Lamp/Light"),
|
||||
mesh = "homedecor_desk_lamp.obj",
|
||||
tiles = {
|
||||
"homedecor_generic_metal.png",
|
||||
@ -547,7 +547,7 @@ homedecor.register("desk_lamp", {
|
||||
-- "kitchen"/"dining room" ceiling lamp
|
||||
|
||||
homedecor.register("ceiling_lamp", {
|
||||
description = S("Ceiling Lamp"),
|
||||
description = S("Ceiling Lamp/Light"),
|
||||
mesh = "homedecor_ceiling_lamp.obj",
|
||||
tiles = {
|
||||
"homedecor_generic_metal_brass.png",
|
||||
@ -565,7 +565,7 @@ homedecor.register("ceiling_lamp", {
|
||||
})
|
||||
|
||||
homedecor.register("ceiling_lamp_off", {
|
||||
description = S("Ceiling Lamp (off)"),
|
||||
description = S("Ceiling Lamp/Light (off)"),
|
||||
mesh = "homedecor_ceiling_lamp.obj",
|
||||
tiles = {
|
||||
"homedecor_generic_metal_brass.png",
|
||||
|
@ -1,6 +1,8 @@
|
||||
default
|
||||
basic_materials?
|
||||
creative?
|
||||
ilights?
|
||||
gloopblocks?
|
||||
homedecor?
|
||||
homedecor_fences?
|
||||
homedecor_lighting?
|
||||
streetspoles?
|
||||
|
@ -2,7 +2,11 @@
|
||||
|
||||
local modpath = minetest.get_modpath("simple_streetlights")
|
||||
|
||||
streetlights = {}
|
||||
streetlights.basic_materials = minetest.get_modpath("basic_materials")
|
||||
streetlights.concrete = "basic_materials:concrete_block"
|
||||
|
||||
dofile(modpath.."/simple.lua")
|
||||
if minetest.get_modpath("homedecor") and minetest.get_modpath("streetspoles") then
|
||||
if minetest.get_modpath("homedecor_lighting") and minetest.get_modpath("streetspoles") then
|
||||
dofile(modpath.."/minedot.lua")
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ local offsets = {
|
||||
},
|
||||
}
|
||||
|
||||
local function takeMaterials(player,materials)
|
||||
local function takeMaterials(player, sneak, materials)
|
||||
local name = player:get_player_name()
|
||||
if creative and creative.is_enabled_for(name) then return true end
|
||||
local inv = minetest.get_inventory({type = "player",name = name})
|
||||
@ -39,8 +39,14 @@ local function takeMaterials(player,materials)
|
||||
for _,i in ipairs(materials) do
|
||||
if not inv:contains_item("main",i) then hasMaterials = false end
|
||||
end
|
||||
if sneak and streetlights.basic_materials and not inv:contains_item("main", streetlights.concrete) then
|
||||
hasMaterials = false
|
||||
end
|
||||
if hasMaterials then
|
||||
for _,i in ipairs(materials) do inv:remove_item("main",i) end
|
||||
if sneak then
|
||||
inv:remove_item("main", streetlights.concrete)
|
||||
end
|
||||
return true
|
||||
else
|
||||
minetest.chat_send_player(name,"You don't have the necessary materials to do that!")
|
||||
@ -50,6 +56,7 @@ end
|
||||
|
||||
local function place(itemstack,player,pointed)
|
||||
if not player then return end
|
||||
local sneak = player:get_player_control().sneak
|
||||
local name = player:get_player_name()
|
||||
if not minetest.check_player_privs(name,{streetlight = true}) then
|
||||
minetest.chat_send_player(name,"*** You don't have permission to use a streetlight spawner.")
|
||||
@ -58,9 +65,10 @@ local function place(itemstack,player,pointed)
|
||||
local pos = pointed.above
|
||||
if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass = true}) then
|
||||
minetest.record_protection_violation(pos,name)
|
||||
return
|
||||
end
|
||||
local isDouble = string.sub(itemstack:get_name(),-6,-1) == "double"
|
||||
if not takeMaterials(player,isDouble and doubleMaterials or singleMaterials) then return end
|
||||
if not takeMaterials(player, sneak, isDouble and doubleMaterials or singleMaterials) then return end
|
||||
local facedir = minetest.facedir_to_dir(minetest.dir_to_facedir(player:get_look_dir()))
|
||||
local schemDir = 0
|
||||
if facedir.x == 1 then schemDir = 180
|
||||
@ -69,6 +77,9 @@ local function place(itemstack,player,pointed)
|
||||
local offset = offsets[isDouble and "double" or "single"][schemDir]
|
||||
local pos = vector.add(pos,offset)
|
||||
minetest.place_schematic(pos,isDouble and schems.double or schems.single,schemDir,nil,false)
|
||||
if sneak and streetlights.basic_materials then
|
||||
minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name = streetlights.concrete})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_tool(":minedot_streetlights:spawner_single",{
|
||||
|
@ -11,7 +11,8 @@ minetest.register_privilege("streetlight", {
|
||||
give_to_singleplayer = true
|
||||
})
|
||||
|
||||
local function check_and_place(itemstack, placer, pointed_thing, pole, light)
|
||||
local function check_and_place(itemstack, placer, pointed_thing, pole, light, param2)
|
||||
local sneak = placer:get_player_control().sneak
|
||||
if not placer then return end
|
||||
if not minetest.check_player_privs(placer, "streetlight") then
|
||||
minetest.chat_send_player(placer:get_player_name(), "*** You don't have permission to use a streetlight spawner.")
|
||||
@ -57,9 +58,17 @@ local function check_and_place(itemstack, placer, pointed_thing, pole, light)
|
||||
def4 = minetest.registered_items[node4.name]
|
||||
if minetest.is_protected(pos4, player_name) or not (def3 and def4.buildable_to) then return end
|
||||
|
||||
if sneak and minetest.is_protected(pos1, player_name) then return end
|
||||
|
||||
if not creative or not creative.is_enabled_for(player_name) then
|
||||
local inv = placer:get_inventory()
|
||||
if not inv:contains_item("main", pole.." 5") or not inv:contains_item("main", light) then return end
|
||||
if sneak and inv:contains_item("main", streetlights.concrete) then
|
||||
inv:remove_item("main", streetlights.concrete)
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
inv:remove_item("main", pole.." 5")
|
||||
inv:remove_item("main", light)
|
||||
end
|
||||
@ -69,61 +78,69 @@ local function check_and_place(itemstack, placer, pointed_thing, pole, light)
|
||||
minetest.set_node(pos2, {name = pole })
|
||||
end
|
||||
minetest.set_node(pos3, { name = pole })
|
||||
minetest.set_node(pos4, { name = light, param2 = 0 })
|
||||
end
|
||||
|
||||
minetest.register_tool("simple_streetlights:spawner_wood_meselamp", {
|
||||
description = "Streetlight spawner (wooden pole, Mese lamp cube)",
|
||||
inventory_image = "simple_streetlights_spawner_wood_meselamp.png",
|
||||
use_texture_alpha = true,
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
check_and_place(itemstack, placer, pointed_thing, "default:fence_wood", "default:meselamp")
|
||||
end
|
||||
})
|
||||
|
||||
if minetest.get_modpath("ilights") then
|
||||
minetest.register_tool("simple_streetlights:spawner_wood_white", {
|
||||
description = "Streetlight spawner (wooden pole, white light)",
|
||||
inventory_image = "simple_streetlights_spawner_wood_white.png",
|
||||
use_texture_alpha = true,
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
check_and_place(itemstack, placer, pointed_thing, "default:fence_wood", "ilights:light")
|
||||
end
|
||||
})
|
||||
|
||||
if minetest.get_modpath("gloopblocks") then
|
||||
minetest.register_tool("simple_streetlights:spawner_steel_white", {
|
||||
description = "Streetlight spawner (steel pole, white light)",
|
||||
inventory_image = "simple_streetlights_spawner_steel_white.png",
|
||||
use_texture_alpha = true,
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
check_and_place(itemstack, placer, pointed_thing, "gloopblocks:fence_steel", "ilights:light")
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
if minetest.get_modpath("homedecor") then
|
||||
minetest.register_tool("simple_streetlights:spawner_wrought_iron_white", {
|
||||
description = "Streetlight spawner (wrought iron pole, white light)",
|
||||
inventory_image = "simple_streetlights_spawner_wrought_iron_white.png",
|
||||
use_texture_alpha = true,
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
check_and_place(itemstack, placer, pointed_thing, "homedecor:fence_wrought_iron", "ilights:light")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_tool("simple_streetlights:spawner_brass_white", {
|
||||
description = "Streetlight spawner (brass pole, white light)",
|
||||
inventory_image = "simple_streetlights_spawner_brass_white.png",
|
||||
use_texture_alpha = true,
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
check_and_place(itemstack, placer, pointed_thing, "homedecor:fence_brass", "ilights:light")
|
||||
end
|
||||
})
|
||||
minetest.set_node(pos4, { name = light, param2 = param2 })
|
||||
if sneak then
|
||||
minetest.set_node(pos1, { name = streetlights.concrete })
|
||||
end
|
||||
end
|
||||
|
||||
local poles_tab = {
|
||||
-- material name, mod name, node name
|
||||
{ "wood", "default", "default:fence_wood" },
|
||||
{ "junglewood", "default", "default:fence_junglewood" },
|
||||
{ "brass", "homedecor_fences", "homedecor:fence_brass" },
|
||||
{ "wrought_iron", "homedecor_fences", "homedecor:fence_wrought_iron" },
|
||||
{ "steel", "gloopblocks", "gloopblocks:fence_steel" }
|
||||
}
|
||||
|
||||
local lights_tab = {
|
||||
-- light name, mod name, node name, optional param2
|
||||
{ "meselamp", "default", "default:meselamp" },
|
||||
{ "ilight", "ilights", "ilights:light" },
|
||||
{ "glowlight_cube", "homedecor_lighting", "homedecor:glowlight_small_cube" }
|
||||
}
|
||||
|
||||
for _, pole in ipairs(poles_tab) do
|
||||
local matname = pole[1]
|
||||
local matmod = pole[2]
|
||||
local matnode = pole[3]
|
||||
|
||||
if minetest.get_modpath(matmod) then
|
||||
|
||||
for _, light in ipairs(lights_tab) do
|
||||
local lightname = light[1]
|
||||
local lightmod = light[2]
|
||||
local lightnode = light[3]
|
||||
local lightparam2 = light[4] or 0
|
||||
|
||||
if minetest.get_modpath(lightmod) then
|
||||
|
||||
minetest.register_tool("simple_streetlights:spawner_"..matname.."_"..lightname, {
|
||||
description = "Streetlight spawner ("..matname.." pole, "..lightname..")",
|
||||
inventory_image = "simple_streetlights_inv_pole_"..matname..".png"..
|
||||
"^simple_streetlights_inv_light_source_"..lightname..".png",
|
||||
use_texture_alpha = true,
|
||||
tool_capabilities = { full_punch_interval=0.1 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
check_and_place(itemstack, placer, pointed_thing, matnode, lightnode, lightparam2)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "simple_streetlights:spawner_"..matname.."_"..lightname,
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
matnode,
|
||||
matnode,
|
||||
matnode,
|
||||
matnode,
|
||||
matnode,
|
||||
matnode,
|
||||
lightnode
|
||||
}
|
||||
})
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
After Width: | Height: | Size: 192 B |
After Width: | Height: | Size: 203 B |
After Width: | Height: | Size: 513 B |
After Width: | Height: | Size: 787 B |
After Width: | Height: | Size: 700 B |
After Width: | Height: | Size: 757 B |
After Width: | Height: | Size: 644 B |
After Width: | Height: | Size: 716 B |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB |