This commit is contained in:
Elias Åström 2021-05-18 19:33:05 +02:00
commit 067affcabb
81 changed files with 831 additions and 322 deletions

@ -22,6 +22,7 @@
* Nicu * Nicu
* aligator * aligator
* Code-Sploit * Code-Sploit
* NO11
## Contributors ## Contributors
* Laurent Rocher * Laurent Rocher
@ -40,7 +41,6 @@
* Jared Moody * Jared Moody
* Li0n * Li0n
* Midgard * Midgard
* NO11
* Saku Laesvuori * Saku Laesvuori
* Yukitty * Yukitty
* ZedekThePD * ZedekThePD
@ -102,6 +102,7 @@
* leorockway * leorockway
* xMrVizzy * xMrVizzy
* yutyo * yutyo
* NO11
## Translations ## Translations
* Wuzzy * Wuzzy

@ -149,13 +149,18 @@ minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
end, true) end, true)
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason) minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
if hp_change < 0 then if player:get_hp() > 0 then
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason)) mt_reason.approved = true
if hp_change < 0 then
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
end
end end
end, false) end, false)
minetest.register_on_dieplayer(function(player, mt_reason) minetest.register_on_dieplayer(function(player, mt_reason)
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason)) if mt_reason.approved then
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
end
end) end)
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()

@ -484,12 +484,18 @@ function mcl_util.deal_damage(target, damage, mcl_reason)
elseif luaentity._cmi_is_mob then elseif luaentity._cmi_is_mob then
-- local puncher = mcl_reason and mcl_reason.direct or target -- local puncher = mcl_reason and mcl_reason.direct or target
-- target:punch(puncher, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy = damage}}, vector.direction(puncher:get_pos(), target:get_pos()), damage) -- target:punch(puncher, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy = damage}}, vector.direction(puncher:get_pos(), target:get_pos()), damage)
luaentity.health = luaentity.health - damage if luaentity.health > 0 then
luaentity.health = luaentity.health - damage
end
return return
end end
end end
target:set_hp(target:get_hp() - damage, {_mcl_reason = mcl_reason}) local hp = target:get_hp()
if hp > 0 then
target:set_hp(hp - damage, {_mcl_reason = mcl_reason})
end
end end
function mcl_util.get_hp(obj) function mcl_util.get_hp(obj)
@ -533,7 +539,7 @@ function mcl_util.get_object_name(object)
local luaentity = object:get_luaentity() local luaentity = object:get_luaentity()
if not luaentity then if not luaentity then
return "" return tostring(object)
end end
return luaentity.nametag and luaentity.nametag ~= "" and luaentity.nametag or luaentity.description or luaentity.name return luaentity.nametag and luaentity.nametag ~= "" and luaentity.nametag or luaentity.description or luaentity.name

@ -61,20 +61,21 @@ In mc, you cant use clock in the nether and the end.
* pos: position * pos: position
## mcl_worlds.register_on_dimension_change(function(player, dimension)) ## mcl_worlds.register_on_dimension_change(function(player, dimension, last_dimension))
Register a callback function func(player, dimension). Register a callback function func(player, dimension).
It will be called whenever a player changes between dimensions. It will be called whenever a player changes between dimensions.
The void counts as dimension. The void counts as dimension.
* player: player, the player who changed the dimension * player: player, the player who changed of dimension
* dimension: position, The new dimension of the player ("overworld", "nether", "end", "void"). * dimension: string, The new dimension of the player ("overworld", "nether", "end", "void").
* last_dimension: string, The dimension where the player was ("overworld", "nether", "end", "void").
## mcl_worlds.registered_on_dimension_change ## mcl_worlds.registered_on_dimension_change
Table containing all function registered with mcl_worlds.register_on_dimension_change() Table containing all function registered with mcl_worlds.register_on_dimension_change()
## mcl_worlds.dimension_change(player, dimension) ## mcl_worlds.dimension_change(player, dimension)
Notify this mod of a dimmension change of <player> to <dimension> Notify this mod of a dimension change of <player> to <dimension>
* player: player, player who changed the dimension * player: player, player who changed the dimension
* dimension: string, new dimension ("overworld", "nether", "end", "void") * dimension: string, new dimension ("overworld", "nether", "end", "void")

@ -112,10 +112,11 @@ local last_dimension = {}
-- * player: Player who changed the dimension -- * player: Player who changed the dimension
-- * dimension: New dimension ("overworld", "nether", "end", "void") -- * dimension: New dimension ("overworld", "nether", "end", "void")
function mcl_worlds.dimension_change(player, dimension) function mcl_worlds.dimension_change(player, dimension)
local playername = player:get_player_name()
for i=1, #mcl_worlds.registered_on_dimension_change do for i=1, #mcl_worlds.registered_on_dimension_change do
mcl_worlds.registered_on_dimension_change[i](player, dimension) mcl_worlds.registered_on_dimension_change[i](player, dimension, last_dimension[playername])
last_dimension[player:get_player_name()] = dimension
end end
last_dimension[playername] = dimension
end end
----------------------- INTERNAL STUFF ---------------------- ----------------------- INTERNAL STUFF ----------------------

@ -0,0 +1,4 @@
# tga_encoder
A TGA Encoder written in Lua without the use of external Libraries.
May be used as a Minetest mod.

@ -0,0 +1,78 @@
tga_encoder = {}
local image = setmetatable({}, {
__call = function(self, ...)
local t = setmetatable({}, {__index = self})
t:constructor(...)
return t
end,
})
function image:constructor(pixels)
self.data = ""
self.pixels = pixels
self.width = #pixels[1]
self.height = #pixels
self:encode()
end
function image:encode_colormap_spec()
self.data = self.data
.. string.char(0, 0) -- first entry index
.. string.char(0, 0) -- number of entries
.. string.char(0) -- bits per pixel
end
function image:encode_image_spec()
self.data = self.data
.. string.char(0, 0) -- X-origin
.. string.char(0, 0) -- Y-origin
.. string.char(self.width % 256, math.floor(self.width / 256)) -- width
.. string.char(self.height % 256, math.floor(self.height / 256)) -- height
.. string.char(24) -- pixel depth (RGB = 3 bytes = 24 bits)
.. string.char(0) -- image descriptor
end
function image:encode_header()
self.data = self.data
.. string.char(0) -- image id
.. string.char(0) -- color map type
.. string.char(2) -- image type (uncompressed true-color image = 2)
self:encode_colormap_spec() -- color map specification
self:encode_image_spec() -- image specification
end
function image:encode_data()
for _, row in ipairs(self.pixels) do
for _, pixel in ipairs(row) do
self.data = self.data
.. string.char(pixel[3], pixel[2], pixel[1])
end
end
end
function image:encode_footer()
self.data = self.data
.. string.char(0, 0, 0, 0) -- extension area offset
.. string.char(0, 0, 0, 0) -- developer area offset
.. "TRUEVISION-XFILE"
.. "."
.. string.char(0)
end
function image:encode()
self:encode_header() -- header
-- no color map and image id data
self:encode_data() -- encode data
-- no extension or developer area
self:encode_footer() -- footer
end
function image:save(filename)
local f = assert(io.open(filename, "w"))
f:write(self.data)
f:close()
end
tga_encoder.image = image

@ -0,0 +1,3 @@
name = tga_encoder
author = Fleckenstein
description = A TGA Encoder written in Lua without the use of external Libraries.

