Mods update

master
daretmavi 2021-04-07 22:11:54 +02:00
parent 87e17b1d77
commit 7d5b649cda
58 changed files with 6881 additions and 151 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------------------
Work in Progress 0.9 [07.04.2020]
Mods update
-------------------------------------------------------------------------------
Work in Progress 0.8.1 [07.04.2020]

View File

@ -77,7 +77,7 @@ origin https://notabug.org/tenplus1/farming (fetch)
Mod: flora/farming
origin https://github.com/minetest-mods/i3.git (fetch)
* main e910c20 [origin/main] Code cleaning
* main 3db6bbe [origin/main] UI improvements
Mod: gui/i3
origin https://repo.or.cz/minetest_hbarmor.git (fetch)
@ -113,7 +113,7 @@ origin https://github.com/TheTermos/mobkit (fetch)
Mod: lib_api/mobkit
origin https://notabug.org/tenplus1/mobs_redo (fetch)
* master 34b06df [origin/master] add ability to follow group: items
* master c06d071 [origin/master] allow players with 'protection_bypass' to rename owned tamed mobs
Mod: lib_api/mobs_redo
origin https://github.com/appgurueu/modlib (fetch)
@ -149,7 +149,7 @@ origin https://codeberg.org/Hamlet/mobs_ghost_redo (fetch)
Mod: mobs/mobs_mobs/mobs_ghost_redo
origin https://notabug.org/TenPlus1/mobs_monster.git (fetch)
* master 095d875 [origin/master] add Tree Creeper
* master e39d06b [origin/master] add fire damage to obsidian flan
Mod: mobs/mobs_mobs/mobs_monster
origin https://github.com/berengma/aerotest (fetch)

View File

@ -17,6 +17,7 @@ This mod requires **Minetest 5.4+**
- 3D Player Model Preview
- Inventory Sorting (alphabetical + item stack compression)
- Item Bookmarks
- Waypoints
**¹** *This mode is a Terraria-like system that shows recipes you can craft from items you ever had in your inventory.
To enable it: `i3_progressive_mode = true` in `minetest.conf`.*

View File

@ -58,15 +58,16 @@ local ES = function(...)
return ESC(S(...))
end
local maxn, sort, concat, copy, insert, remove =
local maxn, sort, concat, copy, insert, remove, indexof =
table.maxn, table.sort, table.concat, table.copy,
table.insert, table.remove
table.insert, table.remove, table.indexof
local sprintf, find, gmatch, match, sub, split, upper, lower =
string.format, string.find, string.gmatch, string.match,
string.sub, string.split, string.upper, string.lower
local min, max, floor, ceil, abs = math.min, math.max, math.floor, math.ceil, math.abs
local min, max, floor, ceil, random =
math.min, math.max, math.floor, math.ceil, math.random
local pairs, ipairs, next, type, setmetatable, tonum, unpack, select =
pairs, ipairs, next, type, setmetatable, tonumber, unpack, select
@ -88,7 +89,7 @@ local HUD_TIMER_MAX = 1.5
local MIN_FORMSPEC_VERSION = 4
local META_SAVES = {"bag_size", "skin_id"}
local META_SAVES = {"bag_size", "waypoints"}
local BAG_SIZES = {
small = INV_SIZE + 3,
@ -96,6 +97,14 @@ local BAG_SIZES = {
large = INV_SIZE + 9,
}
local SUBCAT = {
"bag",
"armor",
"skins",
"awards",
"waypoints",
}
local PNG = {
bg = "i3_bg.png",
bg_full = "i3_bg_full.png",
@ -122,6 +131,13 @@ local PNG = {
tab = "i3_tab.png",
tab_top = "i3_tab.png^\\[transformFY",
furnace_anim = "i3_furnace_anim.png",
bag = "i3_bag.png",
armor = "i3_armor.png",
awards = "i3_award.png",
skins = "i3_skin.png",
waypoints = "i3_waypoint.png",
teleport = "i3_teleport.png",
add = "i3_add.png",
cancel_hover = "i3_cancel.png^\\[brighten",
search_hover = "i3_search.png^\\[brighten",
@ -134,6 +150,13 @@ local PNG = {
next_hover = "i3_next_hover.png",
tab_hover = "i3_tab_hover.png",
tab_hover_top = "i3_tab_hover.png^\\[transformFY",
bag_hover = "i3_bag_hover.png",
armor_hover = "i3_armor_hover.png",
awards_hover = "i3_award_hover.png",
skins_hover = "i3_skin_hover.png",
waypoints_hover = "i3_waypoint_hover.png",
teleport_hover = "i3_teleport.png^\\[brighten",
add_hover = "i3_add.png^\\[brighten",
}
local fs_elements = {
@ -153,11 +176,11 @@ local fs_elements = {
}
local styles = sprintf([[
style_type[field;border=false;bgcolor=transparent]
style_type[label,field;font_size=16]
style_type[image_button;border=false;sound=i3_click]
style_type[item_image_button;border=false;bgimg_hovered=%s;sound=i3_click]
style[filter;border=false]
style[cancel;fgimg=%s;fgimg_hovered=%s;content_offset=0]
style[search;fgimg=%s;fgimg_hovered=%s;content_offset=0]
style[prev_page;fgimg=%s;fgimg_hovered=%s]
@ -166,6 +189,9 @@ local styles = sprintf([[
style[next_recipe;fgimg=%s;fgimg_hovered=%s]
style[prev_usage;fgimg=%s;fgimg_hovered=%s]
style[next_usage;fgimg=%s;fgimg_hovered=%s]
style[waypoint_add;fgimg=%s;fgimg_hovered=%s;content_offset=0]
style[waypoint_delete;fgimg=%s;fgimg_hovered=%s;content_offset=0]
style[waypoint_teleport;fgimg=%s;fgimg_hovered=%s;content_offset=0]
style[pagenum,no_item,no_rcp;border=false;font=bold;font_size=18;content_offset=0]
style[btn_bag,btn_armor,btn_skins;font=bold;font_size=18;border=false;content_offset=0;sound=i3_click]
style[craft_rcp,craft_usg;border=false;noclip=true;font_size=16;sound=i3_craft;
@ -180,7 +206,10 @@ PNG.next, PNG.next_hover,
PNG.prev, PNG.prev_hover,
PNG.next, PNG.next_hover,
PNG.prev, PNG.prev_hover,
PNG.next, PNG.next_hover)
PNG.next, PNG.next_hover,
PNG.add, PNG.add_hover,
PNG.trash, PNG.trash_hover,
PNG.teleport, PNG.teleport_hover)
local function get_lang_code(info)
return info and info.lang_code
@ -639,24 +668,24 @@ local function get_desc(item)
local def = reg_items[item]
if def then
local desc = ItemStack(item):get_short_description()
if true_str(desc) then
desc = desc:trim()
if not find(desc, "%u") then
desc = toupper(desc)
end
return desc
elseif true_str(item) then
return toupper(match(item, ":(.*)"))
end
if not def then
return S("Unknown Item (@1)", item)
end
return S("Unknown Item (@1)", item)
local desc = def.description
if true_str(desc) then
desc = desc:trim():match("[^\n]*"):gsub("_", " ")
if not find(desc, "%u") then
desc = toupper(desc)
end
return desc
elseif true_str(item) then
return toupper(match(item, ":(.*)"))
end
end
local function item_has_groups(item_groups, groups)
@ -1147,7 +1176,7 @@ local function craft_stack(player, pname, data, craft_rcp)
local inv = player:get_inventory()
local rcp_usg = craft_rcp and "recipe" or "usage"
local output = craft_rcp and data.recipes[data.rnum].output or data.usages[data.unum].output
output = ItemStack(output)
output = ItemStack(output)
local stackname, stackcount, stackmax = output:get_name(), output:get_count(), output:get_stack_max()
local scrbar_val = data[fmt("scrbar_%s", craft_rcp and "rcp" or "usg")] or 1
@ -1373,7 +1402,7 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
fs("animated_image", X + 0.05, Y, ITEM_BTN_SIZE, ITEM_BTN_SIZE, PNG.fire_anim, 8, 180)
else
local item = rcp.output
item = ItemStack(clean_name(item))
item = ItemStack(clean_name(item))
local name = item:get_name()
local count = item:get_count()
local bt_s = ITEM_BTN_SIZE * 1.2
@ -1530,21 +1559,20 @@ local function get_rcp_lbl(fs, data, panel, rn, is_recipe)
lbl = ES("Recipe @1 of @2", data.rnum, rn)
end
local _lbl = translate(data.lang_code, lbl)
local lbl_len = #_lbl:gsub("[\128-\191]", "") -- Count chars, not bytes in UTF-8 strings
local shift = min(0.9, abs(12 - max(12, lbl_len)) * 0.15)
local one = rn == 1
local y = data.yoffset + 3.3
fs("label", data.xoffset + 5.65 - shift, data.yoffset + 3.37, lbl)
fs("hypertext", data.xoffset + (one and 4.7 or 3.95), y, 3, 0.6, "",
fmt("<global size=16><right>%s</right>", lbl))
if rn > 1 then
if not one then
local btn_suffix = is_recipe and "recipe" or "usage"
local prev_name = fmt("prev_%s", btn_suffix)
local next_name = fmt("next_%s", btn_suffix)
local x_arrow = data.xoffset + 5.09
local y_arrow = data.yoffset + 3.2
local size = 0.3
fs("image_button", x_arrow - shift, y_arrow, 0.3, 0.3, "", prev_name, "")
fs("image_button", x_arrow + 2.3, y_arrow, 0.3, 0.3, "", next_name, "")
fs("image_button", data.xoffset + 7.05, y, size, size, "", prev_name, "")
fs("image_button", data.xoffset + 7.5, y, size, size, "", next_name, "")
end
local rcp = is_recipe and panel.rcp[data.rnum] or panel.rcp[data.unum]
@ -1617,7 +1645,7 @@ local function get_header(fs, data)
fs(fmt("tooltip[nofav;%s]", ES"Cannot mark this item. Bookmark limit reached."))
end
local desc_lim, name_lim = 32, 34
local desc_lim, name_lim = 33, 34
local desc = translate(data.lang_code, get_desc(data.query_item))
desc = ESC(desc)
local tech_name = data.query_item
@ -1635,7 +1663,7 @@ local function get_header(fs, data)
tech_name = snip(tech_name, name_lim)
end
fs("style_type[label;font=bold;font_size=22]")
fs("style_type[label;font=bold;font_size=20]")
fs("label", X, Y1, desc)
fs("style_type[label;font=mono;font_size=16]")
fs("label", X, Y2, clr("#7bf", tech_name))
@ -1873,24 +1901,28 @@ local function get_ctn_content(fs, data, player, yoffset, ctn_len, award_list, a
fs("image", 4.45, yoffset + 3.75, 1, 1, PNG.trash)
end
local yextra = 5.4
local bag_equip = data.equip == "bag"
local armor_equip = data.equip == "armor"
local skins_equip = data.equip == "skins"
local yextra = 5.5
fs(fmt("style[btn_bag;textcolor=%s]", bag_equip and "#fff" or "#aaa"),
fmt("style[btn_armor;textcolor=%s]", armor_equip and "#fff" or "#aaa"),
fmt("style[btn_skins;textcolor=%s]", skins_equip and "#fff" or "#aaa"),
"style_type[button:hovered;textcolor=#fff]")
fs("button", -0.14, yextra - 0.2, 2, 0.6, "btn_bag", ES"Bag")
fs("button", 1.87, yextra - 0.2, 2, 0.6, "btn_armor", ES"Armor")
fs("button", 3.87, yextra - 0.2, 2, 0.6, "btn_skins", ES"Skins")
for i, title in ipairs(SUBCAT) do
local btn_name = fmt("btn_%s", title)
fs("box", 0, yextra + 0.4, ctn_len, 0.045, "#bababa50")
fs("box", (bag_equip and 0) or (armor_equip and 2) or (skins_equip and 4),
yextra + 0.4, 1.7, 0.045, "#f9826c")
fs(fmt("style[btn_%s;fgimg=%s;fgimg_hovered=%s;content_offset=0]", title,
data.subcat == i and PNG[fmt("%s_hover", title)] or PNG[title],
PNG[fmt("%s_hover", title)]))
if bag_equip then
fs("image_button", 0.25 + ((i - 1) * 1.18), yextra - 0.2, 0.5, 0.5, "", btn_name, "")
fs(fmt("tooltip[%s;%s]", btn_name, title:gsub("^%l", upper)))
end
fs("box", 0, yextra + 0.45, ctn_len, 0.045, "#bababa50")
fs("box", (data.subcat - 1) * 1.18, yextra + 0.45, 1, 0.045, "#f9826c")
local function not_installed(modname)
fs("hypertext", 0, yextra + 0.9, ctn_len, 0.6, "",
fmt("<center><style color=#7bf font=mono>%s</style> not installed</center>", modname))
end
if data.subcat == 1 then
fs(fmt("list[detached:%s_backpack;main;0,%f;1,1;]", ESC(name), yextra + 0.7))
if not data.bag:get_stack("main", 1):is_empty() then
@ -1898,7 +1930,7 @@ local function get_ctn_content(fs, data, player, yoffset, ctn_len, award_list, a
ES("The inventory is extended by @1 slots", BAG_SIZES[data.bag_size] - INV_SIZE))
end
elseif armor_equip then
elseif data.subcat == 2 then
if __3darmor then
fs(fmt("list[detached:%s_armor;armor;0,%f;3,2;]", ESC(name), yextra + 0.7))
@ -1907,11 +1939,10 @@ local function get_ctn_content(fs, data, player, yoffset, ctn_len, award_list, a
fs("label", 3.65, yextra + 1.55, fmt("%s: %s", ES"Level", armor_def.level))
fs("label", 3.65, yextra + 2.05, fmt("%s: %s", ES"Heal", armor_def.heal))
else
fs("hypertext", 0, yextra + 0.9, ctn_len, 0.6, "",
"<center><style color=#7bf font=mono>3d_armor</style> not installed</center>")
not_installed("3d_armor")
end
elseif skins_equip then
elseif data.subcat == 3 then
if __skinsdb then
local _skins = skins.get_skinlist_for_player(name)
local sks = {}
@ -1924,21 +1955,46 @@ local function get_ctn_content(fs, data, player, yoffset, ctn_len, award_list, a
fs(fmt("dropdown[0,%f;4,0.6;skins;%s;%u;true]", yextra + 0.7, sks, data.skin_id or 1))
else
fs("hypertext", 0, yextra + 0.9, ctn_len, 0.6, "",
"<center><style color=#7bf font=mono>skinsdb</style> not installed</center>")
end
end
if __awards then
if bag_equip then
yextra = yextra + 2.2
elseif armor_equip then
yextra = yextra + (__3darmor and 3.4 or 1.7)
elseif skins_equip then
yextra = yextra + 1.7
not_installed("skinsdb")
end
get_award_list(data, fs, ctn_len, yextra, award_list, awards_unlocked, award_list_nb)
elseif data.subcat == 4 then
if __awards then
yextra = yextra + 0.8
get_award_list(data, fs, ctn_len, yextra, award_list, awards_unlocked, award_list_nb)
else
not_installed("awards")
end
elseif data.subcat == 5 then
local waypoints = {}
for _, v in ipairs(data.waypoints or {}) do
insert(waypoints, v.name)
end
fs(fmt("dropdown[0,%f;4.2,0.6;waypoints;%s;%u;true]",
yextra + 0.7, concat(waypoints, ","), data.waypoint_id))
local no_waypoint = not data.waypoints or #data.waypoints == 0
if not no_waypoint then
fs("image_button", 4.4, yextra + 0.75, 0.5, 0.5, "", "waypoint_delete", "")
fs(fmt("tooltip[waypoint_delete;%s]", ES"Delete waypoint"))
if core.is_creative_enabled(name) then
fs("image_button",
no_waypoint and 4.4 or 5.1, yextra + 0.77, 0.5, 0.5,
"", "waypoint_teleport", "")
fs(fmt("tooltip[waypoint_teleport;%s]", ES"Teleport to waypoint"))
end
end
fs(fmt("box[0,%f;4.2,0.6;#bababa25]", yextra + 1.5))
fs(fmt("field[0.1,%f;4.1,0.6;waypoint_name;;]", yextra + 1.5))
fs("image_button", 4.4, yextra + 1.55, 0.5, 0.5, "", "waypoint_add", "")
fs(fmt("tooltip[waypoint_add;%s]", ES"Add waypoint"))
end
end
@ -1977,8 +2033,7 @@ local function get_tabs_fs(player, data, fs, full_height)
local Y = btm and full_height or -tab_hgh
fs("style_type[image_button:hovered;textcolor=#fff]")
fs("image_button", X, Y, tab_len, tab_hgh, "", fmt("tab_%s", def.name),
ESC(def.description))
fs("image_button", X, Y, tab_len, tab_hgh, "", fmt("tab_%s", def.name), ESC(def.description))
if def.image and def.image ~= "" then
local desc = translate(data.lang_code, def.description)
@ -2154,17 +2209,17 @@ local function init_data(player, info)
favs = {},
export_counts = {},
current_tab = 1,
equip = "bag",
subcat = 1,
waypoint_id = 1,
lang_code = get_lang_code(info),
}
local data = pdata[name]
local meta = player:get_meta()
data.bag_size = dslz(meta:get_string "bag_size")
if __skinsdb then
data.skin_id = tonum(dslz(meta:get_string "skin_id") or 1)
for i = 1, #META_SAVES do
local recover = META_SAVES[i]
data[recover] = dslz(meta:get_string(recover))
end
after(0, set_fs, player)
@ -2296,18 +2351,16 @@ local function get_inventory_fs(player, data, fs)
local award_list, award_list_nb
local awards_unlocked = 0
local max_val = 15
local max_val = 13
if __3darmor and data.equip == "armor" then
if data.scrbar_inv == max_val then
data.scrbar_inv = data.scrbar_inv + 9
if __3darmor and data.subcat == 2 then
if (data.scrbar_inv or 0) >= max_val then
data.scrbar_inv = data.scrbar_inv + 10
end
max_val = max_val + 9
end
max_val = max_val + 10
if __awards then
elseif __awards and data.subcat == 4 then
award_list = awards.get_award_states(name)
award_list_nb = #award_list
@ -2319,7 +2372,10 @@ local function get_inventory_fs(player, data, fs)
end
end
max_val = max_val + (award_list_nb * 13.17)
max_val = max_val + (award_list_nb * 13)
elseif data.subcat == 5 then
max_val = max_val + 3
end
fs(fmt([[
@ -2418,16 +2474,21 @@ i3.new_tab {
skins.set_player_skin(player, _skins[data.skin_id])
end
if fields.waypoints then
data.waypoint_id = tonumber(fields.waypoints)
end
for field in pairs(fields) do
if sub(field, 1, 4) == "btn_" then
data.subcat = indexof(SUBCAT, sub(field, 5))
break
end
end
if fields.trash then
local inv = player:get_inventory()
if not inv:is_empty("main") then
inv:set_list("main", {})
end
if not inv:is_empty("craft") then
inv:set_list("craft", {})
end
inv:set_list("main", {})
inv:set_list("craft", {})
elseif fields.compress then
compress_items(player)
@ -2439,13 +2500,43 @@ i3.new_tab {
data.scrbar_inv = tonum(match(sb_inv, "%d+"))
return
elseif fields.btn_bag or fields.btn_armor or fields.btn_skins then
for k in pairs(fields) do
if sub(k, 1, 4) == "btn_" then
data.equip = sub(k, 5)
break
end
elseif fields.waypoint_add then
data.waypoints = data.waypoints or {}
local waypoint = fields.waypoint_name
local last = #data.waypoints + 1
data.waypoint_id = last
if fields.waypoint_name == "" then
waypoint = fmt("Waypoint %u", last)
end
local color = random(0xffffff)
local pos = player:get_pos()
local id = player:hud_add {
hud_elem_type = "waypoint",
name = waypoint,
text = " m",
world_pos = pos,
number = color,
z_index = -300,
}
insert(data.waypoints, {name = waypoint, pos = pos, color = color, id = id})
elseif fields.waypoint_delete then
local waypoint = data.waypoints[data.waypoint_id]
player:hud_remove(waypoint.id)
remove(data.waypoints, data.waypoint_id)
data.waypoint_id = data.waypoint_id + (data.waypoint_id == 1 and 0 or -1)
elseif fields.waypoint_teleport then
local waypoint = data.waypoints[data.waypoint_id]
local pos = waypoint.pos
pos.y = pos.y + 0.5
player:set_pos(pos)
msg(name, fmt("Teleported to %s", clr("#ff0", waypoint.name)))
end
return set_fs(player)
@ -2790,6 +2881,24 @@ local function init_backpack(player)
end
end
local function init_waypoints(player)
local name = player:get_player_name()
local data = pdata[name]
for _, v in ipairs(data.waypoints or {}) do
local id = player:hud_add {
hud_elem_type = "waypoint",
name = v.name,
text = " m",
world_pos = v.pos,
number = v.color,
z_index = -300,
}
v.id = id
end
end
on_joinplayer(function(player)
local name = player:get_player_name()
local info = get_player_info(name)
@ -2812,6 +2921,7 @@ on_joinplayer(function(player)
init_data(player, info)
init_backpack(player)
init_waypoints(player)
after(0, function()
player:hud_set_hotbar_itemcount(HOTBAR_COUNT)
@ -2972,7 +3082,7 @@ if progressive_mode then
local function init_hud(player, data)
data.hud = {
bg = player:hud_add{
bg = player:hud_add {
hud_elem_type = "image",
position = {x = 0.78, y = 1},
alignment = {x = 1, y = 1},
@ -2981,7 +3091,7 @@ if progressive_mode then
z_index = 0xDEAD,
},
book = player:hud_add{
book = player:hud_add {
hud_elem_type = "image",
position = {x = 0.79, y = 1.02},
alignment = {x = 1, y = 1},
@ -2990,7 +3100,7 @@ if progressive_mode then
z_index = 0xDEAD,
},
text = player:hud_add{
text = player:hud_add {
hud_elem_type = "text",
position = {x = 0.84, y = 1.04},
alignment = {x = 1, y = 1},

3251
mods/gui/i3/init.lua.orig Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,15 @@
minetest.register_craft({
output = minetest.itemstring_with_palette("default:wood", 3),
type = "shapeless",
recipe = {
"default:wood",
"dye:red",
},
})
i3.register_craft({
result = "default:ladder_wood",
items = {"default:copper_ingot 7, default:tin_ingot", "default:steel_ingot 2"},
items = {"default:copper_ingot 7, default:tin_ingot, default:steel_ingot 2"},
})
i3.register_craft({

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 705 B

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 950 B

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -8,12 +8,12 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20210323",
version = "20210407",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
-- localize math functions
-- localize common functions
local pi = math.pi
local square = math.sqrt
local sin = math.sin
@ -112,7 +112,8 @@ local mob_class = {
light_damage_min = 14,
light_damage_max = 15,
water_damage = 0,
lava_damage = 0,
lava_damage = 4,
fire_damage = 4,
air_damage = 0,
suffocation = 2,
fall_damage = 1,
@ -164,6 +165,7 @@ local mob_class = {
local mob_class_meta = {__index = mob_class}
-- play sound
function mob_class:mob_sound(sound)
@ -982,7 +984,12 @@ local is_node_dangerous = function(self, nodename)
end
if self.lava_damage > 0
and minetest.get_item_group(nodename, "igniter") ~= 0 then
and minetest.get_item_group(nodename, "lava") ~= 0 then
return true
end
if self.fire_damage > 0
and minetest.get_item_group(nodename, "fire") ~= 0 then
return true
end
@ -1068,37 +1075,47 @@ function mob_class:do_env_damage()
local nodef = minetest.registered_nodes[self.standing_in]
-- water
if self.water_damage and nodef.groups.water then
if self.water_damage ~= 0
and nodef.groups.water then
if self.water_damage ~= 0 then
self.health = self.health - self.water_damage
self.health = self.health - self.water_damage
effect(pos, 5, "bubble.png", nil, nil, 1, nil)
effect(pos, 5, "bubble.png", nil, nil, 1, nil)
if self:check_for_death({type = "environment",
pos = pos, node = self.standing_in}) then
return true
end
if self:check_for_death({type = "environment",
pos = pos, node = self.standing_in}) then
return true
end
-- ignition source (fire or lava)
elseif self.lava_damage and nodef.groups.igniter then
-- lava damage
elseif self.lava_damage ~= 0
and nodef.groups.lava then
if self.lava_damage ~= 0 then
self.health = self.health - self.lava_damage
self.health = self.health - self.lava_damage
effect(pos, 15, "fire_basic_flame.png", 1, 5, 1, 0.2, 15, true)
effect(pos, 15, "fire_basic_flame.png", 1, 5, 1, 0.2, 15, true)
if self:check_for_death({type = "environment", pos = pos,
node = self.standing_in, hot = true}) then
return true
end
if self:check_for_death({type = "environment", pos = pos,
node = self.standing_in, hot = true}) then
return true
end
-- damage_per_second node check
elseif nodef.damage_per_second ~= 0 then
-- fire damage
elseif self.fire_damage ~= 0
and nodef.groups.fire then
self.health = self.health - self.fire_damage
effect(pos, 15, "fire_basic_flame.png", 1, 5, 1, 0.2, 15, true)
if self:check_for_death({type = "environment", pos = pos,
node = self.standing_in, hot = true}) then
return true
end
-- damage_per_second node check (not fire and lava)
elseif nodef.damage_per_second ~= 0
and nodef.groups.lava == 0 and nodef.groups.fire == 0 then
self.health = self.health - nodef.damage_per_second
@ -2772,15 +2789,37 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
return true
end
-- is mob protected?
if self.protected and hitter:is_player()
and minetest.is_protected(self.object:get_pos(),
hitter:get_player_name()) then
-- is mob protected
if self.protected then
minetest.chat_send_player(hitter:get_player_name(),
S("Mob has been protected!"))
-- did player hit mob and if so is it in protected area
if hitter:is_player() then
return true
local player_name = hitter:get_player_name()
if player_name ~= self.owner
and minetest.is_protected(self.object:get_pos(), player_name) then
minetest.chat_send_player(hitter:get_player_name(),
S("Mob has been protected!"))
return true
end
-- if protection is on level 2 then dont let arrows harm mobs
elseif self.protected == 2 then
local ent = hitter and hitter:get_luaentity()
if ent and ent._is_arrow then
return true -- arrow entity
elseif not ent then
return true -- non entity
end
end
end
local weapon = hitter:get_wielded_item()
@ -2812,7 +2851,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
end
damage = damage + (tool_capabilities.damage_groups[group] or 0)
* tmp * ((armor[group] or 0) / 100.0)
* tmp * ((armor[group] or 0) / 100.0)
end
end
@ -3149,8 +3188,7 @@ function mob_class:mob_activate(staticdata, def, dtime)
def.textures = {def.textures}
end
self.base_texture = def.textures and
def.textures[random(#def.textures)]
self.base_texture = def.textures and def.textures[random(#def.textures)]
self.base_mesh = def.mesh
self.base_size = self.visual_size
self.base_colbox = self.collisionbox
@ -3557,6 +3595,7 @@ minetest.register_entity(name, setmetatable({
light_damage_max = def.light_damage_max,
water_damage = def.water_damage,
lava_damage = def.lava_damage,
fire_damage = def.fire_damage,
air_damage = def.air_damage,
suffocation = def.suffocation,
fall_damage = def.fall_damage,
@ -4460,8 +4499,9 @@ function mobs:capture_mob(self, clicker, chance_hand, chance_net,
return false
end
-- cannot pick up if not owner
if self.owner ~= name and force_take == false then
-- cannot pick up if not owner (unless player has protection_bypass priv)
if not minetest.check_player_privs(name, "protection_bypass")
and self.owner ~= name and force_take == false then
minetest.chat_send_player(name, S("@1 is owner!", self.owner))
@ -4562,19 +4602,21 @@ function mobs:protect(self, clicker)
local name = clicker:get_player_name()
local tool = clicker:get_wielded_item()
local tool_name = tool:get_name()
if tool:get_name() ~= "mobs:protector" then
if tool_name ~= "mobs:protector"
and tool_name ~= "mobs:protector2" then
return false
end
if self.tamed == false then
if not self.tamed then
minetest.chat_send_player(name, S("Not tamed!"))
return true -- false
return true
end
if self.protected == true then
if self.protected then
minetest.chat_send_player(name, S("Already protected!"))
return true -- false
return true
end
if not mobs.is_creative(clicker:get_player_name()) then
@ -4582,9 +4624,15 @@ function mobs:protect(self, clicker)
clicker:set_wielded_item(tool)
end
self.protected = true
-- set protection level
if tool_name == "mobs:protector" then
self.protected = true
else
self.protected = 2 ; self.fire_damage = 0
end
local pos = self.object:get_pos()
pos.y = pos.y + self.collisionbox[2] + 0.5
effect(self.object:get_pos(), 25, "mobs_protect_particle.png",
@ -4682,12 +4730,12 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
end
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
-- if mob has been tamed you can name it with a nametag
if item:get_name() == "mobs:nametag"
and clicker:get_player_name() == self.owner then
local name = clicker:get_player_name()
and (name == self.owner
or minetest.check_player_privs(name, "protection_bypass")) then
-- store mob and nametag stack in external variables
mob_obj[name] = self

View File

@ -66,7 +66,10 @@ functions needed for the mob to work properly which contains the following:
water.
'air_damage' holds damage per second inflicted to mob when standing in air.
'lava_damage' holds the damage per second inflicted to mobs when standing
in lava or fire or an ignition source.
in lava.
'fire_damage' holds the damage per second inflicted to mobs when standing
in fire.
'light_damage' holds the damage per second inflicted to mobs when light
level is between the min and max values below
'light_damage_min' minimum light value when mob is affected (default: 14)

View File

@ -115,6 +115,22 @@ minetest.register_craft({
}
})
-- level 2 protection rune
minetest.register_craftitem("mobs:protector2", {
description = S("Mob Protection Rune (Level 2)"),
inventory_image = "mobs_protector2.png",
groups = {flammable = 2}
})
minetest.register_craft({
output = "mobs:protector2",
recipe = {
{"mobs:protector", "default:mese_crystal", "mobs:protector"},
{"default:mese_crystal", "default:diamondblock", "default:mese_crystal"},
{"mobs:protector", "default:mese_crystal", "mobs:protector"}
}
})
-- saddle
minetest.register_craftitem("mobs:saddle", {
description = S("Saddle"),

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

View File

@ -37,6 +37,7 @@ mobs:register_mob("mobs_monster:lava_flan", {
},
water_damage = 8,
lava_damage = 0,
fire_damage = 0,
light_damage = 0,
immune_to = {
{"mobs:pick_lava", -2}, -- lava pick heals 2 health
@ -240,6 +241,7 @@ mobs:register_mob("mobs_monster:obsidian_flan", {
},
water_damage = 0,
lava_damage = 8,
fire_damage = 0,
light_damage = 0,
animation = {
speed_normal = 15,

View File

@ -39,6 +39,7 @@ mobs:register_mob("mobs_monster:sand_monster", {
attack_type = "dogfight",
pathfinding = true,
--specific_attack = {"player", "mobs_npc:npc"},
--ignore_invisibility = true,
reach = 2,
damage = 1,
hp_min = 4,

File diff suppressed because it is too large Load Diff

View File

@ -218,3 +218,31 @@ Mod: LessDirt/default
origin https://github.com/Treer/LessDirt.git (fetch)
* master 59d4434 [origin/master] Update forum link in README.md
Mod: LessDirt/default
origin https://github.com/Treer/LessDirt.git (fetch)
* master 59d4434 [origin/master] Update forum link in README.md
Mod: LessDirt/default
origin https://github.com/Treer/LessDirt.git (fetch)
* master 59d4434 [origin/master] Update forum link in README.md
Mod: LessDirt/default
origin https://github.com/Treer/LessDirt.git (fetch)
* master 59d4434 [origin/master] Update forum link in README.md
Mod: LessDirt/default
origin https://github.com/Treer/LessDirt.git (fetch)
* master 59d4434 [origin/master] Update forum link in README.md
Mod: LessDirt/default
origin https://github.com/Treer/LessDirt.git (fetch)
* master 59d4434 [origin/master] Update forum link in README.md
Mod: LessDirt/default
origin https://github.com/Treer/LessDirt.git (fetch)
* master 59d4434 [origin/master] Update forum link in README.md
Mod: LessDirt/default
origin https://github.com/Treer/LessDirt.git (fetch)
* master 59d4434 [origin/master] Update forum link in README.md
Mod: LessDirt/default