Fix parachute fail with ignore
This commit is contained in:
parent
da08ff22fa
commit
e890682d72
@ -81,6 +81,7 @@ end
|
|||||||
-- false, <failure_reason> on failure.
|
-- false, <failure_reason> on failure.
|
||||||
-- * <failure_reason> = "already_attached" if player was attached
|
-- * <failure_reason> = "already_attached" if player was attached
|
||||||
-- * <failure_reason> = "on_ground" if player already on ground
|
-- * <failure_reason> = "on_ground" if player already on ground
|
||||||
|
-- * <failure_reason> = "ignore" if player is in ignore
|
||||||
local function open_parachute_for_player(player, play_sound, load_area)
|
local function open_parachute_for_player(player, play_sound, load_area)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if play_sound == nil then
|
if play_sound == nil then
|
||||||
@ -95,11 +96,6 @@ local function open_parachute_for_player(player, play_sound, load_area)
|
|||||||
|
|
||||||
local spawnable = check_parachute_spawnable(pos, player)
|
local spawnable = check_parachute_spawnable(pos, player)
|
||||||
|
|
||||||
|
|
||||||
local in_node = minetest.get_node(pos)
|
|
||||||
if in_node.name == "ignore" then
|
|
||||||
return false, "on_ground"
|
|
||||||
end
|
|
||||||
if spawnable then
|
if spawnable then
|
||||||
-- Spawn parachute
|
-- Spawn parachute
|
||||||
local ppos = vector.new(pos.x, pos.y + CBOX_BOTTOM, pos.z)
|
local ppos = vector.new(pos.x, pos.y + CBOX_BOTTOM, pos.z)
|
||||||
@ -111,6 +107,11 @@ local function open_parachute_for_player(player, play_sound, load_area)
|
|||||||
minetest.load_area(load1, load2)
|
minetest.load_area(load1, load2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local in_node = minetest.get_node(pos)
|
||||||
|
if in_node.name == "ignore" then
|
||||||
|
return false, "ignore"
|
||||||
|
end
|
||||||
|
|
||||||
local obj = minetest.add_entity(ppos, "parachute:entity")
|
local obj = minetest.add_entity(ppos, "parachute:entity")
|
||||||
if play_sound then
|
if play_sound then
|
||||||
minetest.sound_play({name="parachute_open", pos=ppos}, {gain=0.5}, true)
|
minetest.sound_play({name="parachute_open", pos=ppos}, {gain=0.5}, true)
|
||||||
@ -164,7 +165,13 @@ minetest.register_craftitem(
|
|||||||
minetest.chat_send_player(
|
minetest.chat_send_player(
|
||||||
player:get_player_name(),
|
player:get_player_name(),
|
||||||
minetest.colorize("#FFFF00", S("You can open the parachute only in air!")))
|
minetest.colorize("#FFFF00", S("You can open the parachute only in air!")))
|
||||||
end
|
elseif fail_reason == "ignore" then
|
||||||
|
-- If we're in ignore, we might either be in an unloaded area or outside the map
|
||||||
|
minetest.chat_send_player(
|
||||||
|
player:get_player_name(),
|
||||||
|
-- Intentionally vague message
|
||||||
|
minetest.colorize("#FFFF00", S("The parachute fails to open for some reason.")))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user