Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minetest_game
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
minetest_game
Commits
8c977451
Commit
8c977451
authored
12 years ago
by
PilzAdam
Browse files
Options
Downloads
Patches
Plain Diff
Fix modname prefix in stairs and slab functions
parent
73d078fd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mods/stairs/init.lua
+20
-18
20 additions, 18 deletions
mods/stairs/init.lua
with
20 additions
and
18 deletions
mods/stairs/init.lua
+
20
−
18
View file @
8c977451
...
...
@@ -3,9 +3,10 @@
stairs
=
{}
-- Node will be called
stairs
:stair_<subname>
-- Node will be called
modname
:stair_<subname>
function
stairs
.
register_stair
(
subname
,
recipeitem
,
groups
,
images
,
description
,
sounds
)
minetest
.
register_node
(
"stairs:stair_"
..
subname
,
{
local
modname
=
minetest
.
get_current_modname
()
minetest
.
register_node
(
modname
..
":stair_"
..
subname
,
{
description
=
description
,
drawtype
=
"nodebox"
,
tiles
=
images
,
...
...
@@ -29,7 +30,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
local
p0
=
pointed_thing
.
under
local
p1
=
pointed_thing
.
above
if
p0
.
y
-
1
==
p1
.
y
then
local
fakestack
=
ItemStack
(
"stairs
:stair_"
..
subname
..
"upside_down"
)
local
fakestack
=
ItemStack
(
modname
..
"
:stair_"
..
subname
..
"upside_down"
)
local
ret
=
minetest
.
item_place
(
fakestack
,
placer
,
pointed_thing
)
if
ret
:
is_empty
()
then
itemstack
:
take_item
()
...
...
@@ -42,8 +43,8 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
end
,
})
minetest
.
register_node
(
"stairs
:stair_"
..
subname
..
"upside_down"
,
{
drop
=
"stairs
:stair_"
..
subname
,
minetest
.
register_node
(
modname
..
"
:stair_"
..
subname
..
"upside_down"
,
{
drop
=
modname
..
"
:stair_"
..
subname
,
drawtype
=
"nodebox"
,
tiles
=
images
,
paramtype
=
"light"
,
...
...
@@ -61,7 +62,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
})
minetest
.
register_craft
({
output
=
'stairs
:stair_'
..
subname
..
' 4'
,
output
=
modname
..
'
:stair_'
..
subname
..
' 4'
,
recipe
=
{
{
recipeitem
,
""
,
""
},
{
recipeitem
,
recipeitem
,
""
},
...
...
@@ -71,7 +72,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
-- Flipped recipe for the silly minecrafters
minetest
.
register_craft
({
output
=
'stairs
:stair_'
..
subname
..
' 4'
,
output
=
modname
..
'
:stair_'
..
subname
..
' 4'
,
recipe
=
{
{
""
,
""
,
recipeitem
},
{
""
,
recipeitem
,
recipeitem
},
...
...
@@ -80,9 +81,10 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
})
end
-- Node will be called
stairs
:slab_<subname>
-- Node will be called
modname
:slab_<subname>
function
stairs
.
register_slab
(
subname
,
recipeitem
,
groups
,
images
,
description
,
sounds
)
minetest
.
register_node
(
"stairs:slab_"
..
subname
,
{
local
modname
=
minetest
.
get_current_modname
()
minetest
.
register_node
(
modname
..
":slab_"
..
subname
,
{
description
=
description
,
drawtype
=
"nodebox"
,
tiles
=
images
,
...
...
@@ -110,7 +112,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
local
p0
=
pointed_thing
.
under
local
p1
=
pointed_thing
.
above
local
n0
=
minetest
.
env
:
get_node
(
p0
)
if
n0
.
name
==
"stairs
:slab_"
..
subname
and
if
n0
.
name
==
modname
..
"
:slab_"
..
subname
and
p0
.
y
+
1
==
p1
.
y
then
slabpos
=
p0
slabnode
=
n0
...
...
@@ -135,7 +137,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
-- Upside down slabs
if
p0
.
y
-
1
==
p1
.
y
then
-- Turn into full block if pointing at a existing slab
if
n0
.
name
==
"stairs
:slab_"
..
subname
..
"upside_down"
then
if
n0
.
name
==
modname
..
"
:slab_"
..
subname
..
"upside_down"
then
-- Remove the slab at the position of the slab
minetest
.
env
:
remove_node
(
p0
)
-- Make a fake stack of a single item and try to place it
...
...
@@ -153,7 +155,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end
-- Place upside down slab
local
fakestack
=
ItemStack
(
"stairs
:slab_"
..
subname
..
"upside_down"
)
local
fakestack
=
ItemStack
(
modname
..
"
:slab_"
..
subname
..
"upside_down"
)
local
ret
=
minetest
.
item_place
(
fakestack
,
placer
,
pointed_thing
)
if
ret
:
is_empty
()
then
itemstack
:
take_item
()
...
...
@@ -162,10 +164,10 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end
-- If pointing at the side of a upside down slab
if
n0
.
name
==
"stairs
:slab_"
..
subname
..
"upside_down"
and
if
n0
.
name
==
modname
..
"
:slab_"
..
subname
..
"upside_down"
and
p0
.
y
+
1
~=
p1
.
y
then
-- Place upside down slab
local
fakestack
=
ItemStack
(
"stairs
:slab_"
..
subname
..
"upside_down"
)
local
fakestack
=
ItemStack
(
modname
..
"
:slab_"
..
subname
..
"upside_down"
)
local
ret
=
minetest
.
item_place
(
fakestack
,
placer
,
pointed_thing
)
if
ret
:
is_empty
()
then
itemstack
:
take_item
()
...
...
@@ -178,8 +180,8 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end
,
})
minetest
.
register_node
(
"stairs
:slab_"
..
subname
..
"upside_down"
,
{
drop
=
"stairs
:slab_"
..
subname
,
minetest
.
register_node
(
modname
..
"
:slab_"
..
subname
..
"upside_down"
,
{
drop
=
modname
..
"
:slab_"
..
subname
,
drawtype
=
"nodebox"
,
tiles
=
images
,
paramtype
=
"light"
,
...
...
@@ -197,14 +199,14 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
})
minetest
.
register_craft
({
output
=
'stairs
:slab_'
..
subname
..
' 3'
,
output
=
modname
..
'
:slab_'
..
subname
..
' 3'
,
recipe
=
{
{
recipeitem
,
recipeitem
,
recipeitem
},
},
})
end
-- Nodes will be called
stairs
:{stair,slab}_<subname>
-- Nodes will be called
modname
:{stair,slab}_<subname>
function
stairs
.
register_stair_and_slab
(
subname
,
recipeitem
,
groups
,
images
,
desc_stair
,
desc_slab
,
sounds
)
stairs
.
register_stair
(
subname
,
recipeitem
,
groups
,
images
,
desc_stair
,
sounds
)
stairs
.
register_slab
(
subname
,
recipeitem
,
groups
,
images
,
desc_slab
,
sounds
)
...
...
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