master #5

Merged
NO11 merged 42 commits from VoxeLibre/VoxeLibre:master into master 2021-08-11 17:38:46 +02:00
110 changed files with 1295 additions and 1313 deletions
Showing only changes of commit 91ac70cf28 - Show all commits

View File

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

View File

@ -3,7 +3,7 @@ local TS = 16 -- texture size
mcl_paintings.paintings = { mcl_paintings.paintings = {
[1] = { [1] = {
[1] = { [1] = {
{ cx = 0, cy = 0 }, { cx = 0, cy = 0 },
{ cx = TS, cy = 0 }, { cx = TS, cy = 0 },
{ cx = 2*TS, cy = 0 }, { cx = 2*TS, cy = 0 },
{ cx = 3*TS, cy = 0 }, { cx = 3*TS, cy = 0 },

View File

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

View File

@ -6,7 +6,7 @@
-- NOTE: Strings intentionally not marked for translation, other mods already have these items. -- 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: 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 --maikerumines throwing code
--arrow (weapon) --arrow (weapon)

View File

@ -3,8 +3,9 @@
-- NOTE: Strings intentionally not marked for translation, other mods already have these items. -- 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: 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 -- Heads system

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@ mobs:register_mob("mobs_mc:guardian", {
xp_min = 10, xp_min = 10,
xp_max = 10, xp_max = 10,
breath_max = -1, breath_max = -1,
passive = false, passive = false,
attack_type = "punch", attack_type = "punch",
pathfinding = 1, pathfinding = 1,
view_range = 16, view_range = 16,
@ -94,7 +94,6 @@ mobs:register_mob("mobs_mc:guardian", {
makes_footstep_sound = false, makes_footstep_sound = false,
fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source }, fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source },
jump = false, jump = false,
view_range = 16,
}) })
-- Spawning disabled due to size issues -- Spawning disabled due to size issues

View File

@ -104,7 +104,6 @@ mobs:register_mob("mobs_mc:guardian_elder", {
makes_footstep_sound = false, makes_footstep_sound = false,
fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source }, fly_in = { mobs_mc.items.water_source, mobs_mc.items.river_water_source },
jump = false, jump = false,
view_range = 16,
}) })
-- Spawning disabled due to size issues <- what do you mean? -j4i -- 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) 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" return entity_id == "mobs_mc:horse" or entity_id == "mobs_mc:skeleton_horse" or entity_id == "mobs_mc:zombie_horse"
end 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" return entity_id == "mobs_mc:mule" or entity_id == "mobs_mc:donkey"
end end]]
local can_breed = function(entity_id) local can_breed = function(entity_id)
return entity_id == "mobs_mc:horse" or "mobs_mc:mule" or entity_id == "mobs_mc:donkey" return entity_id == "mobs_mc:horse" or "mobs_mc:mule" or entity_id == "mobs_mc:donkey"
end end
@ -314,7 +314,7 @@ local horse = {
-- Make sure tamed horse is mature and being clicked by owner only -- 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 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 -- detatch player already riding horse
if self.driver and clicker == self.driver then if self.driver and clicker == self.driver then

View File

@ -307,9 +307,9 @@ mobs:register_arrow("mobs_mc:spit", {
tail_distance_divider = 4, tail_distance_divider = 4,
hit_player = function(self, player) 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" armor.last_damage_types[player:get_player_name()] = "spit"
end end]]
player:punch(self.object, 1.0, { player:punch(self.object, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,
damage_groups = {fleshy = self._damage}, damage_groups = {fleshy = self._damage},
@ -319,7 +319,7 @@ mobs:register_arrow("mobs_mc:spit", {
hit_mob = function(self, mob) hit_mob = function(self, mob)
mob:punch(self.object, 1.0, { mob:punch(self.object, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,
damage_groups = {fleshy = _damage}, damage_groups = {fleshy = self._damage},
}, nil) }, nil)
end, end,

View File

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

View File

@ -44,7 +44,7 @@ mobs:register_mob("mobs_mc:parrot", {
max = 2, max = 2,
looting = "common",}, looting = "common",},
}, },
animation = { animation = {
stand_speed = 50, stand_speed = 50,
walk_speed = 50, walk_speed = 50,
fly_speed = 50, fly_speed = 50,

View File

@ -163,7 +163,7 @@ mobs:register_mob("mobs_mc:pig", {
end end
-- Mount or detach player -- Mount or detach player
local name = clicker:get_player_name() --local name = clicker:get_player_name()
if self.driver and clicker == self.driver then if self.driver and clicker == self.driver then
-- Detach if already attached -- Detach if already attached
mobs.detach(clicker, {x=1, y=0, z=0}) 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) do_custom = function(self, dtime)
if not self.initial_color_set then if not self.initial_color_set then
local r = math.random(0,100000) local r = math.random(0,100000)
local textures
if r <= 81836 then if r <= 81836 then
-- 81.836% -- 81.836%
self.color = "unicolor_white" self.color = "unicolor_white"

View File

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

View File

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

View File

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

View File

@ -26,7 +26,6 @@ mobs:register_mob("mobs_mc:wither", {
{"mobs_mc_wither.png"}, {"mobs_mc_wither.png"},
}, },
visual_size = {x=4, y=4}, visual_size = {x=4, y=4},
makes_footstep_sound = true,
view_range = 16, view_range = 16,
fear_height = 4, fear_height = 4,
walk_velocity = 2, walk_velocity = 2,
@ -81,7 +80,7 @@ mobs:register_mob("mobs_mc:wither", {
end, 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", { mobs:register_arrow("mobs_mc:wither_skull", {
visual = "sprite", visual = "sprite",

View File

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

View File

@ -200,14 +200,14 @@ end
mobs_mc.override.enderman_block_texture_overrides = { mobs_mc.override.enderman_block_texture_overrides = {
["mcl_core:cactus"] = ctable, ["mcl_core:cactus"] = ctable,
-- FIXME: replace colorize colors with colors from palette -- 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",
"mcl_core_grass_block_top.png^[colorize:green:90", "default_dirt.png",
"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)",
"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 -- 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) sound_play({ name = "lightning_thunder", gain = 10 }, { pos = pos, max_hear_distance = 500 }, true)
-- damage nearby objects, transform mobs -- damage nearby objects, transform mobs
-- TODO: use an API insteed of hardcoding this behaviour
local objs = get_objects_inside_radius(pos2, 3.5) local objs = get_objects_inside_radius(pos2, 3.5)
for o=1, #objs do for o=1, #objs do
local obj = objs[o] local obj = objs[o]
@ -153,7 +154,7 @@ lightning.strike = function(pos)
end end
obj:set_properties({textures = lua.base_texture}) obj:set_properties({textures = lua.base_texture})
-- villager → witch (no damage) -- 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 -- Witches are incomplete, this code is unused
-- TODO: Enable this code when witches are working. -- TODO: Enable this code when witches are working.
--[[ --[[

View File

@ -4,11 +4,9 @@ local SHEET_W = 4
local SHEET_H = 2 local SHEET_H = 2
-- Randomize initial moon phase, based on map seed -- Randomize initial moon phase, based on map seed
local phase_offset
local mg_seed = minetest.get_mapgen_setting("seed") local mg_seed = minetest.get_mapgen_setting("seed")
local rand = PseudoRandom(mg_seed) local rand = PseudoRandom(mg_seed)
local phase_offset = rand:next(0, MOON_PHASES - 1) local phase_offset = rand:next(0, MOON_PHASES - 1)
rand = nil
minetest.log("info", "[mcl_moon] Moon phase offset of this world: "..phase_offset) 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 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 pos_to_dim = mcl_worlds.pos_to_dimension
local dim_change = mcl_worlds.dimension_change local dim_change = mcl_worlds.dimension_change
@ -39,9 +39,9 @@ minetest.register_on_mods_loaded(function()
end end
self._void_timer = 0 self._void_timer = 0
local void, void_deadly = is_in_void(pos) local _, void_deadly = is_in_void(pos)
if void_deadly then if void_deadly then
local ent = obj:get_luaentity() --local ent = obj:get_luaentity()
obj:remove() obj:remove()
return return
end end
@ -61,7 +61,7 @@ minetest.register_globalstep(function(dtime)
for p=1, #players do for p=1, #players do
local player = players[p] local player = players[p]
local pos = player:get_pos() local pos = player:get_pos()
local void, void_deadly = is_in_void(pos) local _, void_deadly = is_in_void(pos)
if void_deadly then if void_deadly then
local immortal_val = player:get_armor_groups().immortal local immortal_val = player:get_armor_groups().immortal
local is_immortal = false local is_immortal = false

View File

@ -249,7 +249,7 @@ if mcl_weather.allow_abm then
end end
end end
end end
}) })
-- Wetten the soil -- Wetten the soil
minetest.register_abm({ minetest.register_abm({
@ -264,7 +264,7 @@ if mcl_weather.allow_abm then
end end
end end
end end
}) })
end end
if mcl_weather.reg_weathers.rain == nil then if mcl_weather.reg_weathers.rain == nil then

View File

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

View File

@ -7,78 +7,78 @@ mcl_weather.snow.init_done = false
-- calculates coordinates and draw particles for snow weather -- calculates coordinates and draw particles for snow weather
mcl_weather.snow.add_snow_particles = function(player) mcl_weather.snow.add_snow_particles = function(player)
mcl_weather.rain.last_rp_count = 0 mcl_weather.rain.last_rp_count = 0
for i=mcl_weather.snow.particles_count, 1,-1 do 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) local random_pos_x, _, 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_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 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 mcl_weather.rain.last_rp_count = mcl_weather.rain.last_rp_count + 1
minetest.add_particle({ minetest.add_particle({
pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z}, pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z},
velocity = {x = math.random(-100,100)*0.001, y = math.random(-300,-100)*0.004, z = math.random(-100,100)*0.001}, velocity = {x = math.random(-100,100)*0.001, y = math.random(-300,-100)*0.004, z = math.random(-100,100)*0.001},
acceleration = {x = 0, y=0, z = 0}, acceleration = {x = 0, y=0, z = 0},
expirationtime = 8.0, expirationtime = 8.0,
size = 1, size = 1,
collisiondetection = true, collisiondetection = true,
collision_removal = true, collision_removal = true,
object_collision = false, object_collision = false,
vertical = false, vertical = false,
texture = mcl_weather.snow.get_texture(), texture = mcl_weather.snow.get_texture(),
playername = player:get_player_name() playername = player:get_player_name()
}) })
end end
end end
end end
mcl_weather.snow.set_sky_box = function() mcl_weather.snow.set_sky_box = function()
mcl_weather.skycolor.add_layer( mcl_weather.skycolor.add_layer(
"weather-pack-snow-sky", "weather-pack-snow-sky",
{{r=0, g=0, b=0}, {{r=0, g=0, b=0},
{r=85, g=86, b=86}, {r=85, g=86, b=86},
{r=135, g=135, b=135}, {r=135, g=135, b=135},
{r=85, g=86, b=86}, {r=85, g=86, b=86},
{r=0, g=0, b=0}}) {r=0, g=0, b=0}})
mcl_weather.skycolor.active = true mcl_weather.skycolor.active = true
for _, player in pairs(get_connected_players()) do for _, player in pairs(get_connected_players()) do
player:set_clouds({color="#ADADADE8"}) player:set_clouds({color="#ADADADE8"})
end end
mcl_weather.skycolor.active = true mcl_weather.skycolor.active = true
end end
mcl_weather.snow.clear = function() function mcl_weather.snow.clear()
mcl_weather.skycolor.remove_layer("weather-pack-snow-sky") mcl_weather.skycolor.remove_layer("weather-pack-snow-sky")
mcl_weather.snow.init_done = false mcl_weather.snow.init_done = false
end end
-- Simple random texture getter -- 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" return "weather_pack_snow_snowflake"..math.random(1,2)..".png"
end end
local timer = 0 local timer = 0
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
if mcl_weather.state ~= "snow" then if mcl_weather.state ~= "snow" then
return false return false
end end
timer = timer + dtime; timer = timer + dtime;
if timer >= 0.5 then if timer >= 0.5 then
timer = 0 timer = 0
else else
return return
end end
if mcl_weather.snow.init_done == false then if mcl_weather.snow.init_done == false then
mcl_weather.snow.set_sky_box() mcl_weather.snow.set_sky_box()
mcl_weather.snow.init_done = true mcl_weather.snow.init_done = true
end end
for _, player in pairs(get_connected_players()) do for _, player in pairs(get_connected_players()) do
if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos())) then
return false return false
end end
mcl_weather.snow.add_snow_particles(player) mcl_weather.snow.add_snow_particles(player)
end end
end) end)
-- register snow weather -- register snow weather

View File

@ -4,60 +4,58 @@ local get_connected_players = minetest.get_connected_players
lightning.auto = false lightning.auto = false
mcl_weather.thunder = { mcl_weather.thunder = {
next_strike = 0, next_strike = 0,
min_delay = 3, min_delay = 3,
max_delay = 12, max_delay = 12,
init_done = false, init_done = false,
} }
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
if mcl_weather.get_weather() ~= "thunder" then if mcl_weather.get_weather() ~= "thunder" then
return false return false
end end
mcl_weather.rain.set_particles_mode("thunder") mcl_weather.rain.set_particles_mode("thunder")
mcl_weather.rain.make_weather() 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},
{r=40, g=40, b=40},
{r=85, g=86, b=86},
{r=40, g=40, b=40},
{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
if mcl_weather.thunder.init_done == false then
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},
})
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) end)
mcl_weather.thunder.clear = function() function mcl_weather.thunder.clear()
mcl_weather.rain.clear() mcl_weather.rain.clear()
mcl_weather.skycolor.remove_layer("weather-pack-thunder-sky") mcl_weather.skycolor.remove_layer("weather-pack-thunder-sky")
mcl_weather.skycolor.remove_layer("lightning") mcl_weather.skycolor.remove_layer("lightning")
mcl_weather.thunder.init_done = false mcl_weather.thunder.init_done = false
end end
-- register thunderstorm weather -- register thunderstorm weather
if mcl_weather.reg_weathers.thunder == nil then if mcl_weather.reg_weathers.thunder == nil then
mcl_weather.reg_weathers.thunder = { mcl_weather.reg_weathers.thunder = {
clear = mcl_weather.thunder.clear, clear = mcl_weather.thunder.clear,
light_factor = 0.33333, light_factor = 0.33333,
-- 10min - 20min -- 10min - 20min
min_duration = 600, min_duration = 600,
max_duration = 1200, max_duration = 1200,
transitions = { transitions = {
[100] = "rain", [100] = "rain",
} },
} }
end end

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("mcl_weather") local S = minetest.get_translator("mcl_weather")
local math = math
-- weather states, 'none' is default, other states depends from active mods -- weather states, 'none' is default, other states depends from active mods
mcl_weather.state = "none" 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 look_dir = player:get_look_dir()
local player_pos = player:get_pos() local player_pos = player:get_pos()
local random_pos_x = 0 local random_pos_x, random_pos_y, random_pos_z
local random_pos_y = 0
local random_pos_z = 0
if look_dir.x > 0 then if look_dir.x > 0 then
if look_dir.z > 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 -- Returns true if the specified entry has been viewed by the player
function doc.entry_viewed(playername, category_id, entry_id) 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 if doc.data.players[playername].stored_data.viewed[category_id] == nil then
return false return false
else else
@ -243,7 +243,7 @@ end
-- Returns true if the specified entry is hidden from the player -- Returns true if the specified entry is hidden from the player
function doc.entry_revealed(playername, category_id, entry_id) 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 local hidden = doc.data.categories[category_id].entries[entry_id].hidden
if doc.data.players[playername].stored_data.revealed[category_id] == nil then if doc.data.players[playername].stored_data.revealed[category_id] == nil then
return not hidden 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()) minetest.show_formspec(playername, "doc:error_no_categories", doc.formspec_error_no_categories())
return return
end 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 if ignore_hidden or doc.entry_revealed(playername, category_id, entry_id) then
local playerdata = doc.data.players[playername] local playerdata = doc.data.players[playername]
playerdata.category = category_id 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.."]" formstring = formstring .. "label["..nx..","..ny..";"..i.."]"
pos = pos + 1 pos = pos + 1
end end
local bw, bh
return formstring, ih return formstring, ih
end end

