Mods update

master
daret 2020-11-16 11:49:14 +01:00
parent 1eddf23c79
commit 0fc7f521e3
11 changed files with 172 additions and 67 deletions

View File

@ -76,7 +76,7 @@ origin https://notabug.org/tenplus1/farming (fetch)
Mod: flora/farming
origin https://github.com/minetest-mods/craftguide.git (fetch)
* master 71af070 [origin/master] More cleaning
* master d7619cd [origin/master] Fix header desc
Mod: gui/craftguide
origin https://repo.or.cz/minetest_hbarmor.git (fetch)
@ -112,7 +112,7 @@ origin https://github.com/TheTermos/mobkit (fetch)
Mod: lib_api/mobkit
origin https://notabug.org/tenplus1/mobs_redo (fetch)
* master d12576f [origin/master] mobs:can_spawn function added to check free space to spawn mob
* master bdea826 [origin/master] add additional death checks
Mod: lib_api/mobs_redo
origin https://github.com/appgurueu/modlib (fetch)
@ -151,7 +151,7 @@ origin https://github.com/runsy/petz (fetch)
Mod: mobs/petz
origin https://github.com/berengma/water_life (fetch)
* master 9a88286 [origin/master] Merge pull request #44 from berengma/mono
* master e2af064 [origin/master] Merge pull request #45 from berengma/dev
Mod: mobs/water_life
origin https://github.com/minetest-mods/3d_armor (fetch)

View File

