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
253af007
Commit
253af007
authored
10 years ago
by
Zheyu Shen
Committed by
ShadowNinja
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Don't create bones if the player's inventory is empty
parent
579c279b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mods/bones/init.lua
+8
-7
8 additions, 7 deletions
mods/bones/init.lua
with
8 additions
and
7 deletions
mods/bones/init.lua
+
8
−
7
View file @
253af007
...
...
@@ -51,10 +51,8 @@ minetest.register_node("bones:bones", {
on_metadata_inventory_take
=
function
(
pos
,
listname
,
index
,
stack
,
player
)
local
meta
=
minetest
.
get_meta
(
pos
)
if
meta
:
get_string
(
"owner"
)
~=
""
and
meta
:
get_inventory
():
is_empty
(
"main"
)
then
meta
:
set_string
(
"infotext"
,
meta
:
get_string
(
"owner"
)
..
"'s old bones"
)
meta
:
set_string
(
"formspec"
,
""
)
meta
:
set_string
(
"owner"
,
""
)
if
meta
:
get_inventory
():
is_empty
(
"main"
)
then
minetest
.
remove_node
(
pos
)
end
end
,
...
...
@@ -82,6 +80,12 @@ minetest.register_on_dieplayer(function(player)
return
end
local
player_inv
=
player
:
get_inventory
()
if
player_inv
:
is_empty
(
"main"
)
and
player_inv
:
is_empty
(
"craft"
)
then
return
end
local
pos
=
player
:
getpos
()
pos
.
x
=
math.floor
(
pos
.
x
+
0
.
5
)
pos
.
y
=
math.floor
(
pos
.
y
+
0
.
5
)
...
...
@@ -91,8 +95,6 @@ minetest.register_on_dieplayer(function(player)
local
nn
=
minetest
.
get_node
(
pos
).
name
if
minetest
.
registered_nodes
[
nn
].
can_dig
and
not
minetest
.
registered_nodes
[
nn
].
can_dig
(
pos
,
player
)
then
local
player_inv
=
player
:
get_inventory
()
for
i
=
1
,
player_inv
:
get_size
(
"main"
)
do
player_inv
:
set_stack
(
"main"
,
i
,
nil
)
end
...
...
@@ -107,7 +109,6 @@ minetest.register_on_dieplayer(function(player)
local
meta
=
minetest
.
get_meta
(
pos
)
local
inv
=
meta
:
get_inventory
()
local
player_inv
=
player
:
get_inventory
()
inv
:
set_size
(
"main"
,
8
*
4
)
local
empty_list
=
inv
:
get_list
(
"main"
)
...
...
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