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
Snippets
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
Zadrog Pzvotrügen
minetest_game
Commits
b36b1542
Commit
b36b1542
authored
8 years ago
by
tenplus1
Committed by
paramat
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Creative: Fix inventory crash after toggling creative mode in-game
parent
3976dc6a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mods/creative/init.lua
+7
-6
7 additions, 6 deletions
mods/creative/init.lua
with
7 additions
and
6 deletions
mods/creative/init.lua
+
7
−
6
View file @
b36b1542
...
...
@@ -2,6 +2,7 @@
creative
=
{}
local
player_inventory
=
{}
local
creative_mode
=
minetest
.
setting_getbool
(
"creative_mode"
)
-- Create detached creative inventory after loading all mods
creative
.
init_creative_inventory
=
function
(
player
)
...
...
@@ -14,7 +15,7 @@ creative.init_creative_inventory = function(player)
minetest
.
create_detached_inventory
(
"creative_"
..
player_name
,
{
allow_move
=
function
(
inv
,
from_list
,
from_index
,
to_list
,
to_index
,
count
,
player
)
if
minetest
.
setting_getbool
(
"
creative_mode
"
)
and
not
to_list
==
"main"
then
if
creative_mode
and
not
to_list
==
"main"
then
return
count
else
return
0
...
...
@@ -24,7 +25,7 @@ creative.init_creative_inventory = function(player)
return
0
end
,
allow_take
=
function
(
inv
,
listname
,
index
,
stack
,
player
)
if
minetest
.
setting_getbool
(
"
creative_mode
"
)
then
if
creative_mode
then
return
-
1
else
return
0
...
...
@@ -86,7 +87,7 @@ local trash = minetest.create_detached_inventory("creative_trash", {
-- Allow the stack to be placed and remove it in on_put()
-- This allows the creative inventory to restore the stack
allow_put
=
function
(
inv
,
listname
,
index
,
stack
,
player
)
if
minetest
.
setting_getbool
(
"
creative_mode
"
)
then
if
creative_mode
then
return
stack
:
get_count
()
else
return
0
...
...
@@ -155,7 +156,7 @@ end
minetest
.
register_on_joinplayer
(
function
(
player
)
-- If in creative mode, modify player's inventory forms
if
not
minetest
.
setting_getbool
(
"
creative_mode
"
)
then
if
not
creative_mode
then
return
end
creative
.
init_creative_inventory
(
player
)
...
...
@@ -163,7 +164,7 @@ minetest.register_on_joinplayer(function(player)
end
)
minetest
.
register_on_player_receive_fields
(
function
(
player
,
formname
,
fields
)
if
formname
~=
""
or
not
minetest
.
setting_getbool
(
"
creative_mode
"
)
then
if
formname
~=
""
or
not
creative_mode
then
return
end
...
...
@@ -216,7 +217,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
)
if
minetest
.
setting_getbool
(
"
creative_mode
"
)
then
if
creative_mode
then
local
digtime
=
0
.
5
local
caps
=
{
times
=
{
digtime
,
digtime
,
digtime
},
uses
=
0
,
maxlevel
=
3
}
...
...
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