0
0
Fork 0

Merge branch 'master' into buckets

This commit is contained in:
AFCMS 2021-05-23 16:22:53 +02:00
commit 91ac70cf28
110 changed files with 1295 additions and 1313 deletions

View File

@ -40,4 +40,13 @@ read_globals = {
"factorial"
}
},
------
--MODS
------
--GENERAL
"default",
--HUD
"sfinv", "sfinv_buttons", "unified_inventory", "cmsg", "inventory_plus",
}

View File

@ -4,9 +4,11 @@ dofile(minetest.get_modpath(minetest.get_current_modname()).."/paintings.lua")
local S = minetest.get_translator("mcl_paintings")
local math = math
local wood = "[combine:16x16:-192,0=mcl_paintings_paintings.png"
local is_protected = function(pos, name)
local function is_protected(pos, name)
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return true
@ -17,7 +19,7 @@ end
-- Check if there's a painting for provided painting size.
-- If yes, returns the arguments.
-- If not, returns the next smaller available painting.
local shrink_painting = function(x, y)
local function shrink_painting(x, y)
if x > 4 or y > 4 then
return nil
end
@ -43,7 +45,7 @@ local shrink_painting = function(x, y)
end
end
local get_painting = function(x, y, motive)
local function get_painting(x, y, motive)
local painting = mcl_paintings.paintings[y] and mcl_paintings.paintings[y][x] and mcl_paintings.paintings[y][x][motive]
if not painting then
return nil
@ -53,7 +55,7 @@ local get_painting = function(x, y, motive)
return "[combine:"..sx.."x"..sy..":"..px..","..py.."=mcl_paintings_paintings.png"
end
local get_random_painting = function(x, y)
local function get_random_painting(x, y)
if not mcl_paintings.paintings[y] or not mcl_paintings.paintings[y][x] then
return nil
end
@ -65,7 +67,7 @@ local get_random_painting = function(x, y)
return get_painting(x, y, r), r
end
local size_to_minmax = function(size)
--[[local function size_to_minmax(size)
local min, max
if size == 2 then
min = -0.5
@ -81,13 +83,13 @@ local size_to_minmax = function(size)
max = 0.5
end
return min, max
end
end]]
local size_to_minmax_entity = function(size)
local function size_to_minmax_entity(size)
return -size/2, size/2
end
local set_entity = function(object)
local function set_entity(object)
local ent = object:get_luaentity()
local wallm = ent._facing
local xsize = ent._xsize
@ -169,7 +171,7 @@ minetest.register_entity("mcl_paintings:painting", {
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
-- Drop as item on punch
if puncher and puncher:is_player() then
kname = puncher:get_player_name()
local kname = puncher:get_player_name()
local pos = self._pos
if not pos then
pos = self.object:get_pos()

View File

@ -83,7 +83,7 @@ mobs_mc.items = {
water_source = "default:water_source",
water_flowing = "default:water_flowing",
river_water_source = "default:river_water_source",
water_flowing = "default:river_water_flowing",
--water_flowing = "default:river_water_flowing",
black_dye = "dye:black",
poppy = "flowers:rose",
dandelion = "flowers:dandelion_yellow",
@ -128,7 +128,6 @@ mobs_mc.items = {
nether_portal = "nether:portal",
netherrack = "nether:rack",
nether_brick_block = "nether:brick",
-- Wool (Minecraft color scheme)
wool_white = "wool:white",

View File

@ -6,7 +6,7 @@
-- NOTE: Strings intentionally not marked for translation, other mods already have these items.
-- TODO: Remove this file eventually, all items here are already outsourced in other mods.
local S = minetest.get_translator("mobs_mc")
--local S = minetest.get_translator("mobs_mc")
--maikerumines throwing code
--arrow (weapon)

View File

@ -3,8 +3,9 @@
-- NOTE: Strings intentionally not marked for translation, other mods already have these items.
-- TODO: Remove this file eventually, all items here are already outsourced in other mods.
-- TODO: Add translation.
local S = minetest.get_translator("mobs_mc")
--local S = minetest.get_translator("mobs_mc")
-- Heads system

View File

@ -20,7 +20,7 @@ mobs:register_mob("mobs_mc:blaze", {
xp_max = 10,
tilt_fly = false,
hostile = true,
rotate = 270,
--rotate = 270,
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.79, 0.3},
rotate = -180,
visual = "mesh",

View File

@ -24,7 +24,6 @@ mobs:register_mob("mobs_mc:enderdragon", {
xp_max = 500,
collisionbox = {-2, 0, -2, 2, 2, 2},
eye_height = 1,
physical = false,
visual = "mesh",
mesh = "mobs_mc_dragon.b3d",
textures = {
@ -60,8 +59,6 @@ mobs:register_mob("mobs_mc:enderdragon", {
arrow = "mobs_mc:dragon_fireball",
shoot_interval = 0.5,
shoot_offset = -1.0,
xp_min = 500,
xp_max = 500,
animation = {
fly_speed = 8, stand_speed = 8,
stand_start = 0, stand_end = 20,
@ -114,8 +111,8 @@ mobs:register_mob("mobs_mc:enderdragon", {
fire_resistant = true,
})
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
--TODO: replace this setting by a proper gamerules system
local mobs_griefing = minetest.settings:get_bool("mobs_griefing", true)
-- dragon fireball (projectile)
mobs:register_arrow("mobs_mc:dragon_fireball", {
@ -143,8 +140,10 @@ mobs:register_arrow("mobs_mc:dragon_fireball", {
-- node hit, explode
hit_node = function(self, pos, node)
--mobs:boom(self, pos, 2)
if mobs_griefing then
mcl_explosions.explode(self.object:get_pos(), 2, { drop_chance = 1.0 })
end
end
})
mobs:register_egg("mobs_mc:enderdragon", S("Ender Dragon"), "mobs_mc_spawn_icon_dragon.png", 0, true)

View File

@ -318,12 +318,12 @@ mobs:register_mob("mobs_mc:enderman", {
for n = 1, #objs do
local obj = objs[n]
if obj then
if minetest.is_player(obj) then
--if minetest.is_player(obj) then
-- Warp from players during day.
--if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then
-- self:teleport(nil)
--end
else
if not obj:is_player() then
local lua = obj:get_luaentity()
if lua then
if lua.name == "mcl_bows:arrow_entity" or lua.name == "mcl_throwing:snowball_entity" then

View File

@ -94,7 +94,6 @@ mobs:register_mob("mobs_mc:guardian", {
makes_footstep_sound = false,
fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source },
jump = false,
view_range = 16,
})
-- Spawning disabled due to size issues

View File

@ -104,7 +104,6 @@ mobs:register_mob("mobs_mc:guardian_elder", {
makes_footstep_sound = false,
fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source },
jump = false,
view_range = 16,
})
-- Spawning disabled due to size issues <- what do you mean? -j4i

View File

@ -38,9 +38,9 @@ end
local can_equip_horse_armor = function(entity_id)
return entity_id == "mobs_mc:horse" or entity_id == "mobs_mc:skeleton_horse" or entity_id == "mobs_mc:zombie_horse"
end
local can_equip_chest = function(entity_id)
--[[local can_equip_chest = function(entity_id)
return entity_id == "mobs_mc:mule" or entity_id == "mobs_mc:donkey"
end
end]]
local can_breed = function(entity_id)
return entity_id == "mobs_mc:horse" or "mobs_mc:mule" or entity_id == "mobs_mc:donkey"
end
@ -314,7 +314,7 @@ local horse = {
-- Make sure tamed horse is mature and being clicked by owner only
if self.tamed and not self.child and self.owner == clicker:get_player_name() then
local inv = clicker:get_inventory()
--local inv = clicker:get_inventory()
-- detatch player already riding horse
if self.driver and clicker == self.driver then

View File

@ -307,9 +307,9 @@ mobs:register_arrow("mobs_mc:spit", {
tail_distance_divider = 4,
hit_player = function(self, player)
if rawget(_G, "armor") and armor.last_damage_types then
--[[if rawget(_G, "armor") and armor.last_damage_types then
armor.last_damage_types[player:get_player_name()] = "spit"
end
end]]
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = self._damage},
@ -319,7 +319,7 @@ mobs:register_arrow("mobs_mc:spit", {
hit_mob = function(self, mob)
mob:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = _damage},
damage_groups = {fleshy = self._damage},
}, nil)
end,

View File

@ -151,7 +151,7 @@ end
mobs:register_mob("mobs_mc:cat", cat)
local base_spawn_chance = 5000
--local base_spawn_chance = 5000
-- Spawn ocelot
--they get the same as the llama because I'm trying to rework so much of this code right now -j4i

View File

@ -163,7 +163,7 @@ mobs:register_mob("mobs_mc:pig", {
end
-- Mount or detach player
local name = clicker:get_player_name()
--local name = clicker:get_player_name()
if self.driver and clicker == self.driver then
-- Detach if already attached
mobs.detach(clicker, {x=1, y=0, z=0})

View File

@ -150,7 +150,6 @@ mobs:register_mob("mobs_mc:sheep", {
do_custom = function(self, dtime)
if not self.initial_color_set then
local r = math.random(0,100000)
local textures
if r <= 81836 then
-- 81.836%
self.color = "unicolor_white"

View File

@ -46,7 +46,6 @@ mobs:register_mob("mobs_mc:silverfish", {
view_range = 16,
attack_type = "punch",
damage = 1,
reach = 1,
})
mobs:register_egg("mobs_mc:silverfish", S("Silverfish"), "mobs_mc_spawn_icon_silverfish.png", 0)

View File

@ -31,10 +31,6 @@ local skeleton = {
group_attack = true,
visual = "mesh",
mesh = "mobs_mc_skeleton.b3d",
textures = { {
"mcl_bows_bow_0.png", -- bow
"mobs_mc_skeleton.png", -- skeleton
} },
--head code
has_head = false,

View File

@ -15,7 +15,7 @@ mobs:register_mob("mobs_mc:vex", {
spawn_class = "hostile",
pathfinding = 1,
passive = false,
attack_type = "punch",
attack_type = "dogfight",
physical = false,
hp_min = 14,
hp_max = 14,
@ -36,7 +36,6 @@ mobs:register_mob("mobs_mc:vex", {
view_range = 16,
walk_velocity = 3.2,
run_velocity = 5.9,
attack_type = "dogfight",
sounds = {
-- TODO: random
death = "mobs_mc_vex_death",

View File

@ -26,7 +26,6 @@ mobs:register_mob("mobs_mc:wither", {
{"mobs_mc_wither.png"},
},
visual_size = {x=4, y=4},
makes_footstep_sound = true,
view_range = 16,
fear_height = 4,
walk_velocity = 2,
@ -81,7 +80,7 @@ mobs:register_mob("mobs_mc:wither", {
end,
})
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
--local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
mobs:register_arrow("mobs_mc:wither_skull", {
visual = "sprite",

View File

@ -186,7 +186,7 @@ dog.on_rightclick = function(self, clicker)
if is_food(item:get_name()) then
-- Feed to increase health
local hp = self.health
local hp_add = 0
local hp_add
-- Use eatable group to determine health boost
local eatable = minetest.get_item_group(item, "eatable")
if eatable > 0 then

View File

@ -200,14 +200,14 @@ end
mobs_mc.override.enderman_block_texture_overrides = {
["mcl_core:cactus"] = ctable,
-- FIXME: replace colorize colors with colors from palette
["mcl_core:dirt_with_grass"] =
{
["mcl_core:dirt_with_grass"] = {
"mcl_core_grass_block_top.png^[colorize:green:90",
"default_dirt.png",
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)",
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)",
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)",
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)"}
"default_dirt.png^(mcl_core_grass_block_side_overlay.png^[colorize:green:90)",
},
}
-- List of nodes on which mobs can spawn

View File

@ -134,6 +134,7 @@ lightning.strike = function(pos)
sound_play({ name = "lightning_thunder", gain = 10 }, { pos = pos, max_hear_distance = 500 }, true)
-- damage nearby objects, transform mobs
-- TODO: use an API insteed of hardcoding this behaviour
local objs = get_objects_inside_radius(pos2, 3.5)
for o=1, #objs do
local obj = objs[o]
@ -153,7 +154,7 @@ lightning.strike = function(pos)
end
obj:set_properties({textures = lua.base_texture})
-- villager → witch (no damage)
elseif lua and lua.name == "mobs_mc:villager" then
--elseif lua and lua.name == "mobs_mc:villager" then
-- Witches are incomplete, this code is unused
-- TODO: Enable this code when witches are working.
--[[

View File

@ -4,11 +4,9 @@ local SHEET_W = 4
local SHEET_H = 2
-- Randomize initial moon phase, based on map seed
local phase_offset
local mg_seed = minetest.get_mapgen_setting("seed")
local rand = PseudoRandom(mg_seed)
local phase_offset = rand:next(0, MOON_PHASES - 1)
rand = nil
minetest.log("info", "[mcl_moon] Moon phase offset of this world: "..phase_offset)

View File

@ -1,5 +1,5 @@
local S = minetest.get_translator("mcl_void_damage")
local enable_damage = minetest.settings:get_bool("enable_damage")
--local enable_damage = minetest.settings:get_bool("enable_damage")
local pos_to_dim = mcl_worlds.pos_to_dimension
local dim_change = mcl_worlds.dimension_change
@ -39,9 +39,9 @@ minetest.register_on_mods_loaded(function()
end
self._void_timer = 0
local void, void_deadly = is_in_void(pos)
local _, void_deadly = is_in_void(pos)
if void_deadly then
local ent = obj:get_luaentity()
--local ent = obj:get_luaentity()
obj:remove()
return
end
@ -61,7 +61,7 @@ minetest.register_globalstep(function(dtime)
for p=1, #players do
local player = players[p]
local pos = player:get_pos()
local void, void_deadly = is_in_void(pos)
local _, void_deadly = is_in_void(pos)
if void_deadly then
local immortal_val = player:get_armor_groups().immortal
local is_immortal = false

View File

@ -205,8 +205,8 @@ mcl_weather.skycolor = {
-- Returns first player sky color. I assume that all players are in same color layout.
get_current_bg_color = function()
local players = mcl_weather.skycolor.utils.get_players(nil)
for _, player in ipairs(players) do
return player:get_sky()
if players[1] then
return players[1]:get_sky()
end
return nil
end

View File

@ -9,8 +9,8 @@ mcl_weather.snow.init_done = false
mcl_weather.snow.add_snow_particles = function(player)
mcl_weather.rain.last_rp_count = 0
for i=mcl_weather.snow.particles_count, 1,-1 do
local random_pos_x, random_pos_y, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player)
random_pos_y = math.random() + math.random(player:get_pos().y - 1, player:get_pos().y + 7)
local random_pos_x, _, random_pos_z = mcl_weather.get_random_pos_by_player_look_dir(player)
local random_pos_y = math.random() + math.random(player:get_pos().y - 1, player:get_pos().y + 7)
if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == 15 then
mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1
minetest.add_particle({
@ -45,13 +45,13 @@ mcl_weather.snow.set_sky_box = function()
mcl_weather.skycolor.active = true
end
mcl_weather.snow.clear = function()
function mcl_weather.snow.clear()
mcl_weather.skycolor.remove_layer("weather-pack-snow-sky")
mcl_weather.snow.init_done = false
end
-- Simple random texture getter
mcl_weather.snow.get_texture = function()
function mcl_weather.snow.get_texture()
return "weather_pack_snow_snowflake"..math.random(1,2)..".png"
end

View File

@ -19,29 +19,27 @@ minetest.register_globalstep(function(dtime)
mcl_weather.rain.make_weather()
if mcl_weather.thunder.init_done == false then
mcl_weather.skycolor.add_layer(
"weather-pack-thunder-sky",
{{r=0, g=0, b=0},
mcl_weather.skycolor.add_layer("weather-pack-thunder-sky", {
{r=0, g=0, b=0},
{r=40, g=40, b=40},
{r=85, g=86, b=86},
{r=40, g=40, b=40},
{r=0, g=0, b=0}})
{r=0, g=0, b=0},
})
mcl_weather.skycolor.active = true
for _, player in pairs(get_connected_players()) do
player:set_clouds({color="#3D3D3FE8"})
end
mcl_weather.thunder.init_done = true
end
if (mcl_weather.thunder.next_strike <= minetest.get_gametime()) then
lightning.strike()
local delay = math.random(mcl_weather.thunder.min_delay, mcl_weather.thunder.max_delay)
mcl_weather.thunder.next_strike = minetest.get_gametime() + delay
end
end)
mcl_weather.thunder.clear = function()
function mcl_weather.thunder.clear()
mcl_weather.rain.clear()
mcl_weather.skycolor.remove_layer("weather-pack-thunder-sky")
mcl_weather.skycolor.remove_layer("lightning")
@ -58,6 +56,6 @@ if mcl_weather.reg_weathers.thunder == nil then
max_duration = 1200,
transitions = {
[100] = "rain",
}
},
}
end

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("mcl_weather")
local math = math
-- weather states, 'none' is default, other states depends from active mods
mcl_weather.state = "none"
@ -96,9 +98,7 @@ mcl_weather.get_random_pos_by_player_look_dir = function(player)
local look_dir = player:get_look_dir()
local player_pos = player:get_pos()
local random_pos_x = 0
local random_pos_y = 0
local random_pos_z = 0
local random_pos_x, random_pos_y, random_pos_z
if look_dir.x > 0 then
if look_dir.z > 0 then

View File

@ -233,7 +233,7 @@ end
-- Returns true if the specified entry has been viewed by the player
function doc.entry_viewed(playername, category_id, entry_id)
local entry, category_id, entry_id = get_entry(category_id, entry_id)
local _, category_id, entry_id = get_entry(category_id, entry_id)
if doc.data.players[playername].stored_data.viewed[category_id] == nil then
return false
else
@ -243,7 +243,7 @@ end
-- Returns true if the specified entry is hidden from the player
function doc.entry_revealed(playername, category_id, entry_id)
local entry, category_id, entry_id = get_entry(category_id, entry_id)
local _, category_id, entry_id = get_entry(category_id, entry_id)
local hidden = doc.data.categories[category_id].entries[entry_id].hidden
if doc.data.players[playername].stored_data.revealed[category_id] == nil then
return not hidden
@ -302,7 +302,7 @@ function doc.show_entry(playername, category_id, entry_id, ignore_hidden)
minetest.show_formspec(playername, "doc:error_no_categories", doc.formspec_error_no_categories())
return
end
local entry, category_id, entry_id = get_entry(category_id, entry_id)
local _, category_id, entry_id = get_entry(category_id, entry_id)
if ignore_hidden or doc.entry_revealed(playername, category_id, entry_id) then
local playerdata = doc.data.players[playername]
playerdata.category = category_id
@ -587,8 +587,6 @@ doc.widgets.gallery = function(imagedata, playername, x, y, aspect_ratio, width,
formstring = formstring .. "label["..nx..","..ny..";"..i.."]"
pos = pos + 1
end
local bw, bh
return formstring, ih
end

View File

@ -164,7 +164,7 @@ local factoid_toolcaps = function(tool_capabilities, check_uses)
local useslines = 0
for k,v in pairs(groupcaps) do
-- Mining capabilities
local minrating, maxrating
--[[local minrating, maxrating
if v.times then
for rating, time in pairs(v.times) do
if minrating == nil then minrating = rating else
@ -177,7 +177,7 @@ local factoid_toolcaps = function(tool_capabilities, check_uses)
else
minrating = 1
maxrating = 1
end
end]]
local maxlevel = v.maxlevel
if not maxlevel then
-- Default from tool.h
@ -577,11 +577,8 @@ doc.add_category("nodes", {
description = S("Item reference of blocks and other things which are capable of occupying space"),
build_formspec = function(data, playername)
if data then
local formstring = ""
local datastring = ""
formstring = entry_image(data)
datastring = factoids_header(data, "nodes")
local formstring = entry_image(data)
local datastring = factoids_header(data, "nodes")
local liquid = data.def.liquidtype ~= "none" and minetest.get_item_group(data.itemstring, "fake_liquid") == 0
if not forbidden_core_factoids.basics then
@ -834,7 +831,7 @@ doc.add_category("nodes", {
elseif type(data.def.drop) == "table" and data.def.drop.items ~= nil then
local max = data.def.drop.max_items
local dropstring = ""
local dropstring_base = ""
local dropstring_base
if max == nil then
dropstring_base = N("This block will drop the following items when mined: @1.")
elseif max == 1 then
@ -852,7 +849,7 @@ doc.add_category("nodes", {
local rarity_history = {}
for i=1,#data.def.drop.items do
local local_rarity = data.def.drop.items[i].rarity
local chance = 1
local chance
local rarity = 1
if local_rarity == nil then
local_rarity = 1
@ -937,7 +934,6 @@ doc.add_category("nodes", {
end
local rarity = probtable.rarity
local raritystring = ""
-- No percentage if there's only one possible guaranteed drop
if not(rarity == 1 and #data.def.drop.items == 1) then
local chance = (1/rarity)*100
@ -1086,11 +1082,8 @@ doc.add_category("tools", {
end,
build_formspec = function(data, playername)
if data then
local formstring = ""
local datastring = ""
formstring = entry_image(data)
datastring = factoids_header(data, "tools")
local formstring = entry_image(data)
local datastring = factoids_header(data, "tools")
-- Overwritten durability info
if type(data.def._doc_items_durability) == "number" then
@ -1120,11 +1113,8 @@ doc.add_category("craftitems", {
description = S("Item reference of items which are neither blocks, tools or weapons (esp. crafting items)"),
build_formspec = function(data, playername)
if data then
local formstring = ""
local datastring = ""
formstring = entry_image(data)
datastring = factoids_header(data, "craftitems")
local formstring = entry_image(data)
local datastring = factoids_header(data, "craftitems")
datastring = datastring .. factoids_footer(data, playername, "craftitems")
formstring = formstring .. doc.widgets.text(datastring, nil, nil, doc.FORMSPEC.ENTRY_WIDTH - 1.2)

View File

@ -417,9 +417,9 @@ local function get_tooltip(item, groups, cooktime, burntime)
-- and just print the normal item name without special formatting
if groups[1] == "compass" or groups[1] == "clock" then
groupstr = reg_items[item].description
elseif group_names[groups[1]] then
elseif g then
-- Use the special group name string
groupstr = minetest.colorize(gcol, group_names[groups[1]])
groupstr = minetest.colorize(gcol, g)
else
--[[ Fallback: Generic group explanation: This always
works, but the internally used group name (which

View File

@ -154,7 +154,7 @@ doc.sub.items.register_factoid(nil, "use", function(itemstring, def)
return s
end)
doc.sub.items.register_factoid(nil, "groups", function(itemstring, def)
local def = minetest.registered_items[itemstring]
--local def = minetest.registered_items[itemstring]
local s = ""
local use = minetest.get_item_group(itemstring, "mcl_armor_uses")
local pts = minetest.get_item_group(itemstring, "mcl_armor_points")
@ -289,7 +289,7 @@ doc.sub.items.register_factoid("nodes", "drops", function(itemstring, def)
local itemname = item:get_name()
local itemcount = item:get_count()
local idef = minetest.registered_items[itemname]
local text = ""
local text
if idef.description and idef.description ~= "" then
text = idef.description
else

View File

@ -1,6 +1,6 @@
local S = minetest.get_translator("mcl_tt")
local function get_min_digtime(caps)
--[[local function get_min_digtime(caps)
local mintime
local unique = true
local maxlevel = caps.maxlevel
@ -25,7 +25,7 @@ local function get_min_digtime(caps)
end
end
return mintime, unique
end
end]]
local function newline(str)
if str ~= "" then
@ -47,7 +47,7 @@ tt.register_snippet(function(itemstring, toolcaps)
local minestring = ""
local capstr = ""
local caplines = 0
for k,v in pairs(groupcaps) do
for _,v in pairs(groupcaps) do
local speedstr = ""
local miningusesstr = ""
-- Mining capabilities
@ -153,9 +153,9 @@ tt.register_snippet(function(itemstring, toolcaps)
end)
-- Weapon stats
tt.register_snippet(function(itemstring)
--[[tt.register_snippet(function(itemstring)
local def = minetest.registered_items[itemstring]
end)
end)]]
-- Food
tt.register_snippet(function(itemstring)

View File

@ -2,7 +2,7 @@ local S = minetest.get_translator("mcl_tt")
-- Armor
tt.register_snippet(function(itemstring)
local def = minetest.registered_items[itemstring]
--local def = minetest.registered_items[itemstring]
local s = ""
local head = minetest.get_item_group(itemstring, "armor_head")
local torso = minetest.get_item_group(itemstring, "armor_torso")
@ -26,7 +26,7 @@ tt.register_snippet(function(itemstring)
return s
end)
tt.register_snippet(function(itemstring, _, itemstack)
local def = minetest.registered_items[itemstring]
--local def = minetest.registered_items[itemstring]
local s = ""
local use = minetest.get_item_group(itemstring, "mcl_armor_uses")
local pts = minetest.get_item_group(itemstring, "mcl_armor_points")
@ -75,7 +75,7 @@ tt.register_snippet(function(itemstring)
end)
tt.register_snippet(function(itemstring)
local def = minetest.registered_items[itemstring]
--local def = minetest.registered_items[itemstring]
if minetest.get_item_group(itemstring, "crush_after_fall") == 1 then
return S("Deals damage when falling"), mcl_colors.YELLOW
end

View File

@ -250,9 +250,7 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
local tnodedug = string.split(entry.node, ":")
local tmod = tnodedug[1]
local titem = tnodedug[2]
if not tmod or not titem or not data.count[tmod] or not data.count[tmod][titem] then
-- table running failed!
elseif data.count[tmod][titem] > entry.target-1 then
if tmod and titem and data.count[tmod] and data.count[tmod][titem] and data.count[tmod][titem] > entry.target-1 then
return entry.award
end
elseif awards.get_total_item_count(data, "count") > entry.target-1 then
@ -277,9 +275,7 @@ minetest.register_on_placenode(function(pos, node, digger)
local tnodedug = string.split(entry.node, ":")
local tmod = tnodedug[1]
local titem = tnodedug[2]
if not tmod or not titem or not data.place[tmod] or not data.place[tmod][titem] then
-- table running failed!
elseif data.place[tmod][titem] > entry.target-1 then
if tmod and titem and data.place[tmod] and data.place[tmod][titem] and data.place[tmod][titem] > entry.target-1 then
return entry.award
end
elseif awards.get_total_item_count(data, "place") > entry.target-1 then
@ -303,9 +299,7 @@ minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack,
local titemstring = string.split(entry.item, ":")
local tmod = titemstring[1]
local titem = titemstring[2]
if not tmod or not titem or not data.eat[tmod] or not data.eat[tmod][titem] then
-- table running failed!
elseif data.eat[tmod][titem] > entry.target-1 then
if tmod and titem and data.eat[tmod] and data.eat[tmod][titem] and data.eat[tmod][titem] > entry.target-1 then
return entry.award
end
elseif awards.get_total_item_count(data, "eat") > entry.target-1 then
@ -331,9 +325,7 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv
local titemcrafted = string.split(entry.item, ":")
local tmod = titemcrafted[1]
local titem = titemcrafted[2]
if not tmod or not titem or not data.craft[tmod] or not data.craft[tmod][titem] then
-- table running failed!
elseif data.craft[tmod][titem] > entry.target-1 then
if tmod and titem and data.craft[tmod] and data.craft[tmod][titem] and data.craft[tmod][titem] > entry.target-1 then
return entry.award
end
elseif awards.get_total_item_count(data, "craft") > entry.target-1 then

View File

@ -1,6 +1,5 @@
if minetest.get_modpath("unified_inventory") ~= nil then
local S = minetest.get_translator("awards")
if minetest.get_modpath("unified_inventory") then
local S = minetest.get_translator(minetest.get_current_modname())
unified_inventory.register_button("awards", {
type = "image",
image = "awards_ui_icon.png",

View File

@ -1,5 +1,11 @@
local S = minetest.get_translator("mcl_experience")
mcl_experience = {}
local vector = vector
local math = math
local string = string
local pool = {}
local registered_nodes
local max_xp = 2^31-1
@ -262,7 +268,6 @@ function mcl_experience.add_experience(player, experience)
if #final_candidates > 0 then
local can = final_candidates[math.random(#final_candidates)]
local stack, list, index, wear = can.stack, can.list, can.index, can.wear
local unbreaking_level = mcl_enchanting.get_enchantment(stack, "unbreaking")
local uses = mcl_util.calculate_durability(stack)
local multiplier = 2 * 65535 / uses
local repair = experience * multiplier
@ -329,14 +334,12 @@ minetest.register_on_dieplayer(function(player)
mcl_experience.throw_experience(player:get_pos(), xp_amount)
end)
local name
local collector, pos, pos2
local direction, distance, player_velocity, goal
local currentvel, acceleration, multiplier, velocity
local node, vel, def
local is_moving, is_slippery, slippery, slip_factor
local size, data
local size
local function xp_step(self, dtime)
--if item set to be collected then only execute go to player
if self.collected == true then

View File

@ -7,7 +7,7 @@ local players = {}
-- Containing all the items for each Creative Mode tab
local inventory_lists = {}
local mod_player = minetest.get_modpath("mcl_player") ~= nil
--local mod_player = minetest.get_modpath("mcl_player") ~= nil
-- Create tables
local builtin_filter_ids = {"blocks","deco","redstone","rail","food","tools","combat","mobs","brew","matr","misc","all"}
@ -161,7 +161,7 @@ end
local function init(player)
local playername = player:get_player_name()
local inv = minetest.create_detached_inventory("creative_"..playername, {
minetest.create_detached_inventory("creative_"..playername, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.is_creative_enabled(playername) then
return count
@ -203,7 +203,7 @@ local offset = {} -- string offset:
local boffset = {} --
local hoch = {}
local filtername = {}
local bg = {}
--local bg = {}
local noffset_x_start = -0.24
local noffset_x = noffset_x_start
@ -257,7 +257,6 @@ hoch["mobs"] = "_down"
hoch["matr"] = "_down"
hoch["inv"] = "_down"
filtername = {}
filtername["blocks"] = S("Building Blocks")
filtername["deco"] = S("Decoration Blocks")
filtername["redstone"] = S("Redstone")
@ -272,9 +271,9 @@ filtername["brew"] = S("Brewing")
filtername["matr"] = S("Materials")
filtername["inv"] = S("Survival Inventory")
local dark_bg = "crafting_creative_bg_dark.png"
--local dark_bg = "crafting_creative_bg_dark.png"
local function reset_menu_item_bg()
--[[local function reset_menu_item_bg()
bg["blocks"] = dark_bg
bg["deco"] = dark_bg
bg["redstone"] = dark_bg
@ -289,11 +288,11 @@ local function reset_menu_item_bg()
bg["matr"] = dark_bg
bg["inv"] = dark_bg
bg["default"] = dark_bg
end
end]]
mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_size, show, page, filter)
reset_menu_item_bg()
--reset_menu_item_bg()
pagenum = math.floor(pagenum) or 1
local playername = player:get_player_name()
@ -310,7 +309,6 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
end
local pagemax = math.max(1, math.floor((inv_size-1) / (9*5) + 1))
local name = "nix"
local formspec = ""
local main_list
local listrings = "listring[detached:creative_"..playername..";main]"..
"listring[current_player;main]"..
@ -322,7 +320,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
players[playername].page = page
end
end
bg[name] = "crafting_creative_bg.png"
--bg[name] = "crafting_creative_bg.png"
local inv_bg = "crafting_inventory_creative.png"
if name == "inv" then
@ -428,7 +426,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
caption = "label[0,1.2;"..F(minetest.colorize("#313131", filtername[name])).."]"
end
formspec = "size[10,9.3]"..
local formspec = "size[10,9.3]"..
"no_prepend[]"..
mcl_vars.gui_nonbg..mcl_vars.gui_bg_color..
"background[-0.19,-0.25;10.5,9.87;"..inv_bg.."]"..
@ -560,7 +558,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
-- Figure out current scroll bar from formspec
local formspec = player:get_inventory_formspec()
--local formspec = player:get_inventory_formspec()
local start_i = players[name].start_i
@ -628,7 +626,7 @@ if minetest.is_creative_enabled("") then
end
mcl_inventory.update_inventory_formspec = function(player)
local page = nil
local page
local name = player:get_player_name()
@ -639,7 +637,7 @@ if minetest.is_creative_enabled("") then
end
-- Figure out current scroll bar from formspec
local formspec = player:get_inventory_formspec()
--local formspec = player:get_inventory_formspec()
local start_i = players[name].start_i
local inv_size

View File

@ -3,8 +3,8 @@ local F = minetest.formspec_escape
mcl_inventory = {}
local mod_player = minetest.get_modpath("mcl_player") ~= nil
local mod_craftguide = minetest.get_modpath("mcl_craftguide") ~= nil
--local mod_player = minetest.get_modpath("mcl_player") ~= nil
--local mod_craftguide = minetest.get_modpath("mcl_craftguide") ~= nil
-- Returns a single itemstack in the given inventory to the main inventory, or drop it when there's no space left
function return_item(itemstack, dropper, pos, inv)
@ -60,8 +60,6 @@ local function set_inventory(player, armor_change_only)
inv:set_width("craft", 2)
inv:set_size("craft", 4)
local player_name = player:get_player_name()
-- Show armor and player image
local player_preview
if minetest.settings:get_bool("3d_player_preview", true) then
@ -180,6 +178,6 @@ minetest.register_on_joinplayer(function(player)
end)
if minetest.is_creative_enabled("") then
dofile(minetest.get_modpath("mcl_inventory").."/creative.lua")
dofile(minetest.get_modpath(minetest.get_current_modname()).."/creative.lua")
end

View File

@ -1,6 +1,6 @@
name = mcl_inventory
author = BlockMen
description = Adds the player inventory and creative inventory.
depends = mcl_init, mcl_formspec
optional_depends = mcl_player, _mcl_autogroup, mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting
depends = mcl_init, mcl_formspec, mcl_player
optional_depends = _mcl_autogroup, mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting, mcl_craftguide

View File

@ -220,11 +220,11 @@ for _, mode in pairs{"comp", "sub"} do
for _, state in pairs{mesecon.state.on, mesecon.state.off} do
local state_str = state_strs[state]
local nodename =
"mcl_comparators:comparator_"..state_strs[state].."_"..mode
"mcl_comparators:comparator_"..state_str.."_"..mode
-- Help
local longdesc, usagehelp, use_help
if state_strs[state] == "off" and mode == "comp" then
if state_str == "off" and mode == "comp" then
longdesc = S("Redstone comparators are multi-purpose redstone components.").."\n"..
S("They can transmit a redstone signal, detect whether a block contains any items and compare multiple signals.")
@ -245,9 +245,9 @@ for _, state in pairs{mesecon.state.on, mesecon.state.off} do
_doc_items_longdesc = longdesc,
_doc_items_usagehelp = usagehelp,
drawtype = "nodebox",
tiles = get_tiles(state_strs[state], mode),
tiles = get_tiles(state_str, mode),
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
wield_image = "mcl_comparators_off.png",
--wield_image = "mcl_comparators_off.png",
walkable = true,
selection_box = collision_box,
collision_box = collision_box,
@ -263,7 +263,7 @@ for _, state in pairs{mesecon.state.on, mesecon.state.off} do
drop = 'mcl_comparators:comparator_off_comp',
on_construct = update_self,
on_rightclick =
make_rightclick_handler(state_strs[state], mode),
make_rightclick_handler(state_str, mode),
comparator_mode = mode,
comparator_onstate = "mcl_comparators:comparator_on_"..mode,
comparator_offstate = "mcl_comparators:comparator_off_"..mode,
@ -287,7 +287,7 @@ for _, state in pairs{mesecon.state.on, mesecon.state.off} do
else
nodedef.groups = table.copy(nodedef.groups)
nodedef.groups.not_in_creative_inventory = 1
local extra_desc = {}
--local extra_desc = {}
if mode == "sub" or state == mesecon.state.on then
nodedef.inventory_image = nil
end

View File

@ -96,7 +96,8 @@ local dispenserdef = {
end,
_mcl_blast_resistance = 3.5,
_mcl_hardness = 3.5,
mesecons = {effector = {
mesecons = {
effector = {
-- Dispense random item when triggered
action_on = function (pos, node)
local meta = minetest.get_meta(pos)
@ -166,7 +167,7 @@ local dispenserdef = {
elseif igroups.spawn_egg then
-- Spawn mob
if not dropnodedef.walkable then
pointed_thing = { above = droppos, under = { x=droppos.x, y=droppos.y-1, z=droppos.z } }
--pointed_thing = { above = droppos, under = { x=droppos.x, y=droppos.y-1, z=droppos.z } }
minetest.add_entity(droppos, stack:get_name())
stack:take_item()
@ -214,7 +215,8 @@ local dispenserdef = {
end
end,
rules = mesecon.rules.alldirs,
}},
},
},
on_rotate = on_rotate,
}

View File

@ -11,7 +11,7 @@ local realtime = true
local rules_flat = {
{ x = 0, y = 0, z = -1, spread = true },
}
local get_rules_flat = function(node)
local function get_rules_flat(node)
local rules = rules_flat
for i=1, node.param2 do
rules = mesecon.rotate_rules_left(rules)
@ -46,7 +46,7 @@ end
-- and update the observer state if needed.
-- TODO: Also scan metadata changes.
-- TODO: Ignore some node changes.
local observer_scan = function(pos, initialize)
local function observer_scan(pos, initialize)
local node = minetest.get_node(pos)
local front
if node.name == "mcl_observers:observer_up_off" or node.name == "mcl_observers:observer_up_on" then
@ -87,14 +87,14 @@ local observer_scan = function(pos, initialize)
end
-- Vertical orientation (CURRENTLY DISABLED)
local observer_orientate = function(pos, placer)
local function observer_orientate(pos, placer)
-- Not placed by player
if not placer then return end
-- Placer pitch in degrees
local pitch = placer:get_look_vertical() * (180 / math.pi)
local node = minetest.get_node(pos)
--local node = minetest.get_node(pos)
if pitch > 55 then -- player looking upwards
-- Observer looking downwards
minetest.set_node(pos, {name="mcl_observers:observer_down_off"})
@ -104,16 +104,14 @@ local observer_orientate = function(pos, placer)
end
end
mesecon.register_node("mcl_observers:observer",
{
mesecon.register_node("mcl_observers:observer", {
is_ground_content = false,
sounds = mcl_sounds.node_sound_stone_defaults(),
paramtype2 = "facedir",
on_rotate = false,
_mcl_blast_resistance = 3.5,
_mcl_hardness = 3.5,
},
{
}, {
description = S("Observer"),
_tt_help = S("Emits redstone pulse when block in front changes"),
_doc_items_longdesc = S("An observer is a redstone component which observes the block in front of it and sends a very short redstone pulse whenever this block changes."),
@ -125,18 +123,19 @@ mesecon.register_node("mcl_observers:observer",
"mcl_observers_observer_side.png", "mcl_observers_observer_side.png",
"mcl_observers_observer_front.png", "mcl_observers_observer_back.png",
},
mesecons = { receptor = {
mesecons = {
receptor = {
state = mesecon.state.off,
rules = get_rules_flat,
}},
},
},
on_construct = function(pos)
if not realtime then
observer_scan(pos, true)
end
end,
after_place_node = observer_orientate,
},
{
}, {
_doc_items_create_entry = false,
groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 },
tiles = {
@ -144,10 +143,12 @@ mesecon.register_node("mcl_observers:observer",
"mcl_observers_observer_side.png", "mcl_observers_observer_side.png",
"mcl_observers_observer_front.png", "mcl_observers_observer_back_lit.png",
},
mesecons = { receptor = {
mesecons = {
receptor = {
state = mesecon.state.on,
rules = get_rules_flat,
}},
}
},
-- VERY quickly disable observer after construction
on_construct = function(pos)
@ -162,8 +163,7 @@ mesecon.register_node("mcl_observers:observer",
}
)
mesecon.register_node("mcl_observers:observer_down",
{
mesecon.register_node("mcl_observers:observer_down", {
is_ground_content = false,
sounds = mcl_sounds.node_sound_stone_defaults(),
groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 },
@ -171,34 +171,36 @@ mesecon.register_node("mcl_observers:observer_down",
_mcl_blast_resistance = 3.5,
_mcl_hardness = 3.5,
drop = "mcl_observers:observer_off",
},
{
}, {
tiles = {
"mcl_observers_observer_back.png", "mcl_observers_observer_front.png",
"mcl_observers_observer_side.png^[transformR90", "mcl_observers_observer_side.png^[transformR90",
"mcl_observers_observer_top.png", "mcl_observers_observer_top.png",
},
mesecons = { receptor = {
mesecons = {
receptor = {
state = mesecon.state.off,
rules = rules_down,
}},
},
},
on_construct = function(pos)
if not realtime then
observer_scan(pos, true)
end
end,
},
{
}, {
_doc_items_create_entry = false,
tiles = {
"mcl_observers_observer_back_lit.png", "mcl_observers_observer_front.png",
"mcl_observers_observer_side.png^[transformR90", "mcl_observers_observer_side.png^[transformR90",
"mcl_observers_observer_top.png", "mcl_observers_observer_top.png",
},
mesecons = { receptor = {
mesecons = {
receptor = {
state = mesecon.state.on,
rules = rules_down,
}},
},
},
-- VERY quickly disable observer after construction
on_construct = function(pos)
@ -210,10 +212,10 @@ mesecon.register_node("mcl_observers:observer_down",
minetest.set_node(pos, {name = "mcl_observers:observer_down_off", param2 = node.param2})
mesecon.receptor_off(pos, rules_down)
end,
})
}
)
mesecon.register_node("mcl_observers:observer_up",
{
mesecon.register_node("mcl_observers:observer_up", {
is_ground_content = false,
sounds = mcl_sounds.node_sound_stone_defaults(),
groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 },
@ -221,34 +223,36 @@ mesecon.register_node("mcl_observers:observer_up",
_mcl_blast_resistance = 3.5,
_mcl_hardness = 3.5,
drop = "mcl_observers:observer_off",
},
{
}, {
tiles = {
"mcl_observers_observer_front.png", "mcl_observers_observer_back.png",
"mcl_observers_observer_side.png^[transformR270", "mcl_observers_observer_side.png^[transformR270",
"mcl_observers_observer_top.png^[transformR180", "mcl_observers_observer_top.png^[transformR180",
},
mesecons = { receptor = {
mesecons = {
receptor = {
state = mesecon.state.off,
rules = rules_up,
}},
},
},
on_construct = function(pos)
if not realtime then
observer_scan(pos, true)
end
end,
},
{
}, {
_doc_items_create_entry = false,
tiles = {
"mcl_observers_observer_front.png", "mcl_observers_observer_back_lit.png",
"mcl_observers_observer_side.png^[transformR270", "mcl_observers_observer_side.png^[transformR270",
"mcl_observers_observer_top.png^[transformR180", "mcl_observers_observer_top.png^[transformR180",
},
mesecons = { receptor = {
mesecons = {
receptor = {
state = mesecon.state.on,
rules = rules_up,
}},
},
},
-- VERY quickly disable observer after construction
on_construct = function(pos)
@ -259,7 +263,8 @@ mesecon.register_node("mcl_observers:observer_up",
minetest.set_node(pos, {name = "mcl_observers:observer_up_off"})
mesecon.receptor_off(pos, rules_up)
end,
})
}
)
minetest.register_craft({
output = "mcl_observers:observer_off",
@ -267,7 +272,7 @@ minetest.register_craft({
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
{ "mcl_nether:quartz", "mesecons:redstone", "mesecons:redstone" },
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
}
},
})
minetest.register_craft({
output = "mcl_observers:observer_off",
@ -275,7 +280,7 @@ minetest.register_craft({
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
{ "mesecons:redstone", "mesecons:redstone", "mcl_nether:quartz" },
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
}
},
})
if realtime then

View File

@ -329,7 +329,7 @@ function mesecon.get_conductor_on(node_off, rulename)
return conductor.states[tonumber(binstate,2)+1]
end
end
return offstate
return conductor.offstate
end
function mesecon.get_conductor_off(node_on, rulename)
@ -345,7 +345,7 @@ function mesecon.get_conductor_off(node_on, rulename)
return conductor.states[tonumber(binstate,2)+1]
end
end
return onstate
return conductor.onstate
end
function mesecon.conductor_get_rules(node)
@ -391,9 +391,7 @@ function mesecon.turnon(pos, link)
local f = table.remove(frontiers, 1)
local node = get_node_force(f.pos)
if not node then
-- Area does not exist; do nothing
elseif mesecon.is_conductor_off(node, f.link) then
if node and mesecon.is_conductor_off(node, f.link) then
local rules = mesecon.conductor_get_rules(node)
-- Call turnon on neighbors
@ -453,9 +451,7 @@ function mesecon.turnoff(pos, link)
local f = table.remove(frontiers, 1)
local node = get_node_force(f.pos)
if not node then
-- No-op
elseif mesecon.is_conductor_on(node, f.link) then
if node and mesecon.is_conductor_on(node, f.link) then
local rules = mesecon.conductor_get_rules(node)
for _, r in pairs(mesecon.rule2meta(f.link, rules)) do
local np = vector.add(f.pos, r)

View File

@ -77,7 +77,7 @@ mesecon.on_dignode = function(pos, node)
mesecon.receptor_off(pos, mesecon.receptor_get_rules(node))
end
if minetest.get_item_group(node.name, "opaque") == 1 then
local sources = mesecon.is_powered(pos)
--local sources = mesecon.is_powered(pos)
local neighbors = mesecon.mcl_get_neighbors(pos)
for n=1, #neighbors do
local npos = neighbors[n].pos

View File

@ -72,7 +72,7 @@ end
local function check_commands(commands, player_name)
for _, command in pairs(commands:split("\n")) do
local pos = command:find(" ")
local cmd, param = command, ""
local cmd = command
if pos then
cmd = command:sub(1, pos - 1)
end

View File

@ -4,7 +4,7 @@ local DELAYS = { 0.1, 0.2, 0.3, 0.4 }
local DEFAULT_DELAY = DELAYS[1]
-- Function that get the input/output rules of the delayer
local delayer_get_output_rules = function(node)
local function delayer_get_output_rules(node)
local rules = {{x = -1, y = 0, z = 0, spread=true}}
for i = 0, node.param2 do
rules = mesecon.rotate_rules_left(rules)
@ -12,7 +12,7 @@ local delayer_get_output_rules = function(node)
return rules
end
local delayer_get_input_rules = function(node)
local function delayer_get_input_rules(node)
local rules = {{x = 1, y = 0, z = 0}}
for i = 0, node.param2 do
rules = mesecon.rotate_rules_left(rules)
@ -22,7 +22,7 @@ end
-- Return the sides of a delayer.
-- Those are used to toggle the lock state.
local delayer_get_sides = function(node)
local function delayer_get_sides(node)
local rules = {
{x = 0, y = 0, z = -1},
{x = 0, y = 0, z = 1},
@ -35,7 +35,7 @@ end
-- Make the repeater at pos try to lock any repeater it faces.
-- Returns true if a repeater was locked.
local check_lock_repeater = function(pos, node)
local function check_lock_repeater(pos, node)
-- Check the repeater at pos and look if it faces
-- a repeater placed sideways.
-- If yes, lock the second repeater.
@ -67,7 +67,7 @@ end
-- Make the repeater at pos try to unlock any repeater it faces.
-- Returns true if a repeater was unlocked.
local check_unlock_repeater = function(pos, node)
local function check_unlock_repeater(pos, node)
-- Check the repeater at pos and look if it faces
-- a repeater placed sideways.
-- If yes, also check if the second repeater doesn't receive
@ -119,21 +119,19 @@ local check_unlock_repeater = function(pos, node)
end
-- Functions that are called after the delay time
local delayer_activate = function(pos, node)
local function delayer_activate(pos, node)
local def = minetest.registered_nodes[node.name]
local time = def.delayer_time
minetest.set_node(pos, {name=def.delayer_onstate, param2=node.param2})
mesecon.queue:add_action(pos, "receptor_on", {delayer_get_output_rules(node)}, time, nil)
check_lock_repeater(pos, node)
end
local delayer_deactivate = function(pos, node)
local function delayer_deactivate(pos, node)
local def = minetest.registered_nodes[node.name]
local time = def.delayer_time
minetest.set_node(pos, {name=def.delayer_offstate, param2=node.param2})
mesecon.queue:add_action(pos, "receptor_off", {delayer_get_output_rules(node)}, time, nil)
check_unlock_repeater(pos, node)
end
@ -145,7 +143,7 @@ end
-- Register the 2 (states) x 4 (delay times) delayers
for i = 1, 4 do
local groups = {}
local groups
if i == 1 then
groups = {dig_immediate=3,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,attached_node=1,redstone_repeater=i}
else
@ -191,7 +189,6 @@ if i == 1 then
usagehelp = S("To power a redstone repeater, send a signal in “arrow” direction (the input). The signal goes out on the opposite side (the output) with a delay. To change the delay, use the redstone repeater. The delay is between 0.1 and 0.4 seconds long and can be changed in steps of 0.1 seconds. It is indicated by the position of the moving redstone torch.").."\n"..
S("To lock a repeater, send a signal from an adjacent repeater into one of its sides. While locked, the moving redstone torch disappears, the output doesn't change and the input signal is ignored.")
icon = "mesecons_delayer_item.png"
-- Check sides of constructed repeater and lock it, if required
on_construct = function(pos)
local node = minetest.get_node(pos)
@ -248,7 +245,7 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
"mesecons_delayer_ends_off.png",
},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
wield_image = "mesecons_delayer_off.png",
--wield_image = "mesecons_delayer_off.png",
walkable = true,
selection_box = {
type = "fixed",
@ -290,21 +287,18 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
delayer_lockstate = "mesecons_delayer:delayer_off_locked",
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {
receptor =
{
receptor = {
state = mesecon.state.off,
rules = delayer_get_output_rules
rules = delayer_get_output_rules,
},
effector =
{
effector = {
rules = delayer_get_input_rules,
action_on = delayer_activate
}
action_on = delayer_activate,
},
},
on_rotate = on_rotate,
})
minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), {
description = S("Redstone Repeater (Delay @1, Powered)", i),
_doc_items_create_entry = false,
@ -343,6 +337,7 @@ minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), {
minetest.record_protection_violation(pos, protname)
return
end
--HACK! we already know the node name, so we should generate the function to avoid multiple checks
if node.name=="mesecons_delayer:delayer_on_1" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_on_2",param2=node.param2})
elseif node.name=="mesecons_delayer:delayer_on_2" then
@ -361,20 +356,17 @@ minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), {
delayer_lockstate = "mesecons_delayer:delayer_on_locked",
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {
receptor =
{
receptor = {
state = mesecon.state.on,
rules = delayer_get_output_rules
rules = delayer_get_output_rules,
},
effector =
{
effector = {
rules = delayer_get_input_rules,
action_off = delayer_deactivate
}
action_off = delayer_deactivate,
},
},
on_rotate = on_rotate,
})
end

View File

@ -1,3 +1,5 @@
local table = table
--register stoppers for movestones/pistons
mesecon.mvps_stoppers = {}
@ -6,8 +8,6 @@ mesecon.mvps_droppers = {}
mesecon.on_mvps_move = {}
mesecon.mvps_unmov = {}
local is_protected = minetest.is_protected
--- Objects (entities) that cannot be moved
function mesecon.register_mvps_unmov(objectname)
mesecon.mvps_unmov[objectname] = true;
@ -151,6 +151,7 @@ function mesecon.mvps_get_stack(pos, dir, maximum, piston_pos)
-- add connected nodes to frontiers, connected is a vector list
-- the vectors must be absolute positions
local connected = {}
local has_loop
if minetest.registered_nodes[nn.name]
and minetest.registered_nodes[nn.name].mvps_sticky then
connected, has_loop = minetest.registered_nodes[nn.name].mvps_sticky(np, nn, piston_pos)
@ -258,7 +259,7 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, player_name,
n.meta = minetest.get_meta(n.pos):to_table()
local is_dropper = mesecon.is_mvps_dropper(n.node, movedir, nodes, id)
if is_dropper then
local drops = minetest.get_node_drops(n.node.name, "")
--local drops = minetest.get_node_drops(n.node.name, "")
minetest.dig_node(n.pos)
else
minetest.remove_node(n.pos)

View File

@ -3,28 +3,35 @@ local S = minetest.get_translator("mesecons_pistons")
local PISTON_MAXIMUM_PUSH = 12
--Get mesecon rules of pistons
local piston_rules =
{{x=0, y=0, z=1}, --everything apart from z- (pusher side)
--everything apart from z- (pusher side)
local piston_rules = {
{x=0, y=0, z=1},
{x=1, y=0, z=0},
{x=-1, y=0, z=0},
{x=0, y=1, z=0},
{x=0, y=-1, z=0}}
{x=0, y=-1, z=0},
}
local piston_up_rules =
{{x=0, y=0, z=-1}, --everything apart from y+ (pusher side)
--everything apart from y+ (pusher side)
local piston_up_rules = {
{x=0, y=0, z=-1},
{x=0, y=0, z=1},
{x=-1, y=0, z=0},
{x=1, y=0, z=0},
{x=0, y=-1, z=0}}
{x=0, y=-1, z=0},
}
local piston_down_rules =
{{x=0, y=0, z=-1}, --everything apart from y- (pusher side)
--everything apart from y- (pusher side)
local piston_down_rules = {
{x=0, y=0, z=-1},
{x=0, y=0, z=1},
{x=-1, y=0, z=0},
{x=1, y=0, z=0},
{x=0, y=1, z=0}}
{x=0, y=1, z=0},
}
local piston_get_rules = function (node)
local function piston_get_rules(node)
local rules = piston_rules
for i = 1, node.param2 do
rules = mesecon.rotate_rules_left(rules)
@ -32,7 +39,7 @@ local piston_get_rules = function (node)
return rules
end
local piston_facedir_direction = function (node)
local function piston_facedir_direction(node)
local rules = {{x = 0, y = 0, z = -1}}
for i = 1, node.param2 do
rules = mesecon.rotate_rules_left(rules)
@ -40,7 +47,7 @@ local piston_facedir_direction = function (node)
return rules[1]
end
local piston_get_direction = function (dir, node)
local function piston_get_direction(dir, node)
if type(dir) == "function" then
return dir(node)
else
@ -50,7 +57,7 @@ end
-- Remove pusher of piston.
-- To be used when piston was destroyed or dug.
local piston_remove_pusher = function (pos, oldnode)
local function piston_remove_pusher(pos, oldnode)
local pistonspec = minetest.registered_nodes[oldnode.name].mesecons_piston
local dir = piston_get_direction(pistonspec.dir, oldnode)
@ -70,7 +77,7 @@ end
-- Remove base node of piston.
-- To be used when pusher was destroyed.
local piston_remove_base = function (pos, oldnode)
local function piston_remove_base(pos, oldnode)
local basenodename = minetest.registered_nodes[oldnode.name].corresponding_piston
local pistonspec = minetest.registered_nodes[basenodename].mesecons_piston
@ -89,7 +96,7 @@ local piston_remove_base = function (pos, oldnode)
end
end
local piston_on = function (pos, node)
local function piston_on(pos, node)
local pistonspec = minetest.registered_nodes[node.name].mesecons_piston
local dir = piston_get_direction(pistonspec.dir, node)
@ -113,7 +120,7 @@ local piston_on = function (pos, node)
end
end
local piston_off = function (pos, node)
local function piston_off(pos, node)
local pistonspec = minetest.registered_nodes[node.name].mesecons_piston
minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.offname})
piston_remove_pusher (pos, node)
@ -124,13 +131,13 @@ local piston_off = function (pos, node)
local dir = piston_get_direction(pistonspec.dir, node)
local pullpos = vector.add(pos, vector.multiply(dir, 2))
local meta = minetest.get_meta(pos)
local success, stack, oldstack = mesecon.mvps_pull_single(pullpos, vector.multiply(dir, -1), PISTON_MAXIMUM_PUSH, meta:get_string("owner"), pos)
local success, stack = mesecon.mvps_pull_single(pullpos, vector.multiply(dir, -1), PISTON_MAXIMUM_PUSH, meta:get_string("owner"), pos)
if success then
mesecon.mvps_process_stack(pos, dir, stack)
end
end
local piston_orientate = function (pos, placer)
local function piston_orientate(pos, placer)
mesecon.mvps_set_owner(pos, placer)
-- not placed by player
@ -158,14 +165,14 @@ local piston_pusher_box = {
fixed = {
{-2/16, -2/16, -.5 + pt, 2/16, 2/16, .5 + pt},
{-.5 , -.5 , -.5 , .5 , .5 , -.5 + pt},
}
},
}
local piston_on_box = {
type = "fixed",
fixed = {
{-.5, -.5, -.5 + pt, .5, .5, .5}
}
},
}
@ -203,10 +210,12 @@ minetest.register_node("mesecons_pistons:piston_normal_off", {
after_place_node = piston_orientate,
mesecons_piston = pistonspec_normal,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={
mesecons = {
effector = {
action_on = piston_on,
rules = piston_get_rules
}},
},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
on_rotate = function(pos, node, user, mode)
@ -238,10 +247,12 @@ minetest.register_node("mesecons_pistons:piston_normal_on", {
selection_box = piston_on_box,
mesecons_piston = pistonspec_normal,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={
mesecons = {
effector = {
action_off = piston_off,
rules = piston_get_rules
}},
},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
on_rotate = false,
@ -307,10 +318,12 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", {
after_place_node = piston_orientate,
mesecons_piston = pistonspec_sticky,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={
mesecons = {
effector = {
action_on = piston_on,
rules = piston_get_rules
}},
},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
on_rotate = function(pos, node, user, mode)
@ -342,10 +355,12 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", {
selection_box = piston_on_box,
mesecons_piston = pistonspec_sticky,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={
mesecons = {
effector = {
action_off = piston_off,
rules = piston_get_rules
}},
},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
on_rotate = false,
@ -388,14 +403,14 @@ local piston_up_pusher_box = {
fixed = {
{-2/16, -.5 - pt, -2/16, 2/16, .5 - pt, 2/16},
{-.5 , .5 - pt, -.5 , .5 , .5 , .5},
}
},
}
local piston_up_on_box = {
type = "fixed",
fixed = {
{-.5, -.5, -.5 , .5, .5-pt, .5}
}
},
}
-- Normal
@ -404,7 +419,7 @@ local pistonspec_normal_up = {
offname = "mesecons_pistons:piston_up_normal_off",
onname = "mesecons_pistons:piston_up_normal_on",
dir = {x = 0, y = 1, z = 0},
pusher = "mesecons_pistons:piston_up_pusher_normal"
pusher = "mesecons_pistons:piston_up_pusher_normal",
}
-- offstate
@ -423,10 +438,12 @@ minetest.register_node("mesecons_pistons:piston_up_normal_off", {
is_ground_content = false,
drop = "mesecons_pistons:piston_normal_off",
mesecons_piston = pistonspec_normal_up,
mesecons = {effector={
mesecons = {
effector = {
action_on = piston_on,
rules = piston_up_rules,
}},
},
},
sounds = mcl_sounds.node_sound_stone_defaults({
footstep = mcl_sounds.node_sound_wood_defaults().footstep
}),
@ -462,10 +479,12 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", {
selection_box = piston_up_on_box,
mesecons_piston = pistonspec_normal_up,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={
mesecons = {
effector = {
action_off = piston_off,
rules = piston_up_rules,
}},
},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
on_rotate = false,
@ -507,7 +526,7 @@ local pistonspec_sticky_up = {
onname = "mesecons_pistons:piston_up_sticky_on",
dir = {x = 0, y = 1, z = 0},
pusher = "mesecons_pistons:piston_up_pusher_sticky",
sticky = true
sticky = true,
}
-- offstate
@ -529,10 +548,12 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_off", {
sounds = mcl_sounds.node_sound_stone_defaults({
footstep = mcl_sounds.node_sound_wood_defaults().footstep
}),
mesecons = {effector={
mesecons = {
effector = {
action_on = piston_on,
rules = piston_up_rules,
}},
},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
on_rotate = function(pos, node, user, mode)
@ -565,10 +586,12 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_on", {
selection_box = piston_up_on_box,
mesecons_piston = pistonspec_sticky_up,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={
mesecons = {
effector = {
action_off = piston_off,
rules = piston_up_rules,
}},
},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
on_rotate = false,
@ -611,14 +634,14 @@ local piston_down_pusher_box = {
fixed = {
{-2/16, -.5 + pt, -2/16, 2/16, .5 + pt, 2/16},
{-.5 , -.5 , -.5 , .5 , -.5 + pt, .5},
}
},
}
local piston_down_on_box = {
type = "fixed",
fixed = {
{-.5, -.5+pt, -.5 , .5, .5, .5}
}
},
}
@ -649,10 +672,12 @@ minetest.register_node("mesecons_pistons:piston_down_normal_off", {
drop = "mesecons_pistons:piston_normal_off",
mesecons_piston = pistonspec_normal_down,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={
mesecons = {
effector = {
action_on = piston_on,
rules = piston_down_rules,
}},
},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
on_rotate = function(pos, node, user, mode)
@ -685,10 +710,12 @@ minetest.register_node("mesecons_pistons:piston_down_normal_on", {
selection_box = piston_down_on_box,
mesecons_piston = pistonspec_normal_down,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={
mesecons = {
effector = {
action_off = piston_off,
rules = piston_down_rules,
}},
},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
on_rotate = false,
@ -727,7 +754,7 @@ local pistonspec_sticky_down = {
offname = "mesecons_pistons:piston_down_sticky_off",
dir = {x = 0, y = -1, z = 0},
pusher = "mesecons_pistons:piston_down_pusher_sticky",
sticky = true
sticky = true,
}
-- offstate
@ -747,10 +774,12 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_off", {
drop = "mesecons_pistons:piston_sticky_off",
mesecons_piston = pistonspec_sticky_down,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={
mesecons = {
effector = {
action_on = piston_on,
rules = piston_down_rules,
}},
},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
on_rotate = function(pos, node, user, mode)
@ -783,10 +812,12 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_on", {
selection_box = piston_down_on_box,
mesecons_piston = pistonspec_sticky_down,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={
mesecons = {
effector = {
action_off = piston_off,
rules = piston_down_rules,
}},
},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,
on_rotate = false,
@ -839,7 +870,7 @@ minetest.register_craft({
{"group:wood", "group:wood", "group:wood"},
{"mcl_core:cobble", "mcl_core:iron_ingot", "mcl_core:cobble"},
{"mcl_core:cobble", "mesecons:redstone", "mcl_core:cobble"},
}
},
})
minetest.register_craft({
@ -847,7 +878,7 @@ minetest.register_craft({
recipe = {
{"mcl_mobitems:slimeball"},
{"mesecons_pistons:piston_normal_off"},
}
},
})
-- Add entry aliases for the Help

View File

@ -33,7 +33,7 @@ local wire_getconnect = function (from_pos, self_pos)
if minetest.registered_nodes[node.name]
and minetest.registered_nodes[node.name].mesecons then
-- rules of node to possibly connect to
local rules = {}
local rules
if (minetest.registered_nodes[node.name].mesecon_wire) then
rules = wire_rules
else
@ -214,8 +214,7 @@ local function register_wires()
local dot_off = "redstone_redstone_dust_dot.png^[colorize:#FF0000:"..ratio_off
local dot_on = "redstone_redstone_dust_dot.png^[colorize:#FF0000:"..ratio_on
local tiles_off = { crossing_off, crossing_off, straight0_off, straight1_off, straight0_off, straight1_off }
local tiles_on = { crossing_on, crossing_on, straight0_on, straight1_on, straight0_on, straight1_on }
local tiles_off, tiles_on
local wirehelp, tt, longdesc, usagehelp, img, desc_off, desc_on
if nodeid == "00000000" then
@ -238,8 +237,8 @@ S("Read the help entries on the other redstone components to learn how redstone
else
-- Connected redstone wire
table.insert(nodebox, box_center)
tiles_off = { crossing_off, crossing_off, straight0_off, straight1_off, straight0_off, straight1_off, }
tiles_on = { crossing_on, crossing_on, straight0_on, straight1_on, straight0_on, straight1_on, }
tiles_off = { crossing_off, crossing_off, straight0_off, straight1_off, straight0_off, straight1_off }
tiles_on = { crossing_on, crossing_on, straight0_on, straight1_on, straight0_on, straight1_on }
wirehelp = false
desc_off = S("Redstone Trail (@1)", nodeid)
desc_on = S("Powered Redstone Trail (@1)", nodeid)

View File

@ -41,7 +41,7 @@ end
-- needs to be used up to repair the tool.
local function get_consumed_materials(tool, material)
local wear = tool:get_wear()
local health = (MAX_WEAR - wear)
--local health = (MAX_WEAR - wear)
local matsize = material:get_count()
local materials_used = 0
for m=1, math.min(4, matsize) do
@ -74,10 +74,9 @@ end
local function update_anvil_slots(meta)
local inv = meta:get_inventory()
local new_name = meta:get_string("set_name")
local input1, input2, output
input1 = inv:get_stack("input", 1)
input2 = inv:get_stack("input", 2)
output = inv:get_stack("output", 1)
local input1 = inv:get_stack("input", 1)
local input2 = inv:get_stack("input", 2)
--local output = inv:get_stack("output", 1)
local new_output, name_item
local just_rename = false
@ -243,7 +242,6 @@ end
-- Returns true if anvil was destroyed.
local function damage_anvil(pos)
local node = minetest.get_node(pos)
local new
if node.name == "mcl_anvils:anvil" then
minetest.swap_node(pos, {name="mcl_anvils:anvil_damage_1", param2=node.param2})
damage_particles(pos, node)
@ -278,7 +276,6 @@ local function damage_anvil_by_using(pos)
end
local function damage_anvil_by_falling(pos, distance)
local chance
local r = math.random(1, 100)
if distance > 1 then
if r <= (5*distance) then

View File

@ -426,7 +426,6 @@ local banner_pattern_craft = function(itemstack, player, old_craft_grid, craft_i
if (pitem == d and minetest.get_item_group(itemname, "dye") == 0) or (pitem == e and itemname ~= e and inv_i ~= banner_index) then
pattern_ok = false
break
else
end
inv_i = inv_i + 1
if inv_i > max_i then

View File

@ -48,7 +48,9 @@ local function rotate(pos, node, user, mode, new_param2)
return false
end
local new_dir, newp = minetest_facedir_to_dir(new_param2)
local newp
local new_dir = minetest_facedir_to_dir(new_param2)
if bottom then
newp = vector_add(pos, new_dir)
else
@ -153,7 +155,7 @@ function mcl_beds.register_bed(name, def)
paramtype2 = "facedir",
is_ground_content = false,
stack_max = 1,
groups = {handy=1, flammable = 3, bed = 1, dig_by_piston=1, bouncy=66, fall_damage_add_percent=-50, deco_block = 1, flammable=-1},
groups = {handy=1, bed = 1, dig_by_piston=1, bouncy=66, fall_damage_add_percent=-50, deco_block = 1, flammable=-1},
_mcl_hardness = 0.2,
_mcl_blast_resistance = 1,
sounds = def.sounds or default_sounds,

View File

@ -319,14 +319,14 @@ function mcl_beds.on_rightclick(pos, player, is_top)
-- move to bed
if not mcl_beds.player[name] then
local success, message
local message
if is_top then
success, message = lay_down(player, ppos, pos)
message = select(2, lay_down(player, ppos, pos))
else
local node = minetest.get_node(pos)
local dir = minetest.facedir_to_dir(node.param2)
local other = vector.add(pos, dir)
success, message = lay_down(player, ppos, other)
message = select(2, lay_down(player, ppos, other))
end
if message then
mcl_tmp_message.message(player, message)

View File

@ -238,11 +238,9 @@ minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craf
end
local original
local index
for i = 1, player:get_inventory():get_size("craft") do
if old_craft_grid[i]:get_name() == "mcl_books:written_book" then
original = old_craft_grid[i]
index = i
end
end
if not original then

View File

@ -1,29 +1,32 @@
local S = minetest.get_translator("mcl_bows")
local math = math
local vector = vector
-- Time in seconds after which a stuck arrow is deleted
local ARROW_TIMEOUT = 60
-- Time after which stuck arrow is rechecked for being stuck
local STUCK_RECHECK_TIME = 5
local GRAVITY = 9.81
--local GRAVITY = 9.81
local YAW_OFFSET = -math.pi/2
local dir_to_pitch = function(dir)
local dir2 = vector.normalize(dir)
local function dir_to_pitch(dir)
--local dir2 = vector.normalize(dir)
local xz = math.abs(dir.x) + math.abs(dir.z)
return -math.atan2(-dir.y, xz)
end
local random_arrow_positions = function(positions, placement)
if positions == 'x' then
local function random_arrow_positions(positions, placement)
if positions == "x" then
return math.random(-4, 4)
elseif positions == 'y' then
elseif positions == "y" then
return math.random(0, 10)
end
if placement == 'front' and positions == 'z' then
if placement == "front" and positions == "z" then
return 3
elseif placement == 'back' and positions == 'z' then
elseif placement == "back" and positions == "z" then
return -3
end
return 0
@ -257,12 +260,12 @@ ARROW_ENTITY.on_step = function(self, dtime)
damage_groups={fleshy=self._damage},
}, self.object:get_velocity())
if obj:is_player() then
local placement = ''
local placement
self._placement = math.random(1, 2)
if self._placement == 1 then
placement = 'front'
placement = "front"
else
placement = 'back'
placement = "back"
end
self._in_player = true
if self._placement == 2 then
@ -393,7 +396,7 @@ ARROW_ENTITY.on_step = function(self, dtime)
if not v then
v = 0
end
local old_v = self._viscosity
--local old_v = self._viscosity
self._viscosity = v
local vpenalty = math.max(0.1, 0.98 - 0.1 * v)
if math.abs(vel.x) > 0.001 then

View File

@ -228,11 +228,10 @@ end
controls.register_on_release(function(player, key, time)
if key~="RMB" then return end
local inv = minetest.get_inventory({type="player", name=player:get_player_name()})
--local inv = minetest.get_inventory({type="player", name=player:get_player_name()})
local wielditem = player:get_wielded_item()
if (wielditem:get_name()=="mcl_bows:bow_0" or wielditem:get_name()=="mcl_bows:bow_1" or wielditem:get_name()=="mcl_bows:bow_2" or
wielditem:get_name()=="mcl_bows:bow_0_enchanted" or wielditem:get_name()=="mcl_bows:bow_1_enchanted" or wielditem:get_name()=="mcl_bows:bow_2_enchanted") then
local has_shot = false
local enchanted = mcl_enchanting.is_enchanted(wielditem:get_name())
local speed, damage
@ -272,7 +271,7 @@ controls.register_on_release(function(player, key, time)
damage = math.max(1, math.floor(9 * charge_ratio))
end
has_shot = player_shoot_arrow(wielditem, player, speed, damage, is_critical)
local has_shot = player_shoot_arrow(wielditem, player, speed, damage, is_critical)
if enchanted then
wielditem:set_name("mcl_bows:bow_enchanted")
@ -299,7 +298,7 @@ controls.register_on_hold(function(player, key, time)
if key ~= "RMB" or not (creative or get_arrow(player)) then
return
end
local inv = minetest.get_inventory({type="player", name=name})
--local inv = minetest.get_inventory({type="player", name=name})
local wielditem = player:get_wielded_item()
if bow_load[name] == nil and (wielditem:get_name()=="mcl_bows:bow" or wielditem:get_name()=="mcl_bows:bow_enchanted") and wielditem:get_meta():get("active") and (creative or get_arrow(player)) then
local enchanted = mcl_enchanting.is_enchanted(wielditem:get_name())
@ -346,7 +345,7 @@ minetest.register_globalstep(function(dtime)
local name = player:get_player_name()
local wielditem = player:get_wielded_item()
local wieldindex = player:get_wield_index()
local controls = player:get_player_control()
--local controls = player:get_player_control()
if type(bow_load[name]) == "number" and ((wielditem:get_name()~="mcl_bows:bow_0" and wielditem:get_name()~="mcl_bows:bow_1" and wielditem:get_name()~="mcl_bows:bow_2" and wielditem:get_name()~="mcl_bows:bow_0_enchanted" and wielditem:get_name()~="mcl_bows:bow_1_enchanted" and wielditem:get_name()~="mcl_bows:bow_2_enchanted") or wieldindex ~= bow_index[name]) then
reset_bow_state(player, true)
end

View File

@ -61,14 +61,14 @@ local brewing_formspec = "size[9,8.75]"..
"listring[context;stand]"
local function swap_node(pos, name)
--[[local function swap_node(pos, name)
local node = minetest.get_node(pos)
if node.name == name then
return
end
node.name = name
minetest.swap_node(pos, node)
end
end]]
local function brewable(inv)
@ -110,12 +110,13 @@ local function brewing_stand_timer(pos, elapsed)
local BREW_TIME = 20 -- all brews brew the same
local BURN_TIME = BREW_TIME * 10
local input_item = meta:get_string("input_item") or ""
--local input_item = meta:get_string("input_item") or ""
local stand_timer = meta:get_float("stand_timer") or 0
local fuel = meta:get_float("fuel") or 0
local inv = meta:get_inventory()
local input_list, stand_list, fuel_list, brew_output, d
--local input_list, stand_list, fuel_list
local brew_output, d
local input_count, fuel_name, fuel_count, formspec, fuel_percent, brew_percent
local update = true
@ -124,9 +125,9 @@ local function brewing_stand_timer(pos, elapsed)
update = false
input_list = inv:get_list("input")
stand_list = inv:get_list("stand")
fuel_list = inv:get_list("fuel")
--input_list = inv:get_list("input")
--stand_list = inv:get_list("stand")
--fuel_list = inv:get_list("fuel")
-- TODO ... fix this. Goal is to reset the process if the stand changes
-- for i=1, inv:get_size("stand", i) do -- reset the process due to change
@ -237,7 +238,7 @@ local function brewing_stand_timer(pos, elapsed)
end
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
--[[local function allow_metadata_inventory_put(pos, listname, index, stack, player)
local name = player:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
@ -273,7 +274,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
elseif listname == "stand" then
return 0
end
end
end]]
-- Drop input items of brewing_stand at pos with metadata meta
@ -315,12 +316,14 @@ local doc_string =
S("When you have found a good combination, the brewing will commence automatically and steam starts to appear, using up the fuel and brewing material. The potions will soon be ready.").."\n"..
S("Different combinations of brewing materials and liquids will give different results. Try to experiment!")
local tiles = {"mcl_brewing_top.png", --top
local tiles = {
"mcl_brewing_top.png", --top
"mcl_brewing_base.png", --bottom
"mcl_brewing_side.png", --right
"mcl_brewing_side.png", --left
"mcl_brewing_side.png", --back
"mcl_brewing_side.png^[transformFX"} --front
"mcl_brewing_side.png^[transformFX", --front
}
local allow_put = function(pos, listname, index, stack, player)
local name = player:get_player_name()
@ -349,11 +352,11 @@ local on_put = function(pos, listname, index, stack, player)
--some code here to enforce only potions getting placed on stands
end
local after_dig = function(pos, oldnode, oldmetadata, digger)
--[[local after_dig = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
meta:from_table(oldmetadata)
drop_brewing_stand_items(pos, meta)
end
end]]
local on_destruct = function(pos)
local meta = minetest.get_meta(pos)

View File

@ -9,7 +9,7 @@ minetest.register_alias("bucket:bucket_lava", "mcl_buckets:bucket_lava")
local mod_doc = minetest.get_modpath("doc")
local mod_mcl_core = minetest.get_modpath("mcl_core")
local mod_mclx_core = minetest.get_modpath("mclx_core")
--local mod_mclx_core = minetest.get_modpath("mclx_core")
local vector = vector
local math = math

View File

@ -10,12 +10,12 @@ local sound_place = function(itemname, pos)
end
end
local sound_take = function(itemname, pos)
--[[local sound_take = function(itemname, pos)
local def = minetest.registered_nodes[itemname]
if def and def.sounds and def.sounds.dug then
minetest.sound_play(def.sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true)
end
end
end]]
if mod_mcl_core then
-- Lava bucket

View File

@ -162,13 +162,14 @@ Value:
Otherwise: nil ]]
local open_chests = {}
local function back_is_blocked(pos, dir)
--[[local function back_is_blocked(pos, dir)
pos = vector.add(pos, dir)
local def = minetest.registered_nodes[minetest.get_node(pos).name]
pos.y = pos.y + 1
local def2 = minetest.registered_nodes[minetest.get_node(pos).name]
return not def or def.groups.opaque == 1 or not def2 or def2.groups.opaque == 1
end
end]]
-- To be called if a player opened a chest
local player_chest_open = function(player, pos, node_name, textures, param2, double, sound, mesh, shulker)
local name = player:get_player_name()
@ -696,7 +697,6 @@ minetest.register_node("mcl_chests:"..basename.."_right", {
minetest.swap_node(p, { name = small_name, param2 = param2 })
create_entity(p, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest", "chest")
local meta = minetest.get_meta(pos)
end,
after_dig_node = drop_items_chest,
on_blast = on_chest_blast,
@ -898,7 +898,7 @@ register_chest("trapped_chest_on",
"trapped_chest"
)
local function close_if_trapped_chest(pos, player)
--[[local function close_if_trapped_chest(pos, player)
local node = minetest.get_node(pos)
if node.name == "mcl_chests:trapped_chest_on_small" then
@ -928,7 +928,7 @@ local function close_if_trapped_chest(pos, player)
player_chest_close(player)
end
end
end]]
-- Disable chest when it has been closed
minetest.register_on_player_receive_fields(function(player, formname, fields)
@ -1330,7 +1330,6 @@ minetest.register_craft({
-- Save metadata of shulker box when used in crafting
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
local new = itemstack:get_name()
if minetest.get_item_group(itemstack:get_name(), "shulker_box") ~= 1 then
return
end

View File

@ -96,8 +96,6 @@ minetest.register_globalstep(function(dtime)
for p, player in pairs(minetest.get_connected_players()) do
for s, stack in pairs(player:get_inventory():get_list("main")) do
local dim = mcl_worlds.pos_to_dimension(player:get_pos())
local frame
-- Clocks do not work in certain zones
if not mcl_worlds.clock_works(player:get_pos()) then

View File

@ -4,7 +4,8 @@ mcl_compass = {}
local compass_frames = 32
local default_spawn_settings = minetest.settings:get("static_spawnpoint")
--Not sure spawn point should be dymanic (is it in mc?)
--local default_spawn_settings = minetest.settings:get("static_spawnpoint")
-- Timer for random compass spinning
local random_timer = 0
@ -79,7 +80,9 @@ for i,img in ipairs(images) do
if i == stereotype_frame then
inv = 0
end
local use_doc, longdesc, usagehelp, tt
local use_doc, longdesc, tt
--Why is there no usage help? This should be fixed.
--local usagehelp
use_doc = i == stereotype_frame
if use_doc then
tt = S("Points to the world origin")
@ -91,7 +94,7 @@ for i,img in ipairs(images) do
_tt_help = tt,
_doc_items_create_entry = use_doc,
_doc_items_longdesc = longdesc,
_doc_items_usagehelp = usagehelp,
--_doc_items_usagehelp = usagehelp,
inventory_image = img,
wield_image = img,
stack_max = 64,

View File

@ -28,7 +28,6 @@ minetest.register_craftitem("mcl_core:coal_lump", {
description = S("Coal"),
_doc_items_longdesc = S("“Coal” refers to coal lumps obtained by digging coal ore which can be found underground. Coal is your standard furnace fuel, but it can also be used to make torches, coal blocks and a few other things."),
_doc_items_hidden = false,
groups = { coal=1 },
inventory_image = "default_coal_lump.png",
stack_max = 64,
groups = { craftitem=1, coal=1 },
@ -38,7 +37,6 @@ minetest.register_craftitem("mcl_core:charcoal_lump", {
description = S("Charcoal"),
_doc_items_longdesc = S("Charcoal is an alternative furnace fuel created by cooking wood in a furnace. It has the same burning time as coal and also shares many of its crafting recipes, but it can not be used to create coal blocks."),
_doc_items_hidden = false,
groups = { coal=1 },
inventory_image = "mcl_core_charcoal.png",
stack_max = 64,
groups = { craftitem=1, coal=1 },

View File

@ -23,8 +23,8 @@ minetest.register_abm({
local lavatype = minetest.registered_nodes[node.name].liquidtype
for w=1, #water do
local waternode = minetest.get_node(water[w])
local watertype = minetest.registered_nodes[waternode.name].liquidtype
--local waternode = minetest.get_node(water[w])
--local watertype = minetest.registered_nodes[waternode.name].liquidtype
-- Lava on top of water: Water turns into stone
if water[w].y < pos.y and water[w].x == pos.x and water[w].z == pos.z then
minetest.set_node(water[w], {name="mcl_core:stone"})
@ -336,13 +336,12 @@ end
-- oak tree.
function mcl_core.generate_tree(pos, tree_type, options)
pos.y = pos.y-1
local nodename = minetest.get_node(pos).name
--local nodename = minetest.get_node(pos).name
pos.y = pos.y+1
if not minetest.get_node_light(pos) then
return
end
local node
local two_by_two = options and options.two_by_two
local balloon = options and options.balloon
@ -390,7 +389,7 @@ end
function mcl_core.generate_v6_oak_tree(pos)
local trunk = "mcl_core:tree"
local leaves = "mcl_core:leaves"
local node = {name = ""}
local node
for dy=1,4 do
pos.y = pos.y+dy
if minetest.get_node(pos).name ~= "air" then
@ -409,10 +408,10 @@ function mcl_core.generate_v6_oak_tree(pos)
node = {name = leaves}
pos.y = pos.y+3
local rarity = 0
--[[local rarity = 0
if math.random(0, 10) == 3 then
rarity = 1
end
end]]
for dx=-2,2 do
for dz=-2,2 do
for dy=0,3 do
@ -787,7 +786,6 @@ minetest.register_abm({
if pos == nil then
return
end
local can_change = false
local above = {x=pos.x, y=pos.y+1, z=pos.z}
local abovenode = minetest.get_node(above)
if minetest.get_item_group(abovenode.name, "liquid") ~= 0 or minetest.get_item_group(abovenode.name, "opaque") == 1 then
@ -1021,7 +1019,7 @@ local sapling_grow_action = function(tree_id, soil_needed, one_by_one, two_by_tw
if one_by_one and check_tree_growth(pos, tree_id) then
-- Single sapling
minetest.set_node(pos, {name="air"})
local r = math.random(1, 12)
--local r = math.random(1, 12)
mcl_core.generate_tree(pos, tree_id)
return
end
@ -1418,7 +1416,7 @@ minetest.register_abm({
for s=1, #surround do
local spos = vector.add(p0, surround[s])
local maybe_vine = minetest.get_node(spos)
local surround_inverse = vector.multiply(surround[s], -1)
--local surround_inverse = vector.multiply(surround[s], -1)
if maybe_vine.name == "mcl_core:vine" and (not mcl_core.check_vines_supported(spos, maybe_vine)) then
minetest.remove_node(spos)
vinedecay_particles(spos, maybe_vine)

View File

@ -990,9 +990,8 @@ for i=1,8 do
local itemcount = itemstack:get_count()
local fakestack = ItemStack(itemstring.." "..itemcount)
fakestack:set_name("mcl_core:snow_"..math.min(8, (i+g)))
local success
itemstack, success = minetest.item_place(fakestack, placer, pointed_thing)
minetest.sound_play(mcl_sounds.node_sound_snow_defaults().place, {pos = below}, true)
itemstack = minetest.item_place(fakestack, placer, pointed_thing)
minetest.sound_play(mcl_sounds.node_sound_snow_defaults().place, {pos = pointed_thing.under}, true)
itemstack:set_name(itemstring)
return itemstack
end

View File

@ -120,7 +120,6 @@ minetest.register_node("mcl_core:vine", {
local node = minetest.get_node(under)
local def = minetest.registered_nodes[node.name]
if not def then return itemstack end
local groups = def.groups
-- Check special rightclick action of pointed node
if def and def.on_rightclick then

View File

@ -3,7 +3,10 @@
local S = minetest.get_translator("mcl_core")
local N = function(s) return s end
local WATER_ALPHA = 179
local vector = vector
local math = math
--local WATER_ALPHA = 179
local WATER_VISC = 1
local LAVA_VISC = 7
local LIGHT_LAVA = minetest.LIGHT_MAX
@ -215,7 +218,7 @@ local emit_lava_particle = function(pos)
return
end
local ppos = vector.add(pos, { x = math.random(-7, 7)/16, y = 0.45, z = math.random(-7, 7)/16})
local spos = vector.add(ppos, { x = 0, y = -0.2, z = 0 })
--local spos = vector.add(ppos, { x = 0, y = -0.2, z = 0 })
local vel = { x = math.random(-3, 3)/10, y = math.random(4, 7), z = math.random(-3, 3)/10 }
local acc = { x = 0, y = -9.81, z = 0 }
-- Lava droplet

View File

@ -39,7 +39,6 @@ minetest.register_node("mcl_core:slimeblock", {
type = "regular",
},
tiles = {"mcl_core_slime.png"},
paramtype = "light",
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "blend" or true,
stack_max = 64,
-- According to Minecraft Wiki, bouncing off a slime block from a height off 255 blocks should result in a bounce height of 50 blocks

View File

@ -107,7 +107,6 @@ local register_wooden_planks = function(subname, description, tiles)
end
local register_leaves = function(subname, description, longdesc, tiles, sapling, drop_apples, sapling_chances, leafdecay_distance)
local drop
if leafdecay_distance == nil then
leafdecay_distance = 4
end

View File

@ -98,13 +98,11 @@ function mcl_doors:register_trapdoor(name, def)
if not usagehelp and not def.only_redstone_can_open then
usagehelp = S("To open or close this trapdoor, rightclick it or send a redstone signal to it.")
end
if not tt_help then
if def.only_redstone_can_open then
tt_help = S("Openable by redstone power")
else
tt_help = S("Openable by players and redstone power")
end
end
-- Closed trapdoor
@ -164,7 +162,7 @@ function mcl_doors:register_trapdoor(name, def)
local fpos = get_fpos(placer, pointed_thing)
local origname = itemstack:get_name()
--local origname = itemstack:get_name()
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
or (fpos < -0.5 and fpos > -0.999999999) then
param2 = param2 + 20

View File

@ -250,7 +250,7 @@ local function get_after_use_callback(itemdef)
itemstack:add_wear(digparams.wear)
end
local enchantments = mcl_enchanting.get_enchantments(itemstack)
--local enchantments = mcl_enchanting.get_enchantments(itemstack)
mcl_enchanting.update_groupcaps(itemstack)
end
end
@ -292,7 +292,7 @@ end
function mcl_enchanting.get_possible_enchantments(itemstack, enchantment_level, treasure)
local possible_enchantments, weights, accum_weight = {}, {}, 0
for enchantment, enchantment_def in pairs(mcl_enchanting.enchantments) do
local supported, _, _, primary = mcl_enchanting.can_enchant(itemstack, enchantment, 1)
local _, _, _, primary = mcl_enchanting.can_enchant(itemstack, enchantment, 1)
if primary or treasure then
table.insert(possible_enchantments, enchantment)
accum_weight = accum_weight + enchantment_def.weight

View File

@ -1,6 +1,9 @@
local modpath = minetest.get_modpath("mcl_enchanting")
local S = minetest.get_translator("mcl_enchanting")
local math = math
local vector = vector
mcl_enchanting = {
book_offset = vector.new(0, 0.75, 0),
book_animations = {["close"] = 1, ["opening"] = 2, ["open"] = 3, ["closing"] = 4},
@ -122,7 +125,7 @@ minetest.register_chatcommand("forceenchant", {
return false, S("Player '@1' cannot be found.", target_name)
end
local itemstack = target:get_wielded_item()
local can_enchant, errorstring, extra_info = mcl_enchanting.can_enchant(itemstack, enchantment, level)
local _, errorstring = mcl_enchanting.can_enchant(itemstack, enchantment, level)
if errorstring == "enchantment invalid" then
return false, S("There is no such enchantment '@1'.", enchantment)
elseif errorstring == "item missing" then
@ -242,9 +245,9 @@ minetest.register_node("mcl_enchanting:table", {
on_rotate = rotate,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local player_meta = clicker:get_meta()
local table_meta = minetest.get_meta(pos)
local num_bookshelves = table_meta:get_int("mcl_enchanting:num_bookshelves")
local table_name = table_meta:get_string("name")
--local table_meta = minetest.get_meta(pos)
--local num_bookshelves = table_meta:get_int("mcl_enchanting:num_bookshelves")
local table_name = minetest.get_meta(pos):get_string("name")
if table_name == "" then
table_name = S("Enchant")
end

View File

@ -29,7 +29,7 @@ local no_detach = {}
-- This detaches all chorus plants that are/were attached
-- at start_pos.
mcl_end.detach_chorus_plant = function(start_pos, digger)
function mcl_end.detach_chorus_plant(start_pos, digger)
-- This node should not call a detach function, do NOTHING
local hash = minetest.hash_node_position(start_pos)
if no_detach[hash] ~= nil then
@ -106,11 +106,11 @@ mcl_end.detach_chorus_plant = function(start_pos, digger)
no_detach = {}
end
mcl_end.check_detach_chorus_plant = function(pos, oldnode, oldmetadata, digger)
function mcl_end.check_detach_chorus_plant(pos, oldnode, oldmetadata, digger)
mcl_end.detach_chorus_plant(pos, digger)
end
mcl_end.check_blast_chorus_plant = function(pos)
function mcl_end.check_blast_chorus_plant(pos)
minetest.remove_node(pos)
mcl_end.detach_chorus_plant(pos)
end
@ -139,7 +139,7 @@ minetest.register_node("mcl_end:chorus_flower", {
node_placement_prediction = "",
on_place = function(itemstack, placer, pointed_thing)
local node_under = minetest.get_node(pointed_thing.under)
local node_above = minetest.get_node(pointed_thing.above)
--local node_above = minetest.get_node(pointed_thing.above)
if placer and not placer:get_player_control().sneak then
-- Use pointed node's on_rightclick function first, if present
if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then
@ -309,7 +309,7 @@ minetest.register_node("mcl_end:chorus_plant", {
})
-- Grow a complete chorus plant at pos
mcl_end.grow_chorus_plant = function(pos, node, pr)
function mcl_end.grow_chorus_plant(pos, node, pr)
local flowers = { pos }
-- Plant initial flower (if it isn't there already)
if not node then
@ -340,7 +340,7 @@ end
-- Grow a single step of a chorus plant at pos.
-- Pos must be a chorus flower.
mcl_end.grow_chorus_plant_step = function(pos, node, pr)
function mcl_end.grow_chorus_plant_step(pos, node, pr)
local new_flower_buds = {}
local above = { x = pos.x, y = pos.y + 1, z = pos.z }
local node_above = minetest.get_node(above)
@ -408,7 +408,6 @@ mcl_end.grow_chorus_plant_step = function(pos, node, pr)
elseif branching == true then
branches = pr:next(0, 3)
end
local branch_grown = false
for b=1, branches do
local next_branch = pr:next(1, #around)
local branch = vector.add(pos, around[next_branch])

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("mcl_end")
local vector = vector
local explosion_strength = 6
local directions = {
@ -45,7 +47,7 @@ local function set_crystal_animation(self)
end
local function spawn_crystal(pos)
local crystal = minetest.add_entity(pos, "mcl_end:crystal")
minetest.add_entity(pos, "mcl_end:crystal")
if not vector.equals(pos, vector.floor(pos)) then return end
if mcl_worlds.pos_to_dimension(pos) ~= "end" then return end
local portal_center

View File

@ -161,7 +161,7 @@ function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname)
if string.find(farmland.name, "mcl_farming:soil") and string.find(place_s.name, "air") then
minetest.sound_play(minetest.registered_nodes[plantname].sounds.place, {pos = pos}, true)
minetest.add_node(pos, {name=plantname, param2 = minetest.registered_nodes[plantname].place_param2})
local intervals_counter = get_intervals_counter(pos, 1, 1)
--local intervals_counter = get_intervals_counter(pos, 1, 1)
else
return
end

View File

@ -1,7 +1,5 @@
local S = minetest.get_translator("mcl_fireworks")
local player_rocketing = {}
local tt_help = S("Flight Duration:")
local description = S("Firework Rocket")

View File

@ -2,6 +2,8 @@
local S = minetest.get_translator("mcl_fishing")
local math = math
local bobber_ENTITY={
physical = false,
timer=0,
@ -34,9 +36,8 @@ local fish = function(itemstack, player, pointed_thing)
local pos = player:get_pos()
local objs = minetest.get_objects_inside_radius(pos, 125)
local num = 0
local ent = nil
local noent = true
local ent
local noent = false
local durability = 65
local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking")
@ -50,11 +51,8 @@ local fish = function(itemstack, player, pointed_thing)
if ent then
if ent.player and ent.objtype=="fishing" then
if (player:get_player_name() == ent.player) then
noent = false
if ent._dive == true then
local itemname
local items
local itemcount = 1
local pr = PseudoRandom(os.time() * math.random(1, 100))
local r = pr:next(1, 100)
local fish_values = {85, 84.8, 84.7, 84.5}
@ -145,7 +143,8 @@ local fish = function(itemstack, player, pointed_thing)
end
--Destroy bobber.
ent.object:remove()
return itemstack
noent = false
break
end
end
end
@ -163,11 +162,12 @@ local fish = function(itemstack, player, pointed_thing)
end
end
--If no bobber or flying_bobber exists then throw bobber.
if noent == true then
if noent then
local playerpos = player:get_pos()
local dir = player:get_look_dir()
mcl_throwing.throw("mcl_fishing:flying_bobber", {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, 15, player:get_player_name())
end
return itemstack
end
-- Movement function of bobber
@ -334,13 +334,11 @@ minetest.register_entity("mcl_fishing:flying_bobber_entity", flying_bobber_ENTIT
mcl_throwing.register_throwable_object("mcl_fishing:flying_bobber", "mcl_fishing:flying_bobber_entity", 5)
-- If player leaves area, remove bobber.
minetest.register_on_leaveplayer(function(player)
local function remove_bobber(player)
local objs = minetest.get_objects_inside_radius(player:get_pos(), 250)
local ent = nil
local noent = true
for n = 1, #objs do
ent = objs[n]:get_luaentity()
local ent = objs[n]:get_luaentity()
if ent then
if ent.player and ent.objtype=="fishing" then
ent.object:remove()
@ -349,26 +347,13 @@ minetest.register_on_leaveplayer(function(player)
end
end
end
end)
end
-- If player leaves area, remove bobber.
minetest.register_on_leaveplayer(remove_bobber)
-- If player dies, remove bobber.
minetest.register_on_dieplayer(function(player)
local objs = minetest.get_objects_inside_radius(player:get_pos(), 250)
local num = 0
local ent = nil
local noent = true
for n = 1, #objs do
ent = objs[n]:get_luaentity()
if ent then
if ent.player and ent.objtype=="fishing" then
ent.object:remove()
elseif ent._thrower and ent.objtype=="fishing" then
ent.object:remove()
end
end
end
end)
minetest.register_on_dieplayer(remove_bobber)
-- Fishing Rod
minetest.register_tool("mcl_fishing:fishing_rod", {

View File

@ -180,12 +180,12 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
if not inv_img then
inv_img = top_img
end
local noncreative, create_entry, paramtype2, palette
local create_entry, paramtype2, palette
if is_flower == nil then
is_flower = true
end
local bottom_groups = {flammable=2,fire_encouragement=60,fire_flammability=100, non_mycelium_plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1, plant=1,double_plant=1,deco_block=1,not_in_creative_inventory=noncreative}
local bottom_groups = {flammable=2, fire_encouragement=60, fire_flammability=100, non_mycelium_plant=1, attached_node=1, dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1, plant=1, double_plant=1, deco_block=1}
if is_flower then
bottom_groups.flower = 1
bottom_groups.place_flowerlike = 1
@ -200,7 +200,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
palette = "mcl_core_palette_grass.png"
end
if longdesc == nil then
noncreative = 1
bottom_groups.not_in_creative_inventory = 1
create_entry = false
end
-- Drop itself by default

View File

@ -91,7 +91,7 @@ local function addhead(name, texture, desc, longdesc, rangemob, rangefactor)
local itemstring = itemstack:get_name()
local fakestack = ItemStack(itemstack)
local idef = fakestack:get_definition()
--local idef = fakestack:get_definition()
local retval
if wdir == 0 or wdir == 1 then
return minetest.item_place(itemstack, placer, pointed_thing)
@ -101,7 +101,7 @@ local function addhead(name, texture, desc, longdesc, rangemob, rangefactor)
if not retval then
return itemstack
end
itemstack,_ = minetest.item_place(fakestack, placer, pointed_thing, wdir)
itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir)
itemstack:set_name(itemstring)
return itemstack
end,

View File

@ -276,12 +276,12 @@ minetest.register_node("mcl_itemframes:item_frame",{
on_rotate = function(pos, node, user, mode, param2)
if mode == screwdriver.ROTATE_FACE then
-- Rotate face
local meta = minetest.get_meta(pos)
--local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos)
local objs = nil
if node.name == "mcl_itemframes:item_frame" then
objs = minetest.get_objects_inside_radius(pos, .5)
objs = minetest.get_objects_inside_radius(pos, 0.5)
end
if objs then
for _, obj in ipairs(objs) do

View File

@ -72,7 +72,6 @@ local function now_playing(player, name)
active_huds[playername] = nil
end
end, {playername, id, hud_sequence_numbers[playername]})
end
minetest.register_on_leaveplayer(function(player)

View File

@ -5,7 +5,7 @@ local storage = minetest.get_mod_storage()
local modpath = minetest.get_modpath("mcl_maps")
local worldpath = minetest.get_worldpath()
local map_textures_path = worldpath .. "/mcl_maps/"
local last_finished_id = storage:get_int("next_id") - 1
--local last_finished_id = storage:get_int("next_id") - 1
minetest.mkdir(map_textures_path)

View File

@ -1,11 +1,14 @@
local S = minetest.get_translator("mcl_mobspawners")
local math = math
local table = table
mcl_mobspawners = {}
local default_mob = "mobs_mc:pig"
-- Mob spawner
local spawner_default = default_mob.." 0 15 4 15"
--local spawner_default = default_mob.." 0 15 4 15"
local function get_mob_textures(mob)
local list = minetest.registered_entities[mob].texture_list
@ -160,7 +163,7 @@ local spawn_mobs = function(pos, elapsed)
-- check objects inside 8×8 area around spawner
local objs = minetest.get_objects_inside_radius(pos, 8)
local count = 0
local ent = nil
local ent
local timer = minetest.get_node_timer(pos)

View File

@ -38,7 +38,7 @@ local mt_is_creative_enabled = minetest.is_creative_enabled
local mt_sound_play = minetest.sound_play
local math = math
local string = string
--local string = string
local table = table
-- DEBUG: functions
@ -422,7 +422,7 @@ end
function kelp.surface_after_dig_node(pos, node)
return mt_set_node(pos, {name=registred_nodes[node.name].node_dig_prediction})
return mt_set_node(pos, {name=minetest.registered_nodes[node.name].node_dig_prediction})
end
@ -759,7 +759,6 @@ minetest.register_craftitem("mcl_ocean:dried_kelp", {
groups = { food = 2, eatable = 1 },
on_place = minetest.item_eat(1),
on_secondary_use = minetest.item_eat(1),
groups = { food = 2, eatable = 1 },
_mcl_saturation = 0.6,
})

View File

@ -12,7 +12,7 @@ local function sea_pickle_on_place(itemstack, placer, pointed_thing)
local node_under = minetest.get_node(pos_under)
local node_above = minetest.get_node(pos_above)
local def_under = minetest.registered_nodes[node_under.name]
local def_above = minetest.registered_nodes[node_above.name]
--local def_above = minetest.registered_nodes[node_above.name]
if def_under and def_under.on_rightclick and not placer:get_player_control().sneak then
return def_under.on_rightclick(pos_under, node_under,

View File

@ -105,7 +105,7 @@ for s=1, #surfaces do
doc_longdesc = S("Seagrass grows inside water on top of dirt, sand or gravel.")
desc = S("Seagrass")
doc_create = true
doc_img = "mcl_ocean_seagrass.png"
doc_img = "mcl_ocean_seagrass.png^[verticalframe:12:0"
else
doc_create = false
end
@ -113,7 +113,7 @@ for s=1, #surfaces do
_doc_items_entry_name = desc,
_doc_items_longdesc = doc_longdesc,
_doc_items_create_entry = doc_create,
_doc_items_image = "mcl_ocean_seagrass.png^[verticalframe:12:0",
_doc_items_image = doc_img,
drawtype = "plantlike_rooted",
paramtype = "light",
paramtype2 = "meshoptions",

View File

@ -1,10 +1,14 @@
local S = minetest.get_translator("mcl_portals")
-- Parameters
local SPAWN_MIN = mcl_vars.mg_end_min+70
local SPAWN_MAX = mcl_vars.mg_end_min+98
local table = table
local vector = vector
local math = math
local mg_name = minetest.get_mapgen_setting("mg_name")
-- Parameters
--local SPAWN_MIN = mcl_vars.mg_end_min+70
--local SPAWN_MAX = mcl_vars.mg_end_min+98
--local mg_name = minetest.get_mapgen_setting("mg_name")
local destroy_portal = function(pos)
local neighbors = {
@ -196,7 +200,6 @@ function mcl_portals.end_teleport(obj, pos)
end
end
local platform
build_end_portal_destination(platform_pos)
check_and_build_end_portal_destination(platform_pos)

View File

@ -137,8 +137,20 @@ local function find_exit(p, dx, dy, dz)
if not p or not p.y or not p.z or not p.x then return end
local dx, dy, dz = dx or DISTANCE_MAX, dy or DISTANCE_MAX, dz or DISTANCE_MAX
if dx < 1 or dy < 1 or dz < 1 then return false end
local x, y, z = floor(p.x), floor(p.y), floor(p.z)
local x1, y1, z1, x2, y2, z2 = x-dx+1, y-dy+1, z-dz+1, x+dx-1, y+dy-1, z+dz-1
--y values aren't used
local x = floor(p.x)
--local y = floor(p.y)
local z = floor(p.z)
local x1 = x-dx+1
--local y1 = y-dy+1
local z1 = z-dz+1
local x2 = x+dx-1
--local y2 = y+dy-1
local z2 = z+dz-1
local k1x, k2x = floor(x1/256), floor(x2/256)
local k1z, k2z = floor(z1/256), floor(z2/256)
@ -371,7 +383,7 @@ local function finalize_teleport(obj, exit)
if is_player then
name = obj:get_player_name()
end
local y, dim = mcl_worlds.y_to_layer(exit.y)
local _, dim = mcl_worlds.y_to_layer(exit.y)
-- If player stands, player is at ca. something+0.5 which might cause precision problems, so we used ceil for objpos.y

View File

@ -558,8 +558,8 @@ function mcl_potions.make_invisible(player, toggle)
local is_player = player:is_player()
local entity = player:get_luaentity()
local playername = player:get_player_name()
local skin_file = ""
--local playername = player:get_player_name()
local skin_file
if toggle then -- hide player
@ -567,22 +567,22 @@ function mcl_potions.make_invisible(player, toggle)
if entity then
EF.invisible[player].old_size = entity.visual_size
elseif not player:is_player() then -- if not a player or entity, do nothing
elseif not is_player then -- if not a player or entity, do nothing
return
end
if player:is_player() then
mcl_player.player_set_skin(player, "mobs_mc_empty.png")
elseif not player:is_player() then
if is_player then
mcl_player.player_set_skin(player, skin_file)
elseif not is_player then
player:set_properties({visual_size = {x = 0, y = 0}})
end
player:set_nametag_attributes({color = {a = 0}})
elseif EF.invisible[player] then -- show player
if player:is_player() then
if is_player then
mcl_skins.update_player_skin(player)
elseif not player:is_player() then
elseif not is_player then
player:set_properties({visual_size = EF.invisible[player].old_size})
end
player:set_nametag_attributes({color = {r = 255, g = 255, b = 255, a = 255}})

View File

@ -114,7 +114,7 @@ function TNT:on_activate(staticdata)
self.object:set_texture_mod("^mcl_tnt_blink.png")
end
local function add_effects(pos, radius, drops)
--[[local function add_effects(pos, radius, drops)
minetest.add_particlespawner({
amount = 64,
time = 0.5,
@ -161,7 +161,7 @@ local function add_effects(pos, radius, drops)
texture = texture,
collisiondetection = true,
})
end
end]]
function TNT:on_step(dtime)
local pos = self.object:get_pos()

View File

@ -3580,7 +3580,8 @@ local function register_decorations()
local fern_minimal = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Taiga", "MegaTaiga", "MegaSpruceTaiga", "ColdTaiga" }
local fern_low = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Taiga", "MegaTaiga", "MegaSpruceTaiga" }
local fern_Jungle = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM" }
local fern_JungleM = { "JungleM" },
--local fern_JungleM = { "JungleM" },
register_grass_decoration("fern", -0.03, 0.09, fern_minimal)
register_grass_decoration("fern", -0.015, 0.075, fern_minimal)
register_grass_decoration("fern", 0, 0.06, fern_minimal)
@ -3591,7 +3592,7 @@ local function register_decorations()
register_grass_decoration("fern", 0.05, 0.01, fern_Jungle)
register_grass_decoration("fern", 0.07, -0.01, fern_Jungle)
register_grass_decoration("fern", 0.09, -0.03, fern_Jungle)
register_grass_decoration("fern", 0.12, -0.03, fern_JungleM)
register_grass_decoration("fern", 0.12, -0.03, {"JungleM"})
local b_seagrass = {"ColdTaiga_ocean","ExtremeHills_ocean","ExtremeHillsM_ocean","ExtremeHills+_ocean","Taiga_ocean","MegaTaiga_ocean","MegaSpruceTaiga_ocean","StoneBeach_ocean","Plains_ocean","SunflowerPlains_ocean","Forest_ocean","FlowerForest_ocean","BirchForest_ocean","BirchForestM_ocean","RoofedForest_ocean","Swampland_ocean","Jungle_ocean","JungleM_ocean","JungleEdge_ocean","JungleEdgeM_ocean","MushroomIsland_ocean","Desert_ocean","Savanna_ocean","SavannaM_ocean","Mesa_ocean","MesaBryce_ocean","MesaPlateauF_ocean","MesaPlateauFM_ocean",
"ColdTaiga_deep_ocean","ExtremeHills_deep_ocean","ExtremeHillsM_deep_ocean","ExtremeHills+_deep_ocean","Taiga_deep_ocean","MegaTaiga_deep_ocean","MegaSpruceTaiga_deep_ocean","StoneBeach_deep_ocean","Plains_deep_ocean","SunflowerPlains_deep_ocean","Forest_deep_ocean","FlowerForest_deep_ocean","BirchForest_deep_ocean","BirchForestM_deep_ocean","RoofedForest_deep_ocean","Swampland_deep_ocean","Jungle_deep_ocean","JungleM_deep_ocean","JungleEdge_deep_ocean","JungleEdgeM_deep_ocean","MushroomIsland_deep_ocean","Desert_deep_ocean","Savanna_deep_ocean","SavannaM_deep_ocean","Mesa_deep_ocean","MesaBryce_deep_ocean","MesaPlateauF_deep_ocean","MesaPlateauFM_deep_ocean",
@ -3974,7 +3975,7 @@ if mg_name ~= "singlenode" then
mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed)
local gennotify = minetest.get_mapgen_object("gennotify")
--local poslist = {}
pr = PseudoRandom(blockseed + 14)
local pr = PseudoRandom(blockseed + 14)
for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do
local x, y, z = pos.x, pos.y, pos.z
if x < -2 or x > 2 or z < -2 or z > 2 then

View File

@ -1904,7 +1904,7 @@ function mcl_mapgen_core.unregister_generator(id)
if rec.vf then lvm = lvm - 1 end
if rec.nf then nodes = nodes - 1 end
if rec.needs_param2 then param2 = param2 - 1 end
if rec.needs_level0 then level0 = level0 - 1 end
--if rec.needs_level0 then level0 = level0 - 1 end
end
-- Generate basic layer-based nodes: void, bedrock, realm barrier, lava seas, etc.

View File

@ -1,4 +1,4 @@
local S = minetest.get_translator("mcl_hunger")
--local S = minetest.get_translator("mcl_hunger")
-- wrapper for minetest.item_eat (this way we make sure other mods can't break this one)
minetest.do_item_eat = function(hp_change, replace_with_item, itemstack, user, pointed_thing)

View File

@ -1,5 +1,3 @@
local S = minetest.get_translator("mcl_playerplus")
mcl_playerplus = {
elytra = {},
}

View File

@ -1,3 +0,0 @@
# textdomain: mcl_playerplus
@1 suffocated to death.=@1 erstickte zu Tode.
@1 was prickled to death by a cactus.=@1 wurde von einem Kaktus zu Tode gepiekst.

View File

@ -1,3 +0,0 @@
# textdomain: mcl_playerplus
@1 suffocated to death.=@1 ahogado hasta la muerte.
@1 was prickled to death by a cactus.=@1 fue herido de muerte por un cactus.

View File

@ -1,3 +0,0 @@
# textdomain: mcl_playerplus
@1 suffocated to death.=@1 étouffé à mort.
@1 was prickled to death by a cactus.=@1 a été piqué à mort par un cactus.

View File

@ -1,3 +0,0 @@
# textdomain: mcl_playerplus
@1 suffocated to death.=@1 задохнулся(ась).
@1 was prickled to death by a cactus.=@1 был(а) до смерти заколот(а) кактусом.

View File

@ -1,3 +0,0 @@
# textdomain: mcl_playerplus
@1 suffocated to death.=
@1 was prickled to death by a cactus.=

Some files were not shown because too many files have changed in this diff Show More