Fix indentations in mcl_potions/mcl_brewing

This commit is contained in:
Wuzzy 2020-08-08 10:00:16 +02:00
parent 7104bbd2df
commit a472c30163
7 changed files with 294 additions and 275 deletions

View File

@ -231,7 +231,6 @@ local function brewing_stand_timer(pos, elapsed)
meta:set_float("fuel_timer", fuel_timer) meta:set_float("fuel_timer", fuel_timer)
meta:set_float("stand_timer", stand_timer) meta:set_float("stand_timer", stand_timer)
meta:set_float("fuel", fuel) meta:set_float("fuel", fuel)
-- meta:set_list("stand_items", stand_list)
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
return result return result
@ -856,7 +855,6 @@ minetest.register_node("mcl_brewing:stand_011", {
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
_mcl_hardness = 1, _mcl_hardness = 1,
on_destruct = on_destruct, on_destruct = on_destruct,
-- after_dig_node = after_dig,
allow_metadata_inventory_take = allow_take, allow_metadata_inventory_take = allow_take,
allow_metadata_inventory_put = allow_put, allow_metadata_inventory_put = allow_put,
on_metadata_inventory_put = on_put, on_metadata_inventory_put = on_put,

View File

@ -303,7 +303,8 @@ local is_fire_node = { ["mcl_core:lava_flowing"]=true,
["mcl_nether:magma"]=true, ["mcl_nether:magma"]=true,
["mcl_nether:nether_lava_source"]=true, ["mcl_nether:nether_lava_source"]=true,
["mcl_nether:nether_lava_flowing"]=true, ["mcl_nether:nether_lava_flowing"]=true,
["mcl_nether:nether_lava_source"]=true} ["mcl_nether:nether_lava_source"]=true
}
-- Prevent damage to player with Fire Resistance enabled -- Prevent damage to player with Fire Resistance enabled
minetest.register_on_player_hpchange(function(player, hp_change, reason) minetest.register_on_player_hpchange(function(player, hp_change, reason)
@ -314,8 +315,6 @@ minetest.register_on_player_hpchange(function(player, hp_change, reason)
-- it's worth noting that you don't take damage from players in this case... -- it's worth noting that you don't take damage from players in this case...
local player_info = mcl_playerinfo[player:get_player_name()] local player_info = mcl_playerinfo[player:get_player_name()]
-- if reason.type == "drown" then return hp_change
if is_fire_node[player_info.node_head] or is_fire_node[player_info.node_feet] or is_fire_node[player_info.node_stand] then if is_fire_node[player_info.node_head] or is_fire_node[player_info.node_feet] or is_fire_node[player_info.node_stand] then
return 0 return 0
else else
@ -347,7 +346,9 @@ end, true)
function mcl_potions._reset_player_effects(player) function mcl_potions._reset_player_effects(player)
if not player:is_player() then return end if not player:is_player() then
return
end
meta = player:get_meta() meta = player:get_meta()
mcl_potions.make_invisible(player, false) mcl_potions.make_invisible(player, false)
@ -375,7 +376,9 @@ end
function mcl_potions._save_player_effects(player) function mcl_potions._save_player_effects(player)
if not player:is_player() then return end if not player:is_player() then
return
end
meta = player:get_meta() meta = player:get_meta()
meta:set_string("_is_invisible", minetest.serialize(is_invisible[player])) meta:set_string("_is_invisible", minetest.serialize(is_invisible[player]))
@ -393,7 +396,9 @@ end
function mcl_potions._load_player_effects(player) function mcl_potions._load_player_effects(player)
if not player:is_player() then return end if not player:is_player() then
return
end
meta = player:get_meta() meta = player:get_meta()
if minetest.deserialize(meta:get_string("_is_invisible")) then if minetest.deserialize(meta:get_string("_is_invisible")) then
@ -487,7 +492,9 @@ function mcl_potions.is_obj_hit(self, pos)
if entity and entity.name ~= self.object:get_luaentity().name then if entity and entity.name ~= self.object:get_luaentity().name then
if entity._cmi_is_mob then return true end if entity._cmi_is_mob then
return true
end
elseif object:is_player() and self._thrower ~= object:get_player_name() then elseif object:is_player() and self._thrower ~= object:get_player_name() then
return true return true
@ -500,7 +507,9 @@ end
function mcl_potions.make_invisible(player, toggle) function mcl_potions.make_invisible(player, toggle)
if not player then return false end if not player then
return false
end
local is_player = player:is_player() local is_player = player:is_player()
local entity = player:get_luaentity() local entity = player:get_luaentity()
@ -633,7 +642,9 @@ end
function mcl_potions.swiftness_func(player, factor, duration) function mcl_potions.swiftness_func(player, factor, duration)
if not player:get_meta() then return false end if not player:get_meta() then
return false
end
if not is_swift[player] then if not is_swift[player] then
@ -654,7 +665,9 @@ end
function mcl_potions.leaping_func(player, factor, duration) function mcl_potions.leaping_func(player, factor, duration)
if not player:get_meta() then return false end if not player:get_meta() then
return false
end
if not is_leaping[player] then if not is_leaping[player] then

View File

@ -71,7 +71,9 @@ minetest.register_globalstep(function(dtime)
end end
end end
if vals.timer <= 0 then lingering_effect_at[pos] = nil end if vals.timer <= 0 then
lingering_effect_at[pos] = nil
end
end end
lingering_timer = 0 lingering_timer = 0

View File

@ -12,7 +12,9 @@ local how_to_drink = S("Use the “Place” key to drink it.")
local potion_intro = S("Drinking a potion gives you a particular effect.") local potion_intro = S("Drinking a potion gives you a particular effect.")
local function time_string(dur) local function time_string(dur)
if not dur then return nil end if not dur then
return nil
end
return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60)) return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))
end end
local function perc_string(num) local function perc_string(num)
@ -55,7 +57,9 @@ local function register_potion(def)
end end
local on_use = function (itemstack, user, pointed_thing) local on_use = function (itemstack, user, pointed_thing)
if not def.on_use then return end if not def.on_use then
return
end
def.on_use(user, def.effect, dur) def.on_use(user, def.effect, dur)
minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
mcl_potions._use_potion(itemstack, user, def.color) mcl_potions._use_potion(itemstack, user, def.color)

