mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-04 16:53:46 +01:00
Merge branch 'master' of https://git.minetest.land/Wuzzy/MineClone2
commit
50fa36aa2c
@ -197,6 +197,9 @@ minetest.register_node("mcl_chests:"..basename, {
|
||||
minetest.swap_node(pos, { name = "mcl_chests:"..canonical_basename, param2 = param2 })
|
||||
end
|
||||
end,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
minetest.get_meta(pos):set_string("name", itemstack:get_meta():get_string("name"))
|
||||
end,
|
||||
after_dig_node = drop_items_chest,
|
||||
on_blast = on_chest_blast,
|
||||
allow_metadata_inventory_move = protection_check_move,
|
||||
@ -224,10 +227,15 @@ minetest.register_node("mcl_chests:"..basename, {
|
||||
_mcl_hardness = 2.5,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
local name = minetest.get_meta(pos):get_string("name")
|
||||
if name == "" then
|
||||
name = S("Chest")
|
||||
end
|
||||
|
||||
minetest.show_formspec(clicker:get_player_name(),
|
||||
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
|
||||
"size[9,8.75]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Chest"))).."]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]"..
|
||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
@ -270,6 +278,9 @@ minetest.register_node("mcl_chests:"..basename.."_left", {
|
||||
minetest.swap_node(pos, n)
|
||||
end
|
||||
end,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
minetest.get_meta(pos):set_string("name", itemstack:get_meta():get_string("name"))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
local n = minetest.get_node(pos)
|
||||
if n.name == "mcl_chests:"..basename then
|
||||
@ -345,11 +356,18 @@ minetest.register_node("mcl_chests:"..basename.."_left", {
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
|
||||
local name = minetest.get_meta(pos):get_string("name")
|
||||
if name == "" then
|
||||
name = minetest.get_meta(pos_other):get_string("name")
|
||||
end
|
||||
if name == "" then
|
||||
name = S("Large Chest")
|
||||
end
|
||||
|
||||
minetest.show_formspec(clicker:get_player_name(),
|
||||
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
|
||||
"size[9,11.5]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Large Chest"))).."]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]"..
|
||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
||||
"list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,3.5;9,3;]"..
|
||||
@ -393,6 +411,9 @@ minetest.register_node("mcl_chests:"..basename.."_right", {
|
||||
minetest.swap_node(pos, n)
|
||||
end
|
||||
end,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
minetest.get_meta(pos):set_string("name", itemstack:get_meta():get_string("name"))
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
local n = minetest.get_node(pos)
|
||||
if n.name == "mcl_chests:"..basename then
|
||||
@ -469,12 +490,19 @@ minetest.register_node("mcl_chests:"..basename.."_right", {
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
||||
local name = minetest.get_meta(pos_other):get_string("name")
|
||||
if name == "" then
|
||||
name = minetest.get_meta(pos):get_string("name")
|
||||
end
|
||||
if name == "" then
|
||||
name = S("Large Chest")
|
||||
end
|
||||
|
||||
minetest.show_formspec(clicker:get_player_name(),
|
||||
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
|
||||
|
||||
"size[9,11.5]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Large Chest"))).."]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]"..
|
||||
"list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,0.5;9,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,3.5;9,3;]"..
|
||||
@ -769,8 +797,12 @@ local shulker_mob_textures = {
|
||||
}
|
||||
local canonical_shulker_color = "violet"
|
||||
|
||||
local formspec_shulker_box = "size[9,8.75]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Shulker Box"))).."]"..
|
||||
local function formspec_shulker_box(name)
|
||||
if name == "" then
|
||||
name = S("Shulker Box")
|
||||
end
|
||||
return "size[9,8.75]"..
|
||||
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]"..
|
||||
"list[current_name;main;0,0.5;9,3;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
|
||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
@ -780,6 +812,14 @@ local formspec_shulker_box = "size[9,8.75]"..
|
||||
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
|
||||
"listring[current_name;main]"..
|
||||
"listring[current_player;main]"
|
||||
end
|
||||
|
||||
local function set_shulkerbox_meta(nmeta, imeta)
|
||||
local name = imeta:get_string("name")
|
||||
nmeta:set_string("description", imeta:get_string("description"))
|
||||
nmeta:set_string("name", name)
|
||||
nmeta:set_string("formspec", formspec_shulker_box(name))
|
||||
end
|
||||
|
||||
for color, desc in pairs(boxtypes) do
|
||||
local mob_texture = shulker_mob_textures[color]
|
||||
@ -822,7 +862,7 @@ for color, desc in pairs(boxtypes) do
|
||||
-- on_place = minetest.rotate_node,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", formspec_shulker_box)
|
||||
meta:set_string("formspec", formspec_shulker_box(nil))
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 9*3)
|
||||
end,
|
||||
@ -835,12 +875,7 @@ for color, desc in pairs(boxtypes) do
|
||||
local iinv_main = minetest.deserialize(imetadata)
|
||||
ninv:set_list("main", iinv_main)
|
||||
ninv:set_size("main", 9*3)
|
||||
|
||||
local imeta = stack:get_meta()
|
||||
local nmeta = minetest.get_meta(droppos)
|
||||
nmeta:set_string("description", imeta:get_string("description"))
|
||||
nmeta:set_string("name", imeta:get_string("name"))
|
||||
|
||||
set_shulkerbox_meta(minetest.get_meta(droppos), stack:get_meta())
|
||||
stack:take_item()
|
||||
end
|
||||
return stack
|
||||
@ -852,10 +887,7 @@ for color, desc in pairs(boxtypes) do
|
||||
local ninv = nmeta:get_inventory()
|
||||
ninv:set_list("main", iinv_main)
|
||||
ninv:set_size("main", 9*3)
|
||||
|
||||
local imeta = itemstack:get_meta()
|
||||
nmeta:set_string("description", imeta:get_string("description"))
|
||||
nmeta:set_string("name", imeta:get_string("name"))
|
||||
set_shulkerbox_meta(nmeta, itemstack:get_meta())
|
||||
|
||||
if minetest.is_creative_enabled(placer:get_player_name()) then
|
||||
if not ninv:is_empty("main") then
|
||||
|
@ -111,7 +111,7 @@ mcl_end.check_detach_chorus_plant = function(pos, oldnode, oldmetadata, digger)
|
||||
end
|
||||
|
||||
mcl_end.check_blast_chorus_plant = function(pos)
|
||||
minetest.remove(pos)
|
||||
minetest.remove_node(pos)
|
||||
mcl_end.detach_chorus_plant(pos)
|
||||
end
|
||||
|
||||
|
@ -10,6 +10,22 @@ local is_cat = {}
|
||||
local is_fire_proof = {}
|
||||
|
||||
|
||||
local function potions_set_hudbar(player)
|
||||
|
||||
if is_poisoned[player] and is_regenerating[player] then
|
||||
hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_regen_poison.png", nil, "hudbars_bar_health.png")
|
||||
elseif is_poisoned[player] then
|
||||
hb.change_hudbar(player, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hudbars_bar_health.png")
|
||||
elseif is_regenerating[player] then
|
||||
hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_regenerate.png", nil, "hudbars_bar_health.png")
|
||||
else
|
||||
hb.change_hudbar(player, "health", nil, nil, "hudbars_icon_health.png", nil, "hudbars_bar_health.png")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
local is_player, entity
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
@ -55,6 +71,9 @@ minetest.register_globalstep(function(dtime)
|
||||
|
||||
if is_poisoned[player].timer >= is_poisoned[player].dur then
|
||||
is_poisoned[player] = nil
|
||||
if is_player then
|
||||
potions_set_hudbar(player)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@ -86,6 +105,9 @@ minetest.register_globalstep(function(dtime)
|
||||
|
||||
if is_regenerating[player].timer >= is_regenerating[player].dur then
|
||||
is_regenerating[player] = nil
|
||||
if is_player then
|
||||
potions_set_hudbar(player)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@ -281,11 +303,23 @@ function mcl_potions._reset_player_effects(player)
|
||||
end
|
||||
|
||||
if is_poisoned[player] then
|
||||
|
||||
is_poisoned[player] = nil
|
||||
|
||||
if player:is_player() then
|
||||
potions_set_hudbar(player)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if is_regenerating[player] then
|
||||
|
||||
is_regenerating[player] = nil
|
||||
|
||||
if player:is_player() then
|
||||
potions_set_hudbar(player)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if is_strong[player] then
|
||||
@ -383,19 +417,8 @@ function mcl_potions.make_invisible(player, toggle)
|
||||
|
||||
end
|
||||
|
||||
function mcl_potions.poison(player, toggle)
|
||||
|
||||
if not player then return false end
|
||||
is_poisoned[player:get_player_name()] = toggle
|
||||
|
||||
end
|
||||
|
||||
function mcl_potions.regenerate(player, toggle)
|
||||
|
||||
if not player then return false end
|
||||
is_regenerating[player:get_player_name()] = toggle
|
||||
|
||||
end
|
||||
|
||||
function mcl_potions._use_potion(item, obj, color)
|
||||
local d = 0.1
|
||||
@ -558,6 +581,10 @@ function mcl_potions.poison_func(player, factor, duration)
|
||||
|
||||
is_poisoned[player] = {step = factor, dur = duration, timer = 0}
|
||||
|
||||
if player:is_player() then
|
||||
potions_set_hudbar(player)
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
local victim = is_poisoned[player]
|
||||
@ -576,6 +603,10 @@ function mcl_potions.regeneration_func(player, factor, duration)
|
||||
|
||||
is_regenerating[player] = {step = factor, dur = duration, timer = 0}
|
||||
|
||||
if player:is_player() then
|
||||
potions_set_hudbar(player)
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
local victim = is_regenerating[player]
|
||||
|
@ -111,7 +111,7 @@ local function register_potion(def)
|
||||
_tt_help = get_tt(def._tt, def.effect, dur),
|
||||
_doc_items_longdesc = def._longdesc,
|
||||
_doc_items_usagehelp = how_to_drink,
|
||||
stack_max = 1,
|
||||
stack_max = def.stack_max or 1,
|
||||
inventory_image = def.image or potion_image(def.color),
|
||||
wield_image = def.image or potion_image(def.color),
|
||||
groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1, not_in_creative_inventory=0},
|
||||
|
BIN
mods/ITEMS/mcl_potions/textures/hbhunger_icon_regen_poison.png
Normal file
BIN
mods/ITEMS/mcl_potions/textures/hbhunger_icon_regen_poison.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 290 B |
BIN
mods/ITEMS/mcl_potions/textures/hudbars_icon_regenerate.png
Normal file
BIN
mods/ITEMS/mcl_potions/textures/hudbars_icon_regenerate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 305 B |
@ -98,15 +98,15 @@ local function poisonp(tick, time, time_left, damage, exhaustion, name)
|
||||
if time_left < time then
|
||||
minetest.after(tick, poisonp, tick, time, time_left, damage, exhaustion, name)
|
||||
else
|
||||
if damage > 0 then
|
||||
mcl_hunger.poison_damage[name] = mcl_hunger.poison_damage[name] - 1
|
||||
end
|
||||
-- if damage > 0 then
|
||||
-- mcl_hunger.poison_damage[name] = mcl_hunger.poison_damage[name] - 1
|
||||
-- end
|
||||
if exhaustion > 0 then
|
||||
mcl_hunger.poison_hunger [name] = mcl_hunger.poison_hunger[name] - 1
|
||||
end
|
||||
if mcl_hunger.poison_damage[name] <= 0 then
|
||||
mcl_hunger.reset_bars_poison_damage(player)
|
||||
end
|
||||
-- if mcl_hunger.poison_damage[name] <= 0 then
|
||||
-- mcl_hunger.reset_bars_poison_damage(player)
|
||||
-- end
|
||||
if mcl_hunger.poison_hunger[name] <= 0 then
|
||||
mcl_hunger.reset_bars_poison_hunger(player)
|
||||
end
|
||||
@ -225,10 +225,10 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poiso
|
||||
end
|
||||
if do_poison then
|
||||
-- Set poison bars
|
||||
if poison and poison > 0 then
|
||||
hb.change_hudbar(user, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hbhunger_bar_health_poison.png")
|
||||
mcl_hunger.poison_damage[name] = mcl_hunger.poison_damage[name] + 1
|
||||
end
|
||||
-- if poison and poison > 0 then
|
||||
-- hb.change_hudbar(user, "health", nil, nil, "hbhunger_icon_health_poison.png", nil, "hbhunger_bar_health_poison.png")
|
||||
-- mcl_hunger.poison_damage[name] = mcl_hunger.poison_damage[name] + 1
|
||||
-- end
|
||||
if exhaust and exhaust > 0 then
|
||||
hb.change_hudbar(user, "hunger", nil, nil, "mcl_hunger_icon_foodpoison.png", nil, "mcl_hunger_bar_foodpoison.png")
|
||||
if mcl_hunger.debug then
|
||||
@ -260,4 +260,3 @@ if mcl_hunger.active then
|
||||
mcl_hunger.exhaust(name, mcl_hunger.EXHAUST_DIG)
|
||||
end)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user