View File

@ -164,7 +164,7 @@ local factoid_toolcaps = function(tool_capabilities, check_uses)
local useslines = 0 local useslines = 0
for k,v in pairs(groupcaps) do for k,v in pairs(groupcaps) do
-- Mining capabilities -- Mining capabilities
local minrating, maxrating --[[local minrating, maxrating
if v.times then if v.times then
for rating, time in pairs(v.times) do for rating, time in pairs(v.times) do
if minrating == nil then minrating = rating else if minrating == nil then minrating = rating else
@ -177,7 +177,7 @@ local factoid_toolcaps = function(tool_capabilities, check_uses)
else else
minrating = 1 minrating = 1
maxrating = 1 maxrating = 1
end end]]
local maxlevel = v.maxlevel local maxlevel = v.maxlevel
if not maxlevel then if not maxlevel then
-- Default from tool.h -- 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"), description = S("Item reference of blocks and other things which are capable of occupying space"),
build_formspec = function(data, playername) build_formspec = function(data, playername)
if data then if data then
local formstring = "" local formstring = entry_image(data)
local datastring = "" local datastring = factoids_header(data, "nodes")
formstring = entry_image(data)
datastring = factoids_header(data, "nodes")
local liquid = data.def.liquidtype ~= "none" and minetest.get_item_group(data.itemstring, "fake_liquid") == 0 local liquid = data.def.liquidtype ~= "none" and minetest.get_item_group(data.itemstring, "fake_liquid") == 0
if not forbidden_core_factoids.basics then 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 elseif type(data.def.drop) == "table" and data.def.drop.items ~= nil then
local max = data.def.drop.max_items local max = data.def.drop.max_items
local dropstring = "" local dropstring = ""
local dropstring_base = "" local dropstring_base
if max == nil then if max == nil then
dropstring_base = N("This block will drop the following items when mined: @1.") dropstring_base = N("This block will drop the following items when mined: @1.")
elseif max == 1 then elseif max == 1 then
@ -852,7 +849,7 @@ doc.add_category("nodes", {
local rarity_history = {} local rarity_history = {}
for i=1,#data.def.drop.items do for i=1,#data.def.drop.items do
local local_rarity = data.def.drop.items[i].rarity local local_rarity = data.def.drop.items[i].rarity
local chance = 1 local chance
local rarity = 1 local rarity = 1
if local_rarity == nil then if local_rarity == nil then
local_rarity = 1 local_rarity = 1
@ -937,7 +934,6 @@ doc.add_category("nodes", {
end end
local rarity = probtable.rarity local rarity = probtable.rarity
local raritystring = ""
-- No percentage if there's only one possible guaranteed drop -- No percentage if there's only one possible guaranteed drop
if not(rarity == 1 and #data.def.drop.items == 1) then if not(rarity == 1 and #data.def.drop.items == 1) then
local chance = (1/rarity)*100 local chance = (1/rarity)*100
@ -1086,11 +1082,8 @@ doc.add_category("tools", {
end, end,
build_formspec = function(data, playername) build_formspec = function(data, playername)
if data then if data then
local formstring = "" local formstring = entry_image(data)
local datastring = "" local datastring = factoids_header(data, "tools")
formstring = entry_image(data)
datastring = factoids_header(data, "tools")
-- Overwritten durability info -- Overwritten durability info
if type(data.def._doc_items_durability) == "number" then 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)"), description = S("Item reference of items which are neither blocks, tools or weapons (esp. crafting items)"),
build_formspec = function(data, playername) build_formspec = function(data, playername)
if data then if data then
local formstring = "" local formstring = entry_image(data)
local datastring = "" local datastring = factoids_header(data, "craftitems")
formstring = entry_image(data)
datastring = factoids_header(data, "craftitems")
datastring = datastring .. factoids_footer(data, playername, "craftitems") datastring = datastring .. factoids_footer(data, playername, "craftitems")
formstring = formstring .. doc.widgets.text(datastring, nil, nil, doc.FORMSPEC.ENTRY_WIDTH - 1.2) 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 -- and just print the normal item name without special formatting
if groups[1] == "compass" or groups[1] == "clock" then if groups[1] == "compass" or groups[1] == "clock" then
groupstr = reg_items[item].description groupstr = reg_items[item].description
elseif group_names[groups[1]] then elseif g then
-- Use the special group name string -- Use the special group name string
groupstr = minetest.colorize(gcol, group_names[groups[1]]) groupstr = minetest.colorize(gcol, g)
else else
--[[ Fallback: Generic group explanation: This always --[[ Fallback: Generic group explanation: This always
works, but the internally used group name (which works, but the internally used group name (which
@ -545,7 +545,7 @@ local function get_recipe_fs(data, iY)
if custom_recipe or shapeless or recipe.type == "cooking" then if custom_recipe or shapeless or recipe.type == "cooking" then
local icon = custom_recipe and custom_recipe.icon or local icon = custom_recipe and custom_recipe.icon or
shapeless and "shapeless" or "furnace" shapeless and "shapeless" or "furnace"
if recipe.type == "cooking" then if recipe.type == "cooking" then
icon = "default_furnace_front_active.png" icon = "default_furnace_front_active.png"
@ -638,7 +638,7 @@ local function make_formspec(name)
fs[#fs + 1] = "background9[1,1;1,1;mcl_base_textures_background9.png;true;7]" fs[#fs + 1] = "background9[1,1;1,1;mcl_base_textures_background9.png;true;7]"
fs[#fs + 1] = fmt([[ tooltip[size_inc;%s] fs[#fs + 1] = fmt([[ tooltip[size_inc;%s]
tooltip[size_dec;%s] ]], tooltip[size_dec;%s] ]],
ESC(S("Increase window size")), ESC(S("Increase window size")),
ESC(S("Decrease window size"))) ESC(S("Decrease window size")))
@ -656,9 +656,9 @@ local function make_formspec(name)
]] ]]
fs[#fs + 1] = fmt([[ tooltip[search;%s] fs[#fs + 1] = fmt([[ tooltip[search;%s]
tooltip[clear;%s] tooltip[clear;%s]
tooltip[prev;%s] tooltip[prev;%s]
tooltip[next;%s] ]], tooltip[next;%s] ]],
ESC(S("Search")), ESC(S("Search")),
ESC(S("Reset")), ESC(S("Reset")),
ESC(S("Previous page")), ESC(S("Previous page")),

View File

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

View File

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

View File

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

View File

@ -250,9 +250,7 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
local tnodedug = string.split(entry.node, ":") local tnodedug = string.split(entry.node, ":")
local tmod = tnodedug[1] local tmod = tnodedug[1]
local titem = tnodedug[2] local titem = tnodedug[2]
if not tmod or not titem or not data.count[tmod] or not data.count[tmod][titem] then if tmod and titem and data.count[tmod] and data.count[tmod][titem] and data.count[tmod][titem] > entry.target-1 then
-- table running failed!
elseif data.count[tmod][titem] > entry.target-1 then
return entry.award return entry.award
end end
elseif awards.get_total_item_count(data, "count") > entry.target-1 then 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 tnodedug = string.split(entry.node, ":")
local tmod = tnodedug[1] local tmod = tnodedug[1]
local titem = tnodedug[2] local titem = tnodedug[2]
if not tmod or not titem or not data.place[tmod] or not data.place[tmod][titem] then if tmod and titem and data.place[tmod] and data.place[tmod][titem] and data.place[tmod][titem] > entry.target-1 then
-- table running failed!
elseif data.place[tmod][titem] > entry.target-1 then
return entry.award return entry.award
end end
elseif awards.get_total_item_count(data, "place") > entry.target-1 then 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 titemstring = string.split(entry.item, ":")
local tmod = titemstring[1] local tmod = titemstring[1]
local titem = titemstring[2] local titem = titemstring[2]
if not tmod or not titem or not data.eat[tmod] or not data.eat[tmod][titem] then if tmod and titem and data.eat[tmod] and data.eat[tmod][titem] and data.eat[tmod][titem] > entry.target-1 then
-- table running failed!
elseif data.eat[tmod][titem] > entry.target-1 then
return entry.award return entry.award
end end
elseif awards.get_total_item_count(data, "eat") > entry.target-1 then 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 titemcrafted = string.split(entry.item, ":")
local tmod = titemcrafted[1] local tmod = titemcrafted[1]
local titem = titemcrafted[2] local titem = titemcrafted[2]
if not tmod or not titem or not data.craft[tmod] or not data.craft[tmod][titem] then if tmod and titem and data.craft[tmod] and data.craft[tmod][titem] and data.craft[tmod][titem] > entry.target-1 then
-- table running failed!
elseif data.craft[tmod][titem] > entry.target-1 then
return entry.award return entry.award
end end
elseif awards.get_total_item_count(data, "craft") > entry.target-1 then 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 if minetest.get_modpath("unified_inventory") then
local S = minetest.get_translator("awards") local S = minetest.get_translator(minetest.get_current_modname())
unified_inventory.register_button("awards", { unified_inventory.register_button("awards", {
type = "image", type = "image",
image = "awards_ui_icon.png", image = "awards_ui_icon.png",

View File

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

View File

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

View File

@ -3,8 +3,8 @@ local F = minetest.formspec_escape
mcl_inventory = {} mcl_inventory = {}
local mod_player = minetest.get_modpath("mcl_player") ~= nil --local mod_player = minetest.get_modpath("mcl_player") ~= nil
local mod_craftguide = minetest.get_modpath("mcl_craftguide") ~= 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 -- 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) 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_width("craft", 2)
inv:set_size("craft", 4) inv:set_size("craft", 4)
local player_name = player:get_player_name()
-- Show armor and player image -- Show armor and player image
local player_preview local player_preview
if minetest.settings:get_bool("3d_player_preview", true) then if minetest.settings:get_bool("3d_player_preview", true) then
@ -180,6 +178,6 @@ minetest.register_on_joinplayer(function(player)
end) end)
if minetest.is_creative_enabled("") then 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 end

View File

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

View File

@ -217,94 +217,94 @@ if minetest.get_modpath("screwdriver") then
end end
for _, mode in pairs{"comp", "sub"} do for _, mode in pairs{"comp", "sub"} do
for _, state in pairs{mesecon.state.on, mesecon.state.off} do for _, state in pairs{mesecon.state.on, mesecon.state.off} do
local state_str = state_strs[state] local state_str = state_strs[state]
local nodename = local nodename =
"mcl_comparators:comparator_"..state_strs[state].."_"..mode "mcl_comparators:comparator_"..state_str.."_"..mode
-- Help -- Help
local longdesc, usagehelp, use_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".. 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.") S("They can transmit a redstone signal, detect whether a block contains any items and compare multiple signals.")
usagehelp = S("A redstone comparator has 1 main input, 2 side inputs and 1 output. The output is in arrow direction, the main input is in the opposite direction. The other 2 sides are the side inputs.").."\n".. usagehelp = S("A redstone comparator has 1 main input, 2 side inputs and 1 output. The output is in arrow direction, the main input is in the opposite direction. The other 2 sides are the side inputs.").."\n"..
S("The main input can powered in 2 ways: First, it can be powered directly by redstone power like any other component. Second, it is powered if, and only if a container (like a chest) is placed in front of it and the container contains at least one item.").."\n".. S("The main input can powered in 2 ways: First, it can be powered directly by redstone power like any other component. Second, it is powered if, and only if a container (like a chest) is placed in front of it and the container contains at least one item.").."\n"..
S("The side inputs are only powered by normal redstone power. The redstone comparator can operate in two modes: Transmission mode and subtraction mode. It starts in transmission mode and the mode can be changed by using the block.").."\n\n".. S("The side inputs are only powered by normal redstone power. The redstone comparator can operate in two modes: Transmission mode and subtraction mode. It starts in transmission mode and the mode can be changed by using the block.").."\n\n"..
S("Transmission mode:\nThe front torch is unlit and lowered. The output is powered if, and only if the main input is powered. The two side inputs are ignored.").."\n".. S("Transmission mode:\nThe front torch is unlit and lowered. The output is powered if, and only if the main input is powered. The two side inputs are ignored.").."\n"..
S("Subtraction mode:\nThe front torch is lit. The output is powered if, and only if the main input is powered and none of the side inputs is powered.") S("Subtraction mode:\nThe front torch is lit. The output is powered if, and only if the main input is powered and none of the side inputs is powered.")
else else
use_help = false use_help = false
end end
local nodedef = { local nodedef = {
description = S("Redstone Comparator"), description = S("Redstone Comparator"),
inventory_image = icon, inventory_image = icon,
wield_image = icon, wield_image = icon,
_doc_items_create_entry = use_help, _doc_items_create_entry = use_help,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_usagehelp = usagehelp, _doc_items_usagehelp = usagehelp,
drawtype = "nodebox", 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, 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, walkable = true,
selection_box = collision_box, selection_box = collision_box,
collision_box = collision_box, collision_box = collision_box,
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = node_boxes[mode], fixed = node_boxes[mode],
},
groups = groups,
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = false,
is_ground_content = false,
drop = 'mcl_comparators:comparator_off_comp',
on_construct = update_self,
on_rightclick =
make_rightclick_handler(state_strs[state], mode),
comparator_mode = mode,
comparator_onstate = "mcl_comparators:comparator_on_"..mode,
comparator_offstate = "mcl_comparators:comparator_off_"..mode,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {
receptor = {
state = state,
rules = comparator_get_output_rules,
}, },
effector = { groups = groups,
rules = comparator_get_input_rules, paramtype = "light",
action_change = update_self, paramtype2 = "facedir",
} sunlight_propagates = false,
}, is_ground_content = false,
on_rotate = on_rotate, drop = 'mcl_comparators:comparator_off_comp',
} on_construct = update_self,
on_rightclick =
make_rightclick_handler(state_str, mode),
comparator_mode = mode,
comparator_onstate = "mcl_comparators:comparator_on_"..mode,
comparator_offstate = "mcl_comparators:comparator_off_"..mode,
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {
receptor = {
state = state,
rules = comparator_get_output_rules,
},
effector = {
rules = comparator_get_input_rules,
action_change = update_self,
}
},
on_rotate = on_rotate,
}
if mode == "comp" and state == mesecon.state.off then if mode == "comp" and state == mesecon.state.off then
-- This is the prototype -- This is the prototype
nodedef._doc_items_create_entry = true nodedef._doc_items_create_entry = true
else else
nodedef.groups = table.copy(nodedef.groups) nodedef.groups = table.copy(nodedef.groups)
nodedef.groups.not_in_creative_inventory = 1 nodedef.groups.not_in_creative_inventory = 1
local extra_desc = {} --local extra_desc = {}
if mode == "sub" or state == mesecon.state.on then if mode == "sub" or state == mesecon.state.on then
nodedef.inventory_image = nil nodedef.inventory_image = nil
end
local desc = nodedef.description
if mode ~= "sub" and state == mesecon.state.on then
desc = S("Redstone Comparator (Powered)")
elseif mode == "sub" and state ~= mesecon.state.on then
desc = S("Redstone Comparator (Subtract)")
elseif mode == "sub" and state == mesecon.state.on then
desc = S("Redstone Comparator (Subtract, Powered)")
end
nodedef.description = desc
end end
local desc = nodedef.description
if mode ~= "sub" and state == mesecon.state.on then minetest.register_node(nodename, nodedef)
desc = S("Redstone Comparator (Powered)") mcl_wip.register_wip_item(nodename)
elseif mode == "sub" and state ~= mesecon.state.on then
desc = S("Redstone Comparator (Subtract)")
elseif mode == "sub" and state == mesecon.state.on then
desc = S("Redstone Comparator (Subtract, Powered)")
end
nodedef.description = desc
end end
minetest.register_node(nodename, nodedef)
mcl_wip.register_wip_item(nodename)
end
end end
-- Register recipies -- Register recipies
@ -351,9 +351,9 @@ minetest.register_abm({
-- Add entry aliases for the Help -- Add entry aliases for the Help
if minetest.get_modpath("doc") then if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp", doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp",
"nodes", "mcl_comparators:comparator_off_sub") "nodes", "mcl_comparators:comparator_off_sub")
doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp", doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp",
"nodes", "mcl_comparators:comparator_on_comp") "nodes", "mcl_comparators:comparator_on_comp")
doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp", doc.add_entry_alias("nodes", "mcl_comparators:comparator_off_comp",
"nodes", "mcl_comparators:comparator_on_sub") "nodes", "mcl_comparators:comparator_on_sub")
end end

