forked from MineClone5/MineClone5
Update Fork #9
|
@ -55,7 +55,7 @@ function mcl_maps.create_map(pos)
|
||||||
local map_y_start = 64 * dx
|
local map_y_start = 64 * dx
|
||||||
local map_y_limit = 127 * dx
|
local map_y_limit = 127 * dx
|
||||||
|
|
||||||
local pixels = {}
|
local pixels = ""
|
||||||
local last_heightmap
|
local last_heightmap
|
||||||
for x = 1, 128 do
|
for x = 1, 128 do
|
||||||
local map_x = x + offset
|
local map_x = x + offset
|
||||||
|
@ -125,13 +125,15 @@ function mcl_maps.create_map(pos)
|
||||||
height = map_y - map_z
|
height = map_y - map_z
|
||||||
|
|
||||||
heightmap[z] = height or minp.y
|
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
|
end
|
||||||
last_heightmap = heightmap
|
last_heightmap = heightmap
|
||||||
end
|
end
|
||||||
|
|
||||||
local png = minetest.encode_png(128, 128, pixels)
|
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
|
if not f then return end
|
||||||
f:write(png)
|
f:write(png)
|
||||||
f:close()
|
f:close()
|
||||||
|
@ -219,6 +221,8 @@ filled_wield_def.drawtype = "mesh"
|
||||||
filled_wield_def.node_placement_prediction = ""
|
filled_wield_def.node_placement_prediction = ""
|
||||||
filled_wield_def.range = minetest.registered_items[""].range
|
filled_wield_def.range = minetest.registered_items[""].range
|
||||||
filled_wield_def.on_place = mcl_util.call_on_rightclick
|
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
|
for _, texture in pairs(mcl_skins.list) do
|
||||||
local def = table.copy(filled_wield_def)
|
local def = table.copy(filled_wield_def)
|
||||||
|
|
|
@ -7,4 +7,6 @@ Makes hand wielded items visible to other players.
|
||||||
Info for modders
|
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.
|
||||||
|
|
|
@ -34,8 +34,13 @@ minetest.register_entity("mcl_wieldview:wieldnode", {
|
||||||
self._item = item
|
self._item = item
|
||||||
|
|
||||||
if get_item_group(item, "no_wieldview") ~= 0 then
|
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 = ""
|
item = ""
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local item_def = minetest.registered_items[item]
|
local item_def = minetest.registered_items[item]
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
|
|
Loading…
Reference in New Issue