Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
homedecor_modpack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
homedecor_modpack
Commits
06342cbd
Commit
06342cbd
authored
8 years ago
by
Vanessa Ezekowitz
Browse files
Options
Downloads
Patches
Plain Diff
make sofas and coffee table place with long axis left-to-right
(e.g. front of sofa faces you)
parent
f32fdad4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lrfurn/coffeetable.lua
+39
-73
39 additions, 73 deletions
lrfurn/coffeetable.lua
lrfurn/init.lua
+13
-5
13 additions, 5 deletions
lrfurn/init.lua
lrfurn/longsofas.lua
+2
-2
2 additions, 2 deletions
lrfurn/longsofas.lua
lrfurn/sofas.lua
+2
-2
2 additions, 2 deletions
lrfurn/sofas.lua
with
56 additions
and
82 deletions
lrfurn/coffeetable.lua
+
39
−
73
View file @
06342cbd
local
S
=
homedecor_i18n
.
gettext
minetest
.
register_node
(
"lrfurn:coffeetable_back"
,
{
--[[
local node = minetest.get_node(pos)
local yaw = placer:get_look_yaw()
local dir = minetest.yaw_to_dir(yaw-1.5)
local fdir = minetest.dir_to_facedir(dir)
print(placer:get_look_yaw(), yaw)
print(node.param2, fdir)
if lrfurn.check_right(pos, fdir, false, placer) then
local pos2 = find_coffee_table_second_node(pos, fdir)
]]
--
local
function
find_second_node
(
pos
,
param2
)
if
param2
==
0
then
pos
.
z
=
pos
.
z
+
1
elseif
param2
==
1
then
pos
.
x
=
pos
.
x
+
1
elseif
param2
==
2
then
pos
.
z
=
pos
.
z
-
1
elseif
param2
==
3
then
pos
.
x
=
pos
.
x
-
1
end
return
pos
end
minetest
.
register_alias
(
"lrfurn:coffeetable_back"
,
"lrfurn:coffeetable"
)
minetest
.
register_alias
(
"lrfurn:coffeetable_front"
,
"air"
)
minetest
.
register_node
(
"lrfurn:coffeetable"
,
{
description
=
S
(
"Coffee Table"
),
drawtype
=
"nodebox"
,
tiles
=
{
"lrfurn_coffeetable_back.png"
,
"lrfurn_coffeetable_back.png"
,
"lrfurn_coffeetable_back.png"
,
"lrfurn_coffeetable_back.png"
,
"lrfurn_coffeetable_back.png"
,
"lrfurn_coffeetable_back.png"
},
...
...
@@ -13,11 +42,12 @@ minetest.register_node("lrfurn:coffeetable_back", {
type
=
"fixed"
,
fixed
=
{
--legs
{
-
0
.
375
,
-
0
.
5
,
-
0
.
375
,
-
0
.
3125
,
-
0
.
0625
,
-
0
.
3125
},
{
0
.
3125
,
-
0
.
5
,
-
0
.
375
,
0
.
375
,
-
0
.
0625
,
-
0
.
3125
},
{
-
0
.
375
,
-
0
.
5
,
-
0
.
375
,
-
0
.
3125
,
-
0
.
0625
,
-
0
.
3125
},
{
0
.
3125
,
-
0
.
5
,
-
0
.
375
,
0
.
375
,
-
0
.
0625
,
-
0
.
3125
},
{
-
0
.
375
,
-
0
.
5
,
1
.
3125
,
-
0
.
3125
,
-
0
.
0625
,
1
.
375
},
{
0
.
3125
,
-
0
.
5
,
1
.
3125
,
0
.
375
,
-
0
.
0625
,
1
.
375
},
--tabletop
{
-
0
.
4375
,
-
0
.
0625
,
-
0
.
4375
,
0
.
4375
,
0
,
0
.
5
},
{
-
0
.
4375
,
-
0
.
0625
,
-
0
.
4375
,
0
.
4375
,
0
,
1
.
437
5
},
}
},
selection_box
=
{
...
...
@@ -30,83 +60,19 @@ minetest.register_node("lrfurn:coffeetable_back", {
after_place_node
=
function
(
pos
,
placer
,
itemstack
,
pointed_thing
)
if
minetest
.
is_protected
(
pos
,
placer
:
get_player_name
())
then
return
true
end
local
node
=
minetest
.
get_node
(
pos
)
local
param2
=
node
.
param2
local
fdir
=
node
.
param2
local
fdir
=
minetest
.
dir_to_facedir
(
placer
:
get_look_dir
(),
false
)
if
lrfurn
.
check_forward
(
pos
,
fdir
,
false
,
placer
)
then
node
.
name
=
"lrfurn:coffeetable_front"
if
param2
==
0
then
pos
.
z
=
pos
.
z
+
1
elseif
param2
==
1
then
pos
.
x
=
pos
.
x
+
1
elseif
param2
==
2
then
pos
.
z
=
pos
.
z
-
1
elseif
param2
==
3
then
pos
.
x
=
pos
.
x
-
1
end
minetest
.
set_node
(
pos
,
node
)
if
lrfurn
.
check_right
(
pos
,
fdir
,
false
,
placer
)
then
minetest
.
set_node
(
pos
,
{
name
=
node
.
name
,
param2
=
(
fdir
+
1
)
%
4
})
else
minetest
.
chat_send_player
(
placer
:
get_player_name
(),
S
(
"No room to place the coffee table!"
))
S
(
"No room to place the coffee table!"
))
minetest
.
set_node
(
pos
,
{
name
=
"air"
})
return
true
end
end
,
after_dig_node
=
function
(
pos
,
oldnode
,
oldmetadata
,
digger
)
if
minetest
.
is_protected
(
pos
,
digger
:
get_player_name
())
then
return
true
end
local
param2
=
oldnode
.
param2
if
param2
==
0
then
pos
.
z
=
pos
.
z
+
1
elseif
param2
==
1
then
pos
.
x
=
pos
.
x
+
1
elseif
param2
==
2
then
pos
.
z
=
pos
.
z
-
1
elseif
param2
==
3
then
pos
.
x
=
pos
.
x
-
1
end
if
minetest
.
is_protected
(
pos
,
digger
:
get_player_name
())
then
return
true
end
if
(
minetest
.
get_node
({
x
=
pos
.
x
,
y
=
pos
.
y
,
z
=
pos
.
z
}).
name
==
"lrfurn:coffeetable_front"
)
and
(
minetest
.
get_node
({
x
=
pos
.
x
,
y
=
pos
.
y
,
z
=
pos
.
z
}).
param2
==
param2
)
then
minetest
.
remove_node
(
pos
)
end
end
,
})
minetest
.
register_node
(
"lrfurn:coffeetable_front"
,
{
drawtype
=
"nodebox"
,
tiles
=
{
"lrfurn_coffeetable_front.png"
,
"lrfurn_coffeetable_front.png"
,
"lrfurn_coffeetable_front.png"
,
"lrfurn_coffeetable_front.png"
,
"lrfurn_coffeetable_front.png"
,
"lrfurn_coffeetable_front.png"
},
paramtype
=
"light"
,
paramtype2
=
"facedir"
,
groups
=
{
snappy
=
1
,
choppy
=
2
,
oddly_breakable_by_hand
=
2
,
flammable
=
3
},
sounds
=
default
.
node_sound_wood_defaults
(),
node_box
=
{
type
=
"fixed"
,
fixed
=
{
--legs
{
-
0
.
375
,
-
0
.
5
,
0
.
3125
,
-
0
.
3125
,
-
0
.
0625
,
0
.
375
},
{
0
.
3125
,
-
0
.
5
,
0
.
3125
,
0
.
375
,
-
0
.
0625
,
0
.
375
},
--tabletop
{
-
0
.
4375
,
-
0
.
0625
,
-
0
.
5
,
0
.
4375
,
0
,
0
.
4375
},
}
},
selection_box
=
{
type
=
"fixed"
,
fixed
=
{
{
0
,
0
,
0
,
0
,
0
,
0
},
}
},
})
minetest
.
register_alias
(
"lrfurn:coffeetable"
,
"lrfurn:coffeetable_back"
)
minetest
.
register_craft
({
output
=
"lrfurn:coffeetable"
,
recipe
=
{
...
...
This diff is collapsed.
Click to expand it.
lrfurn/init.lua
+
13
−
5
View file @
06342cbd
...
...
@@ -2,11 +2,11 @@
lrfurn
=
{}
screwdriver
=
screwdriver
or
{}
lrfurn
.
fdir_to_fwd
=
{
{
0
,
1
},
lrfurn
.
fdir_to_right
=
{
{
1
,
0
},
{
0
,
-
1
},
{
-
1
,
0
},
{
0
,
1
},
}
lrfurn
.
colors
=
{
...
...
@@ -27,11 +27,11 @@ lrfurn.colors = {
"yellow"
,
}
function
lrfurn
.
check_
forward
(
pos
,
fdir
,
long
,
placer
)
function
lrfurn
.
check_
right
(
pos
,
fdir
,
long
,
placer
)
if
not
fdir
or
fdir
>
3
then
fdir
=
0
end
local
pos2
=
{
x
=
pos
.
x
+
lrfurn
.
fdir_to_
fwd
[
fdir
+
1
][
1
],
y
=
pos
.
y
,
z
=
pos
.
z
+
lrfurn
.
fdir_to_
fwd
[
fdir
+
1
][
2
]
}
local
pos3
=
{
x
=
pos
.
x
+
lrfurn
.
fdir_to_
fwd
[
fdir
+
1
][
1
]
*
2
,
y
=
pos
.
y
,
z
=
pos
.
z
+
lrfurn
.
fdir_to_
fwd
[
fdir
+
1
][
2
]
*
2
}
local
pos2
=
{
x
=
pos
.
x
+
lrfurn
.
fdir_to_
right
[
fdir
+
1
][
1
],
y
=
pos
.
y
,
z
=
pos
.
z
+
lrfurn
.
fdir_to_
right
[
fdir
+
1
][
2
]
}
local
pos3
=
{
x
=
pos
.
x
+
lrfurn
.
fdir_to_
right
[
fdir
+
1
][
1
]
*
2
,
y
=
pos
.
y
,
z
=
pos
.
z
+
lrfurn
.
fdir_to_
right
[
fdir
+
1
][
2
]
*
2
}
local
node2
=
minetest
.
get_node
(
pos2
)
if
node2
and
node2
.
name
~=
"air"
then
...
...
@@ -58,6 +58,14 @@ function lrfurn.check_forward(pos, fdir, long, placer)
return
true
end
function
lrfurn
.
fix_sofa_rotation_nsew
(
pos
,
placer
,
itemstack
,
pointed_thing
)
local
node
=
minetest
.
get_node
(
pos
)
local
yaw
=
placer
:
get_look_yaw
()
local
dir
=
minetest
.
yaw_to_dir
(
yaw
-
1
.
5
)
local
fdir
=
minetest
.
dir_to_wallmounted
(
dir
)
minetest
.
swap_node
(
pos
,
{
name
=
node
.
name
,
param2
=
fdir
})
end
dofile
(
minetest
.
get_modpath
(
"lrfurn"
)
..
"/longsofas.lua"
)
dofile
(
minetest
.
get_modpath
(
"lrfurn"
)
..
"/sofas.lua"
)
dofile
(
minetest
.
get_modpath
(
"lrfurn"
)
..
"/armchairs.lua"
)
...
...
This diff is collapsed.
Click to expand it.
lrfurn/longsofas.lua
+
2
−
2
View file @
06342cbd
...
...
@@ -24,13 +24,13 @@ minetest.register_node("lrfurn:longsofa", {
node_box
=
longsofa_cbox
,
on_rotate
=
screwdriver
.
disallow
,
after_place_node
=
function
(
pos
,
placer
,
itemstack
,
pointed_thing
)
unifieddyes
.
fix
_rotation_nsew
(
pos
,
placer
,
itemstack
,
pointed_thing
)
lrfurn
.
fix_sofa
_rotation_nsew
(
pos
,
placer
,
itemstack
,
pointed_thing
)
local
playername
=
placer
:
get_player_name
()
if
minetest
.
is_protected
(
pos
,
placer
:
get_player_name
())
then
return
true
end
local
fdir
=
minetest
.
dir_to_facedir
(
placer
:
get_look_dir
(),
false
)
if
lrfurn
.
check_
forward
(
pos
,
fdir
,
true
,
placer
)
then
if
lrfurn
.
check_
right
(
pos
,
fdir
,
true
,
placer
)
then
if
not
creative
.
is_enabled_for
(
playername
)
then
itemstack
:
take_item
()
end
...
...
This diff is collapsed.
Click to expand it.
lrfurn/sofas.lua
+
2
−
2
View file @
06342cbd
...
...
@@ -24,13 +24,13 @@ minetest.register_node("lrfurn:sofa", {
node_box
=
sofa_cbox
,
on_rotate
=
screwdriver
.
disallow
,
after_place_node
=
function
(
pos
,
placer
,
itemstack
,
pointed_thing
)
unifieddyes
.
fix
_rotation_nsew
(
pos
,
placer
,
itemstack
,
pointed_thing
)
lrfurn
.
fix_sofa
_rotation_nsew
(
pos
,
placer
,
itemstack
,
pointed_thing
)
local
playername
=
placer
:
get_player_name
()
if
minetest
.
is_protected
(
pos
,
placer
:
get_player_name
())
then
return
true
end
local
fdir
=
minetest
.
dir_to_facedir
(
placer
:
get_look_dir
(),
false
)
if
lrfurn
.
check_
forward
(
pos
,
fdir
,
false
,
placer
)
then
if
lrfurn
.
check_
right
(
pos
,
fdir
,
false
,
placer
)
then
if
not
creative
.
is_enabled_for
(
playername
)
then
itemstack
:
take_item
()
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment