Merge master into testing

This commit is contained in:
kay27 2022-05-09 05:39:23 +03:00
commit 0d8c9c8577
4 changed files with 23 additions and 12 deletions

View File

@ -55,7 +55,7 @@ function mcl_maps.create_map(pos)
local map_y_start = 64 * dx
local map_y_limit = 127 * dx
local pixels = {}
local pixels = ""
local last_heightmap
for x = 1, 128 do
local map_x = x + offset
@ -125,13 +125,15 @@ function mcl_maps.create_map(pos)
height = map_y - map_z
heightmap[z] = height or minp.y
pixels[#pixels + 1] = color and {r = color[1], g = color[2], b = color[3]} or {r = 0, g = 0, b = 0}
if not color then color = {0, 0, 0} end
pixels = pixels .. minetest.colorspec_to_bytes({r = color[1], g = color[2], b = color[3]})
end
last_heightmap = heightmap
end
local png = minetest.encode_png(128, 128, pixels)
local f = io.open(map_textures_path .. "mcl_maps_map_texture_" .. id .. ".png", "w")
local f = io.open(map_textures_path .. "mcl_maps_map_texture_" .. id .. ".png", "wb")
if not f then return end
f:write(png)
f:close()
@ -219,6 +221,8 @@ 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
filled_wield_def.groups.no_wieldview = 1
filled_wield_def._wieldview_item = "mcl_maps:empty_map"
for _, texture in pairs(mcl_skins.list) do
local def = table.copy(filled_wield_def)

View File

@ -142,14 +142,14 @@ local function egg_on_step(self, dtime)
if not object then return end
local ent = object:get_luaentity()
object:set_properties({
visual_size = { x = ent.base_size.x/2, y = ent.base_size.y/2 },
visual_size = { x = ent.base_size.x*ent.baby_size, y = ent.base_size.y*ent.baby_size },
collisionbox = {
ent.base_colbox[1]/2,
ent.base_colbox[2]/2,
ent.base_colbox[3]/2,
ent.base_colbox[4]/2,
ent.base_colbox[5]/2,
ent.base_colbox[6]/2,
ent.base_colbox[1]*ent.baby_size,
ent.base_colbox[2]*ent.baby_size,
ent.base_colbox[3]*ent.baby_size,
ent.base_colbox[4]*ent.baby_size,
ent.base_colbox[5]*ent.baby_size,
ent.base_colbox[6]*ent.baby_size,
}
})
ent.child = true

View File

@ -7,4 +7,6 @@ Makes hand wielded items visible to other players.
Info for modders
################
Add items to the "no_wieldview" group with a raiting of 1 and it will not be shown by the wieldview.
Add an item to the "no_wieldview" group with a rating of 1 and it will not be shown by the wieldview.
If an item has the "no_wieldview" group rating of 1, the item definition can specify the property "_wieldview_item".
"_wieldview_item" should be set to an item name that will be shown by the wieldview instead of the item.

View File

@ -34,8 +34,13 @@ minetest.register_entity("mcl_wieldview:wieldnode", {
self._item = item
if get_item_group(item, "no_wieldview") ~= 0 then
local def = player:get_wielded_item():get_definition()
if def and def._wieldview_item then
item = def._wieldview_item
else
item = ""
end
end
local item_def = minetest.registered_items[item]
self.object:set_properties({