View File

@ -96,125 +96,127 @@ local dispenserdef = {
end, end,
_mcl_blast_resistance = 3.5, _mcl_blast_resistance = 3.5,
_mcl_hardness = 3.5, _mcl_hardness = 3.5,
mesecons = {effector = { mesecons = {
-- Dispense random item when triggered effector = {
action_on = function (pos, node) -- Dispense random item when triggered
local meta = minetest.get_meta(pos) action_on = function (pos, node)
local inv = meta:get_inventory() local meta = minetest.get_meta(pos)
local droppos, dropdir local inv = meta:get_inventory()
if node.name == "mcl_dispensers:dispenser" then local droppos, dropdir
dropdir = vector.multiply(minetest.facedir_to_dir(node.param2), -1) if node.name == "mcl_dispensers:dispenser" then
droppos = vector.add(pos, dropdir) dropdir = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
elseif node.name == "mcl_dispensers:dispenser_up" then droppos = vector.add(pos, dropdir)
dropdir = {x=0, y=1, z=0} elseif node.name == "mcl_dispensers:dispenser_up" then
droppos = {x=pos.x, y=pos.y+1, z=pos.z} dropdir = {x=0, y=1, z=0}
elseif node.name == "mcl_dispensers:dispenser_down" then droppos = {x=pos.x, y=pos.y+1, z=pos.z}
dropdir = {x=0, y=-1, z=0} elseif node.name == "mcl_dispensers:dispenser_down" then
droppos = {x=pos.x, y=pos.y-1, z=pos.z} dropdir = {x=0, y=-1, z=0}
end droppos = {x=pos.x, y=pos.y-1, z=pos.z}
local dropnode = minetest.get_node(droppos)
local dropnodedef = minetest.registered_nodes[dropnode.name]
local stacks = {}
for i=1,inv:get_size("main") do
local stack = inv:get_stack("main", i)
if not stack:is_empty() then
table.insert(stacks, {stack = stack, stackpos = i})
end end
end local dropnode = minetest.get_node(droppos)
if #stacks >= 1 then local dropnodedef = minetest.registered_nodes[dropnode.name]
local r = math.random(1, #stacks) local stacks = {}
local stack = stacks[r].stack for i=1,inv:get_size("main") do
local dropitem = ItemStack(stack) local stack = inv:get_stack("main", i)
dropitem:set_count(1) if not stack:is_empty() then
local stack_id = stacks[r].stackpos table.insert(stacks, {stack = stack, stackpos = i})
local stackdef = stack:get_definition() end
local iname = stack:get_name() end
local igroups = minetest.registered_items[iname].groups if #stacks >= 1 then
local r = math.random(1, #stacks)
local stack = stacks[r].stack
local dropitem = ItemStack(stack)
dropitem:set_count(1)
local stack_id = stacks[r].stackpos
local stackdef = stack:get_definition()
local iname = stack:get_name()
local igroups = minetest.registered_items[iname].groups
--[===[ Dispense item ]===] --[===[ Dispense item ]===]
-- Hardcoded dispensions -- -- Hardcoded dispensions --
-- Armor, mob heads and pumpkins -- Armor, mob heads and pumpkins
if igroups.armor then if igroups.armor then
local droppos_below = {x = droppos.x, y = droppos.y - 1, z = droppos.z} local droppos_below = {x = droppos.x, y = droppos.y - 1, z = droppos.z}
for _, objs in ipairs({minetest.get_objects_inside_radius(droppos, 1), minetest.get_objects_inside_radius(droppos_below, 1)}) do for _, objs in ipairs({minetest.get_objects_inside_radius(droppos, 1), minetest.get_objects_inside_radius(droppos_below, 1)}) do
for _, obj in ipairs(objs) do for _, obj in ipairs(objs) do
stack = mcl_armor.equip(stack, obj) stack = mcl_armor.equip(stack, obj)
if stack:is_empty() then
break
end
end
if stack:is_empty() then if stack:is_empty() then
break break
end end
end end
if stack:is_empty() then
break
end
end
-- Place head or pumpkin as node, if equipping it as armor has failed -- Place head or pumpkin as node, if equipping it as armor has failed
if not stack:is_empty() then if not stack:is_empty() then
if igroups.head or iname == "mcl_farming:pumpkin_face" then if igroups.head or iname == "mcl_farming:pumpkin_face" then
if dropnodedef.buildable_to then if dropnodedef.buildable_to then
minetest.set_node(droppos, {name = iname, param2 = node.param2}) minetest.set_node(droppos, {name = iname, param2 = node.param2})
stack:take_item() stack:take_item()
end
end end
end end
end
inv:set_stack("main", stack_id, stack)
-- Spawn Egg
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 } }
minetest.add_entity(droppos, stack:get_name())
stack:take_item()
inv:set_stack("main", stack_id, stack) inv:set_stack("main", stack_id, stack)
end -- Spawn Egg
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 } }
minetest.add_entity(droppos, stack:get_name())
-- Generalized dispension
elseif (not dropnodedef.walkable or stackdef._dispense_into_walkable) then
--[[ _on_dispense(stack, pos, droppos, dropnode, dropdir)
* stack: Itemstack which is dispense
* pos: Position of dispenser
* droppos: Position to which to dispense item
* dropnode: Node of droppos
* dropdir: Drop direction
_dispense_into_walkable: If true, can dispense into walkable nodes
]]
if stackdef._on_dispense then
-- Item-specific dispension (if defined)
local od_ret = stackdef._on_dispense(dropitem, pos, droppos, dropnode, dropdir)
if od_ret then
local newcount = stack:get_count() - 1
stack:set_count(newcount)
inv:set_stack("main", stack_id, stack)
if newcount == 0 then
inv:set_stack("main", stack_id, od_ret)
elseif inv:room_for_item("main", od_ret) then
inv:add_item("main", od_ret)
else
minetest.add_item(droppos, dropitem)
end
else
stack:take_item() stack:take_item()
inv:set_stack("main", stack_id, stack) inv:set_stack("main", stack_id, stack)
end end
else
-- Drop item otherwise -- Generalized dispension
minetest.add_item(droppos, dropitem) elseif (not dropnodedef.walkable or stackdef._dispense_into_walkable) then
stack:take_item() --[[ _on_dispense(stack, pos, droppos, dropnode, dropdir)
inv:set_stack("main", stack_id, stack) * stack: Itemstack which is dispense
* pos: Position of dispenser
* droppos: Position to which to dispense item
* dropnode: Node of droppos
* dropdir: Drop direction
_dispense_into_walkable: If true, can dispense into walkable nodes
]]
if stackdef._on_dispense then
-- Item-specific dispension (if defined)
local od_ret = stackdef._on_dispense(dropitem, pos, droppos, dropnode, dropdir)
if od_ret then
local newcount = stack:get_count() - 1
stack:set_count(newcount)
inv:set_stack("main", stack_id, stack)
if newcount == 0 then
inv:set_stack("main", stack_id, od_ret)
elseif inv:room_for_item("main", od_ret) then
inv:add_item("main", od_ret)
else
minetest.add_item(droppos, dropitem)
end
else
stack:take_item()
inv:set_stack("main", stack_id, stack)
end
else
-- Drop item otherwise
minetest.add_item(droppos, dropitem)
stack:take_item()
inv:set_stack("main", stack_id, stack)
end
end end
end end
end,
rules = mesecon.rules.alldirs,
end },
end, },
rules = mesecon.rules.alldirs,
}},
on_rotate = on_rotate, on_rotate = on_rotate,
} }

View File

