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
9a32904b
Commit
9a32904b
authored
9 years ago
by
Vanessa Ezekowitz
Browse files
Options
Downloads
Patches
Plain Diff
add free-space checking for sofas
parent
2b5d0747
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lrfurn/init.lua
+29
-0
29 additions, 0 deletions
lrfurn/init.lua
lrfurn/longsofas.lua
+12
-0
12 additions, 0 deletions
lrfurn/longsofas.lua
lrfurn/sofas.lua
+13
-2
13 additions, 2 deletions
lrfurn/sofas.lua
with
54 additions
and
2 deletions
lrfurn/init.lua
+
29
−
0
View file @
9a32904b
-- LRfurn mod by thefamilygrog66
lrfurn
=
{}
lrfurn
.
fdir_to_fwd
=
{
{
0
,
1
},
{
1
,
0
},
{
0
,
-
1
},
{
-
1
,
0
},
}
function
lrfurn
.
check_forward
(
pos
,
fdir
,
long
)
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
node2
=
minetest
.
get_node
(
pos2
)
if
node2
and
node2
.
name
~=
"air"
then
return
false
end
if
long
then
local
node3
=
minetest
.
get_node
(
pos3
)
if
node3
and
node3
.
name
~=
"air"
then
return
false
end
end
return
true
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
+
12
−
0
View file @
9a32904b
...
...
@@ -32,6 +32,18 @@ for i in ipairs(longsofas_list) do
{
-
0
.
5
,
-
0
.
5
,
-
0
.
5
,
0
.
5
,
0
.
5
,
2
.
5
},
}
},
on_place
=
function
(
itemstack
,
placer
,
pointed_thing
)
local
pos
=
pointed_thing
.
above
local
fdir
=
minetest
.
dir_to_facedir
(
placer
:
get_look_dir
(),
false
)
if
lrfurn
.
check_forward
(
pos
,
fdir
,
true
)
then
minetest
.
set_node
(
pos
,
{
name
=
"lrfurn:longsofa_"
..
colour
,
param2
=
fdir
})
itemstack
:
take_item
()
else
minetest
.
chat_send_player
(
placer
:
get_player_name
(),
"No room to place the sofa!"
)
end
return
itemstack
end
,
on_rightclick
=
function
(
pos
,
node
,
clicker
)
if
not
clicker
:
is_player
()
then
return
...
...
This diff is collapsed.
Click to expand it.
lrfurn/sofas.lua
+
13
−
2
View file @
9a32904b
...
...
@@ -29,10 +29,21 @@ for i in ipairs(sofas_list) do
selection_box
=
{
type
=
"fixed"
,
fixed
=
{
{
-
0
.
5
,
-
0
.
5
,
-
0
.
5
,
0
.
5
,
0
.
5
,
1
.
5
},
}
{
-
0
.
5
,
-
0
.
5
,
-
0
.
5
,
0
.
5
,
0
.
5
,
1
.
5
},
}
},
on_place
=
function
(
itemstack
,
placer
,
pointed_thing
)
local
pos
=
pointed_thing
.
above
local
fdir
=
minetest
.
dir_to_facedir
(
placer
:
get_look_dir
(),
false
)
if
lrfurn
.
check_forward
(
pos
,
fdir
,
true
)
then
minetest
.
set_node
(
pos
,
{
name
=
"lrfurn:sofa_"
..
colour
,
param2
=
fdir
})
itemstack
:
take_item
()
else
minetest
.
chat_send_player
(
placer
:
get_player_name
(),
"No room to place the sofa!"
)
end
return
itemstack
end
,
on_rightclick
=
function
(
pos
,
node
,
clicker
)
if
not
clicker
:
is_player
()
then
return
...
...
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