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
a168d16d
Commit
a168d16d
authored
8 years ago
by
JPG
Browse files
Options
Downloads
Patches
Plain Diff
Minor cleanup
parent
627b80b4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/enchanting.lua
+5
-5
5 additions, 5 deletions
src/enchanting.lua
src/workbench.lua
+17
-18
17 additions, 18 deletions
src/workbench.lua
with
22 additions
and
23 deletions
src/enchanting.lua
+
5
−
5
View file @
a168d16d
...
...
@@ -42,10 +42,9 @@ function enchanting:get_tooltip(enchant, orig_caps, fleshy)
strong
=
{
"#ff3d3d"
,
""
},
speed
=
{
"#fd5eff"
,
""
}
}
return
minetest
.
colorize
and
minetest
.
colorize
(
specs
[
enchant
][
1
],
"
\n
"
..
cap
(
enchant
)
..
specs
[
enchant
][
2
])
or
"
\n
"
..
cap
(
enchant
)
..
specs
[
enchant
][
2
]
return
minetest
.
colorize
and
minetest
.
colorize
(
specs
[
enchant
][
1
],
"
\n
"
..
cap
(
enchant
)
..
specs
[
enchant
][
2
])
or
"
\n
"
..
cap
(
enchant
)
..
specs
[
enchant
][
2
]
end
local
enchant_buttons
=
{
...
...
@@ -159,7 +158,8 @@ function enchanting.destruct(pos)
for
_
,
obj
in
pairs
(
minetest
.
get_objects_inside_radius
(
pos
,
0
.
9
))
do
if
obj
and
obj
:
get_luaentity
()
and
obj
:
get_luaentity
().
name
==
"xdecor:book_open"
then
obj
:
remove
()
break
obj
:
remove
()
break
end
end
end
...
...
This diff is collapsed.
Click to expand it.
src/workbench.lua
+
17
−
18
View file @
a168d16d
...
...
@@ -3,8 +3,8 @@ WB = {}
screwdriver
=
screwdriver
or
{}
local
min
,
ceil
=
math.min
,
math.ceil
-- Nodes allowed to be cut
.
-- Only the regular, solid blocks without metas or explosivity can be cut
.
-- 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
if
(
def
.
drawtype
==
"normal"
or
def
.
drawtype
:
sub
(
1
,
5
)
==
"glass"
)
and
...
...
@@ -28,7 +28,7 @@ for node, def in pairs(minetest.registered_nodes) do
end
end
-- Optionally, you can register custom cuttable nodes in the workbench
.
-- Optionally, you can register custom cuttable nodes in the workbench
WB
.
custom_nodes_register
=
{
-- "default:leaves",
}
...
...
@@ -44,7 +44,7 @@ setmetatable(nodes, {
nodes
=
nodes
..
WB
.
custom_nodes_register
-- Nodeboxes definitions
.
-- Nodeboxes definitions
workbench
.
defs
=
{
-- Name Yield X Y Z W H L
{
"nanoslab"
,
16
,
{
0
,
0
,
0
,
8
,
1
,
8
}},
...
...
@@ -70,15 +70,15 @@ workbench.defs = {
-- Tools allowed to be repaired.
function
workbench
:
repairable
(
stack
)
local
tools
=
{
"pick"
,
"axe"
,
"shovel"
,
"sword"
,
"hoe"
,
"armor"
,
"shield"
}
for
_
,
t
in
pairs
(
tools
)
do
if
stack
:
find
(
t
)
then
return
true
end
for
i
=
1
,
#
tools
do
return
stack
:
find
(
t
ools
[
i
])
end
return
false
end
function
workbench
:
get_output
(
inv
,
input
,
name
)
if
inv
:
is_empty
(
"input"
)
then
inv
:
set_list
(
"forms"
,
{})
return
inv
:
set_list
(
"forms"
,
{})
return
end
local
output
=
{}
...
...
@@ -92,7 +92,7 @@ function workbench:get_output(inv, input, name)
end
local
formspecs
=
{
-- Main formspec
.
-- Main formspec
[[ label[0.9,1.23;Cut]
label[0.9,2.23;Repair]
box[-0.05,1;2.05,0.9;#555555]
...
...
@@ -107,14 +107,14 @@ local formspecs = {
list[context;tool;2,2;1,1;]
list[context;hammer;3,2;1,1;]
list[context;forms;4,0;4,3;] ]]
,
-- Crafting formspec
.
-- Crafting formspec
[[ image[5,1;1,1;gui_furnace_arrow_bg.png^[transformR270]
button[0,0;1.5,1;back;< Back]
list[current_player;craft;2,0;3,3;]
list[current_player;craftpreview;6,1;1,1;]
listring[current_player;main]
listring[current_player;craft] ]]
,
-- Storage formspec
.
-- Storage formspec
[[ list[context;storage;0,1;8,2;]
button[0,0;1.5,1;back;< Back]
listring[context;storage]
...
...
@@ -150,7 +150,7 @@ end
function
workbench
.
dig
(
pos
)
local
inv
=
minetest
.
get_meta
(
pos
):
get_inventory
()
return
inv
:
is_empty
(
"input"
)
and
inv
:
is_empty
(
"hammer"
)
and
inv
:
is_empty
(
"tool"
)
and
inv
:
is_empty
(
"storage"
)
inv
:
is_empty
(
"tool"
)
and
inv
:
is_empty
(
"storage"
)
end
function
workbench
.
timer
(
pos
)
...
...
@@ -160,7 +160,8 @@ function workbench.timer(pos)
local
hammer
=
inv
:
get_stack
(
"hammer"
,
1
)
if
tool
:
is_empty
()
or
hammer
:
is_empty
()
or
tool
:
get_wear
()
==
0
then
timer
:
stop
()
return
timer
:
stop
()
return
end
-- Tool's wearing range: 0-65535 | 0 = new condition.
...
...
@@ -187,15 +188,13 @@ end
function
workbench
.
take
(
_
,
listname
,
_
,
stack
,
player
)
if
listname
==
"forms"
then
local
inv
=
player
:
get_inventory
()
if
inv
:
room_for_item
(
"main"
,
stack
:
get_name
())
then
return
-
1
end
return
0
return
inv
:
room_for_item
(
"main"
,
stack
:
get_name
())
and
-
1
or
0
end
return
stack
:
get_count
()
end
function
workbench
.
move
(
_
,
from_list
,
_
,
to_list
,
_
,
count
)
if
to_list
==
"storage"
and
from_list
~=
"forms"
then
return
count
end
return
0
return
(
to_list
==
"storage"
and
from_list
~=
"forms"
)
and
count
or
0
end
function
workbench
.
on_put
(
pos
,
listname
,
_
,
stack
)
...
...
@@ -285,7 +284,7 @@ for i=1, #nodes do
sounds
=
def
.
sounds
,
tiles
=
tiles
,
groups
=
groups
,
-- `unpack` has been changed to `table.unpack` in newest Lua versions
.
-- `unpack` has been changed to `table.unpack` in newest Lua versions
node_box
=
xdecor
.
pixelbox
(
16
,
{
unpack
(
d
,
3
)}),
sunlight_propagates
=
true
,
on_place
=
minetest
.
rotate_node
...
...
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