@ -11,7 +11,7 @@ local realtime = true
local rules_flat = { local rules_flat = {
{ x = 0, y = 0, z = -1, spread = true }, { x = 0, y = 0, z = -1, spread = true },
} }
local get_rules_flat = function(node) local function get_rules_flat(node)
local rules = rules_flat local rules = rules_flat
for i=1, node.param2 do for i=1, node.param2 do
rules = mesecon.rotate_rules_left(rules) rules = mesecon.rotate_rules_left(rules)
@ -46,7 +46,7 @@ end
-- and update the observer state if needed. -- and update the observer state if needed.
-- TODO: Also scan metadata changes. -- TODO: Also scan metadata changes.
-- TODO: Ignore some node 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 node = minetest.get_node(pos)
local front local front
if node.name == "mcl_observers:observer_up_off" or node.name == "mcl_observers:observer_up_on" then 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 end
-- Vertical orientation (CURRENTLY DISABLED) -- Vertical orientation (CURRENTLY DISABLED)
local observer_orientate = function(pos, placer) local function observer_orientate(pos, placer)
-- Not placed by player -- Not placed by player
if not placer then return end if not placer then return end
-- Placer pitch in degrees -- Placer pitch in degrees
local pitch = placer:get_look_vertical() * (180 / math.pi) 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 if pitch > 55 then -- player looking upwards
-- Observer looking downwards -- Observer looking downwards
minetest.set_node(pos, {name="mcl_observers:observer_down_off"}) minetest.set_node(pos, {name="mcl_observers:observer_down_off"})
@ -104,162 +104,167 @@ local observer_orientate = function(pos, placer)
end end
end end
mesecon.register_node("mcl_observers:observer", mesecon.register_node("mcl_observers:observer", {
{ is_ground_content = false,
is_ground_content = false, sounds = mcl_sounds.node_sound_stone_defaults(),
sounds = mcl_sounds.node_sound_stone_defaults(), paramtype2 = "facedir",
paramtype2 = "facedir", on_rotate = false,
on_rotate = false, _mcl_blast_resistance = 3.5,
_mcl_blast_resistance = 3.5, _mcl_hardness = 3.5,
_mcl_hardness = 3.5, }, {
}, description = S("Observer"),
{ _tt_help = S("Emits redstone pulse when block in front changes"),
description = S("Observer"), _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."),
_tt_help = S("Emits redstone pulse when block in front changes"), _doc_items_usagehelp = S("Place the observer directly in front of the block you want to observe with the “face” looking at the block. The arrow points to the side of the output, which is at the opposite side of the “face”. You can place your redstone dust or any other component here."),
_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."),
_doc_items_usagehelp = S("Place the observer directly in front of the block you want to observe with the “face” looking at the block. The arrow points to the side of the output, which is at the opposite side of the “face”. You can place your redstone dust or any other component here."),
groups = {pickaxey=1, material_stone=1, not_opaque=1, }, groups = {pickaxey=1, material_stone=1, not_opaque=1, },
tiles = { tiles = {
"mcl_observers_observer_top.png^[transformR180", "default_furnace_bottom.png", "mcl_observers_observer_top.png^[transformR180", "default_furnace_bottom.png",
"mcl_observers_observer_side.png", "mcl_observers_observer_side.png", "mcl_observers_observer_side.png", "mcl_observers_observer_side.png",
"mcl_observers_observer_front.png", "mcl_observers_observer_back.png", "mcl_observers_observer_front.png", "mcl_observers_observer_back.png",
}, },
mesecons = { receptor = { mesecons = {
state = mesecon.state.off, receptor = {
rules = get_rules_flat, state = mesecon.state.off,
}}, rules = get_rules_flat,
on_construct = function(pos) },
if not realtime then },
observer_scan(pos, true) on_construct = function(pos)
end if not realtime then
end, observer_scan(pos, true)
after_place_node = observer_orientate, 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 }, _doc_items_create_entry = false,
tiles = { groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 },
"mcl_observers_observer_top.png^[transformR180", "default_furnace_bottom.png", tiles = {
"mcl_observers_observer_side.png", "mcl_observers_observer_side.png", "mcl_observers_observer_top.png^[transformR180", "default_furnace_bottom.png",
"mcl_observers_observer_front.png", "mcl_observers_observer_back_lit.png", "mcl_observers_observer_side.png", "mcl_observers_observer_side.png",
}, "mcl_observers_observer_front.png", "mcl_observers_observer_back_lit.png",
mesecons = { receptor = { },
state = mesecon.state.on, mesecons = {
rules = get_rules_flat, receptor = {
}}, state = mesecon.state.on,
rules = get_rules_flat,
}
},
-- VERY quickly disable observer after construction -- VERY quickly disable observer after construction
on_construct = function(pos) on_construct = function(pos)
local timer = minetest.get_node_timer(pos) local timer = minetest.get_node_timer(pos)
timer:start(mcl_vars.redstone_tick) timer:start(mcl_vars.redstone_tick)
end, end,
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
minetest.set_node(pos, {name = "mcl_observers:observer_off", param2 = node.param2}) minetest.set_node(pos, {name = "mcl_observers:observer_off", param2 = node.param2})
mesecon.receptor_off(pos, get_rules_flat(node)) mesecon.receptor_off(pos, get_rules_flat(node))
end, end,
} }
) )
mesecon.register_node("mcl_observers:observer_down", mesecon.register_node("mcl_observers:observer_down", {
{ is_ground_content = false,
is_ground_content = false, sounds = mcl_sounds.node_sound_stone_defaults(),
sounds = mcl_sounds.node_sound_stone_defaults(), groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 },
groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, on_rotate = false,
on_rotate = false, _mcl_blast_resistance = 3.5,
_mcl_blast_resistance = 3.5, _mcl_hardness = 3.5,
_mcl_hardness = 3.5, drop = "mcl_observers:observer_off",
drop = "mcl_observers:observer_off", }, {
}, tiles = {
{ "mcl_observers_observer_back.png", "mcl_observers_observer_front.png",
tiles = { "mcl_observers_observer_side.png^[transformR90", "mcl_observers_observer_side.png^[transformR90",
"mcl_observers_observer_back.png", "mcl_observers_observer_front.png", "mcl_observers_observer_top.png", "mcl_observers_observer_top.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,
state = mesecon.state.off, rules = rules_down,
rules = rules_down, },
}}, },
on_construct = function(pos) on_construct = function(pos)
if not realtime then if not realtime then
observer_scan(pos, true) observer_scan(pos, true)
end end
end, end,
}, }, {
{ _doc_items_create_entry = false,
_doc_items_create_entry = false, tiles = {
tiles = { "mcl_observers_observer_back_lit.png", "mcl_observers_observer_front.png",
"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_side.png^[transformR90", "mcl_observers_observer_side.png^[transformR90", "mcl_observers_observer_top.png", "mcl_observers_observer_top.png",
"mcl_observers_observer_top.png", "mcl_observers_observer_top.png", },
}, mesecons = {
mesecons = { receptor = { receptor = {
state = mesecon.state.on, state = mesecon.state.on,
rules = rules_down, rules = rules_down,
}}, },
},
-- VERY quickly disable observer after construction -- VERY quickly disable observer after construction
on_construct = function(pos) on_construct = function(pos)
local timer = minetest.get_node_timer(pos) local timer = minetest.get_node_timer(pos)
timer:start(mcl_vars.redstone_tick) timer:start(mcl_vars.redstone_tick)
end, end,
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
minetest.set_node(pos, {name = "mcl_observers:observer_down_off", param2 = node.param2}) minetest.set_node(pos, {name = "mcl_observers:observer_down_off", param2 = node.param2})
mesecon.receptor_off(pos, rules_down) mesecon.receptor_off(pos, rules_down)
end, end,
}) }
)
mesecon.register_node("mcl_observers:observer_up", mesecon.register_node("mcl_observers:observer_up", {
{ is_ground_content = false,
is_ground_content = false, sounds = mcl_sounds.node_sound_stone_defaults(),
sounds = mcl_sounds.node_sound_stone_defaults(), groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 },
groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, on_rotate = false,
on_rotate = false, _mcl_blast_resistance = 3.5,
_mcl_blast_resistance = 3.5, _mcl_hardness = 3.5,
_mcl_hardness = 3.5, drop = "mcl_observers:observer_off",
drop = "mcl_observers:observer_off", }, {
}, tiles = {
{ "mcl_observers_observer_front.png", "mcl_observers_observer_back.png",
tiles = { "mcl_observers_observer_side.png^[transformR270", "mcl_observers_observer_side.png^[transformR270",
"mcl_observers_observer_front.png", "mcl_observers_observer_back.png", "mcl_observers_observer_top.png^[transformR180", "mcl_observers_observer_top.png^[transformR180",
"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,
state = mesecon.state.off, rules = rules_up,
rules = rules_up, },
}}, },
on_construct = function(pos) on_construct = function(pos)
if not realtime then if not realtime then
observer_scan(pos, true) observer_scan(pos, true)
end end
end, end,
}, }, {
{ _doc_items_create_entry = false,
_doc_items_create_entry = false, tiles = {
tiles = { "mcl_observers_observer_front.png", "mcl_observers_observer_back_lit.png",
"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_side.png^[transformR270", "mcl_observers_observer_side.png^[transformR270", "mcl_observers_observer_top.png^[transformR180", "mcl_observers_observer_top.png^[transformR180",
"mcl_observers_observer_top.png^[transformR180", "mcl_observers_observer_top.png^[transformR180", },
}, mesecons = {
mesecons = { receptor = { receptor = {
state = mesecon.state.on, state = mesecon.state.on,
rules = rules_up, rules = rules_up,
}}, },
},
-- VERY quickly disable observer after construction -- VERY quickly disable observer after construction
on_construct = function(pos) on_construct = function(pos)
local timer = minetest.get_node_timer(pos) local timer = minetest.get_node_timer(pos)
timer:start(mcl_vars.redstone_tick) timer:start(mcl_vars.redstone_tick)
end, end,
on_timer = function(pos, elapsed) on_timer = function(pos, elapsed)
minetest.set_node(pos, {name = "mcl_observers:observer_up_off"}) minetest.set_node(pos, {name = "mcl_observers:observer_up_off"})
mesecon.receptor_off(pos, rules_up) mesecon.receptor_off(pos, rules_up)
end, end,
}) }
)
minetest.register_craft({ minetest.register_craft({
output = "mcl_observers:observer_off", output = "mcl_observers:observer_off",
@ -267,7 +272,7 @@ minetest.register_craft({
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" }, { "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
{ "mcl_nether:quartz", "mesecons:redstone", "mesecons:redstone" }, { "mcl_nether:quartz", "mesecons:redstone", "mesecons:redstone" },
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" }, { "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
} },
}) })
minetest.register_craft({ minetest.register_craft({
output = "mcl_observers:observer_off", output = "mcl_observers:observer_off",
@ -275,7 +280,7 @@ minetest.register_craft({
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" }, { "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
{ "mesecons:redstone", "mesecons:redstone", "mcl_nether:quartz" }, { "mesecons:redstone", "mesecons:redstone", "mcl_nether:quartz" },
{ "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" }, { "mcl_core:cobble", "mcl_core:cobble", "mcl_core:cobble" },
} },
}) })
if realtime then if realtime then
@ -454,7 +459,7 @@ minetest.register_lbm({
"mcl_observers:observer_down_on", "mcl_observers:observer_down_on",
"mcl_observers:observer_up_on", "mcl_observers:observer_up_on",
}, },
run_at_every_load = true, run_at_every_load = true,
action = function(pos) action = function(pos)
minetest.after(1, mcl_observers.observer_activate, {x=pos.x, y=pos.y, z=pos.z}) minetest.after(1, mcl_observers.observer_activate, {x=pos.x, y=pos.y, z=pos.z})
end, end,

View File

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

View File

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

View File

@ -4,7 +4,7 @@ local DELAYS = { 0.1, 0.2, 0.3, 0.4 }
local DEFAULT_DELAY = DELAYS[1] local DEFAULT_DELAY = DELAYS[1]
-- Function that get the input/output rules of the delayer -- 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}} local rules = {{x = -1, y = 0, z = 0, spread=true}}
for i = 0, node.param2 do for i = 0, node.param2 do
rules = mesecon.rotate_rules_left(rules) rules = mesecon.rotate_rules_left(rules)
@ -12,7 +12,7 @@ local delayer_get_output_rules = function(node)
return rules return rules
end end
local delayer_get_input_rules = function(node) local function delayer_get_input_rules(node)
local rules = {{x = 1, y = 0, z = 0}} local rules = {{x = 1, y = 0, z = 0}}
for i = 0, node.param2 do for i = 0, node.param2 do
rules = mesecon.rotate_rules_left(rules) rules = mesecon.rotate_rules_left(rules)
@ -22,7 +22,7 @@ end
-- Return the sides of a delayer. -- Return the sides of a delayer.
-- Those are used to toggle the lock state. -- Those are used to toggle the lock state.
local delayer_get_sides = function(node) local function delayer_get_sides(node)
local rules = { local rules = {
{x = 0, y = 0, z = -1}, {x = 0, y = 0, z = -1},
{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. -- Make the repeater at pos try to lock any repeater it faces.
-- Returns true if a repeater was locked. -- 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 -- Check the repeater at pos and look if it faces
-- a repeater placed sideways. -- a repeater placed sideways.
-- If yes, lock the second repeater. -- If yes, lock the second repeater.
@ -67,7 +67,7 @@ end
-- Make the repeater at pos try to unlock any repeater it faces. -- Make the repeater at pos try to unlock any repeater it faces.
-- Returns true if a repeater was unlocked. -- 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 -- Check the repeater at pos and look if it faces
-- a repeater placed sideways. -- a repeater placed sideways.
-- If yes, also check if the second repeater doesn't receive -- If yes, also check if the second repeater doesn't receive
@ -119,21 +119,19 @@ local check_unlock_repeater = function(pos, node)
end end
-- Functions that are called after the delay time -- 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 def = minetest.registered_nodes[node.name]
local time = def.delayer_time local time = def.delayer_time
minetest.set_node(pos, {name=def.delayer_onstate, param2=node.param2}) 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) mesecon.queue:add_action(pos, "receptor_on", {delayer_get_output_rules(node)}, time, nil)
check_lock_repeater(pos, node) check_lock_repeater(pos, node)
end end
local delayer_deactivate = function(pos, node) local function delayer_deactivate(pos, node)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
local time = def.delayer_time local time = def.delayer_time
minetest.set_node(pos, {name=def.delayer_offstate, param2=node.param2}) 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) mesecon.queue:add_action(pos, "receptor_off", {delayer_get_output_rules(node)}, time, nil)
check_unlock_repeater(pos, node) check_unlock_repeater(pos, node)
end end
@ -145,236 +143,230 @@ end
-- Register the 2 (states) x 4 (delay times) delayers -- Register the 2 (states) x 4 (delay times) delayers
for i = 1, 4 do for i = 1, 4 do
local groups = {} local groups
if i == 1 then 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} groups = {dig_immediate=3,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,attached_node=1,redstone_repeater=i}
else else
groups = {dig_immediate=3,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,attached_node=1,redstone_repeater=i,not_in_creative_inventory=1} groups = {dig_immediate=3,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,attached_node=1,redstone_repeater=i,not_in_creative_inventory=1}
end end
local delaytime = DELAYS[i] local delaytime = DELAYS[i]
local boxes local boxes
if i == 1 then if i == 1 then
boxes = { boxes = {
{ -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab
{ -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch
{ -1/16, -6/16, 0/16, 1/16, -1/16, 2/16}, -- moved torch { -1/16, -6/16, 0/16, 1/16, -1/16, 2/16}, -- moved torch
} }
elseif i == 2 then elseif i == 2 then
boxes = { boxes = {
{ -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab
{ -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch
{ -1/16, -6/16, -2/16, 1/16, -1/16, 0/16}, -- moved torch { -1/16, -6/16, -2/16, 1/16, -1/16, 0/16}, -- moved torch
} }
elseif i == 3 then elseif i == 3 then
boxes = { boxes = {
{ -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab
{ -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch
{ -1/16, -6/16, -4/16, 1/16, -1/16, -2/16}, -- moved torch { -1/16, -6/16, -4/16, 1/16, -1/16, -2/16}, -- moved torch
} }
elseif i == 4 then elseif i == 4 then
boxes = { boxes = {
{ -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }, -- the main slab
{ -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch { -1/16, -6/16, 6/16, 1/16, -1/16, 4/16}, -- still torch
{ -1/16, -6/16, -6/16, 1/16, -1/16, -4/16}, -- moved torch { -1/16, -6/16, -6/16, 1/16, -1/16, -4/16}, -- moved torch
} }
end end
local help, tt, longdesc, usagehelp, icon, on_construct local help, tt, longdesc, usagehelp, icon, on_construct
if i == 1 then if i == 1 then
help = true help = true
tt = S("Transmits redstone power only in one direction").."\n".. tt = S("Transmits redstone power only in one direction").."\n"..
S("Delays signal").."\n".. S("Delays signal").."\n"..
S("Output locks when getting active redstone repeater signal from the side") S("Output locks when getting active redstone repeater signal from the side")
longdesc = S("Redstone repeaters are versatile redstone components with multiple purposes: 1. They only allow signals to travel in one direction. 2. They delay the signal. 3. Optionally, they can lock their output in one state.") longdesc = S("Redstone repeaters are versatile redstone components with multiple purposes: 1. They only allow signals to travel in one direction. 2. They delay the signal. 3. Optionally, they can lock their output in one state.")
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".. 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.") 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" icon = "mesecons_delayer_item.png"
-- Check sides of constructed repeater and lock it, if required
-- Check sides of constructed repeater and lock it, if required on_construct = function(pos)
on_construct = function(pos) local node = minetest.get_node(pos)
local node = minetest.get_node(pos) local sides = delayer_get_sides(node)
local sides = delayer_get_sides(node) for s=1, #sides do
for s=1, #sides do local spos = vector.add(pos, sides[s])
local spos = vector.add(pos, sides[s]) local snode = minetest.get_node(spos)
local snode = minetest.get_node(spos) -- Is there a powered repeater at one of our sides?
-- Is there a powered repeater at one of our sides? local g = minetest.get_item_group(snode.name, "redstone_repeater")
local g = minetest.get_item_group(snode.name, "redstone_repeater") if g ~= 0 and mesecon.is_receptor_on(snode.name) then
if g ~= 0 and mesecon.is_receptor_on(snode.name) then -- The other repeater must also face towards the constructed node
-- The other repeater must also face towards the constructed node local sface = delayer_get_output_rules(snode)[1]
local sface = delayer_get_output_rules(snode)[1] local sface_pos = vector.add(spos, sface)
local sface_pos = vector.add(spos, sface) if vector.equals(sface_pos, pos) then
if vector.equals(sface_pos, pos) then -- Repeater is facing towards us! Now we just need to lock the costructed node
-- Repeater is facing towards us! Now we just need to lock the costructed node if mesecon.is_powered(pos, delayer_get_input_rules(node)[1]) ~= false then
if mesecon.is_powered(pos, delayer_get_input_rules(node)[1]) ~= false then local newnode = {name="mesecons_delayer:delayer_on_locked", param2 = node.param2}
local newnode = {name="mesecons_delayer:delayer_on_locked", param2 = node.param2} minetest.set_node(pos, newnode)
minetest.set_node(pos, newnode) mesecon.queue:add_action(pos, "receptor_on", {delayer_get_output_rules(newnode)}, DEFAULT_DELAY, nil)
mesecon.queue:add_action(pos, "receptor_on", {delayer_get_output_rules(newnode)}, DEFAULT_DELAY, nil) else
else minetest.set_node(pos, {name="mesecons_delayer:delayer_off_locked", param2 = node.param2})
minetest.set_node(pos, {name="mesecons_delayer:delayer_off_locked", param2 = node.param2}) end
break
end end
break
end end
end end
end end
else
help = false
end end
else
help = false
end
local desc_off local desc_off
if i == 1 then if i == 1 then
desc_off = S("Redstone Repeater") desc_off = S("Redstone Repeater")
else else
desc_off = S("Redstone Repeater (Delay @1)", i) desc_off = S("Redstone Repeater (Delay @1)", i)
end end
minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), { minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
description = desc_off, description = desc_off,
inventory_image = icon, inventory_image = icon,
wield_image = icon, wield_image = icon,
_tt_help = tt, _tt_help = tt,
_doc_items_create_entry = help, _doc_items_create_entry = help,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_usagehelp = usagehelp, _doc_items_usagehelp = usagehelp,
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
"mesecons_delayer_off.png", "mesecons_delayer_off.png",
"mcl_stairs_stone_slab_top.png", "mcl_stairs_stone_slab_top.png",
"mesecons_delayer_sides_off.png", "mesecons_delayer_sides_off.png",
"mesecons_delayer_sides_off.png", "mesecons_delayer_sides_off.png",
"mesecons_delayer_ends_off.png", "mesecons_delayer_ends_off.png",
"mesecons_delayer_ends_off.png", "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",
walkable = true,
selection_box = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
},
collision_box = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
},
node_box = {
type = "fixed",
fixed = boxes
},
groups = groups,
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = false,
is_ground_content = false,
drop = 'mesecons_delayer:delayer_off_1',
on_rightclick = function (pos, node, clicker)
local protname = clicker:get_player_name()
if minetest.is_protected(pos, protname) then
minetest.record_protection_violation(pos, protname)
return
end
if node.name=="mesecons_delayer:delayer_off_1" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_off_2", param2=node.param2})
elseif node.name=="mesecons_delayer:delayer_off_2" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_off_3", param2=node.param2})
elseif node.name=="mesecons_delayer:delayer_off_3" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_off_4", param2=node.param2})
elseif node.name=="mesecons_delayer:delayer_off_4" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_off_1", param2=node.param2})
end
end,
on_construct = on_construct,
delayer_time = delaytime,
delayer_onstate = "mesecons_delayer:delayer_on_"..tostring(i),
delayer_lockstate = "mesecons_delayer:delayer_off_locked",
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {
receptor =
{
state = mesecon.state.off,
rules = delayer_get_output_rules
}, },
effector = use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
{ --wield_image = "mesecons_delayer_off.png",
rules = delayer_get_input_rules, walkable = true,
action_on = delayer_activate selection_box = {
} type = "fixed",
}, fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
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,
drawtype = "nodebox",
tiles = {
"mesecons_delayer_on.png",
"mcl_stairs_stone_slab_top.png",
"mesecons_delayer_sides_on.png",
"mesecons_delayer_sides_on.png",
"mesecons_delayer_ends_on.png",
"mesecons_delayer_ends_on.png",
},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
walkable = true,
selection_box = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
},
collision_box = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
},
node_box = {
type = "fixed",
fixed = boxes
},
groups = {dig_immediate = 3, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1, attached_node=1, redstone_repeater=i, not_in_creative_inventory = 1},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = false,
is_ground_content = false,
drop = 'mesecons_delayer:delayer_off_1',
on_rightclick = function (pos, node, clicker)
local protname = clicker:get_player_name()
if minetest.is_protected(pos, protname) then
minetest.record_protection_violation(pos, protname)
return
end
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
minetest.set_node(pos, {name="mesecons_delayer:delayer_on_3",param2=node.param2})
elseif node.name=="mesecons_delayer:delayer_on_3" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_on_4",param2=node.param2})
elseif node.name=="mesecons_delayer:delayer_on_4" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_on_1",param2=node.param2})
end
end,
after_dig_node = function(pos, oldnode)
check_unlock_repeater(pos, oldnode)
end,
delayer_time = delaytime,
delayer_offstate = "mesecons_delayer:delayer_off_"..tostring(i),
delayer_lockstate = "mesecons_delayer:delayer_on_locked",
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {
receptor =
{
state = mesecon.state.on,
rules = delayer_get_output_rules
}, },
effector = collision_box = {
{ type = "fixed",
rules = delayer_get_input_rules, fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
action_off = delayer_deactivate },
} node_box = {
}, type = "fixed",
on_rotate = on_rotate, fixed = boxes
}) },
groups = groups,
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = false,
is_ground_content = false,
drop = 'mesecons_delayer:delayer_off_1',
on_rightclick = function (pos, node, clicker)
local protname = clicker:get_player_name()
if minetest.is_protected(pos, protname) then
minetest.record_protection_violation(pos, protname)
return
end
if node.name=="mesecons_delayer:delayer_off_1" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_off_2", param2=node.param2})
elseif node.name=="mesecons_delayer:delayer_off_2" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_off_3", param2=node.param2})
elseif node.name=="mesecons_delayer:delayer_off_3" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_off_4", param2=node.param2})
elseif node.name=="mesecons_delayer:delayer_off_4" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_off_1", param2=node.param2})
end
end,
on_construct = on_construct,
delayer_time = delaytime,
delayer_onstate = "mesecons_delayer:delayer_on_"..tostring(i),
delayer_lockstate = "mesecons_delayer:delayer_off_locked",
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {
receptor = {
state = mesecon.state.off,
rules = delayer_get_output_rules,
},
effector = {
rules = delayer_get_input_rules,
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,
drawtype = "nodebox",
tiles = {
"mesecons_delayer_on.png",
"mcl_stairs_stone_slab_top.png",
"mesecons_delayer_sides_on.png",
"mesecons_delayer_sides_on.png",
"mesecons_delayer_ends_on.png",
"mesecons_delayer_ends_on.png",
},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
walkable = true,
selection_box = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
},
collision_box = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 },
},
node_box = {
type = "fixed",
fixed = boxes
},
groups = {dig_immediate = 3, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1, attached_node=1, redstone_repeater=i, not_in_creative_inventory = 1},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = false,
is_ground_content = false,
drop = 'mesecons_delayer:delayer_off_1',
on_rightclick = function (pos, node, clicker)
local protname = clicker:get_player_name()
if minetest.is_protected(pos, protname) then
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
minetest.set_node(pos, {name="mesecons_delayer:delayer_on_3",param2=node.param2})
elseif node.name=="mesecons_delayer:delayer_on_3" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_on_4",param2=node.param2})
elseif node.name=="mesecons_delayer:delayer_on_4" then
minetest.set_node(pos, {name="mesecons_delayer:delayer_on_1",param2=node.param2})
end
end,
after_dig_node = function(pos, oldnode)
check_unlock_repeater(pos, oldnode)
end,
delayer_time = delaytime,
delayer_offstate = "mesecons_delayer:delayer_off_"..tostring(i),
delayer_lockstate = "mesecons_delayer:delayer_on_locked",
sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {
receptor = {
state = mesecon.state.on,
rules = delayer_get_output_rules,
},
effector = {
rules = delayer_get_input_rules,
action_off = delayer_deactivate,
},
},
on_rotate = on_rotate,
})
end end

