mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-11 18:40:25 +01:00
Merged doors and dyes
- Removed comments in dyes
This commit is contained in:
parent
d44a5b5a79
commit
05685e7a72
@ -1 +1,2 @@
|
|||||||
default
|
default
|
||||||
|
screwdriver?
|
||||||
|
@ -107,6 +107,25 @@ function doors.register_door(name, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function check_and_blast(pos, name)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if node.name == name then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function make_on_blast(base_name, dir, door_type, other_door_type)
|
||||||
|
if def.only_placer_can_open then
|
||||||
|
return function() end
|
||||||
|
else
|
||||||
|
return function(pos, intensity)
|
||||||
|
check_and_blast(pos, base_name .. door_type)
|
||||||
|
pos.y = pos.y + dir
|
||||||
|
check_and_blast(pos, base_name .. other_door_type)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
|
local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
|
||||||
pos.y = pos.y+dir
|
pos.y = pos.y+dir
|
||||||
if not minetest.get_node(pos).name == check_name then
|
if not minetest.get_node(pos).name == check_name then
|
||||||
@ -143,6 +162,33 @@ function doors.register_door(name, def)
|
|||||||
return meta:get_string("doors_owner") == pn
|
return meta:get_string("doors_owner") == pn
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function on_rotate(pos, node, dir, user, check_name, mode, new_param2)
|
||||||
|
if not check_player_priv(pos, user) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if mode ~= screwdriver.ROTATE_FACE then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
pos.y = pos.y + dir
|
||||||
|
if not minetest.get_node(pos).name == check_name then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if minetest.is_protected(pos, user:get_player_name()) then
|
||||||
|
minetest.record_protection_violation(pos, user:get_player_name())
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local node2 = minetest.get_node(pos)
|
||||||
|
node2.param2 = (node2.param2 + 1) % 4
|
||||||
|
minetest.swap_node(pos, node2)
|
||||||
|
|
||||||
|
pos.y = pos.y - dir
|
||||||
|
node.param2 = (node.param2 + 1) % 4
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_b_1", {
|
minetest.register_node(name.."_b_1", {
|
||||||
tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1].."^[transformfx"},
|
tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1].."^[transformfx"},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -170,9 +216,14 @@ function doors.register_door(name, def)
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
on_rotate = function(pos, node, user, mode, new_param2)
|
||||||
|
return on_rotate(pos, node, 1, user, name.."_t_1", mode)
|
||||||
|
end,
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
can_dig = check_player_priv,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
sunlight_propagates = def.sunlight
|
sunlight_propagates = def.sunlight,
|
||||||
|
on_blast = make_on_blast(name, 1, "_b_1", "_t_1")
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(name.."_t_1", {
|
minetest.register_node(name.."_t_1", {
|
||||||
@ -202,9 +253,14 @@ function doors.register_door(name, def)
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
on_rotate = function(pos, node, user, mode, new_param2)
|
||||||
|
return on_rotate(pos, node, -1, user, name.."_b_1", mode)
|
||||||
|
end,
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
can_dig = check_player_priv,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
sunlight_propagates = def.sunlight,
|
sunlight_propagates = def.sunlight,
|
||||||
|
on_blast = make_on_blast(name, -1, "_t_1", "_b_1")
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(name.."_b_2", {
|
minetest.register_node(name.."_b_2", {
|
||||||
@ -234,9 +290,14 @@ function doors.register_door(name, def)
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
on_rotate = function(pos, node, user, mode, new_param2)
|
||||||
|
return on_rotate(pos, node, 1, user, name.."_t_2", mode)
|
||||||
|
end,
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
can_dig = check_player_priv,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
sunlight_propagates = def.sunlight
|
sunlight_propagates = def.sunlight,
|
||||||
|
on_blast = make_on_blast(name, 1, "_b_2", "_t_2")
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(name.."_t_2", {
|
minetest.register_node(name.."_t_2", {
|
||||||
@ -266,9 +327,14 @@ function doors.register_door(name, def)
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
on_rotate = function(pos, node, user, mode, new_param2)
|
||||||
|
return on_rotate(pos, node, -1, user, name.."_b_2", mode)
|
||||||
|
end,
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
can_dig = check_player_priv,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
sunlight_propagates = def.sunlight
|
sunlight_propagates = def.sunlight,
|
||||||
|
on_blast = make_on_blast(name, -1, "_t_2", "_b_2")
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -388,6 +454,8 @@ function doors.register_trapdoor(name, def)
|
|||||||
minetest.set_node(pos, {name = newname, param1 = node.param1, param2 = node.param2})
|
minetest.set_node(pos, {name = newname, param1 = node.param1, param2 = node.param2})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def.on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple
|
||||||
|
|
||||||
-- Common trapdoor configuration
|
-- Common trapdoor configuration
|
||||||
def.drawtype = "nodebox"
|
def.drawtype = "nodebox"
|
||||||
def.paramtype = "light"
|
def.paramtype = "light"
|
||||||
|
@ -1,63 +1,10 @@
|
|||||||
-- minetest/dye/init.lua
|
-- minetest/dye/init.lua
|
||||||
|
|
||||||
-- To make recipes that will work with any dye ever made by anybody, define
|
|
||||||
-- them based on groups.
|
|
||||||
-- You can select any group of groups, based on your need for amount of colors.
|
|
||||||
-- basecolor: 9, excolor: 17, unicolor: 89
|
|
||||||
--
|
|
||||||
-- Example of one shapeless recipe using a color group:
|
|
||||||
-- Note: As this uses basecolor_*, you'd need 9 of these.
|
|
||||||
-- minetest.register_craft({
|
|
||||||
-- type = "shapeless",
|
|
||||||
-- output = '<mod>:item_yellow',
|
|
||||||
-- recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
|
|
||||||
-- })
|
|
||||||
|
|
||||||
-- Other mods can use these for looping through available colors
|
-- Other mods can use these for looping through available colors
|
||||||
dye = {}
|
dye = {}
|
||||||
dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"}
|
dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"}
|
||||||
dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"}
|
dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"}
|
||||||
|
|
||||||
-- Base color groups:
|
|
||||||
-- - basecolor_white
|
|
||||||
-- - basecolor_grey
|
|
||||||
-- - basecolor_black
|
|
||||||
-- - basecolor_red
|
|
||||||
-- - basecolor_yellow
|
|
||||||
-- - basecolor_green
|
|
||||||
-- - basecolor_cyan
|
|
||||||
-- - basecolor_blue
|
|
||||||
-- - basecolor_magenta
|
|
||||||
|
|
||||||
-- Extended color groups (* = equal to a base color):
|
|
||||||
-- * excolor_white
|
|
||||||
-- - excolor_lightgrey
|
|
||||||
-- * excolor_grey
|
|
||||||
-- - excolor_darkgrey
|
|
||||||
-- * excolor_black
|
|
||||||
-- * excolor_red
|
|
||||||
-- - excolor_orange
|
|
||||||
-- * excolor_yellow
|
|
||||||
-- - excolor_lime
|
|
||||||
-- * excolor_green
|
|
||||||
-- - excolor_aqua
|
|
||||||
-- * excolor_cyan
|
|
||||||
-- - excolor_sky_blue
|
|
||||||
-- * excolor_blue
|
|
||||||
-- - excolor_violet
|
|
||||||
-- * excolor_magenta
|
|
||||||
-- - excolor_red_violet
|
|
||||||
|
|
||||||
-- The whole unifieddyes palette as groups:
|
|
||||||
-- - unicolor_<excolor>
|
|
||||||
-- For the following, no white/grey/black is allowed:
|
|
||||||
-- - unicolor_medium_<excolor>
|
|
||||||
-- - unicolor_dark_<excolor>
|
|
||||||
-- - unicolor_light_<excolor>
|
|
||||||
-- - unicolor_<excolor>_s50
|
|
||||||
-- - unicolor_medium_<excolor>_s50
|
|
||||||
-- - unicolor_dark_<excolor>_s50
|
|
||||||
|
|
||||||
-- Local stuff
|
-- Local stuff
|
||||||
local dyelocal = {}
|
local dyelocal = {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user