mirror of
https://github.com/D00Med/scifi_nodes.git
synced 2024-12-23 00:20:17 +01:00
Doors open with mesecon only
This commit is contained in:
parent
23fa45bfa8
commit
1ca3adc46d
@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
|
Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
|
||||||
|
|
||||||
|
# Changes log
|
||||||
|
|
||||||
|
* 05/09/2019 : door opening on rightclick is disabled (maybe reactivated via a mod option)
|
||||||
* 05/08/2019 :
|
* 05/08/2019 :
|
||||||
* digicodes now work
|
* digicodes now work
|
||||||
* new (and cleaner) implementation for palm scanner
|
* new (and cleaner) implementation for palm scanner
|
||||||
|
15
doors.lua
15
doors.lua
@ -14,6 +14,11 @@
|
|||||||
-- will the authors be held liable for any damages arising from the use of this content.
|
-- will the authors be held liable for any damages arising from the use of this content.
|
||||||
|
|
||||||
|
|
||||||
|
-- Retrieving mod settings
|
||||||
|
local scifi_nodes = {}
|
||||||
|
scifi_nodes.doors_open_with_mesecon_only = minetest.settings:get_bool("scifi_nodes.doors_open_with_mesecon_only", true)
|
||||||
|
print("Ici !"..dump(scifi_nodes))
|
||||||
|
|
||||||
-- Some aliases to deal with old namming policy --
|
-- Some aliases to deal with old namming policy --
|
||||||
minetest.register_alias("scifi_nodes:doors_1a","scifi_nodes:Doom_door_closed")
|
minetest.register_alias("scifi_nodes:doors_1a","scifi_nodes:Doom_door_closed")
|
||||||
minetest.register_alias("scifi_nodes:doors_1b","scifi_nodes:Doom_door_closed_top")
|
minetest.register_alias("scifi_nodes:doors_1b","scifi_nodes:Doom_door_closed_top")
|
||||||
@ -53,6 +58,7 @@ for _, current_door in ipairs(doors) do
|
|||||||
local base_name = current_door.base_name
|
local base_name = current_door.base_name
|
||||||
local base_ingredient = current_door.base_ingredient
|
local base_ingredient = current_door.base_ingredient
|
||||||
local sound = current_door.sound
|
local sound = current_door.sound
|
||||||
|
local doors_rightclick
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = closed .. " 2",
|
output = closed .. " 2",
|
||||||
@ -121,7 +127,7 @@ for _, current_door in ipairs(doors) do
|
|||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
||||||
end
|
end
|
||||||
|
|
||||||
function rightclick(pos, node, player, itemstack, pointed_thing)
|
function open_door(pos, node, player, itemstack, pointed_thing)
|
||||||
-- play sound
|
-- play sound
|
||||||
minetest.sound_play(sound,{
|
minetest.sound_play(sound,{
|
||||||
max_hear_distance = 16,
|
max_hear_distance = 16,
|
||||||
@ -177,6 +183,7 @@ for _, current_door in ipairs(doors) do
|
|||||||
end
|
end
|
||||||
timer:start(3)
|
timer:start(3)
|
||||||
end
|
end
|
||||||
|
if scifi_nodes.doors_open_with_mesecon_only then rightclick = nil end
|
||||||
|
|
||||||
function afterplace(pos, placer, itemstack, pointed_thing)
|
function afterplace(pos, placer, itemstack, pointed_thing)
|
||||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=opened_top,param2=nodeu.param2})
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=opened_top,param2=nodeu.param2})
|
||||||
@ -256,10 +263,13 @@ for _, current_door in ipairs(doors) do
|
|||||||
|
|
||||||
local mesecons_doors_def = {
|
local mesecons_doors_def = {
|
||||||
effector = {
|
effector = {
|
||||||
action_on = rightclick,
|
action_on = open_door,
|
||||||
rules = mesecons_doors_rules
|
rules = mesecons_doors_rules
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
local doors_rightclick
|
||||||
|
if scifi_nodes.doors_open_with_mesecon_only then doors_rightclick = {}
|
||||||
|
else doors_rightclick = open_door end
|
||||||
|
|
||||||
minetest.register_node(closed, {
|
minetest.register_node(closed, {
|
||||||
description = current_door.base_name.." sliding door",
|
description = current_door.base_name.." sliding door",
|
||||||
@ -290,7 +300,6 @@ for _, current_door in ipairs(doors) do
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mesecons = mesecons_doors_def,
|
mesecons = mesecons_doors_def,
|
||||||
|
|
||||||
on_place = onplace,
|
on_place = onplace,
|
||||||
after_destruct = afterdestruct,
|
after_destruct = afterdestruct,
|
||||||
on_rightclick = rightclick,
|
on_rightclick = rightclick,
|
||||||
|
Loading…
Reference in New Issue
Block a user