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
fa15d1b7
Commit
fa15d1b7
authored
8 years ago
by
JP Guerrero
Browse files
Options
Downloads
Patches
Plain Diff
Workbench: add more registration filters
parent
01b8471b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/workbench.lua
+7
-5
7 additions, 5 deletions
src/workbench.lua
with
7 additions
and
5 deletions
src/workbench.lua
+
7
−
5
View file @
fa15d1b7
local
workbench
=
{}
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.
...
...
@@ -14,7 +15,8 @@ for node, def in pairs(minetest.registered_nodes) do
not
def
.
allow_metadata_inventory_take
and
not
(
def
.
groups
.
not_in_creative_inventory
==
1
)
and
not
def
.
groups
.
wool
and
not
def
.
description
:
find
(
"Ore"
)
and
not
def
.
tiles
[
1
]:
find
(
"default_mineral"
)
and
not
def
.
mesecons
and
def
.
description
and
def
.
description
~=
""
and
def
.
light_source
==
0
...
...
@@ -30,8 +32,8 @@ workbench.custom_nodes_register = {
setmetatable
(
nodes
,
{
__concat
=
function
(
t1
,
t2
)
for
k
in
pairs
(
t2
)
do
t1
[
#
t1
+
1
]
=
t2
[
k
]
for
i
=
1
,
#
t2
do
t1
[
#
t1
+
1
]
=
t2
[
i
]
end
return
t1
end
...
...
@@ -78,7 +80,7 @@ function workbench:get_output(inv, input, name)
local
output
=
{}
for
_
,
n
in
pairs
(
self
.
defs
)
do
local
count
=
math.
min
(
n
[
2
]
*
input
:
get_count
(),
input
:
get_stack_max
())
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
output
[
#
output
+
1
]
=
item
..
" "
..
count
...
...
@@ -214,7 +216,7 @@ function workbench.on_take(pos, listname, index, stack)
inv
:
set_list
(
"forms"
,
{})
end
elseif
listname
==
"forms"
then
input
:
take_item
(
math.
ceil
(
stack
:
get_count
()
/
workbench
.
defs
[
index
][
2
]))
input
:
take_item
(
ceil
(
stack
:
get_count
()
/
workbench
.
defs
[
index
][
2
]))
inv
:
set_stack
(
"input"
,
1
,
input
)
workbench
:
get_output
(
inv
,
input
,
input
:
get_name
())
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