Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xdecor
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
xdecor
Commits
16ea4a73
Commit
16ea4a73
authored
8 years ago
by
JPG
Browse files
Options
Downloads
Patches
Plain Diff
Style cleaning
parent
4e9af954
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/nodes.lua
+29
-21
29 additions, 21 deletions
src/nodes.lua
src/workbench.lua
+17
-14
17 additions, 14 deletions
src/workbench.lua
with
46 additions
and
35 deletions
src/nodes.lua
+
29
−
21
View file @
16ea4a73
...
...
@@ -172,27 +172,29 @@ for _, c in pairs({"red"}) do -- Add more curtains colors simply here
description
=
c
:
gsub
(
"^%l"
,
string.upper
)
..
" Curtain"
,
walkable
=
false
,
tiles
=
{
"wool_white.png^[colorize:"
..
c
..
":170"
},
inventory_image
=
"wool_white.png^[colorize:"
..
c
..
":170^xdecor_curtain_open_overlay.png^[makealpha:255,126,126"
,
inventory_image
=
"wool_white.png^[colorize:"
..
c
..
":170^xdecor_curtain_open_overlay.png^[makealpha:255,126,126"
,
wield_image
=
"wool_white.png^[colorize:"
..
c
..
":170"
,
drawtype
=
"signlike"
,
paramtype2
=
"wallmounted"
,
groups
=
{
dig_immediate
=
3
,
flammable
=
3
},
selection_box
=
{
type
=
"wallmounted"
},
on_rightclick
=
function
(
pos
,
node
,
clicker
,
itemstack
,
pointed_thing
)
on_rightclick
=
function
(
pos
,
node
,
_
,
itemstack
)
minetest
.
set_node
(
pos
,
{
name
=
"xdecor:curtain_open_"
..
c
,
param2
=
node
.
param2
})
return
itemstack
end
})
xdecor
.
register
(
"curtain_open_"
..
c
,
{
tiles
=
{
"wool_white.png^[colorize:"
..
c
..
":170^xdecor_curtain_open_overlay.png^[makealpha:255,126,126"
},
tiles
=
{
"wool_white.png^[colorize:"
..
c
..
":170^xdecor_curtain_open_overlay.png^[makealpha:255,126,126"
},
drawtype
=
"signlike"
,
paramtype2
=
"wallmounted"
,
walkable
=
false
,
groups
=
{
dig_immediate
=
3
,
flammable
=
3
,
not_in_creative_inventory
=
1
},
selection_box
=
{
type
=
"wallmounted"
},
drop
=
"xdecor:curtain_"
..
c
,
on_rightclick
=
function
(
pos
,
node
,
clicker
,
itemstack
,
pointed_thing
)
on_rightclick
=
function
(
pos
,
node
,
_
,
itemstack
)
minetest
.
set_node
(
pos
,
{
name
=
"xdecor:curtain_"
..
c
,
param2
=
node
.
param2
})
return
itemstack
end
...
...
@@ -200,8 +202,8 @@ for _, c in pairs({"red"}) do -- Add more curtains colors simply here
minetest
.
register_craft
({
output
=
"xdecor:curtain_"
..
c
..
" 4"
,
recipe
=
{
{
""
,
"wool:"
..
c
,
""
},
{
""
,
"wool:"
..
c
,
""
}
}
recipe
=
{{
""
,
"wool:"
..
c
,
""
},
{
""
,
"wool:"
..
c
,
""
}}
})
end
...
...
@@ -225,7 +227,10 @@ xdecor.register("cushion_block", {
groups
=
{
snappy
=
3
,
flammable
=
3
,
fall_damage_add_percent
=-
75
,
not_in_creative_inventory
=
1
}
})
local
function
door_access
(
name
)
return
name
:
find
(
"prison"
)
end
local
function
door_access
(
name
)
return
name
:
find
(
"prison"
)
end
local
xdecor_doors
=
{
japanese
=
{
{
"group:wood"
,
"default:paper"
},
...
...
@@ -313,7 +318,7 @@ xdecor.register("lantern", {
paramtype2
=
"wallmounted"
,
walkable
=
false
,
groups
=
{
snappy
=
3
,
attached_node
=
1
},
tiles
=
{{
name
=
"xdecor_lantern.png"
,
animation
=
{
type
=
"vertical_frames"
,
length
=
1
.
5
}}},
tiles
=
{{
name
=
"xdecor_lantern.png"
,
animation
=
{
type
=
"vertical_frames"
,
length
=
1
.
5
}}},
selection_box
=
xdecor
.
pixelbox
(
16
,
{{
4
,
0
,
4
,
8
,
16
,
8
}})
})
...
...
@@ -342,8 +347,8 @@ for _, f in pairs({"dandelion_white", "dandelion_yellow", "geranium",
minetest
.
register_craft
({
output
=
"xdecor:potted_"
..
f
,
recipe
=
{
{
"default:clay_brick"
,
"flowers:"
..
f
,
"default:clay_brick"
},
{
""
,
"default:clay_brick"
,
""
}
}
recipe
=
{{
"default:clay_brick"
,
"flowers:"
..
f
,
"default:clay_brick"
},
{
""
,
"default:clay_brick"
,
""
}}
})
end
...
...
@@ -367,8 +372,10 @@ xdecor.register("painting_1", {
node_placement_prediction
=
""
,
on_place
=
function
(
itemstack
,
placer
,
pointed_thing
)
local
num
=
math.random
(
4
)
local
leftover
=
minetest
.
item_place_node
(
ItemStack
(
"xdecor:painting_"
..
num
),
placer
,
pointed_thing
)
if
leftover
:
get_count
()
==
0
and
not
minetest
.
setting_getbool
(
"creative_mode"
)
then
local
leftover
=
minetest
.
item_place_node
(
ItemStack
(
"xdecor:painting_"
..
num
),
placer
,
pointed_thing
)
if
leftover
:
get_count
()
==
0
and
not
minetest
.
setting_getbool
(
"creative_mode"
)
then
itemstack
:
take_item
()
end
return
itemstack
...
...
@@ -381,7 +388,8 @@ for i = 2, 4 do
paramtype2
=
"wallmounted"
,
drop
=
"xdecor:painting_1"
,
sunlight_propagates
=
true
,
groups
=
{
choppy
=
3
,
oddly_breakable_by_hand
=
2
,
flammable
=
2
,
attached_node
=
1
,
not_in_creative_inventory
=
1
},
groups
=
{
choppy
=
3
,
oddly_breakable_by_hand
=
2
,
flammable
=
2
,
attached_node
=
1
,
not_in_creative_inventory
=
1
},
sounds
=
default
.
node_sound_wood_defaults
(),
node_box
=
painting_box
})
...
...
@@ -402,6 +410,7 @@ xdecor.register("stonepath", {
})
local
function
register_hard_node
(
name
,
desc
,
def
)
def
=
def
or
{}
xdecor
.
register
(
name
,
{
description
=
desc
,
tiles
=
{
"xdecor_"
..
name
..
".png"
},
...
...
@@ -410,13 +419,13 @@ local function register_hard_node(name, desc, def)
})
end
register_hard_node
(
"cactusbrick"
,
"Cactus Brick"
,
{}
)
register_hard_node
(
"coalstone_tile"
,
"Coal Stone Tile"
,
{}
)
register_hard_node
(
"desertstone_tile"
,
"Desert Stone Tile"
,
{}
)
register_hard_node
(
"hard_clay"
,
"Hardened Clay"
,
{}
)
register_hard_node
(
"moonbrick"
,
"Moon Brick"
,
{}
)
register_hard_node
(
"stone_tile"
,
"Stone Tile"
,
{}
)
register_hard_node
(
"stone_rune"
,
"Runestone"
,
{}
)
register_hard_node
(
"cactusbrick"
,
"Cactus Brick"
)
register_hard_node
(
"coalstone_tile"
,
"Coal Stone Tile"
)
register_hard_node
(
"desertstone_tile"
,
"Desert Stone Tile"
)
register_hard_node
(
"hard_clay"
,
"Hardened Clay"
)
register_hard_node
(
"moonbrick"
,
"Moon Brick"
)
register_hard_node
(
"stone_tile"
,
"Stone Tile"
)
register_hard_node
(
"stone_rune"
,
"Runestone"
)
register_hard_node
(
"packed_ice"
,
"Packed Ice"
,
{
groups
=
{
cracky
=
1
,
puts_out_fire
=
1
},
sounds
=
default
.
node_sound_glass_defaults
()
...
...
@@ -474,4 +483,3 @@ xdecor.register("woodframed_glass", {
groups
=
{
cracky
=
2
,
oddly_breakable_by_hand
=
1
},
sounds
=
default
.
node_sound_glass_defaults
()
})
This diff is collapsed.
Click to expand it.
src/workbench.lua
+
17
−
14
View file @
16ea4a73
...
...
@@ -2,11 +2,12 @@ local workbench = {}
WB
=
{}
screwdriver
=
screwdriver
or
{}
local
min
,
ceil
=
math.min
,
math.ceil
local
registered_nodes
=
minetest
.
registered_nodes
-- Nodes allowed to be cut
-- Only the regular, solid blocks without metas or explosivity can be cut
local
nodes
=
{}
for
node
,
def
in
pairs
(
minetest
.
registered_nodes
)
do
for
node
,
def
in
pairs
(
registered_nodes
)
do
if
(
def
.
drawtype
==
"normal"
or
def
.
drawtype
:
sub
(
1
,
5
)
==
"glass"
)
and
(
def
.
groups
.
cracky
or
def
.
groups
.
choppy
)
and
not
def
.
on_construct
and
...
...
@@ -77,10 +78,11 @@ end
function
workbench
:
get_output
(
inv
,
input
,
name
)
local
output
=
{}
for
_
,
n
in
pairs
(
self
.
defs
)
do
local
count
=
min
(
n
[
2
]
*
input
:
get_count
(),
input
:
get_stack_max
())
local
item
=
name
..
"_"
..
n
[
1
]
if
not
n
[
3
]
then
item
=
"stairs:"
..
n
[
1
]
..
"_"
..
name
:
match
(
":(.*)"
)
end
for
i
=
1
,
#
self
.
defs
do
local
nbox
=
self
.
defs
[
i
]
local
count
=
min
(
nbox
[
2
]
*
input
:
get_count
(),
input
:
get_stack_max
())
local
item
=
name
..
"_"
..
nbox
[
1
]
item
=
nbox
[
3
]
and
item
or
"stairs:"
..
nbox
[
1
]
..
"_"
..
name
:
match
(
":(.*)"
)
output
[
#
output
+
1
]
=
item
..
" "
..
count
end
inv
:
set_list
(
"forms"
,
output
)
...
...
@@ -117,7 +119,8 @@ local formspecs = {
}
function
workbench
:
set_formspec
(
meta
,
id
)
meta
:
set_string
(
"formspec"
,
"size[8,7;]list[current_player;main;0,3.25;8,4;]"
..
meta
:
set_string
(
"formspec"
,
"size[8,7;]list[current_player;main;0,3.25;8,4;]"
..
formspecs
[
id
]
..
xbg
..
default
.
get_hotbar_bg
(
0
,
3
.
25
))
end
...
...
@@ -136,10 +139,11 @@ function workbench.construct(pos)
end
function
workbench
.
fields
(
pos
,
_
,
fields
)
if
fields
.
quit
then
return
end
local
meta
=
minetest
.
get_meta
(
pos
)
if
fields
.
back
then
workbench
:
set_formspec
(
meta
,
1
)
elseif
fields
.
craft
then
workbench
:
set_formspec
(
meta
,
2
)
elseif
fields
.
storage
then
workbench
:
set_formspec
(
meta
,
3
)
end
workbench
:
set_formspec
(
meta
,
fields
.
back
and
1
or
fields
.
craft
and
2
or
fields
.
storage
and
3
)
end
function
workbench
.
dig
(
pos
)
...
...
@@ -172,7 +176,7 @@ function workbench.put(_, listname, _, stack)
local
stackname
=
stack
:
get_name
()
if
(
listname
==
"tool"
and
stack
:
get_wear
()
>
0
and
workbench
:
repairable
(
stackname
))
or
(
listname
==
"input"
and
minetest
.
registered_nodes
[
stackname
..
"_cube"
])
or
(
listname
==
"input"
and
registered_nodes
[
stackname
..
"_cube"
])
or
(
listname
==
"hammer"
and
stackname
==
"xdecor:hammer"
)
or
listname
==
"storage"
then
return
stack
:
get_count
()
...
...
@@ -243,7 +247,7 @@ xdecor.register("workbench", {
for
_
,
d
in
pairs
(
workbench
.
defs
)
do
for
i
=
1
,
#
nodes
do
local
node
=
nodes
[
i
]
local
def
=
minetest
.
registered_nodes
[
node
]
local
def
=
registered_nodes
[
node
]
if
d
[
3
]
then
local
groups
=
{}
...
...
@@ -257,7 +261,7 @@ for i=1, #nodes do
end
if
def
.
tiles
then
if
#
def
.
tiles
>
1
and
not
(
def
.
drawtype
:
sub
(
1
,
5
)
=
=
"glass"
)
then
if
#
def
.
tiles
>
1
and
(
def
.
drawtype
:
sub
(
1
,
5
)
~
=
"glass"
)
then
tiles
=
def
.
tiles
else
tiles
=
{
def
.
tiles
[
1
]}
...
...
@@ -266,7 +270,7 @@ for i=1, #nodes do
tiles
=
{
def
.
tile_images
[
1
]}
end
if
not
minetest
.
registered_nodes
[
"stairs:slab_"
..
node
:
match
(
":(.*)"
)]
then
if
not
registered_nodes
[
"stairs:slab_"
..
node
:
match
(
":(.*)"
)]
then
stairs
.
register_stair_and_slab
(
node
:
match
(
":(.*)"
),
node
,
groups
,
tiles
,
def
.
description
..
" Stair"
,
def
.
description
..
" Slab"
,
def
.
sounds
)
...
...
@@ -288,4 +292,3 @@ for i=1, #nodes do
end
end
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