View File

@ -103,8 +103,11 @@ function mcl_potions.register_splash(name, descr, color, def)
local pos2 = obj:get_pos() local pos2 = obj:get_pos()
local rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2)) local rad = math.floor(math.sqrt((pos2.x-pos.x)^2 + (pos2.y-pos.y)^2 + (pos2.z-pos.z)^2))
if rad > 0 then def.potion_fun(obj, redux_map[rad]) else def.potion_fun(obj, 1) end if rad > 0 then
def.potion_fun(obj, redux_map[rad])
else
def.potion_fun(obj, 1)
end
end end
end end

View File

@ -24,7 +24,6 @@ local function arrow_image(colorstring, opacity)
"mcl_bows_arrow_front.png^[colorize:"..colorstring..":"..tostring(opacity), "mcl_bows_arrow_front.png^[colorize:"..colorstring..":"..tostring(opacity),
"mcl_bows_arrow.png^(mcl_bows_arrow_overlay.png^[colorize:"..colorstring..":"..tostring(opacity)..")", "mcl_bows_arrow.png^(mcl_bows_arrow_overlay.png^[colorize:"..colorstring..":"..tostring(opacity)..")",
"mcl_bows_arrow.png^[transformFX^(mcl_bows_arrow_overlay.png^[transformFX^[colorize:"..colorstring..":"..tostring(opacity)..")"} "mcl_bows_arrow.png^[transformFX^(mcl_bows_arrow_overlay.png^[transformFX^[colorize:"..colorstring..":"..tostring(opacity)..")"}
end end
local how_to_shoot = minetest.registered_items["mcl_bows:arrow"]._doc_items_usagehelp local how_to_shoot = minetest.registered_items["mcl_bows:arrow"]._doc_items_usagehelp