forked from MineClone5/MineClone5
Merge branch 'master' of https://git.minetest.land/Wuzzy/MineClone2
This commit is contained in:
commit
5e26cfcf3d
|
@ -80,3 +80,8 @@ Depending on what you add, the chances for inclusion vary:
|
|||
Report all bugs and missing Minecraft features here:
|
||||
|
||||
<https://git.minetest.land/Wuzzy/MineClone2/issues>
|
||||
|
||||
## Direct discussion
|
||||
We have an IRC channel! Join us on #mineclone2 in freenode.net.
|
||||
|
||||
<ircs://irc.freenode.net:6697/#mineclone2>
|
||||
|
|
|
@ -724,6 +724,42 @@ local is_at_cliff_or_danger = function(self)
|
|||
end
|
||||
|
||||
|
||||
-- copy the 'mob facing cliff_or_danger check' from above, and rework to avoid water
|
||||
local is_at_water_danger = function(self)
|
||||
|
||||
|
||||
if not self.object:get_luaentity() then
|
||||
return false
|
||||
end
|
||||
local yaw = self.object:get_yaw()
|
||||
local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5)
|
||||
local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5)
|
||||
local pos = self.object:get_pos()
|
||||
local ypos = pos.y + self.collisionbox[2] -- just above floor
|
||||
|
||||
local free_fall, blocker = minetest.line_of_sight(
|
||||
{x = pos.x + dir_x, y = ypos, z = pos.z + dir_z},
|
||||
{x = pos.x + dir_x, y = ypos - 3, z = pos.z + dir_z})
|
||||
if free_fall then
|
||||
return true
|
||||
else
|
||||
local bnode = minetest.get_node(blocker)
|
||||
local waterdanger = is_node_waterhazard(self, bnode.name)
|
||||
if
|
||||
waterdanger and (is_node_waterhazard(self, self.standing_in) or is_node_waterhazard(self, self.standing_on)) then
|
||||
return false
|
||||
elseif waterdanger and (is_node_waterhazard(self, self.standing_in) or is_node_waterhazard(self, self.standing_on)) == false then
|
||||
return true
|
||||
else
|
||||
local def = minetest.registered_nodes[bnode.name]
|
||||
return (not def and def.walkable)
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-- get node but use fallback for nil or unknown
|
||||
local node_ok = function(pos, fallback)
|
||||
|
||||
|
@ -2049,40 +2085,40 @@ local do_states = function(self, dtime)
|
|||
|
||||
local is_in_danger = false
|
||||
if lp then
|
||||
|
||||
local is_in_danger = false
|
||||
|
||||
-- if mob is flying, only check for node it is currently in (no contact with node below)
|
||||
if flight_check(self) then
|
||||
is_in_danger = is_node_dangerous(self, self.standing_in)
|
||||
elseif (is_node_dangerous(self, self.standing_in) or
|
||||
is_node_dangerous(self, self.standing_on)) or (is_node_waterhazard(self, self.standing_in) or is_node_waterhazard(self, self.standing_on)) then
|
||||
is_in_danger = true
|
||||
end
|
||||
|
||||
-- If mob in or on dangerous block, look for land
|
||||
if is_in_danger then
|
||||
lp = minetest.find_node_near(s, 5, {"group:solid"})
|
||||
if (is_node_dangerous(self, self.standing_in) or
|
||||
is_node_dangerous(self, self.standing_on)) or (is_node_waterhazard(self, self.standing_in) or is_node_waterhazard(self, self.standing_on)) and (not self.fly) then
|
||||
is_in_danger = true
|
||||
|
||||
-- did we find land?
|
||||
if lp then
|
||||
-- If mob in or on dangerous block, look for land
|
||||
if is_in_danger then
|
||||
-- Better way to find shore - copied from upstream
|
||||
lp = minetest.find_nodes_in_area_under_air(
|
||||
{x = s.x - 5, y = s.y - 0.5, z = s.z - 5},
|
||||
{x = s.x + 5, y = s.y + 1, z = s.z + 5},
|
||||
{"group:solid"})
|
||||
|
||||
local vec = {
|
||||
x = lp.x - s.x,
|
||||
z = lp.z - s.z
|
||||
}
|
||||
lp = #lp > 0 and lp[random(#lp)]
|
||||
|
||||
-- did we find land?
|
||||
if lp then
|
||||
|
||||
yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate
|
||||
local vec = {
|
||||
x = lp.x - s.x,
|
||||
z = lp.z - s.z
|
||||
}
|
||||
|
||||
if lp.x > s.x then yaw = yaw + pi end
|
||||
yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate
|
||||
|
||||
-- look towards land and jump/move in that direction
|
||||
yaw = set_yaw(self, yaw, 6)
|
||||
do_jump(self)
|
||||
set_velocity(self, self.walk_velocity)
|
||||
else
|
||||
yaw = yaw + random(-0.5, 0.5)
|
||||
end
|
||||
|
||||
if lp.x > s.x then yaw = yaw + pi end
|
||||
|
||||
-- look towards land and move in that direction
|
||||
yaw = set_yaw(self, yaw, 6)
|
||||
set_velocity(self, self.walk_velocity)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
-- A danger is near but mob is not inside
|
||||
else
|
||||
|
@ -3218,8 +3254,6 @@ local mob_step = function(self, dtime)
|
|||
|
||||
breed(self)
|
||||
|
||||
follow_flop(self)
|
||||
|
||||
if do_states(self, dtime) then
|
||||
return
|
||||
end
|
||||
|
@ -3228,6 +3262,18 @@ local mob_step = function(self, dtime)
|
|||
|
||||
runaway_from(self)
|
||||
|
||||
if is_at_water_danger(self) and self.state ~= "attack" then
|
||||
if random(1, 10) <= 6 then
|
||||
set_velocity(self, 0)
|
||||
self.state = "stand"
|
||||
set_animation(self, "stand")
|
||||
yaw = yaw + random(-0.5, 0.5)
|
||||
yaw = set_yaw(self, yaw, 8)
|
||||
end
|
||||
end
|
||||
|
||||
follow_flop(self)
|
||||
|
||||
if is_at_cliff_or_danger(self) then
|
||||
set_velocity(self, 0)
|
||||
self.state = "stand"
|
||||
|
|
|
@ -83,7 +83,10 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
|||
end
|
||||
|
||||
-- No sleeping while moving. Slightly different behaviour than in MC.
|
||||
if vector.length(player:get_player_velocity()) > 0.001 then
|
||||
-- FIXME: Velocity threshold should be 0.01 but Minetest 5.3.0
|
||||
-- sometimes reports incorrect Y speed. A velocity threshold
|
||||
-- of 0.125 still seems good enough.
|
||||
if vector.length(player:get_player_velocity()) > 0.125 then
|
||||
minetest.chat_send_player(name, S("You have to stop moving before going to bed!"))
|
||||
return false
|
||||
end
|
||||
|
@ -115,13 +118,16 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
|||
mcl_beds.player[name] = nil
|
||||
player_in_bed = player_in_bed - 1
|
||||
end
|
||||
mcl_beds.pos[name] = nil
|
||||
mcl_beds.bed_pos[name] = nil
|
||||
if p then
|
||||
player:set_pos(p)
|
||||
end
|
||||
|
||||
-- skip here to prevent sending player specific changes (used for leaving players)
|
||||
if skip then
|
||||
return false
|
||||
end
|
||||
if p then
|
||||
player:set_pos(p)
|
||||
end
|
||||
|
||||
-- physics, eye_offset, etc
|
||||
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
|
@ -134,8 +140,6 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
|||
player:get_meta():set_string("mcl_beds:sleeping", "false")
|
||||
hud_flags.wielditem = true
|
||||
mcl_player.player_set_animation(player, "stand" , 30)
|
||||
mcl_beds.pos[name] = nil
|
||||
mcl_beds.bed_pos[name] = nil
|
||||
|
||||
-- lay down
|
||||
else
|
||||
|
@ -198,8 +202,8 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
|||
return true
|
||||
end
|
||||
|
||||
local function update_formspecs(finished)
|
||||
local ges = #minetest.get_connected_players()
|
||||
local function update_formspecs(finished, ges)
|
||||
local ges = ges or #minetest.get_connected_players()
|
||||
local form_n = "size[6,5;true]"
|
||||
local all_in_bed = ges == player_in_bed
|
||||
local night_skip = is_night_skip_enabled()
|
||||
|
@ -360,8 +364,14 @@ end)
|
|||
minetest.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
lay_down(player, nil, nil, false, true)
|
||||
mcl_beds.player[name] = nil
|
||||
if check_in_beds() then
|
||||
players = minetest.get_connected_players()
|
||||
for n, player in ipairs(players) do
|
||||
if player:get_player_name() == name then
|
||||
players[n] = nil
|
||||
break
|
||||
end
|
||||
end
|
||||
if check_in_beds(players) then
|
||||
minetest.after(5, function()
|
||||
if check_in_beds() then
|
||||
update_formspecs(is_night_skip_enabled())
|
||||
|
@ -369,7 +379,7 @@ minetest.register_on_leaveplayer(function(player)
|
|||
end
|
||||
end)
|
||||
end
|
||||
update_formspecs(false)
|
||||
update_formspecs(false, #players)
|
||||
end)
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
|
|
@ -4,7 +4,6 @@ local function active_brewing_formspec(fuel_percent, brew_percent)
|
|||
|
||||
return "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png]"..
|
||||
-- "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory_active.png]"..
|
||||
"label[4,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Brewing Stand"))).."]"..
|
||||
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
|
@ -375,7 +374,7 @@ minetest.register_node("mcl_brewing:stand_000", {
|
|||
_doc_items_longdesc = S("The stand allows you to brew potions!"),
|
||||
_doc_items_usagehelp = doc_string,
|
||||
_tt_help = S("Brew Potions"),
|
||||
groups = {pickaxey=1, falling_node=1, brewitem=1, not_in_creative_inventory = 0, not_in_craft_guide = 0},
|
||||
groups = {pickaxey=1, falling_node=1, brewitem=1 },
|
||||
tiles = tiles,
|
||||
drop = "mcl_brewing:stand",
|
||||
paramtype = "light",
|
||||
|
@ -392,32 +391,16 @@ minetest.register_node("mcl_brewing:stand_000", {
|
|||
{-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
|
||||
{-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
|
||||
|
||||
-- {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
|
||||
-- {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
|
||||
-- {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
|
||||
-- {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
|
||||
-- {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
|
||||
|
||||
{-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
|
||||
{-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
|
||||
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
|
||||
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
|
||||
|
||||
|
||||
-- {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
|
||||
-- {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
|
||||
-- {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
|
||||
-- {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
|
||||
-- {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
|
||||
|
||||
{5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
|
||||
{4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
|
||||
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
|
||||
{2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
|
||||
|
||||
-- {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
|
||||
-- {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
|
||||
|
||||
{0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
|
||||
{0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
|
||||
{0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
|
||||
|
@ -427,7 +410,6 @@ minetest.register_node("mcl_brewing:stand_000", {
|
|||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 1,
|
||||
on_destruct = on_destruct,
|
||||
-- after_dig_node = after_dig,
|
||||
allow_metadata_inventory_take = allow_take,
|
||||
allow_metadata_inventory_put = allow_put,
|
||||
on_metadata_inventory_put = on_put,
|
||||
|
@ -458,7 +440,7 @@ minetest.register_node("mcl_brewing:stand_100", {
|
|||
description = S("Brewing Stand"),
|
||||
_doc_items_create_entry = false,
|
||||
_tt_help = S("Brew Potions"),
|
||||
groups = {pickaxey=1, falling_node=1, brewitem=0, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
tiles = tiles,
|
||||
drop = "mcl_brewing:stand",
|
||||
paramtype = "light",
|
||||
|
@ -486,21 +468,11 @@ minetest.register_node("mcl_brewing:stand_100", {
|
|||
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
|
||||
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
|
||||
|
||||
|
||||
-- {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
|
||||
-- {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
|
||||
-- {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
|
||||
-- {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
|
||||
-- {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
|
||||
|
||||
{5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
|
||||
{4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
|
||||
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
|
||||
{2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
|
||||
|
||||
-- {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
|
||||
-- {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
|
||||
|
||||
{0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
|
||||
{0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
|
||||
{0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
|
||||
|
@ -510,7 +482,6 @@ minetest.register_node("mcl_brewing:stand_100", {
|
|||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 1,
|
||||
on_destruct = on_destruct,
|
||||
-- after_dig_node = after_dig,
|
||||
allow_metadata_inventory_take = allow_take,
|
||||
allow_metadata_inventory_put = allow_put,
|
||||
on_metadata_inventory_put = on_put,
|
||||
|
@ -541,7 +512,7 @@ minetest.register_node("mcl_brewing:stand_010", {
|
|||
description = S("Brewing Stand"),
|
||||
_doc_items_create_entry = false,
|
||||
_tt_help = S("Brew Potions"),
|
||||
groups = {pickaxey=1, falling_node=1, brewitem=0, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
tiles = tiles,
|
||||
drop = "mcl_brewing:stand",
|
||||
paramtype = "light",
|
||||
|
@ -558,12 +529,6 @@ minetest.register_node("mcl_brewing:stand_010", {
|
|||
{-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
|
||||
{-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
|
||||
|
||||
-- {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
|
||||
-- {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
|
||||
-- {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
|
||||
-- {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
|
||||
-- {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
|
||||
|
||||
{-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
|
||||
{-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
|
||||
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
|
||||
|
@ -581,9 +546,6 @@ minetest.register_node("mcl_brewing:stand_010", {
|
|||
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
|
||||
{2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
|
||||
|
||||
-- {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
|
||||
-- {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
|
||||
|
||||
{0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
|
||||
{0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
|
||||
{0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
|
||||
|
@ -593,7 +555,6 @@ minetest.register_node("mcl_brewing:stand_010", {
|
|||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 1,
|
||||
on_destruct = on_destruct,
|
||||
-- after_dig_node = after_dig,
|
||||
allow_metadata_inventory_take = allow_take,
|
||||
allow_metadata_inventory_put = allow_put,
|
||||
on_metadata_inventory_put = on_put,
|
||||
|
@ -624,7 +585,7 @@ minetest.register_node("mcl_brewing:stand_001", {
|
|||
description = S("Brewing Stand"),
|
||||
_doc_items_create_entry = false,
|
||||
_tt_help = S("Brew Potions"),
|
||||
groups = {pickaxey=1, falling_node=1, brewitem=0, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
tiles = tiles,
|
||||
drop = "mcl_brewing:stand",
|
||||
paramtype = "light",
|
||||
|
@ -641,24 +602,11 @@ minetest.register_node("mcl_brewing:stand_001", {
|
|||
{-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
|
||||
{-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
|
||||
|
||||
-- {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
|
||||
-- {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
|
||||
-- {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
|
||||
-- {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
|
||||
-- {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
|
||||
|
||||
{-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
|
||||
{-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
|
||||
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
|
||||
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
|
||||
|
||||
|
||||
-- {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
|
||||
-- {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
|
||||
-- {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
|
||||
-- {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
|
||||
-- {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
|
||||
|
||||
{5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
|
||||
{4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
|
||||
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
|
||||
|
@ -676,7 +624,6 @@ minetest.register_node("mcl_brewing:stand_001", {
|
|||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 1,
|
||||
on_destruct = on_destruct,
|
||||
-- after_dig_node = after_dig,
|
||||
allow_metadata_inventory_take = allow_take,
|
||||
allow_metadata_inventory_put = allow_put,
|
||||
on_metadata_inventory_put = on_put,
|
||||
|
@ -707,7 +654,7 @@ minetest.register_node("mcl_brewing:stand_110", {
|
|||
description = S("Brewing Stand"),
|
||||
_doc_items_create_entry = false,
|
||||
_tt_help = S("Brew Potions"),
|
||||
groups = {pickaxey=1, falling_node=1, brewitem=0, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
tiles = tiles,
|
||||
drop = "mcl_brewing:stand",
|
||||
paramtype = "light",
|
||||
|
@ -747,9 +694,6 @@ minetest.register_node("mcl_brewing:stand_110", {
|
|||
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
|
||||
{2/16, 7/16 ,-2/16 ,1/16, 8/16, -1/16 }, -- line 2
|
||||
|
||||
-- {0/16, -6/16 , 2/16 , 1/16, 1/16, 7/16 }, -- bottle 3
|
||||
-- {0/16, 1/16 , 3/16 , 1/16, 3/16, 6/16 }, -- bottle 3
|
||||
|
||||
{0/16, 7/16 , 1/16 , 1/16, 8/16, 3/16 }, -- line 3
|
||||
{0/16, 6/16 , 3/16 , 1/16, 7/16, 5/16 }, -- line 3
|
||||
{0/16, 3/16 , 4/16 , 1/16, 6/16, 5/16 }, -- line 3
|
||||
|
@ -759,7 +703,6 @@ minetest.register_node("mcl_brewing:stand_110", {
|
|||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 1,
|
||||
on_destruct = on_destruct,
|
||||
-- after_dig_node = after_dig,
|
||||
allow_metadata_inventory_take = allow_take,
|
||||
allow_metadata_inventory_put = allow_put,
|
||||
on_metadata_inventory_put = on_put,
|
||||
|
@ -790,7 +733,7 @@ minetest.register_node("mcl_brewing:stand_101", {
|
|||
description = S("Brewing Stand"),
|
||||
_doc_items_create_entry = false,
|
||||
_tt_help = S("Brew Potions"),
|
||||
groups = {pickaxey=1, falling_node=1, brewitem=0, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
tiles = tiles,
|
||||
drop = "mcl_brewing:stand",
|
||||
paramtype = "light",
|
||||
|
@ -818,13 +761,6 @@ minetest.register_node("mcl_brewing:stand_101", {
|
|||
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
|
||||
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
|
||||
|
||||
|
||||
-- {7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
|
||||
-- {6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
|
||||
-- {5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
|
||||
-- {4/16, -6/16 ,-4/16 , 3/16, 3/16, -3/16 }, -- bottle 2
|
||||
-- {3/16, -6/16 ,-3/16 , 2/16, 1/16, -2/16 }, -- bottle 2
|
||||
|
||||
{5/16, 3/16 ,-5/16 ,4/16, 7/16, -4/16 }, -- line 2
|
||||
{4/16, 6/16 ,-4/16 ,3/16, 8/16, -3/16 }, -- line 2
|
||||
{3/16, 7/16 ,-3/16 ,2/16, 8/16, -2/16 }, -- line 2
|
||||
|
@ -842,7 +778,6 @@ minetest.register_node("mcl_brewing:stand_101", {
|
|||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 1,
|
||||
on_destruct = on_destruct,
|
||||
-- after_dig_node = after_dig,
|
||||
allow_metadata_inventory_take = allow_take,
|
||||
allow_metadata_inventory_put = allow_put,
|
||||
on_metadata_inventory_put = on_put,
|
||||
|
@ -873,7 +808,7 @@ minetest.register_node("mcl_brewing:stand_011", {
|
|||
description = S("Brewing Stand"),
|
||||
_doc_items_create_entry = false,
|
||||
_tt_help = S("Brew Potions"),
|
||||
groups = {pickaxey=1, falling_node=1, brewitem=0, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
tiles = tiles,
|
||||
drop = "mcl_brewing:stand",
|
||||
paramtype = "light",
|
||||
|
@ -890,18 +825,11 @@ minetest.register_node("mcl_brewing:stand_011", {
|
|||
{-8/16, -8/16, -8/16, -2/16, -6/16, -2/16}, -- base
|
||||
{-3/16, -8/16, 2/16, 3/16, -6/16, 8/16}, -- base
|
||||
|
||||
-- {-7/16, -6/16 ,-7/16 , -6/16, 1/16, -6/16 }, -- bottle 1
|
||||
-- {-6/16, -6/16 ,-6/16 , -5/16, 3/16, -5/16 }, -- bottle 1
|
||||
-- {-5/16, -6/16 ,-5/16 , -4/16, 3/16, -4/16 }, -- bottle 1
|
||||
-- {-4/16, -6/16 ,-4/16 , -3/16, 3/16, -3/16 }, -- bottle 1
|
||||
-- {-3/16, -6/16 ,-3/16 , -2/16, 1/16, -2/16 }, -- bottle 1
|
||||
|
||||
{-5/16, 3/16 ,-5/16 , -4/16, 7/16, -4/16 }, -- line 1
|
||||
{-4/16, 6/16 ,-4/16 , -3/16, 8/16, -3/16 }, -- line 1
|
||||
{-3/16, 7/16 ,-3/16 , -2/16, 8/16, -2/16 }, -- line 1
|
||||
{-2/16, 7/16 ,-2/16 , -1/16, 8/16, -1/16 }, -- line 1
|
||||
|
||||
|
||||
{7/16, -6/16 ,-7/16 , 6/16, 1/16, -6/16 }, -- bottle 2
|
||||
{6/16, -6/16 ,-6/16 , 5/16, 3/16, -5/16 }, -- bottle 2
|
||||
{5/16, -6/16 ,-5/16 , 4/16, 3/16, -4/16 }, -- bottle 2
|
||||
|
@ -956,7 +884,7 @@ minetest.register_node("mcl_brewing:stand_111", {
|
|||
description = S("Brewing Stand"),
|
||||
_doc_items_create_entry = false,
|
||||
_tt_help = S("Brew Potions"),
|
||||
groups = {pickaxey=1, falling_node=1, brewitem=0, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
groups = {pickaxey=1, falling_node=1, not_in_creative_inventory = 1, not_in_craft_guide = 1},
|
||||
tiles = tiles,
|
||||
drop = "mcl_brewing:stand",
|
||||
paramtype = "light",
|
||||
|
@ -1008,7 +936,6 @@ minetest.register_node("mcl_brewing:stand_111", {
|
|||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 1,
|
||||
on_destruct = on_destruct,
|
||||
-- after_dig_node = after_dig,
|
||||
allow_metadata_inventory_take = allow_take,
|
||||
allow_metadata_inventory_put = allow_put,
|
||||
on_metadata_inventory_put = on_put,
|
||||
|
|
|
@ -277,8 +277,9 @@ minetest.register_craftitem("mcl_potions:river_water", {
|
|||
|
||||
})
|
||||
|
||||
mcl_potions.register_splash("water", S("Splash Potion"), "#0022FF", {tt="No effect", potion_fun=function() end})
|
||||
mcl_potions.register_lingering("water", S("Lingering Potion"), "#0022FF", {tt="No effect", potion_fun=function() end})
|
||||
-- TODO: Extinguish fire, damage mobs
|
||||
mcl_potions.register_splash("water", S("Splash Water Bottle"), "#0022FF", {tt="No effect", potion_fun=function() end})
|
||||
mcl_potions.register_lingering("water", S("Lingering Water Bottle"), "#0022FF", {tt="No effect", potion_fun=function() end})
|
||||
|
||||
minetest.register_craftitem("mcl_potions:speckled_melon", {
|
||||
description = S("Glistering Melon"),
|
||||
|
|
|
@ -69,9 +69,18 @@ end)
|
|||
function mcl_potions.register_lingering(name, descr, color, def)
|
||||
|
||||
local id = "mcl_potions:"..name.."_lingering"
|
||||
local longdesc = def.longdesc
|
||||
if not def.no_effect then
|
||||
longdesc = S("A throwable potion that will shatter on impact, where it creates a magic cloud that lingers around for a while. Any player or mob inside the cloud will receive the potion's effect, possibly repeatedly.")
|
||||
if def.longdesc then
|
||||
longdesc = longdesc .. "\n" .. def.longdesc
|
||||
end
|
||||
end
|
||||
minetest.register_craftitem(id, {
|
||||
description = descr,
|
||||
_tt_help = def.tt,
|
||||
_doc_items_longdesc = longdesc,
|
||||
_doc_items_usagehelp = S("Use the “Punch” key to throw it."),
|
||||
inventory_image = lingering_image(color),
|
||||
groups = {brewitem=1, not_in_creative_inventory=0},
|
||||
on_use = function(item, placer, pointed_thing)
|
||||
|
|
|
@ -9,6 +9,7 @@ local potion_image = function(colorstring, opacity)
|
|||
end
|
||||
|
||||
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 function time_string(dur)
|
||||
if not dur then return nil end
|
||||
|
@ -66,7 +67,7 @@ local function register_potion(def)
|
|||
if effect and def.is_dur then
|
||||
_tt = perc_string(effect).." | "..time_string(dur)
|
||||
if def.name == "poison" or def.name == "regeneration" then
|
||||
_tt = "1/2 Heart/"..effect.."sec | "..time_string(dur)
|
||||
_tt = "1/2 heart/"..effect.."s | "..time_string(dur)
|
||||
end
|
||||
elseif def.name == "healing" or def.name == "harming" then
|
||||
_tt = ((effect / 2) - ((effect / 2)% 0.5)).." Hearts"
|
||||
|
@ -106,15 +107,32 @@ local function register_potion(def)
|
|||
return function() end
|
||||
end
|
||||
|
||||
local desc
|
||||
if not def.no_potion then
|
||||
desc = S("@1 Potion", def.description)
|
||||
else
|
||||
desc = def.description
|
||||
end
|
||||
local potion_longdesc = def._longdesc
|
||||
if not def.no_effect then
|
||||
potion_longdesc = potion_intro .. "\n" .. def._longdesc
|
||||
end
|
||||
local potion_usagehelp
|
||||
local basic_potion_tt
|
||||
if def.name ~= "dragon_breath" then
|
||||
potion_usagehelp = how_to_drink
|
||||
basic_potion_tt = get_tt(def._tt, def.effect, dur)
|
||||
end
|
||||
|
||||
minetest.register_craftitem("mcl_potions:"..def.name, {
|
||||
description = S(def.description),
|
||||
_tt_help = get_tt(def._tt, def.effect, dur),
|
||||
_doc_items_longdesc = def._longdesc,
|
||||
_doc_items_usagehelp = how_to_drink,
|
||||
description = desc,
|
||||
_tt_help = basic_potion_tt,
|
||||
_doc_items_longdesc = potion_longdesc,
|
||||
_doc_items_usagehelp = potion_usagehelp,
|
||||
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},
|
||||
groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1 },
|
||||
on_place = on_use,
|
||||
on_secondary_use = on_use,
|
||||
})
|
||||
|
@ -125,36 +143,46 @@ local function register_potion(def)
|
|||
|
||||
local splash_def = {
|
||||
tt = get_tt(def._tt, def.effect, splash_dur),
|
||||
longdesc = def._longdesc,
|
||||
potion_fun = get_splash_fun(def.effect, splash_dur),
|
||||
no_effect = def.no_effect,
|
||||
}
|
||||
|
||||
local ling_def
|
||||
if def.name == "healing" or def.name == "harming" then
|
||||
ling_def = {
|
||||
tt = get_tt(def._tt, def.effect*mcl_potions.LINGERING_FACTOR, ling_dur),
|
||||
longdesc = def._longdesc,
|
||||
potion_fun = get_lingering_fun(def.effect*mcl_potions.LINGERING_FACTOR, ling_dur),
|
||||
no_effect = def.no_effect,
|
||||
}
|
||||
else
|
||||
ling_def = {
|
||||
tt = get_tt(def._tt, def.effect, ling_dur),
|
||||
longdesc = def._longdesc,
|
||||
potion_fun = get_lingering_fun(def.effect, ling_dur),
|
||||
no_effect = def.no_effect,
|
||||
}
|
||||
end
|
||||
|
||||
local arrow_def = {
|
||||
tt = get_tt(def._tt, def.effect, dur/8.),
|
||||
longdesc = def._longdesc,
|
||||
potion_fun = get_arrow_fun(def.effect, dur/8.),
|
||||
no_effect = def.no_effect,
|
||||
}
|
||||
|
||||
if def.color and def.name ~= "dragon_breath" then -- dont' splash dragon's breath...
|
||||
mcl_potions.register_splash(def.name, S("Splash "..def.description), def.color, splash_def)
|
||||
mcl_potions.register_lingering(def.name, S("Lingering "..def.description), def.color, ling_def)
|
||||
mcl_potions.register_arrow(def.name, S("Arrow of "..def.description), def.color, arrow_def)
|
||||
if def.color and not def.no_throwable then
|
||||
mcl_potions.register_splash(def.name, S("Splash @1 Potion", def.description), def.color, splash_def)
|
||||
mcl_potions.register_lingering(def.name, S("Lingering @1 Potion", def.description), def.color, ling_def)
|
||||
if not def.no_arrow then
|
||||
mcl_potions.register_arrow(def.name, S("Arrow of @1", def.description), def.color, arrow_def)
|
||||
end
|
||||
end
|
||||
|
||||
if def.is_II then
|
||||
|
||||
local desc_mod = " II"
|
||||
local desc_mod = S(" II")
|
||||
|
||||
local effect_II
|
||||
if def.name == "healing" or def.name == "harming" then
|
||||
|
@ -171,7 +199,7 @@ local function register_potion(def)
|
|||
if def.name == "slowness" then
|
||||
dur_2 = 20
|
||||
effect_II = 0.40
|
||||
desc_mod = " IV"
|
||||
desc_mod = S(" IV")
|
||||
end
|
||||
|
||||
local on_use = function (itemstack, user, pointed_thing)
|
||||
|
@ -182,14 +210,14 @@ local function register_potion(def)
|
|||
end
|
||||
|
||||
minetest.register_craftitem("mcl_potions:"..def.name.."_2", {
|
||||
description = S(def.description..desc_mod),
|
||||
description = S("@1 Potion@2", def.description, desc_mod),
|
||||
_tt_help = get_tt(def._tt_2, effect_II, dur_2),
|
||||
_doc_items_longdesc = def._longdesc,
|
||||
_doc_items_usagehelp = how_to_drink,
|
||||
_doc_items_longdesc = potion_longdesc,
|
||||
_doc_items_usagehelp = potion_usagehelp,
|
||||
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},
|
||||
groups = def.groups or {brewitem=1, food=3, can_eat_when_full=1},
|
||||
on_place = on_use,
|
||||
on_secondary_use = on_use,
|
||||
})
|
||||
|
@ -202,12 +230,16 @@ local function register_potion(def)
|
|||
if def.name == "healing" then
|
||||
splash_def_2 = {
|
||||
tt = get_tt(def._tt_2, 7, splash_dur_2),
|
||||
longdesc = def._longdesc,
|
||||
potion_fun = get_splash_fun(7, splash_dur_2),
|
||||
no_effect = def.no_effect,
|
||||
}
|
||||
else
|
||||
splash_def_2 = {
|
||||
tt = get_tt(def._tt_2, effect_II, splash_dur_2),
|
||||
longdesc = def._longdesc,
|
||||
potion_fun = get_splash_fun(effect_II, splash_dur_2),
|
||||
no_effect = def.no_effect,
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -216,24 +248,32 @@ local function register_potion(def)
|
|||
if def.name == "healing" or def.name == "harming" then
|
||||
ling_def_2 = {
|
||||
tt = get_tt(def._tt_2, effect_II*mcl_potions.LINGERING_FACTOR, ling_dur_2),
|
||||
longdesc = def._longdesc,
|
||||
potion_fun = get_lingering_fun(effect_II*mcl_potions.LINGERING_FACTOR, ling_dur_2),
|
||||
no_effect = def.no_effect,
|
||||
}
|
||||
else
|
||||
ling_def_2 = {
|
||||
tt = get_tt(def._tt_2, effect_II, ling_dur_2),
|
||||
longdesc = def._longdesc,
|
||||
potion_fun = get_lingering_fun(effect_II, ling_dur_2),
|
||||
no_effect = def.no_effect,
|
||||
}
|
||||
end
|
||||
|
||||
local arrow_def_2 = {
|
||||
tt = get_tt(def._tt_2, effect_II, dur_2/8.),
|
||||
longdesc = def._longdesc,
|
||||
potion_fun = get_arrow_fun(effect_II, dur_2/8.),
|
||||
no_effect = def.no_effect,
|
||||
}
|
||||
|
||||
if def.color then
|
||||
mcl_potions.register_splash(def.name.."_2", S("Splash "..def.description..desc_mod), def.color, splash_def_2)
|
||||
mcl_potions.register_lingering(def.name.."_2", S("Lingering "..def.description..desc_mod), def.color, ling_def_2)
|
||||
mcl_potions.register_arrow(def.name.."_2", S("Arrow of "..def.description..desc_mod), def.color, arrow_def_2)
|
||||
if def.color and not def.no_throwable then
|
||||
mcl_potions.register_splash(def.name.."_2", S("Splash @1@2 Potion", def.description, desc_mod), def.color, splash_def_2)
|
||||
mcl_potions.register_lingering(def.name.."_2", S("Lingering @1@2 Potion", def.description, desc_mod), def.color, ling_def_2)
|
||||
if not def.no_arrow then
|
||||
mcl_potions.register_arrow(def.name.."_2", S("Arrow of @1@2", def.description, desc_mod), def.color, arrow_def_2)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -253,14 +293,14 @@ local function register_potion(def)
|
|||
end
|
||||
|
||||
minetest.register_craftitem("mcl_potions:"..def.name.."_plus", {
|
||||
description = S(def.description.." +"),
|
||||
description = S("@1 + Potion", def.description),
|
||||
_tt_help = get_tt(def._tt_plus, |