Merge branch 'beddrop' into 1.1
Fix the bed drop bug
This commit is contained in:
commit
41a45a8974
@ -87,8 +87,10 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
||||
local yaw, param2 = get_look_yaw(bed_pos)
|
||||
player:set_look_horizontal(yaw)
|
||||
local dir = minetest.facedir_to_dir(param2)
|
||||
local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y, z = bed_pos.z + dir.z / 2}
|
||||
local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y + 0.5, z = bed_pos.z + dir.z / 2}
|
||||
print(dump(player:get_physics_override()))
|
||||
player:set_physics_override(0, 0, 0)
|
||||
print(dump(player:get_physics_override()))
|
||||
player:setpos(p)
|
||||
default.player_attached[name] = true
|
||||
hud_flags.wielditem = false
|
||||
|
@ -82,6 +82,7 @@ minetest.register_node("farming:carrot_4", {
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
mature = true,
|
||||
})
|
||||
|
||||
minetest.register_node("farming:carrot_5", {
|
||||
@ -98,4 +99,4 @@ minetest.register_node("farming:carrot_5", {
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
})
|
||||
|
@ -86,6 +86,7 @@ minetest.register_node("farming:corn_4", {
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
mature = true,
|
||||
})
|
||||
|
||||
minetest.register_node("farming:corn_5", {
|
||||
@ -103,4 +104,4 @@ minetest.register_node("farming:corn_5", {
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
})
|
||||
|
@ -144,7 +144,7 @@ end
|
||||
|
||||
-- Growth Logic
|
||||
|
||||
local STAGE_LENGTH_AVG = 160.0
|
||||
local STAGE_LENGTH_AVG = 320.0
|
||||
local STAGE_LENGTH_DEV = STAGE_LENGTH_AVG / 6
|
||||
local MIN_LIGHT = 13
|
||||
local MAX_LIGHT = 1000
|
||||
@ -268,9 +268,12 @@ local function set_growing(pos, stages_left)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
if stages_left > 0 then
|
||||
if not timer:is_started() then
|
||||
local stage_length = statistics.normal(STAGE_LENGTH_AVG, STAGE_LENGTH_DEV)
|
||||
stage_length = clamp(stage_length, 0.5 * STAGE_LENGTH_AVG, 3.0 * STAGE_LENGTH_AVG)
|
||||
timer:set(stage_length, -0.5 * math.random() * STAGE_LENGTH_AVG)
|
||||
--local stage_length = statistics.normal(STAGE_LENGTH_AVG, STAGE_LENGTH_DEV)
|
||||
--stage_length = clamp(stage_length, 0.5 * STAGE_LENGTH_AVG, 3.0 * STAGE_LENGTH_AVG)
|
||||
--local grow_time = -0.5 * math.random() * STAGE_LENGTH_AVG
|
||||
--timer:set(stage_length, grow_time)
|
||||
timer:start(math.random(STAGE_LENGTH_AVG - (STAGE_LENGTH_AVG * 0.15),
|
||||
STAGE_LENGTH_AVG + (STAGE_LENGTH_AVG * 0.15)))
|
||||
end
|
||||
elseif timer:is_started() then
|
||||
timer:stop()
|
||||
@ -329,6 +332,11 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
|
||||
local max_growth = #stages.stages_left
|
||||
if max_growth <= 0 then return false end
|
||||
|
||||
local mature = minetest.registered_nodes[node_name].mature
|
||||
if mature and math.random(100) < 95 then
|
||||
return true
|
||||
end
|
||||
|
||||
if stages.plant_name == "farming:cocoa" then
|
||||
if not minetest.find_node_near(pos, 1, { "default:jungletree", "moretrees:jungletree_leaves_green" }) then
|
||||
return true
|
||||
@ -442,7 +450,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
|
||||
|
||||
-- can I replace above node, and am I pointing at soil
|
||||
if not minetest.registered_nodes[above.name].buildable_to
|
||||
or minetest.get_item_group(under.name, "soil") < 2
|
||||
or minetest.get_item_group(under.name, "soil") < 2
|
||||
-- avoid multiple seed placement bug
|
||||
or minetest.get_item_group(above.name, "plant") ~= 0 then
|
||||
return
|
||||
@ -484,7 +492,6 @@ farming.register_plant = function(name, def)
|
||||
if not def.steps then
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Register seed
|
||||
minetest.register_node(":" .. mname .. ":seed_" .. pname, {
|
||||
description = def.description,
|
||||
@ -519,7 +526,7 @@ farming.register_plant = function(name, def)
|
||||
{items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
local g = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, growing = 1}
|
||||
-- Last step doesn't need growing=1 so Abm never has to check these
|
||||
if i == def.steps then
|
||||
@ -552,4 +559,4 @@ farming.register_plant("farming:cotton", {
|
||||
description = "Cotton2 seed",
|
||||
inventory_image = "farming_cotton_seed.png",
|
||||
steps = 8,
|
||||
})]]
|
||||
})]]
|
||||
|
@ -1,4 +1,4 @@
|
||||
local function register_plant(name, min, max, spawnby, num)
|
||||
local function register_plant(name, y_min, y_max, spawnby, num)
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = {"default:dirt_with_grass", "mapgen:dirt_with_leafy_grass",},
|
||||
@ -11,8 +11,8 @@ local function register_plant(name, min, max, spawnby, num)
|
||||
octaves = 3,
|
||||
persist = 0.6
|
||||
},
|
||||
y_min = min,
|
||||
y_max = max,
|
||||
y_min = y_min,
|
||||
y_max = y_max,
|
||||
decoration = "farming:" .. name,
|
||||
spawn_by = spawnby,
|
||||
num_spawn_by = num,
|
||||
|
@ -354,4 +354,4 @@ minetest.register_node("farming:cut_melon_5", {
|
||||
minetest.remove_node(pos)
|
||||
clicker:set_hp(clicker:get_hp()+1)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
@ -82,6 +82,7 @@ minetest.register_node("farming:potato_4", {
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
mature = true,
|
||||
})
|
||||
|
||||
minetest.register_node("farming:potato_5", {
|
||||
@ -98,4 +99,4 @@ minetest.register_node("farming:potato_5", {
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
})
|
||||
|
@ -82,6 +82,7 @@ minetest.register_node("farming:raddish_4", {
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
mature = true,
|
||||
})
|
||||
|
||||
minetest.register_node("farming:raddish_5", {
|
||||
@ -98,4 +99,4 @@ minetest.register_node("farming:raddish_5", {
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user