View File

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

View File

@ -2,29 +2,36 @@ local S = minetest.get_translator("mesecons_pistons")
local PISTON_MAXIMUM_PUSH = 12 local PISTON_MAXIMUM_PUSH = 12
-- Get mesecon rules of pistons --Get mesecon rules of pistons
local piston_rules =
{{x=0, y=0, z=1}, --everything apart from z- (pusher side)
{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_up_rules = --everything apart from z- (pusher side)
{{x=0, y=0, z=-1}, --everything apart from y+ (pusher side) local piston_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=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_down_rules = --everything apart from y+ (pusher side)
{{x=0, y=0, z=-1}, --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=0, y=0, z=1},
{x=1, y=0, z=0}, {x=-1, y=0, z=0},
{x=0, y=1, z=0}} {x=1, y=0, z=0},
{x=0, y=-1, z=0},
}
local piston_get_rules = function (node) --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},
}
local function piston_get_rules(node)
local rules = piston_rules local rules = piston_rules
for i = 1, node.param2 do for i = 1, node.param2 do
rules = mesecon.rotate_rules_left(rules) rules = mesecon.rotate_rules_left(rules)
@ -32,7 +39,7 @@ local piston_get_rules = function (node)
return rules return rules
end end
local piston_facedir_direction = function (node) local function piston_facedir_direction(node)
local rules = {{x = 0, y = 0, z = -1}} local rules = {{x = 0, y = 0, z = -1}}
for i = 1, node.param2 do for i = 1, node.param2 do
rules = mesecon.rotate_rules_left(rules) rules = mesecon.rotate_rules_left(rules)
@ -40,7 +47,7 @@ local piston_facedir_direction = function (node)
return rules[1] return rules[1]
end end
local piston_get_direction = function (dir, node) local function piston_get_direction(dir, node)
if type(dir) == "function" then if type(dir) == "function" then
return dir(node) return dir(node)
else else
@ -50,7 +57,7 @@ end
-- Remove pusher of piston. -- Remove pusher of piston.
-- To be used when piston was destroyed or dug. -- 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 pistonspec = minetest.registered_nodes[oldnode.name].mesecons_piston
local dir = piston_get_direction(pistonspec.dir, oldnode) local dir = piston_get_direction(pistonspec.dir, oldnode)
@ -70,7 +77,7 @@ end
-- Remove base node of piston. -- Remove base node of piston.
-- To be used when pusher was destroyed. -- 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 basenodename = minetest.registered_nodes[oldnode.name].corresponding_piston
local pistonspec = minetest.registered_nodes[basenodename].mesecons_piston local pistonspec = minetest.registered_nodes[basenodename].mesecons_piston
@ -89,7 +96,7 @@ local piston_remove_base = function (pos, oldnode)
end end
end end
local piston_on = function (pos, node) local function piston_on(pos, node)
local pistonspec = minetest.registered_nodes[node.name].mesecons_piston local pistonspec = minetest.registered_nodes[node.name].mesecons_piston
local dir = piston_get_direction(pistonspec.dir, node) local dir = piston_get_direction(pistonspec.dir, node)
@ -113,7 +120,7 @@ local piston_on = function (pos, node)
end end
end end
local piston_off = function (pos, node) local function piston_off(pos, node)
local pistonspec = minetest.registered_nodes[node.name].mesecons_piston local pistonspec = minetest.registered_nodes[node.name].mesecons_piston
minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.offname}) minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.offname})
piston_remove_pusher (pos, node) piston_remove_pusher (pos, node)
@ -124,13 +131,13 @@ local piston_off = function (pos, node)
local dir = piston_get_direction(pistonspec.dir, node) local dir = piston_get_direction(pistonspec.dir, node)
local pullpos = vector.add(pos, vector.multiply(dir, 2)) local pullpos = vector.add(pos, vector.multiply(dir, 2))
local meta = minetest.get_meta(pos) 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 if success then
mesecon.mvps_process_stack(pos, dir, stack) mesecon.mvps_process_stack(pos, dir, stack)
end end
end end
local piston_orientate = function (pos, placer) local function piston_orientate(pos, placer)
mesecon.mvps_set_owner(pos, placer) mesecon.mvps_set_owner(pos, placer)
-- not placed by player -- not placed by player
@ -158,14 +165,14 @@ local piston_pusher_box = {
fixed = { fixed = {
{-2/16, -2/16, -.5 + pt, 2/16, 2/16, .5 + pt}, {-2/16, -2/16, -.5 + pt, 2/16, 2/16, .5 + pt},
{-.5 , -.5 , -.5 , .5 , .5 , -.5 + pt}, {-.5 , -.5 , -.5 , .5 , .5 , -.5 + pt},
} },
} }
local piston_on_box = { local piston_on_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-.5, -.5, -.5 + pt, .5, .5, .5} {-.5, -.5, -.5 + pt, .5, .5, .5}
} },
} }
@ -195,18 +202,20 @@ minetest.register_node("mesecons_pistons:piston_normal_off", {
"mesecons_piston_bottom.png^[transformR270", "mesecons_piston_bottom.png^[transformR270",
"mesecons_piston_back.png", "mesecons_piston_back.png",
"mesecons_piston_pusher_front.png" "mesecons_piston_pusher_front.png"
}, },
groups = {handy = 1, piston=1}, groups = {handy=1, piston=1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
after_place_node = piston_orientate, after_place_node = piston_orientate,
mesecons_piston = pistonspec_normal, mesecons_piston = pistonspec_normal,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={ mesecons = {
action_on = piston_on, effector = {
rules = piston_get_rules action_on = piston_on,
}}, rules = piston_get_rules
},
},
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
on_rotate = function(pos, node, user, mode) on_rotate = function(pos, node, user, mode)
@ -227,8 +236,8 @@ minetest.register_node("mesecons_pistons:piston_normal_on", {
"mesecons_piston_bottom.png^[transformR270", "mesecons_piston_bottom.png^[transformR270",
"mesecons_piston_back.png", "mesecons_piston_back.png",
"mesecons_piston_on_front.png" "mesecons_piston_on_front.png"
}, },
groups = {handy=1, piston=1, not_in_creative_inventory = 1}, groups = {handy=1, piston=1, not_in_creative_inventory=1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
@ -238,10 +247,12 @@ minetest.register_node("mesecons_pistons:piston_normal_on", {
selection_box = piston_on_box, selection_box = piston_on_box,
mesecons_piston = pistonspec_normal, mesecons_piston = pistonspec_normal,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={ mesecons = {
action_off = piston_off, effector = {
rules = piston_get_rules action_off = piston_off,
}}, rules = piston_get_rules
},
},
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
on_rotate = false, on_rotate = false,
@ -257,10 +268,10 @@ minetest.register_node("mesecons_pistons:piston_pusher_normal", {
"mesecons_piston_pusher_right.png", "mesecons_piston_pusher_right.png",
"mesecons_piston_pusher_back.png", "mesecons_piston_pusher_back.png",
"mesecons_piston_pusher_front.png" "mesecons_piston_pusher_front.png"
}, },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = { piston_pusher = 1 }, groups = {piston_pusher=1},
is_ground_content = false, is_ground_content = false,
after_destruct = piston_remove_base, after_destruct = piston_remove_base,
diggable = false, diggable = false,
@ -299,7 +310,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", {
"mesecons_piston_bottom.png^[transformR270", "mesecons_piston_bottom.png^[transformR270",
"mesecons_piston_back.png", "mesecons_piston_back.png",
"mesecons_piston_pusher_front_sticky.png" "mesecons_piston_pusher_front_sticky.png"
}, },
groups = {handy=1, piston=2}, groups = {handy=1, piston=2},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
@ -307,10 +318,12 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", {
after_place_node = piston_orientate, after_place_node = piston_orientate,
mesecons_piston = pistonspec_sticky, mesecons_piston = pistonspec_sticky,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={ mesecons = {
action_on = piston_on, effector = {
rules = piston_get_rules action_on = piston_on,
}}, rules = piston_get_rules
},
},
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
on_rotate = function(pos, node, user, mode) on_rotate = function(pos, node, user, mode)
@ -331,8 +344,8 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", {
"mesecons_piston_bottom.png^[transformR270", "mesecons_piston_bottom.png^[transformR270",
"mesecons_piston_back.png", "mesecons_piston_back.png",
"mesecons_piston_on_front.png" "mesecons_piston_on_front.png"
}, },
groups = {handy=1, piston=2, not_in_creative_inventory = 1}, groups = {handy=1, piston=2, not_in_creative_inventory=1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
@ -342,10 +355,12 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", {
selection_box = piston_on_box, selection_box = piston_on_box,
mesecons_piston = pistonspec_sticky, mesecons_piston = pistonspec_sticky,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={ mesecons = {
action_off = piston_off, effector = {
rules = piston_get_rules action_off = piston_off,
}}, rules = piston_get_rules
},
},
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
on_rotate = false, on_rotate = false,
@ -361,10 +376,10 @@ minetest.register_node("mesecons_pistons:piston_pusher_sticky", {
"mesecons_piston_pusher_right.png", "mesecons_piston_pusher_right.png",
"mesecons_piston_pusher_back.png", "mesecons_piston_pusher_back.png",
"mesecons_piston_pusher_front_sticky.png" "mesecons_piston_pusher_front_sticky.png"
}, },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = { piston_pusher = 2 }, groups = {piston_pusher=2},
is_ground_content = false, is_ground_content = false,
after_destruct = piston_remove_base, after_destruct = piston_remove_base,
diggable = false, diggable = false,
@ -388,14 +403,14 @@ local piston_up_pusher_box = {
fixed = { fixed = {
{-2/16, -.5 - pt, -2/16, 2/16, .5 - pt, 2/16}, {-2/16, -.5 - pt, -2/16, 2/16, .5 - pt, 2/16},
{-.5 , .5 - pt, -.5 , .5 , .5 , .5}, {-.5 , .5 - pt, -.5 , .5 , .5 , .5},
} },
} }
local piston_up_on_box = { local piston_up_on_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-.5, -.5, -.5 , .5, .5-pt, .5} {-.5, -.5, -.5 , .5, .5-pt, .5}
} },
} }
-- Normal -- Normal
@ -404,7 +419,7 @@ local pistonspec_normal_up = {
offname = "mesecons_pistons:piston_up_normal_off", offname = "mesecons_pistons:piston_up_normal_off",
onname = "mesecons_pistons:piston_up_normal_on", onname = "mesecons_pistons:piston_up_normal_on",
dir = {x = 0, y = 1, z = 0}, dir = {x = 0, y = 1, z = 0},
pusher = "mesecons_pistons:piston_up_pusher_normal" pusher = "mesecons_pistons:piston_up_pusher_normal",
} }
-- offstate -- offstate
@ -416,17 +431,19 @@ minetest.register_node("mesecons_pistons:piston_up_normal_off", {
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
}, },
groups = {handy=1, piston=1, not_in_creative_inventory = 1}, groups = {handy=1, piston=1, not_in_creative_inventory=1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
drop = "mesecons_pistons:piston_normal_off", drop = "mesecons_pistons:piston_normal_off",
mesecons_piston = pistonspec_normal_up, mesecons_piston = pistonspec_normal_up,
mesecons = {effector={ mesecons = {
action_on = piston_on, effector = {
rules = piston_up_rules, action_on = piston_on,
}}, rules = piston_up_rules,
},
},
sounds = mcl_sounds.node_sound_stone_defaults({ sounds = mcl_sounds.node_sound_stone_defaults({
footstep = mcl_sounds.node_sound_wood_defaults().footstep footstep = mcl_sounds.node_sound_wood_defaults().footstep
}), }),
@ -451,8 +468,8 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", {
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
}, },
groups = {handy=1, piston_=1, not_in_creative_inventory = 1}, groups = {handy=1, piston_=1, not_in_creative_inventory=1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
@ -462,10 +479,12 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", {
selection_box = piston_up_on_box, selection_box = piston_up_on_box,
mesecons_piston = pistonspec_normal_up, mesecons_piston = pistonspec_normal_up,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={ mesecons = {
action_off = piston_off, effector = {
rules = piston_up_rules, action_off = piston_off,
}}, rules = piston_up_rules,
},
},
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
on_rotate = false, on_rotate = false,
@ -481,10 +500,10 @@ minetest.register_node("mesecons_pistons:piston_up_pusher_normal", {
"mesecons_piston_pusher_right.png^[transformR90", "mesecons_piston_pusher_right.png^[transformR90",
"mesecons_piston_pusher_bottom.png", "mesecons_piston_pusher_bottom.png",
"mesecons_piston_pusher_top.png^[transformR180", "mesecons_piston_pusher_top.png^[transformR180",
}, },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = { piston_pusher = 1 }, groups = {piston_pusher=1},
is_ground_content = false, is_ground_content = false,
after_destruct = piston_remove_base, after_destruct = piston_remove_base,
diggable = false, diggable = false,
@ -507,7 +526,7 @@ local pistonspec_sticky_up = {
onname = "mesecons_pistons:piston_up_sticky_on", onname = "mesecons_pistons:piston_up_sticky_on",
dir = {x = 0, y = 1, z = 0}, dir = {x = 0, y = 1, z = 0},
pusher = "mesecons_pistons:piston_up_pusher_sticky", pusher = "mesecons_pistons:piston_up_pusher_sticky",
sticky = true sticky = true,
} }
-- offstate -- offstate
@ -519,8 +538,8 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_off", {
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
}, },
groups = {handy=1, piston=2, not_in_creative_inventory = 1}, groups = {handy=1, piston=2, not_in_creative_inventory=1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
@ -529,10 +548,12 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_off", {
sounds = mcl_sounds.node_sound_stone_defaults({ sounds = mcl_sounds.node_sound_stone_defaults({
footstep = mcl_sounds.node_sound_wood_defaults().footstep footstep = mcl_sounds.node_sound_wood_defaults().footstep
}), }),
mesecons = {effector={ mesecons = {
action_on = piston_on, effector = {
rules = piston_up_rules, action_on = piston_on,
}}, rules = piston_up_rules,
},
},
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
on_rotate = function(pos, node, user, mode) on_rotate = function(pos, node, user, mode)
@ -554,8 +575,8 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_on", {
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
"mesecons_piston_bottom.png", "mesecons_piston_bottom.png",
}, },
groups = {handy=1, piston=2, not_in_creative_inventory = 1}, groups = {handy=1, piston=2, not_in_creative_inventory=1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
@ -565,10 +586,12 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_on", {
selection_box = piston_up_on_box, selection_box = piston_up_on_box,
mesecons_piston = pistonspec_sticky_up, mesecons_piston = pistonspec_sticky_up,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={ mesecons = {
action_off = piston_off, effector = {
rules = piston_up_rules, action_off = piston_off,
}}, rules = piston_up_rules,
},
},
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
on_rotate = false, on_rotate = false,
@ -584,10 +607,10 @@ minetest.register_node("mesecons_pistons:piston_up_pusher_sticky", {
"mesecons_piston_pusher_right.png^[transformR90", "mesecons_piston_pusher_right.png^[transformR90",
"mesecons_piston_pusher_bottom.png", "mesecons_piston_pusher_bottom.png",
"mesecons_piston_pusher_top.png^[transformR180", "mesecons_piston_pusher_top.png^[transformR180",
}, },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = { piston_pusher = 2 }, groups = {piston_pusher=2},
is_ground_content = false, is_ground_content = false,
after_destruct = piston_remove_base, after_destruct = piston_remove_base,
diggable = false, diggable = false,
@ -611,14 +634,14 @@ local piston_down_pusher_box = {
fixed = { fixed = {
{-2/16, -.5 + pt, -2/16, 2/16, .5 + pt, 2/16}, {-2/16, -.5 + pt, -2/16, 2/16, .5 + pt, 2/16},
{-.5 , -.5 , -.5 , .5 , -.5 + pt, .5}, {-.5 , -.5 , -.5 , .5 , -.5 + pt, .5},
} },
} }
local piston_down_on_box = { local piston_down_on_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-.5, -.5+pt, -.5 , .5, .5, .5} {-.5, -.5+pt, -.5 , .5, .5, .5}
} },
} }
@ -641,18 +664,20 @@ minetest.register_node("mesecons_pistons:piston_down_normal_off", {
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
}, },
groups = {handy=1, piston=1, not_in_creative_inventory = 1}, groups = {handy=1, piston=1, not_in_creative_inventory=1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
drop = "mesecons_pistons:piston_normal_off", drop = "mesecons_pistons:piston_normal_off",
mesecons_piston = pistonspec_normal_down, mesecons_piston = pistonspec_normal_down,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={ mesecons = {
action_on = piston_on, effector = {
rules = piston_down_rules, action_on = piston_on,
}}, rules = piston_down_rules,
},
},
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
on_rotate = function(pos, node, user, mode) on_rotate = function(pos, node, user, mode)
@ -674,8 +699,8 @@ minetest.register_node("mesecons_pistons:piston_down_normal_on", {
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
}, },
groups = {handy=1, piston=1, not_in_creative_inventory = 1}, groups = {handy=1, piston=1, not_in_creative_inventory=1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
@ -685,10 +710,12 @@ minetest.register_node("mesecons_pistons:piston_down_normal_on", {
selection_box = piston_down_on_box, selection_box = piston_down_on_box,
mesecons_piston = pistonspec_normal_down, mesecons_piston = pistonspec_normal_down,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={ mesecons = {
action_off = piston_off, effector = {
rules = piston_down_rules, action_off = piston_off,
}}, rules = piston_down_rules,
},
},
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
on_rotate = false, on_rotate = false,
@ -704,10 +731,10 @@ minetest.register_node("mesecons_pistons:piston_down_pusher_normal", {
"mesecons_piston_pusher_right.png^[transformR270", "mesecons_piston_pusher_right.png^[transformR270",
"mesecons_piston_pusher_bottom.png^[transformR180", "mesecons_piston_pusher_bottom.png^[transformR180",
"mesecons_piston_pusher_top.png", "mesecons_piston_pusher_top.png",
}, },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = { piston_pusher = 1 }, groups = {piston_pusher=1},
is_ground_content = false, is_ground_content = false,
after_destruct = piston_remove_base, after_destruct = piston_remove_base,
diggable = false, diggable = false,
@ -727,7 +754,7 @@ local pistonspec_sticky_down = {
offname = "mesecons_pistons:piston_down_sticky_off", offname = "mesecons_pistons:piston_down_sticky_off",
dir = {x = 0, y = -1, z = 0}, dir = {x = 0, y = -1, z = 0},
pusher = "mesecons_pistons:piston_down_pusher_sticky", pusher = "mesecons_pistons:piston_down_pusher_sticky",
sticky = true sticky = true,
} }
-- offstate -- offstate
@ -739,7 +766,7 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_off", {
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
}, },
groups = {handy=1, piston=2, not_in_creative_inventory = 1}, groups = {handy=1, piston=2, not_in_creative_inventory = 1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
@ -747,10 +774,12 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_off", {
drop = "mesecons_pistons:piston_sticky_off", drop = "mesecons_pistons:piston_sticky_off",
mesecons_piston = pistonspec_sticky_down, mesecons_piston = pistonspec_sticky_down,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={ mesecons = {
action_on = piston_on, effector = {
rules = piston_down_rules, action_on = piston_on,
}}, rules = piston_down_rules,
},
},
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
on_rotate = function(pos, node, user, mode) on_rotate = function(pos, node, user, mode)
@ -772,8 +801,8 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_on", {
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
"mesecons_piston_bottom.png^[transformR180", "mesecons_piston_bottom.png^[transformR180",
}, },
groups = {handy=1, piston=1, not_in_creative_inventory = 1}, groups = {handy=1, piston=1, not_in_creative_inventory=1},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
@ -783,10 +812,12 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_on", {
selection_box = piston_down_on_box, selection_box = piston_down_on_box,
mesecons_piston = pistonspec_sticky_down, mesecons_piston = pistonspec_sticky_down,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
mesecons = {effector={ mesecons = {
action_off = piston_off, effector = {
rules = piston_down_rules, action_off = piston_off,
}}, rules = piston_down_rules,
},
},
_mcl_blast_resistance = 0.5, _mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5, _mcl_hardness = 0.5,
on_rotate = false, on_rotate = false,
@ -802,10 +833,10 @@ minetest.register_node("mesecons_pistons:piston_down_pusher_sticky", {
"mesecons_piston_pusher_right.png^[transformR270", "mesecons_piston_pusher_right.png^[transformR270",
"mesecons_piston_pusher_bottom.png^[transformR180", "mesecons_piston_pusher_bottom.png^[transformR180",
"mesecons_piston_pusher_top.png", "mesecons_piston_pusher_top.png",
}, },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = { piston_pusher = 2 }, groups = {piston_pusher=2},
is_ground_content = false, is_ground_content = false,
after_destruct = piston_remove_base, after_destruct = piston_remove_base,
diggable = false, diggable = false,
@ -839,7 +870,7 @@ minetest.register_craft({
{"group:wood", "group:wood", "group:wood"}, {"group:wood", "group:wood", "group:wood"},
{"mcl_core:cobble", "mcl_core:iron_ingot", "mcl_core:cobble"}, {"mcl_core:cobble", "mcl_core:iron_ingot", "mcl_core:cobble"},
{"mcl_core:cobble", "mesecons:redstone", "mcl_core:cobble"}, {"mcl_core:cobble", "mesecons:redstone", "mcl_core:cobble"},
} },
}) })
minetest.register_craft({ minetest.register_craft({
@ -847,7 +878,7 @@ minetest.register_craft({
recipe = { recipe = {
{"mcl_mobitems:slimeball"}, {"mcl_mobitems:slimeball"},
{"mesecons_pistons:piston_normal_off"}, {"mesecons_pistons:piston_normal_off"},
} },
}) })
-- Add entry aliases for the Help -- Add entry aliases for the Help

View File

@ -116,7 +116,7 @@ function mesecon.register_pressure_plate(basename, description, textures_off, te
wield_image = image_w, wield_image = image_w,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
description = description, description = description,
on_timer = pp_on_timer, on_timer = pp_on_timer,
on_construct = function(pos) on_construct = function(pos)
minetest.get_node_timer(pos):start(PRESSURE_PLATE_INTERVAL) minetest.get_node_timer(pos):start(PRESSURE_PLATE_INTERVAL)

View File

@ -33,7 +33,7 @@ local wire_getconnect = function (from_pos, self_pos)
if minetest.registered_nodes[node.name] if minetest.registered_nodes[node.name]
and minetest.registered_nodes[node.name].mesecons then and minetest.registered_nodes[node.name].mesecons then
-- rules of node to possibly connect to -- rules of node to possibly connect to
local rules = {} local rules
if (minetest.registered_nodes[node.name].mesecon_wire) then if (minetest.registered_nodes[node.name].mesecon_wire) then
rules = wire_rules rules = wire_rules
else else
@ -214,8 +214,7 @@ local function register_wires()
local dot_off = "redstone_redstone_dust_dot.png^[colorize:#FF0000:"..ratio_off 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 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_off, tiles_on
local tiles_on = { crossing_on, crossing_on, straight0_on, straight1_on, straight0_on, straight1_on }
local wirehelp, tt, longdesc, usagehelp, img, desc_off, desc_on local wirehelp, tt, longdesc, usagehelp, img, desc_off, desc_on
if nodeid == "00000000" then if nodeid == "00000000" then
@ -238,8 +237,8 @@ S("Read the help entries on the other redstone components to learn how redstone
else else
-- Connected redstone wire -- Connected redstone wire
table.insert(nodebox, box_center) table.insert(nodebox, box_center)
tiles_off = { crossing_off, crossing_off, straight0_off, straight1_off, straight0_off, straight1_off, } 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_on = { crossing_on, crossing_on, straight0_on, straight1_on, straight0_on, straight1_on }
wirehelp = false wirehelp = false
desc_off = S("Redstone Trail (@1)", nodeid) desc_off = S("Redstone Trail (@1)", nodeid)
desc_on = S("Powered 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. -- needs to be used up to repair the tool.
local function get_consumed_materials(tool, material) local function get_consumed_materials(tool, material)
local wear = tool:get_wear() local wear = tool:get_wear()
local health = (MAX_WEAR - wear) --local health = (MAX_WEAR - wear)
local matsize = material:get_count() local matsize = material:get_count()
local materials_used = 0 local materials_used = 0
for m=1, math.min(4, matsize) do for m=1, math.min(4, matsize) do
@ -74,10 +74,9 @@ end
local function update_anvil_slots(meta) local function update_anvil_slots(meta)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local new_name = meta:get_string("set_name") local new_name = meta:get_string("set_name")
local input1, input2, output local input1 = inv:get_stack("input", 1)
input1 = inv:get_stack("input", 1) local input2 = inv:get_stack("input", 2)
input2 = inv:get_stack("input", 2) --local output = inv:get_stack("output", 1)
output = inv:get_stack("output", 1)
local new_output, name_item local new_output, name_item
local just_rename = false local just_rename = false
@ -243,7 +242,6 @@ end
-- Returns true if anvil was destroyed. -- Returns true if anvil was destroyed.
local function damage_anvil(pos) local function damage_anvil(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local new
if node.name == "mcl_anvils:anvil" then if node.name == "mcl_anvils:anvil" then
minetest.swap_node(pos, {name="mcl_anvils:anvil_damage_1", param2=node.param2}) minetest.swap_node(pos, {name="mcl_anvils:anvil_damage_1", param2=node.param2})
damage_particles(pos, node) damage_particles(pos, node)
@ -278,7 +276,6 @@ local function damage_anvil_by_using(pos)
end end
local function damage_anvil_by_falling(pos, distance) local function damage_anvil_by_falling(pos, distance)
local chance
local r = math.random(1, 100) local r = math.random(1, 100)
if distance > 1 then if distance > 1 then
if r <= (5*distance) 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 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 pattern_ok = false
break break
else
end end
inv_i = inv_i + 1 inv_i = inv_i + 1
if inv_i > max_i then if inv_i > max_i then

View File

@ -48,7 +48,9 @@ local function rotate(pos, node, user, mode, new_param2)
return false return false
end 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 if bottom then
newp = vector_add(pos, new_dir) newp = vector_add(pos, new_dir)
else else
@ -153,7 +155,7 @@ function mcl_beds.register_bed(name, def)
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
stack_max = 1, 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_hardness = 0.2,
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
sounds = def.sounds or default_sounds, sounds = def.sounds or default_sounds,

View File

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

View File

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

View File

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

View File

@ -228,11 +228,10 @@ end
controls.register_on_release(function(player, key, time) controls.register_on_release(function(player, key, time)
if key~="RMB" then return end 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() 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 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 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 enchanted = mcl_enchanting.is_enchanted(wielditem:get_name())
local speed, damage local speed, damage
@ -272,7 +271,7 @@ controls.register_on_release(function(player, key, time)
damage = math.max(1, math.floor(9 * charge_ratio)) damage = math.max(1, math.floor(9 * charge_ratio))
end 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 if enchanted then
wielditem:set_name("mcl_bows:bow_enchanted") 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 if key ~= "RMB" or not (creative or get_arrow(player)) then
return return
end 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() 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 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()) 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 name = player:get_player_name()
local wielditem = player:get_wielded_item() local wielditem = player:get_wielded_item()
local wieldindex = player:get_wield_index() 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 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) reset_bow_state(player, true)
end end

View File

@ -61,14 +61,14 @@ local brewing_formspec = "size[9,8.75]"..
"listring[context;stand]" "listring[context;stand]"
local function swap_node(pos, name) --[[local function swap_node(pos, name)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if node.name == name then if node.name == name then
return return
end end
node.name = name node.name = name
minetest.swap_node(pos, node) minetest.swap_node(pos, node)
end end]]
local function brewable(inv) 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 BREW_TIME = 20 -- all brews brew the same
local BURN_TIME = BREW_TIME * 10 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 stand_timer = meta:get_float("stand_timer") or 0
local fuel = meta:get_float("fuel") or 0 local fuel = meta:get_float("fuel") or 0
local inv = meta:get_inventory() 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 input_count, fuel_name, fuel_count, formspec, fuel_percent, brew_percent
local update = true local update = true
@ -124,9 +125,9 @@ local function brewing_stand_timer(pos, elapsed)
update = false update = false
input_list = inv:get_list("input") --input_list = inv:get_list("input")
stand_list = inv:get_list("stand") --stand_list = inv:get_list("stand")
fuel_list = inv:get_list("fuel") --fuel_list = inv:get_list("fuel")
-- TODO ... fix this. Goal is to reset the process if the stand changes -- 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 -- 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 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() local name = player:get_player_name()
if minetest.is_protected(pos, name) then if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name) 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 elseif listname == "stand" then
return 0 return 0
end end
end end]]
-- Drop input items of brewing_stand at pos with metadata meta -- 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("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!") 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_base.png", --bottom "mcl_brewing_top.png", --top
"mcl_brewing_side.png", --right "mcl_brewing_base.png", --bottom
"mcl_brewing_side.png", --left "mcl_brewing_side.png", --right
"mcl_brewing_side.png", --back "mcl_brewing_side.png", --left
"mcl_brewing_side.png^[transformFX"} --front "mcl_brewing_side.png", --back
"mcl_brewing_side.png^[transformFX", --front
}
local allow_put = function(pos, listname, index, stack, player) local allow_put = function(pos, listname, index, stack, player)
local name = player:get_player_name() 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 --some code here to enforce only potions getting placed on stands
end end
local after_dig = function(pos, oldnode, oldmetadata, digger) --[[local after_dig = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:from_table(oldmetadata) meta:from_table(oldmetadata)
drop_brewing_stand_items(pos, meta) drop_brewing_stand_items(pos, meta)
end end]]
local on_destruct = function(pos) local on_destruct = function(pos)
local meta = minetest.get_meta(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_doc = minetest.get_modpath("doc")
local mod_mcl_core = minetest.get_modpath("mcl_core") 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 vector = vector
local math = math local math = math

View File

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

View File

@ -162,13 +162,14 @@ Value:
Otherwise: nil ]] Otherwise: nil ]]
local open_chests = {} local open_chests = {}
local function back_is_blocked(pos, dir) --[[local function back_is_blocked(pos, dir)
pos = vector.add(pos, dir) pos = vector.add(pos, dir)
local def = minetest.registered_nodes[minetest.get_node(pos).name] local def = minetest.registered_nodes[minetest.get_node(pos).name]
pos.y = pos.y + 1 pos.y = pos.y + 1
local def2 = minetest.registered_nodes[minetest.get_node(pos).name] 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 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 -- 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 player_chest_open = function(player, pos, node_name, textures, param2, double, sound, mesh, shulker)
local name = player:get_player_name() 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 }) minetest.swap_node(p, { name = small_name, param2 = param2 })
create_entity(p, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest", "chest") create_entity(p, small_name, small_textures, param2, false, "default_chest", "mcl_chests_chest", "chest")
local meta = minetest.get_meta(pos)
end, end,
after_dig_node = drop_items_chest, after_dig_node = drop_items_chest,
on_blast = on_chest_blast, on_blast = on_chest_blast,
@ -898,7 +898,7 @@ register_chest("trapped_chest_on",
"trapped_chest" "trapped_chest"
) )
local function close_if_trapped_chest(pos, player) --[[local function close_if_trapped_chest(pos, player)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if node.name == "mcl_chests:trapped_chest_on_small" then 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) player_chest_close(player)
end end
end end]]
-- Disable chest when it has been closed -- Disable chest when it has been closed
minetest.register_on_player_receive_fields(function(player, formname, fields) 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 -- Save metadata of shulker box when used in crafting
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv) 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 if minetest.get_item_group(itemstack:get_name(), "shulker_box") ~= 1 then
return return
end end

