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