1
0
Fork 0

Merge branch 'master' into dyable-leather-armor

dyable-leather-armor
AFCMS 2021-05-10 09:39:20 +02:00
commit 422d48f658
60 changed files with 665 additions and 196 deletions

View File

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

View File

@ -484,12 +484,18 @@ function mcl_util.deal_damage(target, damage, mcl_reason)
elseif luaentity._cmi_is_mob then
-- 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)
if luaentity.health > 0 then
luaentity.health = luaentity.health - damage
end
return
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
function mcl_util.get_hp(obj)
@ -533,7 +539,7 @@ function mcl_util.get_object_name(object)
local luaentity = object:get_luaentity()
if not luaentity then
return ""
return tostring(object)
end
return luaentity.nametag and luaentity.nametag ~= "" and luaentity.nametag or luaentity.description or luaentity.name

View File

@ -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.

View File

@ -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

View File

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

View File

@ -406,6 +406,14 @@ minetest.register_entity(":__builtin:item", {
return
end
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 max_count = stack:get_stack_max()
if count > max_count then
@ -593,6 +601,12 @@ minetest.register_entity(":__builtin:item", {
local node = minetest.get_node_or_nil(p)
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 self._magnet_active and (self._collector_timer == nil or (self._collector_timer > item_drop_settings.magnet_time)) then
self._magnet_active = false

View File

@ -87,6 +87,12 @@ end
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
--get all attached entities and sort through them

View File

@ -195,7 +195,7 @@ local professions = {
{
-- 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

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

View File

@ -11,6 +11,10 @@ tt.register_snippet = function(func)
table.insert(tt.registered_snippets, func)
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")
-- 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)
if snippet_color == nil then
snippet_color = tt.COLOR_DEFAULT
elseif snippet_color == false then
snippet_color = false
end
if str 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

View File

@ -204,8 +204,9 @@ mcl_damage.register_on_death(function(obj, reason)
if obj:is_player() then
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
local messages = mcl_death_messages.messages[reason.type] or {}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,7 +1,7 @@
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
]]--
@ -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
mcl_clock.stereotype = "mcl_clock:clock"
local watch = {}
watch.old_time = -1
mcl_clock.old_time = -1
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)
-- Image of all possible faces
watch.images = {}
mcl_clock.images = {}
for frame=0, clock_frames-1 do
local sframe = tostring(frame)
if string.len(sframe) == 1 then
sframe = "0" .. sframe
end
table.insert(watch.images, "mcl_clock_clock_"..sframe..".png")
table.insert(mcl_clock.images, "mcl_clock_clock_"..sframe..".png")
end
local function round(num)
return math.floor(num + 0.5)
end
function watch.get_clock_frame()
function mcl_clock.get_clock_frame()
local t = clock_frames * minetest.get_timeofday()
t = round(t)
if t == clock_frames then t = 0 end
@ -45,7 +44,7 @@ end
local doc_mod = minetest.get_modpath("doc") ~= nil
-- Register items
function watch.register_item(name, image, creative, frame)
function mcl_clock.register_item(name, image, creative, frame)
local g = 1
if creative then
g = 0
@ -78,7 +77,7 @@ end
local force_clock_update_timer = 0
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
random_timer = random_timer + dtime
-- This causes the random spinning of the clock
@ -87,16 +86,18 @@ minetest.register_globalstep(function(dtime)
random_timer = 0
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
end
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 s, stack in pairs(player:get_inventory():get_list("main")) do
local dim = mcl_worlds.pos_to_dimension(player:get_pos())
local frame
-- Clocks do not work in certain zones
if not mcl_worlds.clock_works(player:get_pos()) then
@ -104,6 +105,7 @@ minetest.register_globalstep(function(dtime)
else
frame = now
end
local count = stack:get_count()
if stack:get_name() == mcl_clock.stereotype then
player:get_inventory():set_stack("main", s, "mcl_clock:clock_"..frame.." "..count)
@ -117,7 +119,7 @@ end)
-- Immediately set correct clock time after crafting
minetest.register_on_craft(function(itemstack)
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)
@ -132,7 +134,7 @@ minetest.register_craft({
})
-- 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
for a=0,clock_frames-1,1 do
@ -142,6 +144,6 @@ for a=0,clock_frames-1,1 do
else
b = b + 32
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

View File

@ -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)
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)
random_timer = random_timer + dtime
@ -30,27 +51,7 @@ minetest.register_globalstep(function(dtime)
end
if has_compass(player) then
local pos = player:get_pos()
local dim = mcl_worlds.pos_to_dimension(pos)
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
local compass_image = mcl_compass.get_compass_image(pos, player:get_look_horizontal())
for j,stack in pairs(player:get_inventory():get_list("main")) do
if minetest.get_item_group(stack:get_name(), "compass") ~= 0 and

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

View File

@ -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_allow_player_inventory_action(mcl_enchanting.allow_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)

View File

@ -309,7 +309,7 @@ minetest.register_node("mcl_end:chorus_plant", {
})
-- Grow a complete chorus plant at pos
mcl_end.grow_chorus_plant = function(pos, node)
mcl_end.grow_chorus_plant = function(pos, node, pr)
local flowers = { pos }
-- Plant initial flower (if it isn't there already)
if not node then
@ -321,7 +321,7 @@ mcl_end.grow_chorus_plant = function(pos, node)
while true do
local new_flowers_list = {}
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
table.insert(new_flowers_list, new_flowers)
end
@ -340,7 +340,7 @@ end
-- Grow a single step of a chorus plant at pos.
-- Pos must be a chorus flower.
mcl_end.grow_chorus_plant_step = function(pos, node)
mcl_end.grow_chorus_plant_step = function(pos, node, pr)
local new_flower_buds = {}
local above = { x = pos.x, y = pos.y + 1, z = pos.z }
local node_above = minetest.get_node(above)
@ -396,7 +396,7 @@ mcl_end.grow_chorus_plant_step = function(pos, node)
if grow_chance then
local new_flowers = {}
local r = math.random(1, 100)
local r = pr:next(1, 100)
local age = node.param2
if r <= grow_chance then
table.insert(new_flowers, above)
@ -404,13 +404,13 @@ mcl_end.grow_chorus_plant_step = function(pos, node)
age = age + 1
local branches
if branching == false then
branches = math.random(1, 4)
branches = pr:next(1, 4)
elseif branching == true then
branches = math.random(0, 3)
branches = pr:next(0, 3)
end
local branch_grown = false
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 below_branch = vector.add(branch, {x=0,y=-1,z=0})
if minetest.get_node(below_branch).name == "air" then
@ -457,7 +457,7 @@ minetest.register_abm({
interval = 35.0,
chance = 4.0,
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,
})

View File

@ -27,8 +27,16 @@ end
local function crystal_explode(self, puncher)
if self._exploded then return end
self._exploded = true
local strength = puncher and explosion_strength or 1
mcl_explosions.explode(vector.add(self.object:get_pos(), {x = 0, y = 1.5, z = 0}), strength, {drop_chance = 1}, puncher)
local strength = 1
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)
end

View File

@ -53,6 +53,24 @@ minetest.register_entity("mcl_itemframes:item",{
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 = {}
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}
local remove_item_entity = function(pos, node)
local objs = nil
if node.name == "mcl_itemframes:item_frame" then
objs = minetest.get_objects_inside_radius(pos, .5)
end
if objs then
for _, obj in ipairs(objs) do
if obj and obj:get_luaentity() and obj:get_luaentity().name == "mcl_itemframes:item" then
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.5)) do
local entity = obj:get_luaentity()
if entity and (entity.name == "mcl_itemframes:item" or entity.name == "mcl_itemframes:map") then
obj:remove()
end
end
@ -89,6 +104,9 @@ local update_item_entity = function(pos, node, param2)
pos.y = pos.y + posad.y*6.5/16
pos.z = pos.z + posad.z*6.5/16
end
local yaw = math.pi*2 - param2 * math.pi/2
local map_id = item:get_meta():get_string("mcl_maps:id")
if map_id == "" then
local e = minetest.add_entity(pos, "mcl_itemframes:item")
local lua = e:get_luaentity()
lua._nodename = node.name
@ -99,15 +117,14 @@ local update_item_entity = function(pos, node, param2)
else
lua._texture = itemname
local def = minetest.registered_items[itemname]
if def and def.wield_scale then
lua._scale = def.wield_scale.x
else
lua._scale = 1
end
lua._scale = def and def.wield_scale and def.wield_scale.x or 1
end
lua:_update_texture()
if node.name == "mcl_itemframes:item_frame" then
local yaw = math.pi*2 - param2 * math.pi/2
e:set_yaw(yaw)
end
else
local e = minetest.add_entity(pos, "mcl_itemframes:map", map_id)
e:set_yaw(yaw)
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 },
sounds = mcl_sounds.node_sound_defaults(),
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)
if pointed_thing.type ~= "node" then
return itemstack
@ -188,6 +220,13 @@ minetest.register_node("mcl_itemframes:item_frame",{
end
local put_itemstack = ItemStack(itemstack)
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)
update_item_entity(pos, node)
-- Add node infotext when item has been named

View File

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

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,158 @@
local S = minetest.get_translator("mcl_maps")
mcl_maps = {}
-- Turn empty map into filled map by rightclick
local make_filled_map = function(itemstack, placer, pointed_thing)
local new_map = ItemStack("mcl_maps:filled_map")
local S = minetest.get_translator("mcl_maps")
local storage = minetest.get_mod_storage()
local modpath = minetest.get_modpath("mcl_maps")
local worldpath = minetest.get_worldpath()
local map_textures_path = worldpath .. "/mcl_maps/"
local last_finished_id = storage:get_int("next_id") - 1
minetest.mkdir(map_textures_path)
local function load_json_file(name)
local file = assert(io.open(modpath .. "/" .. name .. ".json", "r"))
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
@ -16,74 +166,73 @@ local make_filled_map = function(itemstack, placer, pointed_thing)
return itemstack
end
end
end
minetest.register_craftitem("mcl_maps: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_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",
groups = { not_in_creative_inventory = 1 },
on_place = make_filled_map,
on_secondary_use = make_filled_map,
on_place = fill_map,
on_secondary_use = fill_map,
stack_max = 64,
})
mcl_wip.register_wip_item("mcl_maps:empty_map")
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", {
local filled_def = {
description = S("Map"),
_tt_help = S("Enables minimap"),
_doc_items_longdesc = S("Maps show your surroundings as you explore the world."),
_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"..
S("In Creative Mode, you don't need this item; the minimap is always available."),
groups = { tool = 1 },
_tt_help = S("Shows a map image."),
_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 your hand. This will display a map on your screen."),
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,
on_secondary_use = use_minimap,
})
minetest.register_craftitem("mcl_maps:filled_map", filled_def)
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({
output = "mcl_maps:filled_map",
output = "mcl_maps:empty_map",
recipe = {
{ "mcl_core:paper", "mcl_core:paper", "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)
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)
minetest.register_on_leaveplayer(function(player)
maps[player] = nil
huds[player] = nil
end)
local updatetimer = 0
if not minetest.is_creative_enabled("") then
minetest.register_globalstep(function(dtime)
updatetimer = updatetimer + dtime
if updatetimer > 0.1 then
local players = minetest.get_connected_players()
for i=1, #players do
update_minimap(players[i])
for _, player in pairs(minetest.get_connected_players()) do
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
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
updatetimer = updatetimer - dtime
end
end)
end

View File

@ -1,10 +1,8 @@
# textdomain: mcl_maps
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.
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
Maps show your surroundings as you explore the world.=Karten zeigen Ihre Umgebung, während Sie die Welt erkunden.
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).
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.
Enables minimap=Aktiviert Übersichtskarte
Use the minimap key to show the map.=Taste „Karte an/aus“ benutzen, um die Karte zu betrachten.
Shows a map image.=Zeigt ein Kartenbild.
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.
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.

View File

@ -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.
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
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.

View File

@ -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.
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
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.

View File

@ -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.=Пустые карты не могут использоваться в качестве карт, но могут складываться в стопки, а также могут быть превращены в полноценные карты.
Rightclick to start using the map (which can't be stacked anymore).=Кликните правой, чтобы начать использовать карту (её больше нельзя будет уложить в стопку).
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.=Используйте клавишу [Миникарта] для отображения карты.

View File

@ -1,10 +1,8 @@
# textdomain: mcl_maps
Empty Map=
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=
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.=
Shows a map image.=
When created, the map saves the nearby area as an image that can be viewed any time by holding the map.=
Hold the map in your hand. This will display a map on your screen.=

View File

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

View File

@ -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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@ -3974,9 +3974,16 @@ if mg_name ~= "singlenode" then
mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed)
local gennotify = minetest.get_mapgen_object("gennotify")
--local poslist = {}
local pr = PseudoRandom(blockseed + 14)
for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do
local realpos = { x = pos.x, y = pos.y + 1, z = pos.z }
mcl_end.grow_chorus_plant(realpos)
local x, y, z = pos.x, pos.y, pos.z
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

View File

@ -1248,9 +1248,14 @@ local function generate_clay(minp, maxp, blockseed, voxelmanip_data, voxelmanip_
end
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")
if obj then
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")
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

View File

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

View File

@ -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.
fix_doubleplants (Mcimport double plant fixes) bool true
# Allow players to create Minecraft-like maps.
enable_real_maps (Enable Real Maps) bool true

View File

@ -196,6 +196,11 @@ def convert_textures():
if verbose:
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)
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" ],

View File

@ -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))