Update Fork #9

Merged
chmodsayshello merged 403 commits from MineClone5/MineClone5:master into master 2022-08-02 15:50:37 +02:00
3 changed files with 16 additions and 5 deletions
Showing only changes of commit 00e54944fa - Show all commits

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

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