This commit is contained in:
Elias Fleckenstein 2021-03-01 10:52:07 +01:00
commit f5b590901e
20 changed files with 332 additions and 185 deletions

View File

@ -202,9 +202,8 @@ function boat.on_step(self, dtime, moveresult)
on_ice = true
else
v_slowdown = 0.04
v_factor = 0.5
end
v_factor = 0.5
elseif in_water then
on_water = false
in_water = true

View File

@ -12,15 +12,14 @@ local function detach_driver(self)
if not self._driver then
return
end
mcl_player.player_attached[self._driver] = nil
local player = minetest.get_player_by_name(self._driver)
if self._driver:is_player() then
mcl_player.player_attached[self._driver:get_player_name()] = nil
self._driver:set_detach()
self._driver:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0})
mcl_player.player_set_animation(self._driver, "stand" , 30)
end
self._driver = nil
self._start_pos = nil
if player then
player:set_detach()
player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0})
mcl_player.player_set_animation(player, "stand" , 30)
end
end
local function activate_tnt_minecart(self, timer)
@ -62,7 +61,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
on_rightclick = on_rightclick,
_driver = nil, -- player who sits in and controls the minecart (only for minecart!)
_driver = nil, -- player (or mob) who sits in and controls the minecart (only for minecart!)
_punched = false, -- used to re-send _velocity and position
_velocity = {x=0, y=0, z=0}, -- only used on punch
_start_pos = nil, -- Used to calculate distance for “On A Rail” achievement
@ -97,111 +96,101 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
end
function cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
-- Punch: Pick up minecart (unless TNT was ignited)
if self._boomtimer then return end
if self._driver then
detach_driver(self)
end
local pos = self.object:get_pos()
if not self._railtype then
local node = minetest.get_node(vector.floor(pos)).name
self._railtype = minetest.get_item_group(node, "connect_to_raillike")
-- Disable detector rail
local rou_pos = vector.round(pos)
local node = minetest.get_node(rou_pos)
if node.name == "mcl_minecarts:detector_rail_on" then
local newnode = {name="mcl_minecarts:detector_rail", param2 = node.param2}
minetest.swap_node(rou_pos, newnode)
mesecon.receptor_off(rou_pos)
end
if not puncher or not puncher:is_player() then
local cart_dir = mcl_minecarts:get_rail_direction(pos, {x=1, y=0, z=0}, nil, nil, self._railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
-- Drop items and remove cart entity
if not minetest.is_creative_enabled(puncher:get_player_name()) then
for d=1, #drop do
minetest.add_item(self.object:get_pos(), drop[d])
end
self._velocity = vector.multiply(cart_dir, 3)
self._old_pos = nil
self._punched = true
return
end
-- Punch+sneak: Pick up minecart (unless TNT was ignited)
if puncher:get_player_control().sneak and not self._boomtimer then
if self._driver then
if self._old_pos then
self.object:set_pos(self._old_pos)
end
detach_driver(self)
end
-- Disable detector rail
local rou_pos = vector.round(pos)
local node = minetest.get_node(rou_pos)
if node.name == "mcl_minecarts:detector_rail_on" then
local newnode = {name="mcl_minecarts:detector_rail", param2 = node.param2}
minetest.swap_node(rou_pos, newnode)
mesecon.receptor_off(rou_pos)
end
-- Drop items and remove cart entity
if not minetest.is_creative_enabled(puncher:get_player_name()) then
for d=1, #drop do
minetest.add_item(self.object:get_pos(), drop[d])
end
elseif puncher and puncher:is_player() then
local inv = puncher:get_inventory()
for d=1, #drop do
if not inv:contains_item("main", drop[d]) then
inv:add_item("main", drop[d])
end
elseif puncher and puncher:is_player() then
local inv = puncher:get_inventory()
for d=1, #drop do
if not inv:contains_item("main", drop[d]) then
inv:add_item("main", drop[d])
end
end
self.object:remove()
return
end
local vel = self.object:get_velocity()
if puncher:get_player_name() == self._driver then
if math.abs(vel.x + vel.z) > 7 then
return
end
end
local punch_dir = mcl_minecarts:velocity_to_dir(puncher:get_look_dir())
punch_dir.y = 0
local cart_dir = mcl_minecarts:get_rail_direction(pos, punch_dir, nil, nil, self._railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
time_from_last_punch = math.min(time_from_last_punch, tool_capabilities.full_punch_interval)
local f = 3 * (time_from_last_punch / tool_capabilities.full_punch_interval)
self._velocity = vector.multiply(cart_dir, f)
self._old_pos = nil
self._punched = true
self.object:remove()
end
cart.on_activate_by_rail = on_activate_by_rail
function cart:on_step(dtime)
local ctrl, player = nil, nil
if self._driver then
player = minetest.get_player_by_name(self._driver)
if player then
ctrl = player:get_player_control()
-- player detach
if ctrl.sneak then
detach_driver(self)
return
local update = {}
local vel = self.object:get_velocity()
local pos, rou_pos, node
pos = self.object:get_pos()
rou_pos = vector.round(pos)
node = minetest.get_node(rou_pos)
local g = minetest.get_item_group(node.name, "connect_to_raillike")
if self._driver and self._driver:is_player() then
player = self._driver
ctrl = player:get_player_control()
-- player detach
if ctrl.sneak then
detach_driver(self)
return
end
if g == self._railtype then
if ctrl.right then
local c = vector.multiply(minetest.yaw_to_dir(self._driver:get_look_horizontal()-1.57), 0.2)
self.object:set_velocity(vector.add(vel, {x=c.x, y=0, z=c.z}))
end
if ctrl.left then
local c = vector.multiply(minetest.yaw_to_dir(self._driver:get_look_horizontal()+1.57), 0.2)
self.object:set_velocity(vector.add(vel, {x=c.x, y=0, z=c.z}))
end
if ctrl.up then
local c = vector.multiply(self._driver:get_look_dir(), 0.2)
self.object:set_velocity(vector.add(vel, {x=c.x, y=0, z=c.z}))
end
if ctrl.down then
local c = vector.multiply(self._driver:get_look_dir(), 0.2)
self.object:set_velocity(vector.subtract(vel, {x=c.x, y=0, z=c.z}))
end
end
end
local vel = self.object:get_velocity()
local update = {}
if self._last_float_check == nil then
self._last_float_check = 0
else
self._last_float_check = self._last_float_check + dtime
end
local pos, rou_pos, node
-- Drop minecart if it isn't on a rail anymore
if self._last_float_check >= mcl_minecarts.check_float_time then
pos = self.object:get_pos()
rou_pos = vector.round(pos)
node = minetest.get_node(rou_pos)
local g = minetest.get_item_group(node.name, "connect_to_raillike")
for _,object in pairs(minetest.get_objects_inside_radius(pos, 1.3)) do
if object ~= self.object then
local mob = object:get_luaentity()
if mob then mob = mob._cmi_is_mob == true end
if mob and (not self._driver) and not object:get_attach() then
self._driver = object
object:set_attach(self.object, "", {x=0, y=-1.75, z=-2}, {x=0, y=0, z=0})
mobs:set_animation(self.object, "stand")
return
end
end
end
if g ~= self._railtype and self._railtype ~= nil then
-- Detach driver
if player then
@ -300,8 +289,12 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
end
end
if self._punched then
if update.vel then
vel = vector.add(vel, self._velocity)
if vel.x>8 then vel.x = 8 end
if vel.x<-8 then vel.x = -8 end
if vel.z>8 then vel.z = 8 end
if vel.z<-8 then vel.z = -8 end
self.object:set_velocity(vel)
self._old_dir.y = 0
elseif vector.equals(vel, {x=0, y=0, z=0}) and (not has_fuel) then
@ -626,17 +619,14 @@ register_minecart(
"mcl_minecarts_minecart_normal.png",
{"mcl_minecarts:minecart"},
function(self, clicker)
local name = clicker:get_player_name()
if not clicker or not clicker:is_player() then
return
end
local player_name = clicker:get_player_name()
if self._driver and player_name == self._driver then
if not clicker or not clicker:is_player() then return end
if clicker == self._driver then
detach_driver(self)
elseif not self._driver then
self._driver = player_name
else
local name = clicker:get_player_name()
self._driver = clicker
self._start_pos = self.object:get_pos()
mcl_player.player_attached[player_name] = true
mcl_player.player_attached[name] = true
clicker:set_attach(self.object, "", {x=0, y=-1.75, z=-2}, {x=0, y=0, z=0})
mcl_player.player_attached[name] = true
minetest.after(0.2, function(name)
@ -647,6 +637,7 @@ register_minecart(
mcl_tmp_message.message(clicker, S("Sneak to dismount"))
end
end, name)
clicker:set_look_horizontal(self.object:get_yaw())
end
end, activate_normal_minecart
)

View File

@ -214,7 +214,7 @@ function awards.unlock(name, award)
-- Get award
minetest.log("action", name.." has gotten award "..award)
minetest.chat_send_all("<"..name.."> "..S("Achievement gotten: @1", award))
minetest.chat_send_all(S("@1 has made the achievement @2", name, minetest.colorize("#51EF4E", "[" .. (awdef.title or award) .. "]")))
data.unlocked[award] = award
awards.save()

View File

@ -12,9 +12,9 @@
<achievement ID>=<Succès ID>
<name>=<nom>
A Cat in a Pop-Tart?!=A Cat in a Pop-Tart?!
Achievement gotten!=Succès obtenue!
Achievement gotten:=Succès obtenue:
Achievement gotten: @1=Succès obtenue: @1
Achievement gotten!=Succès obtenu !
Achievement gotten:=Succès obtenu :
Achievement gotten: @1=Succès obtenu : @1
Achievement not found.=Succès inconnu
All your awards and statistics have been cleared. You can now start again.=Toutes vos récompenses et statistiques ont été effacées. Vous pouvez maintenant recommencer.
Awards=Récompenses
@ -28,9 +28,9 @@ Join the game.=Rejoignez le jeu.
List awards in chat (deprecated)=Liste des récompenses dans le chat (obsolète)
Place a block: @1=Placer un bloc: @1
Place blocks: @1×@2=Placer des blocs: @1×@2
Secret Achievement gotten!=Succès secret obtenu!
Secret Achievement gotten:=Succès secret obtenu:
Secret Achievement gotten: @1=Succès secret obtenu: @1
Secret Achievement gotten!=Succès secret obtenu !
Secret Achievement gotten:=Succès secret obtenu :
Secret Achievement gotten: @1=Succès secret obtenu : @1
Show details of an achievement=Afficher les détails d'un succès
Show, clear, disable or enable your achievements=Affichez, effacez, désactivez ou activez vos succès
Get this achievement to find out what it is.=Obtenez ce succès pour découvrir de quoi il s'agit.
@ -38,8 +38,8 @@ Write @1 chat messages.=Écrivez @1 messages de chat.
Write something in chat.=Écrivez quelque chose dans le chat.
You have disabled your achievements.=Vous avez désactivé vos succès.
You have enabled your achievements.=Vous avez activé vos succès.
You have not gotten any awards.=Vous n'avez reçu aucun prix.
You've disabled awards. Type /awards enable to reenable.=Vous avez désactivé les récompenses. Type /awards enable pour les activer.
You have not gotten any awards.=Vous n'avez reçu aucune récompense.
You've disabled awards. Type /awards enable to reenable.=Vous avez désactivé les récompenses. Tapez "/awards enable" pour les réactiver.
[c|clear|disable|enable]=[c|clear|disable|enable]
OK=OK
Error: No awards available.=Erreur: aucune récompense disponible.
@ -52,10 +52,10 @@ Eat @1 item(s).=Manger @1 aliment(s).
Craft @1 item(s).=Fabriquer @1 objet(s).
Can give achievements to any player=Peut donner des succès à n'importe quel joueur
(grant <player> (<achievement> | all)) | list=(grant <player> (<achievement> | all)) | list
Give achievement to player or list all achievements=Donner un succès a un joueur ou répertorier toutes les succès
Give achievement to player or list all achievements=Donner un succès à un joueur ou répertorier tous les succès
@1 (@2)=@1 (@2)
Invalid syntax.=Syntaxe invalide.
Invalid action.=Action invalide.
Player is not online.=Le joueur n'est pas en ligne.
Done.=Terminé.
Achievement “@1” does not exist.=La réalisation «@1» n'existe pas.
Achievement “@1” does not exist.=Le succès «@1» n'existe pas.

View File

@ -59,3 +59,4 @@ Invalid action.=Непредусмотренное действие.
Player is not online.=Игрок не подключён.
Done.=Сделано.
Achievement “@1” does not exist.=Достижения “@1” не существует.
@1 has made the achievement @2=@1 получил(а) достижение @2

View File

@ -59,3 +59,4 @@ Invalid action.=
Player is not online.=
Done.=
Achievement “@1” does not exist.=
@1 has made the achievement @2=

View File

@ -84,7 +84,7 @@ Dark oak leaves are grown from dark oak trees.=Les feuilles de chêne noir sont
Dark oak saplings can grow into dark oaks, but only in groups. A lonely dark oak sapling won't grow. A group of four dark oak saplings grows into a dark oak after some time when they are placed on soil (such as dirt) in a 2×2 square and exposed to light.=Les pousses de chêne noir peuvent devenir des chênes noirs, mais seulement en groupes. Une pousse de chêne noir solitaire ne poussera pas. Un groupe de quatre pousses de chêne noir se transforme en chêne noir après un certain temps lorsqu'ils sont placés sur le sol (comme la terre) dans un carré 2×2 et exposés à la lumière.
Dead Bush=Arbuste mort
Dead bushes are unremarkable plants often found in dry areas. They can be harvested for sticks.=Les buissons morts sont des plantes inhabituelles que l'on trouve souvent dans les zones sèches. Ils peuvent être récoltés avec des bâtons.
Diamond=Diamamnt
Diamond=Diamant
Diamond Ore=Minerai de Diamant
Diamond ore is rare and can be found in clusters near the bottom of the world.=Le minerai de diamant est rare et peut être trouvé en filons près du fond du monde.
Diamonds are precious minerals and useful to create the highest tier of armor and tools.=Les diamants sont des minéraux précieux et utiles pour créer le plus haut niveau d'armure et d'outils.

View File

@ -124,8 +124,8 @@ mcl_enchanting.enchantments.curse_of_vanishing = {
inv_tool_tab = true,
}
-- unimplemented
--[[mcl_enchanting.enchantments.depth_strider = {
-- implemented in mcl_playerplus
mcl_enchanting.enchantments.depth_strider = {
name = S("Depth Strider"),
max_level = 3,
primary = {},
@ -141,7 +141,7 @@ mcl_enchanting.enchantments.curse_of_vanishing = {
power_range_table = {{10, 25}, {20, 35}, {30, 45}},
inv_combat_tab = true,
inv_tool_tab = false,
}]]--
}
-- implemented via on_enchant
mcl_enchanting.enchantments.efficiency = {

View File

@ -0,0 +1,100 @@
# textdomain: mcl_enchanting
Aqua Affinity=Родство с водой
Increases underwater mining speed.=Увеличивает скорость добычи под водой.
Bane of Arthropods=Бич членистоногих
Increases damage and applies Slowness IV to arthropod mobs (spiders, cave spiders, silverfish and endermites).=Увеличивает урон и применяет Замедление IV к насекомым и членистоногим (паукам, пещерным паукам, чешуйницам и чешуйницам края).
Blast Protection=Взрывоустойчивость
Reduces explosion damage and knockback.=Уменьшает урон и отдачу от взрывов.
Channeling=Громовержец
Channels a bolt of lightning toward a target. Works only during thunderstorms and if target is unobstructed with opaque blocks.=Бьёт молнией в цель. Работает только во время грозы, когда цель не защищена плотными блоками.
Curse of Binding=Проклятие несъёмности
Item cannot be removed from armor slots except due to death, breaking or in Creative Mode.=Предмет не может быть изъят из слота доспехов, кроме как в результате смерти, разрушения или в креативном режиме.
Curse of Vanishing=Проклятье утраты
Item destroyed on death.=Предмет уничтожается при смерти.
Depth Strider=Покоритель глубин
Increases underwater movement speed.=Увеличивает скорость передвижения под водой.
Efficiency=Эффективность
Increases mining speed.=Увеличивает скорость добычи.
Feather Falling=Невесомость
Reduces fall damage.=Снижает урон от падения.
Fire Aspect=Заговор огня
Sets target on fire.=Поджигает цель.
Fire Protection=Защита от огня
Reduces fire damage.=Уменьшает урон от огня.
Flame=Пламя
Arrows set target on fire.=Стрелы поджигают цель.
Fortune=Удача
Increases certain block drops.=Увеличивает выпадение ресурсов из блоков.
Frost Walker=Ледоход
Turns water beneath the player into frosted ice and prevents the damage from magma blocks.=Превращает воду под игроком в замороженный лёд и предотвращает урон от магмовых блоков.
Impaling=Пронзатель
Trident deals additional damage to ocean mobs.=Трезубец наносит дополнительный урон океаническим мобам.
Infinity=Бесконечность
Shooting consumes no regular arrows.=При стрельбе не расходуются стрелы.
Knockback=Отскок
Increases knockback.=Увеличивает отдачу.
Looting=Добыча
Increases mob loot.=Увеличивает добычу от мобов.
Loyalty=Верность
Trident returns after being thrown. Higher levels reduce return time.=Возвращает трезубец после броска. Более высокие уровни сокращают время возврата.
Luck of the Sea=Везучий рыбак
Increases rate of good loot (enchanting books, etc.)=Увеличивает шанс поймать сокровище (зачарованные книги и т.п.)
Lure=Приманка
Decreases time until rod catches something.=Уменьшает время ожидания клёва.
Mending=Починка
Repair the item while gaining XP orbs.=Предмет чинится при сборе жемчужин опыта.
Multishot=Залп
Shoot 3 arrows at the cost of one.=Выстреливают три стрелы по стоимости одной.
Piercing=Бронебойность
Arrows passes through multiple objects.=Стрела пробивает насквозь несколько объектов.
Power=Сила
Increases arrow damage.=Увеличивает урон от стрел.
Projectile Protection=Защита от снарядов
Reduces projectile damage.=Уменьшает урон от снарядов.
Protection=Защита
Reduces most types of damage by 4% for each level.=Уменьшает большинство повреждений на 4% за каждый уровень.
Punch=Отбрасывание
Increases arrow knockback.=Увеличивает отбрасывание от стрелы.
Quick Charge=Быстрая перезарядка
Decreases crossbow charging time.=Уменьшает время заряда снаряда.
Respiration=Подводное дыхание
Extends underwater breathing time.=Увеличивает время дыхания под водой.
Riptide=Тягун
Trident launches player with itself when thrown. Works only in water or rain.=Трезубец тянет игрока за собой. Работает только в воде или под дождём.
Sharpness=Острота
Increases damage.=Увеличенный урон.
Silk Touch=Шёлковое касание
Mined blocks drop themselves.=Добываемый блок выпадает сам, даже если из него должно выпадать что-то другое.
Smite=Небесная кара
Increases damage to undead mobs.=Дополнительный урон мертвякам (зомби и т.п.).
Soul Speed=Скорость души
Increases walking speed on soul sand.=Увеличивает скорость ходьбы по песку душ.
Sweeping Edge=Разящий клинок
Increases sweeping attack damage.=Увеличивает урон по мобам, стоящих рядом с целью.
Thorns=Шипы
Reflects some of the damage taken when hit, at the cost of reducing durability with each proc.=Отражают некоторый урон, получаемый от ударов, за счёт снижения прочности с каждым разом.
Unbreaking=Нерушимость
Increases item durability.=Увеличивает прочность предмета.
Inventory=Инвентарь
@1 × Lapis Lazuli=@1 × Ляпис-лазурь
Enchantment levels: @1=Уровень зачаровывания: @1
Level requirement: @1=Требуемый уровень: @1
Enchant an item=Зачаровать предмет
<player> <enchantment> [<level>]=<игрок> <зачарование> [<уровень>]
Usage: /enchant <player> <enchantment> [<level>]=Использование: /enchant <игрок> <зачарование> [<уровень>]
Player '@1' cannot be found.=Не удалось найти игрока '@1'.
There is no such enchantment '@1'.=Нет такого зачаровывания: '@1'.
The target doesn't hold an item.=Цель не держит предмета.
The selected enchantment can't be added to the target item.=Выбранное зачарование не может быть добавлено к целевому предмету.
'@1' is not a valid number='@1' не является допустимым числом
The number you have entered (@1) is too big, it must be at most @2.=Число, которое вы задали (@1), слишком велико, оно может быть максимум @2.
The number you have entered (@1) is too small, it must be at least @2.=Число, которое вы задали (@1), слишком мало, оно может быть минимум @2.
@1 can't be combined with @2.=@1 нельзя сочетать с @2.
Enchanting succeded.=Зачарование выполнено.
Forcefully enchant an item=Принудительно зачаровать предмет
Usage: /forceenchant <player> <enchantment> [<level>]=Использование: /forceenchant <игрок> <зачарование> [<уровень>]
The target item is not enchantable.=Указана незачаровываемая цель.
'@1' is not a valid number.='@1' не является допустимым числом.
Enchanted Book=Зачарованная книга
Enchanting Table=Стол зачаровывания
Enchant=Зачарование

View File

@ -10,10 +10,10 @@ Magma blocks are hot solid blocks which hurt anyone standing on it, unless they
@1 stood too long on a magma block.=@1 s'est tenu trop longtemps sur un bloc de magma.
Soul Sand=Sable des âmes
Soul sand is a block from the Nether. One can only slowly walk on soul sand. The slowing effect is amplified when the soul sand is on top of ice, packed ice or a slime block.=Le sable de l'âme est un bloc du Nether. On ne peut que marcher lentement sur le sable de l'âme. L'effet de ralentissement est amplifié lorsque le sable de l'âme est au-dessus de la glace, de la glace tassée ou d'un bloc de slime.
Nether Brick Block=Brique du Nether
Red Nether Brick Block=Brique Rouge du Nether
Nether Brick Block=Bloc de Briques du Nether
Red Nether Brick Block=Bloc de Briques Rouges du Nether
Nether Wart Block=Bloc de Verrues du Nether
A nether wart block is a purely decorative block made from nether wart.=Un bloc de verrue du Nether est un bloc purement décoratif fabriqué à partir de verrue du Nether.
A nether wart block is a purely decorative block made from nether wart.=Un bloc de verrues du Nether est un bloc purement décoratif fabriqué à partir de verrue du Nether.
Block of Quartz=Bloc de Quartz
Chiseled Quartz Block=Bloc de Quartz sculpté
Pillar Quartz Block=Bloc de Quartz rayé
@ -22,8 +22,8 @@ Glowstone Dust=Poudre Lumineuse
Glowstone dust is the dust which comes out of broken glowstones. It is mainly used in crafting.=La poudre lumineuse est la poussière qui sort des pierres incandescentes brisées. Il est principalement utilisé dans l'artisanat.
Nether Quartz=Quartz du Nether
Nether quartz is a versatile crafting ingredient.=Le quartz du Nether est un ingrédient artisanal polyvalent.
Nether Brick=Bric du Nether
Nether bricks are the main crafting ingredient for crafting nether brick blocks and nether fences.=Les briques du Nether sont le principal ingrédient de fabrication pour la fabrication de blocs de briques et de clôtures du Nether.
Nether Brick=Brique du Nether
Nether bricks are the main crafting ingredient for crafting nether brick blocks and nether fences.=Les briques du Nether sont le principal ingrédient pour la fabrication de blocs de briques et de clôtures du Nether.
Nether Lava Source=Source de Lave du Nether
Flowing Nether Lava=Lave du Nether en Mouvement
Premature Nether Wart (Stage 1)=Verrue du Néant prématurée (étape 1)

View File

@ -223,7 +223,7 @@ minetest.register_ore({
}
})
if minetest.settings:get("mcl_generate_ores") == "true" then
if minetest.settings:get_bool("mcl_generate_ores", true) then
--
-- Coal
--

View File

@ -264,7 +264,8 @@ mcl_structures.generate_boulder = function(pos, rotation, pr)
end
local newpos = {x=pos.x,y=pos.y-1,z=pos.z}
return mcl_structures.place_schematic(newpos, path)
return minetest.place_schematic(newpos, path) -- don't serialize schematics for registered biome decorations, for MT 5.4.0, https://github.com/minetest/minetest/issues/10995
end
local function hut_placement_callback(p1, p2, size, orientation, pr)
@ -278,19 +279,19 @@ local function hut_placement_callback(p1, p2, size, orientation, pr)
end
end
mcl_structures.generate_witch_hut = function(pos, rotation)
mcl_structures.generate_witch_hut = function(pos, rotation, pr)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_witch_hut.mts"
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, hut_placement_callback, pr)
end
mcl_structures.generate_ice_spike_small = function(pos)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_ice_spike_small.mts"
return mcl_structures.place_schematic(pos, path, "random", nil, false)
return minetest.place_schematic(pos, path, "random", nil, false) -- don't serialize schematics for registered biome decorations, for MT 5.4.0
end
mcl_structures.generate_ice_spike_large = function(pos)
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_ice_spike_large.mts"
return mcl_structures.place_schematic(pos, path, "random", nil, false)
return minetest.place_schematic(pos, path, "random", nil, false) -- don't serialize schematics for registered biome decorations, for MT 5.4.0
end
mcl_structures.generate_fossil = function(pos, rotation, pr)
@ -517,39 +518,56 @@ mcl_structures.register_structures = function(structure_type, structures)
registered_structures[structure_type] = structures
end
local function dir_to_rotation(dir)
local ax, az = math.abs(dir.x), math.abs(dir.z)
if ax > az then
if dir.x < 0 then
return "270"
end
return "90"
end
if dir.z < 0 then
return "180"
end
return "0"
end
-- Debug command
minetest.register_chatcommand("spawnstruct", {
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine",
description = S("Generate a pre-defined structure near your position."),
privs = {debug = true},
func = function(name, param)
local pos = minetest.get_player_by_name(name):get_pos()
if not pos then
return
end
local player = minetest.get_player_by_name(name)
if not player then return end
local pos = player:get_pos()
if not pos then return end
pos = vector.round(pos)
local dir = minetest.yaw_to_dir(player:get_look_horizontal())
local rot = dir_to_rotation(dir)
local pr = PseudoRandom(pos.x+pos.y+pos.z)
local errord = false
local message = S("Structure placed.")
if param == "desert_temple" then
mcl_structures.generate_desert_temple(pos)
mcl_structures.generate_desert_temple(pos, rot, pr)
elseif param == "desert_well" then
mcl_structures.generate_desert_well(pos)
mcl_structures.generate_desert_well(pos, rot, pr)
elseif param == "igloo" then
mcl_structures.generate_igloo(pos)
mcl_structures.generate_igloo(pos, rot, pr)
elseif param == "witch_hut" then
mcl_structures.generate_witch_hut(pos)
mcl_structures.generate_witch_hut(pos, rot, pr)
elseif param == "boulder" then
mcl_structures.generate_boulder(pos)
mcl_structures.generate_boulder(pos, rot, pr)
elseif param == "fossil" then
mcl_structures.generate_fossil(pos)
mcl_structures.generate_fossil(pos, rot, pr)
elseif param == "ice_spike_small" then
mcl_structures.generate_ice_spike_small(pos)
mcl_structures.generate_ice_spike_small(pos, rot, pr)
elseif param == "ice_spike_large" then
mcl_structures.generate_ice_spike_large(pos)
mcl_structures.generate_ice_spike_large(pos, rot, pr)
elseif param == "end_exit_portal" then
mcl_structures.generate_end_exit_portal(pos)
mcl_structures.generate_end_exit_portal(pos, rot, pr)
elseif param == "end_portal_shrine" then
mcl_structures.generate_end_portal_shrine(pos)
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
elseif param == "" then
message = S("Error: No structure type given. Please use “/spawnstruct <type>”.")
errord = true

View File

@ -175,6 +175,36 @@ end
-------------------------------------------------------------------------------
-- evaluate settlement_info and place schematics
-------------------------------------------------------------------------------
-- Initialize node
local function construct_node(p1, p2, name)
local r = minetest.registered_nodes[name]
if r then
if r.on_construct then
local nodes = minetest.find_nodes_in_area(p1, p2, name)
for p=1, #nodes do
local pos = nodes[p]
r.on_construct(pos)
end
return nodes
end
minetest.log("warning","[mcl_villages] No on_construct defined for node name " .. name)
return
end
minetest.log("warning","[mcl_villages] Attempt to 'construct' inexistant nodes: " .. name)
end
local function init_nodes(p1, p2, size, rotation, pr)
construct_node(p1, p2, "mcl_itemframes:item_frame")
construct_node(p1, p2, "mcl_furnaces:furnace")
construct_node(p1, p2, "mcl_anvils:anvil")
local nodes = construct_node(p1, p2, "mcl_chests:chest")
if nodes and #nodes > 0 then
for p=1, #nodes do
local pos = nodes[p]
settlements.fill_chest(pos, pr)
end
end
end
function settlements.place_schematics(settlement_info, pr)
local building_all_info
for i, built_house in ipairs(settlement_info) do
@ -243,6 +273,10 @@ function settlements.place_schematics(settlement_info, pr)
schematic,
rotation,
nil,
true)
true,
nil,
init_nodes,
pr
)
end
end

View File

@ -67,9 +67,6 @@ local function build_a_settlement(minp, maxp, blockseed)
-- evaluate settlement_info and place schematics
settlements.place_schematics(settlement_info, pr)
-- evaluate settlement_info and initialize furnaces and chests
settlements.initialize_nodes(settlement_info, pr)
end
local function ecb_village(blockpos, action, calls_remaining, param)

View File

@ -218,43 +218,6 @@ function settlements.initialize_anvil(pos)
end
end
-------------------------------------------------------------------------------
-- initialize furnace, chests, anvil
-------------------------------------------------------------------------------
local building_all_info
function settlements.initialize_nodes(settlement_info, pr)
for i, built_house in ipairs(settlement_info) do
for j, schem in ipairs(settlements.schematic_table) do
if settlement_info[i]["name"] == schem["name"] then
building_all_info = schem
break
end
end
local width = building_all_info["hwidth"]
local depth = building_all_info["hdepth"]
local height = building_all_info["hheight"]
local p = settlement_info[i]["pos"]
for yi = 1,height do
for xi = 0,width do
for zi = 0,depth do
local ptemp = {x=p.x+xi, y=p.y+yi, z=p.z+zi}
local node = mcl_mapgen_core.get_node(ptemp)
if node.name == "mcl_furnaces:furnace" or
node.name == "mcl_chests:chest" or
node.name == "mcl_anvils:anvil" then
minetest.registered_nodes[node.name].on_construct(ptemp)
end
-- when chest is found -> fill with stuff
if node.name == "mcl_chests:chest" then
minetest.after(3, settlements.fill_chest, ptemp, pr)
end
end
end
end
end
end
-------------------------------------------------------------------------------
-- randomize table
-------------------------------------------------------------------------------
function shuffle(tbl, pr)

View File

@ -35,13 +35,41 @@ for _,texture in pairs(list) do
groups = { dig_immediate = 3, not_in_creative_inventory = 1 },
range = def.range,
})
minetest.register_node("mcl_meshhand:"..texture.. "_female", {
description = "",
tiles = {texture..".png"},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
visual_scale = 1,
wield_scale = {x=1,y=1,z=1},
paramtype = "light",
drawtype = "mesh",
mesh = "mcl_meshhand_female.b3d",
-- Prevent construction
node_placement_prediction = "",
on_construct = function(pos)
minetest.log("error", "[mcl_meshhand] Trying to construct mcl_meshhand:"..texture.." at "..minetest.pos_to_string(pos))
minetest.remove_node(pos)
end,
drop = "",
on_drop = function()
return ""
end,
groups = { dig_immediate = 3, not_in_creative_inventory = 1 },
range = def.range,
})
end
if has_mcl_skins == true then
--change the player's hand to their skin
mcl_skins.register_on_set_skin(function(player, skin)
local name = player:get_player_name()
player:get_inventory():set_stack("hand", 1, "mcl_meshhand:"..skin)
local meta = mcl_skins.meta[skin]
if meta.gender == "female" then
player:get_inventory():set_stack("hand", 1, "mcl_meshhand:"..skin.."_female")
else
player:get_inventory():set_stack("hand", 1, "mcl_meshhand:"..skin)
end
end)
else
minetest.register_on_joinplayer(function(player)

View File

@ -163,10 +163,12 @@ minetest.register_globalstep(function(dtime)
-- ask if player is sprinting
local is_sprinting = mcl_sprint.is_sprinting(name)
local velocity = player:get_velocity() or player:get_player_velocity()
-- Apply animations based on what the player is doing
if player:get_hp() == 0 then
player_set_animation(player, "lay")
elseif walking and player:get_velocity().x > 0.35 or walking and player:get_velocity().x < -0.35 or walking and player:get_velocity().z > 0.35 or walking and player:get_velocity().z < -0.35 then
elseif walking and velocity.x > 0.35 or walking and velocity.x < -0.35 or walking and velocity.z > 0.35 or walking and velocity.z < -0.35 then
if player_sneak[name] ~= controls.sneak then
player_anim[name] = nil
player_sneak[name] = controls.sneak

View File

@ -29,14 +29,15 @@ minetest.register_globalstep(function(dtime)
local controls = player:get_player_control()
name = player:get_player_name()
local player_velocity = player:get_velocity()
local player_velocity = player:get_velocity() or player:get_player_velocity()
-- controls head bone
local pitch = degrees(player:get_look_vertical()) * -1
local yaw = degrees(player:get_look_horizontal()) * -1
local player_vel_yaw = 0
if degrees(minetest.dir_to_yaw(player_velocity)) == 0 then
player_vel_yaw = 0
yaw = 0
else
player_vel_yaw = degrees(minetest.dir_to_yaw(player_velocity))
@ -73,7 +74,7 @@ minetest.register_globalstep(function(dtime)
-- sets eye height, and nametag color accordingly
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
if player:get_velocity().x > 0.35 or player:get_velocity().z > 0.35 or player:get_velocity().x < -0.35 or player:get_velocity().z < -0.35 then
if player_velocity.x > 0.35 or player_velocity.z > 0.35 or player_velocity.x < -0.35 or player_velocity.z < -0.35 then
if player_vel_yaw * -1 - yaw < 90 or player_vel_yaw * -1 - yaw > 270 then
-- controls head and Body_Control bones while moving backwards
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,yaw - player_vel_yaw * -1,0))
@ -196,6 +197,18 @@ minetest.register_globalstep(function(dtime)
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface")
end
-- Swimming? Check if boots are enchanted with depth strider
if minetest.get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then
local boots = player:get_inventory():get_stack("armor", 5)
local depth_strider = mcl_enchanting.get_enchantment(boots, "depth_strider")
if depth_strider > 0 then
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", (depth_strider / 3) + 0.75)
end
else
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface")
end
-- Is player suffocating inside node? (Only for solid full opaque cube type nodes
-- without group disable_suffocation=1)
local ndef = minetest.registered_nodes[node_head]