Compare commits

..

3 Commits

Author SHA1 Message Date
kno10 d1846b4dc1 Add CC0 fox sounds, taming, breeding. 2024-11-12 00:20:19 +01:00
kno10 a19e16cbd9 Add fox basics 2024-11-12 00:20:19 +01:00
kno10 5d3d6470b8 Rewrite the head swivel code math 2024-11-12 00:19:54 +01:00
7 changed files with 23 additions and 69 deletions

View File

@ -399,11 +399,11 @@ function mob_class:check_head_swivel(dtime)
end end
-- 0.02 is about 1.14 degrees tolerance, to update less often -- 0.02 is about 1.14 degrees tolerance, to update less often
if math.abs(oldr.x-newr.x) + math.abs(oldr.y-newr.y) + math.abs(oldr.z-newr.z) < 0.02 and vector.equals(oldp, vector.zero()) then return end if math.abs(oldr.x-newr.x) + math.abs(oldr.y-newr.y) + math.abs(oldr.z-newr.z) < 0.02 then return end
if self.object.get_bone_override then -- minetest >= 5.9 if self.object.get_bone_override then -- minetest >= 5.9
self.object:set_bone_override(self.head_swivel, { self.object:set_bone_override(self.head_swivel, {
position = { vec = self.head_bone_position, absolute = true }, --position = { vec = vector.zero(), absolute = false },
rotation = { vec = newr, absolute = true, interpolation = 0.1 } }) rotation = { vec = newr, absolute = true, interpolation = 0.1 } })
else -- minetest < 5.9 else -- minetest < 5.9
-- old API uses degrees not radians and absolute positions -- old API uses degrees not radians and absolute positions

View File

@ -23,7 +23,7 @@ local cow_def = {
}, }, }, },
head_swivel = "head.control", head_swivel = "head.control",
head_eye_height = 1.1, head_eye_height = 1.1,
head_bone_position = vector.new( 0, 10, 0 ), -- for minetest <= 5.8 head_bone_position = vector.new( 0, 6.3, 0 ), -- for minetest <= 5.8
curiosity = 2, curiosity = 2,
head_yaw="z", head_yaw="z",
makes_footstep_sound = true, makes_footstep_sound = true,

View File

@ -418,18 +418,6 @@ minetest.register_on_joinplayer(function(player)
end end
end) end)
---@param player mt.PlayerObjectRef
local function is_touch_enabled(playername)
-- Minetest < 5.7.0 support
if not minetest.get_player_window_information then
return false
end
local window = minetest.get_player_window_information(playername)
-- Always return a boolean (not nil) to avoid false-negatives when
-- comparing to a boolean later.
return window and window.touch_controls or false
end
---@param player mt.PlayerObjectRef ---@param player mt.PlayerObjectRef
function mcl_inventory.set_creative_formspec(player) function mcl_inventory.set_creative_formspec(player)
local playername = player:get_player_name() local playername = player:get_player_name()
@ -578,10 +566,8 @@ function mcl_inventory.set_creative_formspec(player)
bg_img = "crafting_creative_inactive" .. button_bg_postfix[this_tab] .. ".png" bg_img = "crafting_creative_inactive" .. button_bg_postfix[this_tab] .. ".png"
end end
return table.concat({ return table.concat({
"style[" .. this_tab .. ";border=false;bgimg=;bgimg_pressed=]", "style[" .. this_tab .. ";border=false;bgimg=;bgimg_pressed=;noclip=true]",
"style[" .. this_tab .. "_outer;border=false;bgimg=" .. bg_img .. "image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]",
";bgimg_pressed=" .. bg_img .. "]",
"button[" .. offset[this_tab] .. ";1.5,1.44;" .. this_tab .. "_outer;]",
"item_image_button[" .. boffset[this_tab] .. ";1,1;" .. tab_icon[this_tab] .. ";" .. this_tab .. ";]", "item_image_button[" .. boffset[this_tab] .. ";1,1;" .. tab_icon[this_tab] .. ";" .. this_tab .. ";]",
}) })
end end
@ -591,21 +577,11 @@ function mcl_inventory.set_creative_formspec(player)
caption = "label[0.375,0.375;" .. F(C(mcl_formspec.label_color, filtername[name])) .. "]" caption = "label[0.375,0.375;" .. F(C(mcl_formspec.label_color, filtername[name])) .. "]"
end end
local touch_enabled = is_touch_enabled(playername)
players[playername].last_touch_enabled = touch_enabled
local formspec = table.concat({ local formspec = table.concat({
"formspec_version[6]", "formspec_version[6]",
-- Original formspec height was 8.75, increased to include tab buttons. "size[13,8.75]",
-- This avoids tab buttons going off-screen with high scaling values.
"size[13,11.43]",
-- Use as much space as possible on mobile - the tab buttons are a lot
-- of padding already.
touch_enabled and "padding[-0.015,-0.015]" or "",
"no_prepend[]", mcl_vars.gui_nonbg, mcl_vars.gui_bg_color, "style_type[image;noclip=true]",
"background9[0,1.34;13,8.75;mcl_base_textures_background9.png;;7]",
"container[0,1.34]",
-- Hotbar -- Hotbar
mcl_formspec.get_itemslot_bg_v4(0.375, 7.375, 9, 1), mcl_formspec.get_itemslot_bg_v4(0.375, 7.375, 9, 1),
@ -662,7 +638,6 @@ function mcl_inventory.set_creative_formspec(player)
"set_focus[search;true]", "set_focus[search;true]",
}) })
end end
formspec = formspec .. "container_end[]"
if pagenum then formspec = formspec .. "p" .. tostring(pagenum) end if pagenum then formspec = formspec .. "p" .. tostring(pagenum) end
player:set_inventory_formspec(formspec) player:set_inventory_formspec(formspec)
end end
@ -680,54 +655,54 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name() local name = player:get_player_name()
if fields.blocks or fields.blocks_outer then if fields.blocks then
if players[name].page == "blocks" then return end if players[name].page == "blocks" then return end
set_inv_page("blocks", player) set_inv_page("blocks", player)
page = "blocks" page = "blocks"
elseif fields.deco or fields.deco_outer then elseif fields.deco then
if players[name].page == "deco" then return end if players[name].page == "deco" then return end
set_inv_page("deco", player) set_inv_page("deco", player)
page = "deco" page = "deco"
elseif fields.redstone or fields.redstone_outer then elseif fields.redstone then
if players[name].page == "redstone" then return end if players[name].page == "redstone" then return end
set_inv_page("redstone", player) set_inv_page("redstone", player)
page = "redstone" page = "redstone"
elseif fields.rail or fields.rail_outer then elseif fields.rail then
if players[name].page == "rail" then return end if players[name].page == "rail" then return end
set_inv_page("rail", player) set_inv_page("rail", player)
page = "rail" page = "rail"
elseif fields.misc or fields.misc_outer then elseif fields.misc then
if players[name].page == "misc" then return end if players[name].page == "misc" then return end
set_inv_page("misc", player) set_inv_page("misc", player)
page = "misc" page = "misc"
elseif fields.nix or fields.nix_outer then elseif fields.nix then
set_inv_page("all", player) set_inv_page("all", player)
page = "nix" page = "nix"
elseif fields.food or fields.food_outer then elseif fields.food then
if players[name].page == "food" then return end if players[name].page == "food" then return end
set_inv_page("food", player) set_inv_page("food", player)
page = "food" page = "food"
elseif fields.tools or fields.tools_outer then elseif fields.tools then
if players[name].page == "tools" then return end if players[name].page == "tools" then return end
set_inv_page("tools", player) set_inv_page("tools", player)
page = "tools" page = "tools"
elseif fields.combat or fields.combat_outer then elseif fields.combat then
if players[name].page == "combat" then return end if players[name].page == "combat" then return end
set_inv_page("combat", player) set_inv_page("combat", player)
page = "combat" page = "combat"
elseif fields.mobs or fields.mobs_outer then elseif fields.mobs then
if players[name].page == "mobs" then return end if players[name].page == "mobs" then return end
set_inv_page("mobs", player) set_inv_page("mobs", player)
page = "mobs" page = "mobs"
elseif fields.brew or fields.brew_outer then elseif fields.brew then
if players[name].page == "brew" then return end if players[name].page == "brew" then return end
set_inv_page("brew", player) set_inv_page("brew", player)
page = "brew" page = "brew"
elseif fields.matr or fields.matr_outer then elseif fields.matr then
if players[name].page == "matr" then return end if players[name].page == "matr" then return end
set_inv_page("matr", player) set_inv_page("matr", player)
page = "matr" page = "matr"
elseif fields.inv or fields.inv_outer then elseif fields.inv then
if players[name].page == "inv" then return end if players[name].page == "inv" then return end
page = "inv" page = "inv"
elseif fields.search == "" and not fields.creative_next and not fields.creative_prev then elseif fields.search == "" and not fields.creative_next and not fields.creative_prev then
@ -843,19 +818,3 @@ minetest.register_on_player_inventory_action(function(player, action, inventory,
player:get_inventory():set_stack("main", inventory_info.index, stack) player:get_inventory():set_stack("main", inventory_info.index, stack)
end end
end) end)
-- This is necessary because get_player_window_information may return nil in
-- on_joinplayer.
-- (Also, Minetest plans to add support for toggling touchscreen mode in-game.)
minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
if minetest.is_creative_enabled(name) then
local touch_enabled = is_touch_enabled(name)
if touch_enabled ~= players[name].last_touch_enabled then
mcl_inventory.set_creative_formspec(player)
end
end
end
end)

View File

@ -1,5 +1,6 @@
# textdomain: mcl_bone_meal # textdomain: mcl_bone_meal
Bone Meal=Farine d'Os Bone Meal=Farine d'Os
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et est également utile comme engrais pour accélérer la croissance de nombreuses plantes. Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et est également utile comme engrais pour accélérer la croissance de nombreuses plantes.
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Cependant, toutes les plantes ne peuvent pas être fertilisées de cette manière. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent autour. Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=
Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Cependant, toutes les plantes ne peuvent pas être fertilisées de cette manière. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent autour.
Speeds up plant growth=Accélère la croissance des plantes Speeds up plant growth=Accélère la croissance des plantes

View File

@ -169,7 +169,6 @@ S("The speed and damage of the arrow increases the longer you charge. The regula
return itemstack return itemstack
end, end,
groups = {weapon=1,weapon_ranged=1,bow=1,cannot_block=1,enchantability=1}, groups = {weapon=1,weapon_ranged=1,bow=1,cannot_block=1,enchantability=1},
touch_interaction = "short_dig_long_place",
_mcl_uses = 385, _mcl_uses = 385,
}) })
@ -236,7 +235,6 @@ for level=0, 2 do
on_place = function(itemstack) on_place = function(itemstack)
return itemstack return itemstack
end, end,
touch_interaction = "short_dig_long_place",
_mcl_uses = 385, _mcl_uses = 385,
}) })
end end

View File

@ -159,7 +159,6 @@ S("The speed and damage of the arrow increases the longer you charge. The regula
return itemstack return itemstack
end, end,
groups = {weapon=1,weapon_ranged=1,crossbow=1,cannot_block=1,enchantability=1}, groups = {weapon=1,weapon_ranged=1,crossbow=1,cannot_block=1,enchantability=1},
touch_interaction = "short_dig_long_place",
_mcl_uses = 326, _mcl_uses = 326,
}) })
@ -195,7 +194,6 @@ S("The speed and damage of the arrow increases the longer you charge. The regula
return itemstack return itemstack
end, end,
groups = {weapon=1,weapon_ranged=1,crossbow=1,cannot_block=1,enchantability=1,not_in_creative_inventory=1}, groups = {weapon=1,weapon_ranged=1,crossbow=1,cannot_block=1,enchantability=1,not_in_creative_inventory=1},
touch_interaction = "short_dig_long_place",
_mcl_uses = 326, _mcl_uses = 326,
}) })
@ -259,7 +257,6 @@ for level=0, 2 do
on_place = function(itemstack) on_place = function(itemstack)
return itemstack return itemstack
end, end,
touch_interaction = "short_dig_long_place",
_mcl_uses = 385, _mcl_uses = 385,
}) })
end end

View File

@ -6,7 +6,6 @@ minetest.register_tool("mcl_spyglass:spyglass",{
inventory_image = "mcl_spyglass.png", inventory_image = "mcl_spyglass.png",
stack_max = 1, stack_max = 1,
_mcl_toollike_wield = true, _mcl_toollike_wield = true,
touch_interaction = "short_dig_long_place",
}) })
minetest.register_craft({ minetest.register_craft({