View File

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

View File

@ -4,7 +4,8 @@ mcl_compass = {}
local compass_frames = 32 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 -- Timer for random compass spinning
local random_timer = 0 local random_timer = 0
@ -79,7 +80,9 @@ for i,img in ipairs(images) do
if i == stereotype_frame then if i == stereotype_frame then
inv = 0 inv = 0
end 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 use_doc = i == stereotype_frame
if use_doc then if use_doc then
tt = S("Points to the world origin") tt = S("Points to the world origin")
@ -91,7 +94,7 @@ for i,img in ipairs(images) do
_tt_help = tt, _tt_help = tt,
_doc_items_create_entry = use_doc, _doc_items_create_entry = use_doc,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_usagehelp = usagehelp, --_doc_items_usagehelp = usagehelp,
inventory_image = img, inventory_image = img,
wield_image = img, wield_image = img,
stack_max = 64, stack_max = 64,

View File

@ -28,7 +28,6 @@ minetest.register_craftitem("mcl_core:coal_lump", {
description = S("Coal"), 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_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, _doc_items_hidden = false,
groups = { coal=1 },
inventory_image = "default_coal_lump.png", inventory_image = "default_coal_lump.png",
stack_max = 64, stack_max = 64,
groups = { craftitem=1, coal=1 }, groups = { craftitem=1, coal=1 },
@ -38,7 +37,6 @@ minetest.register_craftitem("mcl_core:charcoal_lump", {
description = S("Charcoal"), 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_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, _doc_items_hidden = false,
groups = { coal=1 },
inventory_image = "mcl_core_charcoal.png", inventory_image = "mcl_core_charcoal.png",
stack_max = 64, stack_max = 64,
groups = { craftitem=1, coal=1 }, groups = { craftitem=1, coal=1 },

View File

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

View File

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

View File

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

View File

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

View File

@ -39,7 +39,6 @@ minetest.register_node("mcl_core:slimeblock", {
type = "regular", type = "regular",
}, },
tiles = {"mcl_core_slime.png"}, tiles = {"mcl_core_slime.png"},
paramtype = "light",
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "blend" or true, use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "blend" or true,
stack_max = 64, 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 -- 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 end
local register_leaves = function(subname, description, longdesc, tiles, sapling, drop_apples, sapling_chances, leafdecay_distance) local register_leaves = function(subname, description, longdesc, tiles, sapling, drop_apples, sapling_chances, leafdecay_distance)
local drop
if leafdecay_distance == nil then if leafdecay_distance == nil then
leafdecay_distance = 4 leafdecay_distance = 4
end 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 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.") usagehelp = S("To open or close this trapdoor, rightclick it or send a redstone signal to it.")
end end
if not tt_help then if def.only_redstone_can_open then
if def.only_redstone_can_open then tt_help = S("Openable by redstone power")
tt_help = S("Openable by redstone power") else
else tt_help = S("Openable by players and redstone power")
tt_help = S("Openable by players and redstone power") end
end
end
-- Closed trapdoor -- Closed trapdoor
@ -164,7 +162,7 @@ function mcl_doors:register_trapdoor(name, def)
local fpos = get_fpos(placer, pointed_thing) 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) if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
or (fpos < -0.5 and fpos > -0.999999999) then or (fpos < -0.5 and fpos > -0.999999999) then
param2 = param2 + 20 param2 = param2 + 20

View File

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

View File

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

View File

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

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("mcl_end") local S = minetest.get_translator("mcl_end")
local vector = vector
local explosion_strength = 6 local explosion_strength = 6
local directions = { local directions = {
@ -45,7 +47,7 @@ local function set_crystal_animation(self)
end end
local function spawn_crystal(pos) 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 not vector.equals(pos, vector.floor(pos)) then return end
if mcl_worlds.pos_to_dimension(pos) ~= "end" then return end if mcl_worlds.pos_to_dimension(pos) ~= "end" then return end
local portal_center 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 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.sound_play(minetest.registered_nodes[plantname].sounds.place, {pos = pos}, true)
minetest.add_node(pos, {name=plantname, param2 = minetest.registered_nodes[plantname].place_param2}) 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 else
return return
end end

View File

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

View File

@ -2,6 +2,8 @@
local S = minetest.get_translator("mcl_fishing") local S = minetest.get_translator("mcl_fishing")
local math = math
local bobber_ENTITY={ local bobber_ENTITY={
physical = false, physical = false,
timer=0, timer=0,
@ -31,143 +33,141 @@ local fish = function(itemstack, player, pointed_thing)
end end
end end
local pos = player:get_pos() local pos = player:get_pos()
local objs = minetest.get_objects_inside_radius(pos, 125) local objs = minetest.get_objects_inside_radius(pos, 125)
local num = 0 local ent
local ent = nil local noent = false
local noent = true
local durability = 65 local durability = 65
local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking") local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking")
if unbreaking > 0 then if unbreaking > 0 then
durability = durability * (unbreaking + 1) durability = durability * (unbreaking + 1)
end end
--Check for bobber if so handle. --Check for bobber if so handle.
for n = 1, #objs do for n = 1, #objs do
ent = objs[n]:get_luaentity() ent = objs[n]:get_luaentity()
if ent then if ent then
if ent.player and ent.objtype=="fishing" then if ent.player and ent.objtype=="fishing" then
if (player:get_player_name() == ent.player) then if (player:get_player_name() == ent.player) then
noent = false if ent._dive == true then
if ent._dive == true then local items
local itemname local pr = PseudoRandom(os.time() * math.random(1, 100))
local items local r = pr:next(1, 100)
local itemcount = 1 local fish_values = {85, 84.8, 84.7, 84.5}
local pr = PseudoRandom(os.time() * math.random(1, 100)) local junk_values = {10, 8.1, 6.1, 4.2}
local r = pr:next(1, 100) local luck_of_the_sea = math.min(mcl_enchanting.get_enchantment(itemstack, "luck_of_the_sea"), 3)
local fish_values = {85, 84.8, 84.7, 84.5} local index = luck_of_the_sea + 1
local junk_values = {10, 8.1, 6.1, 4.2} local fish_value = fish_values[index]
local luck_of_the_sea = math.min(mcl_enchanting.get_enchantment(itemstack, "luck_of_the_sea"), 3) local junk_value = junk_values[index] + fish_value
local index = luck_of_the_sea + 1 if r <= fish_value then
local fish_value = fish_values[index] -- Fish
local junk_value = junk_values[index] + fish_value items = mcl_loot.get_loot({
if r <= fish_value then items = {
-- Fish { itemstring = "mcl_fishing:fish_raw", weight = 60 },
items = mcl_loot.get_loot({ { itemstring = "mcl_fishing:salmon_raw", weight = 25 },
items = { { itemstring = "mcl_fishing:clownfish_raw", weight = 2 },
{ itemstring = "mcl_fishing:fish_raw", weight = 60 }, { itemstring = "mcl_fishing:pufferfish_raw", weight = 13 },
{ itemstring = "mcl_fishing:salmon_raw", weight = 25 }, }
{ itemstring = "mcl_fishing:clownfish_raw", weight = 2 }, }, pr)
{ itemstring = "mcl_fishing:pufferfish_raw", weight = 13 }, elseif r <= junk_value then
} -- Junk
}, pr) items = mcl_loot.get_loot({
elseif r <= junk_value then items = {
-- Junk { itemstring = "mcl_core:bowl", weight = 10 },
items = mcl_loot.get_loot({ { itemstring = "mcl_fishing:fishing_rod", weight = 2, wear_min = 6554, wear_max = 65535 }, -- 10%-100% damage
items = { { itemstring = "mcl_mobitems:leather", weight = 10 },
{ itemstring = "mcl_core:bowl", weight = 10 }, { itemstring = "mcl_armor:boots_leather", weight = 10, wear_min = 6554, wear_max = 65535 }, -- 10%-100% damage
{ itemstring = "mcl_fishing:fishing_rod", weight = 2, wear_min = 6554, wear_max = 65535 }, -- 10%-100% damage { itemstring = "mcl_mobitems:rotten_flesh", weight = 10 },
{ itemstring = "mcl_mobitems:leather", weight = 10 }, { itemstring = "mcl_core:stick", weight = 5 },
{ itemstring = "mcl_armor:boots_leather", weight = 10, wear_min = 6554, wear_max = 65535 }, -- 10%-100% damage { itemstring = "mcl_mobitems:string", weight = 5 },
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 10 }, { itemstring = "mcl_potions:water", weight = 10 },
{ itemstring = "mcl_core:stick", weight = 5 }, { itemstring = "mcl_mobitems:bone", weight = 10 },
{ itemstring = "mcl_mobitems:string", weight = 5 }, { itemstring = "mcl_dye:black", weight = 1, amount_min = 10, amount_max = 10 },
{ itemstring = "mcl_potions:water", weight = 10 }, { itemstring = "mcl_mobitems:string", weight = 10 }, -- TODO: Tripwire Hook
{ itemstring = "mcl_mobitems:bone", weight = 10 }, }
{ itemstring = "mcl_dye:black", weight = 1, amount_min = 10, amount_max = 10 }, }, pr)
{ itemstring = "mcl_mobitems:string", weight = 10 }, -- TODO: Tripwire Hook else
} -- Treasure
}, pr) items = mcl_loot.get_loot({
else items = {
-- Treasure -- TODO: Enchanted Bow
items = mcl_loot.get_loot({ { itemstring = "mcl_bows:bow", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage
items = { { itemstack = mcl_enchanting.get_randomly_enchanted_book(30, true, true)},
-- TODO: Enchanted Bow -- TODO: Enchanted Fishing Rod
{ itemstring = "mcl_bows:bow", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage { itemstring = "mcl_fishing:fishing_rod", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage
{ itemstack = mcl_enchanting.get_randomly_enchanted_book(30, true, true)}, { itemstring = "mcl_mobs:nametag", },
-- TODO: Enchanted Fishing Rod { itemstring = "mcl_mobitems:saddle", },
{ itemstring = "mcl_fishing:fishing_rod", wear_min = 49144, wear_max = 65535 }, -- 75%-100% damage { itemstring = "mcl_flowers:waterlily", },
{ itemstring = "mcl_mobs:nametag", }, }
{ itemstring = "mcl_mobitems:saddle", }, }, pr)
{ itemstring = "mcl_flowers:waterlily", }, end
} local item
}, pr) if #items >= 1 then
end item = ItemStack(items[1])
local item else
if #items >= 1 then item = ItemStack()
item = ItemStack(items[1]) end
else local inv = player:get_inventory()
item = ItemStack() if inv:room_for_item("main", item) then
end inv:add_item("main", item)
local inv = player:get_inventory() else
if inv:room_for_item("main", item) then minetest.add_item(pos, item)
inv:add_item("main", item) end
else if mcl_experience.throw_experience then
minetest.add_item(pos, item) mcl_experience.throw_experience(pos, math.random(1,6))
end end
if mcl_experience.throw_experience then
mcl_experience.throw_experience(pos, math.random(1,6))
end
if not minetest.is_creative_enabled(player:get_player_name()) then if not minetest.is_creative_enabled(player:get_player_name()) then
local idef = itemstack:get_definition() local idef = itemstack:get_definition()
itemstack:add_wear(65535/durability) -- 65 uses itemstack:add_wear(65535/durability) -- 65 uses
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true) minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true)
end
end end
end end
--Check if object is on land.
local epos = ent.object:get_pos()
epos.y = math.floor(epos.y)
local node = minetest.get_node(epos)
local def = minetest.registered_nodes[node.name]
if def.walkable then
if not minetest.is_creative_enabled(player:get_player_name()) then
local idef = itemstack:get_definition()
itemstack:add_wear((65535/durability)*2) -- if so and not creative then wear double like in MC.
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true)
end
end
end
--Destroy bobber.
ent.object:remove()
return itemstack
end end
--Check if object is on land.
local epos = ent.object:get_pos()
epos.y = math.floor(epos.y)
local node = minetest.get_node(epos)
local def = minetest.registered_nodes[node.name]
if def.walkable then
if not minetest.is_creative_enabled(player:get_player_name()) then
local idef = itemstack:get_definition()
itemstack:add_wear((65535/durability)*2) -- if so and not creative then wear double like in MC.
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true)
end
end
end
--Destroy bobber.
ent.object:remove()
noent = false
break
end end
end end
end end
--Check for flying bobber. end
for n = 1, #objs do --Check for flying bobber.
ent = objs[n]:get_luaentity() for n = 1, #objs do
if ent then ent = objs[n]:get_luaentity()
if ent._thrower and ent.objtype=="fishing" then if ent then
if player:get_player_name() == ent._thrower then if ent._thrower and ent.objtype=="fishing" then
noent = false if player:get_player_name() == ent._thrower then
break noent = false
end break
end end
end end
end end
--If no bobber or flying_bobber exists then throw bobber. end
if noent == true then --If no bobber or flying_bobber exists then throw bobber.
local playerpos = player:get_pos() if noent then
local dir = player:get_look_dir() local playerpos = player:get_pos()
mcl_throwing.throw("mcl_fishing:flying_bobber", {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, 15, player:get_player_name()) local dir = player:get_look_dir()
end 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 end
-- Movement function of bobber -- 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) mcl_throwing.register_throwable_object("mcl_fishing:flying_bobber", "mcl_fishing:flying_bobber_entity", 5)
-- If player leaves area, remove bobber. local function remove_bobber(player)
minetest.register_on_leaveplayer(function(player)
local objs = minetest.get_objects_inside_radius(player:get_pos(), 250) local objs = minetest.get_objects_inside_radius(player:get_pos(), 250)
local ent = nil
local noent = true
for n = 1, #objs do for n = 1, #objs do
ent = objs[n]:get_luaentity() local ent = objs[n]:get_luaentity()
if ent then if ent then
if ent.player and ent.objtype=="fishing" then if ent.player and ent.objtype=="fishing" then
ent.object:remove() ent.object:remove()
@ -349,26 +347,13 @@ minetest.register_on_leaveplayer(function(player)
end end
end end
end end
end) end
-- If player leaves area, remove bobber.
minetest.register_on_leaveplayer(remove_bobber)
-- If player dies, remove bobber. -- If player dies, remove bobber.
minetest.register_on_dieplayer(function(player) minetest.register_on_dieplayer(remove_bobber)
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)
-- Fishing Rod -- Fishing Rod
minetest.register_tool("mcl_fishing: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 if not inv_img then
inv_img = top_img inv_img = top_img
end end
local noncreative, create_entry, paramtype2, palette local create_entry, paramtype2, palette
if is_flower == nil then if is_flower == nil then
is_flower = true is_flower = true
end 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 if is_flower then
bottom_groups.flower = 1 bottom_groups.flower = 1
bottom_groups.place_flowerlike = 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" palette = "mcl_core_palette_grass.png"
end end
if longdesc == nil then if longdesc == nil then
noncreative = 1 bottom_groups.not_in_creative_inventory = 1
create_entry = false create_entry = false
end end
-- Drop itself by default -- 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 itemstring = itemstack:get_name()
local fakestack = ItemStack(itemstack) local fakestack = ItemStack(itemstack)
local idef = fakestack:get_definition() --local idef = fakestack:get_definition()
local retval local retval
if wdir == 0 or wdir == 1 then if wdir == 0 or wdir == 1 then
return minetest.item_place(itemstack, placer, pointed_thing) 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 if not retval then
return itemstack return itemstack
end end
itemstack,_ = minetest.item_place(fakestack, placer, pointed_thing, wdir) itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir)
itemstack:set_name(itemstring) itemstack:set_name(itemstring)
return itemstack return itemstack
end, end,

View File

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

View File

@ -72,7 +72,6 @@ local function now_playing(player, name)
active_huds[playername] = nil active_huds[playername] = nil
end end
end, {playername, id, hud_sequence_numbers[playername]}) end, {playername, id, hud_sequence_numbers[playername]})
end end
minetest.register_on_leaveplayer(function(player) 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 modpath = minetest.get_modpath("mcl_maps")
local worldpath = minetest.get_worldpath() local worldpath = minetest.get_worldpath()
local map_textures_path = worldpath .. "/mcl_maps/" 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) minetest.mkdir(map_textures_path)

View File

@ -1,11 +1,14 @@
local S = minetest.get_translator("mcl_mobspawners") local S = minetest.get_translator("mcl_mobspawners")
local math = math
local table = table
mcl_mobspawners = {} mcl_mobspawners = {}
local default_mob = "mobs_mc:pig" local default_mob = "mobs_mc:pig"
-- Mob spawner -- 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 function get_mob_textures(mob)
local list = minetest.registered_entities[mob].texture_list 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 -- check objects inside 8×8 area around spawner
local objs = minetest.get_objects_inside_radius(pos, 8) local objs = minetest.get_objects_inside_radius(pos, 8)
local count = 0 local count = 0
local ent = nil local ent
local timer = minetest.get_node_timer(pos) 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 mt_sound_play = minetest.sound_play
local math = math local math = math
local string = string --local string = string
local table = table local table = table
-- DEBUG: functions -- DEBUG: functions
@ -422,7 +422,7 @@ end
function kelp.surface_after_dig_node(pos, node) 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 end
@ -759,7 +759,6 @@ minetest.register_craftitem("mcl_ocean:dried_kelp", {
groups = { food = 2, eatable = 1 }, groups = { food = 2, eatable = 1 },
on_place = minetest.item_eat(1), on_place = minetest.item_eat(1),
on_secondary_use = minetest.item_eat(1), on_secondary_use = minetest.item_eat(1),
groups = { food = 2, eatable = 1 },
_mcl_saturation = 0.6, _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_under = minetest.get_node(pos_under)
local node_above = minetest.get_node(pos_above) local node_above = minetest.get_node(pos_above)
local def_under = minetest.registered_nodes[node_under.name] 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 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, 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.") doc_longdesc = S("Seagrass grows inside water on top of dirt, sand or gravel.")
desc = S("Seagrass") desc = S("Seagrass")
doc_create = true doc_create = true
doc_img = "mcl_ocean_seagrass.png" doc_img = "mcl_ocean_seagrass.png^[verticalframe:12:0"
else else
doc_create = false doc_create = false
end end
@ -113,7 +113,7 @@ for s=1, #surfaces do
_doc_items_entry_name = desc, _doc_items_entry_name = desc,
_doc_items_longdesc = doc_longdesc, _doc_items_longdesc = doc_longdesc,
_doc_items_create_entry = doc_create, _doc_items_create_entry = doc_create,
_doc_items_image = "mcl_ocean_seagrass.png^[verticalframe:12:0", _doc_items_image = doc_img,
drawtype = "plantlike_rooted", drawtype = "plantlike_rooted",
paramtype = "light", paramtype = "light",
paramtype2 = "meshoptions", paramtype2 = "meshoptions",

View File

@ -1,10 +1,14 @@
local S = minetest.get_translator("mcl_portals") local S = minetest.get_translator("mcl_portals")
-- Parameters local table = table
local SPAWN_MIN = mcl_vars.mg_end_min+70 local vector = vector
local SPAWN_MAX = mcl_vars.mg_end_min+98 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 destroy_portal = function(pos)
local neighbors = { local neighbors = {
@ -196,7 +200,6 @@ function mcl_portals.end_teleport(obj, pos)
end end
end end
local platform
build_end_portal_destination(platform_pos) build_end_portal_destination(platform_pos)
check_and_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 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 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 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 k1x, k2x = floor(x1/256), floor(x2/256)
local k1z, k2z = floor(z1/256), floor(z2/256) local k1z, k2z = floor(z1/256), floor(z2/256)
@ -371,7 +383,7 @@ local function finalize_teleport(obj, exit)
if is_player then if is_player then
name = obj:get_player_name() name = obj:get_player_name()
end 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 -- 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 is_player = player:is_player()
local entity = player:get_luaentity() local entity = player:get_luaentity()
local playername = player:get_player_name() --local playername = player:get_player_name()
local skin_file = "" local skin_file
if toggle then -- hide player if toggle then -- hide player
@ -567,22 +567,22 @@ function mcl_potions.make_invisible(player, toggle)
if entity then if entity then
EF.invisible[player].old_size = entity.visual_size 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 return
end end
if player:is_player() then if is_player then
mcl_player.player_set_skin(player, "mobs_mc_empty.png") mcl_player.player_set_skin(player, skin_file)
elseif not player:is_player() then elseif not is_player then
player:set_properties({visual_size = {x = 0, y = 0}}) player:set_properties({visual_size = {x = 0, y = 0}})
end end
player:set_nametag_attributes({color = {a = 0}}) player:set_nametag_attributes({color = {a = 0}})
elseif EF.invisible[player] then -- show player elseif EF.invisible[player] then -- show player
if player:is_player() then if is_player then
mcl_skins.update_player_skin(player) 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}) player:set_properties({visual_size = EF.invisible[player].old_size})
end end
player:set_nametag_attributes({color = {r = 255, g = 255, b = 255, a = 255}}) 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") self.object:set_texture_mod("^mcl_tnt_blink.png")
end end
local function add_effects(pos, radius, drops) --[[local function add_effects(pos, radius, drops)
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 64, amount = 64,
time = 0.5, time = 0.5,
@ -161,7 +161,7 @@ local function add_effects(pos, radius, drops)
texture = texture, texture = texture,
collisiondetection = true, collisiondetection = true,
}) })
end end]]
function TNT:on_step(dtime) function TNT:on_step(dtime)
local pos = self.object:get_pos() 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_minimal = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Taiga", "MegaTaiga", "MegaSpruceTaiga", "ColdTaiga" }
local fern_low = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Taiga", "MegaTaiga", "MegaSpruceTaiga" } local fern_low = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Taiga", "MegaTaiga", "MegaSpruceTaiga" }
local fern_Jungle = { "Jungle", "JungleM", "JungleEdge", "JungleEdgeM" } 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.03, 0.09, fern_minimal)
register_grass_decoration("fern", -0.015, 0.075, fern_minimal) register_grass_decoration("fern", -0.015, 0.075, fern_minimal)
register_grass_decoration("fern", 0, 0.06, 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.05, 0.01, fern_Jungle)
register_grass_decoration("fern", 0.07, -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.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", 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", "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) mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed)
local gennotify = minetest.get_mapgen_object("gennotify") local gennotify = minetest.get_mapgen_object("gennotify")
--local poslist = {} --local poslist = {}
pr = PseudoRandom(blockseed + 14) local pr = PseudoRandom(blockseed + 14)
for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do
local x, y, z = pos.x, pos.y, pos.z local x, y, z = pos.x, pos.y, pos.z
if x < -2 or x > 2 or z < -2 or z > 2 then 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.vf then lvm = lvm - 1 end
if rec.nf then nodes = nodes - 1 end if rec.nf then nodes = nodes - 1 end
if rec.needs_param2 then param2 = param2 - 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 end
-- Generate basic layer-based nodes: void, bedrock, realm barrier, lava seas, etc. -- 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) -- 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) 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 = { mcl_playerplus = {
elytra = {}, 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.

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