Move "light_api" mod to "ikea_light"
parent
f7950d5c30
commit
dae4992665
|
@ -1,8 +1,9 @@
|
|||
light = {}
|
||||
ikea.light = {}
|
||||
ikea.light.sound_gain = 0.1
|
||||
|
||||
-- Set node to the base light node if the name ends in "_off"
|
||||
-- Otherwise set it to the name + "_off"
|
||||
function light.toggle_light(pos, node, play_sound)
|
||||
function ikea.light.toggle_light(pos, node, play_sound)
|
||||
local store_tod = ikea.time.get_storetime()
|
||||
local is_off = false
|
||||
if node.name:sub(-4) == "_off" then
|
||||
|
@ -13,11 +14,11 @@ function light.toggle_light(pos, node, play_sound)
|
|||
minetest.swap_node(pos, {name = node.name:sub(0,-5)})
|
||||
|
||||
if play_sound then
|
||||
minetest.sound_play("light_api_toggle", {
|
||||
name = "light_api_toggle",
|
||||
minetest.sound_play({
|
||||
name = "ikea_light_toggle",
|
||||
pos = pos,
|
||||
max_hear_distance = 150,
|
||||
gain = 1.0,
|
||||
gain = ikea.light.sound_gain,
|
||||
pitch = 1.0,
|
||||
})
|
||||
end
|
||||
|
@ -26,11 +27,11 @@ function light.toggle_light(pos, node, play_sound)
|
|||
minetest.swap_node(pos, {name = node.name.."_off"})
|
||||
|
||||
if play_sound then
|
||||
minetest.sound_play("light_api_toggle", {
|
||||
name = "light_api_toggle",
|
||||
minetest.sound_play({
|
||||
name = "ikea_light_toggle",
|
||||
pos = pos,
|
||||
max_hear_distance = 150,
|
||||
gain = 1.0,
|
||||
gain = ikea.light.sound_gain,
|
||||
pitch = 1.0,
|
||||
})
|
||||
end
|
||||
|
@ -48,7 +49,7 @@ local light_default = {
|
|||
light_source = minetest.LIGHT_MAX,
|
||||
}
|
||||
|
||||
function light.register_light(name, def)
|
||||
function ikea.light.register_light(name, def)
|
||||
local def = {
|
||||
description = (def.description or light_default.description),
|
||||
paramtype = "light",
|
||||
|
@ -78,18 +79,18 @@ minetest.register_abm({
|
|||
chance = 2,
|
||||
catch_up = false,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
light.toggle_light(pos, node, true)
|
||||
ikea.light.toggle_light(pos, node, true)
|
||||
end
|
||||
})
|
||||
|
||||
-- Toggle the lights loaded in without sound
|
||||
minetest.register_lbm({
|
||||
label = "Light Updater LBM",
|
||||
name = "light_api:light_toggle",
|
||||
name = "ikea_light:light_toggle",
|
||||
nodenames = {"group:light"},
|
||||
run_at_every_load = true,
|
||||
|
||||
action = function(pos, node)
|
||||
light.toggle_light(pos, node, false)
|
||||
ikea.light.toggle_light(pos, node, false)
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,2 @@
|
|||
name = ikea_light
|
||||
depends = ikea
|
|
@ -1,2 +1,2 @@
|
|||
name = warehouse
|
||||
depends = mapgen,light_api
|
||||
depends = mapgen,ikea_light
|
||||
|
|
|
@ -16,7 +16,7 @@ minetest.register_node("warehouse:rack", {
|
|||
sunlight_propagates = true,
|
||||
})
|
||||
|
||||
light.register_light("warehouse:light", {
|
||||
ikea.light.register_light("warehouse:light", {
|
||||
description = "Lights That Light The Warehouse",
|
||||
mesh = "warehouse_light.obj",
|
||||
tiles = {name = "warehouse_light.png"},
|
||||
|
|
Loading…
Reference in New Issue