Compare commits
55 Commits
fix-lavaca
...
master
Author | SHA1 | Date |
---|---|---|
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. | 23f1c51912 | |
Nils Dagsson Moskopp | 4d02af8c94 | |
Li0n_2 | 7ede0ca79a | |
JosiahWI | e2e7e15b39 | |
cora | 93a0879b40 | |
Nils Dagsson Moskopp | 0b5fa14041 | |
cora | 4f33f626f5 | |
Nils Dagsson Moskopp | df7bd78af5 | |
Nils Dagsson Moskopp | fe3e837e1b | |
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. | 6f811b3cee | |
Lizzy Fleckenstein | dfa56f229f | |
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. | ee77f33ea8 | |
cora | 5deaabdb47 | |
cora | d77f31eab8 | |
cora | 10670d5c10 | |
Nils Dagsson Moskopp | 609105e091 | |
cora | f9e3c4fd6d | |
cora | d70c05e92c | |
Lizzy Fleckenstein | cacddd3fb4 | |
cora | dd347c50c5 | |
Nils Dagsson Moskopp | 54b36c42a9 | |
cora | 5252952555 | |
Li0n_2 | c08f9850f6 | |
Nils Dagsson Moskopp | f8b5066c61 | |
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. | 4b9094ddc2 | |
cora | 5087e8194a | |
cora | 71befcff10 | |
Nils Dagsson Moskopp | 66dd87af25 | |
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. | fc47f0a87e | |
Nils Dagsson Moskopp | 6bd4b0e62c | |
AFCMS | 3473f55136 | |
Lizzy Fleckenstein | af7f7c3574 | |
cora | 434e545745 | |
Nils Dagsson Moskopp | 76d2846c59 | |
Nils Dagsson Moskopp | 526c25aa57 | |
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. | 249cfb8118 | |
cora | 84194b71e6 | |
cora | 0b7097cb28 | |
cora | bfbc953b92 | |
Nils Dagsson Moskopp | 253100380c | |
cora | df98db1d8c | |
Nils Dagsson Moskopp | f410de485a | |
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. | 3a78211be4 | |
cora | eee94658e7 | |
cora | 07a59ef120 | |
Nils Dagsson Moskopp | e1462d9534 | |
cora | 42a076cc0b | |
NO11 | 3759d50344 | |
NO11 | 50e913b370 | |
NO11 | 508b08dfd3 | |
NO11 | 68646b62b3 | |
NO11 | d3348ef8b7 | |
NO11 | eadb96dd40 | |
NO11 | 616b009452 | |
NO11 | a92e1c05a3 |
|
@ -21,7 +21,7 @@ The basic digging time groups determine by which tools a node can be dug.
|
||||||
* `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb
|
* `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb
|
||||||
* `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb
|
* `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb
|
||||||
* `shearsy=1`: Diggable by shears, and this node is *not* wool
|
* `shearsy=1`: Diggable by shears, and this node is *not* wool
|
||||||
* `shearsy=wool=1`: Diggable by shears, and this node is wool
|
* `shearsy_wool=1`: Diggable by shears, and this node is wool
|
||||||
* `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess
|
* `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess
|
||||||
* `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group
|
* `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group
|
||||||
|
|
||||||
|
@ -182,6 +182,10 @@ These groups are used mostly for informational purposes
|
||||||
* `redstone_torch=1`: Redstone Torch (lit)
|
* `redstone_torch=1`: Redstone Torch (lit)
|
||||||
* `redstone_torch=2`: Redstone Torch (unlit)
|
* `redstone_torch=2`: Redstone Torch (unlit)
|
||||||
|
|
||||||
|
* `dirt=1`: Uncovered dirt
|
||||||
|
* `dirt=2`: Covered dirt (grass or mycelium or podzol on top)
|
||||||
|
* `dirt=3`: Coarse dirt
|
||||||
|
|
||||||
* `plant=1`: Plant or part of a plant
|
* `plant=1`: Plant or part of a plant
|
||||||
* `double_plant`: Part of a double-sized plant. 1 = lower part, 2 = upper part
|
* `double_plant`: Part of a double-sized plant. 1 = lower part, 2 = upper part
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
# mcl_colors
|
||||||
|
Mod providing global table containing legacy minecraft colors to be used in mods.
|
||||||
|
|
||||||
|
## mcl_colors.*
|
||||||
|
Colors by upper name, in hex value.
|
||||||
|
|
||||||
|
## mcl_colors.background.*
|
||||||
|
Background colors by upper name, in hex value.
|
|
@ -0,0 +1,36 @@
|
||||||
|
mcl_colors = {
|
||||||
|
BLACK = "#000000",
|
||||||
|
DARK_BLUE = "#0000AA",
|
||||||
|
DARK_GREEN = "#00AA00",
|
||||||
|
DARK_AQUA = "#00AAAA",
|
||||||
|
DARK_RED = "#AA0000",
|
||||||
|
DARK_PURPLE = "#AA00AA",
|
||||||
|
GOLD = "#FFAA00",
|
||||||
|
GRAY = "#AAAAAA",
|
||||||
|
DARK_GRAY = "#555555",
|
||||||
|
BLUE = "#5555FF",
|
||||||
|
GREEN = "#55FF55",
|
||||||
|
AQUA = "#55FFFF",
|
||||||
|
RED = "#FF5555",
|
||||||
|
LIGHT_PURPLE = "#FF55FF",
|
||||||
|
YELLOW = "#FFFF55",
|
||||||
|
WHITE = "#FFFFFF",
|
||||||
|
background = {
|
||||||
|
BLACK = "#000000",
|
||||||
|
DARK_BLUE = "#00002A",
|
||||||
|
DARK_GREEN = "#002A00",
|
||||||
|
DARK_AQUA = "#002A2A",
|
||||||
|
DARK_RED = "#2A0000",
|
||||||
|
DARK_PURPLE = "#2A002A",
|
||||||
|
GOLD = "#2A2A00",
|
||||||
|
GRAY = "#2A2A2A",
|
||||||
|
DARK_GRAY = "#151515",
|
||||||
|
BLUE = "#15153F",
|
||||||
|
GREEN = "#153F15",
|
||||||
|
AQUA = "#153F3F",
|
||||||
|
RED = "#3F1515",
|
||||||
|
LIGHT_PURPLE = "#3F153F",
|
||||||
|
YELLOW = "#3F3F15",
|
||||||
|
WHITE = "#373501",
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mcl_colors
|
||||||
|
author = Fleckenstein
|
||||||
|
description = The HTML sequences for the minecraft colors
|
|
@ -155,6 +155,16 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
}) + 1
|
}) + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local already_burning = mcl_burning.is_burning(obj)
|
||||||
|
|
||||||
|
|
||||||
|
mcl_burning.set(obj, "float", "burn_time", burn_time)
|
||||||
|
mcl_burning.set(obj, "string", "reason", reason)
|
||||||
|
|
||||||
|
if already_burning then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local hud_id
|
local hud_id
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
hud_id = mcl_burning.get(obj, "int", "hud_id")
|
hud_id = mcl_burning.get(obj, "int", "hud_id")
|
||||||
|
@ -168,8 +178,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
||||||
}) + 1
|
}) + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
mcl_burning.set(obj, "float", "burn_time", burn_time)
|
|
||||||
mcl_burning.set(obj, "string", "reason", reason)
|
|
||||||
mcl_burning.set(obj, "int", "hud_id", hud_id)
|
mcl_burning.set(obj, "int", "hud_id", hud_id)
|
||||||
mcl_burning.set(obj, "int", "sound_id", sound_id)
|
mcl_burning.set(obj, "int", "sound_id", sound_id)
|
||||||
|
|
||||||
|
@ -285,7 +294,7 @@ function mcl_burning.fire_entity_step(self, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
local animation_timer = self.animation_timer + dtime
|
local animation_timer = self.animation_timer + dtime
|
||||||
if animation_timer >= 0.015 then
|
if animation_timer >= ( 1 / mcl_burning.animation_fps ) then
|
||||||
animation_timer = 0
|
animation_timer = 0
|
||||||
local animation_frame = self.animation_frame + 1
|
local animation_frame = self.animation_frame + 1
|
||||||
if animation_frame > mcl_burning.animation_frames - 1 then
|
if animation_frame > mcl_burning.animation_frames - 1 then
|
||||||
|
@ -296,3 +305,48 @@ function mcl_burning.fire_entity_step(self, dtime)
|
||||||
end
|
end
|
||||||
self.animation_timer = animation_timer
|
self.animation_timer = animation_timer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_chatcommand("burn", {
|
||||||
|
params = S("<playername> <duration> <reason>"),
|
||||||
|
description = S("Sets a player on fire for the given amount of seconds with the given reason."),
|
||||||
|
privs = { debug = true },
|
||||||
|
func = function(name, params)
|
||||||
|
local playername, duration, reason = params:match("^(.+) (.+) (.+)$")
|
||||||
|
if not (playername and duration and reason) then
|
||||||
|
return false, S("Error: Parameter missing.")
|
||||||
|
end
|
||||||
|
local player = minetest.get_player_by_name(playername)
|
||||||
|
if not player then
|
||||||
|
return false, S(
|
||||||
|
"Error: Player “@1” not found.",
|
||||||
|
playername
|
||||||
|
)
|
||||||
|
end
|
||||||
|
local duration_number = tonumber(duration)
|
||||||
|
-- Lua numbers are truthy
|
||||||
|
-- NaN is not equal to NaN
|
||||||
|
if not duration_number or (duration_number ~= duration_number) then
|
||||||
|
return false, S(
|
||||||
|
"Error: Duration “@1” is not a number.",
|
||||||
|
duration
|
||||||
|
)
|
||||||
|
end
|
||||||
|
if duration_number < 0 then
|
||||||
|
return false, S(
|
||||||
|
"Error: Duration “@1” is negative.",
|
||||||
|
duration
|
||||||
|
)
|
||||||
|
end
|
||||||
|
mcl_burning.set_on_fire(
|
||||||
|
player,
|
||||||
|
duration_number,
|
||||||
|
reason
|
||||||
|
)
|
||||||
|
return true, S(
|
||||||
|
"Set @1 on fire for @2s for the following reason: @3",
|
||||||
|
playername,
|
||||||
|
duration,
|
||||||
|
reason
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
|
@ -2,7 +2,8 @@ local S = minetest.get_translator("mcl_burning")
|
||||||
local modpath = minetest.get_modpath("mcl_burning")
|
local modpath = minetest.get_modpath("mcl_burning")
|
||||||
|
|
||||||
mcl_burning = {
|
mcl_burning = {
|
||||||
animation_frames = tonumber(minetest.settings:get("fire_animation_frames")) or 8
|
animation_frames = tonumber(minetest.settings:get("fire_animation_frames")) or 8,
|
||||||
|
animation_fps = tonumber(minetest.settings:get("fire_animation_fps")) or 30
|
||||||
}
|
}
|
||||||
|
|
||||||
dofile(modpath .. "/api.lua")
|
dofile(modpath .. "/api.lua")
|
||||||
|
|
|
@ -14,6 +14,8 @@ local DEFAULT_FALL_SPEED = -10
|
||||||
local FLOP_HEIGHT = 5.0
|
local FLOP_HEIGHT = 5.0
|
||||||
local FLOP_HOR_SPEED = 1.5
|
local FLOP_HOR_SPEED = 1.5
|
||||||
|
|
||||||
|
local LIGHT_SUN = minetest.LIGHT_MAX + 1
|
||||||
|
|
||||||
local MOB_CAP = {}
|
local MOB_CAP = {}
|
||||||
MOB_CAP.hostile = 70
|
MOB_CAP.hostile = 70
|
||||||
MOB_CAP.passive = 10
|
MOB_CAP.passive = 10
|
||||||
|
@ -1057,7 +1059,7 @@ local do_env_damage = function(self)
|
||||||
if mod_worlds then
|
if mod_worlds then
|
||||||
_, dim = mcl_worlds.y_to_layer(pos.y)
|
_, dim = mcl_worlds.y_to_layer(pos.y)
|
||||||
end
|
end
|
||||||
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (minetest.get_node_light(pos) or 0) >= minetest.LIGHT_MAX and dim == "overworld" then
|
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (minetest.get_node_light(pos) or 0) == LIGHT_SUN and dim == "overworld" then
|
||||||
if self.ignited_by_sunlight then
|
if self.ignited_by_sunlight then
|
||||||
mcl_burning.set_on_fire(self.object, 10)
|
mcl_burning.set_on_fire(self.object, 10)
|
||||||
else
|
else
|
||||||
|
|
|
@ -3,12 +3,105 @@ local N = function(s) return s end
|
||||||
|
|
||||||
local function get_tool_name(item)
|
local function get_tool_name(item)
|
||||||
local name = item:get_meta():get_string("name")
|
local name = item:get_meta():get_string("name")
|
||||||
if name ~= "" then
|
if name == "" then
|
||||||
return name
|
|
||||||
end
|
|
||||||
local def = item:get_definition()
|
local def = item:get_definition()
|
||||||
return def._tt_original_description or def.description
|
name=def._tt_original_description or def.description
|
||||||
end
|
end
|
||||||
|
local sanitized_name, substitution_count = name:gsub("[\r\n]"," ")
|
||||||
|
return sanitized_name
|
||||||
|
end
|
||||||
|
|
||||||
|
local test_tool_1a = {
|
||||||
|
get_meta = function()
|
||||||
|
return {
|
||||||
|
get_string = function()
|
||||||
|
return "foo 1a"
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( get_tool_name(test_tool_1a) == "foo 1a" )
|
||||||
|
|
||||||
|
local test_tool_1b = {
|
||||||
|
get_meta = function()
|
||||||
|
return {
|
||||||
|
get_string = function()
|
||||||
|
return "bar\rbaz\n1b"
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( get_tool_name(test_tool_1b) == "bar baz 1b" )
|
||||||
|
|
||||||
|
local test_tool_2a = {
|
||||||
|
get_definition = function()
|
||||||
|
return {
|
||||||
|
_tt_original_description = "foo 2a"
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
get_meta = function()
|
||||||
|
return {
|
||||||
|
get_string = function()
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( get_tool_name(test_tool_2a) == "foo 2a" )
|
||||||
|
|
||||||
|
local test_tool_2b = {
|
||||||
|
get_definition = function()
|
||||||
|
return {
|
||||||
|
_tt_original_description = "bar\rbaz\n2b"
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
get_meta = function()
|
||||||
|
return {
|
||||||
|
get_string = function()
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( get_tool_name(test_tool_2b) == "bar baz 2b" )
|
||||||
|
|
||||||
|
local test_tool_3a = {
|
||||||
|
get_definition = function()
|
||||||
|
return {
|
||||||
|
description = "foo 3a"
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
get_meta = function()
|
||||||
|
return {
|
||||||
|
get_string = function()
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( get_tool_name(test_tool_3a) == "foo 3a" )
|
||||||
|
|
||||||
|
local test_tool_3b = {
|
||||||
|
get_definition = function()
|
||||||
|
return {
|
||||||
|
description = "bar\rbaz\n3b"
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
get_meta = function()
|
||||||
|
return {
|
||||||
|
get_string = function()
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( get_tool_name(test_tool_3b) == "bar baz 3b" )
|
||||||
|
|
||||||
mcl_death_messages = {}
|
mcl_death_messages = {}
|
||||||
|
|
||||||
|
|
|
@ -387,13 +387,15 @@ for colorid, colortab in pairs(mcl_banners.colors) do
|
||||||
-- redraw the pattern textures as low-resolution pixel
|
-- redraw the pattern textures as low-resolution pixel
|
||||||
-- art and use that instead.
|
-- art and use that instead.
|
||||||
|
|
||||||
local layer = "(([combine:20x40:-2,-2="..pattern.."^[resize:16x24^[colorize:"..color..":"..layer_ratio.."))"
|
local layer = "([combine:20x40:-2,-2=" .. pattern .. "^[resize:16x24^[colorize:" .. color .. ":" .. layer_ratio .. ")"
|
||||||
|
local mask = "([combine:20x40:-2,-2=" .. pattern .. "^[resize:16x24" .. ")"
|
||||||
|
|
||||||
function escape(text)
|
function escape(text)
|
||||||
return text:gsub("%^", "\\%^"):gsub(":", "\\:") -- :gsub("%(", "\\%("):gsub("%)", "\\%)")
|
return text:gsub("%^", "\\%^"):gsub(":", "\\:") -- :gsub("%(", "\\%("):gsub("%)", "\\%)")
|
||||||
end
|
end
|
||||||
|
|
||||||
finished_banner = "[combine:32x32:0,0=" .. escape(base) .. ":8,4=" .. escape(layer)
|
local layer_masked = layer .. "^[mask:" .. escape(mask)
|
||||||
|
finished_banner = "[combine:32x32:0,0=" .. escape(base) .. ":8,4=" .. escape(layer_masked)
|
||||||
end
|
end
|
||||||
|
|
||||||
inv = finished_banner
|
inv = finished_banner
|
||||||
|
|
|
@ -1,6 +1,41 @@
|
||||||
local S = minetest.get_translator("mcl_chests")
|
local S = minetest.get_translator("mcl_chests")
|
||||||
local mod_doc = minetest.get_modpath("doc")
|
local mod_doc = minetest.get_modpath("doc")
|
||||||
|
|
||||||
|
-- Christmas chest setup
|
||||||
|
local it_is_christmas = false
|
||||||
|
local date = os.date("*t")
|
||||||
|
if (
|
||||||
|
date.month == 12 and (
|
||||||
|
date.day == 24 or
|
||||||
|
date.day == 25 or
|
||||||
|
date.day == 26
|
||||||
|
)
|
||||||
|
) then
|
||||||
|
it_is_christmas = true
|
||||||
|
end
|
||||||
|
|
||||||
|
local tiles_chest_normal_small = {"mcl_chests_normal.png"}
|
||||||
|
local tiles_chest_normal_double = {"mcl_chests_normal_double.png"}
|
||||||
|
|
||||||
|
if it_is_christmas then
|
||||||
|
tiles_chest_normal_small = {"mcl_chests_normal_present.png^mcl_chests_noise.png"}
|
||||||
|
tiles_chest_normal_double = {"mcl_chests_normal_double_present.png^mcl_chests_noise_double.png"}
|
||||||
|
end
|
||||||
|
|
||||||
|
local tiles_chest_trapped_small = {"mcl_chests_trapped.png"}
|
||||||
|
local tiles_chest_trapped_double = {"mcl_chests_trapped_double.png"}
|
||||||
|
|
||||||
|
if it_is_christmas then
|
||||||
|
tiles_chest_trapped_small = {"mcl_chests_trapped_present.png^mcl_chests_noise.png"}
|
||||||
|
tiles_chest_trapped_double = {"mcl_chests_trapped_double_present.png^mcl_chests_noise_double.png"}
|
||||||
|
end
|
||||||
|
|
||||||
|
local tiles_chest_ender_small = {"mcl_chests_ender.png"}
|
||||||
|
|
||||||
|
if it_is_christmas then
|
||||||
|
tiles_chest_ender_small = {"mcl_chests_ender_present.png^mcl_chests_noise.png"}
|
||||||
|
end
|
||||||
|
|
||||||
-- Chest Entity
|
-- Chest Entity
|
||||||
local animate_chests = (minetest.settings:get_bool("animated_chests") ~= false)
|
local animate_chests = (minetest.settings:get_bool("animated_chests") ~= false)
|
||||||
local entity_animations = {
|
local entity_animations = {
|
||||||
|
@ -152,7 +187,10 @@ if minetest.get_modpath("screwdriver") then
|
||||||
local nodename = node.name
|
local nodename = node.name
|
||||||
local nodedef = minetest.registered_nodes[nodename]
|
local nodedef = minetest.registered_nodes[nodename]
|
||||||
local dir = minetest.facedir_to_dir(new_param2)
|
local dir = minetest.facedir_to_dir(new_param2)
|
||||||
|
|
||||||
|
if animate_chests then
|
||||||
find_or_create_entity(pos, nodename, nodedef._chest_entity_textures, new_param2, false, nodedef._chest_entity_sound, nodedef._chest_entity_mesh, nodedef._chest_entity_animation_type, dir):set_yaw(dir)
|
find_or_create_entity(pos, nodename, nodedef._chest_entity_textures, new_param2, false, nodedef._chest_entity_sound, nodedef._chest_entity_mesh, nodedef._chest_entity_animation_type, dir):set_yaw(dir)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -181,6 +219,10 @@ local player_chest_open = function(player, pos, node_name, textures, param2, dou
|
||||||
local dir = minetest.facedir_to_dir(param2)
|
local dir = minetest.facedir_to_dir(param2)
|
||||||
local blocked = not shulker and (back_is_blocked(pos, dir) or double and back_is_blocked(mcl_util.get_double_container_neighbor_pos(pos, param2, node_name:sub(-4)), dir))
|
local blocked = not shulker and (back_is_blocked(pos, dir) or double and back_is_blocked(mcl_util.get_double_container_neighbor_pos(pos, param2, node_name:sub(-4)), dir))
|
||||||
find_or_create_entity(pos, node_name, textures, param2, double, sound, mesh, shulker and "shulker" or "chest", dir):open(name, blocked)
|
find_or_create_entity(pos, node_name, textures, param2, double, sound, mesh, shulker and "shulker" or "chest", dir):open(name, blocked)
|
||||||
|
else
|
||||||
|
minetest.sound_play(sound .. "_open", {
|
||||||
|
pos = pos,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -212,11 +254,14 @@ local chest_update_after_close = function(pos)
|
||||||
|
|
||||||
if node.name == "mcl_chests:trapped_chest_on_small" then
|
if node.name == "mcl_chests:trapped_chest_on_small" then
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_small", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_small", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_small", {"mcl_chests_trapped.png"}, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_small")
|
|
||||||
|
if animate_chests then
|
||||||
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_small", tiles_chest_trapped_small, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_small")
|
||||||
|
end
|
||||||
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
||||||
elseif node.name == "mcl_chests:trapped_chest_on_left" then
|
elseif node.name == "mcl_chests:trapped_chest_on_left" then
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
||||||
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
||||||
|
@ -228,7 +273,7 @@ local chest_update_after_close = function(pos)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
||||||
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
||||||
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -242,6 +287,10 @@ local player_chest_close = function(player)
|
||||||
end
|
end
|
||||||
if animate_chests then
|
if animate_chests then
|
||||||
find_or_create_entity(open_chest.pos, open_chest.node_name, open_chest.textures, open_chest.param2, open_chest.double, open_chest.sound, open_chest.mesh, open_chest.shulker and "shulker" or "chest"):close(name)
|
find_or_create_entity(open_chest.pos, open_chest.node_name, open_chest.textures, open_chest.param2, open_chest.double, open_chest.sound, open_chest.mesh, open_chest.shulker and "shulker" or "chest"):close(name)
|
||||||
|
else
|
||||||
|
minetest.sound_play(open_chest.sound .. "_close", {
|
||||||
|
pos = open_chest.pos,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
chest_update_after_close(open_chest.pos)
|
chest_update_after_close(open_chest.pos)
|
||||||
|
|
||||||
|
@ -380,12 +429,21 @@ minetest.register_node(small_name, {
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
_doc_items_usagehelp = usagehelp,
|
_doc_items_usagehelp = usagehelp,
|
||||||
_doc_items_hidden = hidden,
|
_doc_items_hidden = hidden,
|
||||||
drawtype = "nodebox",
|
drawtype = animate_chests and "nodebox" or "mesh",
|
||||||
node_box = {
|
mesh = not animate_chests and "mcl_chests_chest.obj" or nil,
|
||||||
|
node_box = animate_chests and {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
||||||
|
} or nil,
|
||||||
|
collision_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
||||||
},
|
},
|
||||||
tiles = {"mcl_chests_blank.png"},
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
||||||
|
},
|
||||||
|
tiles = animate_chests and {"mcl_chests_blank.png"} or small_textures,
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
||||||
_chest_entity_textures = small_textures,
|
_chest_entity_textures = small_textures,
|
||||||
_chest_entity_sound = "default_chest",
|
_chest_entity_sound = "default_chest",
|
||||||
|
@ -435,8 +493,11 @@ minetest.register_node(small_name, {
|
||||||
minetest.swap_node(p, { name = "mcl_chests:"..canonical_basename.."_right", param2 = param2 })
|
minetest.swap_node(p, { name = "mcl_chests:"..canonical_basename.."_right", param2 = param2 })
|
||||||
else
|
else
|
||||||
minetest.swap_node(pos, { name = "mcl_chests:"..canonical_basename.."_small", param2 = param2 })
|
minetest.swap_node(pos, { name = "mcl_chests:"..canonical_basename.."_small", param2 = param2 })
|
||||||
|
|
||||||
|
if animate_chests then
|
||||||
create_entity(pos, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest", "chest")
|
create_entity(pos, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest", "chest")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
minetest.get_meta(pos):set_string("name", itemstack:get_meta():get_string("name"))
|
minetest.get_meta(pos):set_string("name", itemstack:get_meta():get_string("name"))
|
||||||
|
@ -823,8 +884,8 @@ register_chest("chest",
|
||||||
chestusage,
|
chestusage,
|
||||||
S("27 inventory slots") .. "\n" .. S("Can be combined to a large chest"),
|
S("27 inventory slots") .. "\n" .. S("Can be combined to a large chest"),
|
||||||
{
|
{
|
||||||
small = {"mcl_chests_normal.png"},
|
small = tiles_chest_normal_small,
|
||||||
double = {"mcl_chests_normal_double.png"},
|
double = tiles_chest_normal_double,
|
||||||
inv = {"default_chest_top.png", "mcl_chests_chest_bottom.png",
|
inv = {"default_chest_top.png", "mcl_chests_chest_bottom.png",
|
||||||
"mcl_chests_chest_right.png", "mcl_chests_chest_left.png",
|
"mcl_chests_chest_right.png", "mcl_chests_chest_left.png",
|
||||||
"mcl_chests_chest_back.png", "default_chest_front.png"},
|
"mcl_chests_chest_back.png", "default_chest_front.png"},
|
||||||
|
@ -839,8 +900,8 @@ register_chest("chest",
|
||||||
)
|
)
|
||||||
|
|
||||||
local traptiles = {
|
local traptiles = {
|
||||||
small = {"mcl_chests_trapped.png"},
|
small = tiles_chest_trapped_small,
|
||||||
double = {"mcl_chests_trapped_double.png"},
|
double = tiles_chest_trapped_double,
|
||||||
inv = {"mcl_chests_chest_trapped_top.png", "mcl_chests_chest_trapped_bottom.png",
|
inv = {"mcl_chests_chest_trapped_top.png", "mcl_chests_chest_trapped_bottom.png",
|
||||||
"mcl_chests_chest_trapped_right.png", "mcl_chests_chest_trapped_left.png",
|
"mcl_chests_chest_trapped_right.png", "mcl_chests_chest_trapped_left.png",
|
||||||
"mcl_chests_chest_trapped_back.png", "mcl_chests_chest_trapped_front.png"},
|
"mcl_chests_chest_trapped_back.png", "mcl_chests_chest_trapped_front.png"},
|
||||||
|
@ -865,7 +926,9 @@ register_chest("trapped_chest",
|
||||||
}},
|
}},
|
||||||
function(pos, node, clicker)
|
function(pos, node, clicker)
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_on_small", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_on_small", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_on_small", {"mcl_chests_trapped.png"}, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_small")
|
if animate_chests then
|
||||||
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_on_small", tiles_chest_trapped_small, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_small")
|
||||||
|
end
|
||||||
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
||||||
end,
|
end,
|
||||||
function(pos, node, clicker)
|
function(pos, node, clicker)
|
||||||
|
@ -873,7 +936,7 @@ register_chest("trapped_chest",
|
||||||
meta:set_int("players", 1)
|
meta:set_int("players", 1)
|
||||||
|
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_on_left", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_on_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_on_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_left")
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_on_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_left")
|
||||||
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
||||||
|
@ -887,7 +950,7 @@ register_chest("trapped_chest",
|
||||||
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_on(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_on_left", param2 = node.param2})
|
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_on_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_on_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_left")
|
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_on_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_on_left")
|
||||||
mesecon.receptor_on(pos_other, trapped_chest_mesecons_rules)
|
mesecon.receptor_on(pos_other, trapped_chest_mesecons_rules)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
@ -908,13 +971,15 @@ local function close_if_trapped_chest(pos, player)
|
||||||
|
|
||||||
if node.name == "mcl_chests:trapped_chest_on_small" then
|
if node.name == "mcl_chests:trapped_chest_on_small" then
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_small", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_small", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_small", {"mcl_chests_trapped.png"}, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_small")
|
if animate_chests then
|
||||||
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_small", tiles_chest_trapped_small, node.param2, false, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_small")
|
||||||
|
end
|
||||||
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
player_chest_close(player)
|
player_chest_close(player)
|
||||||
elseif node.name == "mcl_chests:trapped_chest_on_left" then
|
elseif node.name == "mcl_chests:trapped_chest_on_left" then
|
||||||
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
minetest.swap_node(pos, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
find_or_create_entity(pos, "mcl_chests:trapped_chest_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
||||||
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
||||||
|
@ -928,7 +993,7 @@ local function close_if_trapped_chest(pos, player)
|
||||||
|
|
||||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
||||||
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
minetest.swap_node(pos_other, {name="mcl_chests:trapped_chest_left", param2 = node.param2})
|
||||||
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_left", {"mcl_chests_trapped_double.png"}, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
find_or_create_entity(pos_other, "mcl_chests:trapped_chest_left", tiles_chest_trapped_double, node.param2, true, "default_chest", "mcl_chests_chest", "chest"):reinitialize("mcl_chests:trapped_chest_left")
|
||||||
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
mesecon.receptor_off(pos_other, trapped_chest_mesecons_rules)
|
||||||
|
|
||||||
player_chest_close(player)
|
player_chest_close(player)
|
||||||
|
@ -976,7 +1041,7 @@ minetest.register_node("mcl_chests:ender_chest", {
|
||||||
_doc_items_usagehelp = S("Rightclick the ender chest to access your personal interdimensional inventory."),
|
_doc_items_usagehelp = S("Rightclick the ender chest to access your personal interdimensional inventory."),
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "mcl_chests_chest.obj",
|
mesh = "mcl_chests_chest.obj",
|
||||||
tiles = {"mcl_chests_ender.png"},
|
tiles = tiles_chest_ender_small,
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -1002,22 +1067,38 @@ local formspec_ender_chest = "size[9,8.75]"..
|
||||||
"listring[current_player;enderchest]"..
|
"listring[current_player;enderchest]"..
|
||||||
"listring[current_player;main]"
|
"listring[current_player;main]"
|
||||||
|
|
||||||
|
minetest.register_chatcommand("enderchest", {
|
||||||
|
description = S("Show ender chest inventory formspec."),
|
||||||
|
privs = { debug = true },
|
||||||
|
func = function(name, params)
|
||||||
|
minetest.show_formspec(name, "enderchest:enderchest", formspec_ender_chest)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_node("mcl_chests:ender_chest_small", {
|
minetest.register_node("mcl_chests:ender_chest_small", {
|
||||||
description = S("Ender Chest"),
|
description = S("Ender Chest"),
|
||||||
_tt_help = S("27 interdimensional inventory slots") .. "\n" .. S("Put items inside, retrieve them from any ender chest"),
|
_tt_help = S("27 interdimensional inventory slots") .. "\n" .. S("Put items inside, retrieve them from any ender chest"),
|
||||||
_doc_items_longdesc = S("Ender chests grant you access to a single personal interdimensional inventory with 27 slots. This inventory is the same no matter from which ender chest you access it from. If you put one item into one ender chest, you will find it in all other ender chests. Each player will only see their own items, but not the items of other players."),
|
_doc_items_longdesc = S("Ender chests grant you access to a single personal interdimensional inventory with 27 slots. This inventory is the same no matter from which ender chest you access it from. If you put one item into one ender chest, you will find it in all other ender chests. Each player will only see their own items, but not the items of other players."),
|
||||||
_doc_items_usagehelp = S("Rightclick the ender chest to access your personal interdimensional inventory."),
|
_doc_items_usagehelp = S("Rightclick the ender chest to access your personal interdimensional inventory."),
|
||||||
drawtype = "nodebox",
|
drawtype = animate_chests and "nodebox" or "mesh",
|
||||||
node_box = {
|
mesh = not animate_chests and "mcl_chests_chest.obj" or nil,
|
||||||
|
node_box = animate_chests and {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.4375, -0.5, -0.4375, 0.5, 0.375, 0.4375},
|
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
||||||
|
} or nil,
|
||||||
|
collision_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
||||||
},
|
},
|
||||||
_chest_entity_textures = {"mcl_chests_ender.png"},
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.375, 0.4375},
|
||||||
|
},
|
||||||
|
tiles = animate_chests and {"mcl_chests_blank.png"} or tiles_chest_ender_small,
|
||||||
|
_chest_entity_textures = tiles_chest_ender_small,
|
||||||
_chest_entity_sound = "mcl_chests_enderchest",
|
_chest_entity_sound = "mcl_chests_enderchest",
|
||||||
_chest_entity_mesh = "mcl_chests_chest",
|
_chest_entity_mesh = "mcl_chests_chest",
|
||||||
_chest_entity_animation_type = "chest",
|
_chest_entity_animation_type = "chest",
|
||||||
tiles = {"mcl_chests_blank.png"},
|
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
||||||
--[[{"mcl_chests_ender_chest_top.png", "mcl_chests_ender_chest_bottom.png",
|
--[[{"mcl_chests_ender_chest_top.png", "mcl_chests_ender_chest_bottom.png",
|
||||||
"mcl_chests_ender_chest_right.png", "mcl_chests_ender_chest_left.png",
|
"mcl_chests_ender_chest_right.png", "mcl_chests_ender_chest_left.png",
|
||||||
|
@ -1034,10 +1115,13 @@ minetest.register_node("mcl_chests:ender_chest_small", {
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", formspec_ender_chest)
|
meta:set_string("formspec", formspec_ender_chest)
|
||||||
create_entity(pos, "mcl_chests:ender_chest_small", {"mcl_chests_ender.png"}, minetest.get_node(pos).param2, false, "mcl_chests_enderchest", "mcl_chests_chest", "chest")
|
|
||||||
|
if animate_chests then
|
||||||
|
create_entity(pos, "mcl_chests:ender_chest_small", tiles_chest_ender_small, minetest.get_node(pos).param2, false, "mcl_chests_enderchest", "mcl_chests_chest", "chest")
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
player_chest_open(clicker, pos, "mcl_chests:ender_chest_small", {"mcl_chests_ender.png"}, node.param2, false, "mcl_chests_enderchest", "mcl_chests_chest")
|
player_chest_open(clicker, pos, "mcl_chests:ender_chest_small", tiles_chest_ender_small, node.param2, false, "mcl_chests_enderchest", "mcl_chests_chest")
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
if fields.quit then
|
if fields.quit then
|
||||||
|
@ -1055,6 +1139,20 @@ minetest.register_on_joinplayer(function(player)
|
||||||
inv:set_size("enderchest", 9*3)
|
inv:set_size("enderchest", 9*3)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
minetest.register_allow_player_inventory_action(function(player, action, inv, info)
|
||||||
|
if inv:get_location().type == "player" and (
|
||||||
|
action == "move" and (info.from_list == "enderchest" or info.to_list == "enderchest")
|
||||||
|
or action == "put" and info.listname == "enderchest"
|
||||||
|
or action == "take" and info.listname == "enderchest"
|
||||||
|
) then
|
||||||
|
local def = player:get_wielded_item():get_definition()
|
||||||
|
|
||||||
|
if not minetest.find_node_near(player:get_pos(), def and def.range or ItemStack():get_definition().range, "mcl_chests:ender_chest_small", true) then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'mcl_chests:ender_chest',
|
output = 'mcl_chests:ender_chest',
|
||||||
recipe = {
|
recipe = {
|
||||||
|
@ -1215,8 +1313,9 @@ for color, desc in pairs(boxtypes) do
|
||||||
_doc_items_entry_name = entry_name,
|
_doc_items_entry_name = entry_name,
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
_doc_items_usagehelp = usagehelp,
|
_doc_items_usagehelp = usagehelp,
|
||||||
drawtype = "nodebox",
|
drawtype = animate_chests and "nodebox" or "mesh",
|
||||||
tiles = {"mcl_chests_blank.png"},
|
mesh = not animate_chests and "mcl_chests_shulker.obj" or nil,
|
||||||
|
tiles = animate_chests and {"mcl_chests_blank.png"} or {mob_texture},
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
||||||
_chest_entity_textures = {mob_texture},
|
_chest_entity_textures = {mob_texture},
|
||||||
_chest_entity_sound = "mcl_chests_shulker",
|
_chest_entity_sound = "mcl_chests_shulker",
|
||||||
|
@ -1237,7 +1336,10 @@ for color, desc in pairs(boxtypes) do
|
||||||
meta:set_string("formspec", formspec_shulker_box(nil))
|
meta:set_string("formspec", formspec_shulker_box(nil))
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 9*3)
|
inv:set_size("main", 9*3)
|
||||||
|
|
||||||
|
if animate_chests then
|
||||||
create_entity(pos, small_name, {mob_texture}, minetest.get_node(pos).param2, false, "mcl_chests_shulker", "mcl_chests_shulker", "shulker")
|
create_entity(pos, small_name, {mob_texture}, minetest.get_node(pos).param2, false, "mcl_chests_shulker", "mcl_chests_shulker", "shulker")
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
local nmeta = minetest.get_meta(pos)
|
local nmeta = minetest.get_meta(pos)
|
||||||
|
@ -1356,6 +1458,11 @@ local function select_and_spawn_entity(pos, node)
|
||||||
local node_name = node.name
|
local node_name = node.name
|
||||||
local node_def = minetest.registered_nodes[node_name]
|
local node_def = minetest.registered_nodes[node_name]
|
||||||
local double_chest = minetest.get_item_group(node_name, "double_chest") > 0
|
local double_chest = minetest.get_item_group(node_name, "double_chest") > 0
|
||||||
|
|
||||||
|
if not animate_chests and not double_chest then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
find_or_create_entity(pos, node_name, node_def._chest_entity_textures, node.param2, double_chest, node_def._chest_entity_sound, node_def._chest_entity_mesh, node_def._chest_entity_animation_type)
|
find_or_create_entity(pos, node_name, node_def._chest_entity_textures, node.param2, double_chest, node_def._chest_entity_sound, node_def._chest_entity_mesh, node_def._chest_entity_animation_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 286 B |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 307 B |
After Width: | Height: | Size: 285 B |
After Width: | Height: | Size: 307 B |
After Width: | Height: | Size: 286 B |
|
@ -4,47 +4,30 @@
|
||||||
-- Crafting definition
|
-- Crafting definition
|
||||||
--
|
--
|
||||||
|
|
||||||
|
local function craft_planks(output, input)
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'mcl_core:wood 4',
|
output = "mcl_core:"..output.."wood 4",
|
||||||
recipe = {
|
recipe = {
|
||||||
{'mcl_core:tree'},
|
{"mcl_core:"..input},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_craft({
|
local planks = {
|
||||||
output = 'mcl_core:darkwood 4',
|
{"", "oak"},
|
||||||
recipe = {
|
{"dark", "dark_oak"},
|
||||||
{'mcl_core:darktree'},
|
{"jungle", "jungle"},
|
||||||
|
{"acacia", "acacia"},
|
||||||
|
{"spruce", "spruce"},
|
||||||
|
{"birch", "birch"}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
for _, p in pairs(planks) do
|
||||||
output = 'mcl_core:junglewood 4',
|
craft_planks(p[1], p[1].."tree")
|
||||||
recipe = {
|
craft_planks(p[1], p[1].."tree_bark")
|
||||||
{'mcl_core:jungletree'},
|
craft_planks(p[1], "stripped_"..p[2])
|
||||||
}
|
craft_planks(p[1], "stripped_"..p[2].."_bark")
|
||||||
})
|
end
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'mcl_core:acaciawood 4',
|
|
||||||
recipe = {
|
|
||||||
{'mcl_core:acaciatree'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'mcl_core:sprucewood 4',
|
|
||||||
recipe = {
|
|
||||||
{'mcl_core:sprucetree'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'mcl_core:birchwood 4',
|
|
||||||
recipe = {
|
|
||||||
{'mcl_core:birchtree'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = 'shapeless',
|
type = 'shapeless',
|
||||||
|
@ -399,8 +382,14 @@ minetest.register_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- TODO: Add crafting recipe: 9 ice → 1 packed ice
|
minetest.register_craft({
|
||||||
-- Add it when silk touch tools work.
|
output = 'mcl_core:packed_ice 1',
|
||||||
|
recipe = {
|
||||||
|
{'mcl_core:ice', 'mcl_core:ice', 'mcl_core:ice'},
|
||||||
|
{'mcl_core:ice', 'mcl_core:ice', 'mcl_core:ice'},
|
||||||
|
{'mcl_core:ice', 'mcl_core:ice', 'mcl_core:ice'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Crafting (tool repair)
|
-- Crafting (tool repair)
|
||||||
|
|
|
@ -165,7 +165,7 @@ local function eat_gapple(itemstack, placer, pointed_thing)
|
||||||
mcl_potions.fire_resistance_func(placer, 1, 300)
|
mcl_potions.fire_resistance_func(placer, 1, 300)
|
||||||
mcl_potions.leaping_func(placer, 1, 300)
|
mcl_potions.leaping_func(placer, 1, 300)
|
||||||
end
|
end
|
||||||
mcl_potions.swiftness_func(placer, absorbtion_factor, 120) -- TODO: Absorbtion
|
-- TODO: Absorbtion
|
||||||
mcl_potions.regeneration_func(placer, 2, regen_duration)
|
mcl_potions.regeneration_func(placer, 2, regen_duration)
|
||||||
return gapple_hunger_restore(itemstack, placer, pointed_thing)
|
return gapple_hunger_restore(itemstack, placer, pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,110 +48,6 @@ minetest.register_abm({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local function count_air_nodes_below(pos, limit)
|
|
||||||
local below_pos
|
|
||||||
local below_node
|
|
||||||
for i=1,limit do
|
|
||||||
below_pos = {x=pos.x, y=pos.y-i, z=pos.z}
|
|
||||||
below_node = minetest.get_node(below_pos)
|
|
||||||
if below_node.name ~= "air" then
|
|
||||||
return i - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return limit
|
|
||||||
end
|
|
||||||
|
|
||||||
local function flow_water_downwards(below_pos)
|
|
||||||
minetest.set_node(
|
|
||||||
below_pos,
|
|
||||||
{name="mcl_core:water_flowing", param2=15}
|
|
||||||
)
|
|
||||||
-- One could assume that the lava cooling ABM would now do its
|
|
||||||
-- job if water nodes end up next to lava nodes. This is never
|
|
||||||
-- entirely the case: The only way to get any reliable cooling
|
|
||||||
-- of lava nodes is to do it ourselves here … the lava is just
|
|
||||||
-- removed otherwise.
|
|
||||||
--
|
|
||||||
-- This might be due to an engine bug.
|
|
||||||
local beside_pos_list = {
|
|
||||||
{x=below_pos.x+1, y=below_pos.y, z=below_pos.z},
|
|
||||||
{x=below_pos.x-1, y=below_pos.y, z=below_pos.z},
|
|
||||||
{x=below_pos.x, y=below_pos.y, z=below_pos.z+1},
|
|
||||||
{x=below_pos.x, y=below_pos.y, z=below_pos.z-1},
|
|
||||||
}
|
|
||||||
local beside_node
|
|
||||||
local lavatype
|
|
||||||
for _, beside_pos in ipairs(beside_pos_list) do
|
|
||||||
beside_node = minetest.get_node(beside_pos)
|
|
||||||
if 0 ~= minetest.get_item_group(beside_node.name, "lava") then
|
|
||||||
lavatype = minetest.registered_nodes[beside_node.name].liquidtype
|
|
||||||
-- Lava flow → Cobblestone
|
|
||||||
if lavatype == "flowing" then
|
|
||||||
minetest.set_node(
|
|
||||||
beside_pos,
|
|
||||||
{name="mcl_core:cobble"}
|
|
||||||
)
|
|
||||||
-- Lava source → Obsidian
|
|
||||||
elseif lavatype == "source" then
|
|
||||||
minetest.set_node(
|
|
||||||
beside_pos,
|
|
||||||
{name="mcl_core:obsidian"}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
-- Stone is generated if lava
|
|
||||||
-- ends up above water nodes,
|
|
||||||
-- this is handled elsewhere.
|
|
||||||
minetest.sound_play(
|
|
||||||
"fire_extinguish_flame",
|
|
||||||
{pos=beside_pos, gain=0.25, max_hear_distance=16},
|
|
||||||
true
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
label="Speed up downwards water flow and cool lava",
|
|
||||||
nodenames = {"mcl_core:water_flowing"},
|
|
||||||
neighbors = {"air"},
|
|
||||||
interval = 0.5,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos, node)
|
|
||||||
-- I want to start with an important message to every
|
|
||||||
-- future programmer who wants to rewrite the code in
|
|
||||||
-- a recursive fashion: STACK OVERFLOWS MEAN CRASHES!
|
|
||||||
--
|
|
||||||
-- Your recursive approach will most likely crash the
|
|
||||||
-- game – if not on your computer, then probably some
|
|
||||||
-- time later on some other computer. If you want the
|
|
||||||
-- questionable honor of being at fault when a bucket
|
|
||||||
-- of water can crash the server, go ahead: Refucktor
|
|
||||||
-- the code and be upset when it ruins someone's day.
|
|
||||||
--
|
|
||||||
-- After all, it really was not your fault, right? On
|
|
||||||
-- your computer everything worked and whoever has an
|
|
||||||
-- issue with your elegant solution just should buy a
|
|
||||||
-- new gaming rig or do something else beyond holding
|
|
||||||
-- you responsible for your utterly perfect solution.
|
|
||||||
--
|
|
||||||
-- In case this message offends you, I hereby ask you
|
|
||||||
-- to kindly fuck off, by which I mean: Stop reading.
|
|
||||||
|
|
||||||
-- We have to determine the depth of the air column
|
|
||||||
-- below the flowing water before changing anything
|
|
||||||
-- because otherwise we get artifacts in a lavacast
|
|
||||||
-- due to the lava escaping while we replace nodes.
|
|
||||||
local air_node_count = count_air_nodes_below(pos, 80)
|
|
||||||
if 0 == air_node_count then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
for i=1,air_node_count do
|
|
||||||
local below_pos = {x=pos.x, y=pos.y-i, z=pos.z}
|
|
||||||
flow_water_downwards(below_pos)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Papyrus and cactus growing
|
-- Papyrus and cactus growing
|
||||||
--
|
--
|
||||||
|
|
|
@ -202,18 +202,42 @@ Stained glass is a decorative and mostly transparent block which comes in variou
|
||||||
Stick=Stock
|
Stick=Stock
|
||||||
Sticks are a very versatile crafting material; used in countless crafting recipes.=Stöcke sind ein vielseitiges Material, sie werden in zahllosen Fertigungsrezepten gebraucht.
|
Sticks are a very versatile crafting material; used in countless crafting recipes.=Stöcke sind ein vielseitiges Material, sie werden in zahllosen Fertigungsrezepten gebraucht.
|
||||||
Stone=Stein
|
Stone=Stein
|
||||||
|
Stripped Acacia Log=Entrindeter Akazienstamm
|
||||||
|
Stripped Acacia Wood=Entrindetes Akazienholz
|
||||||
|
Stripped Birch Log=Entrindeter Birkenstamm
|
||||||
|
Stripped Birch Wood=Entrindetes Birkenholz
|
||||||
|
Stripped Dark Oak Log=Entrindeter Schwarzeichenstamm
|
||||||
|
Stripped Dark Oak Wood=Entrindetes Schwarzeichenholz
|
||||||
|
Stripped Jungle Log=Entrindeter Dschungelbaumstamm
|
||||||
|
Stripped Jungle Wood=Entrindetes Dschungelholz
|
||||||
|
Stripped Oak Log=Entrindeter Eichenstamm
|
||||||
|
Stripped Oak Wood=Entrindetes Eichenholz
|
||||||
|
Stripped Spruce Log=Entrindeter Fichtenstamm
|
||||||
|
Stripped Spruce Wood=Entrindetes Fichtenholz
|
||||||
Stone Bricks=Steinziegel
|
Stone Bricks=Steinziegel
|
||||||
Sugar=Zucker
|
Sugar=Zucker
|
||||||
Sugar Canes=Zuckerrohr
|
Sugar Canes=Zuckerrohr
|
||||||
Sugar canes are a plant which has some uses in crafting. Sugar canes will slowly grow up to 3 blocks when they are next to water and are placed on a grass block, dirt, sand, red sand, podzol or coarse dirt. When a sugar cane is broken, all sugar canes connected above will break as well.=Zuckerrohr ist eine Pflanze, die in der Herstellung gebraucht wird. Zuckerrohr wird in der Nähe von Wasser bis zu 3 zusätzliche Blöcke wachsen lassen, wenn sie sich neben Wasser befinden und auf einem Grasblock, auf Erde, Sand, roten Sand, Podsol oder grobe Erde platziert wurden. Wird ein Zuckerrohr abgebrochen, werden alle verbundenen Zuckerrohrblöcke ebenfalls abbrechen.
|
Sugar canes are a plant which has some uses in crafting. Sugar canes will slowly grow up to 3 blocks when they are next to water and are placed on a grass block, dirt, sand, red sand, podzol or coarse dirt. When a sugar cane is broken, all sugar canes connected above will break as well.=Zuckerrohr ist eine Pflanze, die in der Herstellung gebraucht wird. Zuckerrohr wird in der Nähe von Wasser bis zu 3 zusätzliche Blöcke wachsen lassen, wenn sie sich neben Wasser befinden und auf einem Grasblock, auf Erde, Sand, roten Sand, Podsol oder grobe Erde platziert wurden. Wird ein Zuckerrohr abgebrochen, werden alle verbundenen Zuckerrohrblöcke ebenfalls abbrechen.
|
||||||
Sugar canes can only be placed top of other sugar canes and on top of blocks on which they would grow.=Zuckerrohr kann nur auf Zuckerrohr platziert werden und auf Blöcken, auf denen Zuckerrohr wachsen würde.
|
Sugar canes can only be placed top of other sugar canes and on top of blocks on which they would grow.=Zuckerrohr kann nur auf Zuckerrohr platziert werden und auf Blöcken, auf denen Zuckerrohr wachsen würde.
|
||||||
Sugar comes from sugar canes and is used to make sweet foods.=Zucker kommt von Zuckerrohr und wird benutzt, um süße Lebensmittel zu machen.
|
Sugar comes from sugar canes and is used to make sweet foods.=Zucker kommt von Zuckerrohr und wird benutzt, um süße Lebensmittel zu machen.
|
||||||
|
The stripped trunk of an acacia tree.=Der entrindete Stamm einer Akazie.
|
||||||
|
The stripped trunk of a birch tree.=Der entrindete Stamm einer Birke.
|
||||||
|
The stripped trunk of a dark oak tree.=Der entrindete Stamm einer Schwarzeiche.
|
||||||
|
The stripped trunk of a jungle tree.=Der entrindete Stamm eines Dschungelbaums.
|
||||||
|
The stripped trunk of an oak tree.=Der entrindete Stamm einer Eiche.
|
||||||
|
The stripped trunk of a spruce tree.=Der entrindete Stamm einer Fichte.
|
||||||
The trunk of a birch tree.=Der Baumstamm einer Birke.
|
The trunk of a birch tree.=Der Baumstamm einer Birke.
|
||||||
The trunk of a dark oak tree.=Der Baumstamm einer Schwarzeiche.
|
The trunk of a dark oak tree.=Der Baumstamm einer Schwarzeiche.
|
||||||
The trunk of a jungle tree.=Der Baumstamm eines Dschungelbaums.
|
The trunk of a jungle tree.=Der Baumstamm eines Dschungelbaums.
|
||||||
The trunk of a spruce tree.=Der Baumstamm einer Fichte.
|
The trunk of a spruce tree.=Der Baumstamm einer Fichte.
|
||||||
The trunk of an acacia.=Der Baumstamm einer Akazie.
|
The trunk of an acacia.=Der Baumstamm einer Akazie.
|
||||||
The trunk of an oak tree.=Der Baumstamm einer Eiche.
|
The trunk of an oak tree.=Der Baumstamm einer Eiche.
|
||||||
|
The stripped wood of an acacia tree.=Das entrindete Holz einer Akazie.
|
||||||
|
The stripped wood of a birch tree.=Das entrindete Holz einer Birke.
|
||||||
|
The stripped wood of a dark oak tree.=Das entrindete Holz einer Schwarzeiche.
|
||||||
|
The stripped wood of a jungle tree.=Das entrindete Holz eines Dschungelbaums.
|
||||||
|
The stripped wood of an oak tree.=Das entrindete Holz einer Eiche.
|
||||||
|
The stripped wood of a spruce tree.=Das entrindete Holz einer Fichte.
|
||||||
This block consists of a couple of loose stones and can't support itself.=Diser Block besteht aus ein paar losen Steinchen und kann sich nicht selbst tragen.
|
This block consists of a couple of loose stones and can't support itself.=Diser Block besteht aus ein paar losen Steinchen und kann sich nicht selbst tragen.
|
||||||
This is a decorative block surrounded by the bark of a tree trunk.=Dies ist ein dekorativer Block, der von der Rinde eines Baumstamms umgeben ist.
|
This is a decorative block surrounded by the bark of a tree trunk.=Dies ist ein dekorativer Block, der von der Rinde eines Baumstamms umgeben ist.
|
||||||
This is a full block of snow. Snow of this thickness is usually found in areas of extreme cold.=Ein ganzer Block aus Schnee. Schnee von dieser Dicke wird üblicherweise in Gebieten extremer Kälte gefunden.
|
This is a full block of snow. Snow of this thickness is usually found in areas of extreme cold.=Ein ganzer Block aus Schnee. Schnee von dieser Dicke wird üblicherweise in Gebieten extremer Kälte gefunden.
|
||||||
|
|
|
@ -202,18 +202,42 @@ Stained glass is a decorative and mostly transparent block which comes in variou
|
||||||
Stick=
|
Stick=
|
||||||
Sticks are a very versatile crafting material; used in countless crafting recipes.=
|
Sticks are a very versatile crafting material; used in countless crafting recipes.=
|
||||||
Stone=
|
Stone=
|
||||||
|
Stripped Acacia Log=
|
||||||
|
Stripped Acacia Wood=
|
||||||
|
Stripped Birch Log=
|
||||||
|
Stripped Birch Wood=
|
||||||
|
Stripped Dark Oak Log=
|
||||||
|
Stripped Dark Oak Wood=
|
||||||
|
Stripped Jungle Log=
|
||||||
|
Stripped Jungle Wood=
|
||||||
|
Stripped Oak Log=
|
||||||
|
Stripped Oak Wood=
|
||||||
|
Stripped Spruce Log=
|
||||||
|
Stripped Spruce Wood=
|
||||||
Stone Bricks=
|
Stone Bricks=
|
||||||
Sugar=
|
Sugar=
|
||||||
Sugar Canes=
|
Sugar Canes=
|
||||||
Sugar canes are a plant which has some uses in crafting. Sugar canes will slowly grow up to 3 blocks when they are next to water and are placed on a grass block, dirt, sand, red sand, podzol or coarse dirt. When a sugar cane is broken, all sugar canes connected above will break as well.=
|
Sugar canes are a plant which has some uses in crafting. Sugar canes will slowly grow up to 3 blocks when they are next to water and are placed on a grass block, dirt, sand, red sand, podzol or coarse dirt. When a sugar cane is broken, all sugar canes connected above will break as well.=
|
||||||
Sugar canes can only be placed top of other sugar canes and on top of blocks on which they would grow.=
|
Sugar canes can only be placed top of other sugar canes and on top of blocks on which they would grow.=
|
||||||
Sugar comes from sugar canes and is used to make sweet foods.=
|
Sugar comes from sugar canes and is used to make sweet foods.=
|
||||||
|
The stripped trunk of an acacia tree.=
|
||||||
|
The stripped trunk of a birch tree.=
|
||||||
|
The stripped trunk of a dark oak tree.=
|
||||||
|
The stripped trunk of a jungle tree.=
|
||||||
|
The stripped trunk of an oak tree.=
|
||||||
|
The stripped trunk of a spruce tree.=
|
||||||
The trunk of a birch tree.=
|
The trunk of a birch tree.=
|
||||||
The trunk of a dark oak tree.=
|
The trunk of a dark oak tree.=
|
||||||
The trunk of a jungle tree.=
|
The trunk of a jungle tree.=
|
||||||
The trunk of a spruce tree.=
|
The trunk of a spruce tree.=
|
||||||
The trunk of an acacia.=
|
The trunk of an acacia.=
|
||||||
The trunk of an oak tree.=
|
The trunk of an oak tree.=
|
||||||
|
The stripped wood of an acacia tree.=
|
||||||
|
The stripped wood of a birch tree.=
|
||||||
|
The stripped wood of a dark oak tree.=
|
||||||
|
The stripped wood of a jungle tree.=
|
||||||
|
The stripped wood of an oak tree.=
|
||||||
|
The stripped wood of a spruce tree.=
|
||||||
This block consists of a couple of loose stones and can't support itself.=
|
This block consists of a couple of loose stones and can't support itself.=
|
||||||
This is a decorative block surrounded by the bark of a tree trunk.=
|
This is a decorative block surrounded by the bark of a tree trunk.=
|
||||||
This is a full block of snow. Snow of this thickness is usually found in areas of extreme cold.=
|
This is a full block of snow. Snow of this thickness is usually found in areas of extreme cold.=
|
||||||
|
|
|
@ -8,7 +8,7 @@ if mod_screwdriver then
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Register tree trunk (wood) and bark
|
-- Register tree trunk (wood) and bark
|
||||||
local register_tree_trunk = function(subname, description_trunk, description_bark, longdesc, tile_inner, tile_bark)
|
local function register_tree_trunk(subname, description_trunk, description_bark, longdesc, tile_inner, tile_bark, stripped_variant)
|
||||||
minetest.register_node("mcl_core:"..subname, {
|
minetest.register_node("mcl_core:"..subname, {
|
||||||
description = description_trunk,
|
description = description_trunk,
|
||||||
_doc_items_longdesc = longdesc,
|
_doc_items_longdesc = longdesc,
|
||||||
|
@ -22,6 +22,7 @@ local register_tree_trunk = function(subname, description_trunk, description_bar
|
||||||
on_rotate = on_rotate,
|
on_rotate = on_rotate,
|
||||||
_mcl_blast_resistance = 2,
|
_mcl_blast_resistance = 2,
|
||||||
_mcl_hardness = 2,
|
_mcl_hardness = 2,
|
||||||
|
_mcl_stripped_variant = stripped_variant,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("mcl_core:"..subname.."_bark", {
|
minetest.register_node("mcl_core:"..subname.."_bark", {
|
||||||
|
@ -37,6 +38,48 @@ local register_tree_trunk = function(subname, description_trunk, description_bar
|
||||||
on_rotate = on_rotate,
|
on_rotate = on_rotate,
|
||||||
_mcl_blast_resistance = 2,
|
_mcl_blast_resistance = 2,
|
||||||
_mcl_hardness = 2,
|
_mcl_hardness = 2,
|
||||||
|
_mcl_stripped_variant = stripped_variant.."_bark",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "mcl_core:"..subname.."_bark 3",
|
||||||
|
recipe = {
|
||||||
|
{ "mcl_core:"..subname, "mcl_core:"..subname },
|
||||||
|
{ "mcl_core:"..subname, "mcl_core:"..subname },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Register stripped trunk and stripped wood
|
||||||
|
local function register_stripped_trunk(subname, description_stripped_trunk, description_stripped_bark, longdesc, longdesc_wood, tile_stripped_inner, tile_stripped_bark)
|
||||||
|
minetest.register_node("mcl_core:"..subname, {
|
||||||
|
description = description_stripped_trunk,
|
||||||
|
_doc_items_longdesc = longdesc,
|
||||||
|
_doc_items_hidden = false,
|
||||||
|
tiles = {tile_stripped_inner, tile_stripped_inner, tile_stripped_bark},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
on_place = mcl_util.rotate_axis,
|
||||||
|
stack_max = 64,
|
||||||
|
groups = {handy=1, axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
|
||||||
|
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||||
|
on_rotate = on_rotate,
|
||||||
|
_mcl_blast_resistance = 2,
|
||||||
|
_mcl_hardness = 2,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("mcl_core:"..subname.."_bark", {
|
||||||
|
description = description_stripped_bark,
|
||||||
|
_doc_items_longdesc = longdesc_wood,
|
||||||
|
tiles = {tile_stripped_bark},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
on_place = mcl_util.rotate_axis,
|
||||||
|
stack_max = 64,
|
||||||
|
groups = {handy=1, axey=1, bark=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
|
||||||
|
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||||
|
is_ground_content = false,
|
||||||
|
on_rotate = on_rotate,
|
||||||
|
_mcl_blast_resistance = 2,
|
||||||
|
_mcl_hardness = 2,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -48,7 +91,7 @@ local register_tree_trunk = function(subname, description_trunk, description_bar
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local register_wooden_planks = function(subname, description, tiles)
|
local function register_wooden_planks(subname, description, tiles)
|
||||||
minetest.register_node("mcl_core:"..subname, {
|
minetest.register_node("mcl_core:"..subname, {
|
||||||
description = description,
|
description = description,
|
||||||
_doc_items_longdesc = doc.sub.items.temp.build,
|
_doc_items_longdesc = doc.sub.items.temp.build,
|
||||||
|
@ -119,7 +162,7 @@ local register_leaves = function(subname, description, longdesc, tiles, sapling,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local register_sapling = function(subname, description, longdesc, tt_help, texture, selbox)
|
local function register_sapling(subname, description, longdesc, tt_help, texture, selbox)
|
||||||
minetest.register_node("mcl_core:"..subname, {
|
minetest.register_node("mcl_core:"..subname, {
|
||||||
description = description,
|
description = description,
|
||||||
_tt_help = tt_help,
|
_tt_help = tt_help,
|
||||||
|
@ -161,12 +204,19 @@ end
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
register_tree_trunk("tree", S("Oak Wood"), S("Oak Bark"), S("The trunk of an oak tree."), "default_tree_top.png", "default_tree.png")
|
register_tree_trunk("tree", S("Oak Wood"), S("Oak Bark"), S("The trunk of an oak tree."), "default_tree_top.png", "default_tree.png", "mcl_core:stripped_oak")
|
||||||
register_tree_trunk("darktree", S("Dark Oak Wood"), S("Dark Oak Bark"), S("The trunk of a dark oak tree."), "mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak.png")
|
register_tree_trunk("darktree", S("Dark Oak Wood"), S("Dark Oak Bark"), S("The trunk of a dark oak tree."), "mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak.png", "mcl_core:stripped_dark_oak")
|
||||||
register_tree_trunk("acaciatree", S("Acacia Wood"), S("Acacia Bark"), S("The trunk of an acacia."), "default_acacia_tree_top.png", "default_acacia_tree.png")
|
register_tree_trunk("acaciatree", S("Acacia Wood"), S("Acacia Bark"), S("The trunk of an acacia."), "default_acacia_tree_top.png", "default_acacia_tree.png", "mcl_core:stripped_acacia")
|
||||||
register_tree_trunk("sprucetree", S("Spruce Wood"), S("Spruce Bark"), S("The trunk of a spruce tree."), "mcl_core_log_spruce_top.png", "mcl_core_log_spruce.png")
|
register_tree_trunk("sprucetree", S("Spruce Wood"), S("Spruce Bark"), S("The trunk of a spruce tree."), "mcl_core_log_spruce_top.png", "mcl_core_log_spruce.png", "mcl_core:stripped_spruce")
|
||||||
register_tree_trunk("birchtree", S("Birch Wood"), S("Birch Bark"), S("The trunk of a birch tree."), "mcl_core_log_birch_top.png", "mcl_core_log_birch.png")
|
register_tree_trunk("birchtree", S("Birch Wood"), S("Birch Bark"), S("The trunk of a birch tree."), "mcl_core_log_birch_top.png", "mcl_core_log_birch.png", "mcl_core:stripped_birch")
|
||||||
register_tree_trunk("jungletree", S("Jungle Wood"), S("Jungle Bark"), S("The trunk of a jungle tree."), "default_jungletree_top.png", "default_jungletree.png")
|
register_tree_trunk("jungletree", S("Jungle Wood"), S("Jungle Bark"), S("The trunk of a jungle tree."), "default_jungletree_top.png", "default_jungletree.png", "mcl_core:stripped_jungle")
|
||||||
|
|
||||||
|
register_stripped_trunk("stripped_oak", S("Stripped Oak Log"), S("Stripped Oak Wood"), S("The stripped trunk of an oak tree."), S("The stripped wood of an oak tree."), "mcl_core_stripped_oak_top.png", "mcl_core_stripped_oak_side.png")
|
||||||
|
register_stripped_trunk("stripped_acacia", S("Stripped Acacia Log"), S("Stripped Acacia Wood"), S("The stripped trunk of an acacia tree."), S("The stripped wood of an acacia tree."), "mcl_core_stripped_acacia_top.png", "mcl_core_stripped_acacia_side.png")
|
||||||
|
register_stripped_trunk("stripped_dark_oak", S("Stripped Dark Oak Log"), S("Stripped Dark Oak Wood"), S("The stripped trunk of a dark oak tree."), S("The stripped wood of a dark oak tree."), "mcl_core_stripped_dark_oak_top.png", "mcl_core_stripped_dark_oak_side.png")
|
||||||
|
register_stripped_trunk("stripped_birch", S("Stripped Birch Log"), S("Stripped Birch Wood"), S("The stripped trunk of a birch tree."), S("The stripped wood of a birch tree."), "mcl_core_stripped_birch_top.png", "mcl_core_stripped_birch_side.png")
|
||||||
|
register_stripped_trunk("stripped_spruce", S("Stripped Spruce Log"), S("Stripped Spruce Wood"), S("The stripped trunk of a spruce tree."), S("The stripped wood of a spruce tree."), "mcl_core_stripped_spruce_top.png", "mcl_core_stripped_spruce_side.png")
|
||||||
|
register_stripped_trunk("stripped_jungle", S("Stripped Jungle Log"), S("Stripped Jungle Wood"), S("The stripped trunk of a jungle tree."), S("The stripped wood of a jungle tree."),"mcl_core_stripped_jungle_top.png", "mcl_core_stripped_jungle_side.png")
|
||||||
|
|
||||||
register_wooden_planks("wood", S("Oak Wood Planks"), {"default_wood.png"})
|
register_wooden_planks("wood", S("Oak Wood Planks"), {"default_wood.png"})
|
||||||
register_wooden_planks("darkwood", S("Dark Oak Wood Planks"), {"mcl_core_planks_big_oak.png"})
|
register_wooden_planks("darkwood", S("Dark Oak Wood Planks"), {"mcl_core_planks_big_oak.png"})
|
||||||
|
|
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 611 B |
After Width: | Height: | Size: 681 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 695 B |
After Width: | Height: | Size: 650 B |
After Width: | Height: | Size: 637 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 729 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 733 B |
|
@ -388,12 +388,11 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
{ x=0, y=0, z=-1 },
|
{ x=0, y=0, z=-1 },
|
||||||
{ x=0, y=0, z=1 },
|
{ x=0, y=0, z=1 },
|
||||||
}
|
}
|
||||||
local floorpos, floor
|
|
||||||
for n=#neighbors, 1, -1 do
|
for n=#neighbors, 1, -1 do
|
||||||
local offset = neighbors[n]
|
local offset = neighbors[n]
|
||||||
local blockpos = vector.add(stempos, offset)
|
local blockpos = vector.add(stempos, offset)
|
||||||
floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
|
local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
|
||||||
floor = minetest.get_node(floorpos)
|
local floor = minetest.get_node(floorpos)
|
||||||
local block = minetest.get_node(blockpos)
|
local block = minetest.get_node(blockpos)
|
||||||
local soilgroup = minetest.get_item_group(floor.name, "soil")
|
local soilgroup = minetest.get_item_group(floor.name, "soil")
|
||||||
if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then
|
if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then
|
||||||
|
@ -407,6 +406,8 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
||||||
local r = math.random(1, #neighbors)
|
local r = math.random(1, #neighbors)
|
||||||
local offset = neighbors[r]
|
local offset = neighbors[r]
|
||||||
local blockpos = vector.add(stempos, offset)
|
local blockpos = vector.add(stempos, offset)
|
||||||
|
local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
|
||||||
|
local floor = minetest.get_node(floorpos)
|
||||||
local p2
|
local p2
|
||||||
if offset.x == 1 then
|
if offset.x == 1 then
|
||||||
minetest.set_node(stempos, {name=connected_stem_names[1]})
|
minetest.set_node(stempos, {name=connected_stem_names[1]})
|
||||||
|
|
|
@ -43,13 +43,19 @@ end
|
||||||
-- Checks if player is still allowed to display the minimap
|
-- Checks if player is still allowed to display the minimap
|
||||||
local function update_minimap(player)
|
local function update_minimap(player)
|
||||||
local creative = minetest.is_creative_enabled(player:get_player_name())
|
local creative = minetest.is_creative_enabled(player:get_player_name())
|
||||||
|
|
||||||
|
local newstate=false
|
||||||
|
local oldstate=player:hud_get_flags().minimap
|
||||||
|
|
||||||
|
if creative or has_item_in_hotbar(player, "mcl_maps:filled_map") then
|
||||||
|
newstate=true
|
||||||
|
end
|
||||||
|
|
||||||
|
if oldstate ~= newstate then
|
||||||
if creative then
|
if creative then
|
||||||
player:hud_set_flags({minimap = true, minimap_radar = true})
|
player:hud_set_flags({minimap = true, minimap_radar = true})
|
||||||
else
|
else
|
||||||
if has_item_in_hotbar(player, "mcl_maps:filled_map") then
|
player:hud_set_flags({minimap = newstate, minimap_radar = false})
|
||||||
player:hud_set_flags({minimap = true, minimap_radar = false})
|
|
||||||
else
|
|
||||||
player:hud_set_flags({minimap = false, minimap_radar = false})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -351,6 +351,34 @@ minetest.register_tool("mcl_tools:shovel_diamond", {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Axes
|
-- Axes
|
||||||
|
local function make_stripped_trunk(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.type ~= "node" then return end
|
||||||
|
|
||||||
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
|
local nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||||
|
|
||||||
|
if not placer:get_player_control().sneak and nodedef.on_rightclick then
|
||||||
|
return minetest.item_place(itemstack, placer, pointed_thing)
|
||||||
|
end
|
||||||
|
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
|
||||||
|
minetest.record_protection_violation(pointed_thing.under, placer:get_player_name())
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
if nodedef._mcl_stripped_variant == nil then
|
||||||
|
return itemstack
|
||||||
|
else
|
||||||
|
minetest.swap_node(pointed_thing.under, {name=nodedef._mcl_stripped_variant, param2=node.param2})
|
||||||
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
|
-- Add wear (as if digging a axey node)
|
||||||
|
local toolname = itemstack:get_name()
|
||||||
|
local wear = mcl_autogroup.get_wear(toolname, "axey")
|
||||||
|
itemstack:add_wear(wear)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_tool("mcl_tools:axe_wood", {
|
minetest.register_tool("mcl_tools:axe_wood", {
|
||||||
description = S("Wooden Axe"),
|
description = S("Wooden Axe"),
|
||||||
_doc_items_longdesc = axe_longdesc,
|
_doc_items_longdesc = axe_longdesc,
|
||||||
|
@ -364,6 +392,7 @@ minetest.register_tool("mcl_tools:axe_wood", {
|
||||||
damage_groups = {fleshy=7},
|
damage_groups = {fleshy=7},
|
||||||
punch_attack_uses = 30,
|
punch_attack_uses = 30,
|
||||||
},
|
},
|
||||||
|
on_place = make_stripped_trunk,
|
||||||
sound = { breaks = "default_tool_breaks" },
|
sound = { breaks = "default_tool_breaks" },
|
||||||
_repair_material = "group:wood",
|
_repair_material = "group:wood",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
|
@ -383,6 +412,7 @@ minetest.register_tool("mcl_tools:axe_stone", {
|
||||||
damage_groups = {fleshy=9},
|
damage_groups = {fleshy=9},
|
||||||
punch_attack_uses = 66,
|
punch_attack_uses = 66,
|
||||||
},
|
},
|
||||||
|
on_place = make_stripped_trunk,
|
||||||
sound = { breaks = "default_tool_breaks" },
|
sound = { breaks = "default_tool_breaks" },
|
||||||
_repair_material = "mcl_core:cobble",
|
_repair_material = "mcl_core:cobble",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
|
@ -403,6 +433,7 @@ minetest.register_tool("mcl_tools:axe_iron", {
|
||||||
damage_groups = {fleshy=9},
|
damage_groups = {fleshy=9},
|
||||||
punch_attack_uses = 126,
|
punch_attack_uses = 126,
|
||||||
},
|
},
|
||||||
|
on_place = make_stripped_trunk,
|
||||||
sound = { breaks = "default_tool_breaks" },
|
sound = { breaks = "default_tool_breaks" },
|
||||||
_repair_material = "mcl_core:iron_ingot",
|
_repair_material = "mcl_core:iron_ingot",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
|
@ -422,6 +453,7 @@ minetest.register_tool("mcl_tools:axe_gold", {
|
||||||
damage_groups = {fleshy=7},
|
damage_groups = {fleshy=7},
|
||||||
punch_attack_uses = 17,
|
punch_attack_uses = 17,
|
||||||
},
|
},
|
||||||
|
on_place = make_stripped_trunk,
|
||||||
sound = { breaks = "default_tool_breaks" },
|
sound = { breaks = "default_tool_breaks" },
|
||||||
_repair_material = "mcl_core:gold_ingot",
|
_repair_material = "mcl_core:gold_ingot",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
|
@ -441,6 +473,7 @@ minetest.register_tool("mcl_tools:axe_diamond", {
|
||||||
damage_groups = {fleshy=9},
|
damage_groups = {fleshy=9},
|
||||||
punch_attack_uses = 781,
|
punch_attack_uses = 781,
|
||||||
},
|
},
|
||||||
|
on_place = make_stripped_trunk,
|
||||||
sound = { breaks = "default_tool_breaks" },
|
sound = { breaks = "default_tool_breaks" },
|
||||||
_repair_material = "mcl_core:diamond",
|
_repair_material = "mcl_core:diamond",
|
||||||
_mcl_toollike_wield = true,
|
_mcl_toollike_wield = true,
|
||||||
|
|
|
@ -0,0 +1,206 @@
|
||||||
|
local clamp = function(value, min, max)
|
||||||
|
assert( min < max )
|
||||||
|
if value < min then
|
||||||
|
return min
|
||||||
|
end
|
||||||
|
if value > max then
|
||||||
|
return max
|
||||||
|
end
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
|
||||||
|
assert( clamp(000, -100, 100) == 000 )
|
||||||
|
assert( clamp(999, -100, 100) == 100 )
|
||||||
|
assert( clamp(999, -999, 999) == 999 )
|
||||||
|
assert( clamp(998, 999, 1999) == 999 )
|
||||||
|
assert( clamp(999, 999, 1999) == 999 )
|
||||||
|
|
||||||
|
local clamp_s16 = function(value)
|
||||||
|
-- seems minetest hangs on -32768 and 32767
|
||||||
|
return clamp(value, -32767, 32766)
|
||||||
|
end
|
||||||
|
|
||||||
|
assert( clamp_s16(000000) == 000000 )
|
||||||
|
assert( clamp_s16(000001) == 000001 )
|
||||||
|
assert( clamp_s16(000010) == 000010 )
|
||||||
|
assert( clamp_s16(000100) == 000100 )
|
||||||
|
assert( clamp_s16(001000) == 001000 )
|
||||||
|
assert( clamp_s16(010000) == 010000 )
|
||||||
|
assert( clamp_s16(100000) == 032766 )
|
||||||
|
|
||||||
|
assert( clamp_s16(-00000) == -00000 )
|
||||||
|
assert( clamp_s16(-00009) == -00009 )
|
||||||
|
assert( clamp_s16(-00099) == -00099 )
|
||||||
|
assert( clamp_s16(-00999) == -00999 )
|
||||||
|
assert( clamp_s16(-09999) == -09999 )
|
||||||
|
assert( clamp_s16(-99999) == -32767 )
|
||||||
|
|
||||||
|
local minetest_find_nodes_in_area = minetest.find_nodes_in_area
|
||||||
|
minetest.find_nodes_in_area = function(minp, maxp, ...)
|
||||||
|
if
|
||||||
|
minp.x >= 32767 or minp.x <= -32768 or
|
||||||
|
minp.y >= 32767 or minp.y <= -32768 or
|
||||||
|
minp.z >= 32767 or minp.z <= -32768 or
|
||||||
|
maxp.x >= 32767 or maxp.x <= -32768 or
|
||||||
|
maxp.y >= 32767 or maxp.y <= -32768 or
|
||||||
|
maxp.z >= 32767 or maxp.z <= -32768
|
||||||
|
then
|
||||||
|
minetest.log(
|
||||||
|
"warning",
|
||||||
|
"find_nodes_in_area() called with coords outside interval (-32768, 32767), clamping arguments: " ..
|
||||||
|
"minp { x=" .. minp.x .. ", y=" .. minp.y .. " z=" .. minp.z .. " } " ..
|
||||||
|
"maxp { x=" .. maxp.x .. ", y=" .. maxp.y .. " z=" .. maxp.z .. " } "
|
||||||
|
)
|
||||||
|
return minetest_find_nodes_in_area(
|
||||||
|
{ x=clamp_s16(minp.x), y=clamp_s16(minp.y), z=clamp_s16(minp.z) },
|
||||||
|
{ x=clamp_s16(maxp.x), y=clamp_s16(maxp.y), z=clamp_s16(maxp.z) },
|
||||||
|
...
|
||||||
|
)
|
||||||
|
else
|
||||||
|
return minetest_find_nodes_in_area(
|
||||||
|
minp,
|
||||||
|
maxp,
|
||||||
|
...
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
deep_compare = function(a, b)
|
||||||
|
local type_a = type(a)
|
||||||
|
local type_b = type(b)
|
||||||
|
if type_a ~= type_b then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if type_a ~= "table" and type_b ~= "table" then
|
||||||
|
return a == b
|
||||||
|
end
|
||||||
|
for key_a, value_a in pairs(a) do
|
||||||
|
local value_b = b[key_a]
|
||||||
|
if not deep_compare(value_a, value_b) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for key_b, value_b in pairs(b) do
|
||||||
|
local value_a = a[key_b]
|
||||||
|
if not deep_compare(value_b, value_a) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
assert(
|
||||||
|
deep_compare(
|
||||||
|
1,
|
||||||
|
1.0
|
||||||
|
) == true
|
||||||
|
)
|
||||||
|
|
||||||
|
assert(
|
||||||
|
deep_compare(
|
||||||
|
true,
|
||||||
|
"true"
|
||||||
|
) == false
|
||||||
|
)
|
||||||
|
|
||||||
|
assert(
|
||||||
|
deep_compare(
|
||||||
|
{ a=1, b=-2, c=3.4 },
|
||||||
|
{ a=1, b=-2, c=3.4 }
|
||||||
|
) == true
|
||||||
|
)
|
||||||
|
|
||||||
|
assert(
|
||||||
|
deep_compare(
|
||||||
|
{ a={ 1, 2, 3 }, b="foo", c=false },
|
||||||
|
{ a={ 1, 2, 3 }, b="foo", c=false }
|
||||||
|
) == true
|
||||||
|
)
|
||||||
|
|
||||||
|
assert(
|
||||||
|
deep_compare(
|
||||||
|
{ a={ 1, 2, 3 }, b="foo", c=false },
|
||||||
|
{ a={ 4, 5, 6 }, b="foo", c=false }
|
||||||
|
) == false
|
||||||
|
)
|
||||||
|
|
||||||
|
assert(
|
||||||
|
deep_compare(
|
||||||
|
{ a={ 1, 2, 3 }, b={ c=false } },
|
||||||
|
{ a={ 1, 2, 3 }, b={ c=false } }
|
||||||
|
) == true
|
||||||
|
)
|
||||||
|
|
||||||
|
assert(
|
||||||
|
deep_compare(
|
||||||
|
{ a={ 1, 2, 3 }, b={ } },
|
||||||
|
{ a={ 1, 2, 3 }, b={ c=false } }
|
||||||
|
) == false
|
||||||
|
)
|
||||||
|
|
||||||
|
local test_minetest_find_nodes_in_area_implementation_equivalence = function()
|
||||||
|
-- If any assertion in this test function fails, the wrapper
|
||||||
|
-- for minetest.find_nodes_in_area() does not behave like the
|
||||||
|
-- original function. If you are reading the code because your
|
||||||
|
-- server crashed, please inform the Mineclonia developers.
|
||||||
|
local fun_1 = minetest_find_nodes_in_area
|
||||||
|
local fun_2 = minetest.find_nodes_in_area
|
||||||
|
for x = -31000, 31000, 15500 do
|
||||||
|
for y = -31000, 31000, 15500 do
|
||||||
|
for z = -31000, 31000, 15500 do
|
||||||
|
for d = 1, 9, 3 do
|
||||||
|
local minp = { x=x, y=y, z=z }
|
||||||
|
local maxp = { x=x+d, y=y+d, z=z+d }
|
||||||
|
minetest.emerge_area(
|
||||||
|
minp,
|
||||||
|
maxp,
|
||||||
|
function(blockpos, action, calls_remaining)
|
||||||
|
local npos_1, nnum_1 = fun_1(
|
||||||
|
minp,
|
||||||
|
maxp,
|
||||||
|
{ "air", "ignore" }
|
||||||
|
)
|
||||||
|
local npos_2, nnum_2 = fun_2(
|
||||||
|
minp,
|
||||||
|
maxp,
|
||||||
|
{ "air", "ignore" }
|
||||||
|
)
|
||||||
|
assert(
|
||||||
|
deep_compare(
|
||||||
|
npos_1,
|
||||||
|
npos_2
|
||||||
|
) == true
|
||||||
|
)
|
||||||
|
assert(
|
||||||
|
deep_compare(
|
||||||
|
nnum_1,
|
||||||
|
nnum_2
|
||||||
|
) == true
|
||||||
|
)
|
||||||
|
local ntab_1 = fun_1(
|
||||||
|
minp,
|
||||||
|
maxp,
|
||||||
|
{ "air", "ignore" },
|
||||||
|
true
|
||||||
|
)
|
||||||
|
local ntab_2 = fun_2(
|
||||||
|
minp,
|
||||||
|
maxp,
|
||||||
|
{ "air", "ignore" },
|
||||||
|
true
|
||||||
|
)
|
||||||
|
assert(
|
||||||
|
deep_compare(
|
||||||
|
ntab_1,
|
||||||
|
ntab_2
|
||||||
|
) == true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.after( 0, test_minetest_find_nodes_in_area_implementation_equivalence )
|
|
@ -0,0 +1,121 @@
|
||||||
|
local test_minetest_find_nodes_in_area_can_count = function(dtime)
|
||||||
|
-- This function tests that minetest.find_nodes_in_area() can
|
||||||
|
-- count nodes correctly. If it fails, the engine can not be
|
||||||
|
-- trusted to actually count how many nodes of a given type
|
||||||
|
-- are in a given volume. Yes, *it* is bad if that happens.
|
||||||
|
--
|
||||||
|
-- If you are looking at this function because it executes at
|
||||||
|
-- startup and crashes the game, by far the most stupid thing
|
||||||
|
-- you could do is disabling it. Only an absolute moron would
|
||||||
|
-- disable tests that ensure basic functionality still works.
|
||||||
|
--
|
||||||
|
-- Experience has taught me that such warnings are mostly not
|
||||||
|
-- taken seriously by both Minetest mod & core developers. As
|
||||||
|
-- there are very few situations in which someone would read
|
||||||
|
-- the code of the function without a crash, you are probably
|
||||||
|
-- asking yourself how bad it can be. Surely you will want an
|
||||||
|
-- example of what will break if this test breaks. The answer
|
||||||
|
-- to this simple question is equally simple and consists of a
|
||||||
|
-- heartfelt “What the fuck did you say, you stupid fuckwad?”.
|
||||||
|
--
|
||||||
|
-- Alrighty then, let's get it on …
|
||||||
|
|
||||||
|
local pos = { x=30999, y=30999, z=30999 }
|
||||||
|
-- You think there is nothing there? Well, here is the thing:
|
||||||
|
-- With standard settings you can only see map until x=30927,
|
||||||
|
-- although the renderer can actually render up to x=31007 if
|
||||||
|
-- you configure it to. Any statements given by minetest core
|
||||||
|
-- devs that contradict the above assertion are probably lies.
|
||||||
|
--
|
||||||
|
-- In any way, this area should be so far out that no one has
|
||||||
|
-- built here … yet. Now that you know it is possible, I know
|
||||||
|
-- you want to. How though? I suggest to figure the technique
|
||||||
|
-- out yourself, then go on and build invisible lag machines.
|
||||||
|
|
||||||
|
local radius = 3
|
||||||
|
local minp = vector.subtract(pos, radius)
|
||||||
|
local maxp = vector.add(pos, radius)
|
||||||
|
local nodename = "air"
|
||||||
|
local c_nodename = minetest.get_content_id(nodename)
|
||||||
|
|
||||||
|
-- Why not use minetest.set_node() here? Well, some mods do
|
||||||
|
-- trigger on every placement of a node in the entire map …
|
||||||
|
-- and we do not want to crash those mods in this test case.
|
||||||
|
-- (Voxelmanip does not trigger callbacks – so all is well.)
|
||||||
|
--
|
||||||
|
-- And now for a funny story: I initially copied the following
|
||||||
|
-- code from the Minetest developer wiki. Can you spot a typo?
|
||||||
|
-- <https://dev.minetest.net/index.php?title=minetest.get_content_id&action=edit>
|
||||||
|
local vm = minetest.get_voxel_manip()
|
||||||
|
local emin, emax = vm:read_from_map(
|
||||||
|
minp,
|
||||||
|
maxp
|
||||||
|
)
|
||||||
|
local area = VoxelArea:new({
|
||||||
|
MinEdge=emin,
|
||||||
|
MaxEdge=emax
|
||||||
|
})
|
||||||
|
local data = vm:get_data()
|
||||||
|
for z = minp.z, maxp.z do
|
||||||
|
for y = minp.y, maxp.y do
|
||||||
|
local vi = area:index(minp.x, y, z)
|
||||||
|
for x = minp.x, maxp.y do
|
||||||
|
data[vi] = c_nodename
|
||||||
|
vi = vi + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vm:set_data(data)
|
||||||
|
vm:write_to_map()
|
||||||
|
local npos, nnum = minetest.find_nodes_in_area(
|
||||||
|
minp,
|
||||||
|
maxp,
|
||||||
|
{ nodename }
|
||||||
|
)
|
||||||
|
local nodes_expected = math.pow( 1 + (2 * radius), 3 )
|
||||||
|
local nodes_counted = nnum[nodename]
|
||||||
|
local nodes_difference = nodes_expected - nodes_counted
|
||||||
|
-- Originally, there was an assertion here that made the game
|
||||||
|
-- crash at startup if Minetest forgot how to count. This was
|
||||||
|
-- originally intended to avoid buggy engine releases, but it
|
||||||
|
-- mostly made people upset and hindered debugging. Also, the
|
||||||
|
-- assertion contained no error message hinting at the reason
|
||||||
|
-- for the crash, making it exceptionally user-unfriendly. It
|
||||||
|
-- follows that a game or mod should only assert on behaviour
|
||||||
|
-- of the Lua code, not the underlying implementation, unless
|
||||||
|
-- engine bugs are bad enough to permanently corrupt a world.
|
||||||
|
if ( 0 ~= nodes_difference ) then
|
||||||
|
minetest.debug(
|
||||||
|
"minetest.find_nodes_in_area() failed to find " ..
|
||||||
|
nodes_difference .. " nodes that were placed. " ..
|
||||||
|
"Downgrading to Minetest 5.4.1 might fix this."
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.after( 0, test_minetest_find_nodes_in_area_can_count )
|
||||||
|
|
||||||
|
local test_minetest_find_nodes_in_area_crash = function(dtime)
|
||||||
|
-- And now for our feature presentation, where we call the
|
||||||
|
-- function “minetest.find_nodes_in_area()” with a position
|
||||||
|
-- out of bounds! Will it crash? Who knows‽ If it does, the
|
||||||
|
-- workaround is not working though, so it should be patched.
|
||||||
|
|
||||||
|
local pos = { x=32767, y=32767, z=32767 }
|
||||||
|
-- Note that not all out of bounds values actually crash the
|
||||||
|
-- function minetest.find_nodes_in_area()“. In fact, the vast
|
||||||
|
-- majority of out of bounds values do not crash the function.
|
||||||
|
|
||||||
|
local radius = 3
|
||||||
|
local minp = vector.subtract(pos, radius)
|
||||||
|
local maxp = vector.add(pos, radius)
|
||||||
|
local nodename = "air"
|
||||||
|
local npos, nnum = minetest.find_nodes_in_area(
|
||||||
|
minp,
|
||||||
|
maxp,
|
||||||
|
{ nodename }
|
||||||
|
)
|
||||||
|
-- That's all, folks!
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.after( 0, test_minetest_find_nodes_in_area_crash )
|
|
@ -19,8 +19,114 @@ end
|
||||||
|
|
||||||
local pitch, name, node_stand, node_stand_below, node_head, node_feet, pos
|
local pitch, name, node_stand, node_stand_below, node_head, node_feet, pos
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
local function roundN(n, d)
|
||||||
|
if type(n) ~= "number" then return n end
|
||||||
|
local m = 10^d
|
||||||
|
return math.floor(n * m + 0.5) / m
|
||||||
|
end
|
||||||
|
|
||||||
|
local function close_enough(a,b)
|
||||||
|
local rt=true
|
||||||
|
if type(a) == "table" and type(b) == "table" then
|
||||||
|
for k,v in pairs(a) do
|
||||||
|
if roundN(v,2) ~= roundN(b[k],2) then
|
||||||
|
rt=false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
rt = roundN(a,2) == roundN(b,2)
|
||||||
|
end
|
||||||
|
return rt
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local function props_changed(props,oldprops)
|
||||||
|
local changed=false
|
||||||
|
local p={}
|
||||||
|
for k,v in pairs(props) do
|
||||||
|
if not close_enough(v,oldprops[k]) then
|
||||||
|
p[k]=v
|
||||||
|
changed=true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return changed,p
|
||||||
|
end
|
||||||
|
|
||||||
|
--test if assert works
|
||||||
|
assert(true)
|
||||||
|
assert(not false)
|
||||||
|
|
||||||
|
--test data for == and ~=
|
||||||
|
local test_equal1=42
|
||||||
|
local test_equal2=42.0
|
||||||
|
local test_equal3=42.1
|
||||||
|
|
||||||
|
assert(test_equal1==test_equal1)
|
||||||
|
assert(test_equal1==test_equal2)
|
||||||
|
assert(test_equal1~=test_equal3)
|
||||||
|
|
||||||
|
--testdata for roundN
|
||||||
|
local test_round1=15
|
||||||
|
local test_round2=15.00199999999
|
||||||
|
local test_round3=15.00111111
|
||||||
|
local test_round4=15.00999999
|
||||||
|
|
||||||
|
assert(roundN(test_round1,2)==roundN(test_round1,2)) --test again if basic equality works because wth not
|
||||||
|
assert(roundN(test_round1,2)==roundN(test_round2,2))
|
||||||
|
assert(roundN(test_round1,2)==roundN(test_round3,2))
|
||||||
|
assert(roundN(test_round1,2)~=roundN(test_round4,2))
|
||||||
|
|
||||||
|
|
||||||
|
-- tests for close_enough
|
||||||
|
local test_cb = {-0.35,0,-0.35,0.35,0.8,0.35} --collisionboxes
|
||||||
|
local test_cb_close = {-0.351213,0,-0.35,0.35,0.8,0.351212}
|
||||||
|
local test_cb_diff = {-0.35,0,-1.35,0.35,0.8,0.35}
|
||||||
|
|
||||||
|
local test_eh = 1.65 --eye height
|
||||||
|
local test_eh_close = 1.65123123
|
||||||
|
local test_eh_diff = 1.35
|
||||||
|
|
||||||
|
local test_nt = { r = 225, b = 225, a = 225, g = 225 } --nametag
|
||||||
|
local test_nt_diff = { r = 225, b = 225, a = 0, g = 225 }
|
||||||
|
|
||||||
|
assert(close_enough(test_cb,test_cb_close))
|
||||||
|
assert(not close_enough(test_cb,test_cb_diff))
|
||||||
|
|
||||||
|
assert(close_enough(test_eh,test_eh_close))
|
||||||
|
assert(not close_enough(test_eh,test_eh_diff))
|
||||||
|
|
||||||
|
assert(not close_enough(test_nt,test_nt_diff)) --no floats involved here
|
||||||
|
|
||||||
|
--tests for props_changed
|
||||||
|
local test_properties_set1={collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }}
|
||||||
|
local test_properties_set2={collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 225, g = 225 }}
|
||||||
|
|
||||||
|
local test_p1,p=props_changed(test_properties_set1,test_properties_set1)
|
||||||
|
local test_p2,p=props_changed(test_properties_set1,test_properties_set2)
|
||||||
|
|
||||||
|
assert(not test_p1)
|
||||||
|
assert(test_p2)
|
||||||
|
|
||||||
|
-- we still don't really know if lua is lying to us! but at least everything *seems* to be ok
|
||||||
|
|
||||||
|
local function set_properties_conditional(player,props)
|
||||||
|
local changed,p=props_changed(props,player:get_properties())
|
||||||
|
if changed then
|
||||||
|
player:set_properties(p)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function set_bone_position_conditional(player,b,p,r) --bone,position,rotation
|
||||||
|
local oldp,oldr=player:get_bone_position(b)
|
||||||
|
if vector.equals(vector.round(oldp),vector.round(p)) and vector.equals(vector.round(oldr),vector.round(r)) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
player:set_bone_position(b,p,r)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
time = time + dtime
|
time = time + dtime
|
||||||
|
|
||||||
-- Update jump status immediately since we need this info in real time.
|
-- Update jump status immediately since we need this info in real time.
|
||||||
|
@ -45,55 +151,55 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
-- controls right and left arms pitch when shooting a bow or punching
|
-- controls right and left arms pitch when shooting a bow or punching
|
||||||
if string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and not controls.LMB and not controls.up and not controls.down and not controls.left and not controls.right then
|
if string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and not controls.LMB and not controls.up and not controls.down and not controls.left and not controls.right then
|
||||||
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
|
set_bone_position_conditional(player,"Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
|
||||||
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35))
|
set_bone_position_conditional(player,"Arm_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35))
|
||||||
elseif controls.LMB and player:get_attach() == nil then
|
elseif controls.LMB and player:get_attach() == nil then
|
||||||
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch,0,0))
|
set_bone_position_conditional(player,"Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch,0,0))
|
||||||
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
|
set_bone_position_conditional(player,"Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
|
||||||
else
|
else
|
||||||
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
|
set_bone_position_conditional(player,"Arm_Left_Pitch_Control", vector.new(3,5.785,0), vector.new(0,0,0))
|
||||||
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(0,0,0))
|
set_bone_position_conditional(player,"Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(0,0,0))
|
||||||
end
|
end
|
||||||
|
|
||||||
if controls.sneak and player:get_attach() == nil then
|
if controls.sneak and player:get_attach() == nil then
|
||||||
-- controls head pitch when sneaking
|
-- controls head pitch when sneaking
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+36,0,0))
|
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch+36,0,0))
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }})
|
set_properties_conditional(player,{collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }})
|
||||||
-- sneaking body conrols
|
-- sneaking body conrols
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
elseif minetest.get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and player:get_attach() == nil and mcl_sprint.is_sprinting(name) == true then
|
elseif minetest.get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and player:get_attach() == nil and mcl_sprint.is_sprinting(name) == true then
|
||||||
-- set head pitch and yaw when swimming
|
-- set head pitch and yaw when swimming
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),yaw - player_vel_yaw * -1,0))
|
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),yaw - player_vel_yaw * -1,0))
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
set_properties_conditional(player,{collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
-- control body bone when swimming
|
-- control body bone when swimming
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(degrees(dir_to_pitch(player_velocity)) - 90,player_vel_yaw * -1 - yaw + 180,0))
|
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(degrees(dir_to_pitch(player_velocity)) - 90,player_vel_yaw * -1 - yaw + 180,0))
|
||||||
|
|
||||||
elseif player:get_attach() == nil then
|
elseif player:get_attach() == nil then
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
set_properties_conditional(player,{collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
|
|
||||||
if player_velocity.x > 0.35 or player_velocity.z > 0.35 or player_velocity.x < -0.35 or player_velocity.z < -0.35 then
|
if player_velocity.x > 0.35 or player_velocity.z > 0.35 or player_velocity.x < -0.35 or player_velocity.z < -0.35 then
|
||||||
if player_vel_yaw * -1 - yaw < 90 or player_vel_yaw * -1 - yaw > 270 then
|
if player_vel_yaw * -1 - yaw < 90 or player_vel_yaw * -1 - yaw > 270 then
|
||||||
-- controls head and Body_Control bones while moving backwards
|
-- controls head and Body_Control bones while moving backwards
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1,0))
|
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1,0))
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw,0))
|
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw,0))
|
||||||
else
|
else
|
||||||
-- controls head and Body_Control bones while moving forwards
|
-- controls head and Body_Control bones while moving forwards
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1 + 180,0))
|
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1 + 180,0))
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw + 180,0))
|
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0,player_vel_yaw * -1 - yaw + 180,0))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,0,0))
|
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch,0,0))
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local attached = player:get_attach(parent)
|
local attached = player:get_attach(parent)
|
||||||
local attached_yaw = degrees(attached:get_yaw())
|
local attached_yaw = degrees(attached:get_yaw())
|
||||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
set_properties_conditional(player,{collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,degrees(player:get_look_horizontal()) * -1 + attached_yaw,0))
|
set_bone_position_conditional(player,"Head", vector.new(0,6.3,0), vector.new(pitch,degrees(player:get_look_horizontal()) * -1 + attached_yaw,0))
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
end
|
end
|
||||||
|
|
||||||
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
||||||
|
|
|
@ -91,6 +91,11 @@ flame_sound (Flame sound) bool true
|
||||||
# Form: Image height / Image width
|
# Form: Image height / Image width
|
||||||
fire_animation_frames (Fire Animation Frames) int 8
|
fire_animation_frames (Fire Animation Frames) int 8
|
||||||
|
|
||||||
|
# How long to wait between frames of the fire animation in frames per second.
|
||||||
|
# A higher number means it looks better but also results in a lot of additional network traffic. A low single digit value is recommended for multiplayer.
|
||||||
|
#(default: 30)
|
||||||
|
fire_animation_fps (Fire Animation FPS) int 30 0 60
|
||||||
|
|
||||||
# Whether to animate chests when open / close
|
# Whether to animate chests when open / close
|
||||||
animated_chests (Animated chests) bool true
|
animated_chests (Animated chests) bool true
|
||||||
|
|
||||||
|
|