Merge remote-tracking branch 'origin/master' into mapgen
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 35 KiB |
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
|
||||||
|
|
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 9.3 KiB |
|
@ -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 {}
|
||||||
|
|
Before Width: | Height: | Size: 12 KiB |
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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]]}
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 35 KiB |
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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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" ],
|
||||||
|
|
|
@ -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))
|
||||||
|
|