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
231caefc
Commit
231caefc
authored
9 years ago
by
Jean-Patrick Guerrero
Browse files
Options
Downloads
Patches
Plain Diff
Turn repairable tools to be a function
parent
e69cf4fc
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
workbench.lua
+5
-5
5 additions, 5 deletions
workbench.lua
with
5 additions
and
5 deletions
workbench.lua
+
5
−
5
View file @
231caefc
...
...
@@ -38,9 +38,10 @@ workbench.defs = {
}
-- Tools allowed to be repaired.
workbench
.
repairable_tools
=
[[
pick, axe, shovel, sword, hoe, armor, shield
]]
function
workbench
:
repairable_tools
(
stack
)
local
tools
=
[[ pick, axe, shovel, sword, hoe, armor, shield ]]
return
tools
:
find
(
stack
:
match
(
":(%w+)"
))
end
function
workbench
:
get_output
(
inv
,
input
,
name
)
if
inv
:
is_empty
(
"input"
)
then
...
...
@@ -141,8 +142,7 @@ end
function
workbench
.
put
(
_
,
listname
,
_
,
stack
)
local
stackname
=
stack
:
get_name
()
if
(
listname
==
"tool"
and
stack
:
get_wear
()
>
0
and
workbench
.
repairable_tools
:
find
(
stackname
:
match
(
":(%w+)"
)))
or
if
(
listname
==
"tool"
and
stack
:
get_wear
()
>
0
and
workbench
:
repairable_tools
(
stackname
))
or
(
listname
==
"input"
and
minetest
.
registered_nodes
[
stackname
..
"_cube"
])
or
(
listname
==
"hammer"
and
stackname
==
"xdecor:hammer"
)
or
listname
==
"storage"
then
...
...
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