@ -98,7 +98,7 @@ end
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
tick = not tick tick = not tick
for _,player in pairs(minetest.get_connected_players()) do for _,player in pairs(minetest.get_connected_players()) do
@ -106,7 +106,7 @@ minetest.register_globalstep(function(dtime)
local name = player:get_player_name() local name = player:get_player_name()
local pos = player:get_pos() local pos = player:get_pos()
if tick == true and pool[name] > 0 then if tick == true and pool[name] > 0 then
@ -124,7 +124,7 @@ minetest.register_globalstep(function(dtime)
end end
local inv = player:get_inventory() local inv = player:get_inventory()
local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z} local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z}
@ -406,6 +406,14 @@ minetest.register_entity(":__builtin:item", {
return return
end end
local stack = ItemStack(itemstring) local stack = ItemStack(itemstring)
if minetest.get_item_group(stack:get_name(), "compass") > 0 then
stack:set_name("mcl_compass:16")
itemstring = stack:to_string()
self.itemstring = itemstring
end
if minetest.get_item_group(stack:get_name(), "clock") > 0 then
self.is_clock = true
end
local count = stack:get_count() local count = stack:get_count()
local max_count = stack:get_stack_max() local max_count = stack:get_stack_max()
if count > max_count then if count > max_count then
@ -593,6 +601,12 @@ minetest.register_entity(":__builtin:item", {
local node = minetest.get_node_or_nil(p) local node = minetest.get_node_or_nil(p)
local in_unloaded = (node == nil) local in_unloaded = (node == nil)
if self.is_clock then
self.object:set_properties({
textures = {"mcl_clock:clock_" .. (mcl_worlds.clock_works(p) and mcl_clock.old_time or mcl_clock.random_frame)}
})
end
-- If no collector was found for a long enough time, declare the magnet as disabled -- If no collector was found for a long enough time, declare the magnet as disabled
if self._magnet_active and (self._collector_timer == nil or (self._collector_timer > item_drop_settings.magnet_time)) then if self._magnet_active and (self._collector_timer == nil or (self._collector_timer > item_drop_settings.magnet_time)) then
self._magnet_active = false self._magnet_active = false

@ -938,10 +938,13 @@ mobs.mob_step = function(self, dtime)
end end
end end
if self.burn_timer == 0 and minetest_get_node_light(pos) > 12 and minetest_get_node_light(pos, 0.5) == 15 then if self.burn_timer == 0 then
mcl_burning.set_on_fire(self.object, 1) local light_current, light_day = minetest_get_node_light(pos), minetest_get_node_light(pos, 0.5)
self.burn_timer = 1 --1.7 seconds if light_current and light_day and light_current > 12 and light_day == 15 then
self.pause_timer = 0.4 mcl_burning.set_on_fire(self.object, 1)
self.burn_timer = 1 --1.7 seconds
self.pause_timer = 0.4
end
end end
end end

@ -87,6 +87,12 @@ end
mobs.death_logic = function(self, dtime) mobs.death_logic = function(self, dtime)
--stop crashing game when object is nil
if not self or not self.object or not self.object:get_luaentity() then
return
end
self.death_animation_timer = self.death_animation_timer + dtime self.death_animation_timer = self.death_animation_timer + dtime
--get all attached entities and sort through them --get all attached entities and sort through them

@ -2,4 +2,4 @@ name = mcl_mobs
author = PilzAdam author = PilzAdam
description = Adds a mob API for mods to add animals or monsters, etc. description = Adds a mob API for mods to add animals or monsters, etc.
depends = mcl_particles depends = mcl_particles
optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor, mcl_portals, mcl_experience optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, cmi, doc_identifier, mcl_armor, mcl_portals, mcl_experience

@ -15,7 +15,7 @@ with name "mobs_mc_gameconfig". ]]
-- Set to false in your gameconfig mod if you create your own monster egg nodes. -- Set to false in your gameconfig mod if you create your own monster egg nodes.
mobs_mc.create_monster_egg_nodes = true mobs_mc.create_monster_egg_nodes = true
mobs_mc.items = {} --mobs_mc.items = {}
mobs_mc.items = { mobs_mc.items = {
-- Items defined in mobs_mc -- Items defined in mobs_mc

@ -43,10 +43,10 @@ mobs:register_mob("mobs_mc:creeper", {
eye_height = 1.25, eye_height = 1.25,
--hssssssssssss --hssssssssssss
explosion_strength = 10, explosion_strength = 3,
explosion_radius = 4, --explosion_radius = 3,
explosion_damage_radius = 6, --explosion_damage_radius = 6,
explosiontimer_reset_radius = 6, --explosiontimer_reset_radius = 6,
reach = 1.5, reach = 1.5,
defuse_reach = 4, defuse_reach = 4,
explosion_timer = 0.3, explosion_timer = 0.3,
@ -148,7 +148,7 @@ mobs:register_mob("mobs_mc:creeper", {
}) })
mobs:register_mob("mobs_mc:creeper_charged", { mobs:register_mob("mobs_mc:creeper_charged", {
description = S("Creeper"), description = S("Charged Creeper"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
hp_min = 20, hp_min = 20,
@ -182,10 +182,10 @@ mobs:register_mob("mobs_mc:creeper_charged", {
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" }, runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
attack_type = "explode", attack_type = "explode",
explosion_strength = 24, explosion_strength = 6,
explosion_radius = 12, --explosion_radius = 3,
explosion_damage_radius = 18, --explosion_damage_radius = 6,
explosiontimer_reset_radius = 10, --explosiontimer_reset_radius = 3,
reach = 1.5, reach = 1.5,
defuse_reach = 4, defuse_reach = 4,
explosion_timer = 0.3, explosion_timer = 0.3,

@ -15,7 +15,7 @@ mobs:register_mob("mobs_mc:guardian_elder", {
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,

@ -195,7 +195,7 @@ local professions = {
{ {
-- TODO: replace with empty map -- TODO: replace with empty map
{ { "mcl_core:emerald", 7, 11}, { "mcl_maps:filled_map", 1, 1 } }, { { "mcl_core:emerald", 7, 11}, { "mcl_maps:empty_map", 1, 1 } },
}, },
-- TODO: special maps -- TODO: special maps

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

@ -11,6 +11,10 @@ tt.register_snippet = function(func)
table.insert(tt.registered_snippets, func) table.insert(tt.registered_snippets, func)
end end
tt.register_priority_snippet = function(func)
table.insert(tt.registered_snippets, 1, func)
end
dofile(minetest.get_modpath(minetest.get_current_modname()).."/snippets.lua") dofile(minetest.get_modpath(minetest.get_current_modname()).."/snippets.lua")
-- Apply item description updates -- Apply item description updates
@ -22,8 +26,6 @@ local function apply_snippets(desc, itemstring, toolcaps, itemstack)
local str, snippet_color = tt.registered_snippets[s](itemstring, toolcaps, itemstack) local str, snippet_color = tt.registered_snippets[s](itemstring, toolcaps, itemstack)
if snippet_color == nil then if snippet_color == nil then
snippet_color = tt.COLOR_DEFAULT snippet_color = tt.COLOR_DEFAULT
elseif snippet_color == false then
snippet_color = false
end end
if str then if str then
if first then if first then

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

@ -28,6 +28,7 @@ mcl_credits.people = {
"Nicu", "Nicu",
"aligator", "aligator",
"Code-Sploit", "Code-Sploit",
"NO11",
}}, }},
{"Contributors", 0x52FF00, { {"Contributors", 0x52FF00, {
"Laurent Rocher", "Laurent Rocher",
@ -46,7 +47,6 @@ mcl_credits.people = {
"Jared Moody", "Jared Moody",
"Li0n", "Li0n",
"Midgard", "Midgard",
"NO11",
"Saku Laesvuori", "Saku Laesvuori",
"Yukitty", "Yukitty",
"ZedekThePD", "ZedekThePD",
@ -107,7 +107,8 @@ mcl_credits.people = {
"kingoscargames", "kingoscargames",
"leorockway", "leorockway",
"xMrVizzy", "xMrVizzy",
"yutyo" "yutyo",
"NO11",
}}, }},
{"Translations", 0x00FF60, { {"Translations", 0x00FF60, {
"Wuzzy", "Wuzzy",

@ -204,8 +204,9 @@ mcl_damage.register_on_death(function(obj, reason)
if obj:is_player() then if obj:is_player() then
send_to = true send_to = true
end -- ToDo: add mob death messages for owned mobs, only send to owner (sent_to = "player name") end
-- ToDo: add mob death messages for owned mobs, only send to owner (sent_to = "player name")
if send_to then if send_to then
local messages = mcl_death_messages.messages[reason.type] or {} local messages = mcl_death_messages.messages[reason.type] or {}

@ -275,10 +275,6 @@ function mcl_experience.add_experience(player, experience)
end end
stack:set_wear(math.floor(new_wear)) stack:set_wear(math.floor(new_wear))
inv:set_stack(list, index, stack) inv:set_stack(list, index, stack)
if can.list == "armor" then
local armor_inv = minetest.get_inventory({type = "detached", name = player:get_player_name() .. "_armor"})
armor_inv:set_stack(list, index, stack)
end
end end
local old_bar, old_xp, old_level = temp_pool.bar, temp_pool.xp, temp_pool.level local old_bar, old_xp, old_level = temp_pool.bar, temp_pool.xp, temp_pool.level

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

@ -118,16 +118,6 @@ ARROW_ENTITY.on_step = function(self, dtime)
dpos = vector.round(dpos) dpos = vector.round(dpos)
local node = minetest.get_node(dpos) local node = minetest.get_node(dpos)
if self.object:get_attach() ~= nil and self.object:get_attach(parent):get_hp() < 1 then
self.object:remove()
end
minetest.register_on_leaveplayer(function(player)
if self.object:get_attach(parent) == player then
self.object:remove()
end
end)
if self._stuck then if self._stuck then
self._stucktimer = self._stucktimer + dtime self._stucktimer = self._stucktimer + dtime
self._stuckrechecktimer = self._stuckrechecktimer + dtime self._stuckrechecktimer = self._stuckrechecktimer + dtime

@ -1,7 +1,7 @@
local S = minetest.get_translator("mcl_clock") local S = minetest.get_translator("mcl_clock")
--[[ --[[
mcl_clock, renew of the renew of the watch mod mcl_clock, renew of the renew of the mcl_clock mod
Original from Echo, here: http://forum.minetest.net/viewtopic.php?id=3795 Original from Echo, here: http://forum.minetest.net/viewtopic.php?id=3795
]]-- ]]--
@ -11,8 +11,7 @@ mcl_clock = {}
-- This is the itemstring of the default clock item. It is used for the default inventory image, help entries, and the like -- This is the itemstring of the default clock item. It is used for the default inventory image, help entries, and the like
mcl_clock.stereotype = "mcl_clock:clock" mcl_clock.stereotype = "mcl_clock:clock"
local watch = {} mcl_clock.old_time = -1
watch.old_time = -1
local clock_frames = 64 local clock_frames = 64
@ -22,20 +21,20 @@ local random_timer_trigger = 1.0 -- random clock spinning tick in seconds. Incre
local random_frame = math.random(0, clock_frames-1) local random_frame = math.random(0, clock_frames-1)
-- Image of all possible faces -- Image of all possible faces
watch.images = {} mcl_clock.images = {}
for frame=0, clock_frames-1 do for frame=0, clock_frames-1 do
local sframe = tostring(frame) local sframe = tostring(frame)
if string.len(sframe) == 1 then if string.len(sframe) == 1 then
sframe = "0" .. sframe sframe = "0" .. sframe
end end
table.insert(watch.images, "mcl_clock_clock_"..sframe..".png") table.insert(mcl_clock.images, "mcl_clock_clock_"..sframe..".png")
end end
local function round(num) local function round(num)
return math.floor(num + 0.5) return math.floor(num + 0.5)
end end
function watch.get_clock_frame() function mcl_clock.get_clock_frame()
local t = clock_frames * minetest.get_timeofday() local t = clock_frames * minetest.get_timeofday()
t = round(t) t = round(t)
if t == clock_frames then t = 0 end if t == clock_frames then t = 0 end
@ -45,7 +44,7 @@ end
local doc_mod = minetest.get_modpath("doc") ~= nil local doc_mod = minetest.get_modpath("doc") ~= nil
-- Register items -- Register items
function watch.register_item(name, image, creative, frame) function mcl_clock.register_item(name, image, creative, frame)
local g = 1 local g = 1
if creative then if creative then
g = 0 g = 0
@ -78,7 +77,7 @@ end
local force_clock_update_timer = 0 local force_clock_update_timer = 0
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
local now = watch.get_clock_frame() local now = mcl_clock.get_clock_frame()
force_clock_update_timer = force_clock_update_timer + dtime force_clock_update_timer = force_clock_update_timer + dtime
random_timer = random_timer + dtime random_timer = random_timer + dtime
-- This causes the random spinning of the clock -- This causes the random spinning of the clock
@ -87,16 +86,18 @@ minetest.register_globalstep(function(dtime)
random_timer = 0 random_timer = 0
end end
if watch.old_time == now and force_clock_update_timer < 60 then if mcl_clock.old_time == now and force_clock_update_timer < 60 then
return return
end end
force_clock_update_timer = 0 force_clock_update_timer = 0
watch.old_time = now mcl_clock.old_time = now
mcl_clock.random_frame = random_frame
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 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
@ -104,6 +105,7 @@ minetest.register_globalstep(function(dtime)
else else
frame = now frame = now
end end
local count = stack:get_count() local count = stack:get_count()
if stack:get_name() == mcl_clock.stereotype then if stack:get_name() == mcl_clock.stereotype then
player:get_inventory():set_stack("main", s, "mcl_clock:clock_"..frame.." "..count) player:get_inventory():set_stack("main", s, "mcl_clock:clock_"..frame.." "..count)
@ -117,7 +119,7 @@ end)
-- Immediately set correct clock time after crafting -- Immediately set correct clock time after crafting
minetest.register_on_craft(function(itemstack) minetest.register_on_craft(function(itemstack)
if itemstack:get_name() == mcl_clock.stereotype then if itemstack:get_name() == mcl_clock.stereotype then
itemstack:set_name("mcl_clock:clock_"..watch.get_clock_frame()) itemstack:set_name("mcl_clock:clock_"..mcl_clock.get_clock_frame())
end end
end) end)
@ -132,7 +134,7 @@ minetest.register_craft({
}) })
-- Clock tool -- Clock tool
watch.register_item(mcl_clock.stereotype, watch.images[1], true, 1) mcl_clock.register_item(mcl_clock.stereotype, mcl_clock.images[1], true, 1)
-- Faces -- Faces
for a=0,clock_frames-1,1 do for a=0,clock_frames-1,1 do
@ -142,6 +144,6 @@ for a=0,clock_frames-1,1 do
else else
b = b + 32 b = b + 32
end end
watch.register_item("mcl_clock:clock_"..tostring(a), watch.images[b+1], false, a+1) mcl_clock.register_item("mcl_clock:clock_"..tostring(a), mcl_clock.images[b+1], false, a+1)
end end

@ -12,6 +12,27 @@ local random_timer_trigger = 0.5 -- random compass spinning tick in seconds. Inc
local random_frame = math.random(0, compass_frames-1) local random_frame = math.random(0, compass_frames-1)
function mcl_compass.get_compass_image(pos, dir)
-- Compasses do not work in certain zones
if mcl_worlds.compass_works(pos) then
local spawn = {x=0,y=0,z=0}
local ssp = minetest.setting_get_pos("static_spawnpoint")
if ssp then
spawn = ssp
if type(spawn) ~= "table" or type(spawn.x) ~= "number" or type(spawn.y) ~= "number" or type(spawn.z) ~= "number" then
spawn = {x=0,y=0,z=0}
end
end
local angle_north = math.deg(math.atan2(spawn.x - pos.x, spawn.z - pos.z))
if angle_north < 0 then angle_north = angle_north + 360 end
local angle_dir = -math.deg(dir)
local angle_relative = (angle_north - angle_dir + 180) % 360
return math.floor((angle_relative/11.25) + 0.5) % compass_frames
else
return random_frame
end
end
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
random_timer = random_timer + dtime random_timer = random_timer + dtime
@ -30,27 +51,7 @@ minetest.register_globalstep(function(dtime)
end end
if has_compass(player) then if has_compass(player) then
local pos = player:get_pos() local pos = player:get_pos()
local dim = mcl_worlds.pos_to_dimension(pos) local compass_image = mcl_compass.get_compass_image(pos, player:get_look_horizontal())
local compass_image
-- Compasses do not work in certain zones
if not mcl_worlds.compass_works(pos) then
compass_image = random_frame
else
local spawn = {x=0,y=0,z=0}
local ssp = minetest.setting_get_pos("static_spawnpoint")
if ssp then
spawn = ssp
if type(spawn) ~= "table" or type(spawn.x) ~= "number" or type(spawn.y) ~= "number" or type(spawn.z) ~= "number" then
spawn = {x=0,y=0,z=0}
end
end
local dir = player:get_look_horizontal()
local angle_north = math.deg(math.atan2(spawn.x - pos.x, spawn.z - pos.z))
if angle_north < 0 then angle_north = angle_north + 360 end
local angle_dir = -math.deg(dir)
local angle_relative = (angle_north - angle_dir + 180) % 360
compass_image = math.floor((angle_relative/11.25) + 0.5) % compass_frames
end
for j,stack in pairs(player:get_inventory():get_list("main")) do for j,stack in pairs(player:get_inventory():get_list("main")) do
if minetest.get_item_group(stack:get_name(), "compass") ~= 0 and if minetest.get_item_group(stack:get_name(), "compass") ~= 0 and

@ -4,47 +4,30 @@
-- Crafting definition -- Crafting definition
-- --
minetest.register_craft({ local craft_planks = function(output, input)
output = 'mcl_core:wood 4', minetest.register_craft({
recipe = { output = "mcl_core:"..output.."wood 4",
{'mcl_core:tree'}, recipe = {
} {"mcl_core:"..input},
}) }
})
end
minetest.register_craft({ local planks = {
output = 'mcl_core:darkwood 4', {"", "oak"},
recipe = { {"dark", "dark_oak"},
{'mcl_core:darktree'}, {"jungle", "jungle"},
} {"acacia", "acacia"},
}) {"spruce", "spruce"},
{"birch", "birch"}
}
minetest.register_craft({ for _, p in pairs(planks) do
output = 'mcl_core:junglewood 4', craft_planks(p[1], p[1].."tree")
recipe = { craft_planks(p[1], p[1].."tree_bark")
{'mcl_core:jungletree'}, craft_planks(p[1], "stripped_"..p[2])
} craft_planks(p[1], "stripped_"..p[2].."_bark")
}) end
minetest.register_craft({
output = 'mcl_core:acaciawood 4',
recipe = {
{'mcl_core:acaciatree'},
}
})
minetest.register_craft({
output = 'mcl_core:sprucewood 4',
recipe = {
{'mcl_core:sprucetree'},
}
})
minetest.register_craft({
output = 'mcl_core:birchwood 4',
recipe = {
{'mcl_core:birchtree'},
}
})
minetest.register_craft({ minetest.register_craft({
type = 'shapeless', type = 'shapeless',

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 438 B

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 B

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 B

After

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 733 B

@ -361,4 +361,4 @@ minetest.register_on_joinplayer(mcl_enchanting.initialize_player)
minetest.register_on_player_receive_fields(mcl_enchanting.handle_formspec_fields) minetest.register_on_player_receive_fields(mcl_enchanting.handle_formspec_fields)
minetest.register_allow_player_inventory_action(mcl_enchanting.allow_inventory_action) minetest.register_allow_player_inventory_action(mcl_enchanting.allow_inventory_action)
minetest.register_on_player_inventory_action(mcl_enchanting.on_inventory_action) minetest.register_on_player_inventory_action(mcl_enchanting.on_inventory_action)
table.insert(tt.registered_snippets, 1, mcl_enchanting.enchantments_snippet) tt.register_priority_snippet(mcl_enchanting.enchantments_snippet)

@ -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) mcl_end.grow_chorus_plant = function(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
@ -321,7 +321,7 @@ mcl_end.grow_chorus_plant = function(pos, node)
while true do while true do
local new_flowers_list = {} local new_flowers_list = {}
for f=1, #flowers do for f=1, #flowers do
local new_flowers = mcl_end.grow_chorus_plant_step(flowers[f], minetest.get_node(flowers[f])) local new_flowers = mcl_end.grow_chorus_plant_step(flowers[f], minetest.get_node(flowers[f]), pr)
if #new_flowers > 0 then if #new_flowers > 0 then
table.insert(new_flowers_list, new_flowers) table.insert(new_flowers_list, new_flowers)
end end
@ -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) mcl_end.grow_chorus_plant_step = function(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)
@ -396,7 +396,7 @@ mcl_end.grow_chorus_plant_step = function(pos, node)
if grow_chance then if grow_chance then
local new_flowers = {} local new_flowers = {}
local r = math.random(1, 100) local r = pr:next(1, 100)
local age = node.param2 local age = node.param2
if r <= grow_chance then if r <= grow_chance then
table.insert(new_flowers, above) table.insert(new_flowers, above)
@ -404,13 +404,13 @@ mcl_end.grow_chorus_plant_step = function(pos, node)
age = age + 1 age = age + 1
local branches local branches
if branching == false then if branching == false then
branches = math.random(1, 4) branches = pr:next(1, 4)
elseif branching == true then elseif branching == true then
branches = math.random(0, 3) branches = pr:next(0, 3)
end end
local branch_grown = false local branch_grown = false
for b=1, branches do for b=1, branches do
local next_branch = math.random(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])
local below_branch = vector.add(branch, {x=0,y=-1,z=0}) local below_branch = vector.add(branch, {x=0,y=-1,z=0})
if minetest.get_node(below_branch).name == "air" then if minetest.get_node(below_branch).name == "air" then
@ -457,7 +457,7 @@ minetest.register_abm({
interval = 35.0, interval = 35.0,
chance = 4.0, chance = 4.0,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
mcl_end.grow_chorus_plant_step(pos, node) mcl_end.grow_chorus_plant_step(pos, node, pr)
end, end,
}) })

@ -27,8 +27,16 @@ end
local function crystal_explode(self, puncher) local function crystal_explode(self, puncher)
if self._exploded then return end if self._exploded then return end
self._exploded = true self._exploded = true
local strength = puncher and explosion_strength or 1 local strength = 1
mcl_explosions.explode(vector.add(self.object:get_pos(), {x = 0, y = 1.5, z = 0}), strength, {drop_chance = 1}, puncher) local source
if puncher then
strength = explosion_strength
local reason = {}
mcl_damage.from_punch(reason, puncher)
mcl_damage.finish_reason(reason)
source = reason.source
end
mcl_explosions.explode(vector.add(self.object:get_pos(), {x = 0, y = 1.5, z = 0}), strength, {drop_chance = 1}, self.object, source)
minetest.after(0, self.object.remove, self.object) minetest.after(0, self.object.remove, self.object)
end end

@ -117,8 +117,9 @@ pumpkin_face_base_def.groups.armor_head=1
pumpkin_face_base_def.groups.non_combat_armor_head=1 pumpkin_face_base_def.groups.non_combat_armor_head=1
pumpkin_face_base_def._mcl_armor_mob_range_factor = 0 pumpkin_face_base_def._mcl_armor_mob_range_factor = 0
pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman" pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman"
pumpkin_face_base_def._mcl_armor_entry = "head" pumpkin_face_base_def._mcl_armor_element = "head"
pumpkin_face_base_def.groups.non_combat_armor=1 pumpkin_face_base_def._mcl_armor_texture = "mcl_farming_pumpkin_face.png"
pumpkin_face_base_def._mcl_armor_preview = "mcl_farming_pumpkin_face_preview.png"
if minetest.get_modpath("mcl_armor") then if minetest.get_modpath("mcl_armor") then
pumpkin_face_base_def.on_secondary_use = mcl_armor.equip_on_use pumpkin_face_base_def.on_secondary_use = mcl_armor.equip_on_use
end end

@ -112,6 +112,8 @@ local function addhead(name, texture, desc, longdesc, rangemob, rangefactor)
_mcl_armor_mob_range_mob = rangemob, _mcl_armor_mob_range_mob = rangemob,
_mcl_armor_mob_range_factor = rangefactor, _mcl_armor_mob_range_factor = rangefactor,
_mcl_armor_element = "head", _mcl_armor_element = "head",
_mcl_armor_texture = "mcl_heads_" .. name .. ".png",
_mcl_armor_preview = "mcl_heads_" .. name .. "_preview.png",
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
_mcl_hardness = 1, _mcl_hardness = 1,
}) })

@ -53,6 +53,24 @@ minetest.register_entity("mcl_itemframes:item",{
end, end,
}) })
minetest.register_entity("mcl_itemframes:map", {
initial_properties = {
visual = "upright_sprite",
visual_size = {x = 1, y = 1},
pointable = false,
physical = false,
collide_with_objects = false,
textures = {"blank.png"},
},
on_activate = function(self, staticdata)
self.id = staticdata
self.object:set_properties({textures = {mcl_maps.load_map(self.id)}})
end,
get_staticdata = function(self)
return self.id
end,
})
local facedir = {} local facedir = {}
facedir[0] = {x=0,y=0,z=1} facedir[0] = {x=0,y=0,z=1}
@ -61,13 +79,10 @@ facedir[2] = {x=0,y=0,z=-1}
facedir[3] = {x=-1,y=0,z=0} facedir[3] = {x=-1,y=0,z=0}
local remove_item_entity = function(pos, node) local remove_item_entity = function(pos, node)
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) for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.5)) do
end local entity = obj:get_luaentity()
if objs then if entity and (entity.name == "mcl_itemframes:item" or entity.name == "mcl_itemframes:map") then
for _, obj in ipairs(objs) do
if obj and obj:get_luaentity() and obj:get_luaentity().name == "mcl_itemframes:item" then
obj:remove() obj:remove()
end end
end end
@ -89,25 +104,27 @@ local update_item_entity = function(pos, node, param2)
pos.y = pos.y + posad.y*6.5/16 pos.y = pos.y + posad.y*6.5/16
pos.z = pos.z + posad.z*6.5/16 pos.z = pos.z + posad.z*6.5/16
end end
local e = minetest.add_entity(pos, "mcl_itemframes:item") local yaw = math.pi*2 - param2 * math.pi/2
local lua = e:get_luaentity() local map_id = item:get_meta():get_string("mcl_maps:id")
lua._nodename = node.name if map_id == "" then
local itemname = item:get_name() local e = minetest.add_entity(pos, "mcl_itemframes:item")
if itemname == "" or itemname == nil then local lua = e:get_luaentity()
lua._texture = "blank.png" lua._nodename = node.name
lua._scale = 1 local itemname = item:get_name()
else if itemname == "" or itemname == nil then
lua._texture = itemname lua._texture = "blank.png"
local def = minetest.registered_items[itemname]
if def and def.wield_scale then
lua._scale = def.wield_scale.x
else
lua._scale = 1 lua._scale = 1
else
lua._texture = itemname
local def = minetest.registered_items[itemname]
lua._scale = def and def.wield_scale and def.wield_scale.x or 1
end end
end lua:_update_texture()
lua:_update_texture() if node.name == "mcl_itemframes:item_frame" then
if node.name == "mcl_itemframes:item_frame" then e:set_yaw(yaw)
local yaw = math.pi*2 - param2 * math.pi/2 end
else
local e = minetest.add_entity(pos, "mcl_itemframes:map", map_id)
e:set_yaw(yaw) e:set_yaw(yaw)
end end
end end
@ -148,6 +165,21 @@ minetest.register_node("mcl_itemframes:item_frame",{
groups = { dig_immediate=3,deco_block=1,dig_by_piston=1,container=7,attached_node_facedir=1 }, groups = { dig_immediate=3,deco_block=1,dig_by_piston=1,container=7,attached_node_facedir=1 },
sounds = mcl_sounds.node_sound_defaults(), sounds = mcl_sounds.node_sound_defaults(),
node_placement_prediction = "", node_placement_prediction = "",
on_timer = function(pos)
local inv = minetest.get_meta(pos):get_inventory()
local stack = inv:get_stack("main", 1)
local itemname = stack:get_name()
if minetest.get_item_group(itemname, "clock") > 0 then
local new_name = "mcl_clock:clock_" .. (mcl_worlds.clock_works(pos) and mcl_clock.old_time or mcl_clock.random_frame)
if itemname ~= new_name then
stack:set_name(new_name)
inv:set_stack("main", 1, stack)
local node = minetest.get_node(pos)
update_item_entity(pos, node, node.param2)
end
minetest.get_node_timer(pos):start(1.0)
end
end,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
return itemstack return itemstack
@ -188,6 +220,13 @@ minetest.register_node("mcl_itemframes:item_frame",{
end end
local put_itemstack = ItemStack(itemstack) local put_itemstack = ItemStack(itemstack)
put_itemstack:set_count(1) put_itemstack:set_count(1)
local itemname = put_itemstack:get_name()
if minetest.get_item_group(itemname, "compass") > 0 then
put_itemstack:set_name("mcl_compass:" .. mcl_compass.get_compass_image(pos, minetest.dir_to_yaw(minetest.facedir_to_dir(node.param2))))
end
if minetest.get_item_group(itemname, "clock") > 0 then
minetest.get_node_timer(pos):start(1.0)
end
inv:set_stack("main", 1, put_itemstack) inv:set_stack("main", 1, put_itemstack)
update_item_entity(pos, node) update_item_entity(pos, node)
-- Add node infotext when item has been named -- Add node infotext when item has been named

@ -1,3 +1,3 @@
name = mcl_itemframes name = mcl_itemframes
depends = mcl_core, mcl_sounds depends = mcl_core, mcl_sounds, mcl_compass, mcl_maps
optional_depends = screwdriver optional_depends = screwdriver

File diff suppressed because one or more lines are too long

@ -1,89 +1,238 @@
local S = minetest.get_translator("mcl_maps") mcl_maps = {}
-- Turn empty map into filled map by rightclick local S = minetest.get_translator("mcl_maps")
local make_filled_map = function(itemstack, placer, pointed_thing) local storage = minetest.get_mod_storage()
local new_map = ItemStack("mcl_maps:filled_map") local modpath = minetest.get_modpath("mcl_maps")
itemstack:take_item() local worldpath = minetest.get_worldpath()
if itemstack:is_empty() then local map_textures_path = worldpath .. "/mcl_maps/"
return new_map local last_finished_id = storage:get_int("next_id") - 1
else
local inv = placer:get_inventory() minetest.mkdir(map_textures_path)
if inv:room_for_item("main", new_map) then
inv:add_item("main", new_map) local function load_json_file(name)
else local file = assert(io.open(modpath .. "/" .. name .. ".json", "r"))
minetest.add_item(placer:get_pos(), new_map) local data = minetest.parse_json(file:read())
file:close()
return data
end
local texture_colors = load_json_file("colors")
local palettes = load_json_file("palettes")
local color_cache = {}
local creating_maps = {}
local loaded_maps = {}
local c_air = minetest.get_content_id("air")
function mcl_maps.create_map(pos)
local minp = vector.multiply(vector.floor(vector.divide(pos, 128)), 128)
local maxp = vector.add(minp, vector.new(127, 127, 127))
local itemstack = ItemStack("mcl_maps:filled_map")
local meta = itemstack:get_meta()
local next_id = storage:get_int("next_id")
storage:set_int("next_id", next_id + 1)
local id = tostring(next_id)
meta:set_string("mcl_maps:id", id)
meta:set_string("mcl_maps:minp", minetest.pos_to_string(minp))
meta:set_string("mcl_maps:maxp", minetest.pos_to_string(maxp))
tt.reload_itemstack_description(itemstack)
creating_maps[id] = true
minetest.emerge_area(minp, maxp, function(blockpos, action, calls_remaining)
if calls_remaining > 0 then
return
end
local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map(minp, maxp)
local data = vm:get_data()
local param2data = vm:get_param2_data()
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local pixels = {}
local last_heightmap
for x = 1, 128 do
local map_x = minp.x - 1 + x
local heightmap = {}
for z = 1, 128 do
local map_z = minp.z - 1 + z
local color, height
for map_y = maxp.y, minp.y, -1 do
local index = area:index(map_x, map_y, map_z)
local c_id = data[index]
if c_id ~= c_air then
color = color_cache[c_id]
if color == nil then
local nodename = minetest.get_name_from_content_id(c_id)
local def = minetest.registered_nodes[nodename]
if def then
local texture
if def.palette then
texture = def.palette
elseif def.tiles then
texture = def.tiles[1]
if type(texture) == "table" then
texture = texture.name
end
end
if texture then
texture = texture:match("([^=^%^]-([^.]+))$"):split("^")[1]
end
if def.palette then
local palette = palettes[texture]
color = palette and {palette = palette}
else
color = texture_colors[texture]
end
end
end
if color and color.palette then
color = color.palette[param2data[index] + 1]
else
color_cache[c_id] = color or false
end
if color and last_heightmap then
local last_height = last_heightmap[z]
if last_height < map_y then
color = {
math.min(255, color[1] + 16),
math.min(255, color[2] + 16),
math.min(255, color[3] + 16),
}
elseif last_height > map_y then
color = {
math.max(0, color[1] - 16),
math.max(0, color[2] - 16),
math.max(0, color[3] - 16),
}
end
end
height = map_y
break
end
end
heightmap[z] = height or minp.y
pixels[z] = pixels[z] or {}
pixels[z][x] = color or {0, 0, 0}
end
last_heightmap = heightmap
end
tga_encoder.image(pixels):save(map_textures_path .. "mcl_maps_map_texture_" .. id .. ".tga")
creating_maps[id] = nil
end)
return itemstack
end
function mcl_maps.load_map(id)
if id == "" or creating_maps[id] then
return
end
local texture = "mcl_maps_map_texture_" .. id .. ".tga"
if not loaded_maps[id] then
loaded_maps[id] = true
minetest.dynamic_add_media(map_textures_path .. texture, function() end)
end
return texture
end
function mcl_maps.load_map_item(itemstack)
return mcl_maps.load_map(itemstack:get_meta():get_string("mcl_maps:id"))
end
local function fill_map(itemstack, placer, pointed_thing)
local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing)
if new_stack then
return new_stack
end
if minetest.settings:get_bool("enable_real_maps", true) then
local new_map = mcl_maps.create_map(placer:get_pos())
itemstack:take_item()
if itemstack:is_empty() then
return new_map
else
local inv = placer:get_inventory()
if inv:room_for_item("main", new_map) then
inv:add_item("main", new_map)
else
minetest.add_item(placer:get_pos(), new_map)
end
return itemstack
end end
return itemstack
end end
end end
minetest.register_craftitem("mcl_maps:empty_map", { minetest.register_craftitem("mcl_maps:empty_map", {
description = S("Empty Map"), description = S("Empty Map"),
_doc_items_longdesc = S("Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used."), _doc_items_longdesc = S("Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used."),
_doc_items_usagehelp = S("Rightclick to start using the map (which can't be stacked anymore)."), _doc_items_usagehelp = S("Rightclick to create a filled map (which can't be stacked anymore)."),
inventory_image = "mcl_maps_map_empty.png", inventory_image = "mcl_maps_map_empty.png",
groups = { not_in_creative_inventory = 1 }, on_place = fill_map,
on_place = make_filled_map, on_secondary_use = fill_map,
on_secondary_use = make_filled_map,
stack_max = 64, stack_max = 64,
}) })
mcl_wip.register_wip_item("mcl_maps:empty_map") local filled_def = {
local function has_item_in_hotbar(player, item)
-- Requirement: player carries the tool in the hotbar
local inv = player:get_inventory()
local hotbar = player:hud_get_hotbar_itemcount()
for i=1, hotbar do
if inv:get_stack("main", i):get_name() == item then
return true
end
end
return false
end
-- Checks if player is still allowed to display the minimap
local function update_minimap(player)
local creative = minetest.is_creative_enabled(player:get_player_name())
if creative then
player:hud_set_flags({minimap=true, minimap_radar = true})
else
if has_item_in_hotbar(player, "mcl_maps:filled_map") then
player:hud_set_flags({minimap = true, minimap_radar = false})
else
player:hud_set_flags({minimap = false, minimap_radar = false})
end
end
end
-- Remind player how to use the minimap correctly
local function use_minimap(itemstack, player, pointed_thing)
if player and player:is_player() then
update_minimap(player)
minetest.chat_send_player(player:get_player_name(), S("Use the minimap key to show the map."))
end
end
-- Enables minimap if carried in hotbar.
-- If this item is NOT in the hotbar, the minimap is unavailable
-- Note: This is not at all like Minecraft right now. Minetest's minimap is pretty overpowered, it
-- has a very greatly zoomed-out version and even a radar mode
minetest.register_craftitem("mcl_maps:filled_map", {
description = S("Map"), description = S("Map"),
_tt_help = S("Enables minimap"), _tt_help = S("Shows a map image."),
_doc_items_longdesc = S("Maps show your surroundings as you explore the world."), _doc_items_longdesc = S("When created, the map saves the nearby area as an image that can be viewed any time by holding the map."),
_doc_items_usagehelp = S("Hold the map in any of the hotbar slots. This allows you to access the minimap by pressing the minimap key (see controls settings).").."\n".. _doc_items_usagehelp = S("Hold the map in your hand. This will display a map on your screen."),
S("In Creative Mode, you don't need this item; the minimap is always available."),
groups = { tool = 1 },
inventory_image = "mcl_maps_map_filled.png^(mcl_maps_map_filled_markings.png^[colorize:#000000)", inventory_image = "mcl_maps_map_filled.png^(mcl_maps_map_filled_markings.png^[colorize:#000000)",
stack_max = 1, stack_max = 64,
groups = {not_in_creative_inventory = 1, filled_map = 1, tool = 1},
}
on_use = use_minimap, minetest.register_craftitem("mcl_maps:filled_map", filled_def)
on_secondary_use = use_minimap,
}) local filled_wield_def = table.copy(filled_def)
filled_wield_def.use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false
filled_wield_def.visual_scale = 1
filled_wield_def.wield_scale = {x = 1, y = 1, z = 1}
filled_wield_def.paramtype = "light"
filled_wield_def.drawtype = "mesh"
filled_wield_def.node_placement_prediction = ""
filled_wield_def.range = minetest.registered_items[""].range
filled_wield_def.on_place = mcl_util.call_on_rightclick
for _, texture in pairs(mcl_skins.list) do
local def = table.copy(filled_wield_def)
def.tiles = {texture .. ".png"}
def.mesh = "mcl_meshhand.b3d"
def._mcl_hand_id = texture
minetest.register_node("mcl_maps:filled_map_" .. texture, def)
local female_def = table.copy(def)
female_def.mesh = "mcl_meshhand_female.b3d"
female_def._mcl_hand_id = texture .. "_female"
minetest.register_node("mcl_maps:filled_map_" .. texture .. "_female", female_def)
end
local old_add_item = minetest.add_item
function minetest.add_item(pos, stack)
stack = ItemStack(stack)
if minetest.get_item_group(stack:get_name(), "filled_map") > 0 then
stack:set_name("mcl_maps:filled_map")
end
return old_add_item(pos, stack)
end
tt.register_priority_snippet(function(itemstring, _, itemstack)
if itemstack and minetest.get_item_group(itemstring, "filled_map") > 0 then
local id = itemstack:get_meta():get_string("mcl_maps:id")
if id ~= "" then
return "#" .. id, mcl_colors.GRAY
end
end
end)
minetest.register_craft({ minetest.register_craft({
output = "mcl_maps:filled_map", output = "mcl_maps:empty_map",
recipe = { recipe = {
{ "mcl_core:paper", "mcl_core:paper", "mcl_core:paper" }, { "mcl_core:paper", "mcl_core:paper", "mcl_core:paper" },
{ "mcl_core:paper", "group:compass", "mcl_core:paper" }, { "mcl_core:paper", "group:compass", "mcl_core:paper" },
@ -91,20 +240,104 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
type = "shapeless",
output = "mcl_maps:filled_map 2",
recipe = {"group:filled_map", "mcl_maps:empty_map"},
})
local function on_craft(itemstack, player, old_craft_grid, craft_inv)
if itemstack:get_name() == "mcl_maps:filled_map" then
for _, stack in pairs(old_craft_grid) do
if minetest.get_item_group(stack:get_name(), "filled_map") > 0 then
itemstack:get_meta():from_table(stack:get_meta():to_table())
return itemstack
end
end
end
end
minetest.register_on_craft(on_craft)
minetest.register_craft_predict(on_craft)
local maps = {}
local huds = {}
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
update_minimap(player) local map_def = {
hud_elem_type = "image",
text = "blank.png",
position = {x = 0.75, y = 0.8},
alignment = {x = 0, y = -1},
offset = {x = 0, y = 0},
scale = {x = 2, y = 2},
}
local marker_def = table.copy(map_def)
marker_def.alignment = {x = 0, y = 0}
huds[player] = {
map = player:hud_add(map_def),
marker = player:hud_add(marker_def),
}
end) end)
local updatetimer = 0 minetest.register_on_leaveplayer(function(player)
if not minetest.is_creative_enabled("") then maps[player] = nil
minetest.register_globalstep(function(dtime) huds[player] = nil
updatetimer = updatetimer + dtime end)
if updatetimer > 0.1 then
local players = minetest.get_connected_players() minetest.register_globalstep(function(dtime)
for i=1, #players do for _, player in pairs(minetest.get_connected_players()) do
update_minimap(players[i]) local wield = player:get_wielded_item()
local texture = mcl_maps.load_map_item(wield)
local hud = huds[player]
if texture then
local wield_def = wield:get_definition()
local hand_def = player:get_inventory():get_stack("hand", 1):get_definition()
if hand_def and wield_def and hand_def._mcl_hand_id ~= wield_def._mcl_hand_id then
wield:set_name("mcl_maps:filled_map_" .. hand_def._mcl_hand_id)
player:set_wielded_item(wield)
end end
updatetimer = updatetimer - dtime
if texture ~= maps[player] then
player:hud_change(hud.map, "text", "[combine:140x140:0,0=mcl_maps_map_background.png:6,6=" .. texture)
maps[player] = texture
end
local pos = vector.round(player:get_pos())
local meta = wield:get_meta()
local minp = minetest.string_to_pos(meta:get_string("mcl_maps:minp"))
local maxp = minetest.string_to_pos(meta:get_string("mcl_maps:maxp"))
local marker = "mcl_maps_player_arrow.png"
if pos.x < minp.x then
marker = "mcl_maps_player_dot.png"
pos.x = minp.x
elseif pos.x > maxp.x then
marker = "mcl_maps_player_dot.png"
pos.x = maxp.x
end
if pos.z < minp.z then
marker = "mcl_maps_player_dot.png"
pos.z = minp.z
elseif pos.z > maxp.z then
marker = "mcl_maps_player_dot.png"
pos.z = maxp.z
end
if marker == "mcl_maps_player_arrow.png" then
local yaw = (math.floor(player:get_look_horizontal() * 180 / math.pi / 90 + 0.5) % 4) * 90
marker = marker .. "^[transformR" .. yaw
end
player:hud_change(hud.marker, "text", marker)
player:hud_change(hud.marker, "offset", {x = (6 - 140 / 2 + pos.x - minp.x) * 2, y = (6 - 140 + maxp.z - pos.z) * 2})
elseif maps[player] then
player:hud_change(hud.map, "text", "blank.png")
player:hud_change(hud.marker, "text", "blank.png")
maps[player] = nil
end end
end) end
end end)

@ -1,10 +1,8 @@
# textdomain: mcl_maps # textdomain: mcl_maps
Empty Map=Leere Karte Empty Map=Leere Karte
Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used.=Leere Karten sind als Karten nicht nützlich, aber sie können gestapelt werden und zu benutzbaren Karten umgewandelt werden. Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used.=Leere Karten sind als Karten nicht nützlich, aber sie können gestapelt werden und zu benutzbaren Karten umgewandelt werden.
Rightclick to start using the map (which can't be stacked anymore).=Rechtsklick, um zu beginnen, die Karte zu benutzen. Sie kann dann nicht mehr gestapelt werden. Rightclick to create a filled map (which can't be stacked anymore).=Rechtsklick, um die Karte zu füllen. Sie kann dann nicht mehr gestapelt werden.
Map=Karte Map=Karte
Maps show your surroundings as you explore the world.=Karten zeigen Ihre Umgebung, während Sie die Welt erkunden. Shows a map image.=Zeigt ein Kartenbild.
Hold the map in any of the hotbar slots. This allows you to access the minimap by pressing the minimap key (see controls settings).=Halten Sie die Karte in einen beliebigen Platz in der Schnellleiste. Damit können Sie jetzt die Übersichtskarte aktivieren, indem Sie die Taste zum Umschalten der Karte drücken (siehe Tastenbelegung). When created, the map saves the nearby area as an image that can be viewed any time by holding the map.=Beim Erstellen speichert die Karte die Gegend in der Nähe als ein Bild, dass jederzeit durch halten der Karte angesehen werden kann.
In Creative Mode, you don't need this item; the minimap is always available.=Im Kreativmodus brauchen Sie diesen Gegenstand nicht; die Übersichtskarte ist immer verfügbar. Hold the map in your hand. This will display a map on your screen.=Halten Sie die Karte in Ihrer Hand. Eine Karte wird auf Ihrem Bildschirm angezeigt werden.
Enables minimap=Aktiviert Übersichtskarte
Use the minimap key to show the map.=Taste „Karte an/aus“ benutzen, um die Karte zu betrachten.

@ -3,6 +3,3 @@ Empty Map=Mapa vacio
Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used.=Los mapas vacíos no son útiles como mapas, pero se pueden apilar y convertir en mapas que se pueden usar. Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used.=Los mapas vacíos no son útiles como mapas, pero se pueden apilar y convertir en mapas que se pueden usar.
Rightclick to start using the map (which can't be stacked anymore).=Haga clic derecho para comenzar a usar el mapa (que ya no se puede apilar). Rightclick to start using the map (which can't be stacked anymore).=Haga clic derecho para comenzar a usar el mapa (que ya no se puede apilar).
Map=Mapa Map=Mapa
Maps show your surroundings as you explore the world.=Los mapas muestran tu entorno mientras exploras el mundo.
Hold the map in any of the hotbar slots. This allows you to access the minimap by pressing the minimap key (see controls settings).=Mantenga el mapa en cualquiera de las ranuras de la barra de acceso directo. Esto le permite acceder al minimapa presionando la tecla del minimapa (consulte la configuración de los controles).
In Creative Mode, you don't need this item; the minimap is always available.=En el modo creativo, no necesita este elemento; El minimapa siempre está disponible.

@ -3,8 +3,3 @@ Empty Map=Carte Vierge
Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used.=Les cartes vierges ne sont pas utiles en tant que cartes, mais elles peuvent être empilées et transformées en cartes utilisables. Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used.=Les cartes vierges ne sont pas utiles en tant que cartes, mais elles peuvent être empilées et transformées en cartes utilisables.
Rightclick to start using the map (which can't be stacked anymore).=Clic droit pour commencer à utiliser la carte (qui ne peut plus être empilée). Rightclick to start using the map (which can't be stacked anymore).=Clic droit pour commencer à utiliser la carte (qui ne peut plus être empilée).
Map=Carte Map=Carte
Maps show your surroundings as you explore the world.=Les cartes montrent votre environnement lorsque vous explorez le monde.
Hold the map in any of the hotbar slots. This allows you to access the minimap by pressing the minimap key (see controls settings).=Tenez la carte dans l'un des emplacements de la barre de raccourci. Cela vous permet d'accéder à la mini-carte en appuyant sur la touche de la mini-carte (voir les paramètres des commandes).
In Creative Mode, you don't need this item; the minimap is always available.=En mode créatif, vous n'avez pas besoin de cet élément; la minicarte est toujours disponible.
Enables minimap=Active la minicarte
Use the minimap key to show the map.=Utilisez la touche mini-carte pour afficher la carte.

@ -3,8 +3,3 @@ Empty Map=Пустая карта
Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used.=Пустые карты не могут использоваться в качестве карт, но могут складываться в стопки, а также могут быть превращены в полноценные карты. Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used.=Пустые карты не могут использоваться в качестве карт, но могут складываться в стопки, а также могут быть превращены в полноценные карты.
Rightclick to start using the map (which can't be stacked anymore).=Кликните правой, чтобы начать использовать карту (её больше нельзя будет уложить в стопку). Rightclick to start using the map (which can't be stacked anymore).=Кликните правой, чтобы начать использовать карту (её больше нельзя будет уложить в стопку).
Map=Карта Map=Карта
Maps show your surroundings as you explore the world.=Карты показывают ваше окружение, когда вы изучаете мир.
Hold the map in any of the hotbar slots. This allows you to access the minimap by pressing the minimap key (see controls settings).=Поместите карту в один из отсеков панели быстрого доступа. Это позволит вам вызывать миникарту нажатием клавиши [Миникарта] (см. настройки управления).
In Creative Mode, you don't need this item; the minimap is always available.=Этот предмет не нужен в творческом режиме; там миникарта всегда доступна и так.
Enables minimap=Включает миникарту
Use the minimap key to show the map.=Используйте клавишу [Миникарта] для отображения карты.

@ -1,10 +1,8 @@
# textdomain: mcl_maps # textdomain: mcl_maps
Empty Map= Empty Map=
Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used.= Empty maps are not useful as maps, but they can be stacked and turned to maps which can be used.=
Rightclick to start using the map (which can't be stacked anymore).= Rightclick to create a filled map (which can't be stacked anymore).=
Map= Map=
Maps show your surroundings as you explore the world.= Shows a map image.=
Hold the map in any of the hotbar slots. This allows you to access the minimap by pressing the minimap key (see controls settings).= When created, the map saves the nearby area as an image that can be viewed any time by holding the map.=
In Creative Mode, you don't need this item; the minimap is always available.= Hold the map in your hand. This will display a map on your screen.=
Enables minimap=
Use the minimap key to show the map.=

@ -1,2 +1,2 @@
name = mcl_maps name = mcl_maps
depends = mcl_wip depends = mcl_core, mcl_flowers, tga_encoder, tt, mcl_colors, mcl_skins, mcl_util

@ -0,0 +1 @@
{"mcl_core_palette_grass.png": [[109, 196, 117], [159, 193, 114], [118, 177, 120], [118, 177, 120], [107, 186, 107], [118, 177, 120], [92, 182, 119], [92, 182, 119], [92, 182, 119], [92, 182, 119], [118, 177, 120], [109, 196, 117], [35, 175, 105], [94, 190, 107], [94, 190, 107], [94, 190, 107], [94, 190, 107], [159, 193, 114], [76, 176, 84], [164, 150, 110], [164, 150, 110], [164, 150, 110], [164, 150, 110], [159, 193, 114], [93, 181, 76], [93, 181, 76], [93, 181, 76], [93, 181, 76], [76, 118, 60], [94, 190, 107], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117], [109, 196, 117]]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

@ -54,6 +54,7 @@ local spawn_count_overrides = {
local function set_doll_properties(doll, mob) local function set_doll_properties(doll, mob)
local mobinfo = minetest.registered_entities[mob] local mobinfo = minetest.registered_entities[mob]
if not mobinfo then return end
local xs, ys local xs, ys
if doll_size_overrides[mob] then if doll_size_overrides[mob] then
xs = doll_size_overrides[mob].x xs = doll_size_overrides[mob].x

@ -107,7 +107,7 @@ minetest.register_globalstep(function(dtime)
EF.invisible[player].timer = EF.invisible[player].timer + dtime EF.invisible[player].timer = EF.invisible[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#B0B0B0") end if player:get_pos() then mcl_potions._add_spawner(player, "#7F8392") end
if EF.invisible[player].timer >= EF.invisible[player].dur then if EF.invisible[player].timer >= EF.invisible[player].dur then
mcl_potions.make_invisible(player, false) mcl_potions.make_invisible(player, false)
@ -129,7 +129,7 @@ minetest.register_globalstep(function(dtime)
EF.poisoned[player].timer = EF.poisoned[player].timer + dtime EF.poisoned[player].timer = EF.poisoned[player].timer + dtime
EF.poisoned[player].hit_timer = (EF.poisoned[player].hit_timer or 0) + dtime EF.poisoned[player].hit_timer = (EF.poisoned[player].hit_timer or 0) + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#225533") end if player:get_pos() then mcl_potions._add_spawner(player, "#4E9331") end
if EF.poisoned[player].hit_timer >= EF.poisoned[player].step then if EF.poisoned[player].hit_timer >= EF.poisoned[player].step then
if mcl_util.get_hp(player) - 1 > 0 then if mcl_util.get_hp(player) - 1 > 0 then
@ -158,7 +158,7 @@ minetest.register_globalstep(function(dtime)
EF.regenerating[player].timer = EF.regenerating[player].timer + dtime EF.regenerating[player].timer = EF.regenerating[player].timer + dtime
EF.regenerating[player].heal_timer = (EF.regenerating[player].heal_timer or 0) + dtime EF.regenerating[player].heal_timer = (EF.regenerating[player].heal_timer or 0) + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#A52BB2") end if player:get_pos() then mcl_potions._add_spawner(player, "#CD5CAB") end
if EF.regenerating[player].heal_timer >= EF.regenerating[player].step then if EF.regenerating[player].heal_timer >= EF.regenerating[player].step then
@ -192,7 +192,7 @@ minetest.register_globalstep(function(dtime)
EF.water_breathing[player].timer = EF.water_breathing[player].timer + dtime EF.water_breathing[player].timer = EF.water_breathing[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#0000AA") end if player:get_pos() then mcl_potions._add_spawner(player, "#2E5299") end
if player:get_breath() then if player:get_breath() then
if player:get_breath() < 10 then player:set_breath(10) end if player:get_breath() < 10 then player:set_breath(10) end
@ -217,7 +217,7 @@ minetest.register_globalstep(function(dtime)
EF.leaping[player].timer = EF.leaping[player].timer + dtime EF.leaping[player].timer = EF.leaping[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#00CC33") end if player:get_pos() then mcl_potions._add_spawner(player, "#22FF4C") end
if EF.leaping[player].timer >= EF.leaping[player].dur then if EF.leaping[player].timer >= EF.leaping[player].dur then
playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping") playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping")
@ -239,7 +239,7 @@ minetest.register_globalstep(function(dtime)
EF.swift[player].timer = EF.swift[player].timer + dtime EF.swift[player].timer = EF.swift[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#009999") end if player:get_pos() then mcl_potions._add_spawner(player, "#7CAFC6") end
if EF.swift[player].timer >= EF.swift[player].dur then if EF.swift[player].timer >= EF.swift[player].dur then
playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness") playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness")
@ -261,7 +261,7 @@ minetest.register_globalstep(function(dtime)
EF.night_vision[player].timer = EF.night_vision[player].timer + dtime EF.night_vision[player].timer = EF.night_vision[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#1010AA") end if player:get_pos() then mcl_potions._add_spawner(player, "#1F1FA1") end
if EF.night_vision[player].timer >= EF.night_vision[player].dur then if EF.night_vision[player].timer >= EF.night_vision[player].dur then
EF.night_vision[player] = nil EF.night_vision[player] = nil
@ -286,7 +286,7 @@ minetest.register_globalstep(function(dtime)
EF.fire_proof[player].timer = EF.fire_proof[player].timer + dtime EF.fire_proof[player].timer = EF.fire_proof[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#E0B050") end if player:get_pos() then mcl_potions._add_spawner(player, "#E49A3A") end
if EF.fire_proof[player].timer >= EF.fire_proof[player].dur then if EF.fire_proof[player].timer >= EF.fire_proof[player].dur then
EF.fire_proof[player] = nil EF.fire_proof[player] = nil
@ -307,7 +307,7 @@ minetest.register_globalstep(function(dtime)
EF.weak[player].timer = EF.weak[player].timer + dtime EF.weak[player].timer = EF.weak[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#7700BB") end if player:get_pos() then mcl_potions._add_spawner(player, "#484D48") end
if EF.weak[player].timer >= EF.weak[player].dur then if EF.weak[player].timer >= EF.weak[player].dur then
EF.weak[player] = nil EF.weak[player] = nil
@ -328,7 +328,7 @@ minetest.register_globalstep(function(dtime)
EF.strong[player].timer = EF.strong[player].timer + dtime EF.strong[player].timer = EF.strong[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#7700BB") end if player:get_pos() then mcl_potions._add_spawner(player, "#932423") end
if EF.strong[player].timer >= EF.strong[player].dur then if EF.strong[player].timer >= EF.strong[player].dur then
EF.strong[player] = nil EF.strong[player] = nil

@ -459,7 +459,7 @@ local healing_def = {
_tt = S("+4 HP"), _tt = S("+4 HP"),
_tt_2 = S("+8 HP"), _tt_2 = S("+8 HP"),
_longdesc = S("Instantly heals."), _longdesc = S("Instantly heals."),
color = "#CC0000", color = "#F82423",
effect = 4, effect = 4,
instant = true, instant = true,
on_use = mcl_potions.healing_func, on_use = mcl_potions.healing_func,
@ -473,7 +473,7 @@ local harming_def = {
_tt = S("-6 HP"), _tt = S("-6 HP"),
_tt_II = S("-12 HP"), _tt_II = S("-12 HP"),
_longdesc = S("Instantly deals damage."), _longdesc = S("Instantly deals damage."),
color = "#660099", color = "#430A09",
effect = -6, effect = -6,
instant = true, instant = true,
on_use = mcl_potions.healing_func, on_use = mcl_potions.healing_func,
@ -486,7 +486,7 @@ local night_vision_def = {
description = S("Night Vision"), description = S("Night Vision"),
_tt = nil, _tt = nil,
_longdesc = S("Increases the perceived brightness of light under a dark sky."), _longdesc = S("Increases the perceived brightness of light under a dark sky."),
color = "#1010AA", color = "#1F1FA1",
effect = nil, effect = nil,
is_dur = true, is_dur = true,
on_use = mcl_potions.night_vision_func, on_use = mcl_potions.night_vision_func,
@ -498,7 +498,7 @@ local swiftness_def = {
description = S("Swiftness"), description = S("Swiftness"),
_tt = nil, _tt = nil,
_longdesc = S("Increases walking speed."), _longdesc = S("Increases walking speed."),
color = "#009999", color = "#7CAFC6",
effect = 1.2, effect = 1.2,
is_dur = true, is_dur = true,
on_use = mcl_potions.swiftness_func, on_use = mcl_potions.swiftness_func,
@ -511,7 +511,7 @@ local slowness_def = {
description = S("Slowness"), description = S("Slowness"),
_tt = nil, _tt = nil,
_longdesc = S("Decreases walking speed."), _longdesc = S("Decreases walking speed."),
color = "#000080", color = "#5A6C81",
effect = 0.85, effect = 0.85,
is_dur = true, is_dur = true,
on_use = mcl_potions.swiftness_func, on_use = mcl_potions.swiftness_func,
@ -525,7 +525,7 @@ local leaping_def = {
description = S("Leaping"), description = S("Leaping"),
_tt = nil, _tt = nil,
_longdesc = S("Increases jump strength."), _longdesc = S("Increases jump strength."),
color = "#00CC33", color = "#22FF4C",
effect = 1.15, effect = 1.15,
is_dur = true, is_dur = true,
on_use = mcl_potions.leaping_func, on_use = mcl_potions.leaping_func,
@ -538,7 +538,7 @@ local poison_def = {
description = S("Poison"), description = S("Poison"),
_tt = nil, _tt = nil,
_longdesc = S("Applies the poison effect which deals damage at a regular interval."), _longdesc = S("Applies the poison effect which deals damage at a regular interval."),
color = "#447755", color = "#4E9331",
effect = 2.5, effect = 2.5,
is_dur = true, is_dur = true,
on_use = mcl_potions.poison_func, on_use = mcl_potions.poison_func,
@ -552,7 +552,7 @@ local regeneration_def = {
description = S("Regeneration"), description = S("Regeneration"),
_tt = nil, _tt = nil,
_longdesc = S("Regenerates health over time."), _longdesc = S("Regenerates health over time."),
color = "#B52CC2", color = "#CD5CAB",
effect = 2.5, effect = 2.5,
is_dur = true, is_dur = true,
on_use = mcl_potions.regeneration_func, on_use = mcl_potions.regeneration_func,
@ -565,7 +565,7 @@ local invisibility_def = {
description = S("Invisibility"), description = S("Invisibility"),
_tt = nil, _tt = nil,
_longdesc = S("Grants invisibility."), _longdesc = S("Grants invisibility."),
color = "#B0B0B0", color = "#7F8392",
is_dur = true, is_dur = true,
on_use = mcl_potions.invisiblility_func, on_use = mcl_potions.invisiblility_func,
is_plus = true, is_plus = true,
@ -576,7 +576,7 @@ local water_breathing_def = {
description = S("Water Breathing"), description = S("Water Breathing"),
_tt = nil, _tt = nil,
_longdesc = S("Grants limitless breath underwater."), _longdesc = S("Grants limitless breath underwater."),
color = "#0000AA", color = "#2E5299",
is_dur = true, is_dur = true,
on_use = mcl_potions.water_breathing_func, on_use = mcl_potions.water_breathing_func,
is_plus = true, is_plus = true,
@ -587,7 +587,7 @@ local fire_resistance_def = {
description = S("Fire Resistance"), description = S("Fire Resistance"),
_tt = nil, _tt = nil,
_longdesc = S("Grants immunity to damage from heat sources like fire."), _longdesc = S("Grants immunity to damage from heat sources like fire."),
color = "#D0A040", color = "#E49A3A",
is_dur = true, is_dur = true,
on_use = mcl_potions.fire_resistance_func, on_use = mcl_potions.fire_resistance_func,
is_plus = true, is_plus = true,
@ -611,22 +611,22 @@ end
-- description = S("Weakness"), -- description = S("Weakness"),
-- _tt_help = TODO, -- _tt_help = TODO,
-- _doc_items_longdesc = brewhelp, -- _doc_items_longdesc = brewhelp,
-- wield_image = potion_image("#6600AA"), -- wield_image = potion_image("#484D48"),
-- inventory_image = potion_image("#6600AA"), -- inventory_image = potion_image("#484D48"),
-- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- groups = { brewitem=1, food=3, can_eat_when_full=1 },
-- stack_max = 1, -- stack_max = 1,
-- --
-- on_place = function(itemstack, user, pointed_thing) -- on_place = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#6600AA") -- mcl_potions._use_potion(itemstack, user, "#484D48")
-- return itemstack -- return itemstack
-- end, -- end,
-- --
-- on_secondary_use = function(itemstack, user, pointed_thing) -- on_secondary_use = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#6600AA") -- mcl_potions._use_potion(itemstack, user, "#484D48")
-- return itemstack -- return itemstack
-- end -- end
-- }) -- })
@ -635,22 +635,22 @@ end
-- description = S("Weakness +"), -- description = S("Weakness +"),
-- _tt_help = TODO, -- _tt_help = TODO,
-- _doc_items_longdesc = brewhelp, -- _doc_items_longdesc = brewhelp,
-- wield_image = potion_image("#7700BB"), -- wield_image = potion_image("#484D48"),
-- inventory_image = potion_image("#7700BB"), -- inventory_image = potion_image("#484D48"),
-- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- groups = { brewitem=1, food=3, can_eat_when_full=1 },
-- stack_max = 1, -- stack_max = 1,
-- --
-- on_place = function(itemstack, user, pointed_thing) -- on_place = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#7700BB") -- mcl_potions._use_potion(itemstack, user, "#484D48")
-- return itemstack -- return itemstack
-- end, -- end,
-- --
-- on_secondary_use = function(itemstack, user, pointed_thing) -- on_secondary_use = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#7700BB") -- mcl_potions._use_potion(itemstack, user, "#484D48")
-- return itemstack -- return itemstack
-- end -- end
-- }) -- })
@ -659,22 +659,22 @@ end
-- description = S("Strength"), -- description = S("Strength"),
-- _tt_help = TODO, -- _tt_help = TODO,
-- _doc_items_longdesc = brewhelp, -- _doc_items_longdesc = brewhelp,
-- wield_image = potion_image("#D444D4"), -- wield_image = potion_image("#932423"),
-- inventory_image = potion_image("#D444D4"), -- inventory_image = potion_image("#932423"),
-- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- groups = { brewitem=1, food=3, can_eat_when_full=1 },
-- stack_max = 1, -- stack_max = 1,
-- --
-- on_place = function(itemstack, user, pointed_thing) -- on_place = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444D4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end, -- end,
-- --
-- on_secondary_use = function(itemstack, user, pointed_thing) -- on_secondary_use = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444D4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end -- end
-- }) -- })
@ -683,22 +683,22 @@ end
-- description = S("Strength II"), -- description = S("Strength II"),
-- _tt_help = TODO, -- _tt_help = TODO,
-- _doc_items_longdesc = brewhelp, -- _doc_items_longdesc = brewhelp,
-- wield_image = potion_image("#D444E4"), -- wield_image = potion_image("#932423"),
-- inventory_image = potion_image("#D444E4"), -- inventory_image = potion_image("#932423"),
-- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- groups = { brewitem=1, food=3, can_eat_when_full=1 },
-- stack_max = 1, -- stack_max = 1,
-- --
-- on_place = function(itemstack, user, pointed_thing) -- on_place = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2) -- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444E4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end, -- end,
-- --
-- on_secondary_use = function(itemstack, user, pointed_thing) -- on_secondary_use = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2) -- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444E4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end -- end
-- }) -- })
@ -707,22 +707,22 @@ end
-- description = S("Strength +"), -- description = S("Strength +"),
-- _tt_help = TODO, -- _tt_help = TODO,
-- _doc_items_longdesc = brewhelp, -- _doc_items_longdesc = brewhelp,
-- wield_image = potion_image("#D444F4"), -- wield_image = potion_image("#932423"),
-- inventory_image = potion_image("#D444F4"), -- inventory_image = potion_image("#932423"),
-- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- groups = { brewitem=1, food=3, can_eat_when_full=1 },
-- stack_max = 1, -- stack_max = 1,
-- --
-- on_place = function(itemstack, user, pointed_thing) -- on_place = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444F4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end, -- end,
-- --
-- on_secondary_use = function(itemstack, user, pointed_thing) -- on_secondary_use = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444F4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end -- end
-- }) -- })

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

@ -3974,9 +3974,16 @@ 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)
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 realpos = { x = pos.x, y = pos.y + 1, z = pos.z } local x, y, z = pos.x, pos.y, pos.z
mcl_end.grow_chorus_plant(realpos) if x < -2 or x > 2 or z < -2 or z > 2 then
local realpos = { x = x, y = y + 1, z = z }
local node = minetest.get_node(realpos)
if node and node.name == "mcl_end:chorus_flower" then
mcl_end.grow_chorus_plant(realpos, node, pr)
end
end
end end
end) end)
end end

@ -1248,9 +1248,14 @@ local function generate_clay(minp, maxp, blockseed, voxelmanip_data, voxelmanip_
end end
local function generate_end_exit_portal(pos) local function generate_end_exit_portal(pos)
local dragon_entity = minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon"):get_luaentity() local obj = minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon")
dragon_entity._initial = true if obj then
dragon_entity._portal_pos = pos local dragon_entity = obj:get_luaentity()
dragon_entity._initial = true
dragon_entity._portal_pos = pos
else
minetest.log("error", "[mcl_mapgen_core] ERROR! Ender dragon doesn't want to spawn")
end
mcl_structures.call_struct(pos, "end_exit_portal") mcl_structures.call_struct(pos, "end_exit_portal")
end end

@ -7,7 +7,7 @@ end
--[[ Manually set in 'buildings.lua' --[[ Manually set in 'buildings.lua'
-- material to replace cobblestone with -- material to replace cobblestone with
wallmaterial = { local wallmaterial = {
"mcl_core:junglewood", "mcl_core:junglewood",
"mcl_core:sprucewood", "mcl_core:sprucewood",
"mcl_core:wood", "mcl_core:wood",

@ -137,14 +137,14 @@ local timerMult = 1 -- Cycles from 0 to 7, each time when timer hits half a seco
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
main_timer = main_timer + dtime main_timer = main_timer + dtime
timer = timer + dtime timer = timer + dtime
if main_timer > mcl_hunger.HUD_TICK or timer > 0.5 then if main_timer > mcl_hunger.HUD_TICK or timer > 0.25 then
if main_timer > mcl_hunger.HUD_TICK then main_timer = 0 end if main_timer > mcl_hunger.HUD_TICK then main_timer = 0 end
for _,player in pairs(minetest.get_connected_players()) do for _,player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name() local name = player:get_player_name()
local h = tonumber(mcl_hunger.get_hunger(player)) local h = tonumber(mcl_hunger.get_hunger(player))
local hp = player:get_hp() local hp = player:get_hp()
if timer > 0.5 then if timer > 0.25 then
-- Slow health regeneration, and hunger damage (every 4s). -- Slow health regeneration, and hunger damage (every 4s).
-- Regeneration rate based on tutorial video <https://www.youtube.com/watch?v=zs2t-xCVHBo>. -- Regeneration rate based on tutorial video <https://www.youtube.com/watch?v=zs2t-xCVHBo>.
-- Minecraft Wiki seems to be wrong in claiming that full hunger gives 0.5s regen rate. -- Minecraft Wiki seems to be wrong in claiming that full hunger gives 0.5s regen rate.
@ -166,9 +166,9 @@ minetest.register_globalstep(function(dtime)
end end
end end
end end
if timer > 0.5 then if timer > 0.25 then
timer = 0 timer = 0
timerMult = timerMult + 1 timerMult = timerMult + 2
if timerMult > 7 then if timerMult > 7 then
timerMult = 0 timerMult = 0
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

@ -34,7 +34,8 @@ for _,texture in pairs(list) do
end, end,
groups = { dig_immediate = 3, not_in_creative_inventory = 1 }, groups = { dig_immediate = 3, not_in_creative_inventory = 1 },
range = def.range, range = def.range,
}) _mcl_hand_id = texture,
})
minetest.register_node("mcl_meshhand:"..texture.. "_female", { minetest.register_node("mcl_meshhand:"..texture.. "_female", {
description = "", description = "",
@ -57,7 +58,8 @@ for _,texture in pairs(list) do
end, end,
groups = { dig_immediate = 3, not_in_creative_inventory = 1 }, groups = { dig_immediate = 3, not_in_creative_inventory = 1 },
range = def.range, range = def.range,
}) _mcl_hand_id = texture .. "_female",
})
end end
if has_mcl_skins == true then if has_mcl_skins == true then

@ -549,6 +549,9 @@ mcl_damage.register_modifier(function(obj, damage, reason)
end end
return 0 return 0
end end
if node.name == "mcl_core:cobweb" then
return 0
end
end end
pos = vector.add(pos, step) pos = vector.add(pos, step)
node = minetest.get_node(pos) node = minetest.get_node(pos)

@ -150,3 +150,6 @@ basic_pseudobiome_villages (Enables very basic, and experimental "pseudobiome-ba
# If enabled, will run an LBM to fix the top 1/2 of double plants in mcimported worlds; defaults to true. # If enabled, will run an LBM to fix the top 1/2 of double plants in mcimported worlds; defaults to true.
fix_doubleplants (Mcimport double plant fixes) bool true fix_doubleplants (Mcimport double plant fixes) bool true
# Allow players to create Minecraft-like maps.
enable_real_maps (Enable Real Maps) bool true

@ -27,3 +27,17 @@ Usage:
- Convert the textures - Convert the textures
- Put the new texture directory in the Minetest texture pack directory, just like - Put the new texture directory in the Minetest texture pack directory, just like
any other Minetest texture pack any other Minetest texture pack
## Luacheck Globals Generators
This is a Python script which list every single global tables in mineclone2 source code.
It outputs a list to be used in luacheck conf files.
Modes of operation:
- List global tables
Requirements:
- Know how to use the console
- Python 3
Usage:
- In the console, run `python3 ./tools/create_luacheck.py` in the MineClone2 directory

@ -196,6 +196,11 @@ def convert_textures():
if verbose: if verbose:
print(src_file + "" + dst_file) print(src_file + "" + dst_file)
# Convert map background
map_background_file = tex_dir + "/map/map_background.png"
if os.path.isfile(map_background_file):
os.system("convert " + map_background_file + " -interpolate Integer -filter point -resize \"140x140\" " + target_dir("/mods/ITEMS/mcl_maps/textures") + "/mcl_maps_map_background.png")
# Convert armor textures (requires ImageMagick) # Convert armor textures (requires ImageMagick)
armor_files = [ armor_files = [
[ tex_dir + "/models/armor/leather_layer_1.png", tex_dir + "/models/armor/leather_layer_2.png", target_dir("/mods/ITEMS/mcl_armor/textures"), "mcl_armor_helmet_leather.png", "mcl_armor_chestplate_leather.png", "mcl_armor_leggings_leather.png", "mcl_armor_boots_leather.png" ], [ tex_dir + "/models/armor/leather_layer_1.png", tex_dir + "/models/armor/leather_layer_2.png", target_dir("/mods/ITEMS/mcl_armor/textures"), "mcl_armor_helmet_leather.png", "mcl_armor_chestplate_leather.png", "mcl_armor_leggings_leather.png", "mcl_armor_boots_leather.png" ],

44
tools/create_luacheck.py Normal file → Executable file

@ -0,0 +1,44 @@
import os
import re
from pathlib import Path
# Just run this script from mineclone2 directory to get a list of every global vars to use in luacheck configuration files
path = "./mods/"
pattern = re.compile(r'^(?P<global_var>[A-Za-z_0-9]+)[ ]*=[ ]*\{')
pattern_local = re.compile(r'local (?P<local_var>[A-Za-z_0-9]+)')
global_vars = []
print("---Copy/Paste output in your luacheck conf file---\n")
pathlist = Path(path).rglob('*.lua')
for path in pathlist:
path_in_str = str(path)
# print(path_in_str)
trouve = False
with open(path_in_str) as f:
local_vars = []
for i, line in enumerate(f.readlines()):
m = pattern.match(line)
if m:
global_name = m.group('global_var')
if global_name not in local_vars:
#print(path_in_str, ":", i+1, ":", m.group('global_var').strip())
global_vars.append(m.group('global_var').strip())
found = True
break
else:
n = pattern_local.match(line)
if n:
local_vars.append(n.group('local_var'))
if not found:
nb_varloc = len(variables_locales)
#print(path_in_str, ": -", "({} variables locales)".format(nb_varloc) if nb_varloc > 0 else '')
print(', '.join(['"{}"'.format(v) for v in global_vars]))

@ -0,0 +1,59 @@
import json, os
from PIL import Image
colors = {}
palettes = {}
for root, directories, files in os.walk(".."):
if root.endswith("/textures"):
for name in files:
try:
img = Image.open(os.path.join(root, name)).convert("RGBA")
pixels = img.load()
if "palette" in name:
palette = []
for y in range(0, img.size[1]):
for x in range(0, img.size[0]):
r, g, b, a = pixels[x, y]
palette.append((r, g, b))
palettes[name] = palette
else:
r_total = 0
g_total = 0
b_total = 0
count = 0
for x in range(0, img.size[0]):
for y in range(0, img.size[1]):
r, g, b, a = pixels[x, y]
if a > 0:
r_total += r / 255 * a
g_total += g / 255 * a
b_total += b / 255 * a
count += a / 255
average_color = None
if count > 0:
average_color = (int(r_total / count), int(g_total / count), int(b_total / count))
else:
average_color = (255, 255, 255)
colors[name] = average_color
img.close()
except IOError:
pass
path = "../mods/ITEMS/mcl_maps/"
with open(path + "colors.json", "w") as colorfile:
colorfile.write(json.dumps(colors))
with open(path + "palettes.json", "w") as palettefile:
palettefile.write(json.dumps(palettes))