Restrict to vessel-like itens
This commit is contained in:
parent
101b3bffd3
commit
7b5d97b0f9
32
init.lua
32
init.lua
|
@ -61,12 +61,42 @@ local function protection_check_move(pos, from_list, from_index, to_list, to_ind
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local vessels = { "mcl_potions:glass_bottle", "mcl_potions:dragon_breath", "mcl_honey:honey_bottle", "mcl_experience:bottle",
|
||||||
|
"mcl_potions:water", "mcl_potions:water_lingering", "mcl_potions:water_splash",
|
||||||
|
"mcl_potions:river_water",
|
||||||
|
"mcl_potions:awkward", "mcl_potions:awkward_lingering", "mcl_potions:awkward_splash",
|
||||||
|
"mcl_potions:mundane", "mcl_potions:mundane_lingering", "mcl_potions:mundane_splash",
|
||||||
|
"mcl_potions:thick", "mcl_potions:thick_lingering", "mcl_potions:thick_splash",
|
||||||
|
"mcl_potions:slowness", "mcl_potions:slowness_plus", "mcl_potions:slowness_splash", "mcl_potions:slowness_lingering", "mcl_potions:slowness_plus_lingering", "mcl_potions:slowness_plus_splash", "mcl_potions:slowness_2", "mcl_potions:slowness_2_splash", "mcl_potions:slowness_2_lingering",
|
||||||
|
"mcl_potions:healing", "mcl_potions:healing_plus", "mcl_potions:healing_splash", "mcl_potions:healing_lingering", "mcl_potions:healing_plus_lingering", "mcl_potions:healing_plus_splash", "mcl_potions:healing_2", "mcl_potions:healing_2_splash", "mcl_potions:healing_2_lingering",
|
||||||
|
"mcl_potions:night_vision", "mcl_potions:night_vision_plus", "mcl_potions:night_vision_splash", "mcl_potions:night_vision_lingering", "mcl_potions:night_vision_plus_lingering", "mcl_potions:night_vision_plus_splash", "mcl_potions:night_vision_2", "mcl_potions:night_vision_2_splash", "mcl_potions:night_vision_2_lingering",
|
||||||
|
"mcl_potions:swiftness", "mcl_potions:swiftness_plus", "mcl_potions:swiftness_splash", "mcl_potions:swiftness_lingering", "mcl_potions:swiftness_plus_lingering", "mcl_potions:swiftness_plus_splash", "mcl_potions:swiftness_2", "mcl_potions:swiftness_2_splash", "mcl_potions:swiftness_2_lingering",
|
||||||
|
"mcl_potions:fire_resistance", "mcl_potions:fire_resistance_plus", "mcl_potions:fire_resistance_splash", "mcl_potions:fire_resistance_lingering", "mcl_potions:fire_resistance_plus_lingering", "mcl_potions:fire_resistance_plus_splash", "mcl_potions:fire_resistance_2", "mcl_potions:fire_resistance_2_splash", "mcl_potions:fire_resistance_2_lingering",
|
||||||
|
"mcl_potions:water_breathing", "mcl_potions:water_breathing_plus", "mcl_potions:water_breathing_splash", "mcl_potions:water_breathing_lingering", "mcl_potions:water_breathing_plus_lingering", "mcl_potions:water_breathing_plus_splash", "mcl_potions:water_breathing_2", "mcl_potions:water_breathing_2_splash", "mcl_potions:water_breathing_2_lingering",
|
||||||
|
"mcl_potions:regeneration", "mcl_potions:regeneration_plus", "mcl_potions:regeneration_splash", "mcl_potions:regeneration_lingering", "mcl_potions:regeneration_plus_lingering", "mcl_potions:regeneration_plus_splash", "mcl_potions:regeneration_2", "mcl_potions:regeneration_2_splash", "mcl_potions:regeneration_2_lingering",
|
||||||
|
"mcl_potions:poison", "mcl_potions:poison_plus", "mcl_potions:poison_splash", "mcl_potions:poison_lingering", "mcl_potions:poison_plus_lingering", "mcl_potions:poison_plus_splash", "mcl_potions:poison_2", "mcl_potions:poison_2_splash", "mcl_potions:poison_2_lingering",
|
||||||
|
"mcl_potions:leaping", "mcl_potions:leaping_plus", "mcl_potions:leaping_splash", "mcl_potions:leaping_lingering", "mcl_potions:leaping_plus_lingering", "mcl_potions:leaping_plus_splash", "mcl_potions:leaping_2", "mcl_potions:leaping_2_splash", "mcl_potions:leaping_2_lingering",
|
||||||
|
"mcl_potions:harming", "mcl_potions:harming_plus", "mcl_potions:harming_splash", "mcl_potions:harming_lingering", "mcl_potions:harming_plus_lingering", "mcl_potions:harming_plus_splash", "mcl_potions:harming_2", "mcl_potions:harming_2_splash", "mcl_potions:harming_2_lingering",
|
||||||
|
"mcl_potions:invisibility", "mcl_potions:invisibility_plus", "mcl_potions:invisibility_splash", "mcl_potions:invisibility_lingering", "mcl_potions:invisibility_plus_lingering", "mcl_potions:invisibility_plus_splash", "mcl_potions:invisibility_2", "mcl_potions:invisibility_2_splash", "mcl_potions:invisibility_2_lingering",
|
||||||
|
}
|
||||||
|
|
||||||
|
local function is_vessel (tab, val)
|
||||||
|
for index, value in ipairs(tab) do
|
||||||
|
if value == val then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local function protection_check_put_take(pos, listname, index, stack, player)
|
local function protection_check_put_take(pos, listname, index, stack, player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if minetest.is_protected(pos, name) then
|
if minetest.is_protected(pos, name) then
|
||||||
minetest.record_protection_violation(pos, name)
|
minetest.record_protection_violation(pos, name)
|
||||||
return 0
|
return 0
|
||||||
elseif minetest.get_item_group(stack:get_name(), "brewitem") ~= 0 or stack:get_name() == "mcl_honey:honey_bottle" or stack:get_name() == "mcl_experience:bottle" then
|
-- elseif minetest.get_item_group(stack:get_name(), "brewitem") ~= 0 or stack:get_name() == "mcl_honey:honey_bottle" or stack:get_name() == "mcl_experience:bottle" then
|
||||||
|
elseif is_vessel(vessels, stack:get_name()) then
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in New Issue