@ -106,6 +106,7 @@ local fs_elements = {
tooltip = "tooltip[%f,%f;%f,%f;%s]",
hypertext = "hypertext[%f,%f;%f,%f;;%s]",
item_image = "item_image[%f,%f;%f,%f;%s]",
model = "model[%f,%f;%f,%f;%s;%s;%s;0,0;true]",
image_button = "image_button[%f,%f;%f,%f;%s;%s;%s]",
animated_image = "animated_image[%f,%f;%f,%f;;%s;%u;%u]",
item_image_button = "item_image_button[%f,%f;%f,%f;%s;%s;%s]",
@ -827,7 +828,7 @@ local function nice_strip(str, limit)
return #str > limit and sprintf("%s...", sub(str, 1, limit - 3)) or str
end
local function get_desc(item)
local function get_desc(item, lang_code)
if sub(item, 1, 1) == "_" then
item = sub(item, 2)
end
@ -836,6 +837,8 @@ local function get_desc(item)
if def then
local desc = def.description
desc = lang_code and translate(lang_code, desc) or desc
if true_str(desc) then
desc = desc:trim():match("[^\n]*")
@ -1171,17 +1174,48 @@ local function get_rcp_lbl(fs, data, panel, spacing, rn, is_recipe)
get_grid_fs(fs, rcp, spacing)
end
local function get_title_fs(query_item, favs, fs, spacing)
local function get_title_fs(query_item, favs, lang_code, fs, spacing)
fs[#fs + 1] = "style_type[label;font=bold;font_size=+6]"
fs[#fs + 1] = fmt("label", 1, 8.75,
spacing - 0.1, nice_strip(ESC(get_desc(query_item)), 45))
spacing - 0.1, nice_strip(ESC(get_desc(query_item, lang_code)), 45))
fs[#fs + 1] = "style_type[label;font=mono;font_size=+0]"
fs[#fs + 1] = fmt("label", 1, 8.75,
spacing + 0.3, clr("#7bf", nice_strip(query_item, 35)))
fs[#fs + 1] = "style_type[label;font=normal]"
fs[#fs + 1] = fmt("hypertext", 1, 13.8, spacing - 0.15, 1.1, 1.3,
sprintf("<item name=%s width=64 rotate=yes>", query_item))
local def = reg_items[query_item]
if def.drawtype == "mesh" then
local tiles = def.tiles or def.textures
local t = {}
for _, v in ipairs(tiles) do
local _name
if v.color then
local hex = sprintf("%02x", v.color)
while #hex < 8 do
hex = "0" .. hex
end
_name = sprintf("%s^[multiply:%s", v.name,
sprintf("#%s%s", sub(hex, 3), sub(hex, 1, 2)))
end
t[#t + 1] = _name or v.name or v
end
while #t < 6 do
t[#t + 1] = t[#t]
end
fs[#fs + 1] = fmt("model", 1,
13.5, spacing - 0.2, 1.2, 1.2, "", def.mesh, concat(t, ","))
else
fs[#fs + 1] = fmt("hypertext", 1, 13.8, spacing - 0.15, 1.1, 1.3,
sprintf("<item name=%s width=64 rotate=yes>", query_item))
end
local fav = is_fav(favs, query_item)
local nfavs = #favs
@ -1249,7 +1283,7 @@ local function get_panels(data, fs)
fs[#fs + 1] = fmt("button", 1, 8, YOFFSET + spacing + 0.1, 6.8, 1, "", lbl)
elseif panel.name == "title" then
get_title_fs(data.query_item, data.favs, fs, spacing)
get_title_fs(data.query_item, data.favs, data.lang_code, fs, spacing)
elseif panel.name == "favs" then
fs[#fs + 1] = fmt("label", 1, 8.3, spacing - 0.15, ES"Bookmarks")

View File

@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20201029",
version = "20201115",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
@ -877,7 +877,7 @@ function mob_class:check_for_death(cmi_cause)
local pos = self.object:get_pos()
-- execute custom death function
if self.on_die then
if pos and self.on_die then
self:on_die(pos)
@ -897,7 +897,7 @@ function mob_class:check_for_death(cmi_cause)
local frames = self.animation.die_end - self.animation.die_start
local speed = self.animation.die_speed or 15
local length = max(frames / speed, 0)
local length = max((frames / speed), 0)
self.attack = nil
self.v_start = false
@ -910,23 +910,28 @@ function mob_class:check_for_death(cmi_cause)
minetest.after(length, function(self)
if use_cmi and self.object:get_luaentity() then
cmi.notify_die(self.object, cmi_cause)
if self.object:get_luaentity() then
if use_cmi then
cmi.notify_die(self.object, cmi_cause)
end
remove_mob(self, true)
end
remove_mob(self, true)
end, self)
else
return true
elseif pos then -- otherwise remove mod and show particle effect
if use_cmi then
cmi.notify_die(self.object, cmi_cause)
end
remove_mob(self, true)
end
effect(pos, 20, "tnt_smoke.png")
effect(pos, 20, "tnt_smoke.png")
end
return true
end

View File

@ -21,7 +21,7 @@ minetest.register_on_player_hpchange(function(player, hp_change, reason)
if reason then
--minetest.chat_send_all(dump(repel).." : "..dump(water_life.repeltime))
--minetest.chat_send_all(dump(repel).."/"..dump(math.floor(os.clock()) - repel).." : "..dump(water_life.repeltime))
if reason.type == "node_damage" and reason.node == "water_life:moskito" and repel == 0 then
minetest.sound_play("water_life_moskito", {
@ -32,7 +32,6 @@ minetest.register_on_player_hpchange(function(player, hp_change, reason)
elseif reason.type == "node_damage" and reason.node == "water_life:moskito" and repel ~= 0 then
--minetest.chat_send_player(name,"repellant working for another "..dump(math.floor(os.clock())-meta:get_int("repellant")).." seconds")
meta:set_int("repellant",0)
return 0
else
return hp_change
@ -41,10 +40,7 @@ minetest.register_on_player_hpchange(function(player, hp_change, reason)
end
end, true)
minetest.register_on_leaveplayer(function(player)
local meta=player:get_meta()
meta:set_int("repellant",0)
end)
minetest.register_node("water_life:moskito", {
description = ("Moskito"),

View File

@ -17,33 +17,6 @@ local cos = math.cos
local atan=math.atan
water_life.hud_poison = {
hud_elem_type = "image",
position = {x=0.5, y=0.8},
-- Left corner position of element
name = "water_life_poison.png",
scale = {x = 0.1, y = 0.1},
text = "water_life_poison.png",
}
water_life.hud_repellant = {
hud_elem_type = "image",
position = {x=0.55, y=0.8},
-- Left corner position of element
name = "water_life_repellanthud.png",
scale = {x = 0.1, y = 0.1},
text = "water_life_repellanthud.png",
}
local neighbors ={
{x=1,z=0},

View File

@ -15,7 +15,7 @@ local deg=math.deg
local tan = math.tan
local cos = math.cos
local atan=math.atan
water_life.poison = {}
@ -274,7 +274,7 @@ function water_life.lq_jumpattack(self,height,target,extra)
local meta = target:get_meta()
local name = target:get_player_name()
meta:set_int("snakepoison",1)
water_life.poison[name] = target:hud_add(water_life.hud_poison)
water_life.change_hud(target,"poison")
end
end
-- bounce off

View File

@ -92,6 +92,25 @@ minetest.register_craft({
})
-- moskito repellant
if water_life.farming and farming.mod == "redo" then
minetest.register_craft({
output = "water_life:repellant",
recipe = {
{"", "farming:mint_leaf", "farming:bottle_ethanol"},
{"farming:garlic", "farming:chili_pepper", "farming:onion"},
{"", "farming:mortar_pestle", ""}},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
})
else
minetest.register_craft({
output = "water_life:repellant",
recipe = {
{"", "farming:cotton", ""},
{"flowers:tulip_black", "flowers:mushroom_red", "flowers:geranium"},
{"", "vessels:glass_bottle", ""}}
})
end
if not water_life.apionly then
@ -324,16 +343,14 @@ if not water_life.apionly then
if meta:get_int("snakepoison") > 0 then meta:set_int("snakepoison",0) end
user:set_hp(score+10)
itemstack:take_item()
if water_life.poison[name] then
user:hud_remove(water_life.poison[name])
end
water_life.change_hud(user,"poison",0)
return itemstack
end,
groups = {vessel = 1},
})
--[[
minetest.register_craftitem("water_life:repellant", {
description = ("No moskitos for half a day"),
inventory_image = "water_life_repell.png",
@ -348,14 +365,12 @@ if not water_life.apionly then
meta:set_int("repellant",math.floor(os.clock()))
itemstack:take_item()
if not water_life.repellant[name] then
water_life.repellant[name] = user:hud_add(water_life.hud_repellant)
end
water_life.change_hud(user,"repellant")
return itemstack
end,
groups = {vessel = 1},
})]]
})
minetest.register_craft({
type = "shapeless",

View File

@ -0,0 +1,81 @@
water_life.playerhud = {}
water_life.playerhud.poison = {}
water_life.playerhud.repellant = {}
water_life.hud_poison = {
hud_elem_type = "image",
position = {x=0.5, y=0.8},
-- Left corner position of element
name = "water_life_poison",
scale = {x = 0.1, y = 0.1},
text = "water_life_emptyhud.png",
}
water_life.hud_repellant = {
hud_elem_type = "image",
position = {x=0.55, y=0.8},
-- Left corner position of element
name = "water_life_repellant",
scale = {x = 0.1, y = 0.1},
text = "water_life_emptyhud.png",
}
function water_life.change_hud(player,selection,switch)
local value = ""
if not player then return end
if not selection then selection = "poison" end
if not switch then switch = 1 end
local name = player:get_player_name()
if selection == "poison" then
if switch == 1 then value = "water_life_poison.png" else value = "water_life_emptyhud.png" end
player:hud_change(water_life.playerhud.poison[name], "text", value)
end
if selection == "repellant" then
if switch == 1 then value = "water_life_repellanthud.png" else value = "water_life_emptyhud.png" end
player:hud_change(water_life.playerhud.repellant[name], "text", value)
end
end
minetest.register_on_joinplayer(function(player)
if not player then return end
local meta=player:get_meta()
meta:set_int("repellant",0)
local name = player:get_player_name()
water_life.playerhud.poison[name] = player:hud_add(water_life.hud_poison)
water_life.playerhud.repellant[name] = player:hud_add(water_life.hud_repellant)
if meta:get_int("snakepoison") > 0 then
minetest.after(5, function(player)
water_life.change_hud(player,"poison")
end, player)
end
end)

View File

@ -1,16 +1,17 @@
-----------------------------------------------------------
--
-- Water_life copyright 2020 by Gundul
-- see software and media licenses in the licenses folder
-- see software and media licenses in the doc folder
--
-----------------------------------------------------------
water_life = {}
water_life.version = "081120"
water_life.version = "151120"
water_life.shark_food = {}
water_life.repellant = {}
water_life.petz = minetest.get_modpath("petz")
water_life.mobsredo = minetest.get_modpath("mobs")
water_life.farming = minetest.get_modpath("farming")
water_life.abr = tonumber(minetest.settings:get('active_block_range')) or 2
water_life.abo = tonumber(minetest.settings:get('active_object_send_range_blocks')) or 3
@ -43,6 +44,7 @@ dofile(path.."/chatcommands.lua") -- load chatcommands
dofile(path.."/behaviors.lua") -- load behaviors
if not water_life.apionly then
dofile(path.."/hud.lua") -- load player hud
dofile(path.."/spawn.lua") -- load spawn function
dofile(path.."/animals/whale.lua") -- load whales
dofile(path.."/animals/riverfish.lua") -- load riverfish

View File

@ -35,14 +35,13 @@ local function spawnstep(dtime)
if meta:get_int("snakepoison") > 0 then
if not water_life.poison[plyr:get_player_name()] then water_life.poison[plyr:get_player_name()] = plyr:hud_add(water_life.hud_poison) end
local score = plyr:get_hp()
plyr:set_hp(score-1)
end
if meta:get_int("repellant") > 0 then
if math.floor(os.clock()) - meta:get_int("repellant") > water_life.repeltime then
--plyr:hud_remove(water_life.repellant[name])
water_life.change_hud(plyr,"repellant",0)
meta:set_int("repellant",0)
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB