Compare commits

...

10 Commits

Author SHA1 Message Date
Niklp
21bbb75b5a
Add player_monoids support (#22)
- Remove deprecated depends.text & description.txt
- Add player_monoids support for sitting
- Add player_monoids to mod dependencies
2024-06-20 17:36:19 +02:00
sfan5
0e4339bceb Make movement check more liberal 2024-04-28 11:17:47 +02:00
sfan5
52ce4f7b94 Replace deprecated set_physics_override call 2024-04-28 11:07:37 +02:00
Niklp
71bff8a884
Move ts_furniture.fr.tr to locale directory 2024-03-15 23:24:01 +01:00
Lemente
5ad00b3f16
add fr.tr (#19) 2024-02-21 14:25:34 +01:00
Thomas--S
3888a1db42
Merge pull request #16 from Niklp09/ignore
ignore group 'tree'
2022-12-02 22:19:34 +01:00
Niklp
547f2667ed
ignore group 'tree' 2022-11-29 14:56:53 +01:00
Thomas--S
6cdb584c85 Dynamically use textures from base nodes 2021-05-17 13:50:34 +02:00
Thomas--S
3efb796721 Add kneeling bench 2021-03-20 11:56:41 +01:00
Thomas--S
d6a34f398f Fix undeclared variable warning 2020-10-06 19:13:13 +02:00
6 changed files with 202 additions and 35 deletions

View File

@ -1,3 +0,0 @@
default
moretrees?
ethereal?

View File

@ -1 +0,0 @@
Adds basic furniture (Chairs, Tables, Small Tables, Tiny Tables, Benches).

114
init.lua
View File

@ -3,9 +3,26 @@ ts_furniture = {}
-- If true, you can sit on chairs and benches, when right-click them.
ts_furniture.enable_sitting = minetest.settings:get_bool("ts_furniture.enable_sitting", true)
ts_furniture.globalstep = minetest.settings:get_bool("ts_furniture.globalstep", true)
ts_furniture.kneeling_bench = minetest.settings:get_bool("ts_furniture.kneeling_bench", false)
-- Used for localization
local S = minetest.get_translator("ts_furniture")
local has_player_monoids = minetest.get_modpath("player_monoids")
-- Get texture by node name
local T = function (node_name)
local def = minetest.registered_nodes[node_name]
if not (def and def.tiles) then
return ""
end
local tile = def.tiles[5] or def.tiles[4] or def.tiles[3] or def.tiles[2] or def.tiles[1]
if type(tile) == "string" then
return tile
elseif type(tile) == "table" and tile.name then
return tile.name
end
return ""
end
-- The following code is from "Get Comfortable [cozy]" (by everamzah; published under WTFPL)
-- Thomas S. modified it, so that it can be used in this mod
@ -13,13 +30,19 @@ if ts_furniture.enable_sitting then
ts_furniture.sit = function(pos, _, player)
local name = player:get_player_name()
if not player_api.player_attached[name] then
if vector.length(player:get_player_velocity()) > 0 then
if vector.length(player:get_velocity()) > 0.5 then
minetest.chat_send_player(player:get_player_name(), 'You can only sit down when you are not moving.')
return
end
player:move_to(pos)
player:set_eye_offset({x = 0, y = -7, z = 2}, {x = 0, y = 0, z = 0})
player:set_physics_override(0, 0, 0)
if has_player_monoids then
player_monoids.speed:add_change(player, 0, "ts_furniture:sit")
player_monoids.jump:add_change(player, 0, "ts_furniture:sit")
player_monoids.gravity:add_change(player, 0, "ts_furniture:sit")
else
player:set_physics_override({speed = 0, jump = 0, gravity = 0})
end
player_api.player_attached[name] = true
minetest.after(0.1, function()
if player then
@ -40,7 +63,13 @@ if ts_furniture.enable_sitting then
ts_furniture.stand = function(player, name)
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
player:set_physics_override(1, 1, 1)
if has_player_monoids then
player_monoids.speed:del_change(player, "ts_furniture:sit")
player_monoids.jump:del_change(player, "ts_furniture:sit")
player_monoids.gravity:del_change(player, "ts_furniture:sit")
else
player:set_physics_override({speed = 1, jump = 1, gravity = 1})
end
player_api.player_attached[name] = false
player_api.set_animation(player, "stand", 30)
end
@ -55,7 +84,7 @@ if ts_furniture.enable_sitting then
local ctrl = player:get_player_control()
if default.player_attached[name] and not player:get_attach() and
(ctrl.up or ctrl.down or ctrl.left or ctrl.right or ctrl.jump) then
ts_furniture.up(_, _, player)
ts_furniture.up(nil, nil, player)
end
end
end)
@ -147,12 +176,37 @@ local furnitures = {
}
}
if ts_furniture.kneeling_bench then
furnitures.kneeling_bench = {
description = "Kneeling Bench",
nodebox = {
{ -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 },
{ -0.4, -0.5, -0.2, -0.3, -0.3, 0.5 },
{ 0.3, -0.5, -0.2, 0.4, -0.3, 0.5 },
{ -0.5, -0.3, -0.2, 0.5, -0.2, 0.2},
{ -0.5, 0.4, 0.15, 0.5, 0.5, 0.55},
},
craft = function(recipe)
local bench_name = "ts_furniture:" .. recipe:gsub(":", "_") .. "_bench"
return {
{ recipe, "" },
{ recipe, bench_name }
}
end
}
end
local ignore_groups = {
["wood"] = true,
["stone"] = true
["stone"] = true,
["tree"] = true
}
function ts_furniture.register_furniture(recipe, description, tiles)
if not tiles then
tiles = T(recipe)
end
local recipe_def = minetest.registered_items[recipe]
if not recipe_def then
return
@ -196,34 +250,34 @@ function ts_furniture.register_furniture(recipe, description, tiles)
end
end
ts_furniture.register_furniture("default:aspen_wood", "Aspen", "default_aspen_wood.png")
ts_furniture.register_furniture("default:pine_wood", "Pine", "default_pine_wood.png")
ts_furniture.register_furniture("default:acacia_wood", "Acacia", "default_acacia_wood.png")
ts_furniture.register_furniture("default:wood", "Wooden", "default_wood.png")
ts_furniture.register_furniture("default:junglewood", "Jungle Wood", "default_junglewood.png")
ts_furniture.register_furniture("default:aspen_wood", "Aspen")
ts_furniture.register_furniture("default:pine_wood", "Pine")
ts_furniture.register_furniture("default:acacia_wood", "Acacia")
ts_furniture.register_furniture("default:wood", "Wooden")
ts_furniture.register_furniture("default:junglewood", "Jungle Wood")
if (minetest.get_modpath("moretrees")) then
ts_furniture.register_furniture("moretrees:apple_tree_planks", "Apple Tree", "moretrees_apple_tree_wood.png")
ts_furniture.register_furniture("moretrees:beech_planks", "Beech", "moretrees_beech_wood.png")
ts_furniture.register_furniture("moretrees:birch_planks", "Birch", "moretrees_birch_wood.png")
ts_furniture.register_furniture("moretrees:fir_planks", "Fir", "moretrees_fir_wood.png")
ts_furniture.register_furniture("moretrees:oak_planks", "Oak", "moretrees_oak_wood.png")
ts_furniture.register_furniture("moretrees:palm_planks", "Palm", "moretrees_palm_wood.png")
ts_furniture.register_furniture("moretrees:rubber_tree_planks", "Rubber Tree", "moretrees_rubber_tree_wood.png")
ts_furniture.register_furniture("moretrees:sequoia_planks", "Sequoia", "moretrees_sequoia_wood.png")
ts_furniture.register_furniture("moretrees:spruce_planks", "Spruce", "moretrees_spruce_wood.png")
ts_furniture.register_furniture("moretrees:willow_planks", "Willow", "moretrees_willow_wood.png")
ts_furniture.register_furniture("moretrees:apple_tree_planks", "Apple Tree")
ts_furniture.register_furniture("moretrees:beech_planks", "Beech")
ts_furniture.register_furniture("moretrees:birch_planks", "Birch")
ts_furniture.register_furniture("moretrees:fir_planks", "Fir")
ts_furniture.register_furniture("moretrees:oak_planks", "Oak")
ts_furniture.register_furniture("moretrees:palm_planks", "Palm")
ts_furniture.register_furniture("moretrees:rubber_tree_planks", "Rubber Tree")
ts_furniture.register_furniture("moretrees:sequoia_planks", "Sequoia")
ts_furniture.register_furniture("moretrees:spruce_planks", "Spruce")
ts_furniture.register_furniture("moretrees:willow_planks", "Willow")
end
if minetest.get_modpath("ethereal") then
ts_furniture.register_furniture("ethereal:banana_wood", "Banana", "banana_wood.png")
ts_furniture.register_furniture("ethereal:birch_wood", "Birch", "moretrees_birch_wood.png")
ts_furniture.register_furniture("ethereal:frost_wood", "Frost", "frost_wood.png")
ts_furniture.register_furniture("ethereal:mushroom_trunk", "Mushroom", "mushroom_trunk.png")
ts_furniture.register_furniture("ethereal:palm_wood", "Palm", "moretrees_palm_wood.png")
ts_furniture.register_furniture("ethereal:redwood_wood", "Redwood", "redwood_wood.png")
ts_furniture.register_furniture("ethereal:sakura_wood", "Sakura", "ethereal_sakura_wood.png")
ts_furniture.register_furniture("ethereal:scorched_tree", "Scorched", "scorched_tree.png")
ts_furniture.register_furniture("ethereal:willow_wood", "Willow", "willow_wood.png")
ts_furniture.register_furniture("ethereal:yellow_wood", "Healing Tree", "yellow_wood.png")
ts_furniture.register_furniture("ethereal:banana_wood", "Banana")
ts_furniture.register_furniture("ethereal:birch_wood", "Birch")
ts_furniture.register_furniture("ethereal:frost_wood", "Frost")
ts_furniture.register_furniture("ethereal:mushroom_trunk", "Mushroom")
ts_furniture.register_furniture("ethereal:palm_wood", "Palm")
ts_furniture.register_furniture("ethereal:redwood_wood", "Redwood")
ts_furniture.register_furniture("ethereal:sakura_wood", "Sakura")
ts_furniture.register_furniture("ethereal:scorched_tree", "Scorched")
ts_furniture.register_furniture("ethereal:willow_wood", "Willow")
ts_furniture.register_furniture("ethereal:yellow_wood", "Healing Tree")
end

116
locale/ts_furniture.fr.tr Normal file
View File

@ -0,0 +1,116 @@
# textdomain:ts_furniture
Aspen Small Table=Petite table en bois de tremble
Aspen Tiny Table=Table basse en bois de tremble
Aspen Bench=Banc en bois de tremble
Aspen Table=Table en bois de tremble
Aspen Chair=Chaise en bois de tremble
Pine Small Table=Petite table en bois de pin
Pine Tiny Table=Table basse en bois de pin
Pine Bench=Banc en bois de pin
Pine Table=Table en bois de pin
Pine Chair=Chaise en bois de pin
Acacia Small Table=Petite table en bois d'acacia
Acacia Tiny Table=Petite table en bois d'acacia
Acacia Bench=Banc en bois d'acacia
Acacia Table=Table en bois d'acacia
Acacia Chair=Chaise en bois d'acacia
Wooden Small Table=Petite table en bois
Wooden Tiny Table=Table basse en bois
Wooden Bench=Banc en bois
Wooden Table=Table en bois
Wooden Chair=Chaise en bois
Jungle Wood Small Table=Petite table en bois de la jungle
Jungle Wood Tiny Table=Table basse en bois de la jungle
Jungle Wood Bench=Banc en bois de la jungle
Jungle Wood Table=Table en bois de la jungle
Jungle Wood Chair=Chaise en bois de la jungle
Apple Tree Small Table=Petite table en bois de pommier
Apple Tree Tiny Table=Table basse en bois de pommier
Apple Tree Bench=Banc en bois de pommier
Apple Tree Table=Table en bois de pommier
Apple Tree Chair=Chaise en bois de pommier
Beech Small Table=Petite table en bois de hêtre
Beech Tiny Table=Table basse en bois de hêtre
Beech Bench=Banc en bois de hêtre
Beech Table=Table en bois de hêtre
Beech Chair=Chaise en bois de hêtre
Birch Small Table=Petite table en bois de bouleau
Birch Tiny Table=Table basse en bois de bouleau
Birch Bench=Banc en bois de bouleau
Birch Table=Table en bois de bouleau
Birch Chair=Chaise en bois de bouleau
Fir Small Table=Petite table en bois de sapin
Fir Tiny Table=Table basse en bois de sapin
Fir Bench=Banc en bois de sapin
Fir Table=Table en bois de sapin
Fir Chair=Chaise en bois de sapin
Oak Small Table=Petite table en bois de chêne
Oak Tiny Table=Table basse en bois de chêne
Oak Bench=Banc en bois de chêne
Oak Table=Table en bois de chêne
Oak Chair=Chaise en bois de chêne
Palm Small Table=Petite table en bois de palmier
Palm Tiny Table=Table basse en bois de palmier
Palm Bench=Banc en bois de palmier
Palm Table=Table en bois de palmier
Palm Chair=Chaise en bois de palmier
Rubber Tree Small Table=Petite table en bois d'arbre à caoutchouc
Rubber Tree Tiny Table=Table basse en bois d'arbre à caoutchouc
Rubber Tree Bench=Banc en bois d'arbre à caoutchouc
Rubber Tree Table=Table en bois d'arbre à caoutchouc
Rubber Tree Chair=Chaise en bois d'arbre à caoutchouc
Sequoia Small Table=Petite table en bois de sequoia
Sequoia Tiny Table=Table basse en bois de sequoia
Sequoia Bench=Banc en bois de sequoia
Sequoia Table=Table en bois de sequoia
Sequoia Chair=Chaise en bois de sequoia
Spruce Small Table=Petite table en bois d'épicéa
Spruce Tiny Table=Table basse en bois d'épicéa
Spruce Bench=Banc en bois d'épicéa
Spruce Table=Table en bois d'épicéa
Spruce Chair=Chaise en bois d'épicéa
Willow Small Table=Petite table en bois de saule
Willow Tiny Table=Table basse en bois de saule
Willow Bench=Banc en bois de saule
Willow Table=Table en bois de saule
Willow Chair=Chaise en bois de saule
Banana Small Table=Petite table en bois de bananier
Banana Tiny Table=Table basse en bois de bananier
Banana Bench=Banc en bois de bananier
Banana Table=Table en bois de bananier
Banana Chair=Chaise en bois de bananier
Frost Small Table=Petite table en bois de givrier
Frost Tiny Table=Table basse en bois de givrier
Frost Bench=Banc en bois de givrier
Frost Table=Table en bois de givrier
Frost Chair=Chaise en bois de givrier
Mushroom Small Table=Petite table en champignon
Mushroom Tiny Table=Table basse en champignon
Mushroom Bench=Banc en champignon
Mushroom Table=Table en champignon
Mushroom Chair=Chaise en champignon
Palm Small Table=Petite table en bois de palmier
Palm Tiny Table=Table basse en bois de palmier
Palm Bench=Banc en bois de palmier
Palm Table=Table en bois de palmier
Palm Chair=Chaise en bois de palmier
Redwood Small Table=Petite table en bois de séquoia
Redwood Tiny Table=Table basse en bois de séquoia
Redwood Bench=Banc en bois de séquoia
Redwood Table=Table en bois de séquoia
Redwood Chair=Chaise en bois de séquoia
Sakura Small Table=Petite table en bois de cerisier du Japon
Sakura Tiny Table=Table basse en bois de cerisier du Japon
Sakura Bench=Banc en bois de cerisier du Japon
Sakura Table=Table en bois de cerisier du Japon
Sakura Chair=Chaise en bois de cerisier du Japon
Scorched Small Table=Petite table en bois brûlé
Scorched Tiny Table=Table basse en bois brûlé
Scorched Bench=Banc en bois brûlé
Scorched Table=Table en bois brûlé
Scorched Chair=Chaise en bois brûlé
Healing Tree Small Table=Petite table en bois de soignantier
Healing Tree Tiny Table=Table basse en bois de soignantier
Healing Tree Bench=Banc en bois de soignantier
Healing Tree Table=Table en bois de soignantier
Healing Tree Chair=Chaise en bois de soignantier

View File

@ -1,4 +1,4 @@
name = ts_furniture
depends = default
optional_depends = moretrees, ethereal
optional_depends = moretrees, ethereal, player_monoids
description = Adds basic furniture (Chairs, Tables, Small Tables, Tiny Tables, Benches).

View File

@ -1,2 +1,3 @@
ts_furniture.enable_sitting (Enable sitting) bool true
ts_furniture.globalstep (Enable globalstep) bool true
ts_furniture.kneeling_bench (Enable kneeling benches) bool false